From 351d1fc068e8c4d4dd9c5a2a883d21e3981128c1 Mon Sep 17 00:00:00 2001 From: Wisha Wa Date: Mon, 12 Oct 2020 01:27:35 +0700 Subject: [PATCH 0001/1135] ptx: improve performance by removing N^2 routine. --- src/uu/ptx/src/ptx.rs | 246 +++++++++++++++++++++++++++--------------- 1 file changed, 157 insertions(+), 89 deletions(-) diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index 3621e1bdf..3bc2ee297 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -182,8 +182,16 @@ fn get_config(matches: &Matches) -> Config { config } -fn read_input(input_files: &[String], config: &Config) -> HashMap, usize)> { - let mut file_map: HashMap, usize)> = HashMap::new(); +struct FileContent { + lines: Vec, + chars_lines: Vec>, + offset: usize, +} + +type FileMap = HashMap; + +fn read_input(input_files: &[String], config: &Config) -> FileMap { + let mut file_map: FileMap = HashMap::new(); let mut files = Vec::new(); if input_files.is_empty() { files.push("-"); @@ -194,7 +202,7 @@ fn read_input(input_files: &[String], config: &Config) -> HashMap> = BufReader::new(if filename == "-" { Box::new(stdin()) @@ -203,25 +211,33 @@ fn read_input(input_files: &[String], config: &Config) -> HashMap = reader.lines().map(|x| crash_if_err!(1, x)).collect(); + let ws_reg = Regex::new(r"[\t\n\v\f\r]").unwrap(); + let chars_lines: Vec> = lines + .iter() + .map(|x| ws_reg.replace_all(x, " ").chars().collect()) + .collect(); let size = lines.len(); - file_map.insert(filename.to_owned(), (lines, lines_so_far)); - lines_so_far += size + file_map.insert( + filename.to_owned(), + FileContent { + lines, + chars_lines, + offset, + }, + ); + offset += size } file_map } -fn create_word_set( - config: &Config, - filter: &WordFilter, - file_map: &HashMap, usize)>, -) -> BTreeSet { +fn create_word_set(config: &Config, filter: &WordFilter, file_map: &FileMap) -> BTreeSet { let reg = Regex::new(&filter.word_regex).unwrap(); let ref_reg = Regex::new(&config.context_regex).unwrap(); let mut word_set: BTreeSet = BTreeSet::new(); for (file, lines) in file_map.iter() { let mut count: usize = 0; - let offs = lines.1; - for line in &lines.0 { + let offs = lines.offset; + for line in &lines.lines { // if -r, exclude reference from word set let (ref_beg, ref_end) = match ref_reg.find(line) { Some(x) => (x.start(), x.end()), @@ -316,57 +332,73 @@ fn trim_idx(s: &[char], beg: usize, end: usize) -> (usize, usize) { } fn get_output_chunks( - all_before: &str, + all_before: &[char], keyword: &str, - all_after: &str, + all_after: &[char], config: &Config, ) -> (String, String, String, String) { - assert_eq!(all_before.trim(), all_before); - assert_eq!(keyword.trim(), keyword); - assert_eq!(all_after.trim(), all_after); - let mut head = String::new(); - let mut before = String::new(); - let mut after = String::new(); - let mut tail = String::new(); - - let half_line_size = cmp::max( - (config.line_width / 2) as isize - (2 * config.trunc_str.len()) as isize, + let half_line_size = (config.line_width / 2) as usize; + let max_before_size = cmp::max(half_line_size as isize - config.gap_size as isize, 0) as usize; + let max_after_size = cmp::max( + half_line_size as isize + - (2 * config.trunc_str.len()) as isize + - keyword.len() as isize + - 1, 0, ) as usize; - let max_after_size = cmp::max(half_line_size as isize - keyword.len() as isize - 1, 0) as usize; - let max_before_size = half_line_size; - let all_before_vec: Vec = all_before.chars().collect(); - let all_after_vec: Vec = all_after.chars().collect(); + + let mut head = String::with_capacity(half_line_size); + let mut before = String::with_capacity(half_line_size); + let mut after = String::with_capacity(half_line_size); + let mut tail = String::with_capacity(half_line_size); // get before - let mut bb_tmp = cmp::max(all_before.len() as isize - max_before_size as isize, 0) as usize; - bb_tmp = trim_broken_word_left(&all_before_vec, bb_tmp, all_before.len()); - let (before_beg, before_end) = trim_idx(&all_before_vec, bb_tmp, all_before.len()); - before.push_str(&all_before[before_beg..before_end]); + let (_, be) = trim_idx(all_before, 0, all_before.len()); + let mut bb_tmp = cmp::max(be as isize - max_before_size as isize, 0) as usize; + bb_tmp = trim_broken_word_left(all_before, bb_tmp, be); + let (before_beg, before_end) = trim_idx(all_before, bb_tmp, be); + let before_str: String = all_before[before_beg..before_end].iter().collect(); + before.push_str(&before_str); assert!(max_before_size >= before.len()); // get after let mut ae_tmp = cmp::min(max_after_size, all_after.len()); - ae_tmp = trim_broken_word_right(&all_after_vec, 0, ae_tmp); - let (after_beg, after_end) = trim_idx(&all_after_vec, 0, ae_tmp); - after.push_str(&all_after[after_beg..after_end]); + ae_tmp = trim_broken_word_right(all_after, 0, ae_tmp); + let (_, after_end) = trim_idx(all_after, 0, ae_tmp); + let after_str: String = all_after[0..after_end].iter().collect(); + after.push_str(&after_str); assert!(max_after_size >= after.len()); // get tail - let max_tail_size = max_before_size - before.len(); - let (tb, _) = trim_idx(&all_after_vec, after_end, all_after.len()); - let mut te_tmp = cmp::min(tb + max_tail_size, all_after.len()); - te_tmp = trim_broken_word_right(&all_after_vec, tb, te_tmp); - let (tail_beg, tail_end) = trim_idx(&all_after_vec, tb, te_tmp); - tail.push_str(&all_after[tail_beg..tail_end]); + let max_tail_size = cmp::max( + max_before_size as isize - before.len() as isize - config.gap_size as isize, + 0, + ) as usize; + let (tb, _) = trim_idx(all_after, after_end, all_after.len()); + let mut te_tmp = cmp::min(all_after.len(), tb + max_tail_size) as usize; + te_tmp = trim_broken_word_right( + all_after, + tb, + cmp::max(te_tmp as isize - 1, tb as isize) as usize, + ); + let (tail_beg, tail_end) = trim_idx(all_after, tb, te_tmp); + let tail_str: String = all_after[tail_beg..tail_end].iter().collect(); + tail.push_str(&tail_str); // get head - let max_head_size = max_after_size - after.len(); - let (_, he) = trim_idx(&all_before_vec, 0, before_beg); - let mut hb_tmp = cmp::max(he as isize - max_head_size as isize, 0) as usize; - hb_tmp = trim_broken_word_left(&all_before_vec, hb_tmp, he); - let (head_beg, head_end) = trim_idx(&all_before_vec, hb_tmp, he); - head.push_str(&all_before[head_beg..head_end]); + let max_head_size = cmp::max( + max_after_size as isize - after.len() as isize - config.gap_size as isize, + 0, + ) as usize; + let (_, he) = trim_idx(all_before, 0, before_beg); + let hb_tmp = trim_broken_word_left( + all_before, + cmp::max(he as isize - max_head_size as isize, 0) as usize, + he, + ); + let (head_beg, head_end) = trim_idx(all_before, hb_tmp, he); + let head_str: String = all_before[head_beg..head_end].iter().collect(); + head.push_str(&head_str); // put right context truncation string if needed if after_end != all_after.len() && tail_beg == tail_end { @@ -382,11 +414,6 @@ fn get_output_chunks( head = format!("{}{}", config.trunc_str, head); } - // add space before "after" if needed - if !after.is_empty() { - after = format!(" {}", after); - } - (tail, before, after, head) } @@ -399,70 +426,94 @@ fn tex_mapper(x: char) -> String { } } -fn adjust_tex_str(context: &str) -> String { - let ws_reg = Regex::new(r"[\t\n\v\f\r ]").unwrap(); - let mut fix: String = ws_reg.replace_all(context, " ").trim().to_owned(); - let mapped_chunks: Vec = fix.chars().map(tex_mapper).collect(); - fix = mapped_chunks.join(""); - fix +fn format_tex_field(s: &str) -> String { + let mapped_chunks: Vec = s.chars().map(tex_mapper).collect(); + mapped_chunks.join("") } -fn format_tex_line(config: &Config, word_ref: &WordRef, line: &str, reference: &str) -> String { +fn format_tex_line( + config: &Config, + word_ref: &WordRef, + line: &str, + chars_line: &[char], + reference: &str, +) -> String { let mut output = String::new(); output.push_str(&format!("\\{} ", config.macro_name)); let all_before = if config.input_ref { let before = &line[0..word_ref.position]; - adjust_tex_str(before.trim().trim_start_matches(reference)) + let before_start_trimoff = + word_ref.position - before.trim_start_matches(reference).trim_start().len(); + let before_end_index = before.len(); + &chars_line[before_start_trimoff..cmp::max(before_end_index, before_start_trimoff)] } else { - adjust_tex_str(&line[0..word_ref.position]) + let before_chars_trim_idx = (0, word_ref.position); + &chars_line[before_chars_trim_idx.0..before_chars_trim_idx.1] }; - let keyword = adjust_tex_str(&line[word_ref.position..word_ref.position_end]); - let all_after = adjust_tex_str(&line[word_ref.position_end..line.len()]); + let keyword = &line[word_ref.position..word_ref.position_end]; + let after_chars_trim_idx = (word_ref.position_end, chars_line.len()); + let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1]; let (tail, before, after, head) = get_output_chunks(&all_before, &keyword, &all_after, &config); output.push_str(&format!( "{5}{0}{6}{5}{1}{6}{5}{2}{6}{5}{3}{6}{5}{4}{6}", - tail, before, keyword, after, head, "{", "}" + format_tex_field(&tail), + format_tex_field(&before), + format_tex_field(keyword), + format_tex_field(&after), + format_tex_field(&head), + "{", + "}" )); if config.auto_ref || config.input_ref { - output.push_str(&format!("{}{}{}", "{", adjust_tex_str(&reference), "}")); + output.push_str(&format!("{}{}{}", "{", format_tex_field(&reference), "}")); } output } -fn adjust_roff_str(context: &str) -> String { - let ws_reg = Regex::new(r"[\t\n\v\f\r]").unwrap(); - ws_reg - .replace_all(context, " ") - .replace("\"", "\"\"") - .trim() - .to_owned() +fn format_roff_field(s: &str) -> String { + s.replace("\"", "\"\"") } -fn format_roff_line(config: &Config, word_ref: &WordRef, line: &str, reference: &str) -> String { +fn format_roff_line( + config: &Config, + word_ref: &WordRef, + line: &str, + chars_line: &[char], + reference: &str, +) -> String { let mut output = String::new(); output.push_str(&format!(".{}", config.macro_name)); let all_before = if config.input_ref { let before = &line[0..word_ref.position]; - adjust_roff_str(before.trim().trim_start_matches(reference)) + let before_start_trimoff = + word_ref.position - before.trim_start_matches(reference).trim_start().len(); + let before_end_index = before.len(); + &chars_line[before_start_trimoff..cmp::max(before_end_index, before_start_trimoff)] } else { - adjust_roff_str(&line[0..word_ref.position]) + let before_chars_trim_idx = (0, word_ref.position); + &chars_line[before_chars_trim_idx.0..before_chars_trim_idx.1] }; - let keyword = adjust_roff_str(&line[word_ref.position..word_ref.position_end]); - let all_after = adjust_roff_str(&line[word_ref.position_end..line.len()]); + let keyword = &line[word_ref.position..word_ref.position_end]; + let after_chars_trim_idx = (word_ref.position_end, chars_line.len()); + let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1]; let (tail, before, after, head) = get_output_chunks(&all_before, &keyword, &all_after, &config); output.push_str(&format!( " \"{}\" \"{}\" \"{}{}\" \"{}\"", - tail, before, keyword, after, head + format_roff_field(&tail), + format_roff_field(&before), + format_roff_field(keyword), + format_roff_field(&after), + format_roff_field(&head) )); if config.auto_ref || config.input_ref { - output.push_str(&format!(" \"{}\"", adjust_roff_str(&reference))); + output.push_str(&format!(" \"{}\"", format_roff_field(&reference))); } output } fn write_traditional_output( config: &Config, - file_map: &HashMap, usize)>, + file_map: &FileMap, words: &BTreeSet, output_filename: &str, ) { @@ -472,19 +523,36 @@ fn write_traditional_output( let file = crash_if_err!(1, File::create(output_filename)); Box::new(file) }); + for word_ref in words.iter() { - let file_map_value: &(Vec, usize) = file_map + let file_map_value: &FileContent = file_map .get(&(word_ref.filename)) .expect("Missing file in file map"); - let (ref lines, _) = *(file_map_value); - let reference = get_reference(config, word_ref, &lines[word_ref.local_line_nr]); + let FileContent { + ref lines, + ref chars_lines, + offset: _, + } = *(file_map_value); + let reference = get_reference( + config, + word_ref, + &lines[word_ref.local_line_nr], + ); let output_line: String = match config.format { - OutFormat::Tex => { - format_tex_line(config, word_ref, &lines[word_ref.local_line_nr], &reference) - } - OutFormat::Roff => { - format_roff_line(config, word_ref, &lines[word_ref.local_line_nr], &reference) - } + OutFormat::Tex => format_tex_line( + config, + word_ref, + &lines[word_ref.local_line_nr], + &chars_lines[word_ref.local_line_nr], + &reference, + ), + OutFormat::Roff => format_roff_line( + config, + word_ref, + &lines[word_ref.local_line_nr], + &chars_lines[word_ref.local_line_nr], + &reference, + ), OutFormat::Dumb => crash!(1, "There is no dumb format with GNU extensions disabled"), }; crash_if_err!(1, writeln!(writer, "{}", output_line)); From b387565ba3d4a8761cd0462bb79a26b8c6b46ae5 Mon Sep 17 00:00:00 2001 From: Wisha Wa Date: Mon, 12 Oct 2020 01:59:06 +0700 Subject: [PATCH 0002/1135] ptx: remove unneeded regex and reduce repetitive regex compilations --- src/uu/ptx/src/ptx.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index 3bc2ee297..6981eeacc 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -211,11 +211,7 @@ fn read_input(input_files: &[String], config: &Config) -> FileMap { Box::new(file) }); let lines: Vec = reader.lines().map(|x| crash_if_err!(1, x)).collect(); - let ws_reg = Regex::new(r"[\t\n\v\f\r]").unwrap(); - let chars_lines: Vec> = lines - .iter() - .map(|x| ws_reg.replace_all(x, " ").chars().collect()) - .collect(); + let chars_lines: Vec> = lines.iter().map(|x| x.chars().collect()).collect(); let size = lines.len(); file_map.insert( filename.to_owned(), @@ -274,12 +270,11 @@ fn create_word_set(config: &Config, filter: &WordFilter, file_map: &FileMap) -> word_set } -fn get_reference(config: &Config, word_ref: &WordRef, line: &str) -> String { +fn get_reference(config: &Config, word_ref: &WordRef, line: &str, context_reg: &Regex) -> String { if config.auto_ref { format!("{}:{}", word_ref.filename, word_ref.local_line_nr + 1) } else if config.input_ref { - let reg = Regex::new(&config.context_regex).unwrap(); - let (beg, end) = match reg.find(line) { + let (beg, end) = match context_reg.find(line) { Some(x) => (x.start(), x.end()), None => (0, 0), }; @@ -524,6 +519,8 @@ fn write_traditional_output( Box::new(file) }); + let context_reg = Regex::new(&config.context_regex).unwrap(); + for word_ref in words.iter() { let file_map_value: &FileContent = file_map .get(&(word_ref.filename)) @@ -537,6 +534,7 @@ fn write_traditional_output( config, word_ref, &lines[word_ref.local_line_nr], + &context_reg, ); let output_line: String = match config.format { OutFormat::Tex => format_tex_line( From eb8cdcf44aa4bc452493465e09b4de2dbd994ba0 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sat, 20 Feb 2021 15:07:47 +0000 Subject: [PATCH 0003/1135] Re-add fixed test --- .github/workflows/GNU.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index b1cbc1502..c599a454c 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -55,7 +55,6 @@ jobs: grep -rl 'path_prepend_' tests/* | xargs sed -i 's|path_prepend_ ./src||' sed -i -e 's|^seq |/usr/bin/seq |' tests/factor/t*sh sed -i -e '/tests\/misc\/cat-self.sh/ D' Makefile # issue #1707 - sed -i -e '/tests\/misc\/numfmt.pl/ D' Makefile # issue #1708 sed -i -e '/tests\/chown\/preserve-root.sh/ D' Makefile # issue #1709 sed -i -e '/tests\/cp\/file-perm-race.sh/ D' Makefile # issue #1710 sed -i -e '/tests\/cp\/special-f.sh/ D' Makefile # issue #1710 From a73c34c7355a198e48c86fa1308ed9a2fad87f65 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sat, 20 Feb 2021 17:17:03 +0000 Subject: [PATCH 0004/1135] Stop tests failing on utils that aren't the focu of the test --- .github/workflows/GNU.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index c599a454c..6ec44cf22 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -74,6 +74,16 @@ jobs: sed -i -e '/tests\/tail-2\/pid.sh/ D' Makefile # hangs on github, tail doesn't support -f sed -i -e'/incompat4/ D' -e"/options '-co' are incompatible/ d" tests/misc/sort.pl # Sort doesn't correctly check for incompatible options, waits for input + # Use the system coreutils where the test fails due to error in a util that is not the one being tested + sed -i -e 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/chgrp/basic.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh + sed -i -e 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh + sed -i -e 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh + sed -i -e 's|timeout |/usr/bin/timeout |' tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh misc/sort-NaN-infloop.log tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh + sed -i -e 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh + sed -i -e 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh + sed -i -e 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh + sed -i -e 's|truncate |/usr/bin/truncate |' tests/split/fail.sh + test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" - name: Run GNU tests shell: bash From b3dea739f4d4ff1433ccf05f769cfaa1371184f6 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Feb 2021 09:36:03 +0000 Subject: [PATCH 0005/1135] Fix script name --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 6ec44cf22..f9390a3f0 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -78,7 +78,7 @@ jobs: sed -i -e 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/chgrp/basic.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh sed -i -e 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh sed -i -e 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i -e 's|timeout |/usr/bin/timeout |' tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh misc/sort-NaN-infloop.log tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh + sed -i -e 's|timeout |/usr/bin/timeout |' tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.log tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh sed -i -e 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh sed -i -e 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh sed -i -e 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh From 910f6d102f529b10c75fb3fa5696da0b9c15cc21 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Feb 2021 09:53:11 +0000 Subject: [PATCH 0006/1135] Fix script name --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index f9390a3f0..9e0d66eee 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -78,7 +78,7 @@ jobs: sed -i -e 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/chgrp/basic.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh sed -i -e 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh sed -i -e 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i -e 's|timeout |/usr/bin/timeout |' tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.log tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh + sed -i -e 's|timeout |/usr/bin/timeout |' tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh sed -i -e 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh sed -i -e 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh sed -i -e 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh From f2013e47b3789fc22fd8bed0383154d5d1235c8d Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Feb 2021 11:14:14 +0000 Subject: [PATCH 0007/1135] Use which to find system utils --- .github/workflows/GNU.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 9e0d66eee..15bab8b3f 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -75,14 +75,14 @@ jobs: sed -i -e'/incompat4/ D' -e"/options '-co' are incompatible/ d" tests/misc/sort.pl # Sort doesn't correctly check for incompatible options, waits for input # Use the system coreutils where the test fails due to error in a util that is not the one being tested - sed -i -e 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/chgrp/basic.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh - sed -i -e 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh - sed -i -e 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i -e 's|timeout |/usr/bin/timeout |' tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh - sed -i -e 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh - sed -i -e 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh - sed -i -e 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh - sed -i -e 's|truncate |/usr/bin/truncate |' tests/split/fail.sh + sed -i -e "s|stat|$(which stat)|" tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh + sed -i -e "s|ls -|$(which ls) -|" tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh + sed -i -e "s|mkdir |$(which mkdir) |" tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh + sed -i -e "s|timeout |$(which timeout) |" tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh + sed -i -e "s|chmod |$(which chmod) |" tests/du/inacc-dir.sh tests/mkdir/p-3.sh + sed -i -e "s|sort |$(which sort) |" tests/ls/hyperlink.sh + sed -i -e "s|split |$(which split) |" tests/misc/factor-parallel.sh + sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" - name: Run GNU tests From cebb58c5b486853a7dedaba0e68a8b022f83dc64 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Feb 2021 13:36:16 +0000 Subject: [PATCH 0008/1135] Rename install for testing --- .github/workflows/GNU.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 15bab8b3f..c92d90076 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -37,6 +37,7 @@ jobs: sudo apt-get install autoconf autopoint bison texinfo gperf gcc g++ gdb python-pyinotify expect python3-sphinx pushd uutils make PROFILE=release + cp target/release/install target/release/ginstall # The GNU tests rename this script before running, to avoid confusion with the make target BUILDDIR="$PWD/target/release/" popd GNULIB_SRCDIR="$PWD/gnulib" From 4e90de44cc0e8f28b8d86b9218985b71da472017 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Feb 2021 15:51:03 +0000 Subject: [PATCH 0009/1135] Move timeout to per-test script Move to a timeout applied to each script and re add the tests that are hanging so they show as failing --- .github/workflows/GNU.yml | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index c92d90076..82494bdd7 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -44,6 +44,8 @@ jobs: pushd gnu/ ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" ./configure --quiet --disable-gcc-warnings + #Add timeout to tests to protest against hangs + sed -i -e 's|"\$@|timeout 600 "\$@|' build-aux/test-driver # Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile sed -i 's| tr | /usr/bin/tr |' tests/init.sh @@ -55,25 +57,13 @@ jobs: done grep -rl 'path_prepend_' tests/* | xargs sed -i 's|path_prepend_ ./src||' sed -i -e 's|^seq |/usr/bin/seq |' tests/factor/t*sh - sed -i -e '/tests\/misc\/cat-self.sh/ D' Makefile # issue #1707 - sed -i -e '/tests\/chown\/preserve-root.sh/ D' Makefile # issue #1709 - sed -i -e '/tests\/cp\/file-perm-race.sh/ D' Makefile # issue #1710 - sed -i -e '/tests\/cp\/special-f.sh/ D' Makefile # issue #1710 - sed -i -e '/tests\/mv\/mv-special-1.sh/ D' Makefile # issue #1710 - sed -i -e '/tests\/dd\/stats.sh/ D' Makefile # issue #1710 - sed -i -e '/tests\/cp\/existing-perm-race.sh/ D' Makefile # hangs, cp doesn't implement --copy-contents - # Remove tests that rely on seq with large numbers. See issue #1703 - sed -i -e '/tests\/misc\/seq.pl/ D' \ - -e '/tests\/misc\/seq-precision.sh/D' \ - Makefile + # Remove tests checking for --version & --help # Not really interesting for us and logs are too big sed -i -e '/tests\/misc\/invalid-opt.pl/ D' \ -e '/tests\/misc\/help-version.sh/ D' \ -e '/tests\/misc\/help-version-getopt.sh/ D' \ Makefile - sed -i -e '/tests\/tail-2\/pid.sh/ D' Makefile # hangs on github, tail doesn't support -f - sed -i -e'/incompat4/ D' -e"/options '-co' are incompatible/ d" tests/misc/sort.pl # Sort doesn't correctly check for incompatible options, waits for input # Use the system coreutils where the test fails due to error in a util that is not the one being tested sed -i -e "s|stat|$(which stat)|" tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh @@ -93,7 +83,7 @@ jobs: GNULIB_DIR="${PWD}/gnulib" pushd gnu - unbuffer timeout -sKILL 3600 make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : + unbuffer make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : - name: Extract tests info shell: bash run: | From 89f74948e0db872bd9b4722ec8dd822bef7e34db Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Feb 2021 15:52:18 +0000 Subject: [PATCH 0010/1135] Typo --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 82494bdd7..1541be1a4 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -44,7 +44,7 @@ jobs: pushd gnu/ ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" ./configure --quiet --disable-gcc-warnings - #Add timeout to tests to protest against hangs + #Add timeout to to protect against hangs sed -i -e 's|"\$@|timeout 600 "\$@|' build-aux/test-driver # Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile From 16c8b3cbba351898335c0e6b21857b3fe57920b3 Mon Sep 17 00:00:00 2001 From: James Robson Date: Mon, 22 Feb 2021 09:19:43 +0000 Subject: [PATCH 0011/1135] Use system timeout command --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 1541be1a4..2ce9e44a5 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -45,7 +45,7 @@ jobs: ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" ./configure --quiet --disable-gcc-warnings #Add timeout to to protect against hangs - sed -i -e 's|"\$@|timeout 600 "\$@|' build-aux/test-driver + sed -i -e "s|\"\$@|$(which timeout) 600 \"\$@|" build-aux/test-driver # Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile sed -i 's| tr | /usr/bin/tr |' tests/init.sh From b92b88a8229e1d80455d6a3a97fdf7ead2b25f1e Mon Sep 17 00:00:00 2001 From: James Robson Date: Mon, 22 Feb 2021 19:29:00 +0000 Subject: [PATCH 0012/1135] Add 4 hour global timeout for protection --- .github/workflows/GNU.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 2ce9e44a5..0af969220 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -6,6 +6,7 @@ jobs: gnu: name: Run GNU tests runs-on: ubuntu-latest + timeout-minutes: 240 # Kill after 4 hours in case something gets stuck steps: # Checks out a copy of your repository on the ubuntu-latest machine - name: Checkout code uutil From dc49415829ba8eddd0486bd2503b29df3cca65ff Mon Sep 17 00:00:00 2001 From: James Robson Date: Mon, 22 Feb 2021 19:29:45 +0000 Subject: [PATCH 0013/1135] Stop seq-precision.sh causing jams in make --- .github/workflows/GNU.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 0af969220..024112f8a 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -76,6 +76,9 @@ jobs: sed -i -e "s|split |$(which split) |" tests/misc/factor-parallel.sh sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh + #Add specific timeout to seq-precision.sh because otherwise seq will fill logs and cause something to jam in make + sed -i -e "s| seq |$(which timeout) 1 seq |" tests/misc/seq-precision.sh + test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" - name: Run GNU tests shell: bash From b19afebad8a62037aff0e1ea3c05b25808885b8c Mon Sep 17 00:00:00 2001 From: James Robson Date: Tue, 23 Feb 2021 09:58:06 +0000 Subject: [PATCH 0014/1135] Shorten the timeout on seq-precision --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 024112f8a..b9b014dbf 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -77,7 +77,7 @@ jobs: sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh #Add specific timeout to seq-precision.sh because otherwise seq will fill logs and cause something to jam in make - sed -i -e "s| seq |$(which timeout) 1 seq |" tests/misc/seq-precision.sh + sed -i -e "s| seq |$(which timeout) 0.1 seq |" tests/misc/seq-precision.sh test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" - name: Run GNU tests From e89387c089344a6763f94239673437909aa66c44 Mon Sep 17 00:00:00 2001 From: James Robson Date: Tue, 23 Feb 2021 19:49:11 +0000 Subject: [PATCH 0015/1135] Try removing seq-precision --- .github/workflows/GNU.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index b9b014dbf..30c109cda 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -76,9 +76,8 @@ jobs: sed -i -e "s|split |$(which split) |" tests/misc/factor-parallel.sh sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh - #Add specific timeout to seq-precision.sh because otherwise seq will fill logs and cause something to jam in make - sed -i -e "s| seq |$(which timeout) 0.1 seq |" tests/misc/seq-precision.sh - + # take seq-precision out + sed -i '/seq-precision.sh/ D' Makefile test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" - name: Run GNU tests shell: bash From 4cca2b651ad72a9683d9def7f8b2168e9bfab8f0 Mon Sep 17 00:00:00 2001 From: James Robson Date: Wed, 24 Feb 2021 17:28:20 +0000 Subject: [PATCH 0016/1135] Keep producing logs even if make hangs --- .github/workflows/GNU.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 30c109cda..a6e740319 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -6,7 +6,6 @@ jobs: gnu: name: Run GNU tests runs-on: ubuntu-latest - timeout-minutes: 240 # Kill after 4 hours in case something gets stuck steps: # Checks out a copy of your repository on the ubuntu-latest machine - name: Checkout code uutil @@ -86,7 +85,7 @@ jobs: GNULIB_DIR="${PWD}/gnulib" pushd gnu - unbuffer make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : + unbuffer timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make - name: Extract tests info shell: bash run: | From 1cef9aa0462e5e9c8517965d983262493785487b Mon Sep 17 00:00:00 2001 From: James Robson Date: Wed, 24 Feb 2021 17:47:30 +0000 Subject: [PATCH 0017/1135] Add timeouts to other tests that hang --- .github/workflows/GNU.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index a6e740319..cebd5550e 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -69,14 +69,17 @@ jobs: sed -i -e "s|stat|$(which stat)|" tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh sed -i -e "s|ls -|$(which ls) -|" tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh sed -i -e "s|mkdir |$(which mkdir) |" tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i -e "s|timeout |$(which timeout) |" tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh + sed -i -e "s|timeout |$(which timeout) |" tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh sed -i -e "s|chmod |$(which chmod) |" tests/du/inacc-dir.sh tests/mkdir/p-3.sh sed -i -e "s|sort |$(which sort) |" tests/ls/hyperlink.sh sed -i -e "s|split |$(which split) |" tests/misc/factor-parallel.sh sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh - # take seq-precision out - sed -i '/seq-precision.sh/ D' Makefile + #Add specific timeout to tests that currently hang to limit time spent waiting + sed -i -e "s| seq |$(which timeout) 0.1 seq |" tests/misc/seq-precision.sh + sed -i -e "s|cat |$(which timeout) 0.1 cat |" tests/misc/cat-self.sh + + test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" - name: Run GNU tests shell: bash From 03619d867ebd00ff87addf05b4e66cd4a1ee070e Mon Sep 17 00:00:00 2001 From: James Robson Date: Thu, 25 Feb 2021 18:18:30 +0000 Subject: [PATCH 0018/1135] More tight timeouts --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index cebd5550e..6739a12b5 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -76,7 +76,7 @@ jobs: sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh #Add specific timeout to tests that currently hang to limit time spent waiting - sed -i -e "s| seq |$(which timeout) 0.1 seq |" tests/misc/seq-precision.sh + sed -i -e "s|seq \\$|$(which timeout) 0.1 seq \$|" tests/misc/seq-precision.sh tests/misc/seq-long-double.sh sed -i -e "s|cat |$(which timeout) 0.1 cat |" tests/misc/cat-self.sh From bbce17911596c54891154988b86e32241e9351e6 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sat, 27 Feb 2021 13:25:13 +0000 Subject: [PATCH 0019/1135] Remove unbuffer This causes the make process to hang for some reason, and it itsn't providing any real advantage so it's taken out --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 6739a12b5..fb2e231d4 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -88,7 +88,7 @@ jobs: GNULIB_DIR="${PWD}/gnulib" pushd gnu - unbuffer timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make + timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make - name: Extract tests info shell: bash run: | From a395af7ee761aef1041567edecebe46bf6382fcd Mon Sep 17 00:00:00 2001 From: James Robson Date: Sat, 27 Feb 2021 14:35:31 +0000 Subject: [PATCH 0020/1135] Create *sum binaries for tests --- .github/workflows/GNU.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index fb2e231d4..528d62863 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -38,6 +38,12 @@ jobs: pushd uutils make PROFILE=release cp target/release/install target/release/ginstall # The GNU tests rename this script before running, to avoid confusion with the make target + # Create *sum binaries + for sum in b2sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum + do + sum_path="target/release/${sum}" + fest -f "${sum_path}" || cp target/release/hashsum "${sum_path}" + done BUILDDIR="$PWD/target/release/" popd GNULIB_SRCDIR="$PWD/gnulib" From 20082971be5d47fd13ad2ae928de8574cedfc8fb Mon Sep 17 00:00:00 2001 From: James Robson Date: Thu, 4 Mar 2021 17:33:31 +0000 Subject: [PATCH 0021/1135] Use system sha1sum in factor tests --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 528d62863..3a9864ae1 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -62,7 +62,7 @@ jobs: make tests/factor/t${i}.sh done grep -rl 'path_prepend_' tests/* | xargs sed -i 's|path_prepend_ ./src||' - sed -i -e 's|^seq |/usr/bin/seq |' tests/factor/t*sh + sed -i -e 's|^seq |/usr/bin/seq |' -e "s|sha1sum |$(which sha1sum) |" tests/factor/t*sh # Remove tests checking for --version & --help # Not really interesting for us and logs are too big From 3b9399513293f9225b8050326507ac9cc44487b8 Mon Sep 17 00:00:00 2001 From: James Robson Date: Thu, 4 Mar 2021 19:11:38 +0000 Subject: [PATCH 0022/1135] generate all factor scripts --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 3a9864ae1..91796214c 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -57,7 +57,7 @@ jobs: sed -i 's| tr | /usr/bin/tr |' tests/init.sh make # Generate the factor tests, so they can be fixed - for i in $(seq -w 1 36) + for i in $(seq -w 0 36) do make tests/factor/t${i}.sh done From e42479b79b5ba63a87ef902da684ec3ed28f2f1e Mon Sep 17 00:00:00 2001 From: James Robson Date: Thu, 4 Mar 2021 20:50:57 +0000 Subject: [PATCH 0023/1135] fail tests for any binary not built --- .github/workflows/GNU.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 91796214c..f6729d0d1 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -37,17 +37,26 @@ jobs: sudo apt-get install autoconf autopoint bison texinfo gperf gcc g++ gdb python-pyinotify expect python3-sphinx pushd uutils make PROFILE=release - cp target/release/install target/release/ginstall # The GNU tests rename this script before running, to avoid confusion with the make target + BUILDDIR="$PWD/target/release/" + cp ${BUILDDIR}/install ${BUILDDIR}/ginstall # The GNU tests rename this script before running, to avoid confusion with the make target # Create *sum binaries for sum in b2sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum do - sum_path="target/release/${sum}" - fest -f "${sum_path}" || cp target/release/hashsum "${sum_path}" + sum_path="${BUILDDIR}/${sum}" + test -f "${sum_path}" || cp "${BUILDDIR}/hashsum" "${sum_path}" done - BUILDDIR="$PWD/target/release/" + test -f "${BUILDDIR}/[" || cp "${BUILDDIR}/test" "${BUILDDIR}/[" popd GNULIB_SRCDIR="$PWD/gnulib" pushd gnu/ + + # Any binaries that aren't built become `false` so their tests fail + for binary in $(./build-aux/gen-lists-of-programs.sh --list-progs) + do + bin_path="${BUILDDIR}/${binary}" + test -f "${bin_path}" || cp "${BUILDDIR}/false" "${bin_path}" + done + ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" ./configure --quiet --disable-gcc-warnings #Add timeout to to protect against hangs From b098bd5ec2e7523c7eb659bee927edf32c8680bc Mon Sep 17 00:00:00 2001 From: James Robson Date: Fri, 5 Mar 2021 21:40:16 +0000 Subject: [PATCH 0024/1135] Fix tests still failing for the wrong reason --- .github/workflows/GNU.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index f6729d0d1..4d3e39613 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -84,9 +84,10 @@ jobs: sed -i -e "s|stat|$(which stat)|" tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh sed -i -e "s|ls -|$(which ls) -|" tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh sed -i -e "s|mkdir |$(which mkdir) |" tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i -e "s|timeout |$(which timeout) |" tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh + sed -i -e "s|timeout |$(which timeout) |" tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh + sed -i -e "s| timeout | $(which timeout) |" tests/tail-2/inotify-rotate.sh # Don't break the function called 'grep_timeout' sed -i -e "s|chmod |$(which chmod) |" tests/du/inacc-dir.sh tests/mkdir/p-3.sh - sed -i -e "s|sort |$(which sort) |" tests/ls/hyperlink.sh + sed -i -e "s|sort |$(which sort) |" tests/ls/hyperlink.sh tests/misc/test-N.sh sed -i -e "s|split |$(which split) |" tests/misc/factor-parallel.sh sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh From 8dae8b798a1de60689271df83676bfe60ab8ebb5 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sat, 6 Mar 2021 16:35:22 +0000 Subject: [PATCH 0025/1135] Revert "Remove unbuffer" This reverts commit bbce17911596c54891154988b86e32241e9351e6. --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 4d3e39613..2cfc535ce 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -104,7 +104,7 @@ jobs: GNULIB_DIR="${PWD}/gnulib" pushd gnu - timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make + unbuffer timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make - name: Extract tests info shell: bash run: | From 78ec6d1e5a20e697e7e79afead4ec34c5eba07d1 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sat, 6 Mar 2021 21:24:28 +0000 Subject: [PATCH 0026/1135] Revert "Revert "Remove unbuffer"" This reverts commit 8dae8b798a1de60689271df83676bfe60ab8ebb5. --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 2cfc535ce..4d3e39613 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -104,7 +104,7 @@ jobs: GNULIB_DIR="${PWD}/gnulib" pushd gnu - unbuffer timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make + timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make - name: Extract tests info shell: bash run: | From 68ec2ed0f3892e45f386d6d32f3efbd1a06ca6a3 Mon Sep 17 00:00:00 2001 From: Hari <-l> Date: Fri, 12 Mar 2021 16:51:47 -0500 Subject: [PATCH 0027/1135] install: Implement --preserve-timestamps (-p) Last access and last modify timestamps are extracted from the existing file metadata and are applied to the newly created file. --- Cargo.lock | 1957 +++++++++++++++++---------------- src/uu/install/Cargo.toml | 1 + src/uu/install/src/install.rs | 24 +- tests/by-util/test_install.rs | 19 + 4 files changed, 1019 insertions(+), 982 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fe9e11c35..7a5c2bc02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,2657 +1,2658 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "advapi32-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8", + "winapi-build", ] [[package]] name = "aho-corasick" version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4", ] [[package]] name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "arrayvec" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" dependencies = [ - "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop", ] [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", + "winapi 0.3.9", ] [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "bit-set" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" dependencies = [ - "bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bit-vec", ] [[package]] name = "bit-vec" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "blake2-rfc" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ - "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec", + "constant_time_eq", ] [[package]] name = "block-buffer" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" dependencies = [ - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools", + "generic-array", ] [[package]] name = "bstr" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "memchr 2.3.4", + "regex-automata", + "serde", ] [[package]] name = "bumpalo" version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" [[package]] name = "byte-tools" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" [[package]] name = "byteorder" version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" [[package]] name = "cast" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" dependencies = [ - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version", ] [[package]] name = "cc" version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" [[package]] name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" dependencies = [ - "num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer", + "num-traits", + "time", ] [[package]] name = "clap" version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term", + "atty", + "bitflags 1.2.1", + "strsim", + "textwrap", + "unicode-width", + "vec_map", ] [[package]] name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1", ] [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "conv" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" dependencies = [ - "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "custom_derive", ] [[package]] name = "coreutils" version = "0.0.4" dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", - "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_arch 0.0.4", - "uu_base32 0.0.4", - "uu_base64 0.0.4", - "uu_basename 0.0.4", - "uu_cat 0.0.4", - "uu_chgrp 0.0.4", - "uu_chmod 0.0.4", - "uu_chown 0.0.4", - "uu_chroot 0.0.4", - "uu_cksum 0.0.4", - "uu_comm 0.0.4", - "uu_cp 0.0.4", - "uu_csplit 0.0.4", - "uu_cut 0.0.4", - "uu_date 0.0.4", - "uu_df 0.0.4", - "uu_dircolors 0.0.4", - "uu_dirname 0.0.4", - "uu_du 0.0.4", - "uu_echo 0.0.4", - "uu_env 0.0.4", - "uu_expand 0.0.4", - "uu_expr 0.0.4", - "uu_factor 0.0.4", - "uu_false 0.0.4", - "uu_fmt 0.0.4", - "uu_fold 0.0.4", - "uu_groups 0.0.4", - "uu_hashsum 0.0.4", - "uu_head 0.0.4", - "uu_hostid 0.0.4", - "uu_hostname 0.0.4", - "uu_id 0.0.4", - "uu_install 0.0.4", - "uu_join 0.0.4", - "uu_kill 0.0.4", - "uu_link 0.0.4", - "uu_ln 0.0.4", - "uu_logname 0.0.4", - "uu_ls 0.0.4", - "uu_mkdir 0.0.4", - "uu_mkfifo 0.0.4", - "uu_mknod 0.0.4", - "uu_mktemp 0.0.4", - "uu_more 0.0.4", - "uu_mv 0.0.4", - "uu_nice 0.0.4", - "uu_nl 0.0.4", - "uu_nohup 0.0.4", - "uu_nproc 0.0.4", - "uu_numfmt 0.0.4", - "uu_od 0.0.4", - "uu_paste 0.0.4", - "uu_pathchk 0.0.4", - "uu_pinky 0.0.4", - "uu_printenv 0.0.4", - "uu_printf 0.0.4", - "uu_ptx 0.0.4", - "uu_pwd 0.0.4", - "uu_readlink 0.0.4", - "uu_realpath 0.0.4", - "uu_relpath 0.0.4", - "uu_rm 0.0.4", - "uu_rmdir 0.0.4", - "uu_seq 0.0.4", - "uu_shred 0.0.4", - "uu_shuf 0.0.4", - "uu_sleep 0.0.4", - "uu_sort 0.0.4", - "uu_split 0.0.4", - "uu_stat 0.0.4", - "uu_stdbuf 0.0.4", - "uu_sum 0.0.4", - "uu_sync 0.0.4", - "uu_tac 0.0.4", - "uu_tail 0.0.4", - "uu_tee 0.0.4", - "uu_test 0.0.4", - "uu_timeout 0.0.4", - "uu_touch 0.0.4", - "uu_tr 0.0.4", - "uu_true 0.0.4", - "uu_truncate 0.0.4", - "uu_tsort 0.0.4", - "uu_tty 0.0.4", - "uu_uname 0.0.4", - "uu_unexpand 0.0.4", - "uu_uniq 0.0.4", - "uu_unlink 0.0.4", - "uu_uptime 0.0.4", - "uu_users 0.0.4", - "uu_wc 0.0.4", - "uu_who 0.0.4", - "uu_whoami 0.0.4", - "uu_yes 0.0.4", - "uucore 0.0.7", - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder", + "cc", + "conv", + "filetime", + "glob 0.3.0", + "lazy_static", + "libc", + "rand 0.7.3", + "regex", + "rustc-demangle", + "same-file", + "sha1", + "tempfile", + "textwrap", + "thread_local", + "time", + "unindent", + "unix_socket", + "users", + "uu_arch", + "uu_base32", + "uu_base64", + "uu_basename", + "uu_cat", + "uu_chgrp", + "uu_chmod", + "uu_chown", + "uu_chroot", + "uu_cksum", + "uu_comm", + "uu_cp", + "uu_csplit", + "uu_cut", + "uu_date", + "uu_df", + "uu_dircolors", + "uu_dirname", + "uu_du", + "uu_echo", + "uu_env", + "uu_expand", + "uu_expr", + "uu_factor", + "uu_false", + "uu_fmt", + "uu_fold", + "uu_groups", + "uu_hashsum", + "uu_head", + "uu_hostid", + "uu_hostname", + "uu_id", + "uu_install", + "uu_join", + "uu_kill", + "uu_link", + "uu_ln", + "uu_logname", + "uu_ls", + "uu_mkdir", + "uu_mkfifo", + "uu_mknod", + "uu_mktemp", + "uu_more", + "uu_mv", + "uu_nice", + "uu_nl", + "uu_nohup", + "uu_nproc", + "uu_numfmt", + "uu_od", + "uu_paste", + "uu_pathchk", + "uu_pinky", + "uu_printenv", + "uu_printf", + "uu_ptx", + "uu_pwd", + "uu_readlink", + "uu_realpath", + "uu_relpath", + "uu_rm", + "uu_rmdir", + "uu_seq", + "uu_shred", + "uu_shuf", + "uu_sleep", + "uu_sort", + "uu_split", + "uu_stat", + "uu_stdbuf", + "uu_sum", + "uu_sync", + "uu_tac", + "uu_tail", + "uu_tee", + "uu_test", + "uu_timeout", + "uu_touch", + "uu_tr", + "uu_true", + "uu_truncate", + "uu_tsort", + "uu_tty", + "uu_uname", + "uu_unexpand", + "uu_uniq", + "uu_unlink", + "uu_uptime", + "uu_users", + "uu_wc", + "uu_who", + "uu_whoami", + "uu_yes", + "uucore", + "winapi-util", ] [[package]] name = "cpp" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" dependencies = [ - "cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_macros", ] [[package]] name = "cpp_build" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" dependencies = [ - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "cpp_common 0.4.0", + "cpp_syn", + "cpp_synmap", + "cpp_synom", + "lazy_static", ] [[package]] name = "cpp_common" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" dependencies = [ - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn", + "cpp_synom", + "lazy_static", + "quote 0.3.15", ] [[package]] name = "cpp_common" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "proc-macro2", + "syn", ] [[package]] name = "cpp_macros" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "byteorder", + "cpp_common 0.5.6", + "if_rust_version", + "lazy_static", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "cpp_syn" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" dependencies = [ - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom", + "quote 0.3.15", + "unicode-xid 0.0.4", ] [[package]] name = "cpp_synmap" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" dependencies = [ - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn", + "cpp_synom", + "memchr 1.0.2", ] [[package]] name = "cpp_synom" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" dependencies = [ - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4", ] [[package]] name = "criterion" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", - "tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "cast", + "clap", + "criterion-plot", + "csv", + "itertools 0.10.0", + "lazy_static", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", ] [[package]] name = "criterion-plot" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" dependencies = [ - "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cast", + "itertools 0.9.0", ] [[package]] name = "crossbeam-channel" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-utils", ] [[package]] name = "crossbeam-deque" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-epoch", + "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-utils", + "lazy_static", + "memoffset", + "scopeguard", ] [[package]] name = "crossbeam-utils" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "cfg-if 1.0.0", + "lazy_static", ] [[package]] name = "csv" version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" dependencies = [ - "bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", - "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr", + "csv-core", + "itoa", + "ryu", + "serde", ] [[package]] name = "csv-core" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" dependencies = [ - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4", ] [[package]] name = "custom_derive" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" [[package]] name = "data-encoding" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" [[package]] name = "digest" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" dependencies = [ - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array", ] [[package]] name = "dunce" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "env_logger" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "regex", ] [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "filetime" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "libc", + "redox_syscall 0.2.5", + "winapi 0.3.9", ] [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fs_extra" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "generic-array" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" dependencies = [ - "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop", + "typenum", ] [[package]] name = "getopts" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" dependencies = [ - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "getrandom" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "libc", + "wasi", ] [[package]] name = "glob" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "half" version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" [[package]] name = "hermit-abi" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "hex" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" [[package]] name = "hostname" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "match_cfg", + "winapi 0.3.9", ] [[package]] name = "if_rust_version" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" [[package]] name = "ioctl-sys" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" [[package]] name = "itertools" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itertools" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itertools" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itoa" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "js-sys" version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78" dependencies = [ - "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen", ] [[package]] name = "kernel32-sys" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8", + "winapi-build", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" [[package]] name = "log" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", ] [[package]] name = "match_cfg" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" [[package]] name = "maybe-uninit" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "md5" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" [[package]] name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "memchr" version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memoffset" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "nix" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" dependencies = [ - "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.7.0", + "cfg-if 0.1.10", + "libc", + "void", ] [[package]] name = "nix" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1", + "cc", + "cfg-if 0.1.10", + "libc", + "void", ] [[package]] name = "nodrop" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "num-integer" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "num-traits", ] [[package]] name = "num-traits" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "num_cpus" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", ] [[package]] name = "number_prefix" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "numtoa" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" [[package]] name = "onig" version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1", + "lazy_static", + "libc", + "onig_sys", ] [[package]] name = "onig_sys" version = "69.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" dependencies = [ - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "pkg-config", ] [[package]] name = "oorandom" version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "paste" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" dependencies = [ - "paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", + "paste-impl", + "proc-macro-hack", ] [[package]] name = "paste-impl" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" dependencies = [ - "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack", ] [[package]] name = "pkg-config" version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "platform-info" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "winapi 0.3.9", ] [[package]] name = "plotters" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" dependencies = [ - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", ] [[package]] name = "plotters-backend" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" [[package]] name = "plotters-svg" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" dependencies = [ - "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-backend", ] [[package]] name = "ppv-lite86" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "proc-macro-hack" version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1", ] [[package]] name = "quick-error" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quickcheck" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" dependencies = [ - "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger", + "log", + "rand 0.7.3", + "rand_core 0.5.1", ] [[package]] name = "quote" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "rand" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "winapi 0.3.9", ] [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom", + "libc", + "rand_chacha", + "rand_core 0.5.1", + "rand_hc", + "rand_pcg", ] [[package]] name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ - "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86", + "rand_core 0.5.1", ] [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" dependencies = [ - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2", ] [[package]] name = "rand_core" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" [[package]] name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom", ] [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1", ] [[package]] name = "rand_pcg" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1", ] [[package]] name = "rayon" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", ] [[package]] name = "rayon-core" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" dependencies = [ - "crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static", + "num_cpus", ] [[package]] name = "redox_syscall" version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1", ] [[package]] name = "redox_termios" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" dependencies = [ - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5", ] [[package]] name = "regex" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "memchr 2.3.4", + "regex-syntax", + "thread_local", ] [[package]] name = "regex-automata" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder", ] [[package]] name = "regex-syntax" version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" [[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "rust-ini" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" [[package]] name = "rustc-demangle" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" [[package]] name = "rustc_version" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver", ] [[package]] name = "ryu" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "same-file" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" dependencies = [ - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util", ] [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver-parser", ] [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" [[package]] name = "serde_cbor" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" dependencies = [ - "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "half", + "serde", ] [[package]] name = "serde_derive" version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "serde_json" version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ - "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa", + "ryu", + "serde", ] [[package]] name = "sha1" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "sha2" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" dependencies = [ - "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer", + "byte-tools", + "digest", + "fake-simd", + "generic-array", ] [[package]] name = "sha3" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" dependencies = [ - "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer", + "byte-tools", + "digest", + "generic-array", ] [[package]] name = "smallvec" version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" dependencies = [ - "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit", ] [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd9bc7ccc2688b3344c2f48b9b546648b25ce0b20fc717ee7fa7981a8ca9717" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "unicode-xid 0.2.1", ] [[package]] name = "tempfile" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "libc", + "rand 0.7.3", + "redox_syscall 0.1.57", + "remove_dir_all", + "winapi 0.3.9", ] [[package]] name = "term_grid" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" dependencies = [ - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "term_size" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "winapi 0.3.9", ] [[package]] name = "termion" version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "numtoa", + "redox_syscall 0.2.5", + "redox_termios", ] [[package]] name = "termsize" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "kernel32-sys", + "libc", + "termion", + "winapi 0.2.8", ] [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "term_size", + "unicode-width", ] [[package]] name = "thiserror" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" dependencies = [ - "thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "thread_local" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", ] [[package]] name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "redox_syscall 0.1.57", + "winapi 0.3.9", ] [[package]] name = "tinytemplate" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "serde", + "serde_json", ] [[package]] name = "typenum" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "unicode-width" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" [[package]] name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "unindent" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" [[package]] name = "unix_socket" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "libc", ] [[package]] name = "users" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "log", ] [[package]] name = "uu_arch" version = "0.0.4" dependencies = [ - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "platform-info", + "uucore", + "uucore_procs", ] [[package]] name = "uu_base32" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_base64" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_basename" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cat" version = "0.0.4" dependencies = [ - "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "quick-error", + "unix_socket", + "uucore", + "uucore_procs", ] [[package]] name = "uu_chgrp" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chmod" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chown" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "glob 0.3.0", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chroot" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cksum" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_comm" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cp" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "filetime", + "ioctl-sys", + "libc", + "quick-error", + "uucore", + "uucore_procs", + "walkdir", + "winapi 0.3.9", + "xattr", ] [[package]] name = "uu_csplit" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "glob 0.2.11", + "regex", + "thiserror", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cut" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_date" version = "0.0.4" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "chrono", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_df" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "number_prefix", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_dircolors" version = "0.0.4" dependencies = [ - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "glob 0.3.0", + "uucore", + "uucore_procs", ] [[package]] name = "uu_dirname" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_du" version = "0.0.4" dependencies = [ - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_echo" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_env" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "rust-ini", + "uucore", + "uucore_procs", ] [[package]] name = "uu_expand" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_expr" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "onig", + "uucore", + "uucore_procs", ] [[package]] name = "uu_factor" version = "0.0.4" dependencies = [ - "criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "criterion", + "num-traits", + "paste", + "quickcheck", + "rand 0.7.3", + "rand_chacha", + "smallvec", + "uucore", + "uucore_procs", ] [[package]] name = "uu_false" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_fmt" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_fold" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_groups" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hashsum" version = "0.0.4" dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "blake2-rfc", + "clap", + "digest", + "hex", + "libc", + "md5", + "regex", + "regex-syntax", + "sha1", + "sha2", + "sha3", + "uucore", + "uucore_procs", ] [[package]] name = "uu_head" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hostid" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hostname" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "hostname", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_id" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_install" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "filetime", + "libc", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_join" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_kill" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_link" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ln" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_logname" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ls" version = "0.0.4" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "atty", + "getopts", + "lazy_static", + "number_prefix", + "term_grid", + "termsize", + "time", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mkdir" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mkfifo" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mknod" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mktemp" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "rand 0.5.6", + "tempfile", + "uucore", + "uucore_procs", ] [[package]] name = "uu_more" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "nix 0.8.1", + "redox_syscall 0.1.57", + "redox_termios", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mv" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "fs_extra", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nice" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nl" version = "0.0.4" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "aho-corasick", + "getopts", + "libc", + "memchr 2.3.4", + "regex", + "regex-syntax", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nohup" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nproc" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "num_cpus", + "uucore", + "uucore_procs", ] [[package]] name = "uu_numfmt" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_od" version = "0.0.4" dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "byteorder", + "getopts", + "half", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_paste" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pathchk" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pinky" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_printenv" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_printf" version = "0.0.4" dependencies = [ - "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "itertools 0.8.2", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ptx" version = "0.0.4" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "aho-corasick", + "getopts", + "libc", + "memchr 2.3.4", + "regex", + "regex-syntax", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pwd" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_readlink" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_realpath" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_relpath" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_rm" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "remove_dir_all", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_rmdir" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_seq" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_shred" version = "0.0.4" dependencies = [ - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "filetime", + "getopts", + "libc", + "rand 0.5.6", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_shuf" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "rand 0.5.6", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sleep" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sort" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "itertools 0.8.2", + "semver", + "uucore", + "uucore_procs", ] [[package]] name = "uu_split" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stat" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stdbuf" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_stdbuf_libstdbuf 0.0.4", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "tempfile", + "uu_stdbuf_libstdbuf", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stdbuf_libstdbuf" version = "0.0.4" dependencies = [ - "cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "cpp", + "cpp_build", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sum" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sync" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_tac" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tail" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "redox_syscall 0.1.57", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_tee" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_test" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "redox_syscall 0.1.57", + "uucore", + "uucore_procs", ] [[package]] name = "uu_timeout" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_touch" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "filetime", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tr" version = "0.0.4" dependencies = [ - "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "bit-set", + "fnv", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_true" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_truncate" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tsort" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tty" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uname" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "platform-info", + "uucore", + "uucore_procs", ] [[package]] name = "uu_unexpand" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uniq" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_unlink" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uptime" version = "0.0.4" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "chrono", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_users" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_wc" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_who" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_whoami" version = "0.0.4" dependencies = [ - "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "advapi32-sys", + "clap", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_yes" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uucore" version = "0.0.7" dependencies = [ - "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "data-encoding", + "dunce", + "getopts", + "lazy_static", + "libc", + "nix 0.13.1", + "platform-info", + "termion", + "thiserror", + "time", + "wild", ] [[package]] name = "uucore_procs" version = "0.0.5" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "walkdir" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" dependencies = [ - "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file", + "winapi 0.3.9", + "winapi-util", ] [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8" dependencies = [ - "bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote 1.0.9", + "syn", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b" dependencies = [ - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9", + "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1" [[package]] name = "web-sys" version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b" dependencies = [ - "js-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys", + "wasm-bindgen", ] [[package]] name = "wild" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" dependencies = [ - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0", ] [[package]] name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] - -[metadata] -"checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" -"checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" -"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -"checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -"checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" -"checksum bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" -"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" -"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" -"checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" -"checksum bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" -"checksum bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" -"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" -"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" -"checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" -"checksum cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)" = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" -"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" -"checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" -"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" -"checksum cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" -"checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" -"checksum cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" -"checksum cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" -"checksum cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" -"checksum cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" -"checksum cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" -"checksum cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" -"checksum criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" -"checksum criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" -"checksum crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" -"checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" -"checksum crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" -"checksum crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" -"checksum csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" -"checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" -"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" -"checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" -"checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" -"checksum dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" -"checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -"checksum filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" -"checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -"checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" -"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -"checksum generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" -"checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" -"checksum getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -"checksum half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" -"checksum hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" -"checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" -"checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" -"checksum if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" -"checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" -"checksum itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" -"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" -"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -"checksum itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" -"checksum js-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)" = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)" = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" -"checksum log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" -"checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" -"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" -"checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" -"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" -"checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" -"checksum memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" -"checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" -"checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" -"checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" -"checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" -"checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -"checksum number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" -"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" -"checksum onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" -"checksum onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" -"checksum oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" -"checksum paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" -"checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" -"checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" -"checksum platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" -"checksum plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" -"checksum plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" -"checksum plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" -"checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" -"checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" -"checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" -"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -"checksum quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" -"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" -"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" -"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -"checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" -"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -"checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -"checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" -"checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" -"checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" -"checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" -"checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" -"checksum regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" -"checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -"checksum regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)" = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" -"checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -"checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" -"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" -"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -"checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" -"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)" = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" -"checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -"checksum serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)" = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" -"checksum serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)" = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" -"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" -"checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" -"checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" -"checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)" = "8fd9bc7ccc2688b3344c2f48b9b546648b25ce0b20fc717ee7fa7981a8ca9717" -"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" -"checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" -"checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" -"checksum termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" -"checksum termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" -"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -"checksum thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" -"checksum thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" -"checksum thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" -"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" -"checksum typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" -"checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" -"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" -"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" -"checksum unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" -"checksum unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" -"checksum users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" -"checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" -"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -"checksum wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7" -"checksum wasm-bindgen-backend 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8" -"checksum wasm-bindgen-macro 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b" -"checksum wasm-bindgen-macro-support 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e" -"checksum wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1" -"checksum web-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)" = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b" -"checksum wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 5280184fe..9841ac64a 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -19,6 +19,7 @@ path = "src/install.rs" [dependencies] clap = "2.33" +filetime = "0.2" libc = ">= 0.2" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["mode", "perms", "entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index b41b16ef6..c9d2c77ca 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -13,6 +13,7 @@ mod mode; extern crate uucore; use clap::{App, Arg, ArgMatches}; +use filetime::{FileTime, set_file_times}; use uucore::entries::{grp2gid, usr2uid}; use uucore::perms::{wrap_chgrp, wrap_chown, Verbosity}; @@ -32,6 +33,7 @@ pub struct Behavior { owner: String, group: String, verbose: bool, + preserve_timestamps: bool, } #[derive(Clone, Eq, PartialEq)] @@ -154,11 +156,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) ) .arg( - // TODO implement flag Arg::with_name(OPT_PRESERVE_TIMESTAMPS) .short("p") .long(OPT_PRESERVE_TIMESTAMPS) - .help("(unimplemented) apply access/modification times of SOURCE files to corresponding destination files") + .help("apply access/modification times of SOURCE files to corresponding destination files") ) .arg( // TODO implement flag @@ -265,8 +266,6 @@ fn check_unimplemented<'a>(matches: &ArgMatches) -> Result<(), &'a str> { Err("--compare, -C") } else if matches.is_present(OPT_CREATED) { Err("-D") - } else if matches.is_present(OPT_PRESERVE_TIMESTAMPS) { - Err("--preserve-timestamps, -p") } else if matches.is_present(OPT_STRIP) { Err("--strip, -s") } else if matches.is_present(OPT_STRIP_PROGRAM) { @@ -338,6 +337,7 @@ fn behavior(matches: &ArgMatches) -> Result { owner: matches.value_of(OPT_OWNER).unwrap_or("").to_string(), group: matches.value_of(OPT_GROUP).unwrap_or("").to_string(), verbose: matches.is_present(OPT_VERBOSE), + preserve_timestamps: matches.is_present(OPT_PRESERVE_TIMESTAMPS) }) } @@ -555,6 +555,22 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { } } + if b.preserve_timestamps { + let meta = match fs::metadata(from) { + Ok(meta) => meta, + Err(f) => crash!(1, "{}", f.to_string()), + }; + + let modified_time = FileTime::from_last_modification_time(&meta); + let accessed_time = FileTime::from_last_access_time(&meta); + + match set_file_times(to.as_path(), accessed_time, modified_time) { + Ok(_) => {}, + Err(e) => show_info!("{}", e) + } + + } + if b.verbose { show_info!("'{}' -> '{}'", from.display(), to.display()); } diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index a04c0ddfc..ee79a8271 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -309,6 +309,25 @@ fn test_install_target_new_file_failing_nonexistent_parent() { assert!(err.contains("not a directory")) } +#[test] +fn test_install_preserve_timestamps() { + let (at, mut ucmd) = at_and_ucmd!(); + let file1 = "test_install_target_dir_file_a1"; + let file2 = "test_install_target_dir_file_a2"; + at.touch(file1); + + ucmd.arg(file1).arg(file2).arg("-p").succeeds().no_stderr(); + + assert!(at.file_exists(file1)); + assert!(at.file_exists(file2)); + + let file1_metadata = at.metadata(file1); + let file2_metadata = at.metadata(file2); + + assert_eq!(file1_metadata.accessed().ok(), file2_metadata.accessed().ok()); + assert_eq!(file1_metadata.modified().ok(), file2_metadata.modified().ok()); +} + // These two tests are failing but should work #[test] fn test_install_copy_file() { From 2462575d4b9015268177f93895e5aeae0ad8b719 Mon Sep 17 00:00:00 2001 From: Hari Date: Fri, 12 Mar 2021 17:46:58 -0500 Subject: [PATCH 0028/1135] Run cargo +1.33.0 update to fix Cargo.lock --- Cargo.lock | 1961 ++++++++++++++++++++++++++-------------------------- 1 file changed, 980 insertions(+), 981 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7a5c2bc02..92103835d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,2658 +1,2657 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. [[package]] name = "advapi32-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "aho-corasick" version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ - "memchr 2.3.4", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.9", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "arrayvec" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" dependencies = [ - "nodrop", + "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", - "libc", - "winapi 0.3.9", + "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "bit-set" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" dependencies = [ - "bit-vec", + "bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bit-vec" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "blake2-rfc" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ - "arrayvec", - "constant_time_eq", + "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "block-buffer" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" dependencies = [ - "byte-tools", - "generic-array", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bstr" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" dependencies = [ - "lazy_static", - "memchr 2.3.4", - "regex-automata", - "serde", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bumpalo" version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" [[package]] name = "byte-tools" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" [[package]] name = "byteorder" version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" [[package]] name = "cast" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" dependencies = [ - "rustc_version", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cc" version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" [[package]] name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" dependencies = [ - "num-integer", - "num-traits", - "time", + "num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clap" version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ - "ansi_term", - "atty", - "bitflags 1.2.1", - "strsim", - "textwrap", - "unicode-width", - "vec_map", + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags 1.2.1", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "conv" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" dependencies = [ - "custom_derive", + "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "coreutils" version = "0.0.4" dependencies = [ - "byteorder", - "cc", - "conv", - "filetime", - "glob 0.3.0", - "lazy_static", - "libc", - "rand 0.7.3", - "regex", - "rustc-demangle", - "same-file", - "sha1", - "tempfile", - "textwrap", - "thread_local", - "time", - "unindent", - "unix_socket", - "users", - "uu_arch", - "uu_base32", - "uu_base64", - "uu_basename", - "uu_cat", - "uu_chgrp", - "uu_chmod", - "uu_chown", - "uu_chroot", - "uu_cksum", - "uu_comm", - "uu_cp", - "uu_csplit", - "uu_cut", - "uu_date", - "uu_df", - "uu_dircolors", - "uu_dirname", - "uu_du", - "uu_echo", - "uu_env", - "uu_expand", - "uu_expr", - "uu_factor", - "uu_false", - "uu_fmt", - "uu_fold", - "uu_groups", - "uu_hashsum", - "uu_head", - "uu_hostid", - "uu_hostname", - "uu_id", - "uu_install", - "uu_join", - "uu_kill", - "uu_link", - "uu_ln", - "uu_logname", - "uu_ls", - "uu_mkdir", - "uu_mkfifo", - "uu_mknod", - "uu_mktemp", - "uu_more", - "uu_mv", - "uu_nice", - "uu_nl", - "uu_nohup", - "uu_nproc", - "uu_numfmt", - "uu_od", - "uu_paste", - "uu_pathchk", - "uu_pinky", - "uu_printenv", - "uu_printf", - "uu_ptx", - "uu_pwd", - "uu_readlink", - "uu_realpath", - "uu_relpath", - "uu_rm", - "uu_rmdir", - "uu_seq", - "uu_shred", - "uu_shuf", - "uu_sleep", - "uu_sort", - "uu_split", - "uu_stat", - "uu_stdbuf", - "uu_sum", - "uu_sync", - "uu_tac", - "uu_tail", - "uu_tee", - "uu_test", - "uu_timeout", - "uu_touch", - "uu_tr", - "uu_true", - "uu_truncate", - "uu_tsort", - "uu_tty", - "uu_uname", - "uu_unexpand", - "uu_uniq", - "uu_unlink", - "uu_uptime", - "uu_users", - "uu_wc", - "uu_who", - "uu_whoami", - "uu_yes", - "uucore", - "winapi-util", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uu_arch 0.0.4", + "uu_base32 0.0.4", + "uu_base64 0.0.4", + "uu_basename 0.0.4", + "uu_cat 0.0.4", + "uu_chgrp 0.0.4", + "uu_chmod 0.0.4", + "uu_chown 0.0.4", + "uu_chroot 0.0.4", + "uu_cksum 0.0.4", + "uu_comm 0.0.4", + "uu_cp 0.0.4", + "uu_csplit 0.0.4", + "uu_cut 0.0.4", + "uu_date 0.0.4", + "uu_df 0.0.4", + "uu_dircolors 0.0.4", + "uu_dirname 0.0.4", + "uu_du 0.0.4", + "uu_echo 0.0.4", + "uu_env 0.0.4", + "uu_expand 0.0.4", + "uu_expr 0.0.4", + "uu_factor 0.0.4", + "uu_false 0.0.4", + "uu_fmt 0.0.4", + "uu_fold 0.0.4", + "uu_groups 0.0.4", + "uu_hashsum 0.0.4", + "uu_head 0.0.4", + "uu_hostid 0.0.4", + "uu_hostname 0.0.4", + "uu_id 0.0.4", + "uu_install 0.0.4", + "uu_join 0.0.4", + "uu_kill 0.0.4", + "uu_link 0.0.4", + "uu_ln 0.0.4", + "uu_logname 0.0.4", + "uu_ls 0.0.4", + "uu_mkdir 0.0.4", + "uu_mkfifo 0.0.4", + "uu_mknod 0.0.4", + "uu_mktemp 0.0.4", + "uu_more 0.0.4", + "uu_mv 0.0.4", + "uu_nice 0.0.4", + "uu_nl 0.0.4", + "uu_nohup 0.0.4", + "uu_nproc 0.0.4", + "uu_numfmt 0.0.4", + "uu_od 0.0.4", + "uu_paste 0.0.4", + "uu_pathchk 0.0.4", + "uu_pinky 0.0.4", + "uu_printenv 0.0.4", + "uu_printf 0.0.4", + "uu_ptx 0.0.4", + "uu_pwd 0.0.4", + "uu_readlink 0.0.4", + "uu_realpath 0.0.4", + "uu_relpath 0.0.4", + "uu_rm 0.0.4", + "uu_rmdir 0.0.4", + "uu_seq 0.0.4", + "uu_shred 0.0.4", + "uu_shuf 0.0.4", + "uu_sleep 0.0.4", + "uu_sort 0.0.4", + "uu_split 0.0.4", + "uu_stat 0.0.4", + "uu_stdbuf 0.0.4", + "uu_sum 0.0.4", + "uu_sync 0.0.4", + "uu_tac 0.0.4", + "uu_tail 0.0.4", + "uu_tee 0.0.4", + "uu_test 0.0.4", + "uu_timeout 0.0.4", + "uu_touch 0.0.4", + "uu_tr 0.0.4", + "uu_true 0.0.4", + "uu_truncate 0.0.4", + "uu_tsort 0.0.4", + "uu_tty 0.0.4", + "uu_uname 0.0.4", + "uu_unexpand 0.0.4", + "uu_uniq 0.0.4", + "uu_unlink 0.0.4", + "uu_uptime 0.0.4", + "uu_users 0.0.4", + "uu_wc 0.0.4", + "uu_who 0.0.4", + "uu_whoami 0.0.4", + "uu_yes 0.0.4", + "uucore 0.0.7", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" dependencies = [ - "cpp_macros", + "cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_build" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" dependencies = [ - "cc", - "cpp_common 0.4.0", - "cpp_syn", - "cpp_synmap", - "cpp_synom", - "lazy_static", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_common" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" dependencies = [ - "cpp_syn", - "cpp_synom", - "lazy_static", - "quote 0.3.15", + "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_common" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" dependencies = [ - "lazy_static", - "proc-macro2", - "syn", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_macros" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" dependencies = [ - "aho-corasick", - "byteorder", - "cpp_common 0.5.6", - "if_rust_version", - "lazy_static", - "proc-macro2", - "quote 1.0.9", - "syn", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_syn" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" dependencies = [ - "cpp_synom", - "quote 0.3.15", - "unicode-xid 0.0.4", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_synmap" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" dependencies = [ - "cpp_syn", - "cpp_synom", - "memchr 1.0.2", + "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_synom" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" dependencies = [ - "unicode-xid 0.0.4", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "criterion" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" dependencies = [ - "atty", - "cast", - "clap", - "criterion-plot", - "csv", - "itertools 0.10.0", - "lazy_static", - "num-traits", - "oorandom", - "plotters", - "rayon", - "regex", - "serde", - "serde_cbor", - "serde_derive", - "serde_json", - "tinytemplate", - "walkdir", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "criterion-plot" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" dependencies = [ - "cast", - "itertools 0.9.0", + "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-channel" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-deque" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", - "lazy_static", - "memoffset", - "scopeguard", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-utils" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "lazy_static", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "csv" version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" dependencies = [ - "bstr", - "csv-core", - "itoa", - "ryu", - "serde", + "bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", + "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "csv-core" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" dependencies = [ - "memchr 2.3.4", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "custom_derive" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" [[package]] name = "data-encoding" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" [[package]] name = "digest" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" dependencies = [ - "generic-array", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "dunce" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "env_logger" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ - "log", - "regex", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "filetime" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall 0.2.5", - "winapi 0.3.9", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fs_extra" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "generic-array" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" dependencies = [ - "nodrop", - "typenum", + "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "getopts" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" dependencies = [ - "unicode-width", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "getrandom" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glob" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "half" version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" [[package]] name = "hermit-abi" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ - "libc", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hex" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" [[package]] name = "hostname" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ - "libc", - "match_cfg", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "if_rust_version" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" [[package]] name = "ioctl-sys" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" [[package]] name = "itertools" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" dependencies = [ - "either", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itertools" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" dependencies = [ - "either", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itertools" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" dependencies = [ - "either", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itoa" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "js-sys" version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78" dependencies = [ - "wasm-bindgen", + "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "kernel32-sys" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" [[package]] name = "log" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "match_cfg" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" [[package]] name = "maybe-uninit" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "md5" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" [[package]] name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" dependencies = [ - "libc", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "memchr" version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memoffset" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" dependencies = [ - "autocfg", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nix" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" dependencies = [ - "bitflags 0.7.0", - "cfg-if 0.1.10", - "libc", - "void", + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nix" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" dependencies = [ - "bitflags 1.2.1", - "cc", - "cfg-if 0.1.10", - "libc", - "void", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nodrop" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "num-integer" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg", - "num-traits", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num_cpus" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "hermit-abi", - "libc", + "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "number_prefix" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "numtoa" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" [[package]] name = "onig" version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" dependencies = [ - "bitflags 1.2.1", - "lazy_static", - "libc", - "onig_sys", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "onig_sys" version = "69.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" dependencies = [ - "cc", - "pkg-config", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "oorandom" version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "paste" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" dependencies = [ - "paste-impl", - "proc-macro-hack", + "paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "paste-impl" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" dependencies = [ - "proc-macro-hack", + "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pkg-config" version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "platform-info" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" dependencies = [ - "libc", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "plotters" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" dependencies = [ - "num-traits", - "plotters-backend", - "plotters-svg", - "wasm-bindgen", - "web-sys", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "plotters-backend" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" [[package]] name = "plotters-svg" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" dependencies = [ - "plotters-backend", + "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ppv-lite86" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "proc-macro-hack" version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "unicode-xid 0.2.1", + "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "quick-error" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quickcheck" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" dependencies = [ - "env_logger", - "log", - "rand 0.7.3", - "rand_core 0.5.1", + "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "quote" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ - "proc-macro2", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" dependencies = [ - "cloudabi", - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "winapi 0.3.9", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", - "libc", - "rand_chacha", - "rand_core 0.5.1", - "rand_hc", - "rand_pcg", + "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" dependencies = [ - "rand_core 0.4.2", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" [[package]] name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", + "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_pcg" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core 0.5.1", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rayon" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rayon-core" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "lazy_static", - "num_cpus", + "crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_syscall" version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" dependencies = [ - "bitflags 1.2.1", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_termios" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" dependencies = [ - "redox_syscall 0.2.5", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "1.4.3" +version = "1.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" dependencies = [ - "aho-corasick", - "memchr 2.3.4", - "regex-syntax", - "thread_local", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-automata" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" dependencies = [ - "byteorder", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.22" +version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" [[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rust-ini" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" [[package]] name = "rustc-demangle" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" [[package]] name = "rustc_version" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ryu" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "same-file" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" dependencies = [ - "winapi-util", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser", + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" [[package]] name = "serde_cbor" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" dependencies = [ - "half", - "serde", + "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ - "itoa", - "ryu", - "serde", + "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sha1" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "sha2" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" dependencies = [ - "block-buffer", - "byte-tools", - "digest", - "fake-simd", - "generic-array", + "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sha3" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" dependencies = [ - "block-buffer", - "byte-tools", - "digest", - "generic-array", + "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "smallvec" version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" dependencies = [ - "maybe-uninit", + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd9bc7ccc2688b3344c2f48b9b546648b25ce0b20fc717ee7fa7981a8ca9717" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "unicode-xid 0.2.1", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tempfile" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if 0.1.10", - "libc", - "rand 0.7.3", - "redox_syscall 0.1.57", - "remove_dir_all", - "winapi 0.3.9", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "term_grid" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" dependencies = [ - "unicode-width", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "term_size" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" dependencies = [ - "libc", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "termion" version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ - "libc", - "numtoa", - "redox_syscall 0.2.5", - "redox_termios", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "termsize" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" dependencies = [ - "atty", - "kernel32-sys", - "libc", - "termion", - "winapi 0.2.8", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "term_size", - "unicode-width", + "term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thiserror" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thiserror-impl" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thread_local" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" dependencies = [ - "lazy_static", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" dependencies = [ - "libc", - "redox_syscall 0.1.57", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tinytemplate" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ - "serde", - "serde_json", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "typenum" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "unicode-width" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" [[package]] name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "unindent" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" [[package]] name = "unix_socket" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" dependencies = [ - "cfg-if 0.1.10", - "libc", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "users" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" dependencies = [ - "libc", - "log", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_arch" version = "0.0.4" dependencies = [ - "platform-info", - "uucore", - "uucore_procs", + "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_base32" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_base64" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_basename" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cat" version = "0.0.4" dependencies = [ - "quick-error", - "unix_socket", - "uucore", - "uucore_procs", + "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_chgrp" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", - "walkdir", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_chmod" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", - "walkdir", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_chown" version = "0.0.4" dependencies = [ - "clap", - "glob 0.3.0", - "uucore", - "uucore_procs", - "walkdir", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_chroot" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cksum" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_comm" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cp" version = "0.0.4" dependencies = [ - "clap", - "filetime", - "ioctl-sys", - "libc", - "quick-error", - "uucore", - "uucore_procs", - "walkdir", - "winapi 0.3.9", - "xattr", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_csplit" version = "0.0.4" dependencies = [ - "getopts", - "glob 0.2.11", - "regex", - "thiserror", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cut" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_date" version = "0.0.4" dependencies = [ - "chrono", - "clap", - "uucore", - "uucore_procs", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_df" version = "0.0.4" dependencies = [ - "clap", - "libc", - "number_prefix", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_dircolors" version = "0.0.4" dependencies = [ - "glob 0.3.0", - "uucore", - "uucore_procs", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_dirname" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_du" version = "0.0.4" dependencies = [ - "time", - "uucore", - "uucore_procs", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_echo" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_env" version = "0.0.4" dependencies = [ - "clap", - "libc", - "rust-ini", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_expand" version = "0.0.4" dependencies = [ - "getopts", - "unicode-width", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_expr" version = "0.0.4" dependencies = [ - "libc", - "onig", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_factor" version = "0.0.4" dependencies = [ - "criterion", - "num-traits", - "paste", - "quickcheck", - "rand 0.7.3", - "rand_chacha", - "smallvec", - "uucore", - "uucore_procs", + "criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_false" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_fmt" version = "0.0.4" dependencies = [ - "clap", - "libc", - "unicode-width", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_fold" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_groups" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_hashsum" version = "0.0.4" dependencies = [ - "blake2-rfc", - "clap", - "digest", - "hex", - "libc", - "md5", - "regex", - "regex-syntax", - "sha1", - "sha2", - "sha3", - "uucore", - "uucore_procs", + "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_head" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_hostid" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_hostname" version = "0.0.4" dependencies = [ - "clap", - "hostname", - "libc", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_id" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_install" version = "0.0.4" dependencies = [ - "clap", - "filetime", - "libc", - "time", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_join" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_kill" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_link" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_ln" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_logname" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_ls" version = "0.0.4" dependencies = [ - "atty", - "getopts", - "lazy_static", - "number_prefix", - "term_grid", - "termsize", - "time", - "unicode-width", - "uucore", - "uucore_procs", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mkdir" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mkfifo" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mknod" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mktemp" version = "0.0.4" dependencies = [ - "clap", - "rand 0.5.6", - "tempfile", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_more" version = "0.0.4" dependencies = [ - "getopts", - "nix 0.8.1", - "redox_syscall 0.1.57", - "redox_termios", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mv" version = "0.0.4" dependencies = [ - "clap", - "fs_extra", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nice" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nl" version = "0.0.4" dependencies = [ - "aho-corasick", - "getopts", - "libc", - "memchr 2.3.4", - "regex", - "regex-syntax", - "uucore", - "uucore_procs", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nohup" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nproc" version = "0.0.4" dependencies = [ - "clap", - "libc", - "num_cpus", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_numfmt" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_od" version = "0.0.4" dependencies = [ - "byteorder", - "getopts", - "half", - "libc", - "uucore", - "uucore_procs", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_paste" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_pathchk" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_pinky" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_printenv" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_printf" version = "0.0.4" dependencies = [ - "itertools 0.8.2", - "uucore", - "uucore_procs", + "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_ptx" version = "0.0.4" dependencies = [ - "aho-corasick", - "getopts", - "libc", - "memchr 2.3.4", - "regex", - "regex-syntax", - "uucore", - "uucore_procs", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_pwd" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_readlink" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_realpath" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_relpath" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_rm" version = "0.0.4" dependencies = [ - "clap", - "remove_dir_all", - "uucore", - "uucore_procs", - "walkdir", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_rmdir" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_seq" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_shred" version = "0.0.4" dependencies = [ - "filetime", - "getopts", - "libc", - "rand 0.5.6", - "time", - "uucore", - "uucore_procs", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_shuf" version = "0.0.4" dependencies = [ - "getopts", - "rand 0.5.6", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_sleep" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_sort" version = "0.0.4" dependencies = [ - "clap", - "itertools 0.8.2", - "semver", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_split" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_stat" version = "0.0.4" dependencies = [ - "clap", - "time", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_stdbuf" version = "0.0.4" dependencies = [ - "getopts", - "tempfile", - "uu_stdbuf_libstdbuf", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uu_stdbuf_libstdbuf 0.0.4", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_stdbuf_libstdbuf" version = "0.0.4" dependencies = [ - "cpp", - "cpp_build", - "libc", - "uucore", - "uucore_procs", + "cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_sum" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_sync" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_tac" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tail" version = "0.0.4" dependencies = [ - "clap", - "libc", - "redox_syscall 0.1.57", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_tee" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_test" version = "0.0.4" dependencies = [ - "libc", - "redox_syscall 0.1.57", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_timeout" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_touch" version = "0.0.4" dependencies = [ - "clap", - "filetime", - "time", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tr" version = "0.0.4" dependencies = [ - "bit-set", - "fnv", - "getopts", - "uucore", - "uucore_procs", + "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_true" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_truncate" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tsort" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tty" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_uname" version = "0.0.4" dependencies = [ - "clap", - "platform-info", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_unexpand" version = "0.0.4" dependencies = [ - "getopts", - "unicode-width", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_uniq" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_unlink" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_uptime" version = "0.0.4" dependencies = [ - "chrono", - "clap", - "uucore", - "uucore_procs", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_users" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_wc" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_who" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_whoami" version = "0.0.4" dependencies = [ - "advapi32-sys", - "clap", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_yes" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uucore" version = "0.0.7" dependencies = [ - "data-encoding", - "dunce", - "getopts", - "lazy_static", - "libc", - "nix 0.13.1", - "platform-info", - "termion", - "thiserror", - "time", - "wild", + "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uucore_procs" version = "0.0.5" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "walkdir" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" dependencies = [ - "same-file", - "winapi 0.3.9", - "winapi-util", + "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7" dependencies = [ - "cfg-if 1.0.0", - "wasm-bindgen-macro", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8" dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote 1.0.9", - "syn", - "wasm-bindgen-shared", + "bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b" dependencies = [ - "quote 1.0.9", - "wasm-bindgen-macro-support", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1" [[package]] name = "web-sys" version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b" dependencies = [ - "js-sys", - "wasm-bindgen", + "js-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wild" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" dependencies = [ - "glob 0.3.0", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" dependencies = [ - "winapi 0.3.9", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" dependencies = [ - "libc", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] + +[metadata] +"checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" +"checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" +"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +"checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +"checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" +"checksum bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" +"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +"checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" +"checksum bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" +"checksum bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" +"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" +"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +"checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" +"checksum cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)" = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" +"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +"checksum cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" +"checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" +"checksum cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" +"checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" +"checksum cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" +"checksum cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" +"checksum cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" +"checksum cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" +"checksum cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" +"checksum cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" +"checksum criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" +"checksum criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" +"checksum crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" +"checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" +"checksum crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" +"checksum crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" +"checksum csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" +"checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" +"checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" +"checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" +"checksum dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" +"checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +"checksum filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" +"checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +"checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +"checksum generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" +"checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +"checksum getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" +"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +"checksum half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" +"checksum hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +"checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" +"checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +"checksum if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" +"checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" +"checksum itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" +"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" +"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +"checksum itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +"checksum js-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)" = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +"checksum libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)" = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" +"checksum log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +"checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" +"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" +"checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" +"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" +"checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +"checksum memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" +"checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" +"checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" +"checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +"checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +"checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +"checksum number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" +"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" +"checksum onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" +"checksum onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" +"checksum oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +"checksum paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" +"checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" +"checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" +"checksum platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" +"checksum plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" +"checksum plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" +"checksum plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" +"checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +"checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" +"checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +"checksum quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" +"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" +"checksum quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" +"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +"checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +"checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +"checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" +"checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" +"checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +"checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" +"checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" +"checksum regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "54fd1046a3107eb58f42de31d656fee6853e5d276c455fd943742dce89fc3dd3" +"checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" +"checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" +"checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +"checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" +"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +"checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" +"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)" = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" +"checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" +"checksum serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)" = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" +"checksum serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)" = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" +"checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" +"checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" +"checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" +"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +"checksum syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)" = "8fd9bc7ccc2688b3344c2f48b9b546648b25ce0b20fc717ee7fa7981a8ca9717" +"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +"checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" +"checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" +"checksum termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" +"checksum termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" +"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +"checksum thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" +"checksum thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" +"checksum thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +"checksum typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" +"checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" +"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +"checksum unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" +"checksum unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" +"checksum users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" +"checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" +"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +"checksum wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7" +"checksum wasm-bindgen-backend 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8" +"checksum wasm-bindgen-macro 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b" +"checksum wasm-bindgen-macro-support 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e" +"checksum wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1" +"checksum web-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)" = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b" +"checksum wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" From 5ec1bba5e8095f49f904cdd74f3db3c32bd0e058 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 13 Mar 2021 12:42:52 +0100 Subject: [PATCH 0029/1135] touch: use arggroup for sources --- src/uu/touch/src/touch.rs | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 1cd3b2a70..1cb551fd2 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -13,7 +13,7 @@ pub extern crate filetime; #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{App, Arg, ArgGroup}; use filetime::*; use std::fs::{self, File}; use std::io::Error; @@ -129,6 +129,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .min_values(1), ) + .group(ArgGroup::with_name("sources").args(&[ + options::sources::CURRENT, + options::sources::DATE, + options::sources::REFERENCE, + ])) .get_matches_from(args); let files: Vec = matches @@ -136,19 +141,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); - if matches.is_present(options::sources::DATE) - && (matches.is_present(options::sources::REFERENCE) - || matches.is_present(options::sources::CURRENT)) - || matches.is_present(options::sources::REFERENCE) - && (matches.is_present(options::sources::DATE) - || matches.is_present(options::sources::CURRENT)) - || matches.is_present(options::sources::CURRENT) - && (matches.is_present(options::sources::DATE) - || matches.is_present(options::sources::REFERENCE)) - { - panic!("Invalid options: cannot specify reference time from more than one source"); - } - let (mut atime, mut mtime) = if matches.is_present(options::sources::REFERENCE) { stat( &matches.value_of(options::sources::REFERENCE).unwrap()[..], @@ -188,10 +180,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; // Minor optimization: if no reference time was specified, we're done. - if !(matches.is_present(options::sources::DATE) - || matches.is_present(options::sources::REFERENCE) - || matches.is_present(options::sources::CURRENT)) - { + if !matches.is_present("sources") { continue; } } From dfc7a9505424539ee02aa0c051f16ddb98539ef4 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 13 Mar 2021 12:46:54 +0100 Subject: [PATCH 0030/1135] tests/touch: add tests for multiple sources --- tests/by-util/test_touch.rs | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index 7e04beced..52b0c1f51 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -203,6 +203,44 @@ fn test_touch_set_only_mtime_failed() { ucmd.args(&["-t", "2015010112342", "-m", file]).fails(); } +#[test] +fn test_touch_set_both_time_and_reference() { + let (at, mut ucmd) = at_and_ucmd!(); + let ref_file = "test_touch_reference"; + let file = "test_touch_set_both_time_and_reference"; + + let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); + + at.touch(ref_file); + set_file_times(&at, ref_file, start_of_year, start_of_year); + assert!(at.file_exists(ref_file)); + + ucmd.args(&["-t", "2015010112342", "-r", ref_file]).fails(); +} + +#[test] +fn test_touch_set_both_date_and_reference() { + let (at, mut ucmd) = at_and_ucmd!(); + let ref_file = "test_touch_reference"; + let file = "test_touch_set_both_date_and_reference"; + + let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); + + at.touch(ref_file); + set_file_times(&at, ref_file, start_of_year, start_of_year); + assert!(at.file_exists(ref_file)); + + ucmd.args(&["-d", "Thu Jan 01 12:34:00 2015", "-r", ref_file]).fails(); +} + +#[test] +fn test_touch_set_both_time_and_date() { + let (at, mut ucmd) = at_and_ucmd!(); + let file = "test_touch_set_both_time_and_date"; + + ucmd.args(&["-t", "2015010112342", "-d", "Thu Jan 01 12:34:00 2015", file]).fails(); +} + #[test] fn test_touch_set_only_mtime() { let (at, mut ucmd) = at_and_ucmd!(); From 86422a70d2b1c3b737175ddec4189d5568b81536 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 13 Mar 2021 12:47:20 +0100 Subject: [PATCH 0031/1135] touch: turn macros into functions --- src/uu/touch/src/touch.rs | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 1cb551fd2..e362329b3 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -36,23 +36,15 @@ pub mod options { static ARG_FILES: &str = "files"; -// Since touch's date/timestamp parsing doesn't account for timezone, the -// returned value from time::strptime() is UTC. We get system's timezone to -// localize the time. -macro_rules! to_local( - ($exp:expr) => ({ - let mut tm = $exp; - tm.tm_utcoff = time::now().tm_utcoff; - tm - }) -); +fn to_local(mut tm: time::Tm) -> time::Tm { + tm.tm_utcoff = time::now().tm_utcoff; + tm +} -macro_rules! local_tm_to_filetime( - ($exp:expr) => ({ - let ts = $exp.to_timespec(); - FileTime::from_unix_time(ts.sec as i64, ts.nsec as u32) - }) -); +fn local_tm_to_filetime(tm: time::Tm) -> FileTime { + let ts = tm.to_timespec(); + FileTime::from_unix_time(ts.sec as i64, ts.nsec as u32) +} fn get_usage() -> String { format!("{0} [OPTION]... [USER]", executable!()) @@ -161,7 +153,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; (timestamp, timestamp) } else { - let now = local_tm_to_filetime!(time::now()); + let now = local_tm_to_filetime(time::now()); (now, now) }; @@ -249,7 +241,7 @@ fn parse_date(str: &str) -> FileTime { // not about to implement GNU parse_datetime. // http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=lib/parse-datetime.y match time::strptime(str, "%c") { - Ok(tm) => local_tm_to_filetime!(to_local!(tm)), + Ok(tm) => local_tm_to_filetime(to_local(tm)), Err(e) => panic!("Unable to parse date\n{}", e), } } @@ -267,7 +259,7 @@ fn parse_timestamp(s: &str) -> FileTime { }; match time::strptime(&ts, format) { - Ok(tm) => local_tm_to_filetime!(to_local!(tm)), + Ok(tm) => local_tm_to_filetime(to_local(tm)), Err(e) => panic!("Unable to parse timestamp\n{}", e), } } From ed2787a6dfee224a2e9f8df03f6d8101f0afece7 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 13 Mar 2021 13:25:36 +0100 Subject: [PATCH 0032/1135] test/touch: fmt --- tests/by-util/test_touch.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index 52b0c1f51..9921c16b5 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -215,7 +215,8 @@ fn test_touch_set_both_time_and_reference() { set_file_times(&at, ref_file, start_of_year, start_of_year); assert!(at.file_exists(ref_file)); - ucmd.args(&["-t", "2015010112342", "-r", ref_file]).fails(); + ucmd.args(&["-t", "2015010112342", "-r", ref_file, file]) + .fails(); } #[test] @@ -230,15 +231,23 @@ fn test_touch_set_both_date_and_reference() { set_file_times(&at, ref_file, start_of_year, start_of_year); assert!(at.file_exists(ref_file)); - ucmd.args(&["-d", "Thu Jan 01 12:34:00 2015", "-r", ref_file]).fails(); + ucmd.args(&["-d", "Thu Jan 01 12:34:00 2015", "-r", ref_file, file]) + .fails(); } #[test] fn test_touch_set_both_time_and_date() { - let (at, mut ucmd) = at_and_ucmd!(); + let (_at, mut ucmd) = at_and_ucmd!(); let file = "test_touch_set_both_time_and_date"; - ucmd.args(&["-t", "2015010112342", "-d", "Thu Jan 01 12:34:00 2015", file]).fails(); + ucmd.args(&[ + "-t", + "2015010112342", + "-d", + "Thu Jan 01 12:34:00 2015", + file, + ]) + .fails(); } #[test] From 44c390c29095b6f1498402877608556e5c7d1e13 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 13 Mar 2021 13:52:08 +0100 Subject: [PATCH 0033/1135] touch: constant for the sources ArgGroup --- src/uu/touch/src/touch.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index e362329b3..39405900e 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -22,6 +22,8 @@ use std::path::Path; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Update the access and modification times of each FILE to the current time."; pub mod options { + // Both SOURCES and sources are needed as we need to be able to refer to the ArgGroup. + pub static SOURCES: &str = "sources"; pub mod sources { pub static DATE: &str = "date"; pub static REFERENCE: &str = "reference"; @@ -121,7 +123,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .min_values(1), ) - .group(ArgGroup::with_name("sources").args(&[ + .group(ArgGroup::with_name(options::SOURCES).args(&[ options::sources::CURRENT, options::sources::DATE, options::sources::REFERENCE, @@ -172,7 +174,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; // Minor optimization: if no reference time was specified, we're done. - if !matches.is_present("sources") { + if !matches.is_present(options::SOURCES) { continue; } } From 9e98d24f5f370d28ad83e243e221edeb650e14bb Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 13 Mar 2021 23:43:36 +0100 Subject: [PATCH 0034/1135] ls: move from getopts to clap --- src/uu/ls/Cargo.toml | 2 +- src/uu/ls/src/ls.rs | 376 ++++++++++++++++++++++++++----------------- 2 files changed, 228 insertions(+), 150 deletions(-) diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index 10d7cc2da..59901f807 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/ls.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" lazy_static = "1.0.1" number_prefix = "0.4" term_grid = "0.1.5" diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index b8defa397..ec17ec2b3 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -13,6 +13,7 @@ extern crate lazy_static; #[macro_use] extern crate uucore; +use clap::{App, Arg}; use number_prefix::NumberPrefix; use std::cmp::Reverse; #[cfg(unix)] @@ -33,14 +34,20 @@ use unicode_width::UnicodeWidthStr; #[cfg(unix)] use uucore::libc::{mode_t, S_ISGID, S_ISUID, S_ISVTX, S_IWOTH, S_IXGRP, S_IXOTH, S_IXUSR}; -static NAME: &str = "ls"; -static SUMMARY: &str = ""; -static LONG_HELP: &str = " +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = " By default, ls will list the files and contents of any directories on the command line, expect that it will ignore files and directories whose names start with '.' "; +fn get_usage() -> String { + format!( + "{0} [OPTION]... [FILE]...", + executable!() + ) +} + #[cfg(unix)] static DEFAULT_COLORS: &str = "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:"; @@ -52,7 +59,7 @@ lazy_static! { let codes = LS_COLORS.split(':'); let mut map = HashMap::new(); for c in codes { - let p: Vec<_> = c.split('=').collect(); + let p: Vec<_> = c.splitn(1, '=').collect(); if p.len() == 2 { map.insert(p[0], p[1]); } @@ -65,107 +72,175 @@ lazy_static! { static ref END_CODE: &'static str = COLOR_MAP.get("ec").unwrap_or(&""); } +pub mod options { + pub static ONE: &str = "1"; + pub static ALL: &str = "all"; + pub static ALMOST_ALL: &str = "almost-all"; + pub static IGNORE_BACKUPS: &str = "ignore-backups"; + pub static COLUMNS: &str = "c"; + pub static DIRECTORY: &str = "directory"; + pub static CLASSIFY: &str = "classify"; + pub static HUMAN_READABLE: &str = "human-readable"; + pub static INODE: &str = "inode"; + pub static DEREFERENCE: &str = "dereference"; + pub static LONG: &str = "long"; + pub static NUMERIC_UID_GID: &str = "numeric-uid-gid"; + pub static REVERSE: &str = "reverse"; + pub static RECURSIVE: &str = "recursive"; + pub static SORT_SIZE: &str = "S"; + pub static SORT_TIME: &str = "t"; + pub static SORT_NONE: &str = "U"; + pub static COLOR: &str = "color"; + pub static PATHS: &str = "paths"; +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let syntax = format!( - "[OPTION]... DIRECTORY - {0} [OPTION]... [FILE]...", - NAME - ); - let matches = app!(&syntax, SUMMARY, LONG_HELP) - .optflag("1", "", "list one file per line.") - .optflag( - "a", - "all", - "Do not ignore hidden files (files with names that start with '.').", + let usage = get_usage(); + + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(options::ONE) + .short(options::ONE) + .help("list one file per line."), ) - .optflag( - "A", - "almost-all", - "In a directory, do not ignore all file names that start with '.', only ignore \ - '.' and '..'.", + .arg( + Arg::with_name(options::ALL) + .short("a") + .long(options::ALL) + .help("Do not ignore hidden files (files with names that start with '.')."), ) - .optflag("B", "ignore-backups", "Ignore entries which end with ~.") - .optflag( - "c", - "", - "If the long listing format (e.g., -l, -o) is being used, print the status \ - change time (the ‘ctime’ in the inode) instead of the modification time. When \ - explicitly sorting by time (--sort=time or -t) or when not using a long listing \ - format, sort according to the status change time.", + .arg( + Arg::with_name(options::ALMOST_ALL) + .short("A") + .long(options::ALMOST_ALL) + .help( + "In a directory, do not ignore all file names that start with '.', only ignore \ + '.' and '..'.", + ), ) - .optflag( - "d", - "directory", - "Only list the names of directories, rather than listing directory contents. \ - This will not follow symbolic links unless one of `--dereference-command-line \ - (-H)`, `--dereference (-L)`, or `--dereference-command-line-symlink-to-dir` is \ - specified.", + .arg( + Arg::with_name(options::IGNORE_BACKUPS) + .short("B") + .long(options::IGNORE_BACKUPS) + .help("Ignore entries which end with ~."), ) - .optflag( - "F", - "classify", - "Append a character to each file name indicating the file type. Also, for \ - regular files that are executable, append '*'. The file type indicators are \ - '/' for directories, '@' for symbolic links, '|' for FIFOs, '=' for sockets, \ - '>' for doors, and nothing for regular files.", + .arg( + Arg::with_name(options::COLUMNS) + .short(options::COLUMNS) + .help("If the long listing format (e.g., -l, -o) is being used, print the status \ + change time (the ‘ctime’ in the inode) instead of the modification time. When \ + explicitly sorting by time (--sort=time or -t) or when not using a long listing \ + format, sort according to the status change time.", + )) + .arg( + Arg::with_name(options::DIRECTORY) + .short("d") + .long(options::DIRECTORY) + .help( + "Only list the names of directories, rather than listing directory contents. \ + This will not follow symbolic links unless one of `--dereference-command-line \ + (-H)`, `--dereference (-L)`, or `--dereference-command-line-symlink-to-dir` is \ + specified.", + ), ) - .optflag( - "h", - "human-readable", - "Print human readable file sizes (e.g. 1K 234M 56G).", + .arg( + Arg::with_name(options::CLASSIFY) + .short("F") + .long(options::CLASSIFY) + .help("Append a character to each file name indicating the file type. Also, for \ + regular files that are executable, append '*'. The file type indicators are \ + '/' for directories, '@' for symbolic links, '|' for FIFOs, '=' for sockets, \ + '>' for doors, and nothing for regular files.", + )) + .arg( + Arg::with_name(options::HUMAN_READABLE) + .short("h") + .long(options::HUMAN_READABLE) + .help("Print human readable file sizes (e.g. 1K 234M 56G)."), ) - .optflag("i", "inode", "print the index number of each file") - .optflag( - "L", - "dereference", - "When showing file information for a symbolic link, show information for the \ - file the link references rather than the link itself.", + .arg( + Arg::with_name(options::INODE) + .short("i") + .long(options::INODE) + .help("print the index number of each file"), ) - .optflag("l", "long", "Display detailed information.") - .optflag("n", "numeric-uid-gid", "-l with numeric UIDs and GIDs.") - .optflag( - "r", - "reverse", - "Reverse whatever the sorting method is--e.g., list files in reverse \ - alphabetical order, youngest first, smallest first, or whatever.", + .arg( + Arg::with_name(options::DEREFERENCE) + .short("L") + .long(options::DEREFERENCE) + .help( + "When showing file information for a symbolic link, show information for the \ + file the link references rather than the link itself.", + ), ) - .optflag( - "R", - "recursive", - "List the contents of all directories recursively.", + .arg( + Arg::with_name(options::LONG) + .short("l") + .long(options::LONG) + .help("Display detailed information."), ) - .optflag("S", "", "Sort by file size, largest first.") - .optflag( - "t", - "", - "Sort by modification time (the 'mtime' in the inode), newest first.", + .arg( + Arg::with_name(options::NUMERIC_UID_GID) + .short("n") + .long(options::NUMERIC_UID_GID) + .help("-l with numeric UIDs and GIDs."), ) - .optflag( - "U", - "", - "Do not sort; list the files in whatever order they are stored in the \ - directory. This is especially useful when listing very large directories, \ - since not doing any sorting can be noticeably faster.", + .arg( + Arg::with_name(options::REVERSE) + .short("r") + .long(options::REVERSE) + .help("Reverse whatever the sorting method is--e.g., list files in reverse \ + alphabetical order, youngest first, smallest first, or whatever.", + )) + .arg( + Arg::with_name(options::RECURSIVE) + .short("R") + .long(options::RECURSIVE) + .help("List the contents of all directories recursively."), ) - .optflagopt( - "", - "color", - "Color output based on file type.", - "always|auto|never", + .arg( + Arg::with_name(options::SORT_SIZE) + .short(options::SORT_SIZE) + .help("Sort by file size, largest first."), ) - .parse(args); + .arg( + Arg::with_name(options::SORT_TIME) + .short(options::SORT_TIME) + .help("Sort by modification time (the 'mtime' in the inode), newest first."), + ) + .arg( + Arg::with_name(options::SORT_NONE) + .short(options::SORT_NONE) + .help("Do not sort; list the files in whatever order they are stored in the \ + directory. This is especially useful when listing very large directories, \ + since not doing any sorting can be noticeably faster.", + )) + .arg( + Arg::with_name(options::COLOR) + .long(options::COLOR) + .help("Color output based on file type.") + .possible_values(&["always", "yes", "force", "tty", "if-tty", "auto", "never", "no", "none"]) + .require_equals(true) + .empty_values(true), + ) + .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)) + .get_matches_from(args); list(matches) } -fn list(options: getopts::Matches) -> i32 { - let locs: Vec = if options.free.is_empty() { - vec![String::from(".")] - } else { - options.free.to_vec() - }; +fn list(options: clap::ArgMatches) -> i32 { + let locs: Vec = options + .values_of(options::PATHS) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_else(|| vec![String::from(".")]); + + let number_of_locs = locs.len(); let mut files = Vec::::new(); let mut dirs = Vec::::new(); @@ -181,9 +256,9 @@ fn list(options: getopts::Matches) -> i32 { } let mut dir = false; - if p.is_dir() && !options.opt_present("d") { + if p.is_dir() && !options.is_present(options::DIRECTORY) { dir = true; - if options.opt_present("l") && !(options.opt_present("L")) { + if options.is_present(options::LONG) && !options.is_present(options::DEREFERENCE) { if let Ok(md) = p.symlink_metadata() { if md.file_type().is_symlink() && !p.ends_with("/") { dir = false; @@ -202,7 +277,7 @@ fn list(options: getopts::Matches) -> i32 { sort_entries(&mut dirs, &options); for dir in dirs { - if options.free.len() > 1 { + if number_of_locs > 1 { println!("\n{}:", dir.to_string_lossy()); } enter_directory(&dir, &options); @@ -215,10 +290,10 @@ fn list(options: getopts::Matches) -> i32 { } #[cfg(any(unix, target_os = "redox"))] -fn sort_entries(entries: &mut Vec, options: &getopts::Matches) { - let mut reverse = options.opt_present("r"); - if options.opt_present("t") { - if options.opt_present("c") { +fn sort_entries(entries: &mut Vec, options: &clap::ArgMatches) { + let mut reverse = options.is_present(options::REVERSE); + if options.is_present(options::SORT_TIME) { + if options.is_present(options::COLUMNS) { entries.sort_by_key(|k| { Reverse(get_metadata(k, options).map(|md| md.ctime()).unwrap_or(0)) }); @@ -232,10 +307,10 @@ fn sort_entries(entries: &mut Vec, options: &getopts::Matches) { ) }); } - } else if options.opt_present("S") { + } else if options.is_present(options::SORT_SIZE) { entries.sort_by_key(|k| get_metadata(k, options).map(|md| md.size()).unwrap_or(0)); reverse = !reverse; - } else if !options.opt_present("U") { + } else if !options.is_present(options::SORT_NONE) { entries.sort(); } @@ -257,9 +332,9 @@ fn is_hidden(file_path: &DirEntry) -> std::io::Result { } #[cfg(windows)] -fn sort_entries(entries: &mut Vec, options: &getopts::Matches) { - let mut reverse = options.opt_present("r"); - if options.opt_present("t") { +fn sort_entries(entries: &mut Vec, options: &clap::ArgMatches) { + let mut reverse = options.is_present(options::REVERSE); + if options.is_present(options::SORT_TIME) { entries.sort_by_key(|k| { // Newest first Reverse( @@ -268,14 +343,14 @@ fn sort_entries(entries: &mut Vec, options: &getopts::Matches) { .unwrap_or(std::time::UNIX_EPOCH), ) }); - } else if options.opt_present("S") { + } else if options.is_present(options::SORT_SIZE) { entries.sort_by_key(|k| { get_metadata(k, options) .map(|md| md.file_size()) .unwrap_or(0) }); reverse = !reverse; - } else if !options.opt_present("U") { + } else if !options.is_present(options::SORT_NONE) { entries.sort(); } @@ -284,19 +359,22 @@ fn sort_entries(entries: &mut Vec, options: &getopts::Matches) { } } -fn should_display(entry: &DirEntry, options: &getopts::Matches) -> bool { +fn should_display(entry: &DirEntry, options: &clap::ArgMatches) -> bool { let ffi_name = entry.file_name(); let name = ffi_name.to_string_lossy(); - if !options.opt_present("a") && !options.opt_present("A") && is_hidden(entry).unwrap() { + if !options.is_present(options::ALL) + && !options.is_present(options::ALMOST_ALL) + && is_hidden(entry).unwrap() + { return false; } - if options.opt_present("B") && name.ends_with('~') { + if options.is_present(options::IGNORE_BACKUPS) && name.ends_with('~') { return false; } true } -fn enter_directory(dir: &PathBuf, options: &getopts::Matches) { +fn enter_directory(dir: &PathBuf, options: &clap::ArgMatches) { let mut entries: Vec<_> = safe_unwrap!(fs::read_dir(dir).and_then(Iterator::collect)); entries.retain(|e| should_display(e, options)); @@ -304,7 +382,7 @@ fn enter_directory(dir: &PathBuf, options: &getopts::Matches) { let mut entries: Vec<_> = entries.iter().map(DirEntry::path).collect(); sort_entries(&mut entries, options); - if options.opt_present("a") { + if options.is_present(options::ALL) { let mut display_entries = entries.clone(); display_entries.insert(0, dir.join("..")); display_entries.insert(0, dir.join(".")); @@ -313,7 +391,7 @@ fn enter_directory(dir: &PathBuf, options: &getopts::Matches) { display_items(&entries, Some(dir), options); } - if options.opt_present("R") { + if options.is_present(options::RECURSIVE) { for e in entries.iter().filter(|p| p.is_dir()) { println!("\n{}:", e.to_string_lossy()); enter_directory(&e, options); @@ -321,15 +399,15 @@ fn enter_directory(dir: &PathBuf, options: &getopts::Matches) { } } -fn get_metadata(entry: &PathBuf, options: &getopts::Matches) -> std::io::Result { - if options.opt_present("L") { +fn get_metadata(entry: &PathBuf, options: &clap::ArgMatches) -> std::io::Result { + if options.is_present(options::DEREFERENCE) { entry.metadata().or_else(|_| entry.symlink_metadata()) } else { entry.symlink_metadata() } } -fn display_dir_entry_size(entry: &PathBuf, options: &getopts::Matches) -> (usize, usize) { +fn display_dir_entry_size(entry: &PathBuf, options: &clap::ArgMatches) -> (usize, usize) { if let Ok(md) = get_metadata(entry, options) { ( display_symlink_count(&md).len(), @@ -341,17 +419,11 @@ fn display_dir_entry_size(entry: &PathBuf, options: &getopts::Matches) -> (usize } fn pad_left(string: String, count: usize) -> String { - if count > string.len() { - let pad = count - string.len(); - let pad = String::from_utf8(vec![b' '; pad]).unwrap(); - format!("{}{}", pad, string) - } else { - string - } + format!("{:>width$}", string, width = count) } -fn display_items(items: &[PathBuf], strip: Option<&Path>, options: &getopts::Matches) { - if options.opt_present("long") || options.opt_present("numeric-uid-gid") { +fn display_items(items: &[PathBuf], strip: Option<&Path>, options: &clap::ArgMatches) { + if options.is_present(options::LONG) || options.is_present(options::NUMERIC_UID_GID) { let (mut max_links, mut max_size) = (1, 1); for item in items { let (links, size) = display_dir_entry_size(item, options); @@ -362,7 +434,7 @@ fn display_items(items: &[PathBuf], strip: Option<&Path>, options: &getopts::Mat display_item_long(item, strip, max_links, max_size, options); } } else { - if !options.opt_present("1") { + if !options.is_present(options::ONE) { let names = items.iter().filter_map(|i| { let md = get_metadata(i, options); match md { @@ -410,7 +482,7 @@ fn display_item_long( strip: Option<&Path>, max_links: usize, max_size: usize, - options: &getopts::Matches, + options: &clap::ArgMatches, ) { let md = match get_metadata(item, options) { Err(e) => { @@ -436,8 +508,8 @@ fn display_item_long( } #[cfg(unix)] -fn get_inode(metadata: &Metadata, options: &getopts::Matches) -> String { - if options.opt_present("inode") { +fn get_inode(metadata: &Metadata, options: &clap::ArgMatches) -> String { + if options.is_present(options::INODE) { format!("{:8} ", metadata.ino()) } else { "".to_string() @@ -445,7 +517,7 @@ fn get_inode(metadata: &Metadata, options: &getopts::Matches) -> String { } #[cfg(not(unix))] -fn get_inode(_metadata: &Metadata, _options: &getopts::Matches) -> String { +fn get_inode(_metadata: &Metadata, _options: &clap::ArgMatches) -> String { "".to_string() } @@ -455,8 +527,8 @@ fn get_inode(_metadata: &Metadata, _options: &getopts::Matches) -> String { use uucore::entries; #[cfg(unix)] -fn display_uname(metadata: &Metadata, options: &getopts::Matches) -> String { - if options.opt_present("numeric-uid-gid") { +fn display_uname(metadata: &Metadata, options: &clap::ArgMatches) -> String { + if options.is_present(options::NUMERIC_UID_GID) { metadata.uid().to_string() } else { entries::uid2usr(metadata.uid()).unwrap_or_else(|_| metadata.uid().to_string()) @@ -464,8 +536,8 @@ fn display_uname(metadata: &Metadata, options: &getopts::Matches) -> String { } #[cfg(unix)] -fn display_group(metadata: &Metadata, options: &getopts::Matches) -> String { - if options.opt_present("numeric-uid-gid") { +fn display_group(metadata: &Metadata, options: &clap::ArgMatches) -> String { + if options.is_present(options::NUMERIC_UID_GID) { metadata.gid().to_string() } else { entries::gid2grp(metadata.gid()).unwrap_or_else(|_| metadata.gid().to_string()) @@ -474,19 +546,19 @@ fn display_group(metadata: &Metadata, options: &getopts::Matches) -> String { #[cfg(not(unix))] #[allow(unused_variables)] -fn display_uname(metadata: &Metadata, _options: &getopts::Matches) -> String { +fn display_uname(metadata: &Metadata, _options: &clap::ArgMatches) -> String { "somebody".to_string() } #[cfg(not(unix))] #[allow(unused_variables)] -fn display_group(metadata: &Metadata, _options: &getopts::Matches) -> String { +fn display_group(metadata: &Metadata, _options: &clap::ArgMatches) -> String { "somegroup".to_string() } #[cfg(unix)] -fn display_date(metadata: &Metadata, options: &getopts::Matches) -> String { - let secs = if options.opt_present("c") { +fn display_date(metadata: &Metadata, options: &clap::ArgMatches) -> String { + let secs = if options.is_present(options::COLUMNS) { metadata.ctime() } else { metadata.mtime() @@ -497,7 +569,7 @@ fn display_date(metadata: &Metadata, options: &getopts::Matches) -> String { #[cfg(not(unix))] #[allow(unused_variables)] -fn display_date(metadata: &Metadata, options: &getopts::Matches) -> String { +fn display_date(metadata: &Metadata, options: &clap::ArgMatches) -> String { if let Ok(mtime) = metadata.modified() { let time = time::at(Timespec::new( mtime @@ -512,8 +584,10 @@ fn display_date(metadata: &Metadata, options: &getopts::Matches) -> String { } } -fn display_file_size(metadata: &Metadata, options: &getopts::Matches) -> String { - if options.opt_present("human-readable") { +fn display_file_size(metadata: &Metadata, options: &clap::ArgMatches) -> String { + // NOTE: The human-readable behaviour deviates from the GNU ls. + // The GNU ls uses binary prefixes by default. + if options.is_present(options::HUMAN_READABLE) { match NumberPrefix::decimal(metadata.len() as f64) { NumberPrefix::Standalone(bytes) => bytes.to_string(), NumberPrefix::Prefixed(prefix, bytes) => { @@ -551,15 +625,15 @@ fn display_file_name( path: &Path, strip: Option<&Path>, metadata: &Metadata, - options: &getopts::Matches, + options: &clap::ArgMatches, ) -> Cell { let mut name = get_file_name(path, strip); - if !options.opt_present("long") { + if !options.is_present(options::LONG) { name = get_inode(metadata, options) + &name; } - if options.opt_present("classify") { + if options.is_present(options::CLASSIFY) { let file_type = metadata.file_type(); if file_type.is_dir() { name.push('/'); @@ -568,7 +642,7 @@ fn display_file_name( } } - if options.opt_present("long") && metadata.file_type().is_symlink() { + if options.is_present(options::LONG) && metadata.file_type().is_symlink() { if let Ok(target) = path.read_link() { // We don't bother updating width here because it's not used for long listings let target_name = target.to_string_lossy().to_string(); @@ -613,23 +687,27 @@ fn display_file_name( path: &Path, strip: Option<&Path>, metadata: &Metadata, - options: &getopts::Matches, + options: &clap::ArgMatches, ) -> Cell { let mut name = get_file_name(path, strip); - if !options.opt_present("long") { + if !options.is_present(options::LONG) { name = get_inode(metadata, options) + &name; } let mut width = UnicodeWidthStr::width(&*name); - let color = match options.opt_str("color") { - None => atty::is(atty::Stream::Stdout), - Some(val) => match val.as_ref() { - "always" | "yes" | "force" => true, - "auto" | "tty" | "if-tty" => atty::is(atty::Stream::Stdout), - /* "never" | "no" | "none" | */ _ => false, - }, + let color = if options.is_present(options::COLOR) { + match options.value_of(options::COLOR) { + None => atty::is(atty::Stream::Stdout), + Some(val) => match val { + "" | "always" | "yes" | "force" => true, + "auto" | "tty" | "if-tty" => atty::is(atty::Stream::Stdout), + /* "never" | "no" | "none" | */ _ => false, + }, + } + } else { + false }; - let classify = options.opt_present("classify"); + let classify = options.is_present(options::CLASSIFY); let ext; if color || classify { @@ -693,7 +771,7 @@ fn display_file_name( } } - if options.opt_present("long") && metadata.file_type().is_symlink() { + if options.is_present(options::LONG) && metadata.file_type().is_symlink() { if let Ok(target) = path.read_link() { // We don't bother updating width here because it's not used for long listings let code = if target.exists() { "fi" } else { "mi" }; From 7c8e8b2d4cce76b7c3bdddd11a1dcc4b683d6e4e Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 14 Mar 2021 12:22:32 +0100 Subject: [PATCH 0035/1135] ls: refactor arguments into a config struct --- src/uu/ls/src/ls.rs | 419 ++++++++++++++++++++++++++------------------ 1 file changed, 253 insertions(+), 166 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index ec17ec2b3..d61a45702 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -42,10 +42,7 @@ static ABOUT: &str = " "; fn get_usage() -> String { - format!( - "{0} [OPTION]... [FILE]...", - executable!() - ) + format!("{0} [OPTION]... [FILE]...", executable!()) } #[cfg(unix)] @@ -73,11 +70,10 @@ lazy_static! { } pub mod options { - pub static ONE: &str = "1"; + pub static ONELINE: &str = "1"; pub static ALL: &str = "all"; pub static ALMOST_ALL: &str = "almost-all"; pub static IGNORE_BACKUPS: &str = "ignore-backups"; - pub static COLUMNS: &str = "c"; pub static DIRECTORY: &str = "directory"; pub static CLASSIFY: &str = "classify"; pub static HUMAN_READABLE: &str = "human-readable"; @@ -90,10 +86,128 @@ pub mod options { pub static SORT_SIZE: &str = "S"; pub static SORT_TIME: &str = "t"; pub static SORT_NONE: &str = "U"; + pub static SORT_CTIME: &str = "c"; pub static COLOR: &str = "color"; pub static PATHS: &str = "paths"; } +#[derive(PartialEq, Eq)] +enum DisplayOptions { + Columns, + Long, + OneLine, +} + +enum Sort { + None, + Name, + Size, + Time, + CTime, +} + +enum SizeFormats { + Bytes, + Binary, // Powers of 1024, --human-readable +} + +#[derive(PartialEq, Eq)] +enum Files { + All, + AlmostAll, + Normal, +} + +struct Config { + display: DisplayOptions, + files: Files, + sort: Sort, + + recursive: bool, + reverse: bool, + dereference: bool, + classify: bool, + ignore_backups: bool, + size_format: SizeFormats, + numeric_uid_gid: bool, + directory: bool, + #[cfg(unix)] + inode: bool, + #[cfg(unix)] + color: bool, +} + +impl Config { + fn from(options: clap::ArgMatches) -> Config { + let display = if options.is_present(options::LONG) { + DisplayOptions::Long + } else if options.is_present(options::ONELINE) { + DisplayOptions::OneLine + } else { + DisplayOptions::Columns + }; + + let files = if options.is_present(options::ALL) { + Files::All + } else if options.is_present(options::ALMOST_ALL) { + Files::AlmostAll + } else { + Files::Normal + }; + + let sort = if options.is_present(options::SORT_TIME) { + Sort::Time + } else if options.is_present(options::SORT_CTIME) { + Sort::CTime + } else if options.is_present(options::SORT_SIZE) { + Sort::Size + } else if options.is_present(options::SORT_NONE) { + Sort::None + } else { + Sort::Name + }; + + #[cfg(unix)] + let color = if options.is_present(options::COLOR) { + match options.value_of(options::COLOR) { + None => atty::is(atty::Stream::Stdout), + Some(val) => match val { + "" | "always" | "yes" | "force" => true, + "auto" | "tty" | "if-tty" => atty::is(atty::Stream::Stdout), + /* "never" | "no" | "none" | */ _ => false, + }, + } + } else { + false + }; + + let size_format = if options.is_present(options::HUMAN_READABLE) { + SizeFormats::Binary + } else { + SizeFormats::Bytes + }; + + Config { + display, + files, + sort, + + recursive: options.is_present(options::RECURSIVE), + reverse: options.is_present(options::REVERSE), + dereference: options.is_present(options::DEREFERENCE), + classify: options.is_present(options::CLASSIFY), + ignore_backups: options.is_present(options::IGNORE_BACKUPS), + size_format, + numeric_uid_gid: options.is_present(options::NUMERIC_UID_GID), + directory: options.is_present(options::DIRECTORY), + #[cfg(unix)] + color, + #[cfg(unix)] + inode: options.is_present(options::INODE), + } + } +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); @@ -104,8 +218,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .arg( - Arg::with_name(options::ONE) - .short(options::ONE) + Arg::with_name(options ::ONELINE) + .short(options ::ONELINE) .help("list one file per line."), ) .arg( @@ -130,8 +244,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("Ignore entries which end with ~."), ) .arg( - Arg::with_name(options::COLUMNS) - .short(options::COLUMNS) + Arg::with_name(options::SORT_CTIME) + .short(options::SORT_CTIME) .help("If the long listing format (e.g., -l, -o) is being used, print the status \ change time (the ‘ctime’ in the inode) instead of the modification time. When \ explicitly sorting by time (--sort=time or -t) or when not using a long listing \ @@ -231,15 +345,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)) .get_matches_from(args); - list(matches) -} - -fn list(options: clap::ArgMatches) -> i32 { - let locs: Vec = options + let locs = matches .values_of(options::PATHS) .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_else(|| vec![String::from(".")]); + list(locs, Config::from(matches)) +} + +fn list(locs: Vec, config: Config) -> i32 { let number_of_locs = locs.len(); let mut files = Vec::::new(); @@ -256,9 +370,9 @@ fn list(options: clap::ArgMatches) -> i32 { } let mut dir = false; - if p.is_dir() && !options.is_present(options::DIRECTORY) { + if p.is_dir() && !config.directory { dir = true; - if options.is_present(options::LONG) && !options.is_present(options::DEREFERENCE) { + if config.display == DisplayOptions::Long && !config.dereference { if let Ok(md) = p.symlink_metadata() { if md.file_type().is_symlink() && !p.ends_with("/") { dir = false; @@ -272,15 +386,15 @@ fn list(options: clap::ArgMatches) -> i32 { files.push(p); } } - sort_entries(&mut files, &options); - display_items(&files, None, &options); + sort_entries(&mut files, &config); + display_items(&files, None, &config); - sort_entries(&mut dirs, &options); + sort_entries(&mut dirs, &config); for dir in dirs { if number_of_locs > 1 { println!("\n{}:", dir.to_string_lossy()); } - enter_directory(&dir, &options); + enter_directory(&dir, &config); } if has_failed { 1 @@ -290,128 +404,118 @@ fn list(options: clap::ArgMatches) -> i32 { } #[cfg(any(unix, target_os = "redox"))] -fn sort_entries(entries: &mut Vec, options: &clap::ArgMatches) { - let mut reverse = options.is_present(options::REVERSE); - if options.is_present(options::SORT_TIME) { - if options.is_present(options::COLUMNS) { - entries.sort_by_key(|k| { - Reverse(get_metadata(k, options).map(|md| md.ctime()).unwrap_or(0)) - }); - } else { - entries.sort_by_key(|k| { - // Newest first - Reverse( - get_metadata(k, options) - .and_then(|md| md.modified()) - .unwrap_or(std::time::UNIX_EPOCH), - ) - }); - } - } else if options.is_present(options::SORT_SIZE) { - entries.sort_by_key(|k| get_metadata(k, options).map(|md| md.size()).unwrap_or(0)); - reverse = !reverse; - } else if !options.is_present(options::SORT_NONE) { - entries.sort(); - } - - if reverse { - entries.reverse(); - } -} - -#[cfg(windows)] -fn is_hidden(file_path: &DirEntry) -> std::io::Result { - let metadata = fs::metadata(file_path.path())?; - let attr = metadata.file_attributes(); - Ok(((attr & 0x2) > 0) || file_path.file_name().to_string_lossy().starts_with('.')) -} - -#[cfg(unix)] -fn is_hidden(file_path: &DirEntry) -> std::io::Result { - Ok(file_path.file_name().to_string_lossy().starts_with('.')) -} - -#[cfg(windows)] -fn sort_entries(entries: &mut Vec, options: &clap::ArgMatches) { - let mut reverse = options.is_present(options::REVERSE); - if options.is_present(options::SORT_TIME) { - entries.sort_by_key(|k| { - // Newest first +fn sort_entries(entries: &mut Vec, config: &Config) { + match config.sort { + Sort::CTime => entries + .sort_by_key(|k| Reverse(get_metadata(k, config).map(|md| md.ctime()).unwrap_or(0))), + Sort::Time => entries.sort_by_key(|k| { Reverse( - get_metadata(k, options) + get_metadata(k, config) .and_then(|md| md.modified()) .unwrap_or(std::time::UNIX_EPOCH), ) - }); - } else if options.is_present(options::SORT_SIZE) { - entries.sort_by_key(|k| { - get_metadata(k, options) - .map(|md| md.file_size()) - .unwrap_or(0) - }); - reverse = !reverse; - } else if !options.is_present(options::SORT_NONE) { - entries.sort(); + }), + Sort::Size => entries + .sort_by_key(|k| Reverse(get_metadata(k, config).map(|md| md.size()).unwrap_or(0))), + Sort::Name => entries.sort(), + Sort::None => {} } - if reverse { + if config.reverse { entries.reverse(); } } -fn should_display(entry: &DirEntry, options: &clap::ArgMatches) -> bool { +#[cfg(windows)] +fn is_hidden(file_path: &DirEntry) -> bool { + let metadata = fs::metadata(file_path.path()).unwrap(); + let attr = metadata.file_attributes(); + ((attr & 0x2) > 0) || file_path.file_name().to_string_lossy().starts_with('.') +} + +#[cfg(unix)] +fn is_hidden(file_path: &DirEntry) -> bool { + file_path.file_name().to_string_lossy().starts_with('.') +} + +#[cfg(windows)] +fn sort_entries(entries: &mut Vec, config: &Config) { + match config.sort { + Sort::CTime | Sort::Time => entries.sort_by_key(|k| { + // Newest first + Reverse( + get_metadata(k, config) + .and_then(|md| md.modified()) + .unwrap_or(std::time::UNIX_EPOCH), + ) + }), + Sort::Size => entries.sort_by_key(|k| { + // Largest first + Reverse( + get_metadata(k, config) + .map(|md| md.file_size()) + .unwrap_or(0), + ) + }), + Sort::Name => entries.sort(), + Sort::None => {}, + } + + if config.reverse { + entries.reverse(); + } +} + +fn should_display(entry: &DirEntry, config: &Config) -> bool { let ffi_name = entry.file_name(); let name = ffi_name.to_string_lossy(); - if !options.is_present(options::ALL) - && !options.is_present(options::ALMOST_ALL) - && is_hidden(entry).unwrap() - { + if config.files == Files::Normal && is_hidden(entry) { return false; } - if options.is_present(options::IGNORE_BACKUPS) && name.ends_with('~') { + if config.ignore_backups && name.ends_with('~') { return false; } true } -fn enter_directory(dir: &PathBuf, options: &clap::ArgMatches) { +fn enter_directory(dir: &PathBuf, config: &Config) { let mut entries: Vec<_> = safe_unwrap!(fs::read_dir(dir).and_then(Iterator::collect)); - entries.retain(|e| should_display(e, options)); + entries.retain(|e| should_display(e, config)); let mut entries: Vec<_> = entries.iter().map(DirEntry::path).collect(); - sort_entries(&mut entries, options); + sort_entries(&mut entries, config); - if options.is_present(options::ALL) { + if config.files == Files::All { let mut display_entries = entries.clone(); display_entries.insert(0, dir.join("..")); display_entries.insert(0, dir.join(".")); - display_items(&display_entries, Some(dir), options); + display_items(&display_entries, Some(dir), config); } else { - display_items(&entries, Some(dir), options); + display_items(&entries, Some(dir), config); } - if options.is_present(options::RECURSIVE) { + if config.recursive { for e in entries.iter().filter(|p| p.is_dir()) { println!("\n{}:", e.to_string_lossy()); - enter_directory(&e, options); + enter_directory(&e, config); } } } -fn get_metadata(entry: &PathBuf, options: &clap::ArgMatches) -> std::io::Result { - if options.is_present(options::DEREFERENCE) { +fn get_metadata(entry: &PathBuf, config: &Config) -> std::io::Result { + if config.dereference { entry.metadata().or_else(|_| entry.symlink_metadata()) } else { entry.symlink_metadata() } } -fn display_dir_entry_size(entry: &PathBuf, options: &clap::ArgMatches) -> (usize, usize) { - if let Ok(md) = get_metadata(entry, options) { +fn display_dir_entry_size(entry: &PathBuf, config: &Config) -> (usize, usize) { + if let Ok(md) = get_metadata(entry, config) { ( display_symlink_count(&md).len(), - display_file_size(&md, options).len(), + display_file_size(&md, config).len(), ) } else { (0, 0) @@ -422,28 +526,28 @@ fn pad_left(string: String, count: usize) -> String { format!("{:>width$}", string, width = count) } -fn display_items(items: &[PathBuf], strip: Option<&Path>, options: &clap::ArgMatches) { - if options.is_present(options::LONG) || options.is_present(options::NUMERIC_UID_GID) { +fn display_items(items: &[PathBuf], strip: Option<&Path>, config: &Config) { + if config.display == DisplayOptions::Long || config.numeric_uid_gid { let (mut max_links, mut max_size) = (1, 1); for item in items { - let (links, size) = display_dir_entry_size(item, options); + let (links, size) = display_dir_entry_size(item, config); max_links = links.max(max_links); max_size = size.max(max_size); } for item in items { - display_item_long(item, strip, max_links, max_size, options); + display_item_long(item, strip, max_links, max_size, config); } } else { - if !options.is_present(options::ONE) { + if config.display != DisplayOptions::OneLine { let names = items.iter().filter_map(|i| { - let md = get_metadata(i, options); + let md = get_metadata(i, config); match md { Err(e) => { let filename = get_file_name(i, strip); show_error!("'{}': {}", filename, e); None } - Ok(md) => Some(display_file_name(&i, strip, &md, options)), + Ok(md) => Some(display_file_name(&i, strip, &md, config)), } }); @@ -467,9 +571,9 @@ fn display_items(items: &[PathBuf], strip: Option<&Path>, options: &clap::ArgMat // Couldn't display a grid, either because we don't know // the terminal width or because fit_into_width failed for i in items { - let md = get_metadata(i, options); + let md = get_metadata(i, config); if let Ok(md) = md { - println!("{}", display_file_name(&i, strip, &md, options).contents); + println!("{}", display_file_name(&i, strip, &md, config).contents); } } } @@ -482,9 +586,9 @@ fn display_item_long( strip: Option<&Path>, max_links: usize, max_size: usize, - options: &clap::ArgMatches, + config: &Config, ) { - let md = match get_metadata(item, options) { + let md = match get_metadata(item, config) { Err(e) => { let filename = get_file_name(&item, strip); show_error!("{}: {}", filename, e); @@ -495,21 +599,21 @@ fn display_item_long( println!( "{}{}{} {} {} {} {} {} {}", - get_inode(&md, options), + get_inode(&md, config), display_file_type(md.file_type()), display_permissions(&md), pad_left(display_symlink_count(&md), max_links), - display_uname(&md, options), - display_group(&md, options), - pad_left(display_file_size(&md, options), max_size), - display_date(&md, options), - display_file_name(&item, strip, &md, options).contents + display_uname(&md, config), + display_group(&md, config), + pad_left(display_file_size(&md, config), max_size), + display_date(&md, config), + display_file_name(&item, strip, &md, config).contents ); } #[cfg(unix)] -fn get_inode(metadata: &Metadata, options: &clap::ArgMatches) -> String { - if options.is_present(options::INODE) { +fn get_inode(metadata: &Metadata, config: &Config) -> String { + if config.inode { format!("{:8} ", metadata.ino()) } else { "".to_string() @@ -517,7 +621,7 @@ fn get_inode(metadata: &Metadata, options: &clap::ArgMatches) -> String { } #[cfg(not(unix))] -fn get_inode(_metadata: &Metadata, _options: &clap::ArgMatches) -> String { +fn get_inode(_metadata: &Metadata, _config: &Config) -> String { "".to_string() } @@ -527,8 +631,8 @@ fn get_inode(_metadata: &Metadata, _options: &clap::ArgMatches) -> String { use uucore::entries; #[cfg(unix)] -fn display_uname(metadata: &Metadata, options: &clap::ArgMatches) -> String { - if options.is_present(options::NUMERIC_UID_GID) { +fn display_uname(metadata: &Metadata, config: &Config) -> String { + if config.numeric_uid_gid { metadata.uid().to_string() } else { entries::uid2usr(metadata.uid()).unwrap_or_else(|_| metadata.uid().to_string()) @@ -536,8 +640,8 @@ fn display_uname(metadata: &Metadata, options: &clap::ArgMatches) -> String { } #[cfg(unix)] -fn display_group(metadata: &Metadata, options: &clap::ArgMatches) -> String { - if options.is_present(options::NUMERIC_UID_GID) { +fn display_group(metadata: &Metadata, config: &Config) -> String { + if config.numeric_uid_gid { metadata.gid().to_string() } else { entries::gid2grp(metadata.gid()).unwrap_or_else(|_| metadata.gid().to_string()) @@ -545,31 +649,29 @@ fn display_group(metadata: &Metadata, options: &clap::ArgMatches) -> String { } #[cfg(not(unix))] -#[allow(unused_variables)] -fn display_uname(metadata: &Metadata, _options: &clap::ArgMatches) -> String { +fn display_uname(_metadata: &Metadata, _config: &Config) -> String { "somebody".to_string() } #[cfg(not(unix))] #[allow(unused_variables)] -fn display_group(metadata: &Metadata, _options: &clap::ArgMatches) -> String { +fn display_group(_metadata: &Metadata, _config: &Config) -> String { "somegroup".to_string() } #[cfg(unix)] -fn display_date(metadata: &Metadata, options: &clap::ArgMatches) -> String { - let secs = if options.is_present(options::COLUMNS) { - metadata.ctime() - } else { - metadata.mtime() +fn display_date(metadata: &Metadata, config: &Config) -> String { + let secs = match config.sort { + Sort::CTime => metadata.ctime(), + Sort::Time => metadata.mtime(), + _ => 0, }; let time = time::at(Timespec::new(secs, 0)); strftime("%F %R", &time).unwrap() } #[cfg(not(unix))] -#[allow(unused_variables)] -fn display_date(metadata: &Metadata, options: &clap::ArgMatches) -> String { +fn display_date(metadata: &Metadata, _config: &Config) -> String { if let Ok(mtime) = metadata.modified() { let time = time::at(Timespec::new( mtime @@ -584,18 +686,17 @@ fn display_date(metadata: &Metadata, options: &clap::ArgMatches) -> String { } } -fn display_file_size(metadata: &Metadata, options: &clap::ArgMatches) -> String { +fn display_file_size(metadata: &Metadata, config: &Config) -> String { // NOTE: The human-readable behaviour deviates from the GNU ls. // The GNU ls uses binary prefixes by default. - if options.is_present(options::HUMAN_READABLE) { - match NumberPrefix::decimal(metadata.len() as f64) { + match config.size_format { + SizeFormats::Binary => match NumberPrefix::decimal(metadata.len() as f64) { NumberPrefix::Standalone(bytes) => bytes.to_string(), NumberPrefix::Prefixed(prefix, bytes) => { format!("{:.2}{}", bytes, prefix).to_uppercase() } - } - } else { - metadata.len().to_string() + }, + SizeFormats::Bytes => metadata.len().to_string(), } } @@ -625,15 +726,15 @@ fn display_file_name( path: &Path, strip: Option<&Path>, metadata: &Metadata, - options: &clap::ArgMatches, + config: &Config, ) -> Cell { let mut name = get_file_name(path, strip); - if !options.is_present(options::LONG) { - name = get_inode(metadata, options) + &name; + if config.display == DisplayOptions::Long { + name = get_inode(metadata, config) + &name; } - if options.is_present(options::CLASSIFY) { + if config.classify { let file_type = metadata.file_type(); if file_type.is_dir() { name.push('/'); @@ -642,7 +743,7 @@ fn display_file_name( } } - if options.is_present(options::LONG) && metadata.file_type().is_symlink() { + if config.display == DisplayOptions::Long && metadata.file_type().is_symlink() { if let Ok(target) = path.read_link() { // We don't bother updating width here because it's not used for long listings let target_name = target.to_string_lossy().to_string(); @@ -687,30 +788,17 @@ fn display_file_name( path: &Path, strip: Option<&Path>, metadata: &Metadata, - options: &clap::ArgMatches, + config: &Config, ) -> Cell { let mut name = get_file_name(path, strip); - if !options.is_present(options::LONG) { - name = get_inode(metadata, options) + &name; + if config.display != DisplayOptions::Long { + name = get_inode(metadata, config) + &name; } let mut width = UnicodeWidthStr::width(&*name); - let color = if options.is_present(options::COLOR) { - match options.value_of(options::COLOR) { - None => atty::is(atty::Stream::Stdout), - Some(val) => match val { - "" | "always" | "yes" | "force" => true, - "auto" | "tty" | "if-tty" => atty::is(atty::Stream::Stdout), - /* "never" | "no" | "none" | */ _ => false, - }, - } - } else { - false - }; - let classify = options.is_present(options::CLASSIFY); let ext; - if color || classify { + if config.color || config.classify { let file_type = metadata.file_type(); let (code, sym) = if file_type.is_dir() { @@ -760,10 +848,10 @@ fn display_file_name( ("", None) }; - if color { + if config.color { name = color_name(name, code); } - if classify { + if config.classify { if let Some(s) = sym { name.push(s); width += 1; @@ -771,7 +859,7 @@ fn display_file_name( } } - if options.is_present(options::LONG) && metadata.file_type().is_symlink() { + if config.display == DisplayOptions::Long && metadata.file_type().is_symlink() { if let Ok(target) = path.read_link() { // We don't bother updating width here because it's not used for long listings let code = if target.exists() { "fi" } else { "mi" }; @@ -788,8 +876,7 @@ fn display_file_name( } #[cfg(not(unix))] -#[allow(unused_variables)] -fn display_symlink_count(metadata: &Metadata) -> String { +fn display_symlink_count(_metadata: &Metadata) -> String { // Currently not sure of how to get this on Windows, so I'm punting. // Git Bash looks like it may do the same thing. String::from("1") From 0717a5f3014b52b862c177222afcd257cbe633f3 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 14 Mar 2021 13:32:15 +0100 Subject: [PATCH 0036/1135] ls: formatting --- src/uu/ls/src/ls.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index d61a45702..d9bbd0f88 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -122,7 +122,6 @@ struct Config { display: DisplayOptions, files: Files, sort: Sort, - recursive: bool, reverse: bool, dereference: bool, @@ -191,7 +190,7 @@ impl Config { display, files, sort, - + recursive: options.is_present(options::RECURSIVE), reverse: options.is_present(options::REVERSE), dereference: options.is_present(options::DEREFERENCE), @@ -458,7 +457,7 @@ fn sort_entries(entries: &mut Vec, config: &Config) { ) }), Sort::Name => entries.sort(), - Sort::None => {}, + Sort::None => {} } if config.reverse { From 6829e7f359ba93cc5f1d06a0fd164d87a1af0e57 Mon Sep 17 00:00:00 2001 From: Dean Li Date: Sun, 14 Mar 2021 20:39:41 +0800 Subject: [PATCH 0037/1135] expand: replace getopts with clap expand has one odd behavior that allows two format for tabstop From expand --help ``` -t, --tabs=N have tabs N characters apart, not 8 -t, --tabs=LIST use comma separated list of tab positions ``` This patch use one `value_name("N, LIST")` for tabstop and deal with above behavior in `parse_tabstop`. Close #1795 --- src/uu/expand/Cargo.toml | 2 +- src/uu/expand/src/expand.rs | 72 ++++++++++++++++++++----------------- 2 files changed, 41 insertions(+), 33 deletions(-) diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index d9861a0c7..b5c0343e7 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/expand.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" unicode-width = "0.1.5" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index 353c3e6bc..52537dcc2 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -12,19 +12,25 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg, ArgMatches}; use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; use std::iter::repeat; use std::str::from_utf8; use unicode_width::UnicodeWidthChar; -static SYNTAX: &str = "[OPTION]... [FILE]..."; -static SUMMARY: &str = "Convert tabs in each FILE to spaces, writing to standard output. +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Convert tabs in each FILE to spaces, writing to standard output. With no FILE, or when FILE is -, read standard input."; + static LONG_HELP: &str = ""; static DEFAULT_TABSTOP: usize = 8; +fn get_usage() -> String { + format!("{0} [OPTION]... [FILE]...", executable!()) +} + fn tabstops_parse(s: String) -> Vec { let words = s.split(','); @@ -58,14 +64,14 @@ struct Options { } impl Options { - fn new(matches: getopts::Matches) -> Options { - let tabstops = match matches.opt_str("t") { + fn new(matches: &ArgMatches) -> Options { + let tabstops = match matches.value_of("tabstops") { + Some(s) => tabstops_parse(s.to_string()), None => vec![DEFAULT_TABSTOP], - Some(s) => tabstops_parse(s), }; - let iflag = matches.opt_present("i"); - let uflag = !matches.opt_present("U"); + let iflag = matches.is_present("iflag"); + let uflag = !matches.is_present("uflag"); // avoid allocations when dumping out long sequences of spaces // by precomputing the longest string of spaces we will ever need @@ -80,10 +86,9 @@ impl Options { .unwrap(); // length of tabstops is guaranteed >= 1 let tspaces = repeat(' ').take(nspaces).collect(); - let files = if matches.free.is_empty() { - vec!["-".to_owned()] - } else { - matches.free + let files: Vec = match matches.values_of("files") { + Some(s) => s.map(|v| v.to_string()).collect(), + None => vec!["-".to_owned()], }; Options { @@ -97,31 +102,34 @@ impl Options { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); - - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optflag("i", "initial", "do not convert tabs after non blanks") - .optopt( - "t", - "tabs", - "have tabs NUMBER characters apart, not 8", - "NUMBER", + let usage = get_usage(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(LONG_HELP) + .arg( + Arg::with_name("iflag") + .long("initial") + .short("i") + .help("do not convert tabs after non blanks"), ) - .optopt( - "t", - "tabs", - "use comma separated list of explicit tab positions", - "LIST", + .arg( + Arg::with_name("tabstops") + .long("tabs") + .short("t") + .value_name("N, LIST") + .takes_value(true) + .help("have tabs N characters apart, not 8 or use comma separated list of explicit tab positions"), ) - .optflag( - "U", - "no-utf8", - "interpret input file as 8-bit ASCII rather than UTF-8", + .arg( + Arg::with_name("uflags").long("no-utf8").short("U").help("interpret input file as 8-bit ASCII rather than UTF-8"), + ).arg( + Arg::with_name("files").multiple(true).hidden(true).takes_value(true) ) - .parse(args); - - expand(Options::new(matches)); + .get_matches_from(args); + expand(Options::new(&matches)); 0 } From d8c3d1d51dd7de9d237364ef931c5a957d4a3974 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 14 Mar 2021 15:32:30 +0000 Subject: [PATCH 0038/1135] Use system utils --- .github/workflows/GNU.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 4d3e39613..ff88fb5a3 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -90,6 +90,8 @@ jobs: sed -i -e "s|sort |$(which sort) |" tests/ls/hyperlink.sh tests/misc/test-N.sh sed -i -e "s|split |$(which split) |" tests/misc/factor-parallel.sh sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh + sed -i -e "s|dd |$(which dd) |" tests/du/8gb.sh tests/tail-2/big-4gb.sh + sed -i -e "s|id -|$(which id) -|" tests/misc/runcon-no-reorder.sh #Add specific timeout to tests that currently hang to limit time spent waiting sed -i -e "s|seq \\$|$(which timeout) 0.1 seq \$|" tests/misc/seq-precision.sh tests/misc/seq-long-double.sh From 7c219fd128968f786c9806408b5f3bb21c711b48 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 14 Mar 2021 15:34:22 +0000 Subject: [PATCH 0039/1135] clean up sed commands --- .github/workflows/GNU.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index ff88fb5a3..374160c42 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -60,7 +60,7 @@ jobs: ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" ./configure --quiet --disable-gcc-warnings #Add timeout to to protect against hangs - sed -i -e "s|\"\$@|$(which timeout) 600 \"\$@|" build-aux/test-driver + sed -i "s|\"\$@|$(which timeout) 600 \"\$@|" build-aux/test-driver # Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile sed -i 's| tr | /usr/bin/tr |' tests/init.sh @@ -81,21 +81,21 @@ jobs: Makefile # Use the system coreutils where the test fails due to error in a util that is not the one being tested - sed -i -e "s|stat|$(which stat)|" tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh - sed -i -e "s|ls -|$(which ls) -|" tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh - sed -i -e "s|mkdir |$(which mkdir) |" tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i -e "s|timeout |$(which timeout) |" tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh - sed -i -e "s| timeout | $(which timeout) |" tests/tail-2/inotify-rotate.sh # Don't break the function called 'grep_timeout' - sed -i -e "s|chmod |$(which chmod) |" tests/du/inacc-dir.sh tests/mkdir/p-3.sh - sed -i -e "s|sort |$(which sort) |" tests/ls/hyperlink.sh tests/misc/test-N.sh - sed -i -e "s|split |$(which split) |" tests/misc/factor-parallel.sh - sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh - sed -i -e "s|dd |$(which dd) |" tests/du/8gb.sh tests/tail-2/big-4gb.sh - sed -i -e "s|id -|$(which id) -|" tests/misc/runcon-no-reorder.sh + sed -i "s|stat|$(which stat)|" tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh + sed -i "s|ls -|$(which ls) -|" tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh + sed -i "s|mkdir |$(which mkdir) |" tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh + sed -i "s|timeout |$(which timeout) |" tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh + sed -i "s| timeout | $(which timeout) |" tests/tail-2/inotify-rotate.sh # Don't break the function called 'grep_timeout' + sed -i "s|chmod |$(which chmod) |" tests/du/inacc-dir.sh tests/mkdir/p-3.sh + sed -i "s|sort |$(which sort) |" tests/ls/hyperlink.sh tests/misc/test-N.sh + sed -i "s|split |$(which split) |" tests/misc/factor-parallel.sh + sed -i "s|truncate |$(which truncate) |" tests/split/fail.sh + sed -i "s|dd |$(which dd) |" tests/du/8gb.sh tests/tail-2/big-4gb.sh + sed -i "s|id -|$(which id) -|" tests/misc/runcon-no-reorder.sh #Add specific timeout to tests that currently hang to limit time spent waiting - sed -i -e "s|seq \\$|$(which timeout) 0.1 seq \$|" tests/misc/seq-precision.sh tests/misc/seq-long-double.sh - sed -i -e "s|cat |$(which timeout) 0.1 cat |" tests/misc/cat-self.sh + sed -i "s|seq \\$|$(which timeout) 0.1 seq \$|" tests/misc/seq-precision.sh tests/misc/seq-long-double.sh + sed -i "s|cat |$(which timeout) 0.1 cat |" tests/misc/cat-self.sh test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" From 570e45649613f0515db32213acf004c7214bd7f9 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 14 Mar 2021 15:59:17 +0000 Subject: [PATCH 0040/1135] clean up workflow script --- .github/workflows/GNU.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 374160c42..299f333e1 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -34,11 +34,11 @@ jobs: shell: bash run: | sudo apt-get update - sudo apt-get install autoconf autopoint bison texinfo gperf gcc g++ gdb python-pyinotify expect python3-sphinx + sudo apt-get install autoconf autopoint bison texinfo gperf gcc g++ gdb python-pyinotify python3-sphinx pushd uutils make PROFILE=release BUILDDIR="$PWD/target/release/" - cp ${BUILDDIR}/install ${BUILDDIR}/ginstall # The GNU tests rename this script before running, to avoid confusion with the make target + cp "${BUILDDIR}/install" "${BUILDDIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target # Create *sum binaries for sum in b2sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum do @@ -54,7 +54,7 @@ jobs: for binary in $(./build-aux/gen-lists-of-programs.sh --list-progs) do bin_path="${BUILDDIR}/${binary}" - test -f "${bin_path}" || cp "${BUILDDIR}/false" "${bin_path}" + test -f "${bin_path}" || { echo "'${binary}' was not built with uutils, using the 'false' program"; cp "${BUILDDIR}/false" "${bin_path}"; } done ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" @@ -66,7 +66,7 @@ jobs: sed -i 's| tr | /usr/bin/tr |' tests/init.sh make # Generate the factor tests, so they can be fixed - for i in $(seq -w 0 36) + for i in {00..36} do make tests/factor/t${i}.sh done @@ -106,7 +106,7 @@ jobs: GNULIB_DIR="${PWD}/gnulib" pushd gnu - timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make + timeout -sKILL 2h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make - name: Extract tests info shell: bash run: | From 5d7a8514715ecc815a777834c37c9a9e81a80b5c Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 14 Mar 2021 21:30:21 +0100 Subject: [PATCH 0041/1135] ls: fix --color behaviour --- src/uu/ls/src/ls.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index d9bbd0f88..20fffdedc 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -56,7 +56,7 @@ lazy_static! { let codes = LS_COLORS.split(':'); let mut map = HashMap::new(); for c in codes { - let p: Vec<_> = c.splitn(1, '=').collect(); + let p: Vec<_> = c.splitn(2, '=').collect(); if p.len() == 2 { map.insert(p[0], p[1]); } @@ -337,9 +337,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(options::COLOR) .long(options::COLOR) .help("Color output based on file type.") - .possible_values(&["always", "yes", "force", "tty", "if-tty", "auto", "never", "no", "none"]) + .takes_value(true) .require_equals(true) - .empty_values(true), + .min_values(0), ) .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)) .get_matches_from(args); From c454d2640cfdee55337f0cb128184873e33ff2c3 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 14 Mar 2021 21:32:21 +0100 Subject: [PATCH 0042/1135] ls: structure options some more --- src/uu/ls/src/ls.rs | 110 +++++++++++++++++++++++++++++++------------- 1 file changed, 77 insertions(+), 33 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 20fffdedc..0d8d9e3c3 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -7,6 +7,45 @@ // spell-checker:ignore (ToDO) cpio svgz webm somegroup nlink rmvb xspf +// Missing features from GNU Coreutils: +// --author +// -b, --escape +// --block-size=SIZE +// -c +// -D, --Dired +// -f +// --file-type +// --format=WORD +// --full-time +// -g +// --group-directories-first +// -G, --no-group +// --si +// -H, --dereference-command-line +// --dereference-command-line-symlink-to-dir +// --hide=PATTERN +// --hyperlink[=WHEN] +// --indicator-style=WORD +// -I, --ignore +// -k, --kibibytes +// -m +// -N, --literal +// -o +// -p, --indicator-style=slash +// -q, --hide-control-chars +// --show-control-chars +// -Q, --quote-name +// --quoting-style=WORD +// --time=WORD +// --time-style=TIME_STYLE +// -T, --tabsize=COLS +// -u +// -v +// -w, --width=COLS +// -x +// -X +// -Z, --context + #[cfg(unix)] #[macro_use] extern crate lazy_static; @@ -70,23 +109,29 @@ lazy_static! { } pub mod options { - pub static ONELINE: &str = "1"; - pub static ALL: &str = "all"; - pub static ALMOST_ALL: &str = "almost-all"; + pub mod display { + pub static ONELINE: &str = "1"; + pub static LONG: &str = "long"; + } + pub mod files { + pub static ALL: &str = "all"; + pub static ALMOST_ALL: &str = "almost-all"; + } + pub mod sort { + pub static SIZE: &str = "S"; + pub static TIME: &str = "t"; + pub static NONE: &str = "U"; + pub static CTIME: &str = "c"; + } pub static IGNORE_BACKUPS: &str = "ignore-backups"; pub static DIRECTORY: &str = "directory"; pub static CLASSIFY: &str = "classify"; pub static HUMAN_READABLE: &str = "human-readable"; pub static INODE: &str = "inode"; pub static DEREFERENCE: &str = "dereference"; - pub static LONG: &str = "long"; pub static NUMERIC_UID_GID: &str = "numeric-uid-gid"; pub static REVERSE: &str = "reverse"; pub static RECURSIVE: &str = "recursive"; - pub static SORT_SIZE: &str = "S"; - pub static SORT_TIME: &str = "t"; - pub static SORT_NONE: &str = "U"; - pub static SORT_CTIME: &str = "c"; pub static COLOR: &str = "color"; pub static PATHS: &str = "paths"; } @@ -138,29 +183,29 @@ struct Config { impl Config { fn from(options: clap::ArgMatches) -> Config { - let display = if options.is_present(options::LONG) { + let display = if options.is_present(options::display::LONG) { DisplayOptions::Long - } else if options.is_present(options::ONELINE) { + } else if options.is_present(options::display::ONELINE) { DisplayOptions::OneLine } else { DisplayOptions::Columns }; - let files = if options.is_present(options::ALL) { + let files = if options.is_present(options::files::ALL) { Files::All - } else if options.is_present(options::ALMOST_ALL) { + } else if options.is_present(options::files::ALMOST_ALL) { Files::AlmostAll } else { Files::Normal }; - let sort = if options.is_present(options::SORT_TIME) { + let sort = if options.is_present(options::sort::TIME) { Sort::Time - } else if options.is_present(options::SORT_CTIME) { + } else if options.is_present(options::sort::CTIME) { Sort::CTime - } else if options.is_present(options::SORT_SIZE) { + } else if options.is_present(options::sort::SIZE) { Sort::Size - } else if options.is_present(options::SORT_NONE) { + } else if options.is_present(options::sort::NONE) { Sort::None } else { Sort::Name @@ -190,7 +235,6 @@ impl Config { display, files, sort, - recursive: options.is_present(options::RECURSIVE), reverse: options.is_present(options::REVERSE), dereference: options.is_present(options::DEREFERENCE), @@ -217,20 +261,20 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .arg( - Arg::with_name(options ::ONELINE) - .short(options ::ONELINE) + Arg::with_name(options::display::ONELINE) + .short(options::display::ONELINE) .help("list one file per line."), ) .arg( - Arg::with_name(options::ALL) + Arg::with_name(options::files::ALL) .short("a") - .long(options::ALL) + .long(options::files::ALL) .help("Do not ignore hidden files (files with names that start with '.')."), ) .arg( - Arg::with_name(options::ALMOST_ALL) + Arg::with_name(options::files::ALMOST_ALL) .short("A") - .long(options::ALMOST_ALL) + .long(options::files::ALMOST_ALL) .help( "In a directory, do not ignore all file names that start with '.', only ignore \ '.' and '..'.", @@ -243,8 +287,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("Ignore entries which end with ~."), ) .arg( - Arg::with_name(options::SORT_CTIME) - .short(options::SORT_CTIME) + Arg::with_name(options::sort::CTIME) + .short(options::sort::CTIME) .help("If the long listing format (e.g., -l, -o) is being used, print the status \ change time (the ‘ctime’ in the inode) instead of the modification time. When \ explicitly sorting by time (--sort=time or -t) or when not using a long listing \ @@ -292,9 +336,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ), ) .arg( - Arg::with_name(options::LONG) + Arg::with_name(options::display::LONG) .short("l") - .long(options::LONG) + .long(options::display::LONG) .help("Display detailed information."), ) .arg( @@ -317,18 +361,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("List the contents of all directories recursively."), ) .arg( - Arg::with_name(options::SORT_SIZE) - .short(options::SORT_SIZE) + Arg::with_name(options::sort::SIZE) + .short(options::sort::SIZE) .help("Sort by file size, largest first."), ) .arg( - Arg::with_name(options::SORT_TIME) - .short(options::SORT_TIME) + Arg::with_name(options::sort::TIME) + .short(options::sort::TIME) .help("Sort by modification time (the 'mtime' in the inode), newest first."), ) .arg( - Arg::with_name(options::SORT_NONE) - .short(options::SORT_NONE) + Arg::with_name(options::sort::NONE) + .short(options::sort::NONE) .help("Do not sort; list the files in whatever order they are stored in the \ directory. This is especially useful when listing very large directories, \ since not doing any sorting can be noticeably faster.", From c86c18cbb54ba33b175729cd362584d9df3b82a9 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 14 Mar 2021 23:11:11 +0100 Subject: [PATCH 0043/1135] ls: implement -c and -u --- src/uu/ls/src/ls.rs | 90 +++++++++++++++++++++++++++++++-------------- 1 file changed, 63 insertions(+), 27 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 0d8d9e3c3..1719579fc 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -54,7 +54,6 @@ extern crate uucore; use clap::{App, Arg}; use number_prefix::NumberPrefix; -use std::cmp::Reverse; #[cfg(unix)] use std::collections::HashMap; use std::fs; @@ -66,6 +65,10 @@ use std::os::unix::fs::MetadataExt; #[cfg(windows)] use std::os::windows::fs::MetadataExt; use std::path::{Path, PathBuf}; +use std::cmp::Reverse; +#[cfg(not(unix))] +use std::time::{SystemTime, UNIX_EPOCH}; + use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use time::{strftime, Timespec}; #[cfg(unix)] @@ -121,7 +124,10 @@ pub mod options { pub static SIZE: &str = "S"; pub static TIME: &str = "t"; pub static NONE: &str = "U"; - pub static CTIME: &str = "c"; + } + pub mod time { + pub static ACCESS: &str = "u"; + pub static CHANGE: &str = "c"; } pub static IGNORE_BACKUPS: &str = "ignore-backups"; pub static DIRECTORY: &str = "directory"; @@ -148,7 +154,6 @@ enum Sort { Name, Size, Time, - CTime, } enum SizeFormats { @@ -163,6 +168,12 @@ enum Files { Normal, } +enum Time { + Modification, + Access, + Change, +} + struct Config { display: DisplayOptions, files: Files, @@ -175,6 +186,7 @@ struct Config { size_format: SizeFormats, numeric_uid_gid: bool, directory: bool, + time: Time, #[cfg(unix)] inode: bool, #[cfg(unix)] @@ -201,8 +213,6 @@ impl Config { let sort = if options.is_present(options::sort::TIME) { Sort::Time - } else if options.is_present(options::sort::CTIME) { - Sort::CTime } else if options.is_present(options::sort::SIZE) { Sort::Size } else if options.is_present(options::sort::NONE) { @@ -211,6 +221,14 @@ impl Config { Sort::Name }; + let time = if options.is_present(options::time::ACCESS) { + Time::Access + } else if options.is_present(options::time::CHANGE) { + Time::Change + } else { + Time::Modification + }; + #[cfg(unix)] let color = if options.is_present(options::COLOR) { match options.value_of(options::COLOR) { @@ -243,6 +261,7 @@ impl Config { size_format, numeric_uid_gid: options.is_present(options::NUMERIC_UID_GID), directory: options.is_present(options::DIRECTORY), + time, #[cfg(unix)] color, #[cfg(unix)] @@ -287,13 +306,21 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("Ignore entries which end with ~."), ) .arg( - Arg::with_name(options::sort::CTIME) - .short(options::sort::CTIME) - .help("If the long listing format (e.g., -l, -o) is being used, print the status \ + Arg::with_name(options::time::CHANGE) + .short(options::time::CHANGE) + .help("If the long listing format (e.g., -l, -o) is being used, print the status \ change time (the ‘ctime’ in the inode) instead of the modification time. When \ explicitly sorting by time (--sort=time or -t) or when not using a long listing \ format, sort according to the status change time.", )) + .arg( + Arg::with_name(options::time::ACCESS) + .short(options::time::ACCESS) + .help("If the long listing format (e.g., -l, -o) is being used, print the status \ + access time instead of the modification time. When explicitly sorting by time \ + (--sort=time or -t) or when not using a long listing format, sort according to the \ + status change time.") + ) .arg( Arg::with_name(options::DIRECTORY) .short("d") @@ -449,13 +476,11 @@ fn list(locs: Vec, config: Config) -> i32 { #[cfg(any(unix, target_os = "redox"))] fn sort_entries(entries: &mut Vec, config: &Config) { match config.sort { - Sort::CTime => entries - .sort_by_key(|k| Reverse(get_metadata(k, config).map(|md| md.ctime()).unwrap_or(0))), Sort::Time => entries.sort_by_key(|k| { Reverse( get_metadata(k, config) - .and_then(|md| md.modified()) - .unwrap_or(std::time::UNIX_EPOCH), + .map(|md| get_time(&md, config)) + .unwrap_or(0), ) }), Sort::Size => entries @@ -484,13 +509,9 @@ fn is_hidden(file_path: &DirEntry) -> bool { #[cfg(windows)] fn sort_entries(entries: &mut Vec, config: &Config) { match config.sort { - Sort::CTime | Sort::Time => entries.sort_by_key(|k| { + Sort::Time => entries.sort_by_key(|k| { // Newest first - Reverse( - get_metadata(k, config) - .and_then(|md| md.modified()) - .unwrap_or(std::time::UNIX_EPOCH), - ) + Reverse(get_time(get_metadata(k, config), config).unwrap_or(std::time::UNIX_EPOCH)) }), Sort::Size => entries.sort_by_key(|k| { // Largest first @@ -702,23 +723,38 @@ fn display_group(_metadata: &Metadata, _config: &Config) -> String { "somegroup".to_string() } +// The implementations for get_time are separated because some options, such +// as ctime will not be available +#[cfg(unix)] +fn get_time(md: &Metadata, config: &Config) -> i64 { + match config.time { + Time::Change => md.ctime(), + Time::Modification => md.mtime(), + Time::Access => md.atime(), + } +} + +#[cfg(not(unix))] +fn get_time(md: &Metadata, config: &Config) -> Option { + match config.time { + Time::Modification => md.modification().ok(), + Time::Access => md.access().ok(), + _ => None, + } +} + #[cfg(unix)] fn display_date(metadata: &Metadata, config: &Config) -> String { - let secs = match config.sort { - Sort::CTime => metadata.ctime(), - Sort::Time => metadata.mtime(), - _ => 0, - }; + let secs = get_time(metadata, config); let time = time::at(Timespec::new(secs, 0)); strftime("%F %R", &time).unwrap() } #[cfg(not(unix))] -fn display_date(metadata: &Metadata, _config: &Config) -> String { - if let Ok(mtime) = metadata.modified() { +fn display_date(metadata: &Metadata, config: &Config) -> String { + if let Some(time) = get_time(metadata, config) { let time = time::at(Timespec::new( - mtime - .duration_since(std::time::UNIX_EPOCH) + time.duration_since(std::time::UNIX_EPOCH) .unwrap() .as_secs() as i64, 0, From 7bde2e78a97ddc8d390c8391457db8a015b92c08 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 14 Mar 2021 23:34:52 +0100 Subject: [PATCH 0044/1135] ls: simplify --color and remove it on windows --- src/uu/ls/src/ls.rs | 46 +++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 1719579fc..6f74d459b 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -138,6 +138,7 @@ pub mod options { pub static NUMERIC_UID_GID: &str = "numeric-uid-gid"; pub static REVERSE: &str = "reverse"; pub static RECURSIVE: &str = "recursive"; + #[cfg(unix)] pub static COLOR: &str = "color"; pub static PATHS: &str = "paths"; } @@ -230,17 +231,13 @@ impl Config { }; #[cfg(unix)] - let color = if options.is_present(options::COLOR) { - match options.value_of(options::COLOR) { - None => atty::is(atty::Stream::Stdout), - Some(val) => match val { - "" | "always" | "yes" | "force" => true, - "auto" | "tty" | "if-tty" => atty::is(atty::Stream::Stdout), - /* "never" | "no" | "none" | */ _ => false, - }, - } - } else { - false + let color = match options.value_of(options::COLOR) { + None => options.is_present(options::COLOR), + Some(val) => match val { + "" | "always" | "yes" | "force" => true, + "auto" | "tty" | "if-tty" => atty::is(atty::Stream::Stdout), + /* "never" | "no" | "none" | */ _ => false, + }, }; let size_format = if options.is_present(options::HUMAN_READABLE) { @@ -275,7 +272,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) + let mut app = App::new(executable!()) .version(VERSION) .about(ABOUT) .usage(&usage[..]) @@ -319,7 +316,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("If the long listing format (e.g., -l, -o) is being used, print the status \ access time instead of the modification time. When explicitly sorting by time \ (--sort=time or -t) or when not using a long listing format, sort according to the \ - status change time.") + access time.") ) .arg( Arg::with_name(options::DIRECTORY) @@ -404,16 +401,21 @@ pub fn uumain(args: impl uucore::Args) -> i32 { directory. This is especially useful when listing very large directories, \ since not doing any sorting can be noticeably faster.", )) - .arg( + .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)); + + #[cfg(unix)] + { + app = app.arg( Arg::with_name(options::COLOR) - .long(options::COLOR) - .help("Color output based on file type.") - .takes_value(true) - .require_equals(true) - .min_values(0), - ) - .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)) - .get_matches_from(args); + .long(options::COLOR) + .help("Color output based on file type.") + .takes_value(true) + .require_equals(true) + .min_values(0), + ); + } + + let matches = app.get_matches_from(args); let locs = matches .values_of(options::PATHS) From 61a95239cee641da0dbb9993378d458588bc4296 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 15 Mar 2021 09:30:50 +0100 Subject: [PATCH 0045/1135] ls: rename display to format, set arg overrides --- src/uu/ls/src/ls.rs | 212 +++++++++++++++++++++++++++++++------------- 1 file changed, 152 insertions(+), 60 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 6f74d459b..69d1e251d 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -112,9 +112,10 @@ lazy_static! { } pub mod options { - pub mod display { + pub mod format { pub static ONELINE: &str = "1"; pub static LONG: &str = "long"; + pub static COLUMNS: &str = "C"; } pub mod files { pub static ALL: &str = "all"; @@ -129,6 +130,9 @@ pub mod options { pub static ACCESS: &str = "u"; pub static CHANGE: &str = "c"; } + pub static FORMAT: &str = "format"; + pub static SORT: &str = "sort"; + pub static TIME: &str = "time"; pub static IGNORE_BACKUPS: &str = "ignore-backups"; pub static DIRECTORY: &str = "directory"; pub static CLASSIFY: &str = "classify"; @@ -144,7 +148,7 @@ pub mod options { } #[derive(PartialEq, Eq)] -enum DisplayOptions { +enum Format { Columns, Long, OneLine, @@ -176,7 +180,7 @@ enum Time { } struct Config { - display: DisplayOptions, + format: Format, files: Files, sort: Sort, recursive: bool, @@ -196,12 +200,22 @@ struct Config { impl Config { fn from(options: clap::ArgMatches) -> Config { - let display = if options.is_present(options::display::LONG) { - DisplayOptions::Long - } else if options.is_present(options::display::ONELINE) { - DisplayOptions::OneLine + let format = if let Some(format_) = options.value_of(options::FORMAT) { + match format_ { + "long" | "verbose" => Format::Long, + "single-column" => Format::OneLine, + "columns" => Format::Columns, + // below should never happen as clap already restricts the values. + _ => panic!("Invalid field for --format") + } + } else if options.is_present(options::format::LONG) { + Format::Long + } else if options.is_present(options::format::ONELINE) { + Format::OneLine + } else if options.is_present(options::format::COLUMNS) { + Format::Columns } else { - DisplayOptions::Columns + Format::Columns }; let files = if options.is_present(options::files::ALL) { @@ -212,7 +226,16 @@ impl Config { Files::Normal }; - let sort = if options.is_present(options::sort::TIME) { + let sort = if let Some(field) = options.value_of(options::SORT) { + match field { + "none" => Sort::None, + "name" => Sort::Name, + "time" => Sort::Time, + "size" => Sort::Size, + // below should never happen as clap already restricts the values. + _ => panic!("Invalid field for --sort") + } + } else if options.is_present(options::sort::TIME) { Sort::Time } else if options.is_present(options::sort::SIZE) { Sort::Size @@ -222,7 +245,14 @@ impl Config { Sort::Name }; - let time = if options.is_present(options::time::ACCESS) { + let time = if let Some(field) = options.value_of(options::TIME) { + match field { + "ctime" | "status" => Time::Change, + "access" | "atime" | "use" => Time::Access, + // below should never happen as clap already restricts the values. + _ => panic!("Invalid field for --time") + } + } else if options.is_present(options::time::ACCESS) { Time::Access } else if options.is_present(options::time::CHANGE) { Time::Change @@ -247,7 +277,7 @@ impl Config { }; Config { - display, + format, files, sort, recursive: options.is_present(options::RECURSIVE), @@ -276,11 +306,110 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .version(VERSION) .about(ABOUT) .usage(&usage[..]) + + // Format arguments .arg( - Arg::with_name(options::display::ONELINE) - .short(options::display::ONELINE) - .help("list one file per line."), + Arg::with_name(options::FORMAT) + .long(options::FORMAT) + .help("Set the display format.") + .takes_value(true) + .possible_values(&["long", "verbose", "single-column", "columns"]) + .hide_possible_values(true) + .require_equals(true) + .overrides_with_all(&[ + options::FORMAT, + options::format::COLUMNS, + options::format::ONELINE, + options::format::LONG, + ]), ) + .arg( + Arg::with_name(options::format::COLUMNS) + .short(options::format::COLUMNS) + .help("Display the files in columns.") + ) + .arg( + Arg::with_name(options::format::ONELINE) + .short(options::format::ONELINE) + .help("List one file per line.") + ) + .arg( + Arg::with_name(options::format::LONG) + .short("l") + .long(options::format::LONG) + .help("Display detailed information.") + ) + + // Time arguments + .arg( + Arg::with_name(options::TIME) + .long(options::TIME) + .help("Show time in :\n\ + \taccess time (-u): atime, access, use;\n\ + \tchange time (-t): ctime, status.") + .value_name("field") + .takes_value(true) + .possible_values(&["atime", "access", "use", "ctime", "status"]) + .hide_possible_values(true) + .require_equals(true) + .overrides_with_all(&[ + options::TIME, + options::time::ACCESS, + options::time::CHANGE, + ]) + ) + .arg( + Arg::with_name(options::time::CHANGE) + .short(options::time::CHANGE) + .help("If the long listing format (e.g., -l, -o) is being used, print the status \ + change time (the ‘ctime’ in the inode) instead of the modification time. When \ + explicitly sorting by time (--sort=time or -t) or when not using a long listing \ + format, sort according to the status change time.", + )) + .arg( + Arg::with_name(options::time::ACCESS) + .short(options::time::ACCESS) + .help("If the long listing format (e.g., -l, -o) is being used, print the status \ + access time instead of the modification time. When explicitly sorting by time \ + (--sort=time or -t) or when not using a long listing format, sort according to the \ + access time.") + ) + + // Sort arguments + .arg( + Arg::with_name(options::SORT) + .long(options::SORT) + .help("Sort by : name, none (-U), time (-t) or size (-S)") + .value_name("field") + .takes_value(true) + .possible_values(&["name", "none", "time", "size"]) + .require_equals(true) + .overrides_with_all(&[ + options::SORT, + options::sort::SIZE, + options::sort::TIME, + options::sort::NONE, + ]) + ) + .arg( + Arg::with_name(options::sort::SIZE) + .short(options::sort::SIZE) + .help("Sort by file size, largest first."), + ) + .arg( + Arg::with_name(options::sort::TIME) + .short(options::sort::TIME) + .help("Sort by modification time (the 'mtime' in the inode), newest first."), + ) + .arg( + Arg::with_name(options::sort::NONE) + .short(options::sort::NONE) + .help("Do not sort; list the files in whatever order they are stored in the \ + directory. This is especially useful when listing very large directories, \ + since not doing any sorting can be noticeably faster.") + ) + + // Other Flags .arg( Arg::with_name(options::files::ALL) .short("a") @@ -302,22 +431,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::IGNORE_BACKUPS) .help("Ignore entries which end with ~."), ) - .arg( - Arg::with_name(options::time::CHANGE) - .short(options::time::CHANGE) - .help("If the long listing format (e.g., -l, -o) is being used, print the status \ - change time (the ‘ctime’ in the inode) instead of the modification time. When \ - explicitly sorting by time (--sort=time or -t) or when not using a long listing \ - format, sort according to the status change time.", - )) - .arg( - Arg::with_name(options::time::ACCESS) - .short(options::time::ACCESS) - .help("If the long listing format (e.g., -l, -o) is being used, print the status \ - access time instead of the modification time. When explicitly sorting by time \ - (--sort=time or -t) or when not using a long listing format, sort according to the \ - access time.") - ) .arg( Arg::with_name(options::DIRECTORY) .short("d") @@ -359,12 +472,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { file the link references rather than the link itself.", ), ) - .arg( - Arg::with_name(options::display::LONG) - .short("l") - .long(options::display::LONG) - .help("Display detailed information."), - ) .arg( Arg::with_name(options::NUMERIC_UID_GID) .short("n") @@ -384,23 +491,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::RECURSIVE) .help("List the contents of all directories recursively."), ) - .arg( - Arg::with_name(options::sort::SIZE) - .short(options::sort::SIZE) - .help("Sort by file size, largest first."), - ) - .arg( - Arg::with_name(options::sort::TIME) - .short(options::sort::TIME) - .help("Sort by modification time (the 'mtime' in the inode), newest first."), - ) - .arg( - Arg::with_name(options::sort::NONE) - .short(options::sort::NONE) - .help("Do not sort; list the files in whatever order they are stored in the \ - directory. This is especially useful when listing very large directories, \ - since not doing any sorting can be noticeably faster.", - )) + + // Positional arguments .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)); #[cfg(unix)] @@ -444,7 +536,7 @@ fn list(locs: Vec, config: Config) -> i32 { if p.is_dir() && !config.directory { dir = true; - if config.display == DisplayOptions::Long && !config.dereference { + if config.format == Format::Long && !config.dereference { if let Ok(md) = p.symlink_metadata() { if md.file_type().is_symlink() && !p.ends_with("/") { dir = false; @@ -593,7 +685,7 @@ fn pad_left(string: String, count: usize) -> String { } fn display_items(items: &[PathBuf], strip: Option<&Path>, config: &Config) { - if config.display == DisplayOptions::Long || config.numeric_uid_gid { + if config.format == Format::Long || config.numeric_uid_gid { let (mut max_links, mut max_size) = (1, 1); for item in items { let (links, size) = display_dir_entry_size(item, config); @@ -604,7 +696,7 @@ fn display_items(items: &[PathBuf], strip: Option<&Path>, config: &Config) { display_item_long(item, strip, max_links, max_size, config); } } else { - if config.display != DisplayOptions::OneLine { + if config.format != Format::OneLine { let names = items.iter().filter_map(|i| { let md = get_metadata(i, config); match md { @@ -811,7 +903,7 @@ fn display_file_name( ) -> Cell { let mut name = get_file_name(path, strip); - if config.display == DisplayOptions::Long { + if config.format == Format::Long { name = get_inode(metadata, config) + &name; } @@ -824,7 +916,7 @@ fn display_file_name( } } - if config.display == DisplayOptions::Long && metadata.file_type().is_symlink() { + if config.format == Format::Long && metadata.file_type().is_symlink() { if let Ok(target) = path.read_link() { // We don't bother updating width here because it's not used for long listings let target_name = target.to_string_lossy().to_string(); @@ -872,7 +964,7 @@ fn display_file_name( config: &Config, ) -> Cell { let mut name = get_file_name(path, strip); - if config.display != DisplayOptions::Long { + if config.format != Format::Long { name = get_inode(metadata, config) + &name; } let mut width = UnicodeWidthStr::width(&*name); @@ -940,7 +1032,7 @@ fn display_file_name( } } - if config.display == DisplayOptions::Long && metadata.file_type().is_symlink() { + if config.format == Format::Long && metadata.file_type().is_symlink() { if let Ok(target) = path.read_link() { // We don't bother updating width here because it's not used for long listings let code = if target.exists() { "fi" } else { "mi" }; From 5656a717c9f7445ea9b2695255e47e449aa2d183 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 15 Mar 2021 09:31:13 +0100 Subject: [PATCH 0046/1135] ls: make name sort case insensitive --- src/uu/ls/src/ls.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 69d1e251d..7e98a7fd3 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -579,7 +579,8 @@ fn sort_entries(entries: &mut Vec, config: &Config) { }), Sort::Size => entries .sort_by_key(|k| Reverse(get_metadata(k, config).map(|md| md.size()).unwrap_or(0))), - Sort::Name => entries.sort(), + // The default sort in GNU ls is case insensitive + Sort::Name => entries.sort_by_key(|k| k.to_string_lossy().to_lowercase()), Sort::None => {} } From 01fd207c81dc09b7efc7cff411b345c5441b98d4 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 15 Mar 2021 09:53:19 +0100 Subject: [PATCH 0047/1135] ls: remove list of missing features --- src/uu/ls/src/ls.rs | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 7e98a7fd3..c2d544a2c 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -7,45 +7,6 @@ // spell-checker:ignore (ToDO) cpio svgz webm somegroup nlink rmvb xspf -// Missing features from GNU Coreutils: -// --author -// -b, --escape -// --block-size=SIZE -// -c -// -D, --Dired -// -f -// --file-type -// --format=WORD -// --full-time -// -g -// --group-directories-first -// -G, --no-group -// --si -// -H, --dereference-command-line -// --dereference-command-line-symlink-to-dir -// --hide=PATTERN -// --hyperlink[=WHEN] -// --indicator-style=WORD -// -I, --ignore -// -k, --kibibytes -// -m -// -N, --literal -// -o -// -p, --indicator-style=slash -// -q, --hide-control-chars -// --show-control-chars -// -Q, --quote-name -// --quoting-style=WORD -// --time=WORD -// --time-style=TIME_STYLE -// -T, --tabsize=COLS -// -u -// -v -// -w, --width=COLS -// -x -// -X -// -Z, --context - #[cfg(unix)] #[macro_use] extern crate lazy_static; From a4c79c92ae3172164a5adb8a1badaedf82a7f3de Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 15 Mar 2021 10:24:24 +0100 Subject: [PATCH 0048/1135] ls: fix windows issues --- src/uu/ls/src/ls.rs | 109 +++++++++++++++----------------------------- 1 file changed, 38 insertions(+), 71 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index c2d544a2c..187b39006 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -15,6 +15,7 @@ extern crate uucore; use clap::{App, Arg}; use number_prefix::NumberPrefix; +use std::cmp::Reverse; #[cfg(unix)] use std::collections::HashMap; use std::fs; @@ -26,9 +27,6 @@ use std::os::unix::fs::MetadataExt; #[cfg(windows)] use std::os::windows::fs::MetadataExt; use std::path::{Path, PathBuf}; -use std::cmp::Reverse; -#[cfg(not(unix))] -use std::time::{SystemTime, UNIX_EPOCH}; use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use time::{strftime, Timespec}; @@ -167,7 +165,7 @@ impl Config { "single-column" => Format::OneLine, "columns" => Format::Columns, // below should never happen as clap already restricts the values. - _ => panic!("Invalid field for --format") + _ => panic!("Invalid field for --format"), } } else if options.is_present(options::format::LONG) { Format::Long @@ -194,7 +192,7 @@ impl Config { "time" => Sort::Time, "size" => Sort::Size, // below should never happen as clap already restricts the values. - _ => panic!("Invalid field for --sort") + _ => panic!("Invalid field for --sort"), } } else if options.is_present(options::sort::TIME) { Sort::Time @@ -211,7 +209,7 @@ impl Config { "ctime" | "status" => Time::Change, "access" | "atime" | "use" => Time::Access, // below should never happen as clap already restricts the values. - _ => panic!("Invalid field for --time") + _ => panic!("Invalid field for --time"), } } else if options.is_present(options::time::ACCESS) { Time::Access @@ -263,7 +261,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let mut app = App::new(executable!()) + let app = App::new(executable!()) .version(VERSION) .about(ABOUT) .usage(&usage[..]) @@ -455,18 +453,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // Positional arguments .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)); - + #[cfg(unix)] - { - app = app.arg( + let app = { + app.arg( Arg::with_name(options::COLOR) - .long(options::COLOR) - .help("Color output based on file type.") - .takes_value(true) - .require_equals(true) - .min_values(0), - ); - } + .long(options::COLOR) + .help("Color output based on file type.") + .takes_value(true) + .require_equals(true) + .min_values(0), + ) + }; let matches = app.get_matches_from(args); @@ -528,18 +526,18 @@ fn list(locs: Vec, config: Config) -> i32 { } } -#[cfg(any(unix, target_os = "redox"))] fn sort_entries(entries: &mut Vec, config: &Config) { match config.sort { Sort::Time => entries.sort_by_key(|k| { Reverse( get_metadata(k, config) - .map(|md| get_time(&md, config)) + .ok() + .and_then(|md| get_time(&md, config)) .unwrap_or(0), ) }), Sort::Size => entries - .sort_by_key(|k| Reverse(get_metadata(k, config).map(|md| md.size()).unwrap_or(0))), + .sort_by_key(|k| Reverse(get_metadata(k, config).map(|md| md.len()).unwrap_or(0))), // The default sort in GNU ls is case insensitive Sort::Name => entries.sort_by_key(|k| k.to_string_lossy().to_lowercase()), Sort::None => {} @@ -562,30 +560,6 @@ fn is_hidden(file_path: &DirEntry) -> bool { file_path.file_name().to_string_lossy().starts_with('.') } -#[cfg(windows)] -fn sort_entries(entries: &mut Vec, config: &Config) { - match config.sort { - Sort::Time => entries.sort_by_key(|k| { - // Newest first - Reverse(get_time(get_metadata(k, config), config).unwrap_or(std::time::UNIX_EPOCH)) - }), - Sort::Size => entries.sort_by_key(|k| { - // Largest first - Reverse( - get_metadata(k, config) - .map(|md| md.file_size()) - .unwrap_or(0), - ) - }), - Sort::Name => entries.sort(), - Sort::None => {} - } - - if config.reverse { - entries.reverse(); - } -} - fn should_display(entry: &DirEntry, config: &Config) -> bool { let ffi_name = entry.file_name(); let name = ffi_name.to_string_lossy(); @@ -782,42 +756,35 @@ fn display_group(_metadata: &Metadata, _config: &Config) -> String { // The implementations for get_time are separated because some options, such // as ctime will not be available #[cfg(unix)] -fn get_time(md: &Metadata, config: &Config) -> i64 { - match config.time { +fn get_time(md: &Metadata, config: &Config) -> Option { + Some(match config.time { Time::Change => md.ctime(), Time::Modification => md.mtime(), Time::Access => md.atime(), - } + }) } #[cfg(not(unix))] -fn get_time(md: &Metadata, config: &Config) -> Option { - match config.time { - Time::Modification => md.modification().ok(), - Time::Access => md.access().ok(), - _ => None, - } +fn get_time(md: &Metadata, config: &Config) -> Option { + let time = match config.time { + Time::Modification => md.modified().ok()?, + Time::Access => md.accessed().ok()?, + _ => return None, + }; + Some( + time.duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_secs() as i64, + ) } -#[cfg(unix)] fn display_date(metadata: &Metadata, config: &Config) -> String { - let secs = get_time(metadata, config); - let time = time::at(Timespec::new(secs, 0)); - strftime("%F %R", &time).unwrap() -} - -#[cfg(not(unix))] -fn display_date(metadata: &Metadata, config: &Config) -> String { - if let Some(time) = get_time(metadata, config) { - let time = time::at(Timespec::new( - time.duration_since(std::time::UNIX_EPOCH) - .unwrap() - .as_secs() as i64, - 0, - )); - strftime("%F %R", &time).unwrap() - } else { - "???".to_string() + match get_time(metadata, config) { + Some(secs) => { + let time = time::at(Timespec::new(secs, 0)); + strftime("%F %R", &time).unwrap() + } + None => "???".into(), } } From f28d5f4a73c19775c3892d09c808aa4a98f473c7 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 15 Mar 2021 12:07:10 +0100 Subject: [PATCH 0049/1135] ls: attempt to fix windows sorting issues --- src/uu/ls/src/ls.rs | 48 +++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 187b39006..90e4e2b22 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -27,6 +27,7 @@ use std::os::unix::fs::MetadataExt; #[cfg(windows)] use std::os::windows::fs::MetadataExt; use std::path::{Path, PathBuf}; +use std::time::{Duration, SystemTime, UNIX_EPOCH}; use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use time::{strftime, Timespec}; @@ -532,8 +533,8 @@ fn sort_entries(entries: &mut Vec, config: &Config) { Reverse( get_metadata(k, config) .ok() - .and_then(|md| get_time(&md, config)) - .unwrap_or(0), + .and_then(|md| get_system_time(&md, config)) + .unwrap_or(UNIX_EPOCH), ) }), Sort::Size => entries @@ -756,34 +757,35 @@ fn display_group(_metadata: &Metadata, _config: &Config) -> String { // The implementations for get_time are separated because some options, such // as ctime will not be available #[cfg(unix)] -fn get_time(md: &Metadata, config: &Config) -> Option { - Some(match config.time { - Time::Change => md.ctime(), - Time::Modification => md.mtime(), - Time::Access => md.atime(), - }) +fn get_system_time(md: &Metadata, config: &Config) -> Option { + match config.time { + Time::Change => Some(UNIX_EPOCH + Duration::new(md.ctime() as u64, md.ctime_nsec() as u32)), + Time::Modification => md.modified().ok(), + Time::Access => md.accessed().ok(), + } } #[cfg(not(unix))] -fn get_time(md: &Metadata, config: &Config) -> Option { - let time = match config.time { - Time::Modification => md.modified().ok()?, - Time::Access => md.accessed().ok()?, - _ => return None, - }; - Some( - time.duration_since(std::time::UNIX_EPOCH) - .unwrap() - .as_secs() as i64, - ) +fn get_system_time(md: &Metadata, config: &Config) -> Option { + match config.time { + Time::Modification => md.modified().ok(), + Time::Access => md.accessed().ok(), + _ => None, + } +} + +fn get_time(md: &Metadata, config: &Config) -> Option { + let duration = get_system_time(md, config)? + .duration_since(UNIX_EPOCH) + .ok()?; + let secs = duration.as_secs() as i64; + let nsec = duration.subsec_nanos() as i32; + Some(time::at(Timespec::new(secs, nsec))) } fn display_date(metadata: &Metadata, config: &Config) -> String { match get_time(metadata, config) { - Some(secs) => { - let time = time::at(Timespec::new(secs, 0)); - strftime("%F %R", &time).unwrap() - } + Some(time) => strftime("%F %R", &time).unwrap(), None => "???".into(), } } From 20094127c3cbe6e74dc77ed75c81944716a5c761 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 15 Mar 2021 12:21:08 +0100 Subject: [PATCH 0050/1135] ls: --color back on windows as noop --- src/uu/ls/src/ls.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 90e4e2b22..24adaa649 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -102,7 +102,6 @@ pub mod options { pub static NUMERIC_UID_GID: &str = "numeric-uid-gid"; pub static REVERSE: &str = "reverse"; pub static RECURSIVE: &str = "recursive"; - #[cfg(unix)] pub static COLOR: &str = "color"; pub static PATHS: &str = "paths"; } @@ -451,13 +450,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::RECURSIVE) .help("List the contents of all directories recursively."), ) - - // Positional arguments - .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)); - - #[cfg(unix)] - let app = { - app.arg( + .arg( Arg::with_name(options::COLOR) .long(options::COLOR) .help("Color output based on file type.") @@ -465,7 +458,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .require_equals(true) .min_values(0), ) - }; + + // Positional arguments + .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)); let matches = app.get_matches_from(args); From 10135dccef1d3c0844963831acadf1127dbdfb17 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 15 Mar 2021 13:46:21 +0100 Subject: [PATCH 0051/1135] ls: fix unused import and improve coverage --- src/uu/ls/src/ls.rs | 10 +-- tests/by-util/test_ls.rs | 127 +++++++++++++++++++++++++++++++++++---- 2 files changed, 120 insertions(+), 17 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 24adaa649..5c4cdaa80 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -27,7 +27,9 @@ use std::os::unix::fs::MetadataExt; #[cfg(windows)] use std::os::windows::fs::MetadataExt; use std::path::{Path, PathBuf}; -use std::time::{Duration, SystemTime, UNIX_EPOCH}; +#[cfg(unix)] +use std::time::Duration; +use std::time::{SystemTime, UNIX_EPOCH}; use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use time::{strftime, Timespec}; @@ -165,7 +167,7 @@ impl Config { "single-column" => Format::OneLine, "columns" => Format::Columns, // below should never happen as clap already restricts the values. - _ => panic!("Invalid field for --format"), + _ => unreachable!("Invalid field for --format"), } } else if options.is_present(options::format::LONG) { Format::Long @@ -192,7 +194,7 @@ impl Config { "time" => Sort::Time, "size" => Sort::Size, // below should never happen as clap already restricts the values. - _ => panic!("Invalid field for --sort"), + _ => unreachable!("Invalid field for --sort"), } } else if options.is_present(options::sort::TIME) { Sort::Time @@ -209,7 +211,7 @@ impl Config { "ctime" | "status" => Time::Change, "access" | "atime" | "use" => Time::Access, // below should never happen as clap already restricts the values. - _ => panic!("Invalid field for --time"), + _ => unreachable!("Invalid field for --time"), } } else if options.is_present(options::time::ACCESS) { Time::Access diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 422db8df9..e8ef18966 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -57,6 +57,36 @@ fn test_ls_a() { assert!(!result.stdout.contains("..")); } +#[test] +fn test_ls_columns() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.touch(&at.plus_as_string("test-columns-1")); + at.touch(&at.plus_as_string("test-columns-2")); + + // Columns is the default + let result = scene.ucmd().run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + + #[cfg(not(windows))] + assert_eq!(result.stdout, "test-columns-1\ntest-columns-2\n"); + #[cfg(windows)] + assert_eq!(result.stdout, "test-columns-1 test-columns-2\n"); + + for option in &["-C", "--format=columns"] { + let result = scene.ucmd().arg(option).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + #[cfg(not(windows))] + assert_eq!(result.stdout, "test-columns-1\ntest-columns-2\n"); + #[cfg(windows)] + assert_eq!(result.stdout, "test-columns-1 test-columns-2\n"); + } +} + #[test] fn test_ls_long() { #[cfg(not(windows))] @@ -71,16 +101,20 @@ fn test_ls_long() { } } - let (at, mut ucmd) = at_and_ucmd!(); + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; at.touch(&at.plus_as_string("test-long")); - let result = ucmd.arg("-l").arg("test-long").succeeds(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - #[cfg(not(windows))] - assert!(result.stdout.contains("-rw-rw-r--")); - #[cfg(windows)] - assert!(result.stdout.contains("---------- 1 somebody somegroup")); + for arg in &["-l", "--long", "--format=long", "--format=verbose"] { + let result = scene.ucmd().arg(arg).arg("test-long").succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + #[cfg(not(windows))] + assert!(result.stdout.contains("-rw-rw-r--")); + + #[cfg(windows)] + assert!(result.stdout.contains("---------- 1 somebody somegroup")); + } #[cfg(not(windows))] { @@ -90,6 +124,24 @@ fn test_ls_long() { } } +#[test] +fn test_ls_oneline() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.touch(&at.plus_as_string("test-oneline-1")); + at.touch(&at.plus_as_string("test-oneline-2")); + + // Bit of a weird situation: in the tests oneline and columns have the same output, + // except on Windows. + for option in &["-1", "--format=single-column"] { + let result = scene.ucmd().arg(option).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert_eq!(result.stdout, "test-oneline-1\ntest-oneline-2\n"); + } +} + #[test] fn test_ls_deref() { let scene = TestScenario::new(util_name!()); @@ -166,27 +218,54 @@ fn test_ls_order_size() { } #[test] -fn test_ls_order_creation() { +fn test_ls_long_ctime() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.touch("test-long-ctime-1"); + let result = scene.ucmd().arg("-lc").succeeds(); + + // Should show the time on Unix, but question marks on windows. + #[cfg(unix)] + assert!(result.stdout.contains(":")); + #[cfg(not(unix))] + assert!(result.stdout.contains("???")); +} + +#[test] +fn test_ls_order_time() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.touch("test-1"); at.append("test-1", "1"); - sleep(Duration::from_millis(500)); + sleep(Duration::from_millis(100)); at.touch("test-2"); at.append("test-2", "22"); - sleep(Duration::from_millis(500)); + sleep(Duration::from_millis(100)); at.touch("test-3"); at.append("test-3", "333"); - sleep(Duration::from_millis(500)); + sleep(Duration::from_millis(100)); at.touch("test-4"); at.append("test-4", "4444"); + sleep(Duration::from_millis(100)); + + // Read test-3, only changing access time + at.read("test-3"); + + // Set permissions of test-2, only changing ctime + std::fs::set_permissions( + at.plus_as_string("test-2"), + at.metadata("test-2").permissions(), + ) + .unwrap(); let result = scene.ucmd().arg("-al").run(); println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); assert!(result.success); + // ctime was changed at write, so the order is 4 3 2 1 let result = scene.ucmd().arg("-t").run(); println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); @@ -196,7 +275,7 @@ fn test_ls_order_creation() { #[cfg(windows)] assert_eq!(result.stdout, "test-4 test-3 test-2 test-1\n"); - let result = scene.ucmd().arg("-t").arg("-r").run(); + let result = scene.ucmd().arg("-tr").run(); println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); assert!(result.success); @@ -204,6 +283,28 @@ fn test_ls_order_creation() { assert_eq!(result.stdout, "test-1\ntest-2\ntest-3\ntest-4\n"); #[cfg(windows)] assert_eq!(result.stdout, "test-1 test-2 test-3 test-4\n"); + + // 3 was accessed last in the read + // So the order should be 2 3 4 1 + let result = scene.ucmd().arg("-tu").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + #[cfg(not(windows))] + assert_eq!(result.stdout, "test-3\ntest-4\ntest-2\ntest-1\n"); + #[cfg(windows)] + assert_eq!(result.stdout, "test-3 test-4 test-2 test-1\n"); + + // test-2 had the last ctime change when the permissions were set + // So the order should be 2 4 3 1 + #[cfg(unix)] + { + let result = scene.ucmd().arg("-tc").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert_eq!(result.stdout, "test-2\ntest-4\ntest-3\ntest-1\n"); + } } #[test] From fd957dd1487c1d25d733ae655cc945c339337145 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 15 Mar 2021 14:09:29 +0100 Subject: [PATCH 0052/1135] ls: fix access time on windows --- tests/by-util/test_ls.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index e8ef18966..fea912695 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -292,8 +292,11 @@ fn test_ls_order_time() { assert!(result.success); #[cfg(not(windows))] assert_eq!(result.stdout, "test-3\ntest-4\ntest-2\ntest-1\n"); + + // Access time does not seem to be set on Windows on read call + // so the order is 4 3 2 1 #[cfg(windows)] - assert_eq!(result.stdout, "test-3 test-4 test-2 test-1\n"); + assert_eq!(result.stdout, "test-4 test-3 test-2 test-1\n"); // test-2 had the last ctime change when the permissions were set // So the order should be 2 4 3 1 From cd775ed704d897e06395134ab1922f7a58725031 Mon Sep 17 00:00:00 2001 From: Dean Li Date: Mon, 15 Mar 2021 21:28:47 +0800 Subject: [PATCH 0053/1135] Expand: use mod::options --- src/uu/expand/src/expand.rs | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index 52537dcc2..67d24086c 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -23,6 +23,13 @@ static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Convert tabs in each FILE to spaces, writing to standard output. With no FILE, or when FILE is -, read standard input."; +pub mod options { + pub static TABS: &str = "tabs"; + pub static INITIAL: &str = "initial"; + pub static NO_UTF8: &str = "no-utf8"; + pub static FILES: &str = "FILES"; +} + static LONG_HELP: &str = ""; static DEFAULT_TABSTOP: usize = 8; @@ -65,13 +72,13 @@ struct Options { impl Options { fn new(matches: &ArgMatches) -> Options { - let tabstops = match matches.value_of("tabstops") { + let tabstops = match matches.value_of(options::TABS) { Some(s) => tabstops_parse(s.to_string()), None => vec![DEFAULT_TABSTOP], }; - let iflag = matches.is_present("iflag"); - let uflag = !matches.is_present("uflag"); + let iflag = matches.is_present(options::INITIAL); + let uflag = !matches.is_present(options::NO_UTF8); // avoid allocations when dumping out long sequences of spaces // by precomputing the longest string of spaces we will ever need @@ -86,7 +93,7 @@ impl Options { .unwrap(); // length of tabstops is guaranteed >= 1 let tspaces = repeat(' ').take(nspaces).collect(); - let files: Vec = match matches.values_of("files") { + let files: Vec = match matches.values_of(options::FILES) { Some(s) => s.map(|v| v.to_string()).collect(), None => vec!["-".to_owned()], }; @@ -109,23 +116,29 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .usage(&usage[..]) .after_help(LONG_HELP) .arg( - Arg::with_name("iflag") - .long("initial") + Arg::with_name(options::INITIAL) + .long(options::INITIAL) .short("i") .help("do not convert tabs after non blanks"), ) .arg( - Arg::with_name("tabstops") - .long("tabs") + Arg::with_name(options::TABS) + .long(options::TABS) .short("t") .value_name("N, LIST") .takes_value(true) .help("have tabs N characters apart, not 8 or use comma separated list of explicit tab positions"), ) .arg( - Arg::with_name("uflags").long("no-utf8").short("U").help("interpret input file as 8-bit ASCII rather than UTF-8"), + Arg::with_name(options::NO_UTF8) + .long(options::NO_UTF8) + .short("U") + .help("interpret input file as 8-bit ASCII rather than UTF-8"), ).arg( - Arg::with_name("files").multiple(true).hidden(true).takes_value(true) + Arg::with_name(options::FILES) + .multiple(true) + .hidden(true) + .takes_value(true) ) .get_matches_from(args); From f60808471051187eeaf03fc74b936a45d18c26c0 Mon Sep 17 00:00:00 2001 From: Dean Li Date: Mon, 15 Mar 2021 21:29:28 +0800 Subject: [PATCH 0054/1135] Expand: add test for multiple files --- tests/by-util/test_expand.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/by-util/test_expand.rs b/tests/by-util/test_expand.rs index 121ccccec..801bf9d98 100644 --- a/tests/by-util/test_expand.rs +++ b/tests/by-util/test_expand.rs @@ -46,3 +46,13 @@ fn test_with_space() { assert!(result.success); assert!(result.stdout.contains(" return")); } + +#[test] +fn test_with_multiple_files() { + let (_, mut ucmd) = at_and_ucmd!(); + + let result = ucmd.arg("with-spaces.txt").arg("with-tab.txt").run(); + assert!(result.success); + assert!(result.stdout.contains(" return")); + assert!(result.stdout.contains(" ")); +} From 406cd865ebeeae49f8c192909b7e8d624d070483 Mon Sep 17 00:00:00 2001 From: Hari Date: Mon, 15 Mar 2021 11:00:30 -0400 Subject: [PATCH 0055/1135] install: run rustfmt Fix formatting issues based on PR review comments --- src/uu/install/src/install.rs | 9 ++++----- tests/by-util/test_install.rs | 10 ++++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index c9d2c77ca..9d1acdc7e 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -13,7 +13,7 @@ mod mode; extern crate uucore; use clap::{App, Arg, ArgMatches}; -use filetime::{FileTime, set_file_times}; +use filetime::{set_file_times, FileTime}; use uucore::entries::{grp2gid, usr2uid}; use uucore::perms::{wrap_chgrp, wrap_chown, Verbosity}; @@ -337,7 +337,7 @@ fn behavior(matches: &ArgMatches) -> Result { owner: matches.value_of(OPT_OWNER).unwrap_or("").to_string(), group: matches.value_of(OPT_GROUP).unwrap_or("").to_string(), verbose: matches.is_present(OPT_VERBOSE), - preserve_timestamps: matches.is_present(OPT_PRESERVE_TIMESTAMPS) + preserve_timestamps: matches.is_present(OPT_PRESERVE_TIMESTAMPS), }) } @@ -565,10 +565,9 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { let accessed_time = FileTime::from_last_access_time(&meta); match set_file_times(to.as_path(), accessed_time, modified_time) { - Ok(_) => {}, - Err(e) => show_info!("{}", e) + Ok(_) => {} + Err(e) => show_info!("{}", e), } - } if b.verbose { diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index ee79a8271..7b3706f9e 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -324,8 +324,14 @@ fn test_install_preserve_timestamps() { let file1_metadata = at.metadata(file1); let file2_metadata = at.metadata(file2); - assert_eq!(file1_metadata.accessed().ok(), file2_metadata.accessed().ok()); - assert_eq!(file1_metadata.modified().ok(), file2_metadata.modified().ok()); + assert_eq!( + file1_metadata.accessed().ok(), + file2_metadata.accessed().ok() + ); + assert_eq!( + file1_metadata.modified().ok(), + file2_metadata.modified().ok() + ); } // These two tests are failing but should work From 02e9ffecddffa79e63cab71d8adf356c6ef07e40 Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Mon, 15 Mar 2021 11:07:19 -0400 Subject: [PATCH 0056/1135] numfmt: split implementation into modules --- src/uu/numfmt/src/format.rs | 265 ++++++++++++++++++++++++ src/uu/numfmt/src/numfmt.rs | 391 +++-------------------------------- src/uu/numfmt/src/options.rs | 25 +++ src/uu/numfmt/src/units.rs | 67 ++++++ 4 files changed, 382 insertions(+), 366 deletions(-) create mode 100644 src/uu/numfmt/src/format.rs create mode 100644 src/uu/numfmt/src/options.rs create mode 100644 src/uu/numfmt/src/units.rs diff --git a/src/uu/numfmt/src/format.rs b/src/uu/numfmt/src/format.rs new file mode 100644 index 000000000..e7286c44e --- /dev/null +++ b/src/uu/numfmt/src/format.rs @@ -0,0 +1,265 @@ +use crate::options::NumfmtOptions; +use crate::units::{ + DisplayableSuffix, RawSuffix, Result, Suffix, Transform, Unit, IEC_BASES, SI_BASES, +}; + +/// Iterate over a line's fields, where each field is a contiguous sequence of +/// non-whitespace, optionally prefixed with one or more characters of leading +/// whitespace. Fields are returned as tuples of `(prefix, field)`. +/// +/// # Examples: +/// +/// ``` +/// let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some(" 1234 5") }; +/// +/// assert_eq!(Some((" ", "1234")), fields.next()); +/// assert_eq!(Some((" ", "5")), fields.next()); +/// assert_eq!(None, fields.next()); +/// ``` +/// +/// Delimiters are included in the results; `prefix` will be empty only for +/// the first field of the line (including the case where the input line is +/// empty): +/// +/// ``` +/// let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some("first second") }; +/// +/// assert_eq!(Some(("", "first")), fields.next()); +/// assert_eq!(Some((" ", "second")), fields.next()); +/// +/// let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some("") }; +/// +/// assert_eq!(Some(("", "")), fields.next()); +/// ``` +pub struct WhitespaceSplitter<'a> { + pub s: Option<&'a str>, +} + +impl<'a> Iterator for WhitespaceSplitter<'a> { + type Item = (&'a str, &'a str); + + /// Yield the next field in the input string as a tuple `(prefix, field)`. + fn next(&mut self) -> Option { + let haystack = self.s?; + + let (prefix, field) = haystack.split_at( + haystack + .find(|c: char| !c.is_whitespace()) + .unwrap_or_else(|| haystack.len()), + ); + + let (field, rest) = field.split_at( + field + .find(|c: char| c.is_whitespace()) + .unwrap_or_else(|| field.len()), + ); + + self.s = if !rest.is_empty() { Some(rest) } else { None }; + + Some((prefix, field)) + } +} + +fn parse_suffix(s: &str) -> Result<(f64, Option)> { + if s.is_empty() { + return Err("invalid number: ‘’".to_string()); + } + + let with_i = s.ends_with('i'); + let mut iter = s.chars(); + if with_i { + iter.next_back(); + } + let suffix: Option = match iter.next_back() { + Some('K') => Ok(Some((RawSuffix::K, with_i))), + Some('M') => Ok(Some((RawSuffix::M, with_i))), + Some('G') => Ok(Some((RawSuffix::G, with_i))), + Some('T') => Ok(Some((RawSuffix::T, with_i))), + Some('P') => Ok(Some((RawSuffix::P, with_i))), + Some('E') => Ok(Some((RawSuffix::E, with_i))), + Some('Z') => Ok(Some((RawSuffix::Z, with_i))), + Some('Y') => Ok(Some((RawSuffix::Y, with_i))), + Some('0'..='9') => Ok(None), + _ => Err(format!("invalid suffix in input: ‘{}’", s)), + }?; + + let suffix_len = match suffix { + None => 0, + Some((_, false)) => 1, + Some((_, true)) => 2, + }; + + let number = s[..s.len() - suffix_len] + .parse::() + .map_err(|_| format!("invalid number: ‘{}’", s))?; + + Ok((number, suffix)) +} + +fn remove_suffix(i: f64, s: Option, u: &Unit) -> Result { + match (s, u) { + (None, _) => Ok(i), + (Some((raw_suffix, false)), &Unit::Auto) | (Some((raw_suffix, false)), &Unit::Si) => { + match raw_suffix { + RawSuffix::K => Ok(i * 1e3), + RawSuffix::M => Ok(i * 1e6), + RawSuffix::G => Ok(i * 1e9), + RawSuffix::T => Ok(i * 1e12), + RawSuffix::P => Ok(i * 1e15), + RawSuffix::E => Ok(i * 1e18), + RawSuffix::Z => Ok(i * 1e21), + RawSuffix::Y => Ok(i * 1e24), + } + } + (Some((raw_suffix, false)), &Unit::Iec(false)) + | (Some((raw_suffix, true)), &Unit::Auto) + | (Some((raw_suffix, true)), &Unit::Iec(true)) => match raw_suffix { + RawSuffix::K => Ok(i * IEC_BASES[1]), + RawSuffix::M => Ok(i * IEC_BASES[2]), + RawSuffix::G => Ok(i * IEC_BASES[3]), + RawSuffix::T => Ok(i * IEC_BASES[4]), + RawSuffix::P => Ok(i * IEC_BASES[5]), + RawSuffix::E => Ok(i * IEC_BASES[6]), + RawSuffix::Z => Ok(i * IEC_BASES[7]), + RawSuffix::Y => Ok(i * IEC_BASES[8]), + }, + (_, _) => Err("This suffix is unsupported for specified unit".to_owned()), + } +} + +fn transform_from(s: &str, opts: &Transform) -> Result { + let (i, suffix) = parse_suffix(s)?; + + remove_suffix(i, suffix, &opts.unit).map(|n| if n < 0.0 { -n.abs().ceil() } else { n.ceil() }) +} + +/// Divide numerator by denominator, with ceiling. +/// +/// If the result of the division is less than 10.0, truncate the result +/// to the next highest tenth. +/// +/// Otherwise, truncate the result to the next highest whole number. +/// +/// # Examples: +/// +/// ``` +/// use uu_numfmt::format::div_ceil; +/// +/// assert_eq!(div_ceil(1.01, 1.0), 1.1); +/// assert_eq!(div_ceil(999.1, 1000.), 1.0); +/// assert_eq!(div_ceil(1001., 10.), 101.); +/// assert_eq!(div_ceil(9991., 10.), 1000.); +/// assert_eq!(div_ceil(-12.34, 1.0), -13.0); +/// assert_eq!(div_ceil(1000.0, -3.14), -319.0); +/// assert_eq!(div_ceil(-271828.0, -271.0), 1004.0); +/// ``` +pub fn div_ceil(n: f64, d: f64) -> f64 { + let v = n / (d / 10.0); + let (v, sign) = if v < 0.0 { (v.abs(), -1.0) } else { (v, 1.0) }; + + if v < 100.0 { + v.ceil() / 10.0 * sign + } else { + (v / 10.0).ceil() * sign + } +} + +fn consider_suffix(n: f64, u: &Unit) -> Result<(f64, Option)> { + use crate::units::RawSuffix::*; + + let abs_n = n.abs(); + let suffixes = [K, M, G, T, P, E, Z, Y]; + + let (bases, with_i) = match *u { + Unit::Si => (&SI_BASES, false), + Unit::Iec(with_i) => (&IEC_BASES, with_i), + Unit::Auto => return Err("Unit 'auto' isn't supported with --to options".to_owned()), + Unit::None => return Ok((n, None)), + }; + + let i = match abs_n { + _ if abs_n <= bases[1] - 1.0 => return Ok((n, None)), + _ if abs_n < bases[2] => 1, + _ if abs_n < bases[3] => 2, + _ if abs_n < bases[4] => 3, + _ if abs_n < bases[5] => 4, + _ if abs_n < bases[6] => 5, + _ if abs_n < bases[7] => 6, + _ if abs_n < bases[8] => 7, + _ if abs_n < bases[9] => 8, + _ => return Err("Number is too big and unsupported".to_string()), + }; + + let v = div_ceil(n, bases[i]); + + // check if rounding pushed us into the next base + if v.abs() >= bases[1] { + Ok((v / bases[1], Some((suffixes[i], with_i)))) + } else { + Ok((v, Some((suffixes[i - 1], with_i)))) + } +} + +fn transform_to(s: f64, opts: &Transform) -> Result { + let (i2, s) = consider_suffix(s, &opts.unit)?; + Ok(match s { + None => format!("{}", i2), + Some(s) if i2.abs() < 10.0 => format!("{:.1}{}", i2, DisplayableSuffix(s)), + Some(s) => format!("{:.0}{}", i2, DisplayableSuffix(s)), + }) +} + +fn format_string( + source: &str, + options: &NumfmtOptions, + implicit_padding: Option, +) -> Result { + let number = transform_to( + transform_from(source, &options.transform.from)?, + &options.transform.to, + )?; + + Ok(match implicit_padding.unwrap_or(options.padding) { + p if p == 0 => number, + p if p > 0 => format!("{:>padding$}", number, padding = p as usize), + p => format!("{: Result<()> { + for (n, (prefix, field)) in (1..).zip(WhitespaceSplitter { s: Some(s) }) { + let field_selected = uucore::ranges::contain(&options.fields, n); + + if field_selected { + let empty_prefix = prefix.is_empty(); + + // print delimiter before second and subsequent fields + let prefix = if n > 1 { + print!(" "); + &prefix[1..] + } else { + &prefix + }; + + let implicit_padding = if !empty_prefix && options.padding == 0 { + Some((prefix.len() + field.len()) as isize) + } else { + None + }; + + print!("{}", format_string(&field, options, implicit_padding)?); + } else { + // print unselected field without conversion + print!("{}{}", prefix, field); + } + } + + println!(); + + Ok(()) +} diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index ea750c024..e37792669 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -8,11 +8,17 @@ #[macro_use] extern crate uucore; +use crate::format::format_and_print; +use crate::options::*; +use crate::units::{Result, Transform, Unit}; use clap::{App, AppSettings, Arg, ArgMatches}; -use std::fmt; use std::io::{BufRead, Write}; use uucore::ranges::Range; +pub mod format; +mod options; +mod units; + static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Convert numbers from/to human-readable strings"; static LONG_HELP: &str = "UNIT options: @@ -43,119 +49,33 @@ FIELDS supports cut(1) style field ranges: Multiple fields/ranges can be separated with commas "; -mod options { - pub const FIELD: &str = "field"; - pub const FIELD_DEFAULT: &str = "1"; - pub const FROM: &str = "from"; - pub const FROM_DEFAULT: &str = "none"; - pub const HEADER: &str = "header"; - pub const HEADER_DEFAULT: &str = "1"; - pub const NUMBER: &str = "NUMBER"; - pub const PADDING: &str = "padding"; - pub const TO: &str = "to"; - pub const TO_DEFAULT: &str = "none"; -} - fn get_usage() -> String { format!("{0} [OPTION]... [NUMBER]...", executable!()) } -const SI_BASES: [f64; 10] = [1., 1e3, 1e6, 1e9, 1e12, 1e15, 1e18, 1e21, 1e24, 1e27]; - -const IEC_BASES: [f64; 10] = [ - 1., - 1_024., - 1_048_576., - 1_073_741_824., - 1_099_511_627_776., - 1_125_899_906_842_624., - 1_152_921_504_606_846_976., - 1_180_591_620_717_411_303_424., - 1_208_925_819_614_629_174_706_176., - 1_237_940_039_285_380_274_899_124_224., -]; - -type Result = std::result::Result; - -type WithI = bool; - -enum Unit { - Auto, - Si, - Iec(WithI), - None, -} - -#[derive(Clone, Copy, Debug)] -enum RawSuffix { - K, - M, - G, - T, - P, - E, - Z, - Y, -} - -type Suffix = (RawSuffix, WithI); - -struct DisplayableSuffix(Suffix); - -impl fmt::Display for DisplayableSuffix { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let DisplayableSuffix((ref raw_suffix, ref with_i)) = *self; - match raw_suffix { - RawSuffix::K => write!(f, "K"), - RawSuffix::M => write!(f, "M"), - RawSuffix::G => write!(f, "G"), - RawSuffix::T => write!(f, "T"), - RawSuffix::P => write!(f, "P"), - RawSuffix::E => write!(f, "E"), - RawSuffix::Z => write!(f, "Z"), - RawSuffix::Y => write!(f, "Y"), - } - .and_then(|()| match with_i { - true => write!(f, "i"), - false => Ok(()), - }) - } -} - -fn parse_suffix(s: &str) -> Result<(f64, Option)> { - if s.is_empty() { - return Err("invalid number: ‘’".to_string()); +fn handle_args<'a>(args: impl Iterator, options: NumfmtOptions) -> Result<()> { + for l in args { + format_and_print(l, &options)?; } - let with_i = s.ends_with('i'); - let mut iter = s.chars(); - if with_i { - iter.next_back(); + Ok(()) +} + +fn handle_stdin(options: NumfmtOptions) -> Result<()> { + let stdin = std::io::stdin(); + let locked_stdin = stdin.lock(); + + let mut lines = locked_stdin.lines(); + for l in lines.by_ref().take(options.header) { + l.map(|s| println!("{}", s)).map_err(|e| e.to_string())?; } - let suffix: Option = match iter.next_back() { - Some('K') => Ok(Some((RawSuffix::K, with_i))), - Some('M') => Ok(Some((RawSuffix::M, with_i))), - Some('G') => Ok(Some((RawSuffix::G, with_i))), - Some('T') => Ok(Some((RawSuffix::T, with_i))), - Some('P') => Ok(Some((RawSuffix::P, with_i))), - Some('E') => Ok(Some((RawSuffix::E, with_i))), - Some('Z') => Ok(Some((RawSuffix::Z, with_i))), - Some('Y') => Ok(Some((RawSuffix::Y, with_i))), - Some('0'..='9') => Ok(None), - _ => Err(format!("invalid suffix in input: ‘{}’", s)), - }?; - let suffix_len = match suffix { - None => 0, - Some((_, false)) => 1, - Some((_, true)) => 2, - }; + for l in lines { + l.map_err(|e| e.to_string()) + .and_then(|l| format_and_print(&l, &options))?; + } - let number = s[..s.len() - suffix_len] - .parse::() - .map_err(|_| format!("invalid number: ‘{}’", s))?; - - Ok((number, suffix)) + Ok(()) } fn parse_unit(s: &str) -> Result { @@ -169,242 +89,6 @@ fn parse_unit(s: &str) -> Result { } } -struct TransformOptions { - from: Transform, - to: Transform, -} - -struct Transform { - unit: Unit, -} - -struct NumfmtOptions { - transform: TransformOptions, - padding: isize, - header: usize, - fields: Vec, -} - -/// Iterate over a line's fields, where each field is a contiguous sequence of -/// non-whitespace, optionally prefixed with one or more characters of leading -/// whitespace. Fields are returned as tuples of `(prefix, field)`. -/// -/// # Examples: -/// -/// ``` -/// let mut fields = uu_numfmt::WhitespaceSplitter { s: Some(" 1234 5") }; -/// -/// assert_eq!(Some((" ", "1234")), fields.next()); -/// assert_eq!(Some((" ", "5")), fields.next()); -/// assert_eq!(None, fields.next()); -/// ``` -/// -/// Delimiters are included in the results; `prefix` will be empty only for -/// the first field of the line (including the case where the input line is -/// empty): -/// -/// ``` -/// let mut fields = uu_numfmt::WhitespaceSplitter { s: Some("first second") }; -/// -/// assert_eq!(Some(("", "first")), fields.next()); -/// assert_eq!(Some((" ", "second")), fields.next()); -/// -/// let mut fields = uu_numfmt::WhitespaceSplitter { s: Some("") }; -/// -/// assert_eq!(Some(("", "")), fields.next()); -/// ``` -pub struct WhitespaceSplitter<'a> { - pub s: Option<&'a str>, -} - -impl<'a> Iterator for WhitespaceSplitter<'a> { - type Item = (&'a str, &'a str); - - /// Yield the next field in the input string as a tuple `(prefix, field)`. - fn next(&mut self) -> Option { - let haystack = self.s?; - - let (prefix, field) = haystack.split_at( - haystack - .find(|c: char| !c.is_whitespace()) - .unwrap_or_else(|| haystack.len()), - ); - - let (field, rest) = field.split_at( - field - .find(|c: char| c.is_whitespace()) - .unwrap_or_else(|| field.len()), - ); - - self.s = if !rest.is_empty() { Some(rest) } else { None }; - - Some((prefix, field)) - } -} - -fn remove_suffix(i: f64, s: Option, u: &Unit) -> Result { - match (s, u) { - (None, _) => Ok(i), - (Some((raw_suffix, false)), &Unit::Auto) | (Some((raw_suffix, false)), &Unit::Si) => { - match raw_suffix { - RawSuffix::K => Ok(i * 1e3), - RawSuffix::M => Ok(i * 1e6), - RawSuffix::G => Ok(i * 1e9), - RawSuffix::T => Ok(i * 1e12), - RawSuffix::P => Ok(i * 1e15), - RawSuffix::E => Ok(i * 1e18), - RawSuffix::Z => Ok(i * 1e21), - RawSuffix::Y => Ok(i * 1e24), - } - } - (Some((raw_suffix, false)), &Unit::Iec(false)) - | (Some((raw_suffix, true)), &Unit::Auto) - | (Some((raw_suffix, true)), &Unit::Iec(true)) => match raw_suffix { - RawSuffix::K => Ok(i * IEC_BASES[1]), - RawSuffix::M => Ok(i * IEC_BASES[2]), - RawSuffix::G => Ok(i * IEC_BASES[3]), - RawSuffix::T => Ok(i * IEC_BASES[4]), - RawSuffix::P => Ok(i * IEC_BASES[5]), - RawSuffix::E => Ok(i * IEC_BASES[6]), - RawSuffix::Z => Ok(i * IEC_BASES[7]), - RawSuffix::Y => Ok(i * IEC_BASES[8]), - }, - (_, _) => Err("This suffix is unsupported for specified unit".to_owned()), - } -} - -fn transform_from(s: &str, opts: &Transform) -> Result { - let (i, suffix) = parse_suffix(s)?; - - remove_suffix(i, suffix, &opts.unit).map(|n| if n < 0.0 { -n.abs().ceil() } else { n.ceil() }) -} - -/// Divide numerator by denominator, with ceiling. -/// -/// If the result of the division is less than 10.0, truncate the result -/// to the next highest tenth. -/// -/// Otherwise, truncate the result to the next highest whole number. -/// -/// # Examples: -/// -/// ``` -/// use uu_numfmt::div_ceil; -/// -/// assert_eq!(div_ceil(1.01, 1.0), 1.1); -/// assert_eq!(div_ceil(999.1, 1000.), 1.0); -/// assert_eq!(div_ceil(1001., 10.), 101.); -/// assert_eq!(div_ceil(9991., 10.), 1000.); -/// assert_eq!(div_ceil(-12.34, 1.0), -13.0); -/// assert_eq!(div_ceil(1000.0, -3.14), -319.0); -/// assert_eq!(div_ceil(-271828.0, -271.0), 1004.0); -/// ``` -pub fn div_ceil(n: f64, d: f64) -> f64 { - let v = n / (d / 10.0); - let (v, sign) = if v < 0.0 { (v.abs(), -1.0) } else { (v, 1.0) }; - - if v < 100.0 { - v.ceil() / 10.0 * sign - } else { - (v / 10.0).ceil() * sign - } -} - -fn consider_suffix(n: f64, u: &Unit) -> Result<(f64, Option)> { - use RawSuffix::*; - - let abs_n = n.abs(); - let suffixes = [K, M, G, T, P, E, Z, Y]; - - let (bases, with_i) = match *u { - Unit::Si => (&SI_BASES, false), - Unit::Iec(with_i) => (&IEC_BASES, with_i), - Unit::Auto => return Err("Unit 'auto' isn't supported with --to options".to_owned()), - Unit::None => return Ok((n, None)), - }; - - let i = match abs_n { - _ if abs_n <= bases[1] - 1.0 => return Ok((n, None)), - _ if abs_n < bases[2] => 1, - _ if abs_n < bases[3] => 2, - _ if abs_n < bases[4] => 3, - _ if abs_n < bases[5] => 4, - _ if abs_n < bases[6] => 5, - _ if abs_n < bases[7] => 6, - _ if abs_n < bases[8] => 7, - _ if abs_n < bases[9] => 8, - _ => return Err("Number is too big and unsupported".to_string()), - }; - - let v = div_ceil(n, bases[i]); - - // check if rounding pushed us into the next base - if v.abs() >= bases[1] { - Ok((v / bases[1], Some((suffixes[i], with_i)))) - } else { - Ok((v, Some((suffixes[i - 1], with_i)))) - } -} - -fn transform_to(s: f64, opts: &Transform) -> Result { - let (i2, s) = consider_suffix(s, &opts.unit)?; - Ok(match s { - None => format!("{}", i2), - Some(s) if i2.abs() < 10.0 => format!("{:.1}{}", i2, DisplayableSuffix(s)), - Some(s) => format!("{:.0}{}", i2, DisplayableSuffix(s)), - }) -} - -fn format_string( - source: &str, - options: &NumfmtOptions, - implicit_padding: Option, -) -> Result { - let number = transform_to( - transform_from(source, &options.transform.from)?, - &options.transform.to, - )?; - - Ok(match implicit_padding.unwrap_or(options.padding) { - p if p == 0 => number, - p if p > 0 => format!("{:>padding$}", number, padding = p as usize), - p => format!("{: Result<()> { - for (n, (prefix, field)) in (1..).zip(WhitespaceSplitter { s: Some(s) }) { - let field_selected = uucore::ranges::contain(&options.fields, n); - - if field_selected { - let empty_prefix = prefix.is_empty(); - - // print delimiter before second and subsequent fields - let prefix = if n > 1 { - print!(" "); - &prefix[1..] - } else { - &prefix - }; - - let implicit_padding = if !empty_prefix && options.padding == 0 { - Some((prefix.len() + field.len()) as isize) - } else { - None - }; - - print!("{}", format_string(&field, options, implicit_padding)?); - } else { - // print unselected field without conversion - print!("{}{}", prefix, field); - } - } - - println!(); - - Ok(()) -} - fn parse_options(args: &ArgMatches) -> Result { let from = parse_unit(args.value_of(options::FROM).unwrap())?; let to = parse_unit(args.value_of(options::TO).unwrap())?; @@ -452,31 +136,6 @@ fn parse_options(args: &ArgMatches) -> Result { }) } -fn handle_args<'a>(args: impl Iterator, options: NumfmtOptions) -> Result<()> { - for l in args { - format_and_print(l, &options)?; - } - - Ok(()) -} - -fn handle_stdin(options: NumfmtOptions) -> Result<()> { - let stdin = std::io::stdin(); - let locked_stdin = stdin.lock(); - - let mut lines = locked_stdin.lines(); - for l in lines.by_ref().take(options.header) { - l.map(|s| println!("{}", s)).map_err(|e| e.to_string())?; - } - - for l in lines { - l.map_err(|e| e.to_string()) - .and_then(|l| format_and_print(&l, &options))?; - } - - Ok(()) -} - pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); diff --git a/src/uu/numfmt/src/options.rs b/src/uu/numfmt/src/options.rs new file mode 100644 index 000000000..ab0340d4e --- /dev/null +++ b/src/uu/numfmt/src/options.rs @@ -0,0 +1,25 @@ +use crate::units::Transform; +use uucore::ranges::Range; + +pub const FIELD: &str = "field"; +pub const FIELD_DEFAULT: &str = "1"; +pub const FROM: &str = "from"; +pub const FROM_DEFAULT: &str = "none"; +pub const HEADER: &str = "header"; +pub const HEADER_DEFAULT: &str = "1"; +pub const NUMBER: &str = "NUMBER"; +pub const PADDING: &str = "padding"; +pub const TO: &str = "to"; +pub const TO_DEFAULT: &str = "none"; + +pub struct TransformOptions { + pub from: Transform, + pub to: Transform, +} + +pub struct NumfmtOptions { + pub transform: TransformOptions, + pub padding: isize, + pub header: usize, + pub fields: Vec, +} diff --git a/src/uu/numfmt/src/units.rs b/src/uu/numfmt/src/units.rs new file mode 100644 index 000000000..5f9907bdf --- /dev/null +++ b/src/uu/numfmt/src/units.rs @@ -0,0 +1,67 @@ +use std::fmt; + +pub const SI_BASES: [f64; 10] = [1., 1e3, 1e6, 1e9, 1e12, 1e15, 1e18, 1e21, 1e24, 1e27]; + +pub const IEC_BASES: [f64; 10] = [ + 1., + 1_024., + 1_048_576., + 1_073_741_824., + 1_099_511_627_776., + 1_125_899_906_842_624., + 1_152_921_504_606_846_976., + 1_180_591_620_717_411_303_424., + 1_208_925_819_614_629_174_706_176., + 1_237_940_039_285_380_274_899_124_224., +]; + +pub type WithI = bool; + +pub enum Unit { + Auto, + Si, + Iec(WithI), + None, +} + +pub struct Transform { + pub unit: Unit, +} + +pub type Result = std::result::Result; + +#[derive(Clone, Copy, Debug)] +pub enum RawSuffix { + K, + M, + G, + T, + P, + E, + Z, + Y, +} + +pub type Suffix = (RawSuffix, WithI); + +pub struct DisplayableSuffix(pub Suffix); + +impl fmt::Display for DisplayableSuffix { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let DisplayableSuffix((ref raw_suffix, ref with_i)) = *self; + match raw_suffix { + RawSuffix::K => write!(f, "K"), + RawSuffix::M => write!(f, "M"), + RawSuffix::G => write!(f, "G"), + RawSuffix::T => write!(f, "T"), + RawSuffix::P => write!(f, "P"), + RawSuffix::E => write!(f, "E"), + RawSuffix::Z => write!(f, "Z"), + RawSuffix::Y => write!(f, "Y"), + } + .and_then(|()| match with_i { + true => write!(f, "i"), + false => Ok(()), + }) + } +} From 52f2ab68985cb6f79b63f343835b1c67ff8f030a Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Mon, 15 Mar 2021 11:20:33 -0400 Subject: [PATCH 0057/1135] numfmt: implement --delimiter closes #1454 --- src/uu/numfmt/src/format.rs | 43 +++++++++++++--- src/uu/numfmt/src/numfmt.rs | 16 ++++++ src/uu/numfmt/src/options.rs | 2 + tests/by-util/test_numfmt.rs | 95 ++++++++++++++++++++++++++++++++++++ 4 files changed, 150 insertions(+), 6 deletions(-) diff --git a/src/uu/numfmt/src/format.rs b/src/uu/numfmt/src/format.rs index e7286c44e..ebe380569 100644 --- a/src/uu/numfmt/src/format.rs +++ b/src/uu/numfmt/src/format.rs @@ -226,12 +226,31 @@ fn format_string( }) } -/// Format a line of text according to the selected options. -/// -/// Given a line of text `s`, split the line into fields, transform and format -/// any selected numeric fields, and print the result to stdout. Fields not -/// selected for conversion are passed through unmodified. -pub fn format_and_print(s: &str, options: &NumfmtOptions) -> Result<()> { +fn format_and_print_delimited(s: &str, options: &NumfmtOptions) -> Result<()> { + let delimiter = options.delimiter.as_ref().unwrap(); + + for (n, field) in (1..).zip(s.split(delimiter)) { + let field_selected = uucore::ranges::contain(&options.fields, n); + + // print delimiter before second and subsequent fields + if n > 1 { + print!("{}", delimiter); + } + + if field_selected { + print!("{}", format_string(&field.trim_start(), options, None)?); + } else { + // print unselected field without conversion + print!("{}", field); + } + } + + println!(); + + Ok(()) +} + +fn format_and_print_whitespace(s: &str, options: &NumfmtOptions) -> Result<()> { for (n, (prefix, field)) in (1..).zip(WhitespaceSplitter { s: Some(s) }) { let field_selected = uucore::ranges::contain(&options.fields, n); @@ -263,3 +282,15 @@ pub fn format_and_print(s: &str, options: &NumfmtOptions) -> Result<()> { Ok(()) } + +/// Format a line of text according to the selected options. +/// +/// Given a line of text `s`, split the line into fields, transform and format +/// any selected numeric fields, and print the result to stdout. Fields not +/// selected for conversion are passed through unmodified. +pub fn format_and_print(s: &str, options: &NumfmtOptions) -> Result<()> { + match &options.delimiter { + Some(_) => format_and_print_delimited(s, options), + None => format_and_print_whitespace(s, options), + } +} diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index e37792669..29c422a89 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -128,11 +128,20 @@ fn parse_options(args: &ArgMatches) -> Result { None => unreachable!(), }; + let delimiter = args.value_of(options::DELIMITER).map_or(Ok(None), |arg| { + if arg.len() == 1 { + Ok(Some(arg.to_string())) + } else { + Err("the delimiter must be a single character".to_string()) + } + })?; + Ok(NumfmtOptions { transform, padding, header, fields, + delimiter, }) } @@ -145,6 +154,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .usage(&usage[..]) .after_help(LONG_HELP) .setting(AppSettings::AllowNegativeNumbers) + .arg( + Arg::with_name(options::DELIMITER) + .short("d") + .long(options::DELIMITER) + .value_name("X") + .help("use X instead of whitespace for field delimiter"), + ) .arg( Arg::with_name(options::FIELD) .long(options::FIELD) diff --git a/src/uu/numfmt/src/options.rs b/src/uu/numfmt/src/options.rs index ab0340d4e..17f0a6fbe 100644 --- a/src/uu/numfmt/src/options.rs +++ b/src/uu/numfmt/src/options.rs @@ -1,6 +1,7 @@ use crate::units::Transform; use uucore::ranges::Range; +pub const DELIMITER: &str = "delimiter"; pub const FIELD: &str = "field"; pub const FIELD_DEFAULT: &str = "1"; pub const FROM: &str = "from"; @@ -22,4 +23,5 @@ pub struct NumfmtOptions { pub padding: isize, pub header: usize, pub fields: Vec, + pub delimiter: Option, } diff --git a/tests/by-util/test_numfmt.rs b/tests/by-util/test_numfmt.rs index c22db3bf5..64fc5360d 100644 --- a/tests/by-util/test_numfmt.rs +++ b/tests/by-util/test_numfmt.rs @@ -383,3 +383,98 @@ fn test_field_df_example() { .succeeds() .stdout_is_fixture("df_expected.txt"); } + +#[test] +fn test_delimiter_must_not_be_empty() { + new_ucmd!().args(&["-d"]).fails(); +} + +#[test] +fn test_delimiter_must_not_be_more_than_one_character() { + new_ucmd!() + .args(&["--delimiter", "sad"]) + .fails() + .stderr_is("numfmt: the delimiter must be a single character"); +} + +#[test] +fn test_delimiter_only() { + new_ucmd!() + .args(&["-d", ","]) + .pipe_in("1234,56") + .succeeds() + .stdout_only("1234,56\n"); +} + +#[test] +fn test_line_is_field_with_no_delimiter() { + new_ucmd!() + .args(&["-d,", "--to=iec"]) + .pipe_in("123456") + .succeeds() + .stdout_only("121K\n"); +} + +#[test] +fn test_delimiter_to_si() { + new_ucmd!() + .args(&["-d=,", "--to=si"]) + .pipe_in("1234,56") + .succeeds() + .stdout_only("1.3K,56\n"); +} + +#[test] +fn test_delimiter_skips_leading_whitespace() { + new_ucmd!() + .args(&["-d=,", "--to=si"]) + .pipe_in(" \t 1234,56") + .succeeds() + .stdout_only("1.3K,56\n"); +} + +#[test] +fn test_delimiter_preserves_leading_whitespace_in_unselected_fields() { + new_ucmd!() + .args(&["-d=|", "--to=si"]) + .pipe_in(" 1000| 2000") + .succeeds() + .stdout_only("1.0K| 2000\n"); +} + +#[test] +fn test_delimiter_from_si() { + new_ucmd!() + .args(&["-d=,", "--from=si"]) + .pipe_in("1.2K,56") + .succeeds() + .stdout_only("1200,56\n"); +} + +#[test] +fn test_delimiter_overrides_whitespace_separator() { + // GNU numfmt reports this as “invalid suffix” + new_ucmd!() + .args(&["-d,"]) + .pipe_in("1 234,56") + .fails() + .stderr_is("numfmt: invalid number: ‘1 234’\n"); +} + +#[test] +fn test_delimiter_with_padding() { + new_ucmd!() + .args(&["-d=|", "--to=si", "--padding=5"]) + .pipe_in("1000|2000") + .succeeds() + .stdout_only(" 1.0K|2000\n"); +} + +#[test] +fn test_delimiter_with_padding_and_fields() { + new_ucmd!() + .args(&["-d=|", "--to=si", "--padding=5", "--field=-"]) + .pipe_in("1000|2000") + .succeeds() + .stdout_only(" 1.0K| 2.0K\n"); +} From 13e61c3234234a2614d172a3236bf0e691548c68 Mon Sep 17 00:00:00 2001 From: Peter Sherman Date: Mon, 15 Mar 2021 15:56:11 +0000 Subject: [PATCH 0058/1135] head: add support for -z/--zero-terminated --- src/uu/head/src/head.rs | 15 +++++++++++++-- tests/by-util/test_head.rs | 8 ++++++++ tests/fixtures/head/zero_terminated.expected | Bin 0 -> 182 bytes tests/fixtures/head/zero_terminated.txt | Bin 0 -> 7605 bytes 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 tests/fixtures/head/zero_terminated.expected create mode 100644 tests/fixtures/head/zero_terminated.txt diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 56d7e8452..9e92dd8c7 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -29,6 +29,7 @@ enum FilterMode { struct Settings { mode: FilterMode, verbose: bool, + zero_terminated: bool, } impl Default for Settings { @@ -36,6 +37,7 @@ impl Default for Settings { Settings { mode: FilterMode::Lines(10), verbose: false, + zero_terminated: false, } } } @@ -69,6 +71,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) .optflag("q", "quiet", "never print headers giving file names") .optflag("v", "verbose", "always print headers giving file names") + .optflag("z", "zero-terminated", "line delimiter is NUL, not newline") .optflag("h", "help", "display this help and exit") .optflag("V", "version", "output version information and exit") .parse(new_args); @@ -113,6 +116,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let quiet = matches.opt_present("q"); let verbose = matches.opt_present("v"); + settings.zero_terminated = matches.opt_present("z"); let files = matches.free; // GNU implementation allows multiple declarations of "-q" and "-v" with the @@ -129,6 +133,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.verbose = true; } + if files.is_empty() { let mut buffer = BufReader::new(stdin()); head(&mut buffer, &settings); @@ -203,8 +208,14 @@ fn head(reader: &mut BufReader, settings: &Settings) -> bool { } } FilterMode::Lines(count) => { - for line in reader.lines().take(count) { - println!("{}", line.unwrap()); + if settings.zero_terminated { + for line in reader.split(0).take(count) { + print!("{}\0", String::from_utf8(line.unwrap()).unwrap()) + } + } else { + for line in reader.lines().take(count) { + println!("{}", line.unwrap()); + } } } FilterMode::NLines(count) => { diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index 4324290cb..eec82b51f 100644 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -86,6 +86,14 @@ fn test_verbose() { .stdout_is_fixture("lorem_ipsum_verbose.expected"); } +#[test] +fn test_zero_terminated() { + new_ucmd!() + .args(&["-z", "zero_terminated.txt"]) + .run() + .stdout_is_fixture("zero_terminated.expected"); +} + #[test] #[ignore] fn test_spams_newline() { diff --git a/tests/fixtures/head/zero_terminated.expected b/tests/fixtures/head/zero_terminated.expected new file mode 100644 index 0000000000000000000000000000000000000000..3c4cc058c3e55c81d16ec3ab18981d16fdb67cf1 GIT binary patch literal 182 zcmdPX(`V4r)7MMSEJ-XWDauSLElDi~i6keMKq-AAQ!~Ai3OF}0rywH{Ss*VzFSR@; zGcOe`m|a|&3)T%{=qKi6Ca1<{=Eaxi=cS|;t{nTIN#p9^tVer~RQBG?=-D+xoD zeqxd#HbEn7g2vbc<5N;|GIKLaQj6lt^NUijC`rvND5=C0PlCHEDKRBJzbGZO$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U&& zlYl9PjE5JO=HeR-2T3Otr^MqK_J%0|HR`Ype8c52hQ2{ESO(fb!o`)vWrQpRtHEb0 zL;;4iC5hnnLrG#XeB>}CzMv>G7p+LfssI{#*yQ4qQq%H_P~#4y4s3LML241W8HrL- zV3CGfkO^)cmLz88=%?l9HUBc%PL zi_y43Rs(W0*!iI5Cr*osAzd`&@)y|<5W6&07q1bZ!4F-e!4F(!p{v6Tc37!U4leS_ nlkt`H<;mCvh{}`obMuob<5Mz|vk|80hlaStTf~FLiot>anuxG) literal 0 HcmV?d00001 From e3e5bf0178432234c4cc2d8d03ec7df6bee5bc64 Mon Sep 17 00:00:00 2001 From: Peter Sherman Date: Mon, 15 Mar 2021 20:48:49 +0000 Subject: [PATCH 0059/1135] Format head.rs --- src/uu/head/src/head.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 9e92dd8c7..ae5807c22 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -133,7 +133,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.verbose = true; } - if files.is_empty() { let mut buffer = BufReader::new(stdin()); head(&mut buffer, &settings); From 97f40b0aee9cf4af8724891eba058b1afbf4248d Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 17 Mar 2021 10:16:31 +0100 Subject: [PATCH 0060/1135] rm: add an additional flag -R for --recursive make clap support -R in addition to -r --- src/uu/rm/src/rm.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 4c81c97cc..190fe9794 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -48,6 +48,7 @@ static OPT_PRESERVE_ROOT: &str = "preserve-root"; static OPT_PROMPT: &str = "prompt"; static OPT_PROMPT_MORE: &str = "prompt-more"; static OPT_RECURSIVE: &str = "recursive"; +static OPT_RECURSIVE_R: &str = "recursive_R"; static OPT_VERBOSE: &str = "verbose"; static ARG_FILES: &str = "files"; @@ -58,7 +59,7 @@ fn get_usage() -> String { fn get_long_usage() -> String { String::from( - "By default, rm does not remove directories. Use the --recursive (-r) + "By default, rm does not remove directories. Use the --recursive (-r or -R) option to remove each listed directory, too, along with all of its contents To remove a file whose name starts with a '-', for example '-foo', @@ -82,7 +83,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .after_help(&long_usage[..]) - // TODO: make getopts support -R in addition to -r .arg( Arg::with_name(OPT_FORCE) @@ -128,6 +128,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_RECURSIVE) .help("remove directories and their contents recursively") ) + .arg( + Arg::with_name(OPT_RECURSIVE_R).short("R") + .help("Equivalent to -r") + ) .arg( Arg::with_name(OPT_DIR) .short("d") @@ -182,7 +186,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }, one_fs: matches.is_present(OPT_ONE_FILE_SYSTEM), preserve_root: !matches.is_present(OPT_NO_PRESERVE_ROOT), - recursive: matches.is_present(OPT_RECURSIVE), + recursive: matches.is_present(OPT_RECURSIVE) || matches.is_present(OPT_RECURSIVE_R), dir: matches.is_present(OPT_DIR), verbose: matches.is_present(OPT_VERBOSE), }; @@ -283,7 +287,7 @@ fn handle_dir(path: &Path, options: &Options) -> bool { had_err = true; } else { show_error!( - "could not remove directory '{}' (did you mean to pass '-r'?)", + "could not remove directory '{}' (did you mean to pass '-r' or '-R'?)", path.display() ); had_err = true; From 867e117c99a0b3e7e3ca3c902ab92875f4234d46 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 17 Mar 2021 10:20:08 +0100 Subject: [PATCH 0061/1135] Update test_rm.rs --- tests/by-util/test_rm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index f9a4dd0d5..27568957a 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -148,7 +148,7 @@ fn test_rm_errors() { // rm: error: could not remove directory 'test_rm_errors_directory' (did you mean to pass '-r'?) ucmd.arg(dir).fails().stderr_is( "rm: error: could not remove directory 'test_rm_errors_directory' (did you mean \ - to pass '-r'?)\n", + to pass '-r' or '-R'?)\n", ); } From fbb9c50050af8f8e0c89327150d8176193873d1e Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Tue, 16 Mar 2021 09:42:06 -0400 Subject: [PATCH 0062/1135] tr: process octal escape sequences closes #1817 --- src/uu/tr/src/expand.rs | 54 ++++++++++++++++++++++++++-------- tests/by-util/test_tr.rs | 63 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 12 deletions(-) diff --git a/src/uu/tr/src/expand.rs b/src/uu/tr/src/expand.rs index 3291d57ae..e71cf262c 100644 --- a/src/uu/tr/src/expand.rs +++ b/src/uu/tr/src/expand.rs @@ -14,17 +14,46 @@ use std::cmp::min; use std::iter::Peekable; use std::ops::RangeInclusive; +/// Parse a backslash escape sequence to the corresponding character. Assumes +/// the string starts from the character _after_ the `\` and is not empty. +/// +/// Returns a tuple containing the character and the number of characters +/// consumed from the input. The alphabetic escape sequences consume 1 +/// character; octal escape sequences consume 1 to 3 octal digits. #[inline] -fn unescape_char(c: char) -> char { - match c { - 'a' => 0x07u8 as char, - 'b' => 0x08u8 as char, - 'f' => 0x0cu8 as char, - 'v' => 0x0bu8 as char, - 'n' => '\n', - 'r' => '\r', - 't' => '\t', - _ => c, +fn parse_sequence(s: &str) -> (char, usize) { + let c = s.chars().next().expect("invalid escape: empty string"); + + if '0' <= c && c <= '7' { + let mut v = c.to_digit(8).unwrap(); + let mut consumed = 1; + let bits_per_digit = 3; + + for c in s.chars().skip(1).take(2) { + match c.to_digit(8) { + Some(c) => { + v = (v << bits_per_digit) | c; + consumed += 1; + } + None => break, + } + } + + (from_u32(v).expect("invalid octal escape"), consumed) + } else { + ( + match c { + 'a' => 0x07u8 as char, + 'b' => 0x08u8 as char, + 'f' => 0x0cu8 as char, + 'v' => 0x0bu8 as char, + 'n' => '\n', + 'r' => '\r', + 't' => '\t', + c => c, + }, + 1, + ) } } @@ -52,8 +81,9 @@ impl<'a> Iterator for Unescape<'a> { '\\' if self.string.len() > 1 => { // yes---it's \ and it's not the last char in a string // we know that \ is 1 byte long so we can index into the string safely - let c = self.string[1..].chars().next().unwrap(); - (Some(unescape_char(c)), 1 + c.len_utf8()) + let (c, consumed) = parse_sequence(&self.string[1..]); + + (Some(c), 1 + consumed) } c => (Some(c), c.len_utf8()), // not an escape char }; diff --git a/tests/by-util/test_tr.rs b/tests/by-util/test_tr.rs index b32d98d29..a1500bcf6 100644 --- a/tests/by-util/test_tr.rs +++ b/tests/by-util/test_tr.rs @@ -134,3 +134,66 @@ fn missing_required_second_arg_fails() { assert!(!result.success); assert!(result.stderr.contains("missing operand after")); } + +#[test] +fn test_interpret_backslash_escapes() { + new_ucmd!() + .args(&["abfnrtv", r"\a\b\f\n\r\t\v"]) + .pipe_in("abfnrtv") + .succeeds() + .stdout_is("\u{7}\u{8}\u{c}\n\r\t\u{b}"); +} + +#[test] +fn test_interpret_unrecognized_backslash_escape_as_character() { + new_ucmd!() + .args(&["qcz+=~-", r"\q\c\z\+\=\~\-"]) + .pipe_in("qcz+=~-") + .succeeds() + .stdout_is("qcz+=~-"); +} + +#[test] +fn test_interpret_single_octal_escape() { + new_ucmd!() + .args(&["X", r"\015"]) + .pipe_in("X") + .succeeds() + .stdout_is("\r"); +} + +#[test] +fn test_interpret_one_and_two_digit_octal_escape() { + new_ucmd!() + .args(&["XYZ", r"\0\11\77"]) + .pipe_in("XYZ") + .succeeds() + .stdout_is("\0\t?"); +} + +#[test] +fn test_octal_escape_is_at_most_three_digits() { + new_ucmd!() + .args(&["XY", r"\0156"]) + .pipe_in("XY") + .succeeds() + .stdout_is("\r6"); +} + +#[test] +fn test_non_octal_digit_ends_escape() { + new_ucmd!() + .args(&["rust", r"\08\11956"]) + .pipe_in("rust") + .succeeds() + .stdout_is("\08\t9"); +} + +#[test] +fn test_interpret_backslash_at_eol_literally() { + new_ucmd!() + .args(&["X", r"\"]) + .pipe_in("X") + .succeeds() + .stdout_is("\\"); +} From 64b8c8aac79c2a9c992667320a30ca6b39d6c9ca Mon Sep 17 00:00:00 2001 From: John Eckersberg Date: Fri, 12 Mar 2021 13:38:02 -0500 Subject: [PATCH 0063/1135] nice: move from getopts to clap #1794 --- Cargo.lock | 3 +- src/uu/nice/Cargo.toml | 3 +- src/uu/nice/src/nice.rs | 97 +++++++++++++++++--------------------- tests/by-util/test_nice.rs | 57 +++++++++++++++++++++- 4 files changed, 104 insertions(+), 56 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ebb288d3d..be021fea8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1822,8 +1822,9 @@ dependencies = [ name = "uu_nice" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", ] diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index e7d184c96..c851daa5a 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -15,8 +15,9 @@ edition = "2018" path = "src/nice.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "0.2.42" +nix = { version="<=0.13" } uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/nice/src/nice.rs b/src/uu/nice/src/nice.rs index 1f79ea09b..c1d3345af 100644 --- a/src/uu/nice/src/nice.rs +++ b/src/uu/nice/src/nice.rs @@ -15,7 +15,7 @@ use std::ffi::CString; use std::io::Error; use std::ptr; -const NAME: &str = "nice"; +use clap::{App, AppSettings, Arg}; const VERSION: &str = env!("CARGO_PKG_VERSION"); // XXX: PRIO_PROCESS is 0 on at least FreeBSD and Linux. Don't know about Mac OS X. @@ -26,64 +26,57 @@ extern "C" { fn setpriority(which: c_int, who: c_int, prio: c_int) -> c_int; } -pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); +pub mod options { + pub static ADJUSTMENT: &str = "adjustment"; + pub static COMMAND: &str = "COMMAND"; +} - let mut opts = getopts::Options::new(); - - opts.optopt( - "n", - "adjustment", - "add N to the niceness (default is 10)", - "N", - ); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(err) => { - show_error!("{}", err); - return 125; - } - }; - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - if matches.opt_present("help") { - let msg = format!( - "{0} {1} - -Usage: +fn get_usage() -> String { + format!( + " {0} [OPTIONS] [COMMAND [ARGS]] Run COMMAND with an adjusted niceness, which affects process scheduling. With no COMMAND, print the current niceness. Niceness values range from at least -20 (most favorable to the process) to 19 (least favorable to the process).", - NAME, VERSION - ); + executable!() + ) +} - print!("{}", opts.usage(&msg)); - return 0; - } +pub fn uumain(args: impl uucore::Args) -> i32 { + let usage = get_usage(); - let mut niceness = unsafe { getpriority(PRIO_PROCESS, 0) }; + let matches = App::new(executable!()) + .setting(AppSettings::TrailingVarArg) + .version(VERSION) + .usage(&usage[..]) + .arg( + Arg::with_name(options::ADJUSTMENT) + .short("n") + .long(options::ADJUSTMENT) + .help("add N to the niceness (default is 10)") + .takes_value(true) + .allow_hyphen_values(true), + ) + .arg(Arg::with_name(options::COMMAND).multiple(true)) + .get_matches_from(args); + + let mut niceness = unsafe { + nix::errno::Errno::clear(); + getpriority(PRIO_PROCESS, 0) + }; if Error::last_os_error().raw_os_error().unwrap() != 0 { - show_error!("{}", Error::last_os_error()); + show_error!("getpriority: {}", Error::last_os_error()); return 125; } - let adjustment = match matches.opt_str("adjustment") { + let adjustment = match matches.value_of(options::ADJUSTMENT) { Some(nstr) => { - if matches.free.is_empty() { + if !matches.is_present(options::COMMAND) { show_error!( - "A command must be given with an adjustment. - Try \"{} --help\" for more information.", - args[0] + "A command must be given with an adjustment.\nTry \"{} --help\" for more information.", + executable!() ); return 125; } @@ -96,7 +89,7 @@ process).", } } None => { - if matches.free.is_empty() { + if !matches.is_present(options::COMMAND) { println!("{}", niceness); return 0; } @@ -105,25 +98,23 @@ process).", }; niceness += adjustment; - unsafe { - setpriority(PRIO_PROCESS, 0, niceness); - } - if Error::last_os_error().raw_os_error().unwrap() != 0 { - show_warning!("{}", Error::last_os_error()); + if unsafe { setpriority(PRIO_PROCESS, 0, niceness) } == -1 { + show_warning!("setpriority: {}", Error::last_os_error()); } let cstrs: Vec = matches - .free - .iter() + .values_of(options::COMMAND) + .unwrap() .map(|x| CString::new(x.as_bytes()).unwrap()) .collect(); + let mut args: Vec<*const c_char> = cstrs.iter().map(|s| s.as_ptr()).collect(); args.push(ptr::null::()); unsafe { execvp(args[0], args.as_mut_ptr()); } - show_error!("{}", Error::last_os_error()); + show_error!("execvp: {}", Error::last_os_error()); if Error::last_os_error().raw_os_error().unwrap() as c_int == libc::ENOENT { 127 } else { diff --git a/tests/by-util/test_nice.rs b/tests/by-util/test_nice.rs index 651491045..e10314f57 100644 --- a/tests/by-util/test_nice.rs +++ b/tests/by-util/test_nice.rs @@ -1 +1,56 @@ -// ToDO: add tests +use crate::common::util::*; + +#[test] +fn test_get_current_niceness() { + // NOTE: this assumes the test suite is being run with a default niceness + // of 0, which may not necessarily be true + new_ucmd!().run().stdout_is("0\n"); +} + +#[test] +fn test_negative_adjustment() { + // This assumes the test suite is run as a normal (non-root) user, and as + // such attempting to set a negative niceness value will be rejected by + // the OS. If it gets denied, then we know a negative value was parsed + // correctly. + + let res = new_ucmd!().args(&["-n", "-1", "true"]).run(); + assert!(res.stderr.starts_with("nice: warning: setpriority: Permission denied")); +} + +#[test] +fn test_adjustment_with_no_command_should_error() { + new_ucmd!() + .args(&["-n", "19"]) + .run() + .stderr_is("nice: error: A command must be given with an adjustment.\nTry \"nice --help\" for more information.\n"); +} + +#[test] +fn test_command_with_no_adjustment() { + new_ucmd!().args(&["echo", "a"]).run().stdout_is("a\n"); +} + +#[test] +fn test_command_with_no_args() { + new_ucmd!() + .args(&["-n", "19", "echo"]) + .run() + .stdout_is("\n"); +} + +#[test] +fn test_command_with_args() { + new_ucmd!() + .args(&["-n", "19", "echo", "a", "b", "c"]) + .run() + .stdout_is("a b c\n"); +} + +#[test] +fn test_command_where_command_takes_n_flag() { + new_ucmd!() + .args(&["-n", "19", "echo", "-n", "a"]) + .run() + .stdout_is("a"); +} From 955fa74a42c91dea96da691a16930e93a668f988 Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 17 Mar 2021 13:58:53 +0100 Subject: [PATCH 0064/1135] factor::tests: Check that powers of known-factorization numbers are factored correctly (#1831) * factor::tests::recombines_factors: Minor refactor (skip useless bool) * factor::tests: Check factorizations of powers of factored numbers * factor::Factors: Add debug assertions to (Factor ^ Exponent) * factor::tests: Drop obsoleted tests `factor_correctly_recombines_prior_test_failures` was replaced with `factor_2044854919485649` as this was the only test not subsumed. * factor::tests::2044854919485649: Check the expected factorisation --- src/uu/factor/src/factor.rs | 56 ++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 7beb6a043..2715bad71 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -225,20 +225,19 @@ pub fn factor(num: u64) -> Factors { #[cfg(test)] mod tests { - use super::{factor, Factors}; + use super::{factor, Decomposition, Exponent, Factors}; use quickcheck::quickcheck; + use smallvec::smallvec; + use std::cell::RefCell; #[test] - fn factor_correctly_recombines_prior_test_failures() { - let prior_failures = [ - // * integers with duplicate factors (ie, N.pow(M)) - 4566769_u64, // == 2137.pow(2) - 2044854919485649_u64, - 18446739546814299361_u64, - 18446738440860217487_u64, - 18446736729316206481_u64, - ]; - assert!(prior_failures.iter().all(|i| factor(*i).product() == *i)); + fn factor_2044854919485649() { + let f = Factors(RefCell::new(Decomposition(smallvec![ + (503, 1), + (2423, 1), + (40961, 2) + ]))); + assert_eq!(factor(f.product()), f); } #[test] @@ -248,15 +247,6 @@ mod tests { .all(|i| factor(i).product() == i)); } - #[test] - fn factor_recombines_small_squares() { - // factor(18446736729316206481) == 4294966441 ** 2 ; causes debug_assert fault for repeated decomposition factor in add() - // ToDO: explain/combine with factor_18446736729316206481 and factor_18446739546814299361 tests - assert!((1..10_000) - .map(|i| (2 * i + 1) * (2 * i + 1)) - .all(|i| factor(i).product() == i)); - } - #[test] fn factor_recombines_overflowing() { assert!((0..250) @@ -282,9 +272,15 @@ mod tests { i == 0 || factor(i).product() == i } - fn recombines_factors(f: Factors) -> bool { + fn recombines_factors(f: Factors) -> () { assert_eq!(factor(f.product()), f); - true + } + + fn exponentiate_factors(f: Factors, e: Exponent) -> () { + if e == 0 { return; } + if let Some(fe) = f.product().checked_pow(e.into()) { + assert_eq!(factor(fe), f ^ e); + } } } } @@ -319,3 +315,19 @@ impl quickcheck::Arbitrary for Factors { } } } + +#[cfg(test)] +impl std::ops::BitXor for Factors { + type Output = Self; + + fn bitxor(self, rhs: Exponent) -> Factors { + debug_assert_ne!(rhs, 0); + let mut r = Factors::one(); + for (p, e) in self.0.borrow().0.iter() { + r.add(*p, rhs * e); + } + + debug_assert_eq!(r.product(), self.product().pow(rhs.into())); + return r; + } +} From d9adec34967f4e641937fcbedeb0aab4784aa287 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 17 Mar 2021 14:46:25 +0100 Subject: [PATCH 0065/1135] add comment --- src/uu/rm/src/rm.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 190fe9794..466a8d6c1 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -129,6 +129,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("remove directories and their contents recursively") ) .arg( + // To mimic GNU's behavior we also want the '-R' flag. However, using clap's + // alias method 'visible_alias("R")' would result in a long '--R' flag. Arg::with_name(OPT_RECURSIVE_R).short("R") .help("Equivalent to -r") ) From c5792a4c477fdf80b3932935e452615b225832e1 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 17 Mar 2021 23:15:03 +0100 Subject: [PATCH 0066/1135] tests/ls: add tests for colors --- tests/by-util/test_ls.rs | 51 ++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index fea912695..52678b2fa 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -374,19 +374,56 @@ fn test_ls_recursive() { assert!(result.stdout.contains("a\\b:\nb")); } +#[cfg(unix)] #[test] fn test_ls_ls_color() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.mkdir("a"); + at.mkdir("a/nested_dir"); at.mkdir("z"); - at.touch(&at.plus_as_string("a/a")); - scene.ucmd().arg("--color").succeeds(); - scene.ucmd().arg("--color=always").succeeds(); - scene.ucmd().arg("--color=never").succeeds(); - scene.ucmd().arg("--color").arg("a").succeeds(); - scene.ucmd().arg("--color=always").arg("a/a").succeeds(); - scene.ucmd().arg("--color=never").arg("z").succeeds(); + at.touch(&at.plus_as_string("a/nested_file")); + at.touch("test-color"); + + let a_with_colors = "\x1b[01;34ma\x1b[0m"; + let z_with_colors = "\x1b[01;34mz\x1b[0m"; + let nested_dir_with_colors = "\x1b[01;34mnested_dir\x1b[0m"; + + // Color is disabled by default + let result = scene.ucmd().succeeds(); + assert!(!result.stdout.contains(a_with_colors)); + assert!(!result.stdout.contains(z_with_colors)); + + // Color should be enabled + let result = scene.ucmd().arg("--color").succeeds(); + assert!(result.stdout.contains(a_with_colors)); + assert!(result.stdout.contains(z_with_colors)); + + // Color should be enabled + let result = scene.ucmd().arg("--color=always").succeeds(); + assert!(result.stdout.contains(a_with_colors)); + assert!(result.stdout.contains(z_with_colors)); + + // Color should be disabled + let result = scene.ucmd().arg("--color=never").succeeds(); + assert!(!result.stdout.contains(a_with_colors)); + assert!(!result.stdout.contains(z_with_colors)); + + // Nested dir should be shown and colored + let result = scene.ucmd().arg("--color").arg("a").succeeds(); + assert!(result.stdout.contains(nested_dir_with_colors)); + + // Color has no effect + let result = scene + .ucmd() + .arg("--color=always") + .arg("a/nested_file") + .succeeds(); + assert!(result.stdout.contains("a/nested_file\n")); + + // No output + let result = scene.ucmd().arg("--color=never").arg("z").succeeds(); + assert_eq!(result.stdout, ""); } #[cfg(not(any(target_os = "macos", target_os = "windows")))] // Truncate not available on mac or win From e5b577fb27c33c8c539dfbaf3b050e71e47fb7e2 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 18 Mar 2021 10:13:29 +0100 Subject: [PATCH 0067/1135] Update cargo.lock --- Cargo.lock | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9dcc23ff2..78aef58bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -193,7 +193,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -404,7 +404,7 @@ dependencies = [ "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", @@ -517,7 +517,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1035,7 +1035,7 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.4" +version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1471,7 +1471,7 @@ version = "0.0.4" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1557,7 +1557,7 @@ dependencies = [ name = "uu_expand" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1634,7 +1634,7 @@ dependencies = [ "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1838,7 +1838,7 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1939,7 +1939,7 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -2598,7 +2598,7 @@ dependencies = [ "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" "checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" -"checksum regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "54fd1046a3107eb58f42de31d656fee6853e5d276c455fd943742dce89fc3dd3" +"checksum regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" "checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" From 1d271991af968e0884bfef4e91f9b8d3753915b0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 18 Mar 2021 10:24:30 +0100 Subject: [PATCH 0068/1135] Rustfmt new tests --- tests/by-util/test_cat.rs | 22 +++++++++++----------- tests/by-util/test_nice.rs | 4 +++- tests/by-util/test_nl.rs | 16 ++++++++-------- tests/by-util/test_rm.rs | 2 +- tests/by-util/test_rmdir.rs | 8 ++++---- tests/by-util/test_unlink.rs | 6 +++--- tests/by-util/test_wc.rs | 2 +- 7 files changed, 31 insertions(+), 29 deletions(-) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index a3e321139..b194eb9b0 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -10,16 +10,16 @@ fn test_output_multi_files_print_all_chars() { .succeeds() .stdout_only( " 1\tabcde$\n 2\tfghij$\n 3\tklmno$\n 4\tpqrst$\n \ - 5\tuvwxyz$\n 6\t^@^A^B^C^D^E^F^G^H^I$\n \ - 7\t^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^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 + M-VM-WM-XM-YM-ZM-[M-\\M-]M-^M-_M-`M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-\ + pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-zM-{M-|M-}M-~M-^?", ); } @@ -30,7 +30,7 @@ fn test_numbered_lines_no_trailing_newline() { .succeeds() .stdout_only( " 1\ttext without a trailing newlineabcde\n 2\tfghij\n \ - 3\tklmno\n 4\tpqrst\n 5\tuvwxyz\n", + 3\tklmno\n 4\tpqrst\n 5\tuvwxyz\n", ); } diff --git a/tests/by-util/test_nice.rs b/tests/by-util/test_nice.rs index e10314f57..7e704fc00 100644 --- a/tests/by-util/test_nice.rs +++ b/tests/by-util/test_nice.rs @@ -15,7 +15,9 @@ fn test_negative_adjustment() { // correctly. let res = new_ucmd!().args(&["-n", "-1", "true"]).run(); - assert!(res.stderr.starts_with("nice: warning: setpriority: Permission denied")); + assert!(res + .stderr + .starts_with("nice: warning: setpriority: Permission denied")); } #[test] diff --git a/tests/by-util/test_nl.rs b/tests/by-util/test_nl.rs index fca73c37b..3ca039d19 100644 --- a/tests/by-util/test_nl.rs +++ b/tests/by-util/test_nl.rs @@ -23,8 +23,8 @@ fn test_padding_without_overflow() { .run() .stdout_is( "000001xL1\n001001xL2\n002001xL3\n003001xL4\n004001xL5\n005001xL6\n006001xL7\n0070\ - 01xL8\n008001xL9\n009001xL10\n010001xL11\n011001xL12\n012001xL13\n013001xL14\n014\ - 001xL15\n", + 01xL8\n008001xL9\n009001xL10\n010001xL11\n011001xL12\n012001xL13\n013001xL14\n014\ + 001xL15\n", ); } @@ -35,7 +35,7 @@ fn test_padding_with_overflow() { .run() .stdout_is( "0001xL1\n1001xL2\n2001xL3\n3001xL4\n4001xL5\n5001xL6\n6001xL7\n7001xL8\n8001xL9\n\ - 9001xL10\n10001xL11\n11001xL12\n12001xL13\n13001xL14\n14001xL15\n", + 9001xL10\n10001xL11\n11001xL12\n12001xL13\n13001xL14\n14001xL15\n", ); } @@ -45,15 +45,15 @@ fn test_sections_and_styles() { ( "section.txt", "\nHEADER1\nHEADER2\n\n1 |BODY1\n2 \ - |BODY2\n\nFOOTER1\nFOOTER2\n\nNEXTHEADER1\nNEXTHEADER2\n\n1 \ - |NEXTBODY1\n2 |NEXTBODY2\n\nNEXTFOOTER1\nNEXTFOOTER2\n", + |BODY2\n\nFOOTER1\nFOOTER2\n\nNEXTHEADER1\nNEXTHEADER2\n\n1 \ + |NEXTBODY1\n2 |NEXTBODY2\n\nNEXTFOOTER1\nNEXTFOOTER2\n", ), ( "joinblanklines.txt", "1 |Nonempty\n2 |Nonempty\n3 |Followed by 10x empty\n\n\n\n\n4 \ - |\n\n\n\n\n5 |\n6 |Followed by 5x empty\n\n\n\n\n7 |\n8 \ - |Followed by 4x empty\n\n\n\n\n9 |Nonempty\n10 |Nonempty\n11 \ - |Nonempty.\n", + |\n\n\n\n\n5 |\n6 |Followed by 5x empty\n\n\n\n\n7 |\n8 \ + |Followed by 4x empty\n\n\n\n\n9 |Nonempty\n10 |Nonempty\n11 \ + |Nonempty.\n", ), ] { new_ucmd!() diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 27568957a..c3635d202 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -148,7 +148,7 @@ fn test_rm_errors() { // rm: error: could not remove directory 'test_rm_errors_directory' (did you mean to pass '-r'?) ucmd.arg(dir).fails().stderr_is( "rm: error: could not remove directory 'test_rm_errors_directory' (did you mean \ - to pass '-r' or '-R'?)\n", + to pass '-r' or '-R'?)\n", ); } diff --git a/tests/by-util/test_rmdir.rs b/tests/by-util/test_rmdir.rs index 5f87b5af6..34531cf22 100644 --- a/tests/by-util/test_rmdir.rs +++ b/tests/by-util/test_rmdir.rs @@ -40,7 +40,7 @@ fn test_rmdir_nonempty_directory_no_parents() { ucmd.arg(dir).fails().stderr_is( "rmdir: error: failed to remove 'test_rmdir_nonempty_no_parents': Directory not \ - empty\n", + empty\n", ); assert!(at.dir_exists(dir)); @@ -60,9 +60,9 @@ fn test_rmdir_nonempty_directory_with_parents() { ucmd.arg("-p").arg(dir).fails().stderr_is( "rmdir: error: failed to remove 'test_rmdir_nonempty/with/parents': Directory not \ - empty\nrmdir: error: failed to remove 'test_rmdir_nonempty/with': Directory not \ - empty\nrmdir: error: failed to remove 'test_rmdir_nonempty': Directory not \ - empty\n", + empty\nrmdir: error: failed to remove 'test_rmdir_nonempty/with': Directory not \ + empty\nrmdir: error: failed to remove 'test_rmdir_nonempty': Directory not \ + empty\n", ); assert!(at.dir_exists(dir)); diff --git a/tests/by-util/test_unlink.rs b/tests/by-util/test_unlink.rs index daac6d3b3..fa8f962c4 100644 --- a/tests/by-util/test_unlink.rs +++ b/tests/by-util/test_unlink.rs @@ -23,7 +23,7 @@ fn test_unlink_multiple_files() { ucmd.arg(file_a).arg(file_b).fails().stderr_is( "unlink: error: extra operand: 'test_unlink_multiple_file_b'\nTry 'unlink --help' \ - for more information.\n", + for more information.\n", ); } @@ -36,7 +36,7 @@ fn test_unlink_directory() { ucmd.arg(dir).fails().stderr_is( "unlink: error: cannot unlink 'test_unlink_empty_directory': Not a regular file \ - or symlink\n", + or symlink\n", ); } @@ -46,6 +46,6 @@ fn test_unlink_nonexistent() { new_ucmd!().arg(file).fails().stderr_is( "unlink: error: Cannot stat 'test_unlink_nonexistent': No such file or directory \ - (os error 2)\n", + (os error 2)\n", ); } diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index fc9c00ecc..b064d7e0e 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -81,6 +81,6 @@ fn test_multiple_default() { .run() .stdout_is( " 13 109 772 lorem_ipsum.txt\n 18 204 1115 moby_dick.txt\n 5 57 302 \ - alice_in_wonderland.txt\n 36 370 2189 total\n", + alice_in_wonderland.txt\n 36 370 2189 total\n", ); } From ed7e24c5b03fad4c020af2f67e7f7cba9d9da29e Mon Sep 17 00:00:00 2001 From: aspen Date: Wed, 17 Mar 2021 21:29:32 -0400 Subject: [PATCH 0069/1135] uu_more: update nix to 0.13 --- Cargo.lock | 40 +++++++++++----------------------------- src/uu/more/Cargo.toml | 6 +++--- src/uu/more/src/more.rs | 22 +++++++++++----------- 3 files changed, 25 insertions(+), 43 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9dcc23ff2..9d9fb6c24 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -59,11 +59,6 @@ name = "bit-vec" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "bitflags" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "bitflags" version = "1.2.1" @@ -193,7 +188,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -404,7 +399,7 @@ dependencies = [ "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", @@ -517,7 +512,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -726,17 +721,6 @@ dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "nix" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "nix" version = "0.13.1" @@ -1035,7 +1019,7 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.4" +version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1471,7 +1455,7 @@ version = "0.0.4" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1557,7 +1541,7 @@ dependencies = [ name = "uu_expand" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1634,7 +1618,7 @@ dependencies = [ "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1802,7 +1786,7 @@ name = "uu_more" version = "0.0.4" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", @@ -1838,7 +1822,7 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1939,7 +1923,7 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -2490,7 +2474,6 @@ dependencies = [ "checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" "checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" "checksum bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" -"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" "checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" @@ -2561,7 +2544,6 @@ dependencies = [ "checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" "checksum memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" "checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" -"checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" "checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" "checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" "checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" @@ -2598,7 +2580,7 @@ dependencies = [ "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" "checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" -"checksum regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "54fd1046a3107eb58f42de31d656fee6853e5d276c455fd943742dce89fc3dd3" +"checksum regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" "checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index 3c1746bd4..acd9378b2 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -16,15 +16,15 @@ path = "src/more.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +uucore = { version = ">=0.0.7", package = "uucore", path = "../../uucore" } +uucore_procs = { version = ">=0.0.5", package = "uucore_procs", path = "../../uucore_procs" } [target.'cfg(target_os = "redox")'.dependencies] redox_termios = "0.1" redox_syscall = "0.1" [target.'cfg(all(unix, not(target_os = "fuchsia")))'.dependencies] -nix = "0.8.1" +nix = "<=0.13" [[bin]] name = "more" diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index de4e10187..524b0fbc4 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -17,7 +17,7 @@ use std::io::{stdout, Read, Write}; #[cfg(all(unix, not(target_os = "fuchsia")))] extern crate nix; #[cfg(all(unix, not(target_os = "fuchsia")))] -use nix::sys::termios; +use nix::sys::termios::{self, LocalFlags, SetArg}; #[cfg(target_os = "redox")] extern crate redox_termios; @@ -92,10 +92,10 @@ fn help(usage: &str) { fn setup_term() -> termios::Termios { let mut term = termios::tcgetattr(0).unwrap(); // Unset canonical mode, so we get characters immediately - term.c_lflag.remove(termios::ICANON); + term.local_flags.remove(LocalFlags::ICANON); // Disable local echo - term.c_lflag.remove(termios::ECHO); - termios::tcsetattr(0, termios::TCSADRAIN, &term).unwrap(); + term.local_flags.remove(LocalFlags::ECHO); + termios::tcsetattr(0, SetArg::TCSADRAIN, &term).unwrap(); term } @@ -110,8 +110,8 @@ fn setup_term() -> redox_termios::Termios { let mut term = redox_termios::Termios::default(); let fd = syscall::dup(0, b"termios").unwrap(); syscall::read(fd, &mut term).unwrap(); - term.c_lflag &= !redox_termios::ICANON; - term.c_lflag &= !redox_termios::ECHO; + term.local_flags &= !redox_termios::ICANON; + term.local_flags &= !redox_termios::ECHO; syscall::write(fd, &term).unwrap(); let _ = syscall::close(fd); term @@ -119,9 +119,9 @@ fn setup_term() -> redox_termios::Termios { #[cfg(all(unix, not(target_os = "fuchsia")))] fn reset_term(term: &mut termios::Termios) { - term.c_lflag.insert(termios::ICANON); - term.c_lflag.insert(termios::ECHO); - termios::tcsetattr(0, termios::TCSADRAIN, &term).unwrap(); + term.local_flags.insert(LocalFlags::ICANON); + term.local_flags.insert(LocalFlags::ECHO); + termios::tcsetattr(0, SetArg::TCSADRAIN, &term).unwrap(); } #[cfg(any(windows, target_os = "fuchsia"))] @@ -132,8 +132,8 @@ fn reset_term(_: &mut usize) {} fn reset_term(term: &mut redox_termios::Termios) { let fd = syscall::dup(0, b"termios").unwrap(); syscall::read(fd, term).unwrap(); - term.c_lflag |= redox_termios::ICANON; - term.c_lflag |= redox_termios::ECHO; + term.local_flags |= redox_termios::ICANON; + term.local_flags |= redox_termios::ECHO; syscall::write(fd, &term).unwrap(); let _ = syscall::close(fd); } From 4e29b693f89907cc7cf401565dcd6d355a34bf55 Mon Sep 17 00:00:00 2001 From: aspen Date: Wed, 17 Mar 2021 21:32:34 -0400 Subject: [PATCH 0070/1135] uutils: change every `target_os = "macos"` to `target_vendor = "apple"` --- Cargo.lock | 20 ++++++++++---------- src/uu/chroot/src/chroot.rs | 2 +- src/uu/df/src/df.rs | 22 +++++++++++----------- src/uu/id/src/id.rs | 2 +- src/uu/nohup/src/nohup.rs | 2 +- src/uu/nproc/src/nproc.rs | 6 +++--- src/uu/stat/src/fsext.rs | 20 ++++++++++---------- src/uu/stdbuf/build.rs | 4 ++-- src/uu/stdbuf/src/stdbuf.rs | 4 ++-- src/uu/uname/src/uname.rs | 2 +- src/uu/who/src/who.rs | 14 ++------------ src/uucore/src/lib/features/entries.rs | 8 ++++---- src/uucore/src/lib/features/signals.rs | 2 +- src/uucore/src/lib/features/utmpx.rs | 4 ++-- tests/by-util/test_chgrp.rs | 2 +- tests/by-util/test_du.rs | 20 ++++++++++---------- tests/by-util/test_hostname.rs | 2 +- tests/by-util/test_ls.rs | 2 +- 18 files changed, 64 insertions(+), 74 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9dcc23ff2..78aef58bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -193,7 +193,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -404,7 +404,7 @@ dependencies = [ "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", @@ -517,7 +517,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1035,7 +1035,7 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.4" +version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1471,7 +1471,7 @@ version = "0.0.4" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1557,7 +1557,7 @@ dependencies = [ name = "uu_expand" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1634,7 +1634,7 @@ dependencies = [ "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1838,7 +1838,7 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1939,7 +1939,7 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -2598,7 +2598,7 @@ dependencies = [ "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" "checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" -"checksum regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "54fd1046a3107eb58f42de31d656fee6853e5d276c455fd943742dce89fc3dd3" +"checksum regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" "checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" diff --git a/src/uu/chroot/src/chroot.rs b/src/uu/chroot/src/chroot.rs index 773207363..ab654abf8 100644 --- a/src/uu/chroot/src/chroot.rs +++ b/src/uu/chroot/src/chroot.rs @@ -164,7 +164,7 @@ fn set_main_group(group: &str) { } } -#[cfg(any(target_os = "macos", target_os = "freebsd"))] +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] fn set_groups(groups: Vec) -> libc::c_int { unsafe { setgroups(groups.len() as libc::c_int, groups.as_ptr()) } } diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index ed2865728..57caf7970 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -32,15 +32,15 @@ use std::ffi::CString; #[cfg(unix)] use std::mem; -#[cfg(any(target_os = "macos", target_os = "freebsd"))] +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] use libc::c_int; -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] use libc::statfs; -#[cfg(any(target_os = "macos", target_os = "freebsd"))] +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] use std::ffi::CStr; -#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "windows"))] +#[cfg(any(target_vendor = "apple", target_os = "freebsd", target_os = "windows"))] use std::ptr; -#[cfg(any(target_os = "macos", target_os = "freebsd"))] +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] use std::slice; #[cfg(target_os = "freebsd")] @@ -137,7 +137,7 @@ struct MountInfo { #[cfg(all( target_os = "freebsd", - not(all(target_os = "macos", target_arch = "x86_64")) + not(all(target_vendor = "apple", target_arch = "x86_64")) ))] #[repr(C)] #[derive(Copy, Clone)] @@ -209,20 +209,20 @@ fn get_usage() -> String { format!("{0} [OPTION]... [FILE]...", executable!()) } -#[cfg(any(target_os = "freebsd", target_os = "macos"))] +#[cfg(any(target_os = "freebsd", target_vendor = "apple"))] extern "C" { - #[cfg(all(target_os = "macos", target_arch = "x86_64"))] + #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))] #[link_name = "getmntinfo$INODE64"] fn getmntinfo(mntbufp: *mut *mut statfs, flags: c_int) -> c_int; #[cfg(any( all(target_os = "freebsd"), - all(target_os = "macos", target_arch = "aarch64") + all(target_vendor = "apple", target_arch = "aarch64") ))] fn getmntinfo(mntbufp: *mut *mut statfs, flags: c_int) -> c_int; } -#[cfg(any(target_os = "freebsd", target_os = "macos"))] +#[cfg(any(target_os = "freebsd", target_vendor = "apple"))] impl From for MountInfo { fn from(statfs: statfs) -> Self { let mut info = MountInfo { @@ -585,7 +585,7 @@ fn read_fs_list() -> Vec { }) .collect::>() } - #[cfg(any(target_os = "freebsd", target_os = "macos"))] + #[cfg(any(target_os = "freebsd", target_vendor = "apple"))] { let mut mptr: *mut statfs = ptr::null_mut(); let len = unsafe { getmntinfo(&mut mptr, 1 as c_int) }; diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index f07a850fa..4536622c7 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -291,7 +291,7 @@ fn pretty(possible_pw: Option) { } } -#[cfg(any(target_os = "macos", target_os = "freebsd"))] +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] fn pline(possible_uid: Option) { let uid = possible_uid.unwrap_or_else(getuid); let pw = Passwd::locate(uid).unwrap(); diff --git a/src/uu/nohup/src/nohup.rs b/src/uu/nohup/src/nohup.rs index 67e281e38..5fce208da 100644 --- a/src/uu/nohup/src/nohup.rs +++ b/src/uu/nohup/src/nohup.rs @@ -23,7 +23,7 @@ use uucore::fs::{is_stderr_interactive, is_stdin_interactive, is_stdout_interact static NAME: &str = "nohup"; static VERSION: &str = env!("CARGO_PKG_VERSION"); -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] extern "C" { fn _vprocmgr_detach_from_console(flags: u32) -> *const libc::c_int; } diff --git a/src/uu/nproc/src/nproc.rs b/src/uu/nproc/src/nproc.rs index 4eb538618..285cf764f 100644 --- a/src/uu/nproc/src/nproc.rs +++ b/src/uu/nproc/src/nproc.rs @@ -15,7 +15,7 @@ use std::env; #[cfg(target_os = "linux")] pub const _SC_NPROCESSORS_CONF: libc::c_int = 83; -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] pub const _SC_NPROCESSORS_CONF: libc::c_int = libc::_SC_NPROCESSORS_CONF; #[cfg(target_os = "freebsd")] pub const _SC_NPROCESSORS_CONF: libc::c_int = 57; @@ -89,7 +89,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { #[cfg(any( target_os = "linux", - target_os = "macos", + target_vendor = "apple", target_os = "freebsd", target_os = "netbsd" ))] @@ -109,7 +109,7 @@ fn num_cpus_all() -> usize { // Other platforms (e.g., windows), num_cpus::get() directly. #[cfg(not(any( target_os = "linux", - target_os = "macos", + target_vendor = "apple", target_os = "freebsd", target_os = "netbsd" )))] diff --git a/src/uu/stat/src/fsext.rs b/src/uu/stat/src/fsext.rs index 11c8f8095..d90099892 100644 --- a/src/uu/stat/src/fsext.rs +++ b/src/uu/stat/src/fsext.rs @@ -149,7 +149,7 @@ use std::path::Path; #[cfg(any( target_os = "linux", - target_os = "macos", + target_vendor = "apple", target_os = "android", target_os = "freebsd" ))] @@ -165,7 +165,7 @@ use uucore::libc::statvfs as Sstatfs; #[cfg(any( target_os = "linux", - target_os = "macos", + target_vendor = "apple", target_os = "android", target_os = "freebsd" ))] @@ -211,11 +211,11 @@ impl FsMeta for Sstatfs { fn free_fnodes(&self) -> u64 { self.f_ffree as u64 } - #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))] + #[cfg(any(target_os = "linux", target_vendor = "apple", target_os = "freebsd"))] fn fs_type(&self) -> i64 { self.f_type as i64 } - #[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "freebsd")))] + #[cfg(not(any(target_os = "linux", target_vendor = "apple", target_os = "freebsd")))] fn fs_type(&self) -> i64 { // FIXME: statvfs doesn't have an equivalent, so we need to do something else unimplemented!() @@ -225,12 +225,12 @@ impl FsMeta for Sstatfs { fn iosize(&self) -> u64 { self.f_frsize as u64 } - #[cfg(any(target_os = "macos", target_os = "freebsd"))] + #[cfg(any(target_vendor = "apple", target_os = "freebsd"))] fn iosize(&self) -> u64 { self.f_iosize as u64 } // XXX: dunno if this is right - #[cfg(not(any(target_os = "macos", target_os = "freebsd", target_os = "linux")))] + #[cfg(not(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux")))] fn iosize(&self) -> u64 { self.f_bsize as u64 } @@ -241,13 +241,13 @@ impl FsMeta for Sstatfs { // // Solaris, Irix and POSIX have a system call statvfs(2) that returns a // struct statvfs, containing an unsigned long f_fsid - #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "linux"))] + #[cfg(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux"))] fn fsid(&self) -> u64 { let f_fsid: &[u32; 2] = unsafe { &*(&self.f_fsid as *const uucore::libc::fsid_t as *const [u32; 2]) }; (u64::from(f_fsid[0])) << 32 | u64::from(f_fsid[1]) } - #[cfg(not(any(target_os = "macos", target_os = "freebsd", target_os = "linux")))] + #[cfg(not(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux")))] fn fsid(&self) -> u64 { self.f_fsid as u64 } @@ -256,7 +256,7 @@ impl FsMeta for Sstatfs { fn namelen(&self) -> u64 { self.f_namelen as u64 } - #[cfg(target_os = "macos")] + #[cfg(target_vendor = "apple")] fn namelen(&self) -> u64 { 1024 } @@ -265,7 +265,7 @@ impl FsMeta for Sstatfs { self.f_namemax as u64 } // XXX: should everything just use statvfs? - #[cfg(not(any(target_os = "macos", target_os = "freebsd", target_os = "linux")))] + #[cfg(not(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux")))] fn namelen(&self) -> u64 { self.f_namemax as u64 } diff --git a/src/uu/stdbuf/build.rs b/src/uu/stdbuf/build.rs index c005072d9..b14d503cf 100644 --- a/src/uu/stdbuf/build.rs +++ b/src/uu/stdbuf/build.rs @@ -4,12 +4,12 @@ use std::env; use std::fs; use std::path::Path; -#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "windows")))] +#[cfg(not(any(target_vendor = "apple", target_os = "windows")))] mod platform { pub const DYLIB_EXT: &str = ".so"; } -#[cfg(any(target_os = "macos", target_os = "ios"))] +#[cfg(any(target_vendor = "apple"))] mod platform { pub const DYLIB_EXT: &str = ".dylib"; } diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 86523144c..67ed9a838 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -57,7 +57,7 @@ fn preload_strings() -> (&'static str, &'static str) { ("LD_PRELOAD", "so") } -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] fn preload_strings() -> (&'static str, &'static str) { ("DYLD_LIBRARY_PATH", "dylib") } @@ -67,7 +67,7 @@ fn preload_strings() -> (&'static str, &'static str) { target_os = "freebsd", target_os = "netbsd", target_os = "dragonflybsd", - target_os = "macos" + target_vendor = "apple" )))] fn preload_strings() -> (&'static str, &'static str) { crash!(1, "Command not supported for this operating system!") diff --git a/src/uu/uname/src/uname.rs b/src/uu/uname/src/uname.rs index 6575aa9fd..4586a084f 100644 --- a/src/uu/uname/src/uname.rs +++ b/src/uu/uname/src/uname.rs @@ -39,7 +39,7 @@ const HOST_OS: &str = "Windows NT"; const HOST_OS: &str = "FreeBSD"; #[cfg(target_os = "openbsd")] const HOST_OS: &str = "OpenBSD"; -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] const HOST_OS: &str = "Darwin"; #[cfg(target_os = "fuchsia")] const HOST_OS: &str = "Fuchsia"; diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index b028be0a0..8c7ff3211 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -60,12 +60,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { "count", "all login names and number of users logged on", ); - #[cfg(any( - target_os = "macos", - target_os = "ios", - target_os = "linux", - target_os = "android" - ))] + #[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))] opts.optflag("r", "runlevel", "print current runlevel"); opts.optflag("s", "short", "print only name, line, and time (default)"); opts.optflag("t", "time", "print last system clock change"); @@ -305,12 +300,7 @@ impl Who { #[allow(unused_assignments)] let mut res = false; - #[cfg(any( - target_os = "macos", - target_os = "ios", - target_os = "linux", - target_os = "android" - ))] + #[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))] { res = record == utmpx::RUN_LVL; } diff --git a/src/uucore/src/lib/features/entries.rs b/src/uucore/src/lib/features/entries.rs index a921af2d0..d2dce2461 100644 --- a/src/uucore/src/lib/features/entries.rs +++ b/src/uucore/src/lib/features/entries.rs @@ -34,7 +34,7 @@ //! assert!(entries::Group::locate(root_group).is_ok()); //! ``` -#[cfg(any(target_os = "freebsd", target_os = "macos"))] +#[cfg(any(target_os = "freebsd", target_vendor = "apple"))] use libc::time_t; use libc::{c_char, c_int, gid_t, uid_t}; use libc::{getgrgid, getgrnam, getgroups, getpwnam, getpwuid, group, passwd}; @@ -119,19 +119,19 @@ impl Passwd { } /// AKA passwd.pw_class - #[cfg(any(target_os = "freebsd", target_os = "macos"))] + #[cfg(any(target_os = "freebsd", target_vendor = "apple"))] pub fn user_access_class(&self) -> Cow { cstr2cow!(self.inner.pw_class) } /// AKA passwd.pw_change - #[cfg(any(target_os = "freebsd", target_os = "macos"))] + #[cfg(any(target_os = "freebsd", target_vendor = "apple"))] pub fn passwd_change_time(&self) -> time_t { self.inner.pw_change } /// AKA passwd.pw_expire - #[cfg(any(target_os = "freebsd", target_os = "macos"))] + #[cfg(any(target_os = "freebsd", target_vendor = "apple"))] pub fn expiration(&self) -> time_t { self.inner.pw_expire } diff --git a/src/uucore/src/lib/features/signals.rs b/src/uucore/src/lib/features/signals.rs index 294669eab..d22fa1791 100644 --- a/src/uucore/src/lib/features/signals.rs +++ b/src/uucore/src/lib/features/signals.rs @@ -197,7 +197,7 @@ No Name Default Action Description */ -#[cfg(any(target_os = "macos", target_os = "freebsd"))] +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] pub static ALL_SIGNALS: [Signal<'static>; 31] = [ Signal { name: "HUP", diff --git a/src/uucore/src/lib/features/utmpx.rs b/src/uucore/src/lib/features/utmpx.rs index 31cd3b72c..0308d8a5e 100644 --- a/src/uucore/src/lib/features/utmpx.rs +++ b/src/uucore/src/lib/features/utmpx.rs @@ -47,7 +47,7 @@ use libc::utmpx; pub use libc::endutxent; pub use libc::getutxent; pub use libc::setutxent; -#[cfg(any(target_os = "macos", target_os = "linux"))] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] pub use libc::utmpxname; #[cfg(target_os = "freebsd")] pub unsafe extern "C" fn utmpxname(_file: *const libc::c_char) -> libc::c_int { @@ -85,7 +85,7 @@ mod ut { pub use libc::USER_PROCESS; } -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] mod ut { pub static DEFAULT_FILE: &str = "/var/run/utmpx"; diff --git a/tests/by-util/test_chgrp.rs b/tests/by-util/test_chgrp.rs index d5afaf3a7..613f52fd2 100644 --- a/tests/by-util/test_chgrp.rs +++ b/tests/by-util/test_chgrp.rs @@ -115,7 +115,7 @@ fn test_reference() { } #[test] -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] fn test_reference() { new_ucmd!() .arg("-v") diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index c9704a658..a79f820fb 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -12,7 +12,7 @@ fn test_du_basics() { assert!(result.success); assert_eq!(result.stderr, ""); } -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] fn _du_basics(s: String) { let answer = "32\t./subdir 8\t./subdir/deeper @@ -21,7 +21,7 @@ fn _du_basics(s: String) { "; assert_eq!(s, answer); } -#[cfg(not(target_os = "macos"))] +#[cfg(not(target_vendor = "apple"))] fn _du_basics(s: String) { let answer = "28\t./subdir 8\t./subdir/deeper @@ -41,11 +41,11 @@ fn test_du_basics_subdir() { _du_basics_subdir(result.stdout); } -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] fn _du_basics_subdir(s: String) { assert_eq!(s, "4\tsubdir/deeper\n"); } -#[cfg(not(target_os = "macos"))] +#[cfg(not(target_vendor = "apple"))] fn _du_basics_subdir(s: String) { // MS-WSL linux has altered expected output if !is_wsl() { @@ -80,12 +80,12 @@ fn test_du_soft_link() { _du_soft_link(result.stdout); } -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] fn _du_soft_link(s: String) { // 'macos' host variants may have `du` output variation for soft links assert!((s == "12\tsubdir/links\n") || (s == "16\tsubdir/links\n")); } -#[cfg(not(target_os = "macos"))] +#[cfg(not(target_vendor = "apple"))] fn _du_soft_link(s: String) { // MS-WSL linux has altered expected output if !is_wsl() { @@ -109,11 +109,11 @@ fn test_du_hard_link() { _du_hard_link(result.stdout); } -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] fn _du_hard_link(s: String) { assert_eq!(s, "12\tsubdir/links\n") } -#[cfg(not(target_os = "macos"))] +#[cfg(not(target_vendor = "apple"))] fn _du_hard_link(s: String) { // MS-WSL linux has altered expected output if !is_wsl() { @@ -133,11 +133,11 @@ fn test_du_d_flag() { _du_d_flag(result.stdout); } -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] fn _du_d_flag(s: String) { assert_eq!(s, "16\t./subdir\n20\t./\n"); } -#[cfg(not(target_os = "macos"))] +#[cfg(not(target_vendor = "apple"))] fn _du_d_flag(s: String) { // MS-WSL linux has altered expected output if !is_wsl() { diff --git a/tests/by-util/test_hostname.rs b/tests/by-util/test_hostname.rs index a526ddd88..804d47642 100644 --- a/tests/by-util/test_hostname.rs +++ b/tests/by-util/test_hostname.rs @@ -11,7 +11,7 @@ fn test_hostname() { } // FixME: fails for "MacOS" -#[cfg(not(target_os = "macos"))] +#[cfg(not(target_vendor = "apple"))] #[test] fn test_hostname_ip() { let result = new_ucmd!().arg("-i").run(); diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 422db8df9..a1c3d7569 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -285,7 +285,7 @@ fn test_ls_ls_color() { scene.ucmd().arg("--color=never").arg("z").succeeds(); } -#[cfg(not(any(target_os = "macos", target_os = "windows")))] // Truncate not available on mac or win +#[cfg(not(any(target_vendor = "apple", target_os = "windows")))] // Truncate not available on mac or win #[test] fn test_ls_human() { let scene = TestScenario::new(util_name!()); From 58b9372dbe21efe87e637d8db9a8f52e20512872 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Thu, 18 Mar 2021 14:46:56 +0100 Subject: [PATCH 0071/1135] rm: fix for -d to match GNU's output #1769 --- src/uu/rm/src/rm.rs | 26 +++++++++++++++++++------- tests/by-util/test_rm.rs | 17 +++++++++++++++++ 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 466a8d6c1..e858e3b0a 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -305,16 +305,28 @@ fn remove_dir(path: &Path, options: &Options) -> bool { true }; if response { - match fs::remove_dir(path) { - Ok(_) => { - if options.verbose { - println!("removed '{}'", path.display()); + if let Ok(mut read_dir) = fs::read_dir(path) { + if options.dir && read_dir.next().is_none() { + match fs::remove_dir(path) { + Ok(_) => { + if options.verbose { + println!("removed directory '{}'", path.display()); + } + } + Err(e) => { + show_error!("cannot remove '{}': {}", path.display(), e); + return true; + } } - } - Err(e) => { - show_error!("removing '{}': {}", path.display(), e); + } else { + // directory can be read but is not empty + show_error!("cannot remove '{}': Directory not empty", path.display()); return true; } + } else { + // GNU's rm shows this message if directory is empty but not readable + show_error!("cannot remove '{}': Directory not empty", path.display()); + return true; } } diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 27568957a..06d1d435d 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -115,6 +115,23 @@ fn test_rm_empty_directory() { assert!(!at.dir_exists(dir)); } +#[test] +fn test_rm_non_empty_directory() { + let (at, mut ucmd) = at_and_ucmd!(); + let dir = "test_rm_non_empty_dir"; + let file_a = &format!("{}/test_rm_non_empty_file_a", dir); + + at.mkdir(dir); + at.touch(file_a); + + let result = ucmd.arg("-d").arg(dir).fails(); + assert!(result + .stderr + .contains(&format!("cannot remove '{}': Directory not empty", dir))); + assert!(at.file_exists(file_a)); + assert!(at.dir_exists(dir)); +} + #[test] fn test_rm_recursive() { let (at, mut ucmd) = at_and_ucmd!(); From 5ec87dc70a08399e4a029cf1f924d8780a9d613e Mon Sep 17 00:00:00 2001 From: Marco Satti Date: Fri, 19 Mar 2021 16:54:01 +0800 Subject: [PATCH 0072/1135] date: Implement setting the date on Unix & Windows (#1798) * date: implement set date for unix and windows Parsing the date string is not fully implemented yet, as in it relies on the internals of chrono - things like "Mon, 14 Aug 2006 02:34:56 -0600" do not work, nor does "2006-08-14 02:34:56" (no TZ / local time). This is no different to using the "--date" option however, and will get fixed when `parse_date` is a bit smarter. Only supports unix and Windows platforms for now. --- Cargo.lock | 2 + src/uu/date/Cargo.toml | 6 ++ src/uu/date/src/date.rs | 127 +++++++++++++++++++++++++++++++------ tests/by-util/test_date.rs | 41 ++++++++++++ 4 files changed, 157 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9d9fb6c24..2ba6cf6a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1475,8 +1475,10 @@ version = "0.0.4" dependencies = [ "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index 4e3227f02..c62cfe2b3 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -20,6 +20,12 @@ clap = "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +[target.'cfg(unix)'.dependencies] +libc = "0.2" + +[target.'cfg(windows)'.dependencies] +winapi = { version = "0.3", features = ["minwinbase", "sysinfoapi", "minwindef"] } + [[bin]] name = "date" path = "src/main.rs" diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index 5ee4b1610..43573437d 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -12,13 +12,20 @@ #[macro_use] extern crate uucore; +use chrono::{DateTime, FixedOffset, Local, Offset, Utc}; +#[cfg(windows)] +use chrono::{Datelike, Timelike}; use clap::{App, Arg}; - -use chrono::offset::Utc; -use chrono::{DateTime, FixedOffset, Local, Offset}; +#[cfg(all(unix, not(target_os = "macos")))] +use libc::{clock_settime, timespec, CLOCK_REALTIME}; use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::PathBuf; +#[cfg(windows)] +use winapi::{ + shared::minwindef::WORD, + um::{minwinbase::SYSTEMTIME, sysinfoapi::SetSystemTime}, +}; // Options const DATE: &str = "date"; @@ -62,6 +69,11 @@ static RFC_3339_HELP_STRING: &str = "output date/time in RFC 3339 format. for date and time to the indicated precision. Example: 2006-08-14 02:34:56-06:00"; +#[cfg(not(target_os = "macos"))] +static OPT_SET_HELP_STRING: &str = "set time described by STRING"; +#[cfg(target_os = "macos")] +static OPT_SET_HELP_STRING: &str = "set time described by STRING (not available on mac yet)"; + /// Settings for this program, parsed from the command line struct Settings { utc: bool, @@ -186,7 +198,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .short("s") .long(OPT_SET) .takes_value(true) - .help("set time described by STRING"), + .help(OPT_SET_HELP_STRING), ) .arg( Arg::with_name(OPT_UNIVERSAL) @@ -222,18 +234,31 @@ pub fn uumain(args: impl uucore::Args) -> i32 { DateSource::Now }; + let set_to = match matches.value_of(OPT_SET).map(parse_date) { + None => None, + Some(Err((input, _err))) => { + eprintln!("date: invalid date '{}'", input); + return 1; + } + Some(Ok(date)) => Some(date), + }; + let settings = Settings { utc: matches.is_present(OPT_UNIVERSAL), format, date_source, - // TODO: Handle this option: - set_to: None, + set_to, }; - if let Some(_time) = settings.set_to { - unimplemented!(); - // Probably need to use this syscall: - // https://doc.rust-lang.org/libc/i686-unknown-linux-gnu/libc/fn.clock_settime.html + if let Some(date) = settings.set_to { + // All set time functions expect UTC datetimes. + let date: DateTime = if settings.utc { + date.with_timezone(&Utc) + } else { + date.into() + }; + + return set_system_datetime(date); } else { // Declare a file here because it needs to outlive the `dates` iterator. let file: File; @@ -247,15 +272,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { now.with_timezone(now.offset()) }; - /// Parse a `String` into a `DateTime`. - /// If it fails, return a tuple of the `String` along with its `ParseError`. - fn parse_date( - s: String, - ) -> Result, (String, chrono::format::ParseError)> { - // TODO: The GNU date command can parse a wide variety of inputs. - s.parse().map_err(|e| (s, e)) - } - // Iterate over all dates - whether it's a single date or a file. let dates: Box> = match settings.date_source { DateSource::Custom(ref input) => { @@ -314,3 +330,76 @@ fn make_format_string(settings: &Settings) -> &str { Format::Default => "%c", } } + +/// Parse a `String` into a `DateTime`. +/// If it fails, return a tuple of the `String` along with its `ParseError`. +fn parse_date + Clone>( + s: S, +) -> Result, (String, chrono::format::ParseError)> { + // TODO: The GNU date command can parse a wide variety of inputs. + s.as_ref().parse().map_err(|e| (s.as_ref().into(), e)) +} + +#[cfg(not(any(unix, windows)))] +fn set_system_datetime(_date: DateTime) -> i32 { + unimplemented!("setting date not implemented (unsupported target)"); +} + +#[cfg(target_os = "macos")] +fn set_system_datetime(_date: DateTime) -> i32 { + eprintln!("date: setting the date is not supported by macOS"); + return 1; +} + +#[cfg(all(unix, not(target_os = "macos")))] +/// System call to set date (unix). +/// See here for more: +/// 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) -> i32 { + let timespec = timespec { + tv_sec: date.timestamp() as _, + tv_nsec: date.timestamp_subsec_nanos() as _, + }; + + let result = unsafe { clock_settime(CLOCK_REALTIME, ×pec) }; + + if result != 0 { + let error = std::io::Error::last_os_error(); + eprintln!("date: cannot set date: {}", error); + error.raw_os_error().unwrap() + } else { + 0 + } +} + +#[cfg(windows)] +/// System call to set date (Windows). +/// 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) -> i32 { + let system_time = SYSTEMTIME { + wYear: date.year() as WORD, + wMonth: date.month() as WORD, + // Ignored + wDayOfWeek: 0, + wDay: date.day() as WORD, + wHour: date.hour() as WORD, + wMinute: date.minute() as WORD, + wSecond: date.second() as WORD, + // TODO: be careful of leap seconds - valid range is [0, 999] - how to handle? + wMilliseconds: ((date.nanosecond() / 1_000_000) % 1000) as WORD, + }; + + let result = unsafe { SetSystemTime(&system_time) }; + + if result == 0 { + let error = std::io::Error::last_os_error(); + eprintln!("date: cannot set date: {}", error); + error.raw_os_error().unwrap() + } else { + 0 + } +} diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 0837878b2..652edfa25 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -2,6 +2,8 @@ extern crate regex; use self::regex::Regex; use crate::common::util::*; +#[cfg(all(unix, not(target_os = "macos")))] +use rust_users::*; #[test] fn test_date_email() { @@ -131,3 +133,42 @@ fn test_date_format_full_day() { let re = Regex::new(r"\S+ \d{4}-\d{2}-\d{2}").unwrap(); assert!(re.is_match(&result.stdout.trim())); } + +#[test] +#[cfg(all(unix, not(target_os = "macos")))] +fn test_date_set_valid() { + if get_effective_uid() == 0 { + let (_, mut ucmd) = at_and_ucmd!(); + let result = ucmd.arg("--set").arg("2020-03-12 13:30:00+08:00").succeeds(); + result.no_stdout().no_stderr(); + } +} + +#[test] +#[cfg(any(windows, all(unix, not(target_os = "macos"))))] +fn test_date_set_invalid() { + let (_, mut ucmd) = at_and_ucmd!(); + let result = ucmd.arg("--set").arg("123abcd").fails(); + let result = result.no_stdout(); + assert!(result.stderr.starts_with("date: invalid date ")); +} + +#[test] +#[cfg(all(unix, not(target_os = "macos")))] +fn test_date_set_permissions_error() { + if !(get_effective_uid() == 0 || is_wsl()) { + let (_, mut ucmd) = at_and_ucmd!(); + let result = ucmd.arg("--set").arg("2020-03-11 21:45:00+08:00").fails(); + let result = result.no_stdout(); + assert!(result.stderr.starts_with("date: cannot set date: ")); + } +} + +#[test] +#[cfg(target_os = "macos")] +fn test_date_set_mac_unavailable() { + let (_, mut ucmd) = at_and_ucmd!(); + let result = ucmd.arg("--set").arg("2020-03-11 21:45:00+08:00").fails(); + let result = result.no_stdout(); + assert!(result.stderr.starts_with("date: setting the date is not supported by macOS")); +} From 621511dcaca907ccc9b6e425dcfafa0ec452b798 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 19 Mar 2021 14:24:25 +0100 Subject: [PATCH 0073/1135] Update cargo.lock --- Cargo.lock | 52 +++++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2ba6cf6a2..1c47c5c5f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "advapi32-sys" version = "0.2.0" @@ -652,10 +654,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "js-sys" -version = "0.3.48" +version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -838,8 +840,8 @@ dependencies = [ "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1731,7 +1733,7 @@ name = "uu_ls" version = "0.0.4" dependencies = [ "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2358,16 +2360,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wasm-bindgen" -version = "0.2.71" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.71" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2376,42 +2378,42 @@ dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.71" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.71" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.71" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "web-sys" -version = "0.3.48" +version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "js-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2534,7 +2536,7 @@ dependencies = [ "checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" "checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" "checksum itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" -"checksum js-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)" = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78" +"checksum js-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)" = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" @@ -2626,12 +2628,12 @@ dependencies = [ "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -"checksum wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7" -"checksum wasm-bindgen-backend 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8" -"checksum wasm-bindgen-macro 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b" -"checksum wasm-bindgen-macro-support 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e" -"checksum wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1" -"checksum web-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)" = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b" +"checksum wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" +"checksum wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" +"checksum wasm-bindgen-macro 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b" +"checksum wasm-bindgen-macro-support 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d" +"checksum wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" +"checksum web-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310" "checksum wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" From 976fa95ce83487a21a6151386f5c8528ca74c0a3 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 19 Mar 2021 14:25:05 +0100 Subject: [PATCH 0074/1135] fix(ls): fix a clippy warning "this `if` has identical blocks" --- src/uu/ls/src/ls.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 5c4cdaa80..10bba98f7 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -173,8 +173,6 @@ impl Config { Format::Long } else if options.is_present(options::format::ONELINE) { Format::OneLine - } else if options.is_present(options::format::COLUMNS) { - Format::Columns } else { Format::Columns }; From 118b802fe8bcc584be5a3fd65cf8e23396de28dc Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 19 Mar 2021 15:14:25 +0100 Subject: [PATCH 0075/1135] ls: --si and more compatible size formatting --- src/uu/ls/src/ls.rs | 66 +++++++++++++++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 5c4cdaa80..f7075c4df 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -92,13 +92,16 @@ pub mod options { pub static ACCESS: &str = "u"; pub static CHANGE: &str = "c"; } + pub mod size { + pub static HUMAN_READABLE: &str = "human-readable"; + pub static SI: &str = "si"; + } pub static FORMAT: &str = "format"; pub static SORT: &str = "sort"; pub static TIME: &str = "time"; pub static IGNORE_BACKUPS: &str = "ignore-backups"; pub static DIRECTORY: &str = "directory"; pub static CLASSIFY: &str = "classify"; - pub static HUMAN_READABLE: &str = "human-readable"; pub static INODE: &str = "inode"; pub static DEREFERENCE: &str = "dereference"; pub static NUMERIC_UID_GID: &str = "numeric-uid-gid"; @@ -122,9 +125,10 @@ enum Sort { Time, } -enum SizeFormats { +enum SizeFormat { Bytes, - Binary, // Powers of 1024, --human-readable + Binary, // Powers of 1024, --human-readable, -h + Decimal, // Powers of 1000, --si } #[derive(PartialEq, Eq)] @@ -149,7 +153,7 @@ struct Config { dereference: bool, classify: bool, ignore_backups: bool, - size_format: SizeFormats, + size_format: SizeFormat, numeric_uid_gid: bool, directory: bool, time: Time, @@ -231,10 +235,12 @@ impl Config { }, }; - let size_format = if options.is_present(options::HUMAN_READABLE) { - SizeFormats::Binary + let size_format = if options.is_present(options::size::HUMAN_READABLE) { + SizeFormat::Binary + } else if options.is_present(options::size::SI) { + SizeFormat::Decimal } else { - SizeFormats::Bytes + SizeFormat::Bytes }; Config { @@ -413,10 +419,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { '>' for doors, and nothing for regular files.", )) .arg( - Arg::with_name(options::HUMAN_READABLE) + Arg::with_name(options::size::HUMAN_READABLE) .short("h") - .long(options::HUMAN_READABLE) - .help("Print human readable file sizes (e.g. 1K 234M 56G)."), + .long(options::size::HUMAN_READABLE) + .help("Print human readable file sizes (e.g. 1K 234M 56G).") + .overrides_with(options::size::SI), + ) + .arg( + Arg::with_name(options::size::SI) + .long(options::size::SI) + .help("Print human readable file sizes using powers of 1000 instead of 1024.") ) .arg( Arg::with_name(options::INODE) @@ -787,17 +799,37 @@ fn display_date(metadata: &Metadata, config: &Config) -> String { } } +// There are a few peculiarities to how GNU formats the sizes: +// 1. One decimal place is given if and only if the size is smaller than 10 +// 2. It rounds sizes up. +// 3. The human-readable format uses powers for 1024, but does not display the "i" +// that is commonly used to denote Kibi, Mebi, etc. +// 4. Kibi and Kilo are denoted differently ("k" and "K", respectively) +fn format_prefixed(prefixed: NumberPrefix) -> String { + match prefixed { + NumberPrefix::Standalone(bytes) => bytes.to_string(), + NumberPrefix::Prefixed(prefix, bytes) => { + // Remove the "i" from "Ki", "Mi", etc. if present + let prefix_str = prefix.symbol().trim_end_matches("i"); + + // Check whether we get more than 10 if we round up to the first decimal + // because we want do display 9.81 as "9.9", not as "10". + if (10.0 * bytes).ceil() >= 100.0 { + format!("{:.0}{}", bytes.ceil(), prefix_str) + } else { + format!("{:.1}{}", (10.0 * bytes).ceil() / 10.0, prefix_str) + } + } + } +} + fn display_file_size(metadata: &Metadata, config: &Config) -> String { // NOTE: The human-readable behaviour deviates from the GNU ls. // The GNU ls uses binary prefixes by default. match config.size_format { - SizeFormats::Binary => match NumberPrefix::decimal(metadata.len() as f64) { - NumberPrefix::Standalone(bytes) => bytes.to_string(), - NumberPrefix::Prefixed(prefix, bytes) => { - format!("{:.2}{}", bytes, prefix).to_uppercase() - } - }, - SizeFormats::Bytes => metadata.len().to_string(), + SizeFormat::Binary => format_prefixed(NumberPrefix::binary(metadata.len() as f64)), + SizeFormat::Decimal => format_prefixed(NumberPrefix::decimal(metadata.len() as f64)), + SizeFormat::Bytes => metadata.len().to_string(), } } From 39b07f670f8b35599c4a62d978715631ae19dea5 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 19 Mar 2021 15:15:24 +0100 Subject: [PATCH 0076/1135] tests/ls: adapt tests to --si and new size formats --- tests/by-util/test_ls.rs | 82 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 8 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index d01aaffd9..e0063aa1a 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -428,28 +428,94 @@ fn test_ls_ls_color() { #[cfg(not(any(target_vendor = "apple", target_os = "windows")))] // Truncate not available on mac or win #[test] -fn test_ls_human() { +fn test_ls_human_si() { let scene = TestScenario::new(util_name!()); - let file = "test_human"; - let result = scene.cmd("truncate").arg("-s").arg("+1000").arg(file).run(); + let file1 = "test_human-1"; + let result = scene + .cmd("truncate") + .arg("-s") + .arg("+1000") + .arg(file1) + .run(); println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); - let result = scene.ucmd().arg("-hl").arg(file).run(); + + let result = scene.ucmd().arg("-hl").arg(file1).run(); println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); assert!(result.success); - assert!(result.stdout.contains("1.00K")); + assert!(result.stdout.contains(" 1000 ")); + + let result = scene.ucmd().arg("-l").arg("--si").arg(file1).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert!(result.stdout.contains(" 1.0k ")); + scene .cmd("truncate") .arg("-s") .arg("+1000k") - .arg(file) + .arg(file1) .run(); - let result = scene.ucmd().arg("-hl").arg(file).run(); + + let result = scene.ucmd().arg("-hl").arg(file1).run(); println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); assert!(result.success); - assert!(result.stdout.contains("1.02M")); + assert!(result.stdout.contains(" 1001K ")); + + let result = scene.ucmd().arg("-l").arg("--si").arg(file1).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert!(result.stdout.contains(" 1.1M ")); + + let file2 = "test-human-2"; + let result = scene + .cmd("truncate") + .arg("-s") + .arg("+12300k") + .arg(file2) + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + let result = scene.ucmd().arg("-hl").arg(file2).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + // GNU rounds up, so we must too. + assert!(result.stdout.contains(" 13M ")); + + let result = scene.ucmd().arg("-l").arg("--si").arg(file2).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + // GNU rounds up, so we must too. + assert!(result.stdout.contains(" 13M ")); + + let file3 = "test-human-3"; + let result = scene + .cmd("truncate") + .arg("-s") + .arg("+9999") + .arg(file3) + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + + let result = scene.ucmd().arg("-hl").arg(file3).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert!(result.stdout.contains(" 9.8K ")); + + let result = scene.ucmd().arg("-l").arg("--si").arg(file3).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert!(result.stdout.contains(" 10k ")); } #[cfg(windows)] From 9132d32315fccd8a040cc8da4797a492f3cf228e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 19 Mar 2021 18:01:43 +0100 Subject: [PATCH 0077/1135] Rustfmt the tests --- tests/by-util/test_date.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 652edfa25..458e62004 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -139,7 +139,10 @@ fn test_date_format_full_day() { fn test_date_set_valid() { if get_effective_uid() == 0 { let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("--set").arg("2020-03-12 13:30:00+08:00").succeeds(); + let result = ucmd + .arg("--set") + .arg("2020-03-12 13:30:00+08:00") + .succeeds(); result.no_stdout().no_stderr(); } } @@ -170,5 +173,7 @@ fn test_date_set_mac_unavailable() { let (_, mut ucmd) = at_and_ucmd!(); let result = ucmd.arg("--set").arg("2020-03-11 21:45:00+08:00").fails(); let result = result.no_stdout(); - assert!(result.stderr.starts_with("date: setting the date is not supported by macOS")); + assert!(result + .stderr + .starts_with("date: setting the date is not supported by macOS")); } From c6927d97c8600e9cdcc571aacf377032a6d06e37 Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Fri, 19 Mar 2021 22:15:35 +0200 Subject: [PATCH 0078/1135] cp: add support for -x/--one-file-system (#1840) --- Cargo.toml | 1 + src/uu/cp/src/cp.rs | 11 +-- tests/by-util/test_cp.rs | 73 +++++++++++++++++++ tests/fixtures/cp/dir_with_mount/copy_me.txt | 0 .../cp/dir_with_mount/copy_me/copy_me.txt | 0 5 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 tests/fixtures/cp/dir_with_mount/copy_me.txt create mode 100644 tests/fixtures/cp/dir_with_mount/copy_me/copy_me.txt diff --git a/Cargo.toml b/Cargo.toml index 9b55abe5c..bf11e66fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -347,6 +347,7 @@ tempfile = "= 3.1.0" time = "0.1" unindent = "0.1" uucore = { version=">=0.0.7", package="uucore", path="src/uucore", features=["entries"] } +walkdir = "2.2" [target.'cfg(unix)'.dev-dependencies] rust-users = { version="0.10", package="users" } diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 0922af241..01ad4a8aa 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -431,6 +431,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg(Arg::with_name(OPT_NO_DEREFERENCE_PRESERVE_LINKS) .short("d") .help("same as --no-dereference --preserve=links")) + .arg(Arg::with_name(OPT_ONE_FILE_SYSTEM) + .short("x") + .long(OPT_ONE_FILE_SYSTEM) + .help("stay on this file system")) // TODO: implement the following args .arg(Arg::with_name(OPT_COPY_CONTENTS) @@ -442,10 +446,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .value_name("WHEN") .help("NotImplemented: control creation of sparse files. See below")) - .arg(Arg::with_name(OPT_ONE_FILE_SYSTEM) - .short("x") - .long(OPT_ONE_FILE_SYSTEM) - .help("NotImplemented: stay on this file system")) .arg(Arg::with_name(OPT_CONTEXT) .long(OPT_CONTEXT) .takes_value(true) @@ -563,6 +563,7 @@ impl Options { let not_implemented_opts = vec![ OPT_COPY_CONTENTS, OPT_SPARSE, + #[cfg(not(any(windows, unix)))] OPT_ONE_FILE_SYSTEM, OPT_CONTEXT, #[cfg(windows)] @@ -937,7 +938,7 @@ fn copy_directory(root: &Path, target: &Target, options: &Options) -> CopyResult #[cfg(any(windows, target_os = "redox"))] let mut hard_links: Vec<(String, u64)> = vec![]; - for path in WalkDir::new(root) { + for path in WalkDir::new(root).same_file_system(options.one_file_system) { let p = or_continue!(path); let is_symlink = fs::symlink_metadata(p.path())?.file_type().is_symlink(); let path = if (options.no_dereference || options.dereference) && is_symlink { diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index b96bd4e29..a00ed2fd2 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -31,6 +31,12 @@ static TEST_COPY_FROM_FOLDER: &str = "hello_dir_with_file/"; static TEST_COPY_FROM_FOLDER_FILE: &str = "hello_dir_with_file/hello_world.txt"; static TEST_COPY_TO_FOLDER_NEW: &str = "hello_dir_new"; static TEST_COPY_TO_FOLDER_NEW_FILE: &str = "hello_dir_new/hello_world.txt"; +#[cfg(any(target_os = "linux", target_os = "freebsd"))] +static TEST_MOUNT_COPY_FROM_FOLDER: &str = "dir_with_mount"; +#[cfg(any(target_os = "linux", target_os = "freebsd"))] +static TEST_MOUNT_MOUNTPOINT: &str = "mount"; +#[cfg(any(target_os = "linux", target_os = "freebsd"))] +static TEST_MOUNT_OTHER_FILESYSTEM_FILE: &str = "mount/DO_NOT_copy_me.txt"; #[test] fn test_cp_cp() { @@ -1001,3 +1007,70 @@ fn test_cp_target_file_dev_null() { assert!(at.file_exists(file2)); } + +#[test] +#[cfg(any(target_os = "linux", target_os = "freebsd"))] +fn test_cp_one_file_system() { + use crate::common::util::AtPath; + use walkdir::WalkDir; + + let scene = TestScenario::new(util_name!()); + + // Test must be run as root (or with `sudo -E`) + if scene.cmd("whoami").run().stdout != "root\n" { + return; + } + + let at = scene.fixtures.clone(); + let at_src = AtPath::new(&at.plus(TEST_MOUNT_COPY_FROM_FOLDER)); + let at_dst = AtPath::new(&at.plus(TEST_COPY_TO_FOLDER_NEW)); + + // Prepare the mount + at_src.mkdir(TEST_MOUNT_MOUNTPOINT); + let mountpoint_path = &at_src.plus_as_string(TEST_MOUNT_MOUNTPOINT); + + let _r = scene + .cmd("mount") + .arg("-t") + .arg("tmpfs") + .arg("-o") + .arg("size=640k") // ought to be enough + .arg("tmpfs") + .arg(mountpoint_path) + .run(); + assert!(_r.code == Some(0), _r.stderr); + + at_src.touch(TEST_MOUNT_OTHER_FILESYSTEM_FILE); + + // Begin testing -x flag + let result = scene + .ucmd() + .arg("-rx") + .arg(TEST_MOUNT_COPY_FROM_FOLDER) + .arg(TEST_COPY_TO_FOLDER_NEW) + .run(); + + // Ditch the mount before the asserts + let _r = scene.cmd("umount").arg(mountpoint_path).run(); + assert!(_r.code == Some(0), _r.stderr); + + assert!(result.success); + assert!(!at_dst.file_exists(TEST_MOUNT_OTHER_FILESYSTEM_FILE)); + // Check if the other files were copied from the source folder hirerarchy + for entry in WalkDir::new(at_src.as_string()) { + let entry = entry.unwrap(); + let relative_src = entry + .path() + .strip_prefix(at_src.as_string()) + .unwrap() + .to_str() + .unwrap(); + + let ft = entry.file_type(); + match (ft.is_dir(), ft.is_file(), ft.is_symlink()) { + (true, _, _) => assert!(at_dst.dir_exists(relative_src)), + (_, true, _) => assert!(at_dst.file_exists(relative_src)), + (_, _, _) => panic!(), + } + } +} diff --git a/tests/fixtures/cp/dir_with_mount/copy_me.txt b/tests/fixtures/cp/dir_with_mount/copy_me.txt new file mode 100644 index 000000000..e69de29bb diff --git a/tests/fixtures/cp/dir_with_mount/copy_me/copy_me.txt b/tests/fixtures/cp/dir_with_mount/copy_me/copy_me.txt new file mode 100644 index 000000000..e69de29bb From 0e217e202a2f23bb73c881c15c083a8e1eb55d7f Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 19 Mar 2021 22:58:50 +0100 Subject: [PATCH 0079/1135] tee: move from getopts to clap (#1814) --- src/uu/tee/Cargo.toml | 2 +- src/uu/tee/src/tee.rs | 118 ++++++++++++++++++------------------------ 2 files changed, 50 insertions(+), 70 deletions(-) diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index ee18e888f..99a6ec23e 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/tee.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33.3" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["libc"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/tee/src/tee.rs b/src/uu/tee/src/tee.rs index e29945382..c54fa0d16 100644 --- a/src/uu/tee/src/tee.rs +++ b/src/uu/tee/src/tee.rs @@ -5,6 +5,10 @@ // * 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 clap::{App, Arg}; use std::fs::OpenOptions; use std::io::{copy, sink, stdin, stdout, Error, ErrorKind, Read, Result, Write}; use std::path::{Path, PathBuf}; @@ -12,80 +16,61 @@ use std::path::{Path, PathBuf}; #[cfg(unix)] use uucore::libc; -static NAME: &str = "tee"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Copy standard input to each FILE, and also to standard output."; -pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); - - match options(&args).and_then(exec) { - Ok(_) => 0, - Err(_) => 1, - } +mod options { + pub const APPEND: &str = "append"; + pub const IGNORE_INTERRUPTS: &str = "ignore-interrupts"; + pub const FILE: &str = "file"; } #[allow(dead_code)] struct Options { - program: String, append: bool, ignore_interrupts: bool, - print_and_exit: Option, files: Vec, } -fn options(args: &[String]) -> Result { - let mut opts = getopts::Options::new(); - - opts.optflag("a", "append", "append to the given FILEs, do not overwrite"); - opts.optflag( - "i", - "ignore-interrupts", - "ignore interrupt signals (ignored on non-Unix platforms)", - ); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - opts.parse(&args[1..]) - .map_err(|e| Error::new(ErrorKind::Other, format!("{}", e))) - .map(|m| { - let version = format!("{} {}", NAME, VERSION); - let arguments = "[OPTION]... [FILE]..."; - let brief = "Copy standard input to each FILE, and also to standard output."; - let comment = "If a FILE is -, it refers to a file named - ."; - let help = format!( - "{}\n\nUsage:\n {} {}\n\n{}\n{}", - version, - NAME, - arguments, - opts.usage(brief), - comment - ); - let names: Vec = m.free.clone().into_iter().collect(); - let to_print = if m.opt_present("help") { - Some(help) - } else if m.opt_present("version") { - Some(version) - } else { - None - }; - Options { - program: NAME.to_owned(), - append: m.opt_present("append"), - ignore_interrupts: m.opt_present("ignore-interrupts"), - print_and_exit: to_print, - files: names, - } - }) - .map_err(|message| warn(format!("{}", message).as_ref())) +fn get_usage() -> String { + format!("{0} [OPTION]... [FILE]...", executable!()) } -fn exec(options: Options) -> Result<()> { - match options.print_and_exit { - Some(text) => { - println!("{}", text); - Ok(()) - } - None => tee(options), +pub fn uumain(args: impl uucore::Args) -> i32 { + let usage = get_usage(); + + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help("If a FILE is -, it refers to a file named - .") + .arg( + Arg::with_name(options::APPEND) + .long(options::APPEND) + .short("a") + .help("append to the given FILEs, do not overwrite"), + ) + .arg( + Arg::with_name(options::IGNORE_INTERRUPTS) + .long(options::IGNORE_INTERRUPTS) + .short("i") + .help("ignore interrupt signals (ignored on non-Unix platforms)"), + ) + .arg(Arg::with_name(options::FILE).multiple(true)) + .get_matches_from(args); + + let options = Options { + append: matches.is_present(options::APPEND), + ignore_interrupts: matches.is_present(options::IGNORE_INTERRUPTS), + files: matches + .values_of(options::FILE) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(), + }; + + match tee(options) { + Ok(_) => 0, + Err(_) => 1, } } @@ -173,7 +158,7 @@ impl Write for NamedWriter { match self.inner.write(buf) { Err(f) => { self.inner = Box::new(sink()) as Box; - warn(format!("{}: {}", self.path.display(), f.to_string()).as_ref()); + show_warning!("{}: {}", self.path.display(), f.to_string()); Err(f) } okay => okay, @@ -184,7 +169,7 @@ impl Write for NamedWriter { match self.inner.flush() { Err(f) => { self.inner = Box::new(sink()) as Box; - warn(format!("{}: {}", self.path.display(), f.to_string()).as_ref()); + show_warning!("{}: {}", self.path.display(), f.to_string()); Err(f) } okay => okay, @@ -200,15 +185,10 @@ impl Read for NamedReader { fn read(&mut self, buf: &mut [u8]) -> Result { match self.inner.read(buf) { Err(f) => { - warn(format!("{}: {}", Path::new("stdin").display(), f.to_string()).as_ref()); + show_warning!("{}: {}", Path::new("stdin").display(), f.to_string()); Err(f) } okay => okay, } } } - -fn warn(message: &str) -> Error { - eprintln!("{}: {}", NAME, message); - Error::new(ErrorKind::Other, format!("{}: {}", NAME, message)) -} From 785897efbd404d755bd6fb2a1a5cdb536ae414a1 Mon Sep 17 00:00:00 2001 From: Marco Satti Date: Sat, 20 Mar 2021 15:17:18 +0800 Subject: [PATCH 0080/1135] date: add more tests for setting (alt. formats) --- tests/by-util/test_date.rs | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 458e62004..216446266 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -177,3 +177,42 @@ fn test_date_set_mac_unavailable() { .stderr .starts_with("date: setting the date is not supported by macOS")); } + +#[test] +#[cfg(all(unix, not(target_os = "macos")))] +fn test_date_set_valid_2() { + if get_effective_uid() == 0 { + let (_, mut ucmd) = at_and_ucmd!(); + let result = ucmd + .arg("--set") + .arg("Sat 20 Mar 2021 14:53:01 AWST") + .succeeds(); + result.no_stdout().no_stderr(); + } +} + +#[test] +#[cfg(all(unix, not(target_os = "macos")))] +fn test_date_set_valid_3() { + if get_effective_uid() == 0 { + let (_, mut ucmd) = at_and_ucmd!(); + let result = ucmd + .arg("--set") + .arg("Sat 20 Mar 2021 14:53:01") // Local timezone + .succeeds(); + result.no_stdout().no_stderr(); + } +} + +#[test] +#[cfg(all(unix, not(target_os = "macos")))] +fn test_date_set_valid_4() { + if get_effective_uid() == 0 { + let (_, mut ucmd) = at_and_ucmd!(); + let result = ucmd + .arg("--set") + .arg("2020-03-11 21:45:00") // Local timezone + .succeeds(); + result.no_stdout().no_stderr(); + } +} From d1fc42a7c901362a33f832567022d362ed31a33e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 20 Mar 2021 10:28:06 +0100 Subject: [PATCH 0081/1135] refresh cargo.lock with recent updates --- Cargo.lock | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 1c47c5c5f..8d4318dec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -297,6 +297,7 @@ dependencies = [ "uu_whoami 0.0.4", "uu_yes 0.0.4", "uucore 0.0.7", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2128,7 +2129,7 @@ dependencies = [ name = "uu_tee" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", From e9adc5067bf66f4e0c9d96623eabe48acf76a437 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Sat, 20 Mar 2021 02:33:04 -0700 Subject: [PATCH 0082/1135] cksum: generate CRC table in a const fn (#1744) --- src/uu/cksum/build.rs | 46 ------------------ src/uu/cksum/src/cksum.rs | 99 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 94 insertions(+), 51 deletions(-) delete mode 100644 src/uu/cksum/build.rs diff --git a/src/uu/cksum/build.rs b/src/uu/cksum/build.rs deleted file mode 100644 index a9edd0d59..000000000 --- a/src/uu/cksum/build.rs +++ /dev/null @@ -1,46 +0,0 @@ -// This file is part of the uutils coreutils package. -// -// (c) Alex Lyon -// (c) Michael Gehring -// -// For the full copyright and license information, please view the LICENSE -// file that was distributed with this source code. - -use std::env; -use std::fs::File; -use std::io::Write; -use std::path::Path; - -const CRC_TABLE_LEN: usize = 256; - -fn main() { - let out_dir = env::var("OUT_DIR").unwrap(); - - let mut table = Vec::with_capacity(CRC_TABLE_LEN); - for num in 0..CRC_TABLE_LEN { - table.push(crc_entry(num as u8) as u32); - } - let file = File::create(&Path::new(&out_dir).join("crc_table.rs")).unwrap(); - write!( - &file, - "#[allow(clippy::unreadable_literal)]\nconst CRC_TABLE: [u32; {}] = {:?};", - CRC_TABLE_LEN, table - ) - .unwrap(); -} - -#[inline] -fn crc_entry(input: u8) -> u32 { - let mut crc = (input as u32) << 24; - - for _ in 0..8 { - if crc & 0x8000_0000 != 0 { - crc <<= 1; - crc ^= 0x04c1_1db7; - } else { - crc <<= 1; - } - } - - crc -} diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index f589e6f81..e1c75fffc 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -14,11 +14,101 @@ use std::fs::File; use std::io::{self, stdin, BufReader, Read}; use std::path::Path; -include!(concat!(env!("OUT_DIR"), "/crc_table.rs")); +// NOTE: CRC_TABLE_LEN *must* be <= 256 as we cast 0..CRC_TABLE_LEN to u8 +const CRC_TABLE_LEN: usize = 256; +const CRC_TABLE: [u32; CRC_TABLE_LEN] = generate_crc_table(); -static SYNTAX: &str = "[OPTIONS] [FILE]..."; -static SUMMARY: &str = "Print CRC and size for each file"; -static LONG_HELP: &str = ""; +const SYNTAX: &str = "[OPTIONS] [FILE]..."; +const SUMMARY: &str = "Print CRC and size for each file"; +const LONG_HELP: &str = ""; + +// this is basically a hack to get "loops" to work on Rust 1.33. Once we update to Rust 1.46 or +// greater, we can just use while loops +macro_rules! unroll { + (256, |$i:ident| $s:expr) => {{ + unroll!(@ 32, 0 * 32, $i, $s); + unroll!(@ 32, 1 * 32, $i, $s); + unroll!(@ 32, 2 * 32, $i, $s); + unroll!(@ 32, 3 * 32, $i, $s); + unroll!(@ 32, 4 * 32, $i, $s); + unroll!(@ 32, 5 * 32, $i, $s); + unroll!(@ 32, 6 * 32, $i, $s); + unroll!(@ 32, 7 * 32, $i, $s); + }}; + (8, |$i:ident| $s:expr) => {{ + unroll!(@ 8, 0, $i, $s); + }}; + + (@ 32, $start:expr, $i:ident, $s:expr) => {{ + unroll!(@ 8, $start + 0 * 8, $i, $s); + unroll!(@ 8, $start + 1 * 8, $i, $s); + unroll!(@ 8, $start + 2 * 8, $i, $s); + unroll!(@ 8, $start + 3 * 8, $i, $s); + }}; + (@ 8, $start:expr, $i:ident, $s:expr) => {{ + unroll!(@ 4, $start, $i, $s); + unroll!(@ 4, $start + 4, $i, $s); + }}; + (@ 4, $start:expr, $i:ident, $s:expr) => {{ + unroll!(@ 2, $start, $i, $s); + unroll!(@ 2, $start + 2, $i, $s); + }}; + (@ 2, $start:expr, $i:ident, $s:expr) => {{ + unroll!(@ 1, $start, $i, $s); + unroll!(@ 1, $start + 1, $i, $s); + }}; + (@ 1, $start:expr, $i:ident, $s:expr) => {{ + let $i = $start; + let _ = $s; + }}; +} + +const fn generate_crc_table() -> [u32; CRC_TABLE_LEN] { + let mut table = [0; CRC_TABLE_LEN]; + + // NOTE: works on Rust 1.46 + //let mut i = 0; + //while i < CRC_TABLE_LEN { + // table[i] = crc_entry(i as u8) as u32; + // + // i += 1; + //} + unroll!(256, |i| { + table[i] = crc_entry(i as u8) as u32; + }); + + table +} + +const fn crc_entry(input: u8) -> u32 { + let mut crc = (input as u32) << 24; + + // NOTE: this does not work on Rust 1.33, but *does* on 1.46 + //let mut i = 0; + //while i < 8 { + // if crc & 0x8000_0000 != 0 { + // crc <<= 1; + // crc ^= 0x04c1_1db7; + // } else { + // crc <<= 1; + // } + // + // i += 1; + //} + unroll!(8, |_i| { + let if_cond = crc & 0x8000_0000; + let if_body = (crc << 1) ^ 0x04c1_1db7; + let else_body = crc << 1; + + // NOTE: i feel like this is easier to understand than emulating an if statement in bitwise + // ops + let cond_table = [else_body, if_body]; + + crc = cond_table[(if_cond != 0) as usize]; + }); + + crc +} #[inline] fn crc_update(crc: u32, input: u8) -> u32 { @@ -68,7 +158,6 @@ fn cksum(fname: &str) -> io::Result<(u32, usize)> { Err(err) => return Err(err), } } - //Ok((0 as u32,0 as usize)) } pub fn uumain(args: impl uucore::Args) -> i32 { From 8b9ac0c7c3231ebde87b875e95dc67d02e9e753a Mon Sep 17 00:00:00 2001 From: nicoo Date: Sat, 20 Mar 2021 11:46:58 +0100 Subject: [PATCH 0083/1135] =?UTF-8?q?Revert=20#1571=20=E2=80=9Cperf/factor?= =?UTF-8?q?=20~=20deduplicate=20divisors=E2=80=9D=20(#1842)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was a draft PR, not ready for merging, and its premature inclusion caused repeated issues, see 368f47381b7441ddb23bb7460417e0d1ce33e330 & friends. Close #1841. This reverts commits 3743a3e1e7a87bdd0ea7b923dc42386bfc14ccd5, ce218e01b6fcfadf4a9e55348d98f36dafff6c6b, and b7b0c76b8ea60297b43777d17d7322d1d45a9e91. --- src/uu/factor/src/factor.rs | 145 +++++++++++------------------------- src/uu/factor/src/table.rs | 5 +- 2 files changed, 45 insertions(+), 105 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 2715bad71..7d2e16a11 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -9,7 +9,7 @@ use smallvec::SmallVec; use std::cell::RefCell; use std::fmt; -use crate::numeric::{gcd, Arithmetic, Montgomery}; +use crate::numeric::{Arithmetic, Montgomery}; use crate::{miller_rabin, rho, table}; type Exponent = u8; @@ -29,20 +29,15 @@ impl Decomposition { fn add(&mut self, factor: u64, exp: Exponent) { debug_assert!(exp > 0); - // Assert the factor doesn't already exist in the Decomposition object - debug_assert_eq!(self.0.iter_mut().find(|(f, _)| *f == factor), None); - self.0.push((factor, exp)) - } - - fn is_one(&self) -> bool { - self.0.is_empty() - } - - fn pop(&mut self) -> Option<(u64, Exponent)> { - self.0.pop() + if let Some((_, e)) = self.0.iter_mut().find(|(f, _)| *f == factor) { + *e += exp; + } else { + self.0.push((factor, exp)) + } } + #[cfg(test)] fn product(&self) -> u64 { self.0 .iter() @@ -86,11 +81,11 @@ impl Factors { self.0.borrow_mut().add(prime, exp) } - #[cfg(test)] pub fn push(&mut self, prime: u64) { self.add(prime, 1) } + #[cfg(test)] fn product(&self) -> u64 { self.0.borrow().product() } @@ -111,116 +106,62 @@ impl fmt::Display for Factors { } } -fn _find_factor(num: u64) -> Option { +fn _factor(num: u64, f: Factors) -> Factors { use miller_rabin::Result::*; + // Shadow the name, so the recursion automatically goes from “Big” arithmetic to small. + let _factor = |n, f| { + if n < (1 << 32) { + _factor::>(n, f) + } else { + _factor::(n, f) + } + }; + + if num == 1 { + return f; + } + let n = A::new(num); - match miller_rabin::test::(n) { - Prime => None, - Composite(d) => Some(d), - Pseudoprime => Some(rho::find_divisor::(n)), - } + let divisor = match miller_rabin::test::(n) { + Prime => { + let mut r = f; + r.push(num); + return r; + } + + Composite(d) => d, + Pseudoprime => rho::find_divisor::(n), + }; + + let f = _factor(divisor, f); + _factor(num / divisor, f) } -fn find_factor(num: u64) -> Option { - if num < (1 << 32) { - _find_factor::>(num) - } else { - _find_factor::>(num) - } -} - -pub fn factor(num: u64) -> Factors { +pub fn factor(mut n: u64) -> Factors { let mut factors = Factors::one(); - if num < 2 { + if n < 2 { return factors; } - let mut n = num; - let n_zeros = num.trailing_zeros(); + let n_zeros = n.trailing_zeros(); if n_zeros > 0 { factors.add(2, n_zeros as Exponent); n >>= n_zeros; } - debug_assert_eq!(num, n * factors.product()); if n == 1 { return factors; } - table::factor(&mut n, &mut factors); - debug_assert_eq!(num, n * factors.product()); + let (factors, n) = table::factor(n, factors); - if n == 1 { - return factors; + if n < (1 << 32) { + _factor::>(n, factors) + } else { + _factor::>(n, factors) } - - let mut dec = Decomposition::one(); - dec.add(n, 1); - - while !dec.is_one() { - // Check correctness invariant - debug_assert_eq!(num, factors.product() * dec.product()); - - let (factor, exp) = dec.pop().unwrap(); - - if let Some(divisor) = find_factor(factor) { - let mut gcd_queue = Decomposition::one(); - - let quotient = factor / divisor; - let mut trivial_gcd = quotient == divisor; - if trivial_gcd { - gcd_queue.add(divisor, exp + 1); - } else { - gcd_queue.add(divisor, exp); - gcd_queue.add(quotient, exp); - } - - while !trivial_gcd { - debug_assert_eq!(factor, gcd_queue.product()); - - let mut tmp = Decomposition::one(); - trivial_gcd = true; - for i in 0..gcd_queue.0.len() - 1 { - let (mut a, exp_a) = gcd_queue.0[i]; - let (mut b, exp_b) = gcd_queue.0[i + 1]; - - if a == 1 { - continue; - } - - let g = gcd(a, b); - if g != 1 { - trivial_gcd = false; - a /= g; - b /= g; - } - if a != 1 { - tmp.add(a, exp_a); - } - if g != 1 { - tmp.add(g, exp_a + exp_b); - } - - if i + 1 != gcd_queue.0.len() - 1 { - gcd_queue.0[i + 1].0 = b; - } else if b != 1 { - tmp.add(b, exp_b); - } - } - gcd_queue = tmp; - } - - debug_assert_eq!(factor, gcd_queue.product()); - dec.0.extend(gcd_queue.0); - } else { - // factor is prime - factors.add(factor, exp); - } - } - - factors } #[cfg(test)] diff --git a/src/uu/factor/src/table.rs b/src/uu/factor/src/table.rs index b62e801cb..d6ef796fc 100644 --- a/src/uu/factor/src/table.rs +++ b/src/uu/factor/src/table.rs @@ -14,8 +14,7 @@ use crate::Factors; include!(concat!(env!("OUT_DIR"), "/prime_table.rs")); -pub(crate) fn factor(n: &mut u64, factors: &mut Factors) { - let mut num = *n; +pub(crate) fn factor(mut num: u64, mut factors: Factors) -> (Factors, u64) { for &(prime, inv, ceil) in P_INVS_U64 { if num == 1 { break; @@ -43,5 +42,5 @@ pub(crate) fn factor(n: &mut u64, factors: &mut Factors) { } } - *n = num; + (factors, num) } From 0f7423dfa6e44c11593f1acaca98c372b1dbe50f Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Sat, 20 Mar 2021 14:37:37 +0200 Subject: [PATCH 0084/1135] install: fix bug #1823 --- src/uu/install/src/install.rs | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 9d1acdc7e..a675549d1 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -426,18 +426,25 @@ fn copy_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behavior) -> let mut all_successful = true; for sourcepath in files.iter() { - let targetpath = match sourcepath.as_os_str().to_str() { - Some(name) => target_dir.join(name), - None => { - show_error!( - "cannot stat '{}': No such file or directory", - sourcepath.display() - ); + if !sourcepath.exists() { + show_error!( + "cannot stat '{}': No such file or directory", + sourcepath.display() + ); - all_successful = false; - continue; - } - }; + all_successful = false; + continue; + } + + if sourcepath.is_dir() { + show_info!("omitting directory '{}'", sourcepath.display()); + all_successful = false; + continue; + } + + let mut targetpath = target_dir.clone().to_path_buf(); + let filename = sourcepath.components().last().unwrap(); + targetpath.push(filename); if copy(sourcepath, &targetpath, b).is_err() { all_successful = false; From 7a9128197621e0faf75e8f7c095b8f197d01c0ff Mon Sep 17 00:00:00 2001 From: Dominik Bittner Date: Sat, 20 Mar 2021 13:49:53 +0100 Subject: [PATCH 0085/1135] Install: remove path when copining files - add a test for copying a file from one directory to another - add the desired behavior Fixes #1823 --- tests/by-util/test_install.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 7b3706f9e..9f4d9af18 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -358,3 +358,18 @@ fn test_install_target_file_dev_null() { ucmd.arg(file1).arg(file2).succeeds().no_stderr(); assert!(at.file_exists(file2)); } + +#[test] +fn test_install_copy_file_leading_dot() { + let (at, mut ucmd) = at_and_ucmd!(); + let dir1 = "test_install_target_new_file_dir_l"; + let dir2 = "test_install_target_new_file_dir_m"; + let file1 = "test_install_target_file_file_l1"; + + at.mkdir(dir1); + at.mkdir(dir2); + at.touch(&format!("{}/{}", dir1, file1)); + + ucmd.arg(format!("{}/{}", dir1, file1)).arg(dir2).succeeds().no_stderr(); + assert!(at.file_exists(&format!("{}/{}", dir2, file1))); +} From ecddaf577a7e8dd7fc3d3c07e4c3ac56fd96e392 Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Sat, 20 Mar 2021 15:44:41 +0200 Subject: [PATCH 0086/1135] install: rustfmt test --- tests/by-util/test_install.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 9f4d9af18..a5ce040f7 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -370,6 +370,9 @@ fn test_install_copy_file_leading_dot() { at.mkdir(dir2); at.touch(&format!("{}/{}", dir1, file1)); - ucmd.arg(format!("{}/{}", dir1, file1)).arg(dir2).succeeds().no_stderr(); + ucmd.arg(format!("{}/{}", dir1, file1)) + .arg(dir2) + .succeeds() + .no_stderr(); assert!(at.file_exists(&format!("{}/{}", dir2, file1))); } From f8125a1040ff34745d101913a90892515e60ad88 Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Sat, 20 Mar 2021 16:11:29 +0200 Subject: [PATCH 0087/1135] install: match GNU warning output --- src/uu/install/src/install.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index a675549d1..1ac9bc743 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -427,7 +427,7 @@ fn copy_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behavior) -> let mut all_successful = true; for sourcepath in files.iter() { if !sourcepath.exists() { - show_error!( + show_info!( "cannot stat '{}': No such file or directory", sourcepath.display() ); From 9b0eee9066238c6197b316259388437095429879 Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Sat, 20 Mar 2021 20:07:19 +0200 Subject: [PATCH 0088/1135] install: added additional tests --- tests/by-util/test_install.rs | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index a5ce040f7..88f4c85cc 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -360,7 +360,7 @@ fn test_install_target_file_dev_null() { } #[test] -fn test_install_copy_file_leading_dot() { +fn test_install_nested_paths_copy_file() { let (at, mut ucmd) = at_and_ucmd!(); let dir1 = "test_install_target_new_file_dir_l"; let dir2 = "test_install_target_new_file_dir_m"; @@ -376,3 +376,34 @@ fn test_install_copy_file_leading_dot() { .no_stderr(); assert!(at.file_exists(&format!("{}/{}", dir2, file1))); } + +#[test] +fn test_install_failing_omitting_directory() { + let (at, mut ucmd) = at_and_ucmd!(); + let dir1 = "source_dir"; + let file1 = "source_file"; + let dir2 = "target_dir"; + + at.mkdir(dir1); + at.mkdir(dir2); + at.touch(file1); + + let r = ucmd.arg(dir1).arg(file1).arg(dir2).run(); + assert!(r.code == Some(1)); + assert!(r.stderr.contains("omitting directory")); +} + +#[test] +fn test_install_failing_no_such_file() { + let (at, mut ucmd) = at_and_ucmd!(); + let file1 = "source_file"; + let file2 = "inexistent_file"; + let dir1 = "target_dir"; + + at.mkdir(dir1); + at.touch(file1); + + let r = ucmd.arg(file1).arg(file2).arg(dir1).run(); + assert!(r.code == Some(1)); + assert!(r.stderr.contains("No such file or directory")); +} From 220ca78c9bc81cd16425b9c79da06997161ae6b6 Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Sat, 20 Mar 2021 20:31:52 +0200 Subject: [PATCH 0089/1135] install: normalize test filenames --- tests/by-util/test_install.rs | 80 +++++++++++++++++------------------ 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 88f4c85cc..89dfb0e56 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -17,9 +17,9 @@ fn test_install_help() { #[test] fn test_install_basic() { let (at, mut ucmd) = at_and_ucmd!(); - let dir = "test_install_target_dir_dir_a"; - let file1 = "test_install_target_dir_file_a1"; - let file2 = "test_install_target_dir_file_a2"; + let dir = "target_dir"; + let file1 = "source_file1"; + let file2 = "source_file2"; at.touch(file1); at.touch(file2); @@ -34,7 +34,7 @@ fn test_install_basic() { #[test] fn test_install_twice_dir() { - let dir = "test_install_target_dir_dir_a"; + let dir = "dir"; let scene = TestScenario::new(util_name!()); scene.ucmd().arg("-d").arg(dir).succeeds(); @@ -47,9 +47,9 @@ fn test_install_twice_dir() { #[test] fn test_install_failing_not_dir() { let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_dir_file_a1"; - let file2 = "test_install_target_dir_file_a2"; - let file3 = "test_install_target_dir_file_a3"; + let file1 = "file1"; + let file2 = "file2"; + let file3 = "file3"; at.touch(file1); at.touch(file2); @@ -66,8 +66,8 @@ fn test_install_failing_not_dir() { #[test] fn test_install_unimplemented_arg() { let (at, mut ucmd) = at_and_ucmd!(); - let dir = "test_install_target_dir_dir_b"; - let file = "test_install_target_dir_file_b"; + let dir = "target_dir"; + let file = "source_file"; let context_arg = "--context"; at.touch(file); @@ -86,9 +86,9 @@ fn test_install_unimplemented_arg() { #[test] fn test_install_component_directories() { let (at, mut ucmd) = at_and_ucmd!(); - let component1 = "test_install_target_dir_component_c1"; - let component2 = "test_install_target_dir_component_c2"; - let component3 = "test_install_target_dir_component_c3"; + let component1 = "component1"; + let component2 = "component2"; + let component3 = "component3"; let directories_arg = "-d"; ucmd.args(&[directories_arg, component1, component2, component3]) @@ -104,10 +104,10 @@ fn test_install_component_directories() { fn test_install_mode_numeric() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; - let dir = "test_install_target_dir_dir_e"; - let dir2 = "test_install_target_dir_dir_e2"; + let dir = "dir1"; + let dir2 = "dir2"; - let file = "test_install_target_dir_file_e"; + let file = "file"; let mode_arg = "--mode=333"; at.touch(file); @@ -145,8 +145,8 @@ fn test_install_mode_numeric() { #[test] fn test_install_mode_symbolic() { let (at, mut ucmd) = at_and_ucmd!(); - let dir = "test_install_target_dir_dir_f"; - let file = "test_install_target_dir_file_f"; + let dir = "target_dir"; + let file = "source_file"; let mode_arg = "--mode=o+wx"; at.touch(file); @@ -163,8 +163,8 @@ fn test_install_mode_symbolic() { #[test] fn test_install_mode_failing() { let (at, mut ucmd) = at_and_ucmd!(); - let dir = "test_install_target_dir_dir_g"; - let file = "test_install_target_dir_file_g"; + let dir = "target_dir"; + let file = "source_file"; let mode_arg = "--mode=999"; at.touch(file); @@ -185,7 +185,7 @@ fn test_install_mode_failing() { #[test] fn test_install_mode_directories() { let (at, mut ucmd) = at_and_ucmd!(); - let component = "test_install_target_dir_component_h"; + let component = "component"; let directories_arg = "-d"; let mode_arg = "--mode=333"; @@ -203,8 +203,8 @@ fn test_install_mode_directories() { #[test] fn test_install_target_file() { let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_file_file_i1"; - let file2 = "test_install_target_file_file_i2"; + let file1 = "source_file"; + let file2 = "target_file"; at.touch(file1); at.touch(file2); @@ -217,8 +217,8 @@ fn test_install_target_file() { #[test] fn test_install_target_new_file() { let (at, mut ucmd) = at_and_ucmd!(); - let file = "test_install_target_new_filer_file_j"; - let dir = "test_install_target_new_file_dir_j"; + let file = "file"; + let dir = "target_dir"; at.touch(file); at.mkdir(dir); @@ -234,8 +234,8 @@ fn test_install_target_new_file() { #[test] fn test_install_target_new_file_with_group() { let (at, mut ucmd) = at_and_ucmd!(); - let file = "test_install_target_new_filer_file_j"; - let dir = "test_install_target_new_file_dir_j"; + let file = "file"; + let dir = "target_dir"; let gid = get_effective_gid(); at.touch(file); @@ -264,8 +264,8 @@ fn test_install_target_new_file_with_group() { #[test] fn test_install_target_new_file_with_owner() { let (at, mut ucmd) = at_and_ucmd!(); - let file = "test_install_target_new_filer_file_j"; - let dir = "test_install_target_new_file_dir_j"; + let file = "file"; + let dir = "target_dir"; let uid = get_effective_uid(); at.touch(file); @@ -294,9 +294,9 @@ fn test_install_target_new_file_with_owner() { #[test] fn test_install_target_new_file_failing_nonexistent_parent() { let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_new_file_failing_file_k1"; - let file2 = "test_install_target_new_file_failing_file_k2"; - let dir = "test_install_target_new_file_failing_dir_k"; + let file1 = "source_file"; + let file2 = "target_file"; + let dir = "target_dir"; at.touch(file1); @@ -312,8 +312,8 @@ fn test_install_target_new_file_failing_nonexistent_parent() { #[test] fn test_install_preserve_timestamps() { let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_dir_file_a1"; - let file2 = "test_install_target_dir_file_a2"; + let file1 = "source_file"; + let file2 = "target_file"; at.touch(file1); ucmd.arg(file1).arg(file2).arg("-p").succeeds().no_stderr(); @@ -338,8 +338,8 @@ fn test_install_preserve_timestamps() { #[test] fn test_install_copy_file() { let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_dir_file_a1"; - let file2 = "test_install_target_dir_file_a2"; + let file1 = "source_file"; + let file2 = "target_file"; at.touch(file1); ucmd.arg(file1).arg(file2).succeeds().no_stderr(); @@ -353,7 +353,7 @@ fn test_install_copy_file() { fn test_install_target_file_dev_null() { let (at, mut ucmd) = at_and_ucmd!(); let file1 = "/dev/null"; - let file2 = "test_install_target_file_file_i2"; + let file2 = "target_file"; ucmd.arg(file1).arg(file2).succeeds().no_stderr(); assert!(at.file_exists(file2)); @@ -362,9 +362,9 @@ fn test_install_target_file_dev_null() { #[test] fn test_install_nested_paths_copy_file() { let (at, mut ucmd) = at_and_ucmd!(); - let dir1 = "test_install_target_new_file_dir_l"; - let dir2 = "test_install_target_new_file_dir_m"; - let file1 = "test_install_target_file_file_l1"; + let file1 = "source_file"; + let dir1 = "source_dir"; + let dir2 = "target_dir"; at.mkdir(dir1); at.mkdir(dir2); @@ -380,8 +380,8 @@ fn test_install_nested_paths_copy_file() { #[test] fn test_install_failing_omitting_directory() { let (at, mut ucmd) = at_and_ucmd!(); - let dir1 = "source_dir"; let file1 = "source_file"; + let dir1 = "source_dir"; let dir2 = "target_dir"; at.mkdir(dir1); From 0a661a6da27af00751ccaf9ce1f89b5018739399 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sat, 20 Mar 2021 22:15:47 +0000 Subject: [PATCH 0090/1135] Remove use of which to set system binaries --- .github/workflows/GNU.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 299f333e1..1fcc7c721 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -60,7 +60,7 @@ jobs: ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" ./configure --quiet --disable-gcc-warnings #Add timeout to to protect against hangs - sed -i "s|\"\$@|$(which timeout) 600 \"\$@|" build-aux/test-driver + sed -i 's|"\$@|/usr/bin/timeout 600 "\$@|' build-aux/test-driver # Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile sed -i 's| tr | /usr/bin/tr |' tests/init.sh @@ -71,7 +71,7 @@ jobs: make tests/factor/t${i}.sh done grep -rl 'path_prepend_' tests/* | xargs sed -i 's|path_prepend_ ./src||' - sed -i -e 's|^seq |/usr/bin/seq |' -e "s|sha1sum |$(which sha1sum) |" tests/factor/t*sh + sed -i -e 's|^seq |/usr/bin/seq |' -e 's|sha1sum |/usr/bin/sha1sum |' tests/factor/t*sh # Remove tests checking for --version & --help # Not really interesting for us and logs are too big @@ -81,21 +81,21 @@ jobs: Makefile # Use the system coreutils where the test fails due to error in a util that is not the one being tested - sed -i "s|stat|$(which stat)|" tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh - sed -i "s|ls -|$(which ls) -|" tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh - sed -i "s|mkdir |$(which mkdir) |" tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i "s|timeout |$(which timeout) |" tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh - sed -i "s| timeout | $(which timeout) |" tests/tail-2/inotify-rotate.sh # Don't break the function called 'grep_timeout' - sed -i "s|chmod |$(which chmod) |" tests/du/inacc-dir.sh tests/mkdir/p-3.sh - sed -i "s|sort |$(which sort) |" tests/ls/hyperlink.sh tests/misc/test-N.sh - sed -i "s|split |$(which split) |" tests/misc/factor-parallel.sh - sed -i "s|truncate |$(which truncate) |" tests/split/fail.sh - sed -i "s|dd |$(which dd) |" tests/du/8gb.sh tests/tail-2/big-4gb.sh - sed -i "s|id -|$(which id) -|" tests/misc/runcon-no-reorder.sh + sed -i 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh + sed -i 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh tests/du/8gb.sh + sed -i 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh + sed -i 's|timeout |/usr/bin/timeout |' tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh + sed -i 's| timeout | /usr/bin/timeout |' tests/tail-2/inotify-rotate.sh # Don't break the function called 'grep_timeout' + sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh + sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/misc/test-N.sh + sed -i 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh + sed -i 's|truncate |/usr/bin/truncate |' tests/split/fail.sh + sed -i '|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh + sed -i 's|id -|/usr/bin/id -|' tests/misc/runcon-no-reorder.sh #Add specific timeout to tests that currently hang to limit time spent waiting - sed -i "s|seq \\$|$(which timeout) 0.1 seq \$|" tests/misc/seq-precision.sh tests/misc/seq-long-double.sh - sed -i "s|cat |$(which timeout) 0.1 cat |" tests/misc/cat-self.sh + sed -i 's|seq \$|/usr/bin/timeout 0.1 seq \$|' tests/misc/seq-precision.sh tests/misc/seq-long-double.sh + sed -i 's|cat |/usr/bin/timeout 0.1 cat |' tests/misc/cat-self.sh test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" From 4352d47ac31f6aab4968cfa3aa1cb54f75eed7ed Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Mar 2021 14:45:34 +0000 Subject: [PATCH 0091/1135] Don't fail the job if test-suite.log is missing --- .github/workflows/GNU.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 1fcc7c721..79ef69b8c 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -110,13 +110,18 @@ jobs: - name: Extract tests info shell: bash run: | - TOTAL=$( grep "# TOTAL:" gnu/tests/test-suite.log|cut -d' ' -f2-) - PASS=$( grep "# PASS:" gnu/tests/test-suite.log|cut -d' ' -f2-) - SKIP=$( grep "# SKIP:" gnu/tests/test-suite.log|cut -d' ' -f2-) - FAIL=$( grep "# FAIL:" gnu/tests/test-suite.log|cut -d' ' -f2-) - XPASS=$( grep "# XPASS:" gnu/tests/test-suite.log|cut -d' ' -f2-) - ERROR=$( grep "# ERROR:" gnu/tests/test-suite.log|cut -d' ' -f2-) - echo "::warning ::GNU testsuite = $TOTAL / $PASS / $FAIL / $ERROR" + if test -f gnu/tests/test-suite.log + then + TOTAL=$( grep "# TOTAL:" gnu/tests/test-suite.log|cut -d' ' -f2-) + PASS=$( grep "# PASS:" gnu/tests/test-suite.log|cut -d' ' -f2-) + SKIP=$( grep "# SKIP:" gnu/tests/test-suite.log|cut -d' ' -f2-) + FAIL=$( grep "# FAIL:" gnu/tests/test-suite.log|cut -d' ' -f2-) + XPASS=$( grep "# XPASS:" gnu/tests/test-suite.log|cut -d' ' -f2-) + ERROR=$( grep "# ERROR:" gnu/tests/test-suite.log|cut -d' ' -f2-) + echo "::warning ::GNU testsuite = $TOTAL / $PASS / $FAIL / $ERROR" + else + echo "::error ::Failed to get summary of test results" + fi - uses: actions/upload-artifact@v2 with: From 0f77b54aeb8c44ca61979d9a772abe0b2cba29d4 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Mar 2021 15:11:48 +0000 Subject: [PATCH 0092/1135] Fix typo --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 79ef69b8c..59ce82420 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -90,7 +90,7 @@ jobs: sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/misc/test-N.sh sed -i 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh sed -i 's|truncate |/usr/bin/truncate |' tests/split/fail.sh - sed -i '|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh + sed -i 's|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh sed -i 's|id -|/usr/bin/id -|' tests/misc/runcon-no-reorder.sh #Add specific timeout to tests that currently hang to limit time spent waiting From 25d4a083877db99af4887a1304afd245a94f0491 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 21 Mar 2021 16:18:06 +0100 Subject: [PATCH 0093/1135] ls: long format author, group and owner (#1850) This PR adds the options to customize what information is shown in long format regarding author, group & owner. Specifically it adds: - `--author`: shows the author, which is always the same as the owner. GNU has this feature because GNU/Hurd supports a difference between author and owner, but I don't think Rust supports GNU/Hurd, so I just used the owner. - `-G` & `--no-group`: hide the group information. - `-o`: hide the group and use long format (equivalent to `-lG`). - `-g`: hide the owner and use long format. The `-o` and `-g` options have some interesting behaviour that I had to account for. Some examples: - `-og` hides both group and owner. - `-ol` still hides the group. Same behaviour with variations such as `-o --format=long`, `-gl`, `-g --format=long` and `-ogl`. - They even retain some information when overridden by another format: `-oCl` (or `-o --format=vertical --format=long`) still hides the group. My previous solution for handling the behaviour where `-l1` shows the long format did not fit with these additions, so I had to rewrite that as well. The tests only cover the how many names (author, group and owner) are present in the output, so it can't distinguish between, for example, author & group and group & owner. --- src/uu/ls/src/ls.rs | 240 +++++++++++++++++++++++++++++++-------- tests/by-util/test_ls.rs | 151 ++++++++++++++++++++++++ 2 files changed, 345 insertions(+), 46 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 6ade9e2e6..a935eef54 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -78,6 +78,8 @@ pub mod options { pub static ONELINE: &str = "1"; pub static LONG: &str = "long"; pub static COLUMNS: &str = "C"; + pub static LONG_NO_OWNER: &str = "g"; + pub static LONG_NO_GROUP: &str = "o"; } pub mod files { pub static ALL: &str = "all"; @@ -96,6 +98,8 @@ pub mod options { pub static HUMAN_READABLE: &str = "human-readable"; pub static SI: &str = "si"; } + pub static AUTHOR: &str = "author"; + pub static NO_GROUP: &str = "no-group"; pub static FORMAT: &str = "format"; pub static SORT: &str = "sort"; pub static TIME: &str = "time"; @@ -161,26 +165,85 @@ struct Config { inode: bool, #[cfg(unix)] color: bool, + long: LongFormat, +} + +// Fields that can be removed or added to the long format +struct LongFormat { + author: bool, + group: bool, + owner: bool, } impl Config { fn from(options: clap::ArgMatches) -> Config { - let format = if let Some(format_) = options.value_of(options::FORMAT) { - match format_ { - "long" | "verbose" => Format::Long, - "single-column" => Format::OneLine, - "columns" => Format::Columns, - // below should never happen as clap already restricts the values. - _ => unreachable!("Invalid field for --format"), - } + let (mut format, opt) = if let Some(format_) = options.value_of(options::FORMAT) { + ( + match format_ { + "long" | "verbose" => Format::Long, + "single-column" => Format::OneLine, + "columns" | "vertical" => Format::Columns, + // below should never happen as clap already restricts the values. + _ => unreachable!("Invalid field for --format"), + }, + options::FORMAT, + ) } else if options.is_present(options::format::LONG) { - Format::Long - } else if options.is_present(options::format::ONELINE) { - Format::OneLine + (Format::Long, options::format::LONG) } else { - Format::Columns + (Format::Columns, options::format::COLUMNS) }; + // The -o and -g options are tricky. They cannot override with each + // other because it's possible to combine them. For example, the option + // -og should hide both owner and group. Furthermore, they are not + // reset if -l or --format=long is used. So these should just show the + // group: -gl or "-g --format=long". Finally, they are also not reset + // when switching to a different format option inbetween like this: + // -ogCl or "-og --format=vertical --format=long". + // + // -1 has a similar issue: it does nothing if the format is long. This + // actually makes it distinct from the --format=singe-column option, + // which always applies. + // + // The idea here is to not let these options override with the other + // options, but manually check the last index they occur. If this index + // is larger than the index for the other format options, we apply the + // long format. + match options.indices_of(opt).map(|x| x.max().unwrap()) { + None => { + if options.is_present(options::format::LONG_NO_GROUP) + || options.is_present(options::format::LONG_NO_OWNER) + { + format = Format::Long; + } else if options.is_present(options::format::ONELINE) { + format = Format::OneLine; + } + } + Some(mut idx) => { + if let Some(indices) = options.indices_of(options::format::LONG_NO_OWNER) { + let i = indices.max().unwrap(); + if i > idx { + format = Format::Long; + idx = i; + } + } + if let Some(indices) = options.indices_of(options::format::LONG_NO_GROUP) { + let i = indices.max().unwrap(); + if i > idx { + format = Format::Long; + idx = i; + } + } + if let Some(indices) = options.indices_of(options::format::ONELINE) { + let i = indices.max().unwrap(); + if i > idx && format != Format::Long { + format = Format::OneLine; + } + } + } + } + let files = if options.is_present(options::files::ALL) { Files::All } else if options.is_present(options::files::ALMOST_ALL) { @@ -241,6 +304,18 @@ impl Config { SizeFormat::Bytes }; + let long = { + let author = options.is_present(options::AUTHOR); + let group = !options.is_present(options::NO_GROUP) + && !options.is_present(options::format::LONG_NO_GROUP); + let owner = !options.is_present(options::format::LONG_NO_OWNER); + LongFormat { + author, + group, + owner, + } + }; + Config { format, files, @@ -258,6 +333,7 @@ impl Config { color, #[cfg(unix)] inode: options.is_present(options::INODE), + long, } } } @@ -284,7 +360,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .overrides_with_all(&[ options::FORMAT, options::format::COLUMNS, - options::format::ONELINE, options::format::LONG, ]), ) @@ -292,17 +367,40 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(options::format::COLUMNS) .short(options::format::COLUMNS) .help("Display the files in columns.") - ) - .arg( - Arg::with_name(options::format::ONELINE) - .short(options::format::ONELINE) - .help("List one file per line.") + .overrides_with_all(&[ + options::FORMAT, + options::format::COLUMNS, + options::format::LONG, + ]), ) .arg( Arg::with_name(options::format::LONG) .short("l") .long(options::format::LONG) .help("Display detailed information.") + .overrides_with_all(&[ + options::FORMAT, + options::format::COLUMNS, + options::format::ONELINE, + options::format::LONG, + ]), + ) + // The next three arguments do not override with the other format + // options, see the comment in Config::from for the reason. + .arg( + Arg::with_name(options::format::ONELINE) + .short(options::format::ONELINE) + .help("List one file per line.") + ) + .arg( + Arg::with_name(options::format::LONG_NO_GROUP) + .short(options::format::LONG_NO_GROUP) + .help("Long format without group information. Identical to --format=long with --no-group.") + ) + .arg( + Arg::with_name(options::format::LONG_NO_OWNER) + .short(options::format::LONG_NO_OWNER) + .help("Long format without owner information.") ) // Time arguments @@ -329,8 +427,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("If the long listing format (e.g., -l, -o) is being used, print the status \ change time (the ‘ctime’ in the inode) instead of the modification time. When \ explicitly sorting by time (--sort=time or -t) or when not using a long listing \ - format, sort according to the status change time.", - )) + format, sort according to the status change time.") + .overrides_with_all(&[ + options::TIME, + options::time::ACCESS, + options::time::CHANGE, + ]) + ) .arg( Arg::with_name(options::time::ACCESS) .short(options::time::ACCESS) @@ -338,6 +441,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { access time instead of the modification time. When explicitly sorting by time \ (--sort=time or -t) or when not using a long listing format, sort according to the \ access time.") + .overrides_with_all(&[ + options::TIME, + options::time::ACCESS, + options::time::CHANGE, + ]) ) // Sort arguments @@ -359,12 +467,24 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg( Arg::with_name(options::sort::SIZE) .short(options::sort::SIZE) - .help("Sort by file size, largest first."), + .help("Sort by file size, largest first.") + .overrides_with_all(&[ + options::SORT, + options::sort::SIZE, + options::sort::TIME, + options::sort::NONE, + ]) ) .arg( Arg::with_name(options::sort::TIME) .short(options::sort::TIME) - .help("Sort by modification time (the 'mtime' in the inode), newest first."), + .help("Sort by modification time (the 'mtime' in the inode), newest first.") + .overrides_with_all(&[ + options::SORT, + options::sort::SIZE, + options::sort::TIME, + options::sort::NONE, + ]) ) .arg( Arg::with_name(options::sort::NONE) @@ -372,8 +492,27 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("Do not sort; list the files in whatever order they are stored in the \ directory. This is especially useful when listing very large directories, \ since not doing any sorting can be noticeably faster.") + .overrides_with_all(&[ + options::SORT, + options::sort::SIZE, + options::sort::TIME, + options::sort::NONE, + ]) ) + // Long format options + .arg( + Arg::with_name(options::NO_GROUP) + .long(options::NO_GROUP) + .short("-G") + .help("Do not show group in long format.") + ) + .arg( + Arg::with_name(options::AUTHOR) + .long(options::AUTHOR) + .help("Show author in long format. On the supported platforms, the author \ + always matches the file owner.") + ) // Other Flags .arg( Arg::with_name(options::files::ALL) @@ -699,32 +838,45 @@ fn display_item_long( Ok(md) => md, }; - println!( - "{}{}{} {} {} {} {} {} {}", - get_inode(&md, config), + #[cfg(unix)] + { + if config.inode { + print!("{} ", get_inode(&md)); + } + } + + print!( + "{}{} {}", display_file_type(md.file_type()), display_permissions(&md), pad_left(display_symlink_count(&md), max_links), - display_uname(&md, config), - display_group(&md, config), + ); + + if config.long.owner { + print!(" {}", display_uname(&md, config)); + } + + if config.long.group { + print!(" {}", display_group(&md, config)); + } + + // Author is only different from owner on GNU/Hurd, so we reuse + // the owner, since GNU/Hurd is not currently supported by Rust. + if config.long.author { + print!(" {}", display_uname(&md, config)); + } + + println!( + " {} {} {}", pad_left(display_file_size(&md, config), max_size), display_date(&md, config), - display_file_name(&item, strip, &md, config).contents + display_file_name(&item, strip, &md, config).contents, ); } #[cfg(unix)] -fn get_inode(metadata: &Metadata, config: &Config) -> String { - if config.inode { - format!("{:8} ", metadata.ino()) - } else { - "".to_string() - } -} - -#[cfg(not(unix))] -fn get_inode(_metadata: &Metadata, _config: &Config) -> String { - "".to_string() +fn get_inode(metadata: &Metadata) -> String { + format!("{:8}", metadata.ino()) } // Currently getpwuid is `linux` target only. If it's broken out into @@ -808,7 +960,7 @@ fn format_prefixed(prefixed: NumberPrefix) -> String { NumberPrefix::Standalone(bytes) => bytes.to_string(), NumberPrefix::Prefixed(prefix, bytes) => { // Remove the "i" from "Ki", "Mi", etc. if present - let prefix_str = prefix.symbol().trim_end_matches("i"); + let prefix_str = prefix.symbol().trim_end_matches('i'); // Check whether we get more than 10 if we round up to the first decimal // because we want do display 9.81 as "9.9", not as "10". @@ -861,10 +1013,6 @@ fn display_file_name( ) -> Cell { let mut name = get_file_name(path, strip); - if config.format == Format::Long { - name = get_inode(metadata, config) + &name; - } - if config.classify { let file_type = metadata.file_type(); if file_type.is_dir() { @@ -922,8 +1070,8 @@ fn display_file_name( config: &Config, ) -> Cell { let mut name = get_file_name(path, strip); - if config.format != Format::Long { - name = get_inode(metadata, config) + &name; + if config.format != Format::Long && config.inode { + name = get_inode(metadata) + " " + &name; } let mut width = UnicodeWidthStr::width(&*name); diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index e0063aa1a..ac5e0c8b3 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -124,6 +124,108 @@ fn test_ls_long() { } } +#[test] +fn test_ls_long_formats() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.touch(&at.plus_as_string("test-long-formats")); + + // Regex for three names, so all of author, group and owner + let re_three = Regex::new(r"[xrw-]{9} \d ([-0-9_a-z]+ ){3}0").unwrap(); + + // Regex for two names, either: + // - group and owner + // - author and owner + // - author and group + let re_two = Regex::new(r"[xrw-]{9} \d ([-0-9_a-z]+ ){2}0").unwrap(); + + // Regex for one name: author, group or owner + let re_one = Regex::new(r"[xrw-]{9} \d [-0-9_a-z]+ 0").unwrap(); + + // Regex for no names + let re_zero = Regex::new(r"[xrw-]{9} \d 0").unwrap(); + + let result = scene + .ucmd() + .arg("-l") + .arg("--author") + .arg("test-long-formats") + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_three.is_match(&result.stdout)); + + let result = scene + .ucmd() + .arg("-l1") + .arg("--author") + .arg("test-long-formats") + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_three.is_match(&result.stdout)); + + for arg in &[ + "-l", // only group and owner + "-g --author", // only author and group + "-o --author", // only author and owner + "-lG --author", // only author and owner + "-l --no-group --author", // only author and owner + ] { + let result = scene + .ucmd() + .args(&arg.split(" ").collect::>()) + .arg("test-long-formats") + .succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_two.is_match(&result.stdout)); + } + + for arg in &[ + "-g", // only group + "-gl", // only group + "-o", // only owner + "-ol", // only owner + "-oG", // only owner + "-lG", // only owner + "-l --no-group", // only owner + "-gG --author", // only author + ] { + let result = scene + .ucmd() + .args(&arg.split(" ").collect::>()) + .arg("test-long-formats") + .succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_one.is_match(&result.stdout)); + } + + for arg in &[ + "-og", + "-ogl", + "-lgo", + "-gG", + "-g --no-group", + "-og --no-group", + "-og --format=long", + "-ogCl", + "-og --format=vertical -l", + "-og1", + "-og1l", + ] { + let result = scene + .ucmd() + .args(&arg.split(" ").collect::>()) + .arg("test-long-formats") + .succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_zero.is_match(&result.stdout)); + } +} + #[test] fn test_ls_oneline() { let scene = TestScenario::new(util_name!()); @@ -426,6 +528,55 @@ fn test_ls_ls_color() { assert_eq!(result.stdout, ""); } +#[cfg(unix)] +#[test] +fn test_ls_inode() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let file = "test_inode"; + at.touch(file); + + let re_short = Regex::new(r" *(\d+) test_inode").unwrap(); + let re_long = Regex::new(r" *(\d+) [xrw-]{10} \d .+ test_inode").unwrap(); + + let result = scene.ucmd().arg("test_inode").arg("-i").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_short.is_match(&result.stdout)); + let inode_short = re_short + .captures(&result.stdout) + .unwrap() + .get(1) + .unwrap() + .as_str(); + + let result = scene.ucmd().arg("test_inode").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(!re_short.is_match(&result.stdout)); + assert!(!result.stdout.contains(inode_short)); + + let result = scene.ucmd().arg("-li").arg("test_inode").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_long.is_match(&result.stdout)); + let inode_long = re_long + .captures(&result.stdout) + .unwrap() + .get(1) + .unwrap() + .as_str(); + + let result = scene.ucmd().arg("-l").arg("test_inode").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(!re_long.is_match(&result.stdout)); + assert!(!result.stdout.contains(inode_long)); + + assert_eq!(inode_short, inode_long) +} + #[cfg(not(any(target_vendor = "apple", target_os = "windows")))] // Truncate not available on mac or win #[test] fn test_ls_human_si() { From f60790dd411fbdc85a77eef24faab5c34422b00b Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Sun, 21 Mar 2021 18:18:47 +0300 Subject: [PATCH 0094/1135] chroot: move to clap from getopts (#1792) + add tests --- src/uu/chroot/Cargo.toml | 2 +- src/uu/chroot/src/chroot.rs | 122 +++++++++++++++++++++-------------- tests/by-util/test_chroot.rs | 99 +++++++++++++++++++++++++++- 3 files changed, 172 insertions(+), 51 deletions(-) diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index 7ad2f0908..e967d4137 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/chroot.rs" [dependencies] -getopts = "0.2.18" +clap= "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/chroot/src/chroot.rs b/src/uu/chroot/src/chroot.rs index ab654abf8..2c3bcbca4 100644 --- a/src/uu/chroot/src/chroot.rs +++ b/src/uu/chroot/src/chroot.rs @@ -10,60 +10,81 @@ #[macro_use] extern crate uucore; -use uucore::entries; -use uucore::libc::{self, chroot, setgid, setgroups, setuid}; - +use clap::{App, Arg}; use std::ffi::CString; use std::io::Error; use std::path::Path; use std::process::Command; +use uucore::entries; +use uucore::libc::{self, chroot, setgid, setgroups, setuid}; +static VERSION: &str = env!("CARGO_PKG_VERSION"); static NAME: &str = "chroot"; +static ABOUT: &str = "Run COMMAND with root directory set to NEWROOT."; static SYNTAX: &str = "[OPTION]... NEWROOT [COMMAND [ARG]...]"; -static SUMMARY: &str = "Run COMMAND with root directory set to NEWROOT."; -static LONG_HELP: &str = " - If COMMAND is not specified, it defaults to '$(SHELL) -i'. - If $(SHELL) is not set, /bin/sh is used. -"; + +mod options { + pub const NEWROOT: &str = "newroot"; + pub const USER: &str = "user"; + pub const GROUP: &str = "group"; + pub const GROUPS: &str = "groups"; + pub const USERSPEC: &str = "userspec"; +} pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optopt( - "u", - "user", - "User (ID or name) to switch before running the program", - "USER", + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(SYNTAX) + .arg(Arg::with_name(options::NEWROOT).hidden(true).required(true)) + .arg( + Arg::with_name(options::USER) + .short("u") + .long(options::USER) + .help("User (ID or name) to switch before running the program") + .value_name("USER"), ) - .optopt("g", "group", "Group (ID or name) to switch to", "GROUP") - .optopt( - "G", - "groups", - "Comma-separated list of groups to switch to", - "GROUP1,GROUP2...", + .arg( + Arg::with_name(options::GROUP) + .short("g") + .long(options::GROUP) + .help("Group (ID or name) to switch to") + .value_name("GROUP"), ) - .optopt( - "", - "userspec", - "Colon-separated user and group to switch to. \ + .arg( + Arg::with_name(options::GROUPS) + .short("G") + .long(options::GROUPS) + .help("Comma-separated list of groups to switch to") + .value_name("GROUP1,GROUP2..."), + ) + .arg( + Arg::with_name(options::USERSPEC) + .long(options::USERSPEC) + .help( + "Colon-separated user and group to switch to. \ Same as -u USER -g GROUP. \ Userspec has higher preference than -u and/or -g", - "USER:GROUP", + ) + .value_name("USER:GROUP"), ) - .parse(args); - - if matches.free.is_empty() { - println!("Missing operand: NEWROOT"); - println!("Try `{} --help` for more information.", NAME); - return 1; - } + .get_matches_from(args); let default_shell: &'static str = "/bin/sh"; let default_option: &'static str = "-i"; let user_shell = std::env::var("SHELL"); - let newroot = Path::new(&matches.free[0][..]); + let newroot: &Path = match matches.value_of(options::NEWROOT) { + Some(v) => Path::new(v), + None => crash!( + 1, + "Missing operand: NEWROOT\nTry '{} --help' for more information.", + NAME + ), + }; + if !newroot.is_dir() { crash!( 1, @@ -72,7 +93,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); } - let command: Vec<&str> = match matches.free.len() { + let command: Vec<&str> = match matches.args.len() { 1 => { let shell: &str = match user_shell { Err(_) => default_shell, @@ -80,7 +101,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; vec![shell, default_option] } - _ => matches.free[1..].iter().map(|x| &x[..]).collect(), + _ => { + let mut vector: Vec<&str> = Vec::new(); + for (&k, v) in matches.args.iter() { + vector.push(k.clone()); + vector.push(&v.vals[0].to_str().unwrap()); + } + vector + } }; set_context(&newroot, &matches); @@ -97,30 +125,26 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } -fn set_context(root: &Path, options: &getopts::Matches) { - let userspec_str = options.opt_str("userspec"); - let user_str = options.opt_str("user").unwrap_or_default(); - let group_str = options.opt_str("group").unwrap_or_default(); - let groups_str = options.opt_str("groups").unwrap_or_default(); +fn set_context(root: &Path, options: &clap::ArgMatches) { + let userspec_str = options.value_of(options::USERSPEC); + let user_str = options.value_of(options::USER).unwrap_or_default(); + let group_str = options.value_of(options::GROUP).unwrap_or_default(); + let groups_str = options.value_of(options::GROUPS).unwrap_or_default(); let userspec = match userspec_str { Some(ref u) => { let s: Vec<&str> = u.split(':').collect(); - if s.len() != 2 { + if s.len() != 2 || s.iter().any(|&spec| spec == "") { crash!(1, "invalid userspec: `{}`", u) }; s } None => Vec::new(), }; - let user = if userspec.is_empty() { - &user_str[..] + + let (user, group) = if userspec.is_empty() { + (&user_str[..], &group_str[..]) } else { - &userspec[0][..] - }; - let group = if userspec.is_empty() { - &group_str[..] - } else { - &userspec[1][..] + (&userspec[0][..], &userspec[1][..]) }; enter_chroot(root); diff --git a/tests/by-util/test_chroot.rs b/tests/by-util/test_chroot.rs index 651491045..9a8fb71dd 100644 --- a/tests/by-util/test_chroot.rs +++ b/tests/by-util/test_chroot.rs @@ -1 +1,98 @@ -// ToDO: add tests +use crate::common::util::*; + +#[test] +fn test_missing_operand() { + let result = new_ucmd!().run(); + + assert_eq!( + true, + result + .stderr + .starts_with("error: The following required arguments were not provided") + ); + + assert_eq!(true, result.stderr.contains("")); +} + +#[test] +fn test_enter_chroot_fails() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.mkdir("jail"); + + let result = ucmd.arg("jail").run(); + + assert_eq!( + true, + result.stderr.starts_with( + "chroot: error: cannot chroot to jail: Operation not permitted (os error 1)" + ) + ) +} + +#[test] +fn test_no_such_directory() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.touch(&at.plus_as_string("a")); + + ucmd.arg("a") + .fails() + .stderr_is("chroot: error: cannot change root directory to `a`: no such directory"); +} + +#[test] +fn test_invalid_user_spec() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.mkdir("a"); + + let result = ucmd.arg("a").arg("--userspec=ARABA:").run(); + + assert_eq!( + true, + result.stderr.starts_with("chroot: error: invalid userspec") + ); +} + +#[test] +fn test_preference_of_userspec() { + let scene = TestScenario::new(util_name!()); + let result = scene.cmd("whoami").run(); + if is_ci() && result.stderr.contains("No such user/group") { + // In the CI, some server are failing to return whoami. + // As seems to be a configuration issue, ignoring it + return; + } + println!("result.stdout {}", result.stdout); + println!("result.stderr = {}", result.stderr); + let username = result.stdout.trim_end(); + + let ts = TestScenario::new("id"); + let result = ts.cmd("id").arg("-g").arg("-n").run(); + println!("result.stdout {}", result.stdout); + println!("result.stderr = {}", result.stderr); + + if is_ci() && result.stderr.contains("cannot find name for user ID") { + // In the CI, some server are failing to return id. + // As seems to be a configuration issue, ignoring it + return; + } + + let group_name = result.stdout.trim_end(); + let (at, mut ucmd) = at_and_ucmd!(); + + at.mkdir("a"); + + let result = ucmd + .arg("a") + .arg("--user") + .arg("fake") + .arg("-G") + .arg("ABC,DEF") + .arg(format!("--userspec={}:{}", username, group_name)) + .run(); + + println!("result.stdout {}", result.stdout); + println!("result.stderr = {}", result.stderr); +} From ca8fbc37bfe5526af61d210480895069aecc8030 Mon Sep 17 00:00:00 2001 From: pedrohjordao Date: Sun, 21 Mar 2021 15:19:30 +0000 Subject: [PATCH 0095/1135] od: Changes command line parser to clap (#1849) --- Cargo.lock | 4 +- src/uu/od/Cargo.toml | 2 +- src/uu/od/src/od.rs | 361 ++++++++++++++++++++++++---------- src/uu/od/src/parse_inputs.rs | 40 ++-- 4 files changed, 284 insertions(+), 123 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8d4318dec..ad207edd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,3 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. [[package]] name = "advapi32-sys" version = "0.2.0" @@ -1868,7 +1866,7 @@ name = "uu_od" version = "0.0.4" dependencies = [ "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index 14aea59a7..e4db9faf0 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -16,7 +16,7 @@ path = "src/od.rs" [dependencies] byteorder = "1.3.2" -getopts = "0.2.18" +clap = "2.33" half = "1.6" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 47d3c29f8..791ddc4fc 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -41,15 +41,18 @@ use crate::parse_nrofbytes::parse_number_of_bytes; use crate::partialreader::*; use crate::peekreader::*; use crate::prn_char::format_ascii_dump; +use clap::{self, AppSettings, Arg, ArgMatches}; static VERSION: &str = env!("CARGO_PKG_VERSION"); const PEEK_BUFFER_SIZE: usize = 4; // utf-8 can be 4 bytes +static ABOUT: &str = "dump files in octal and other formats"; -static USAGE: &str = r#"Usage: +static USAGE: &str = r#" od [OPTION]... [--] [FILENAME]... od [-abcdDefFhHiIlLoOsxX] [FILENAME] [[+][0x]OFFSET[.][b]] - od --traditional [OPTION]... [FILENAME] [[+][0x]OFFSET[.][b] [[+][0x]LABEL[.][b]]] + od --traditional [OPTION]... [FILENAME] [[+][0x]OFFSET[.][b] [[+][0x]LABEL[.][b]]]"#; +static LONG_HELP: &str = r#" Displays data in various human-readable formats. If multiple formats are specified, the output will contain all formats in the order they appear on the command line. Each format will be printed on a new line. Only the line @@ -88,85 +91,18 @@ Any type specification can have a "z" suffix, which will add a ASCII dump at If an error occurred, a diagnostic message will be printed to stderr, and the exitcode will be non-zero."#; -fn create_getopts_options() -> getopts::Options { - let mut opts = getopts::Options::new(); - - opts.optopt( - "A", - "address-radix", - "Select the base in which file offsets are printed.", - "RADIX", - ); - opts.optopt( - "j", - "skip-bytes", - "Skip bytes input bytes before formatting and writing.", - "BYTES", - ); - opts.optopt( - "N", - "read-bytes", - "limit dump to BYTES input bytes", - "BYTES", - ); - opts.optopt( - "", - "endian", - "byte order to use for multi-byte formats", - "big|little", - ); - opts.optopt( - "S", - "strings", - "output strings of at least BYTES graphic chars. 3 is assumed when \ - BYTES is not specified.", - "BYTES", - ); - opts.optflagmulti("a", "", "named characters, ignoring high-order bit"); - opts.optflagmulti("b", "", "octal bytes"); - opts.optflagmulti("c", "", "ASCII characters or backslash escapes"); - opts.optflagmulti("d", "", "unsigned decimal 2-byte units"); - opts.optflagmulti("D", "", "unsigned decimal 4-byte units"); - opts.optflagmulti("o", "", "octal 2-byte units"); - - opts.optflagmulti("I", "", "decimal 8-byte units"); - opts.optflagmulti("L", "", "decimal 8-byte units"); - opts.optflagmulti("i", "", "decimal 4-byte units"); - opts.optflagmulti("l", "", "decimal 8-byte units"); - opts.optflagmulti("x", "", "hexadecimal 2-byte units"); - opts.optflagmulti("h", "", "hexadecimal 2-byte units"); - - opts.optflagmulti("O", "", "octal 4-byte units"); - opts.optflagmulti("s", "", "decimal 2-byte units"); - opts.optflagmulti("X", "", "hexadecimal 4-byte units"); - opts.optflagmulti("H", "", "hexadecimal 4-byte units"); - - opts.optflagmulti("e", "", "floating point double precision (64-bit) units"); - opts.optflagmulti("f", "", "floating point single precision (32-bit) units"); - opts.optflagmulti("F", "", "floating point double precision (64-bit) units"); - - opts.optmulti("t", "format", "select output format or formats", "TYPE"); - opts.optflag( - "v", - "output-duplicates", - "do not use * to mark line suppression", - ); - opts.optflagopt( - "w", - "width", - "output BYTES bytes per output line. 32 is implied when BYTES is not \ - specified.", - "BYTES", - ); - opts.optflag("", "help", "display this help and exit."); - opts.optflag("", "version", "output version information and exit."); - opts.optflag( - "", - "traditional", - "compatibility mode with one input, offset and label.", - ); - - opts +pub(crate) mod options { + pub const ADDRESS_RADIX: &str = "address-radix"; + pub const SKIP_BYTES: &str = "skip-bytes"; + pub const READ_BYTES: &str = "read-bytes"; + pub const ENDIAN: &str = "endian"; + pub const STRINGS: &str = "strings"; + pub const FORMAT: &str = "format"; + pub const OUTPUT_DUPLICATES: &str = "output-duplicates"; + pub const TRADITIONAL: &str = "traditional"; + pub const WIDTH: &str = "width"; + pub const VERSION: &str = "version"; + pub const FILENAME: &str = "FILENAME"; } struct OdOptions { @@ -182,8 +118,8 @@ struct OdOptions { } impl OdOptions { - fn new(matches: getopts::Matches, args: Vec) -> Result { - let byte_order = match matches.opt_str("endian").as_ref().map(String::as_ref) { + fn new<'a>(matches: ArgMatches<'a>, args: Vec) -> Result { + let byte_order = match matches.value_of(options::ENDIAN) { None => ByteOrder::Native, Some("little") => ByteOrder::Little, Some("big") => ByteOrder::Big, @@ -192,7 +128,7 @@ impl OdOptions { } }; - let mut skip_bytes = match matches.opt_default("skip-bytes", "0") { + let mut skip_bytes = match matches.value_of(options::SKIP_BYTES) { None => 0, Some(s) => match parse_number_of_bytes(&s) { Ok(i) => i, @@ -223,8 +159,9 @@ impl OdOptions { } }; - let mut line_bytes = match matches.opt_default("w", "32") { + let mut line_bytes = match matches.value_of(options::WIDTH) { None => 16, + Some(_) if matches.occurrences_of(options::WIDTH) == 0 => 16, Some(s) => s.parse::().unwrap_or(0), }; let min_bytes = formats.iter().fold(1, |max, next| { @@ -235,9 +172,9 @@ impl OdOptions { line_bytes = min_bytes; } - let output_duplicates = matches.opt_present("v"); + let output_duplicates = matches.is_present(options::OUTPUT_DUPLICATES); - let read_bytes = match matches.opt_str("read-bytes") { + let read_bytes = match matches.value_of(options::READ_BYTES) { None => None, Some(s) => match parse_number_of_bytes(&s) { Ok(i) => Some(i), @@ -247,10 +184,10 @@ impl OdOptions { }, }; - let radix = match matches.opt_str("A") { + let radix = match matches.value_of(options::ADDRESS_RADIX) { None => Radix::Octal, Some(s) => { - let st = s.into_bytes(); + let st = s.as_bytes(); if st.len() != 1 { return Err("Radix must be one of [d, o, n, x]".to_string()); } else { @@ -286,26 +223,244 @@ impl OdOptions { pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let opts = create_getopts_options(); + let clap_opts = clap::App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(USAGE) + .after_help(LONG_HELP) + .arg( + Arg::with_name(options::ADDRESS_RADIX) + .short("A") + .long(options::ADDRESS_RADIX) + .help("Select the base in which file offsets are printed.") + .value_name("RADIX"), + ) + .arg( + Arg::with_name(options::SKIP_BYTES) + .short("j") + .long(options::SKIP_BYTES) + .help("Skip bytes input bytes before formatting and writing.") + .value_name("BYTES"), + ) + .arg( + Arg::with_name(options::READ_BYTES) + .short("N") + .long(options::READ_BYTES) + .help("limit dump to BYTES input bytes") + .value_name("BYTES"), + ) + .arg( + Arg::with_name(options::ENDIAN) + .long(options::ENDIAN) + .help("byte order to use for multi-byte formats") + .possible_values(&["big", "little"]) + .value_name("big|little"), + ) + .arg( + Arg::with_name(options::STRINGS) + .short("S") + .long(options::STRINGS) + .help( + "output strings of at least BYTES graphic chars. 3 is assumed when \ + BYTES is not specified.", + ) + .default_value("3") + .value_name("BYTES"), + ) + .arg( + Arg::with_name("a") + .short("a") + .help("named characters, ignoring high-order bit") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("b") + .short("b") + .help("octal bytes") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("c") + .short("c") + .help("ASCII characters or backslash escapes") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("d") + .short("d") + .help("unsigned decimal 2-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("D") + .short("D") + .help("unsigned decimal 4-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("o") + .short("o") + .help("octal 2-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("I") + .short("I") + .help("decimal 8-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("L") + .short("L") + .help("decimal 8-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("i") + .short("i") + .help("decimal 4-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("l") + .short("l") + .help("decimal 8-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("x") + .short("x") + .help("hexadecimal 2-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("h") + .short("h") + .help("hexadecimal 2-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("O") + .short("O") + .help("octal 4-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("s") + .short("s") + .help("decimal 2-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("X") + .short("X") + .help("hexadecimal 4-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("H") + .short("H") + .help("hexadecimal 4-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("e") + .short("e") + .help("floating point double precision (64-bit) units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("f") + .short("f") + .help("floating point double precision (32-bit) units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("F") + .short("F") + .help("floating point double precision (64-bit) units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name(options::FORMAT) + .short("t") + .long(options::FORMAT) + .help("select output format or formats") + .multiple(true) + .value_name("TYPE"), + ) + .arg( + Arg::with_name(options::OUTPUT_DUPLICATES) + .short("v") + .long(options::OUTPUT_DUPLICATES) + .help("do not use * to mark line suppression") + .takes_value(false) + .possible_values(&["big", "little"]), + ) + .arg( + Arg::with_name(options::WIDTH) + .short("w") + .long(options::WIDTH) + .help( + "output BYTES bytes per output line. 32 is implied when BYTES is not \ + specified.", + ) + .default_value("32") + .value_name("BYTES"), + ) + .arg( + Arg::with_name(options::VERSION) + .long(options::VERSION) + .help("output version information and exit.") + .takes_value(false), + ) + .arg( + Arg::with_name(options::TRADITIONAL) + .long(options::TRADITIONAL) + .help("compatibility mode with one input, offset and label.") + .takes_value(false), + ) + .arg( + Arg::with_name(options::FILENAME) + .hidden(true) + .multiple(true) + ) + .settings(&[ + AppSettings::TrailingVarArg, + AppSettings::DontDelimitTrailingValues, + AppSettings::DisableVersion, + AppSettings::DeriveDisplayOrder, + ]); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_usage_error!("{}", f); - return 1; - } - }; + let clap_matches = clap_opts + .clone() // Clone to reuse clap_otps to print help + .get_matches_from(args.clone()); - if matches.opt_present("help") { - println!("{}", opts.usage(&USAGE)); - return 0; - } - if matches.opt_present("version") { + if clap_matches.is_present(options::VERSION) { println!("{} {}", executable!(), VERSION); return 0; } - let od_options = match OdOptions::new(matches, args) { + let od_options = match OdOptions::new(clap_matches, args) { Err(s) => { show_usage_error!("{}", s); return 1; diff --git a/src/uu/od/src/parse_inputs.rs b/src/uu/od/src/parse_inputs.rs index 89a833d94..915aa1d92 100644 --- a/src/uu/od/src/parse_inputs.rs +++ b/src/uu/od/src/parse_inputs.rs @@ -1,20 +1,24 @@ -use getopts::Matches; +use super::options; +use clap::ArgMatches; /// Abstraction for getopts pub trait CommandLineOpts { /// returns all command line parameters which do not belong to an option. - fn inputs(&self) -> Vec; + fn inputs(&self) -> Vec<&str>; /// tests if any of the specified options is present. fn opts_present(&self, _: &[&str]) -> bool; } /// Implementation for `getopts` -impl CommandLineOpts for Matches { - fn inputs(&self) -> Vec { - self.free.clone() +impl<'a> CommandLineOpts for ArgMatches<'a> { + fn inputs(&self) -> Vec<&str> { + self.values_of(options::FILENAME) + .map(|values| values.collect()) + .unwrap_or_default() } + fn opts_present(&self, opts: &[&str]) -> bool { - self.opts_present(&opts.iter().map(|s| (*s).to_string()).collect::>()) + opts.iter().any(|opt| self.is_present(opt)) } } @@ -39,7 +43,7 @@ pub enum CommandLineInputs { /// '-' is used as filename if stdin is meant. This is also returned if /// there is no input, as stdin is the default input. pub fn parse_inputs(matches: &dyn CommandLineOpts) -> Result { - let mut input_strings: Vec = matches.inputs(); + let mut input_strings = matches.inputs(); if matches.opts_present(&["traditional"]) { return parse_inputs_traditional(input_strings); @@ -59,7 +63,7 @@ pub fn parse_inputs(matches: &dyn CommandLineOpts) -> Result Result) -> Result { +pub fn parse_inputs_traditional(input_strings: Vec<&str>) -> Result { match input_strings.len() { 0 => Ok(CommandLineInputs::FileNames(vec!["-".to_string()])), 1 => { let offset0 = parse_offset_operand(&input_strings[0]); Ok(match offset0 { Ok(n) => CommandLineInputs::FileAndOffset(("-".to_string(), n, None)), - _ => CommandLineInputs::FileNames(input_strings), + _ => CommandLineInputs::FileNames( + input_strings.iter().map(|s| s.to_string()).collect(), + ), }) } 2 => { @@ -98,7 +106,7 @@ pub fn parse_inputs_traditional(input_strings: Vec) -> Result Ok(CommandLineInputs::FileAndOffset(( - input_strings[0].clone(), + input_strings[0].clone().to_owned(), m, None, ))), @@ -110,7 +118,7 @@ pub fn parse_inputs_traditional(input_strings: Vec) -> Result Ok(CommandLineInputs::FileAndOffset(( - input_strings[0].clone(), + input_strings[0].clone().to_owned(), n, Some(m), ))), @@ -178,8 +186,8 @@ mod tests { } impl<'a> CommandLineOpts for MockOptions<'a> { - fn inputs(&self) -> Vec { - self.inputs.clone() + fn inputs(&self) -> Vec<&str> { + self.inputs.iter().map(|s| s.as_str()).collect() } fn opts_present(&self, opts: &[&str]) -> bool { for expected in opts.iter() { From 734368bc92e8f4093bf109a60c126b61f8bac499 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 21 Mar 2021 17:03:58 +0100 Subject: [PATCH 0096/1135] refresh cargo.lock with recent updates --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index ad207edd3..e5852987e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1410,7 +1410,7 @@ dependencies = [ name = "uu_chroot" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", ] From 6c9841534020eacc62aee5e450f57d1439db295e Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Sun, 21 Mar 2021 23:27:44 +0300 Subject: [PATCH 0097/1135] fix(head): check the whether file exists before unwrap (#1858) closes https://github.com/uutils/coreutils/issues/1800 --- src/uu/head/src/head.rs | 7 +++++++ tests/by-util/test_head.rs | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index ae5807c22..0036dbba9 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -149,6 +149,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { first_time = false; let path = Path::new(file); + if path.is_dir() || !path.metadata().is_ok() { + eprintln!( + "cannot open '{}' for reading: No such file or directory", + &path.to_str().unwrap() + ); + continue; + } let reader = File::open(&path).unwrap(); let mut buffer = BufReader::new(reader); if !head(&mut buffer, &settings) { diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index eec82b51f..a1086c004 100644 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -167,3 +167,15 @@ fn test_bug_in_negative_zero_lines() { //GNU Head returns "a\nb\n" .stdout_is(""); } + +#[test] +fn test_no_such_file_or_directory() { + let result = new_ucmd!().arg("no_such_file.toml").run(); + + assert_eq!( + true, + result + .stderr + .contains("cannot open 'no_such_file.toml' for reading: No such file or directory") + ) +} From 40677bdc7a367b85dc0b0a40fb2f52a776ecda6f Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Mar 2021 20:49:15 +0000 Subject: [PATCH 0098/1135] Fix more problems with utils that aren't being tested --- .github/workflows/GNU.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 59ce82420..5b8742b6b 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -84,14 +84,20 @@ jobs: sed -i 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh sed -i 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh tests/du/8gb.sh sed -i 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i 's|timeout |/usr/bin/timeout |' tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh - sed -i 's| timeout | /usr/bin/timeout |' tests/tail-2/inotify-rotate.sh # Don't break the function called 'grep_timeout' - sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh + sed -i 's|timeout \([[:digit:]]\)| /usr/bin/timeout \1|' tests/tail-2/inotify-rotate.sh tests/tail-2/inotify-dir-recreate.sh tests/tail-2/inotify-rotate-resources.sh tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh tests/tail-2/follow-name.sh + # Don't break the function called 'grep_timeout' + sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh tests/tail-2/tail-n0f.sh tests/cp/fail-perm.sh tests/du/inaccessible-cwd.sh tests/mv/i-2.sh sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/misc/test-N.sh sed -i 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh sed -i 's|truncate |/usr/bin/truncate |' tests/split/fail.sh - sed -i 's|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh + sed -i 's|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh tests/cp/fiemap-2.sh tests/init.sh sed -i 's|id -|/usr/bin/id -|' tests/misc/runcon-no-reorder.sh + sed -i 's|touch |/usr/bin/touch |' tests/cp/preserve-link.sh tests/cp/reflink-perm.sh tests/ls/block-size.sh tests/ls/abmon-align.sh tests/ls/rt-1.sh tests/mv/update.sh tests/misc/ls-time.sh tests/misc/stat-nanoseconds.sh tests/misc/time-style.sh tests/misc/test-N.sh + sed -i 's|ln -|/usr/bin/ln -|' tests/cp/link-deref.sh + sed -i 's|printf |/usr/bin/printf |' tests/dd/ascii.sh + sed -i 's|cp |/usr/bin/cp |' tests/mv/hard-2.sh + sed -i 's|paste |/usr/bin/paste |' tests/misc/od-endian.sh + sed -i 's|seq |/usr/bin/seq |' tests/misc/sort-discrim.sh #Add specific timeout to tests that currently hang to limit time spent waiting sed -i 's|seq \$|/usr/bin/timeout 0.1 seq \$|' tests/misc/seq-precision.sh tests/misc/seq-long-double.sh From 21be280c5a3f9f13b740db9f5f4e48dd0cb7c207 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 21 Mar 2021 22:21:57 +0100 Subject: [PATCH 0099/1135] rustfmt the od changes --- src/uu/od/src/od.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 791ddc4fc..c3b39fca1 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -442,7 +442,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg( Arg::with_name(options::FILENAME) .hidden(true) - .multiple(true) + .multiple(true), ) .settings(&[ AppSettings::TrailingVarArg, From 027d5e6d9d848a5f58389db79591b63763d9011f Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Mar 2021 22:31:15 +0000 Subject: [PATCH 0100/1135] Fix yaml syntax --- .github/workflows/GNU.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 5b8742b6b..f89621e3f 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -84,8 +84,7 @@ jobs: sed -i 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh sed -i 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh tests/du/8gb.sh sed -i 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i 's|timeout \([[:digit:]]\)| /usr/bin/timeout \1|' tests/tail-2/inotify-rotate.sh tests/tail-2/inotify-dir-recreate.sh tests/tail-2/inotify-rotate-resources.sh tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh tests/tail-2/follow-name.sh - # Don't break the function called 'grep_timeout' + sed -i 's|timeout \([[:digit:]]\)| /usr/bin/timeout \1|' tests/tail-2/inotify-rotate.sh tests/tail-2/inotify-dir-recreate.sh tests/tail-2/inotify-rotate-resources.sh tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh tests/tail-2/follow-name.sh # Don't break the function called 'grep_timeout' sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh tests/tail-2/tail-n0f.sh tests/cp/fail-perm.sh tests/du/inaccessible-cwd.sh tests/mv/i-2.sh sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/misc/test-N.sh sed -i 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh From 27b7552ef4a8986b0e931718563021ee7270fc22 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Mon, 22 Mar 2021 12:01:54 +0300 Subject: [PATCH 0101/1135] fix(tail): add support for negative indexing (#1865) closes: https://github.com/uutils/coreutils/issues/1860 --- src/uu/tail/src/tail.rs | 6 ++++-- tests/by-util/test_tail.rs | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index cd391a53e..3a6b04b29 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -80,6 +80,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .short("c") .long(options::BYTES) .takes_value(true) + .allow_hyphen_values(true) .help("Number of bytes to print"), ) .arg( @@ -93,6 +94,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .short("n") .long(options::LINES) .takes_value(true) + .allow_hyphen_values(true) .help("Number of lines to print"), ) .arg( @@ -343,9 +345,9 @@ pub fn parse_size(mut size_slice: &str) -> Result { // sole B is not a valid suffix Err(ParseSizeErr::parse_failure(size_slice)) } else { - let value: Option = size_slice.parse().ok(); + let value: Option = size_slice.parse().ok(); value - .map(|v| Ok(multiplier * v)) + .map(|v| Ok((multiplier as i64 * v.abs()) as u64)) .unwrap_or_else(|| Err(ParseSizeErr::parse_failure(size_slice))) } } diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 458fc6aa7..5edff4d55 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -329,3 +329,17 @@ fn test_multiple_input_quiet_flag_overrides_verbose_flag_for_suppressing_headers .run() .stdout_is_fixture("foobar_multiple_quiet.expected"); } + +#[test] +fn test_negative_indexing() { + let positive_lines_index = new_ucmd!().arg("-n").arg("5").arg(FOOBAR_TXT).run(); + + let negative_lines_index = new_ucmd!().arg("-n").arg("-5").arg(FOOBAR_TXT).run(); + + let positive_bytes_index = new_ucmd!().arg("-c").arg("20").arg(FOOBAR_TXT).run(); + + let negative_bytes_index = new_ucmd!().arg("-c").arg("-20").arg(FOOBAR_TXT).run(); + + assert_eq!(positive_lines_index.stdout, negative_lines_index.stdout); + assert_eq!(positive_bytes_index.stdout, negative_bytes_index.stdout); +} From b9662c78a5c520b8661f7a27227b2331e069d725 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 22 Mar 2021 10:14:59 +0100 Subject: [PATCH 0102/1135] ls: possible fix for access time tests (#1866) --- tests/by-util/test_ls.rs | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index ac5e0c8b3..4fd35a286 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -344,6 +344,7 @@ fn test_ls_order_time() { sleep(Duration::from_millis(100)); at.touch("test-2"); at.append("test-2", "22"); + sleep(Duration::from_millis(100)); at.touch("test-3"); at.append("test-3", "333"); @@ -361,6 +362,7 @@ fn test_ls_order_time() { at.metadata("test-2").permissions(), ) .unwrap(); + let second_access = at.open("test-2").metadata().unwrap().accessed().unwrap(); let result = scene.ucmd().arg("-al").run(); println!("stderr = {:?}", result.stderr); @@ -392,13 +394,23 @@ fn test_ls_order_time() { println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); assert!(result.success); - #[cfg(not(windows))] - assert_eq!(result.stdout, "test-3\ntest-4\ntest-2\ntest-1\n"); - - // Access time does not seem to be set on Windows on read call - // so the order is 4 3 2 1 - #[cfg(windows)] - assert_eq!(result.stdout, "test-4 test-3 test-2 test-1\n"); + let file3_access = at.open("test-3").metadata().unwrap().accessed().unwrap(); + let file4_access = at.open("test-4").metadata().unwrap().accessed().unwrap(); + if file3_access > file4_access { + if cfg!(not(windows)) { + assert_eq!(result.stdout, "test-3\ntest-4\ntest-2\ntest-1\n"); + } else { + assert_eq!(result.stdout, "test-3 test-4 test-2 test-1\n"); + } + } else { + // Access time does not seem to be set on Windows and some other + // systems so the order is 4 3 2 1 + if cfg!(not(windows)) { + assert_eq!(result.stdout, "test-4\ntest-3\ntest-2\ntest-1\n"); + } else { + assert_eq!(result.stdout, "test-4 test-3 test-2 test-1\n"); + } + } // test-2 had the last ctime change when the permissions were set // So the order should be 2 4 3 1 From 93c7cbe65e0d4a189960772a4f4f32c718096e59 Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Mon, 22 Mar 2021 12:13:38 +0200 Subject: [PATCH 0103/1135] documentation for usual macros - removed repeat_str helper as it's now part of std - added docstrings for usual macros and test utils --- src/uucore/src/lib/macros.rs | 16 ++++++++++++++++ tests/by-util/test_pathchk.rs | 2 +- tests/common/macros.rs | 35 +++++++++++++++++++++++++++++++++++ tests/common/util.rs | 24 ++++++++++++++---------- 4 files changed, 66 insertions(+), 11 deletions(-) diff --git a/src/uucore/src/lib/macros.rs b/src/uucore/src/lib/macros.rs index 0aa6d8f0a..6836f81aa 100644 --- a/src/uucore/src/lib/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -5,6 +5,9 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +/// Deduce the name of the binary from the current source code filename. +/// +/// e.g.: `src/uu/cp/src/cp.rs` -> `cp` #[macro_export] macro_rules! executable( () => ({ @@ -18,6 +21,7 @@ macro_rules! executable( }) ); +/// Show an error to stderr in a silimar style to GNU coreutils. #[macro_export] macro_rules! show_error( ($($args:tt)+) => ({ @@ -26,6 +30,7 @@ macro_rules! show_error( }) ); +/// Show a warning to stderr in a silimar style to GNU coreutils. #[macro_export] macro_rules! show_warning( ($($args:tt)+) => ({ @@ -34,6 +39,7 @@ macro_rules! show_warning( }) ); +/// Show an info message to stderr in a silimar style to GNU coreutils. #[macro_export] macro_rules! show_info( ($($args:tt)+) => ({ @@ -42,6 +48,7 @@ macro_rules! show_info( }) ); +/// Show a bad inocation help message in a similar style to GNU coreutils. #[macro_export] macro_rules! show_usage_error( ($($args:tt)+) => ({ @@ -51,6 +58,7 @@ macro_rules! show_usage_error( }) ); +/// Display the provided error message, then `exit()` with the provided exit code #[macro_export] macro_rules! crash( ($exit_code:expr, $($args:tt)+) => ({ @@ -59,6 +67,7 @@ macro_rules! crash( }) ); +/// Calls `exit()` with the provided exit code. #[macro_export] macro_rules! exit( ($exit_code:expr) => ({ @@ -66,6 +75,8 @@ macro_rules! exit( }) ); +/// Unwraps the Result. Instead of panicking, it exists the program with the +/// provided exit code. #[macro_export] macro_rules! crash_if_err( ($exit_code:expr, $exp:expr) => ( @@ -76,6 +87,9 @@ macro_rules! crash_if_err( ) ); +/// Unwraps the Result. Instead of panicking, it shows the error and then +/// returns from the function with the provided exit code. +/// Assumes the current function returns an i32 value. #[macro_export] macro_rules! return_if_err( ($exit_code:expr, $exp:expr) => ( @@ -109,6 +123,8 @@ macro_rules! safe_writeln( ) ); +/// Unwraps the Result. Instead of panicking, it exists the program with exit +/// code 1. #[macro_export] macro_rules! safe_unwrap( ($exp:expr) => ( diff --git a/tests/by-util/test_pathchk.rs b/tests/by-util/test_pathchk.rs index bdce377b3..e24a464e0 100644 --- a/tests/by-util/test_pathchk.rs +++ b/tests/by-util/test_pathchk.rs @@ -9,7 +9,7 @@ fn test_default_mode() { // fail on long inputs new_ucmd!() - .args(&[repeat_str("test", 20000)]) + .args(&["test".repeat(20000)]) .fails() .no_stdout(); } diff --git a/tests/common/macros.rs b/tests/common/macros.rs index 645cfcc67..32ff7cbe8 100644 --- a/tests/common/macros.rs +++ b/tests/common/macros.rs @@ -1,3 +1,6 @@ +/// Assertion helper macro for [`CmdResult`] types +/// +/// [`CmdResult`]: crate::tests::common::util::CmdResult #[macro_export] macro_rules! assert_empty_stderr( ($cond:expr) => ( @@ -7,6 +10,9 @@ macro_rules! assert_empty_stderr( ); ); +/// Assertion helper macro for [`CmdResult`] types +/// +/// [`CmdResult`]: crate::tests::common::util::CmdResult #[macro_export] macro_rules! assert_empty_stdout( ($cond:expr) => ( @@ -16,6 +22,9 @@ macro_rules! assert_empty_stdout( ); ); +/// Assertion helper macro for [`CmdResult`] types +/// +/// [`CmdResult`]: crate::tests::common::util::CmdResult #[macro_export] macro_rules! assert_no_error( ($cond:expr) => ( @@ -26,6 +35,7 @@ macro_rules! assert_no_error( ); ); +/// Platform-independent helper for constructing a PathBuf from individual elements #[macro_export] macro_rules! path_concat { ($e:expr, ..$n:expr) => {{ @@ -47,6 +57,9 @@ macro_rules! path_concat { }}; } +/// Deduce the name of the test binary from the test filename. +/// +/// e.g.: `tests/by-util/test_cat.rs` -> `cat` #[macro_export] macro_rules! util_name { () => { @@ -54,6 +67,16 @@ macro_rules! util_name { }; } +/// Convenience macro for acquiring a [`UCommand`] builder. +/// +/// Returns the following: +/// - a [`UCommand`] builder for invoking the binary to be tested +/// +/// This macro is intended for quick, single-call tests. For more complex tests +/// that require multiple invocations of the tested binary, see [`TestScenario`] +/// +/// [`UCommand`]: crate::tests::common::util::UCommand +/// [`TestScenario]: crate::tests::common::util::TestScenario #[macro_export] macro_rules! new_ucmd { () => { @@ -61,6 +84,18 @@ macro_rules! new_ucmd { }; } +/// Convenience macro for acquiring a [`UCommand`] builder and a test path. +/// +/// Returns a tuple containing the following: +/// - an [`AsPath`] that points to a unique temporary test directory +/// - a [`UCommand`] builder for invoking the binary to be tested +/// +/// This macro is intended for quick, single-call tests. For more complex tests +/// that require multiple invocations of the tested binary, see [`TestScenario`] +/// +/// [`UCommand`]: crate::tests::common::util::UCommand +/// [`AsPath`]: crate::tests::common::util::AsPath +/// [`TestScenario]: crate::tests::common::util::TestScenario #[macro_export] macro_rules! at_and_ucmd { () => {{ diff --git a/tests/common/util.rs b/tests/common/util.rs index 0f1acd49a..a2fab66c6 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] + use std::env; use std::ffi::OsStr; use std::fs::{self, File, OpenOptions}; @@ -27,7 +29,7 @@ static ALREADY_RUN: &str = " you have already run this UCommand, if you want to testing();"; static MULTIPLE_STDIN_MEANINGLESS: &str = "Ucommand is designed around a typical use case of: provide args and input stream -> spawn process -> block until completion -> return output streams. For verifying that a particular section of the input stream is what causes a particular behavior, use the Command type directly."; -/// Test if the program are running under CI +/// Test if the program is running under CI pub fn is_ci() -> bool { std::env::var("CI") .unwrap_or(String::from("false")) @@ -55,14 +57,6 @@ fn read_scenario_fixture>(tmpd: &Option>, file_rel_p AtPath::new(tmpdir_path).read(file_rel_path.as_ref().to_str().unwrap()) } -pub fn repeat_str(s: &str, n: u32) -> String { - let mut repeated = String::new(); - for _ in 0..n { - repeated.push_str(s); - } - repeated -} - /// A command result is the outputs of a command (streams and status code) /// within a struct which has convenience assertion functions about those outputs #[derive(Debug)] @@ -384,8 +378,10 @@ impl AtPath { /// An environment for running a single uutils test case, serves three functions: /// 1. centralizes logic for locating the uutils binary and calling the utility -/// 2. provides a temporary directory for the test case +/// 2. provides a unique temporary directory for the test case /// 3. copies over fixtures for the utility to the temporary directory +/// +/// Fixtures can be found under `tests/fixtures/$util_name/` pub struct TestScenario { bin_path: PathBuf, util_name: String, @@ -420,12 +416,16 @@ impl TestScenario { ts } + /// Returns builder for invoking the target uutils binary. Paths given are + /// treated relative to the environment's unique temporary test directory. pub fn ucmd(&self) -> UCommand { let mut cmd = self.cmd(&self.bin_path); cmd.arg(&self.util_name); cmd } + /// Returns builder for invoking any system command. Paths given are treated + /// relative to the environment's unique temporary test directory. pub fn cmd>(&self, bin: S) -> UCommand { UCommand::new_from_tmp(bin, self.tmpd.clone(), true) } @@ -495,6 +495,8 @@ impl UCommand { ucmd } + /// Add a parameter to the invocation. Path arguments are treated relative + /// to the test environment directory. pub fn arg>(&mut self, arg: S) -> Box<&mut UCommand> { if self.has_run { panic!(ALREADY_RUN); @@ -505,6 +507,8 @@ impl UCommand { Box::new(self) } + /// Add multiple parameters to the invocation. Path arguments are treated relative + /// to the test environment directory. pub fn args>(&mut self, args: &[S]) -> Box<&mut UCommand> { if self.has_run { panic!(MULTIPLE_STDIN_MEANINGLESS); From d86ee34bc60846650aa1ca5e0179e31a8fd923f3 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Mon, 22 Mar 2021 20:16:28 +0300 Subject: [PATCH 0104/1135] tsort: move from getopts to clap (#1867) --- src/uu/tsort/Cargo.toml | 2 +- src/uu/tsort/src/tsort.rs | 50 +++++++++++++------------------------ tests/by-util/test_tsort.rs | 33 ++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 33 deletions(-) diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index 10672a9e0..d870e0155 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/tsort.rs" [dependencies] -getopts = "0.2.18" +clap= "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/tsort/src/tsort.rs b/src/uu/tsort/src/tsort.rs index 0a0023031..3440972a2 100644 --- a/src/uu/tsort/src/tsort.rs +++ b/src/uu/tsort/src/tsort.rs @@ -9,49 +9,35 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::collections::{HashMap, HashSet}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; use std::path::Path; -static NAME: &str = "tsort"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static SUMMARY: &str = "Topological sort the strings in FILE. +Strings are defined as any sequence of tokens separated by whitespace (tab, space, or newline). +If FILE is not passed in, stdin is used instead."; +static USAGE: &str = "tsort [OPTIONS] FILE"; + +mod options { + pub const FILE: &str = "file"; +} pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .usage(USAGE) + .about(SUMMARY) + .arg(Arg::with_name(options::FILE).hidden(true)) + .get_matches_from(args); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f), - }; - - if matches.opt_present("h") { - println!("{} {}", NAME, VERSION); - println!(); - println!("Usage:"); - println!(" {} [OPTIONS] FILE", NAME); - println!(); - println!("{}", opts.usage("Topological sort the strings in FILE. Strings are defined as any sequence of tokens separated by whitespace (tab, space, or newline). If FILE is not passed in, stdin is used instead.")); - return 0; - } - - if matches.opt_present("V") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let files = matches.free.clone(); - let input = if files.len() > 1 { - crash!(1, "{}, extra operand '{}'", NAME, matches.free[1]); - } else if files.is_empty() { - "-".to_owned() - } else { - files[0].clone() + let input = match matches.value_of(options::FILE) { + Some(v) => v, + None => "-", }; let mut stdin_buf; diff --git a/tests/by-util/test_tsort.rs b/tests/by-util/test_tsort.rs index c743868ec..159b80025 100644 --- a/tests/by-util/test_tsort.rs +++ b/tests/by-util/test_tsort.rs @@ -15,3 +15,36 @@ fn test_sort_self_loop() { .succeeds() .stdout_only("first\nsecond\n"); } + +#[test] +fn test_no_such_file() { + let result = new_ucmd!().arg("invalid_file_txt").run(); + + assert_eq!(true, result.stderr.contains("No such file or directory")); +} + +#[test] +fn test_version_flag() { + let version_short = new_ucmd!().arg("-V").run(); + let version_long = new_ucmd!().arg("--version").run(); + + assert_eq!(version_short.stdout, version_long.stdout); +} + +#[test] +fn test_help_flag() { + let help_short = new_ucmd!().arg("-h").run(); + let help_long = new_ucmd!().arg("--help").run(); + + assert_eq!(help_short.stdout, help_long.stdout); +} + +#[test] +fn test_multiple_arguments() { + let result = new_ucmd!() + .arg("call_graph.txt") + .arg("invalid_file.txt") + .run(); + + assert_eq!(true, result.stderr.contains("error: Found argument 'invalid_file.txt' which wasn't expected, or isn't valid in this context")) +} From de3f9b8186c2d4cc48c83c94ed06ca53a3950236 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 22 Mar 2021 18:24:23 +0100 Subject: [PATCH 0105/1135] ls: across & commas formats and width parameter (#1869) --- src/uu/ls/src/ls.rs | 160 +++++++++++++++++++++++++++--------- tests/by-util/test_ls.rs | 172 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 290 insertions(+), 42 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index a935eef54..455b4f7b6 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -15,7 +15,6 @@ extern crate uucore; use clap::{App, Arg}; use number_prefix::NumberPrefix; -use std::cmp::Reverse; #[cfg(unix)] use std::collections::HashMap; use std::fs; @@ -30,6 +29,7 @@ use std::path::{Path, PathBuf}; #[cfg(unix)] use std::time::Duration; use std::time::{SystemTime, UNIX_EPOCH}; +use std::{cmp::Reverse, process::exit}; use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use time::{strftime, Timespec}; @@ -78,6 +78,8 @@ pub mod options { pub static ONELINE: &str = "1"; pub static LONG: &str = "long"; pub static COLUMNS: &str = "C"; + pub static ACROSS: &str = "x"; + pub static COMMAS: &str = "m"; pub static LONG_NO_OWNER: &str = "g"; pub static LONG_NO_GROUP: &str = "o"; } @@ -98,6 +100,7 @@ pub mod options { pub static HUMAN_READABLE: &str = "human-readable"; pub static SI: &str = "si"; } + pub static WIDTH: &str = "width"; pub static AUTHOR: &str = "author"; pub static NO_GROUP: &str = "no-group"; pub static FORMAT: &str = "format"; @@ -120,6 +123,8 @@ enum Format { Columns, Long, OneLine, + Across, + Commas, } enum Sort { @@ -166,6 +171,7 @@ struct Config { #[cfg(unix)] color: bool, long: LongFormat, + width: Option, } // Fields that can be removed or added to the long format @@ -183,6 +189,8 @@ impl Config { "long" | "verbose" => Format::Long, "single-column" => Format::OneLine, "columns" | "vertical" => Format::Columns, + "across" | "horizontal" => Format::Across, + "commas" => Format::Commas, // below should never happen as clap already restricts the values. _ => unreachable!("Invalid field for --format"), }, @@ -190,6 +198,10 @@ impl Config { ) } else if options.is_present(options::format::LONG) { (Format::Long, options::format::LONG) + } else if options.is_present(options::format::ACROSS) { + (Format::Across, options::format::ACROSS) + } else if options.is_present(options::format::COMMAS) { + (Format::Commas, options::format::COMMAS) } else { (Format::Columns, options::format::COLUMNS) }; @@ -316,6 +328,16 @@ impl Config { } }; + let width = options + .value_of(options::WIDTH) + .map(|x| { + x.parse::().unwrap_or_else(|_e| { + show_error!("invalid line width: ‘{}’", x); + exit(2); + }) + }) + .or_else(|| termsize::get().map(|s| s.cols)); + Config { format, files, @@ -334,6 +356,7 @@ impl Config { #[cfg(unix)] inode: options.is_present(options::INODE), long, + width, } } } @@ -354,13 +377,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::FORMAT) .help("Set the display format.") .takes_value(true) - .possible_values(&["long", "verbose", "single-column", "columns"]) + .possible_values(&["long", "verbose", "single-column", "columns", "vertical", "across", "horizontal", "commas"]) .hide_possible_values(true) .require_equals(true) .overrides_with_all(&[ options::FORMAT, options::format::COLUMNS, options::format::LONG, + options::format::ACROSS, + options::format::COLUMNS, ]), ) .arg( @@ -371,6 +396,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::FORMAT, options::format::COLUMNS, options::format::LONG, + options::format::ACROSS, + options::format::COLUMNS, ]), ) .arg( @@ -381,8 +408,33 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .overrides_with_all(&[ options::FORMAT, options::format::COLUMNS, - options::format::ONELINE, options::format::LONG, + options::format::ACROSS, + options::format::COLUMNS, + ]), + ) + .arg( + Arg::with_name(options::format::ACROSS) + .short(options::format::ACROSS) + .help("List entries in rows instead of in columns.") + .overrides_with_all(&[ + options::FORMAT, + options::format::COLUMNS, + options::format::LONG, + options::format::ACROSS, + options::format::COLUMNS, + ]), + ) + .arg( + Arg::with_name(options::format::COMMAS) + .short(options::format::COMMAS) + .help("List entries separated by commas.") + .overrides_with_all(&[ + options::FORMAT, + options::format::COLUMNS, + options::format::LONG, + options::format::ACROSS, + options::format::COLUMNS, ]), ) // The next three arguments do not override with the other format @@ -601,6 +653,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::RECURSIVE) .help("List the contents of all directories recursively."), ) + .arg( + Arg::with_name(options::WIDTH) + .long(options::WIDTH) + .short("w") + .help("Assume that the terminal is COLS columns wide.") + .value_name("COLS") + .takes_value(true) + ) .arg( Arg::with_name(options::COLOR) .long(options::COLOR) @@ -779,47 +839,71 @@ fn display_items(items: &[PathBuf], strip: Option<&Path>, config: &Config) { display_item_long(item, strip, max_links, max_size, config); } } else { - if config.format != Format::OneLine { - let names = items.iter().filter_map(|i| { - let md = get_metadata(i, config); - match md { - Err(e) => { - let filename = get_file_name(i, strip); - show_error!("'{}': {}", filename, e); - None - } - Ok(md) => Some(display_file_name(&i, strip, &md, config)), - } - }); - - if let Some(size) = termsize::get() { - let mut grid = Grid::new(GridOptions { - filling: Filling::Spaces(2), - direction: Direction::TopToBottom, - }); - - for name in names { - grid.add(name); - } - - if let Some(output) = grid.fit_into_width(size.cols as usize) { - print!("{}", output); - return; - } - } - } - - // Couldn't display a grid, either because we don't know - // the terminal width or because fit_into_width failed - for i in items { + let names = items.iter().filter_map(|i| { let md = get_metadata(i, config); - if let Ok(md) = md { - println!("{}", display_file_name(&i, strip, &md, config).contents); + match md { + Err(e) => { + let filename = get_file_name(i, strip); + show_error!("'{}': {}", filename, e); + None + } + Ok(md) => Some(display_file_name(&i, strip, &md, config)), + } + }); + + match (&config.format, config.width) { + (Format::Columns, Some(width)) => display_grid(names, width, Direction::TopToBottom), + (Format::Across, Some(width)) => display_grid(names, width, Direction::LeftToRight), + (Format::Commas, width_opt) => { + let term_width = width_opt.unwrap_or(1); + let mut current_col = 0; + let mut names = names; + if let Some(name) = names.next() { + print!("{}", name.contents); + current_col = name.width as u16 + 2; + } + for name in names { + let name_width = name.width as u16; + if current_col + name_width + 1 > term_width { + current_col = name_width + 2; + print!(",\n{}", name.contents); + } else { + current_col += name_width + 2; + print!(", {}", name.contents); + } + } + // Current col is never zero again if names have been printed. + // So we print a newline. + if current_col > 0 { + println!(); + } + } + _ => { + for name in names { + println!("{}", name.contents); + } } } } } +fn display_grid(names: impl Iterator, width: u16, direction: Direction) { + let mut grid = Grid::new(GridOptions { + filling: Filling::Spaces(2), + direction, + }); + + for name in names { + grid.add(name); + } + + match grid.fit_into_width(width as usize) { + Some(output) => print!("{}", output), + // Width is too small for the grid, so we fit it in one column + None => print!("{}", grid.fit_into_columns(1)), + } +} + use uucore::fs::display_permissions; fn display_item_long( diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 4fd35a286..ecd288735 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -57,12 +57,72 @@ fn test_ls_a() { assert!(!result.stdout.contains("..")); } +#[test] +fn test_ls_width() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.touch(&at.plus_as_string("test-width-1")); + at.touch(&at.plus_as_string("test-width-2")); + at.touch(&at.plus_as_string("test-width-3")); + at.touch(&at.plus_as_string("test-width-4")); + + for option in &["-w 100", "-w=100", "--width=100", "--width 100"] { + let result = scene + .ucmd() + .args(&option.split(" ").collect::>()) + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!( + result.stdout, + "test-width-1 test-width-2 test-width-3 test-width-4\n", + ) + } + + for option in &["-w 50", "-w=50", "--width=50", "--width 50"] { + let result = scene + .ucmd() + .args(&option.split(" ").collect::>()) + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!( + result.stdout, + "test-width-1 test-width-3\ntest-width-2 test-width-4\n", + ) + } + + for option in &[ + "-w 25", + "-w=25", + "--width=25", + "--width 25", + "-w 0", + "-w=0", + "--width=0", + "--width 0", + ] { + let result = scene + .ucmd() + .args(&option.split(" ").collect::>()) + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!( + result.stdout, + "test-width-1\ntest-width-2\ntest-width-3\ntest-width-4\n", + ) + } +} + #[test] fn test_ls_columns() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.touch(&at.plus_as_string("test-columns-1")); at.touch(&at.plus_as_string("test-columns-2")); + at.touch(&at.plus_as_string("test-columns-3")); + at.touch(&at.plus_as_string("test-columns-4")); // Columns is the default let result = scene.ucmd().run(); @@ -71,9 +131,15 @@ fn test_ls_columns() { assert!(result.success); #[cfg(not(windows))] - assert_eq!(result.stdout, "test-columns-1\ntest-columns-2\n"); + assert_eq!( + result.stdout, + "test-columns-1\ntest-columns-2\ntest-columns-3\ntest-columns-4\n" + ); #[cfg(windows)] - assert_eq!(result.stdout, "test-columns-1 test-columns-2\n"); + assert_eq!( + result.stdout, + "test-columns-1 test-columns-2 test-columns-3 test-columns-4\n" + ); for option in &["-C", "--format=columns"] { let result = scene.ucmd().arg(option).run(); @@ -81,9 +147,107 @@ fn test_ls_columns() { println!("stdout = {:?}", result.stdout); assert!(result.success); #[cfg(not(windows))] - assert_eq!(result.stdout, "test-columns-1\ntest-columns-2\n"); + assert_eq!( + result.stdout, + "test-columns-1\ntest-columns-2\ntest-columns-3\ntest-columns-4\n" + ); #[cfg(windows)] - assert_eq!(result.stdout, "test-columns-1 test-columns-2\n"); + assert_eq!( + result.stdout, + "test-columns-1 test-columns-2 test-columns-3 test-columns-4\n" + ); + } + + for option in &["-C", "--format=columns"] { + let result = scene.ucmd().arg("-w=40").arg(option).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert_eq!( + result.stdout, + "test-columns-1 test-columns-3\ntest-columns-2 test-columns-4\n" + ); + } +} + +#[test] +fn test_ls_across() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.touch(&at.plus_as_string("test-across-1")); + at.touch(&at.plus_as_string("test-across-2")); + at.touch(&at.plus_as_string("test-across-3")); + at.touch(&at.plus_as_string("test-across-4")); + + for option in &["-x", "--format=across"] { + let result = scene.ucmd().arg(option).succeeds(); + // Because the test terminal has width 0, this is the same output as + // the columns option. + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + if cfg!(unix) { + assert_eq!( + result.stdout, + "test-across-1\ntest-across-2\ntest-across-3\ntest-across-4\n" + ); + } else { + assert_eq!( + result.stdout, + "test-across-1 test-across-2 test-across-3 test-across-4\n" + ); + } + } + + for option in &["-x", "--format=across"] { + let result = scene.ucmd().arg("-w=30").arg(option).run(); + // Because the test terminal has width 0, this is the same output as + // the columns option. + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!( + result.stdout, + "test-across-1 test-across-2\ntest-across-3 test-across-4\n" + ); + } +} + +#[test] +fn test_ls_commas() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.touch(&at.plus_as_string("test-commas-1")); + at.touch(&at.plus_as_string("test-commas-2")); + at.touch(&at.plus_as_string("test-commas-3")); + at.touch(&at.plus_as_string("test-commas-4")); + + for option in &["-m", "--format=commas"] { + let result = scene.ucmd().arg(option).succeeds(); + if cfg!(unix) { + assert_eq!( + result.stdout, + "test-commas-1,\ntest-commas-2,\ntest-commas-3,\ntest-commas-4\n" + ); + } else { + assert_eq!( + result.stdout, + "test-commas-1, test-commas-2, test-commas-3, test-commas-4\n" + ); + } + } + + for option in &["-m", "--format=commas"] { + let result = scene.ucmd().arg("-w=30").arg(option).succeeds(); + assert_eq!( + result.stdout, + "test-commas-1, test-commas-2,\ntest-commas-3, test-commas-4\n" + ); + } + for option in &["-m", "--format=commas"] { + let result = scene.ucmd().arg("-w=45").arg(option).succeeds(); + assert_eq!( + result.stdout, + "test-commas-1, test-commas-2, test-commas-3,\ntest-commas-4\n" + ); } } From 56da6b4a2c656e387ebd9d98ffae74e82068c7c9 Mon Sep 17 00:00:00 2001 From: James Robson Date: Mon, 22 Mar 2021 17:48:12 +0000 Subject: [PATCH 0106/1135] Fix test setup --- .github/workflows/GNU.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index f89621e3f..9eb5da2b9 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -81,15 +81,15 @@ jobs: Makefile # Use the system coreutils where the test fails due to error in a util that is not the one being tested - sed -i 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh + sed -i 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh sed -i 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh tests/du/8gb.sh sed -i 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh sed -i 's|timeout \([[:digit:]]\)| /usr/bin/timeout \1|' tests/tail-2/inotify-rotate.sh tests/tail-2/inotify-dir-recreate.sh tests/tail-2/inotify-rotate-resources.sh tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh tests/tail-2/follow-name.sh # Don't break the function called 'grep_timeout' - sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh tests/tail-2/tail-n0f.sh tests/cp/fail-perm.sh tests/du/inaccessible-cwd.sh tests/mv/i-2.sh + sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh tests/tail-2/tail-n0f.sh tests/cp/fail-perm.sh tests/du/inaccessible-cwd.sh tests/mv/i-2.sh tests/chgrp/basic.sh sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/misc/test-N.sh sed -i 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh sed -i 's|truncate |/usr/bin/truncate |' tests/split/fail.sh - sed -i 's|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh tests/cp/fiemap-2.sh tests/init.sh + sed -i 's|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh tests/cp/fiemap-2.sh init.cfg sed -i 's|id -|/usr/bin/id -|' tests/misc/runcon-no-reorder.sh sed -i 's|touch |/usr/bin/touch |' tests/cp/preserve-link.sh tests/cp/reflink-perm.sh tests/ls/block-size.sh tests/ls/abmon-align.sh tests/ls/rt-1.sh tests/mv/update.sh tests/misc/ls-time.sh tests/misc/stat-nanoseconds.sh tests/misc/time-style.sh tests/misc/test-N.sh sed -i 's|ln -|/usr/bin/ln -|' tests/cp/link-deref.sh From 20dec4cbba9ee3153f517d7b444c0fe8ac8aa558 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Mon, 22 Mar 2021 22:08:07 +0300 Subject: [PATCH 0107/1135] fix: fix clippy warnings (#1876) --- src/uu/expr/src/syntax_tree.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/uu/expr/src/syntax_tree.rs b/src/uu/expr/src/syntax_tree.rs index d56bab4fc..3381c29bd 100644 --- a/src/uu/expr/src/syntax_tree.rs +++ b/src/uu/expr/src/syntax_tree.rs @@ -148,11 +148,11 @@ impl ASTNode { |a: &String, b: &String| Ok(bool_as_string(a >= b)), &operand_values, ), - "|" => infix_operator_or(&operand_values), - "&" => infix_operator_and(&operand_values), + "|" => Ok(infix_operator_or(&operand_values)), + "&" => Ok(infix_operator_and(&operand_values)), ":" | "match" => operator_match(&operand_values), - "length" => prefix_operator_length(&operand_values), - "index" => prefix_operator_index(&operand_values), + "length" => Ok(prefix_operator_length(&operand_values)), + "index" => Ok(prefix_operator_index(&operand_values)), "substr" => prefix_operator_substr(&operand_values), _ => Err(format!("operation not implemented: {}", op_type)), @@ -465,20 +465,20 @@ where } } -fn infix_operator_or(values: &[String]) -> Result { +fn infix_operator_or(values: &[String]) -> String { assert!(values.len() == 2); if value_as_bool(&values[0]) { - Ok(values[0].clone()) + values[0].clone() } else { - Ok(values[1].clone()) + values[1].clone() } } -fn infix_operator_and(values: &[String]) -> Result { +fn infix_operator_and(values: &[String]) -> String { if value_as_bool(&values[0]) && value_as_bool(&values[1]) { - Ok(values[0].clone()) + values[0].clone() } else { - Ok(0.to_string()) + 0.to_string() } } @@ -502,12 +502,12 @@ fn operator_match(values: &[String]) -> Result { } } -fn prefix_operator_length(values: &[String]) -> Result { +fn prefix_operator_length(values: &[String]) -> String { assert!(values.len() == 1); - Ok(values[0].len().to_string()) + values[0].len().to_string() } -fn prefix_operator_index(values: &[String]) -> Result { +fn prefix_operator_index(values: &[String]) -> String { assert!(values.len() == 2); let haystack = &values[0]; let needles = &values[1]; @@ -515,11 +515,11 @@ fn prefix_operator_index(values: &[String]) -> Result { for (current_idx, ch_h) in haystack.chars().enumerate() { for ch_n in needles.chars() { if ch_n == ch_h { - return Ok(current_idx.to_string()); + return current_idx.to_string(); } } } - Ok("0".to_string()) + "0".to_string() } fn prefix_operator_substr(values: &[String]) -> Result { From a1b50ae0f43e78424de6ccdfc545a59aa0156d8c Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Mon, 22 Mar 2021 21:09:00 +0200 Subject: [PATCH 0108/1135] nohup: move from getopts to clap (#1871) - changed some error return codes to match GNU implementation - changed warning/error messages to match GNU nohup - replaced getopts dependency with clap - added a test --- src/uu/nohup/Cargo.toml | 2 +- src/uu/nohup/src/nohup.rs | 134 +++++++++++++++++++----------------- tests/by-util/test_nohup.rs | 20 +++++- 3 files changed, 90 insertions(+), 66 deletions(-) diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index 0c5709a65..e9b6f8bd4 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/nohup.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/nohup/src/nohup.rs b/src/uu/nohup/src/nohup.rs index 5fce208da..afbf2541b 100644 --- a/src/uu/nohup/src/nohup.rs +++ b/src/uu/nohup/src/nohup.rs @@ -10,6 +10,7 @@ #[macro_use] extern crate uucore; +use clap::{App, AppSettings, Arg}; use libc::{c_char, dup2, execvp, signal}; use libc::{SIGHUP, SIG_IGN}; use std::env; @@ -20,50 +21,42 @@ use std::os::unix::prelude::*; use std::path::{Path, PathBuf}; use uucore::fs::{is_stderr_interactive, is_stdin_interactive, is_stdout_interactive}; -static NAME: &str = "nohup"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Run COMMAND ignoring hangup signals."; +static LONG_HELP: &str = " +If standard input is terminal, it'll be replaced with /dev/null. +If standard output is terminal, it'll be appended to nohup.out instead, +or $HOME/nohup.out, if nohup.out open failed. +If standard error is terminal, it'll be redirected to stdout. +"; +static NOHUP_OUT: &str = "nohup.out"; +// exit codes that match the GNU implementation +static EXIT_CANCELED: i32 = 125; +static EXIT_CANNOT_INVOKE: i32 = 126; +static EXIT_ENOENT: i32 = 127; +static POSIX_NOHUP_FAILURE: i32 = 127; -#[cfg(target_vendor = "apple")] -extern "C" { - fn _vprocmgr_detach_from_console(flags: u32) -> *const libc::c_int; -} - -#[cfg(any(target_os = "linux", target_os = "freebsd"))] -unsafe fn _vprocmgr_detach_from_console(_: u32) -> *const libc::c_int { - std::ptr::null() +mod options { + pub const CMD: &str = "cmd"; } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(LONG_HELP) + .arg( + Arg::with_name(options::CMD) + .hidden(true) + .required(true) + .multiple(true), + ) + .setting(AppSettings::TrailingVarArg) + .get_matches_from(args); - opts.optflag("h", "help", "Show help and exit"); - opts.optflag("V", "version", "Show version and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("{}", f); - show_usage(&opts); - return 1; - } - }; - - if matches.opt_present("V") { - println!("{} {}", NAME, VERSION); - return 0; - } - if matches.opt_present("h") { - show_usage(&opts); - return 0; - } - - if matches.free.is_empty() { - show_error!("Missing operand: COMMAND"); - println!("Try `{} --help` for more information.", NAME); - return 1; - } replace_fds(); unsafe { signal(SIGHUP, SIG_IGN) }; @@ -73,13 +66,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; let cstrs: Vec = matches - .free - .iter() + .values_of(options::CMD) + .unwrap() .map(|x| CString::new(x.as_bytes()).unwrap()) .collect(); let mut args: Vec<*const c_char> = cstrs.iter().map(|s| s.as_ptr()).collect(); args.push(std::ptr::null()); - unsafe { execvp(args[0], args.as_mut_ptr()) } + + let ret = unsafe { execvp(args[0], args.as_mut_ptr()) }; + match ret { + libc::ENOENT => EXIT_ENOENT, + _ => EXIT_CANNOT_INVOKE, + } } fn replace_fds() { @@ -108,23 +106,32 @@ fn replace_fds() { } fn find_stdout() -> File { + let internal_failure_code = match std::env::var("POSIXLY_CORRECT") { + Ok(_) => POSIX_NOHUP_FAILURE, + Err(_) => EXIT_CANCELED, + }; + match OpenOptions::new() .write(true) .create(true) .append(true) - .open(Path::new("nohup.out")) + .open(Path::new(NOHUP_OUT)) { Ok(t) => { - show_warning!("Output is redirected to: nohup.out"); + show_info!("ignoring input and appending output to '{}'", NOHUP_OUT); t } - Err(e) => { + Err(e1) => { let home = match env::var("HOME") { - Err(_) => crash!(2, "Cannot replace STDOUT: {}", e), + Err(_) => { + show_info!("failed to open '{}': {}", NOHUP_OUT, e1); + exit!(internal_failure_code) + } Ok(h) => h, }; let mut homeout = PathBuf::from(home); - homeout.push("nohup.out"); + homeout.push(NOHUP_OUT); + let homeout_str = homeout.to_str().unwrap(); match OpenOptions::new() .write(true) .create(true) @@ -132,30 +139,29 @@ fn find_stdout() -> File { .open(&homeout) { Ok(t) => { - show_warning!("Output is redirected to: {:?}", homeout); + show_info!("ignoring input and appending output to '{}'", homeout_str); t } - Err(e) => crash!(2, "Cannot replace STDOUT: {}", e), + Err(e2) => { + show_info!("failed to open '{}': {}", NOHUP_OUT, e1); + show_info!("failed to open '{}': {}", homeout_str, e2); + exit!(internal_failure_code) + } } } } } -fn show_usage(opts: &getopts::Options) { - let msg = format!( - "{0} {1} - -Usage: - {0} COMMAND [ARG]... - {0} OPTION - -Run COMMAND ignoring hangup signals. -If standard input is terminal, it'll be replaced with /dev/null. -If standard output is terminal, it'll be appended to nohup.out instead, -or $HOME/nohup.out, if nohup.out open failed. -If standard error is terminal, it'll be redirected to stdout.", - NAME, VERSION - ); - - print!("{}", opts.usage(&msg)); +fn get_usage() -> String { + format!("{0} COMMAND [ARG]...\n {0} FLAG", executable!()) +} + +#[cfg(target_vendor = "apple")] +extern "C" { + fn _vprocmgr_detach_from_console(flags: u32) -> *const libc::c_int; +} + +#[cfg(any(target_os = "linux", target_os = "freebsd"))] +unsafe fn _vprocmgr_detach_from_console(_: u32) -> *const libc::c_int { + std::ptr::null() } diff --git a/tests/by-util/test_nohup.rs b/tests/by-util/test_nohup.rs index 651491045..b98ae007c 100644 --- a/tests/by-util/test_nohup.rs +++ b/tests/by-util/test_nohup.rs @@ -1 +1,19 @@ -// ToDO: add tests +use crate::common::util::*; +use std::thread::sleep; + +// General observation: nohup.out will not be created in tests run by cargo test +// because stdin/stdout is not attached to a TTY. +// All that can be tested is the side-effects. + +#[test] +#[cfg(any(target_os = "linux", target_os = "freebsd", target_vendor = "apple"))] +fn test_nohup_multiple_args_and_flags() { + let (at, mut ucmd) = at_and_ucmd!(); + + ucmd.args(&["touch", "-t", "1006161200", "file1", "file2"]) + .succeeds(); + sleep(std::time::Duration::from_millis(10)); + + assert!(at.file_exists("file1")); + assert!(at.file_exists("file2")); +} From e5ef7486d5be004324dc26239fbf520d4f3bc6b2 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Tue, 23 Mar 2021 00:42:14 +0300 Subject: [PATCH 0109/1135] feat: move echo to clap (#1884) --- src/uu/echo/Cargo.toml | 1 + src/uu/echo/src/echo.rs | 50 ++++++++++++++++++++++++++++++++--------- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index a8742b68f..7b831fcb8 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/echo.rs" [dependencies] +clap = "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index 93c395391..7dfdf3113 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -9,10 +9,13 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::io::{self, Write}; use std::iter::Peekable; use std::str::Chars; +static VERSION: &str = env!("CARGO_PKG_VERSION"); +const NAME: &str = "echo"; const SYNTAX: &str = "[OPTIONS]... [STRING]..."; const SUMMARY: &str = "display a line of text"; const HELP: &str = r#" @@ -33,6 +36,13 @@ const HELP: &str = r#" \\xHH byte with hexadecimal value HH (1 to 2 digits) "#; +mod options { + pub const STRING: &str = "string"; + pub const NEWLINE: &str = "n"; + pub const ENABLE_ESCAPE: &str = "e"; + pub const DISABLE_ESCAPE: &str = "E"; +} + fn parse_code( input: &mut Peekable, base: u32, @@ -105,20 +115,38 @@ fn print_escaped(input: &str, mut output: impl Write) -> io::Result { pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let matches = app!(SYNTAX, SUMMARY, HELP) - .optflag("n", "", "do not output the trailing newline") - .optflag("e", "", "enable interpretation of backslash escapes") - .optflag( - "E", - "", - "disable interpretation of backslash escapes (default)", + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(SYNTAX) + .about(SUMMARY) + .help(HELP) + .arg(Arg::with_name(options::STRING).hidden(true).multiple(true)) + .arg( + Arg::with_name(options::NEWLINE) + .short("n") + .help("do not output the trailing newline"), ) - .parse(args); + .arg( + Arg::with_name(options::ENABLE_ESCAPE) + .short("e") + .help("enable interpretation of backslash escapes"), + ) + .arg( + Arg::with_name(options::DISABLE_ESCAPE) + .short("E") + .help("disable interpretation of backslash escapes (default)"), + ) + .get_matches_from(args); - let no_newline = matches.opt_present("n"); - let escaped = matches.opt_present("e"); + let no_newline = matches.is_present("n"); + let escaped = matches.is_present("e"); + let values: Vec = match matches.values_of(options::STRING) { + Some(v) => v.map(|v| v.to_string()).collect(), + None => vec!["".to_string()], + }; - match execute(no_newline, escaped, matches.free) { + match execute(no_newline, escaped, values) { Ok(_) => 0, Err(f) => { show_error!("{}", f); From 5e2e2e8ab6902cde39c0b5d027c83b9cbcd61553 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Tue, 23 Mar 2021 11:40:05 +0300 Subject: [PATCH 0110/1135] echo: allow leading hyphens (#1887) * fix: use settings to allow leading hyphen and trailing var arg fixes: https://github.com/uutils/coreutils/issues/1873 * test: add test cases * test: add more test cases with different order in hyphen values * chore: add comment to explain why we need TrailingVarArg --- src/uu/echo/src/echo.rs | 5 ++++ tests/by-util/test_echo.rs | 55 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index 7dfdf3113..7c0014229 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -117,6 +117,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .name(NAME) + // TrailingVarArg specifies the final positional argument is a VarArg + // and it doesn't attempts the parse any further args. + // Final argument must have multiple(true) or the usage string equivalent. + .setting(clap::AppSettings::TrailingVarArg) + .setting(clap::AppSettings::AllowLeadingHyphen) .version(VERSION) .usage(SYNTAX) .about(SUMMARY) diff --git a/tests/by-util/test_echo.rs b/tests/by-util/test_echo.rs index 2d073d60b..7394ffc1e 100644 --- a/tests/by-util/test_echo.rs +++ b/tests/by-util/test_echo.rs @@ -173,3 +173,58 @@ fn test_disable_escapes() { .succeeds() .stdout_only(format!("{}\n", input_str)); } + +#[test] +fn test_hyphen_value() { + new_ucmd!().arg("-abc").succeeds().stdout_is("-abc\n"); +} + +#[test] +fn test_multiple_hyphen_values() { + new_ucmd!() + .args(&["-abc", "-def", "-edf"]) + .succeeds() + .stdout_is("-abc -def -edf\n"); +} + +#[test] +fn test_hyphen_values_inside_string() { + new_ucmd!() + .arg("'\"\n'CXXFLAGS=-g -O2'\n\"'") + .succeeds() + .stdout + .contains("CXXFLAGS"); +} + +#[test] +fn test_hyphen_values_at_start() { + let result = new_ucmd!() + .arg("-E") + .arg("-test") + .arg("araba") + .arg("-merci") + .run(); + + assert!(result.success); + assert_eq!(false, result.stdout.contains("-E")); + assert_eq!(result.stdout, "-test araba -merci\n"); +} + +#[test] +fn test_hyphen_values_between() { + let result = new_ucmd!().arg("test").arg("-E").arg("araba").run(); + + assert!(result.success); + assert_eq!(result.stdout, "test -E araba\n"); + + let result = new_ucmd!() + .arg("dumdum ") + .arg("dum dum dum") + .arg("-e") + .arg("dum") + .run(); + + assert!(result.success); + assert_eq!(result.stdout, "dumdum dum dum dum -e dum\n"); + assert_eq!(true, result.stdout.contains("-e")); +} From 545fe7d887d5e162610474e07922169f7b78fd2b Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Tue, 23 Mar 2021 11:42:05 +0300 Subject: [PATCH 0111/1135] feat(unexpand): move from getopts to clap (#1883) * feat: move unexpand to clap * chore: allow muliple files * test: add test fixture, test reading from a file * test: fix typo on file name, add test for multiple inputs * chore: use 'success()' instead of asserting * chore: delete unused variables * chore: use help instead of long_help, break long line --- src/uu/unexpand/Cargo.toml | 2 +- src/uu/unexpand/src/unexpand.rs | 119 +++++++++++------------- tests/by-util/test_unexpand.rs | 19 ++++ tests/fixtures/unexpand/with_spaces.txt | 2 + 4 files changed, 76 insertions(+), 66 deletions(-) create mode 100644 tests/fixtures/unexpand/with_spaces.txt diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index ec6967e21..d66d335bf 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/unexpand.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" unicode-width = "0.1.5" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/unexpand/src/unexpand.rs b/src/uu/unexpand/src/unexpand.rs index 59a2dc6a0..5b08c33cf 100644 --- a/src/uu/unexpand/src/unexpand.rs +++ b/src/uu/unexpand/src/unexpand.rs @@ -11,7 +11,7 @@ #[macro_use] extern crate uucore; - +use clap::{App, Arg}; use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Stdout, Write}; use std::str::from_utf8; @@ -19,6 +19,9 @@ use unicode_width::UnicodeWidthChar; static NAME: &str = "unexpand"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static USAGE: &str = "unexpand [OPTION]... [FILE]..."; +static SUMMARY: &str = "Convert blanks in each FILE to tabs, writing to standard output.\n + With no FILE, or when FILE is -, read standard input."; const DEFAULT_TABSTOP: usize = 8; @@ -46,6 +49,14 @@ fn tabstops_parse(s: String) -> Vec { nums } +mod options { + pub const FILE: &str = "file"; + pub const ALL: &str = "all"; + pub const FIRST_ONLY: &str = "first-only"; + pub const TABS: &str = "tabs"; + pub const NO_UTF8: &str = "no-utf8"; +} + struct Options { files: Vec, tabstops: Vec, @@ -54,20 +65,19 @@ struct Options { } impl Options { - fn new(matches: getopts::Matches) -> Options { - let tabstops = match matches.opt_str("t") { + fn new(matches: clap::ArgMatches) -> Options { + let tabstops = match matches.value_of(options::TABS) { None => vec![DEFAULT_TABSTOP], - Some(s) => tabstops_parse(s), + Some(s) => tabstops_parse(s.to_string()), }; - let aflag = (matches.opt_present("all") || matches.opt_present("tabs")) - && !matches.opt_present("first-only"); - let uflag = !matches.opt_present("U"); + let aflag = (matches.is_present(options::ALL) || matches.is_present(options::TABS)) + && !matches.is_present(options::FIRST_ONLY); + let uflag = !matches.is_present(options::NO_UTF8); - let files = if matches.free.is_empty() { - vec!["-".to_owned()] - } else { - matches.free + let files = match matches.value_of(options::FILE) { + Some(v) => vec![v.to_string()], + None => vec!["-".to_owned()], }; Options { @@ -82,60 +92,39 @@ impl Options { pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = getopts::Options::new(); - - opts.optflag( - "a", - "all", - "convert all blanks, instead of just initial blanks", - ); - opts.optflag( - "", - "first-only", - "convert only leading sequences of blanks (overrides -a)", - ); - opts.optopt( - "t", - "tabs", - "have tabs N characters apart instead of 8 (enables -a)", - "N", - ); - opts.optopt( - "t", - "tabs", - "use comma separated LIST of tab positions (enables -a)", - "LIST", - ); - opts.optflag( - "U", - "no-utf8", - "interpret input file as 8-bit ASCII rather than UTF-8", - ); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f), - }; - - if matches.opt_present("help") { - println!("{} {}\n", NAME, VERSION); - println!("Usage: {} [OPTION]... [FILE]...\n", NAME); - println!( - "{}", - opts.usage( - "Convert blanks in each FILE to tabs, writing to standard output.\n\ - With no FILE, or when FILE is -, read standard input." - ) - ); - return 0; - } - - if matches.opt_present("V") { - println!("{} {}", NAME, VERSION); - return 0; - } + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(USAGE) + .about(SUMMARY) + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) + .arg( + Arg::with_name(options::ALL) + .short("a") + .long(options::ALL) + .help("convert all blanks, instead of just initial blanks") + .takes_value(false), + ) + .arg( + Arg::with_name(options::FIRST_ONLY) + .long(options::FIRST_ONLY) + .help("convert only leading sequences of blanks (overrides -a)") + .takes_value(false), + ) + .arg( + Arg::with_name(options::TABS) + .short("t") + .long(options::TABS) + .long_help("use comma separated LIST of tab positions or have tabs N characters apart instead of 8 (enables -a)") + .takes_value(true) + ) + .arg( + Arg::with_name(options::NO_UTF8) + .short("U") + .long(options::NO_UTF8) + .takes_value(false) + .help("interpret input file as 8-bit ASCII rather than UTF-8")) + .get_matches_from(args); unexpand(Options::new(matches)); diff --git a/tests/by-util/test_unexpand.rs b/tests/by-util/test_unexpand.rs index 93cc42d90..e8b880287 100644 --- a/tests/by-util/test_unexpand.rs +++ b/tests/by-util/test_unexpand.rs @@ -136,3 +136,22 @@ fn unexpand_spaces_after_fields() { .run() .stdout_is("\t\tA B C D\t\t A\t\n"); } + +#[test] +fn unexpand_read_from_file() { + new_ucmd!() + .arg("with_spaces.txt") + .arg("-t4") + .run() + .success(); +} + +#[test] +fn unexpand_read_from_two_file() { + new_ucmd!() + .arg("with_spaces.txt") + .arg("with_spaces.txt") + .arg("-t4") + .run() + .success(); +} diff --git a/tests/fixtures/unexpand/with_spaces.txt b/tests/fixtures/unexpand/with_spaces.txt new file mode 100644 index 000000000..3f39671a1 --- /dev/null +++ b/tests/fixtures/unexpand/with_spaces.txt @@ -0,0 +1,2 @@ + abc d e f g \t\t A + \ No newline at end of file From b54f0b1ff20919b42de48f74c0265a889696d726 Mon Sep 17 00:00:00 2001 From: Alessandro Stoltenberg Date: Tue, 23 Mar 2021 11:55:18 +0100 Subject: [PATCH 0112/1135] echo: Refactored help message. (#1886) --- src/uu/echo/src/echo.rs | 57 ++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index 7c0014229..c991f5d3f 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -9,17 +9,17 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::io::{self, Write}; use std::iter::Peekable; use std::str::Chars; -static VERSION: &str = env!("CARGO_PKG_VERSION"); -const NAME: &str = "echo"; -const SYNTAX: &str = "[OPTIONS]... [STRING]..."; -const SUMMARY: &str = "display a line of text"; -const HELP: &str = r#" +static NAME: &str = "echo"; +static USAGE: &str = "[OPTIONS]... [STRING]..."; +static SUMMARY: &str = "display a line of text"; +static AFTER_HELP: &str = r#" Echo the STRING(s) to standard output. + If -e is in effect, the following sequences are recognized: \\\\ backslash @@ -37,10 +37,10 @@ const HELP: &str = r#" "#; mod options { - pub const STRING: &str = "string"; - pub const NEWLINE: &str = "n"; - pub const ENABLE_ESCAPE: &str = "e"; - pub const DISABLE_ESCAPE: &str = "E"; + pub static STRING: &str = "STRING"; + pub static NO_NEWLINE: &str = "no_newline"; + pub static ENABLE_BACKSLASH_ESCAPE: &str = "enable_backslash_escape"; + pub static DISABLE_BACKSLASH_ESCAPE: &str = "disable_backslash_escape"; } fn parse_code( @@ -122,32 +122,43 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // Final argument must have multiple(true) or the usage string equivalent. .setting(clap::AppSettings::TrailingVarArg) .setting(clap::AppSettings::AllowLeadingHyphen) - .version(VERSION) - .usage(SYNTAX) + .version(crate_version!()) + .usage(USAGE) .about(SUMMARY) - .help(HELP) - .arg(Arg::with_name(options::STRING).hidden(true).multiple(true)) + .after_help(AFTER_HELP) .arg( - Arg::with_name(options::NEWLINE) + Arg::with_name(options::NO_NEWLINE) .short("n") - .help("do not output the trailing newline"), + .help("do not output the trailing newline") + .takes_value(false) + .display_order(1), ) .arg( - Arg::with_name(options::ENABLE_ESCAPE) + Arg::with_name(options::ENABLE_BACKSLASH_ESCAPE) .short("e") - .help("enable interpretation of backslash escapes"), + .help("enable interpretation of backslash escapes") + .takes_value(false) + .display_order(2), ) .arg( - Arg::with_name(options::DISABLE_ESCAPE) + Arg::with_name(options::DISABLE_BACKSLASH_ESCAPE) .short("E") - .help("disable interpretation of backslash escapes (default)"), + .help("disable interpretation of backslash escapes (default)") + .takes_value(false) + .display_order(3), + ) + .arg( + Arg::with_name(options::STRING) + .hidden(true) + .multiple(true) + .allow_hyphen_values(true), ) .get_matches_from(args); - let no_newline = matches.is_present("n"); - let escaped = matches.is_present("e"); + let no_newline = matches.is_present(options::NO_NEWLINE); + let escaped = matches.is_present(options::ENABLE_BACKSLASH_ESCAPE); let values: Vec = match matches.values_of(options::STRING) { - Some(v) => v.map(|v| v.to_string()).collect(), + Some(s) => s.map(|s| s.to_string()).collect(), None => vec!["".to_string()], }; From 4873c8a24b7e00283572f05da18e3b74a6819562 Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Tue, 23 Mar 2021 13:49:35 -0700 Subject: [PATCH 0113/1135] mv: ensure line prints (#1890) Previously this used `print` instead of `println`, and as a result the prompt would never appear and the command would hang. The Rust docs note this about print: > Note that stdout is frequently line-buffered by default so it may be > necessary to use io::stdout().flush() to ensure the output is emitted > immediately. Changing to `println` fixes the issue. Fixes #1889. Co-authored-by: Kevin Burke --- src/uu/mv/src/mv.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 6575ad37a..b481aeebc 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -380,7 +380,7 @@ fn rename(from: &PathBuf, to: &PathBuf, b: &Behavior) -> io::Result<()> { match b.overwrite { OverwriteMode::NoClobber => return Ok(()), OverwriteMode::Interactive => { - print!("{}: overwrite ‘{}’? ", executable!(), to.display()); + println!("{}: overwrite ‘{}’? ", executable!(), to.display()); if !read_yes() { return Ok(()); } From 9b2ee1ce06199be5f7cbf09a5ec39aa7245a1c2d Mon Sep 17 00:00:00 2001 From: Marco Satti Date: Wed, 24 Mar 2021 15:33:11 +0800 Subject: [PATCH 0114/1135] date: change tests to expect failure (#1895) * date: change tests to expect failure Although these tests contain valid dates, the parsing logic is not implemented yet. It should be changed to expect success when the parsing logic is done. * date: fix test build errors --- tests/by-util/test_date.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 216446266..5619aed94 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -180,39 +180,45 @@ fn test_date_set_mac_unavailable() { #[test] #[cfg(all(unix, not(target_os = "macos")))] +/// TODO: expected to fail currently; change to succeeds() when required. fn test_date_set_valid_2() { if get_effective_uid() == 0 { let (_, mut ucmd) = at_and_ucmd!(); let result = ucmd .arg("--set") .arg("Sat 20 Mar 2021 14:53:01 AWST") - .succeeds(); - result.no_stdout().no_stderr(); + .fails(); + let result = result.no_stdout(); + assert!(result.stderr.starts_with("date: invalid date ")); } } #[test] #[cfg(all(unix, not(target_os = "macos")))] +/// TODO: expected to fail currently; change to succeeds() when required. fn test_date_set_valid_3() { if get_effective_uid() == 0 { let (_, mut ucmd) = at_and_ucmd!(); let result = ucmd .arg("--set") .arg("Sat 20 Mar 2021 14:53:01") // Local timezone - .succeeds(); - result.no_stdout().no_stderr(); + .fails(); + let result = result.no_stdout(); + assert!(result.stderr.starts_with("date: invalid date ")); } } #[test] #[cfg(all(unix, not(target_os = "macos")))] +/// TODO: expected to fail currently; change to succeeds() when required. fn test_date_set_valid_4() { if get_effective_uid() == 0 { let (_, mut ucmd) = at_and_ucmd!(); let result = ucmd .arg("--set") .arg("2020-03-11 21:45:00") // Local timezone - .succeeds(); - result.no_stdout().no_stderr(); + .fails(); + let result = result.no_stdout(); + assert!(result.stderr.starts_with("date: invalid date ")); } } From 365c23049394fd29ff1506827d8eff778b452a2d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 24 Mar 2021 08:56:30 +0100 Subject: [PATCH 0115/1135] refresh cargo.lock with recent updates (#1896) --- Cargo.lock | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e5852987e..aabac3783 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -90,7 +90,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -295,7 +295,7 @@ dependencies = [ "uu_whoami 0.0.4", "uu_yes 0.0.4", "uucore 0.0.7", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -401,12 +401,12 @@ dependencies = [ "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -468,7 +468,7 @@ dependencies = [ "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1100,7 +1100,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.124" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1109,12 +1109,12 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.124" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1129,7 +1129,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1286,7 +1286,7 @@ name = "tinytemplate" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1382,7 +1382,7 @@ version = "0.0.4" dependencies = [ "uucore 0.0.7", "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1392,7 +1392,7 @@ dependencies = [ "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1403,7 +1403,7 @@ dependencies = [ "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1445,7 +1445,7 @@ dependencies = [ "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1525,6 +1525,7 @@ dependencies = [ name = "uu_echo" version = "0.0.4" dependencies = [ + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", ] @@ -1835,7 +1836,7 @@ dependencies = [ name = "uu_nohup" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1977,7 +1978,7 @@ dependencies = [ "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2196,7 +2197,7 @@ dependencies = [ name = "uu_tsort" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", ] @@ -2225,7 +2226,7 @@ dependencies = [ name = "uu_unexpand" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -2344,7 +2345,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "walkdir" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2595,9 +2596,9 @@ dependencies = [ "checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)" = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" +"checksum serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)" = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" "checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -"checksum serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)" = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" +"checksum serde_derive 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)" = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" "checksum serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)" = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" @@ -2625,7 +2626,7 @@ dependencies = [ "checksum users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" "checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" +"checksum walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" "checksum wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" "checksum wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" From bdf603a65ef5d40741cdf18b765611d239822230 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Tue, 23 Mar 2021 19:12:10 +0100 Subject: [PATCH 0116/1135] rm: make -d/-r obligatory for removing symlink_dir (windows) --- src/uu/rm/src/rm.rs | 31 ++++++++++++++++++++----------- tests/by-util/test_rm.rs | 3 +++ 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index e858e3b0a..6e26cb82a 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -306,21 +306,30 @@ fn remove_dir(path: &Path, options: &Options) -> bool { }; if response { if let Ok(mut read_dir) = fs::read_dir(path) { - if options.dir && read_dir.next().is_none() { - match fs::remove_dir(path) { - Ok(_) => { - if options.verbose { - println!("removed directory '{}'", path.display()); + if options.dir || options.recursive { + if read_dir.next().is_none() { + match fs::remove_dir(path) { + Ok(_) => { + if options.verbose { + println!("removed directory '{}'", path.display()); + } + } + Err(e) => { + show_error!("cannot remove '{}': {}", path.display(), e); + return true; } } - Err(e) => { - show_error!("cannot remove '{}': {}", path.display(), e); - return true; - } + } else { + // directory can be read but is not empty + show_error!("cannot remove '{}': Directory not empty", path.display()); + return true; } } else { - // directory can be read but is not empty - show_error!("cannot remove '{}': Directory not empty", path.display()); + // called to remove a symlink_dir (windows) without "-r"/"-R" or "-d" + show_error!( + "could not remove directory '{}' (did you mean to pass '-r' or '-R'?)", + path.display() + ); return true; } } else { diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 06d1d435d..9556bf8e7 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -194,7 +194,10 @@ fn test_rm_dir_symlink() { at.mkdir(dir); at.symlink_dir(dir, link); + #[cfg(not(windows))] ucmd.arg(link).succeeds(); + #[cfg(windows)] + ucmd.arg("-r").arg(link).succeeds(); } #[test] From ffcfcfeef75810d8465aabe76bc1a01008ff9a5f Mon Sep 17 00:00:00 2001 From: dkg Date: Wed, 24 Mar 2021 12:56:07 -0400 Subject: [PATCH 0117/1135] tac is "semi-done" because of unimplemented ---regex (#1901) --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 9d25a1120..dd60d2126 100644 --- a/README.md +++ b/README.md @@ -301,7 +301,7 @@ Utilities | csplit | date | | | cut | join | | | dircolors | df | | -| dirname | | | +| dirname | tac | | | du | | | | echo | | | | env | | | @@ -354,7 +354,6 @@ Utilities | stdbuf | | | | sum | | | | sync | | | -| tac | | | | tee | | | | timeout | | | | touch | | | From 63317b35292079af1a5f3c3f8c81471dcb83a0b3 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Wed, 24 Mar 2021 23:46:17 +0300 Subject: [PATCH 0118/1135] ptx: move from getopts to clap (#1893) * ptx: move from getopts to clap * chore: delete comment * chore: fix some clippy warnings --- src/uu/ptx/Cargo.toml | 1 + src/uu/ptx/src/ptx.rs | 335 ++++++++++++++++++++++++++---------------- 2 files changed, 206 insertions(+), 130 deletions(-) diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index 3a91feeb0..d1e0267b6 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/ptx.rs" [dependencies] +clap = "2.33" aho-corasick = "0.7.3" getopts = "0.2.18" libc = "0.2.42" diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index bfcd6699f..989ab52ef 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate uucore; -use getopts::{Matches, Options}; +use clap::{App, Arg}; use regex::Regex; use std::cmp; use std::collections::{BTreeSet, HashMap, HashSet}; @@ -20,6 +20,12 @@ use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; static NAME: &str = "ptx"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static BRIEF: &str = "Usage: ptx [OPTION]... [INPUT]... (without -G) or: \ + ptx -G [OPTION]... [INPUT [OUTPUT]] \n Output a permuted index, \ + including context, of the words in the input files. \n\n Mandatory \ + arguments to long options are mandatory for short options too.\n + With no FILE, or when FILE is -, read standard input. \ + Default is '-F /'."; #[derive(Debug)] enum OutFormat { @@ -61,8 +67,11 @@ impl Default for Config { } } -fn read_word_filter_file(matches: &Matches, option: &str) -> HashSet { - let filename = matches.opt_str(option).expect("parsing options failed!"); +fn read_word_filter_file(matches: &clap::ArgMatches, option: &str) -> HashSet { + let filename = matches + .value_of(option) + .expect("parsing options failed!") + .to_string(); let reader = BufReader::new(crash_if_err!(1, File::open(filename))); let mut words: HashSet = HashSet::new(); for word in reader.lines() { @@ -81,23 +90,29 @@ struct WordFilter { } impl WordFilter { - fn new(matches: &Matches, config: &Config) -> WordFilter { - let (o, oset): (bool, HashSet) = if matches.opt_present("o") { - (true, read_word_filter_file(matches, "o")) + fn new(matches: &clap::ArgMatches, config: &Config) -> WordFilter { + let (o, oset): (bool, HashSet) = if matches.is_present(options::ONLY_FILE) { + (true, read_word_filter_file(matches, options::ONLY_FILE)) } else { (false, HashSet::new()) }; - let (i, iset): (bool, HashSet) = if matches.opt_present("i") { - (true, read_word_filter_file(matches, "i")) + let (i, iset): (bool, HashSet) = if matches.is_present(options::IGNORE_FILE) { + (true, read_word_filter_file(matches, options::IGNORE_FILE)) } else { (false, HashSet::new()) }; - if matches.opt_present("b") { + if matches.is_present(options::BREAK_FILE) { crash!(1, "-b not implemented yet"); } // Ignore empty string regex from cmd-line-args - let arg_reg: Option = if matches.opt_present("W") { - matches.opt_str("W").filter(|reg| !reg.is_empty()) + let arg_reg: Option = if matches.is_present(options::WORD_REGEXP) { + match matches.value_of(options::WORD_REGEXP) { + Some(v) => match v.is_empty() { + true => None, + false => Some(v.to_string()), + }, + None => None, + } } else { None }; @@ -131,55 +146,50 @@ struct WordRef { filename: String, } -fn print_version() { - println!("{} {}", NAME, VERSION); -} - -fn print_usage(opts: &Options) { - let brief = "Usage: ptx [OPTION]... [INPUT]... (without -G) or: \ - ptx -G [OPTION]... [INPUT [OUTPUT]] \n Output a permuted index, \ - including context, of the words in the input files. \n\n Mandatory \ - arguments to long options are mandatory for short options too."; - let explanation = "With no FILE, or when FILE is -, read standard input. \ - Default is '-F /'."; - println!("{}\n{}", opts.usage(&brief), explanation); -} - -fn get_config(matches: &Matches) -> Config { +fn get_config(matches: &clap::ArgMatches) -> Config { let mut config: Config = Default::default(); let err_msg = "parsing options failed"; - if matches.opt_present("G") { + if matches.is_present(options::TRADITIONAL) { config.gnu_ext = false; config.format = OutFormat::Roff; config.context_regex = "[^ \t\n]+".to_owned(); } else { crash!(1, "GNU extensions not implemented yet"); } - if matches.opt_present("S") { + if matches.is_present(options::SENTENCE_REGEXP) { crash!(1, "-S not implemented yet"); } - config.auto_ref = matches.opt_present("A"); - config.input_ref = matches.opt_present("r"); - config.right_ref &= matches.opt_present("R"); - config.ignore_case = matches.opt_present("f"); - if matches.opt_present("M") { - config.macro_name = matches.opt_str("M").expect(err_msg); + config.auto_ref = matches.is_present(options::AUTO_REFERENCE); + config.input_ref = matches.is_present(options::REFERENCES); + config.right_ref &= matches.is_present(options::RIGHT_SIDE_REFS); + config.ignore_case = matches.is_present(options::IGNORE_CASE); + if matches.is_present(options::MACRO_NAME) { + config.macro_name = matches + .value_of(options::MACRO_NAME) + .expect(err_msg) + .to_string(); } - if matches.opt_present("F") { - config.trunc_str = matches.opt_str("F").expect(err_msg); + if matches.is_present(options::IGNORE_CASE) { + config.trunc_str = matches + .value_of(options::IGNORE_CASE) + .expect(err_msg) + .to_string(); } - if matches.opt_present("w") { - let width_str = matches.opt_str("w").expect(err_msg); + if matches.is_present(options::WIDTH) { + let width_str = matches.value_of(options::WIDTH).expect(err_msg).to_string(); config.line_width = crash_if_err!(1, usize::from_str_radix(&width_str, 10)); } - if matches.opt_present("g") { - let gap_str = matches.opt_str("g").expect(err_msg); + if matches.is_present(options::GAP_SIZE) { + let gap_str = matches + .value_of(options::GAP_SIZE) + .expect(err_msg) + .to_string(); config.gap_size = crash_if_err!(1, usize::from_str_radix(&gap_str, 10)); } - if matches.opt_present("O") { + if matches.is_present(options::FORMAT_ROFF) { config.format = OutFormat::Roff; } - if matches.opt_present("T") { + if matches.is_present(options::FORMAT_TEX) { config.format = OutFormat::Tex; } config @@ -494,102 +504,167 @@ fn write_traditional_output( } } +mod options { + pub static FILE: &str = "file"; + pub static AUTO_REFERENCE: &str = "auto-reference"; + pub static TRADITIONAL: &str = "traditional"; + pub static FLAG_TRUNCATION: &str = "flag-truncation"; + pub static MACRO_NAME: &str = "macro-name"; + pub static FORMAT_ROFF: &str = "format=roff"; + pub static RIGHT_SIDE_REFS: &str = "right-side-refs"; + pub static SENTENCE_REGEXP: &str = "sentence-regexp"; + pub static FORMAT_TEX: &str = "format=tex"; + pub static WORD_REGEXP: &str = "word-regexp"; + pub static BREAK_FILE: &str = "break-file"; + pub static IGNORE_CASE: &str = "ignore-case"; + pub static GAP_SIZE: &str = "gap-size"; + pub static IGNORE_FILE: &str = "ignore-file"; + pub static ONLY_FILE: &str = "only-file"; + pub static REFERENCES: &str = "references"; + pub static WIDTH: &str = "width"; +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = Options::new(); - opts.optflag( - "A", - "auto-reference", - "output automatically generated references", - ); - opts.optflag("G", "traditional", "behave more like System V 'ptx'"); - opts.optopt( - "F", - "flag-truncation", - "use STRING for flagging line truncations", - "STRING", - ); - opts.optopt( - "M", - "macro-name", - "macro name to use instead of 'xx'", - "STRING", - ); - opts.optflag("O", "format=roff", "generate output as roff directives"); - opts.optflag( - "R", - "right-side-refs", - "put references at right, not counted in -w", - ); - opts.optopt( - "S", - "sentence-regexp", - "for end of lines or end of sentences", - "REGEXP", - ); - opts.optflag("T", "format=tex", "generate output as TeX directives"); - opts.optopt( - "W", - "word-regexp", - "use REGEXP to match each keyword", - "REGEXP", - ); - opts.optopt( - "b", - "break-file", - "word break characters in this FILE", - "FILE", - ); - opts.optflag( - "f", - "ignore-case", - "fold lower case to upper case for sorting", - ); - opts.optopt( - "g", - "gap-size", - "gap size in columns between output fields", - "NUMBER", - ); - opts.optopt( - "i", - "ignore-file", - "read ignore word list from FILE", - "FILE", - ); - opts.optopt( - "o", - "only-file", - "read only word list from this FILE", - "FILE", - ); - opts.optflag("r", "references", "first field of each line is a reference"); - opts.optopt( - "w", - "width", - "output width in columns, reference excluded", - "NUMBER", - ); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); + // let mut opts = Options::new(); + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(BRIEF) + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) + .arg( + Arg::with_name(options::AUTO_REFERENCE) + .short("A") + .long(options::AUTO_REFERENCE) + .help("output automatically generated references") + .takes_value(false), + ) + .arg( + Arg::with_name(options::TRADITIONAL) + .short("G") + .long(options::TRADITIONAL) + .help("behave more like System V 'ptx'"), + ) + .arg( + Arg::with_name(options::FLAG_TRUNCATION) + .short("F") + .long(options::FLAG_TRUNCATION) + .help("use STRING for flagging line truncations") + .value_name("STRING") + .takes_value(true), + ) + .arg( + Arg::with_name(options::MACRO_NAME) + .short("M") + .long(options::MACRO_NAME) + .help("macro name to use instead of 'xx'") + .value_name("STRING") + .takes_value(true), + ) + .arg( + Arg::with_name(options::FORMAT_ROFF) + .short("O") + .long(options::FORMAT_ROFF) + .help("generate output as roff directives"), + ) + .arg( + Arg::with_name(options::RIGHT_SIDE_REFS) + .short("R") + .long(options::RIGHT_SIDE_REFS) + .help("put references at right, not counted in -w") + .takes_value(false), + ) + .arg( + Arg::with_name(options::SENTENCE_REGEXP) + .short("S") + .long(options::SENTENCE_REGEXP) + .help("for end of lines or end of sentences") + .value_name("REGEXP") + .takes_value(true), + ) + .arg( + Arg::with_name(options::FORMAT_TEX) + .short("T") + .long(options::FORMAT_TEX) + .help("generate output as TeX directives"), + ) + .arg( + Arg::with_name(options::WORD_REGEXP) + .short("W") + .long(options::WORD_REGEXP) + .help("use REGEXP to match each keyword") + .value_name("REGEXP") + .takes_value(true), + ) + .arg( + Arg::with_name(options::BREAK_FILE) + .short("b") + .long(options::BREAK_FILE) + .help("word break characters in this FILE") + .value_name("FILE") + .takes_value(true), + ) + .arg( + Arg::with_name(options::IGNORE_CASE) + .short("f") + .long(options::IGNORE_CASE) + .help("fold lower case to upper case for sorting") + .takes_value(false), + ) + .arg( + Arg::with_name(options::GAP_SIZE) + .short("g") + .long(options::GAP_SIZE) + .help("gap size in columns between output fields") + .value_name("NUMBER") + .takes_value(true), + ) + .arg( + Arg::with_name(options::IGNORE_FILE) + .short("i") + .long(options::IGNORE_FILE) + .help("read ignore word list from FILE") + .value_name("FILE") + .takes_value(true), + ) + .arg( + Arg::with_name(options::ONLY_FILE) + .short("o") + .long(options::ONLY_FILE) + .help("read only word list from this FILE") + .value_name("FILE") + .takes_value(true), + ) + .arg( + Arg::with_name(options::REFERENCES) + .short("r") + .long(options::REFERENCES) + .help("first field of each line is a reference") + .value_name("FILE") + .takes_value(false), + ) + .arg( + Arg::with_name(options::WIDTH) + .short("w") + .long(options::WIDTH) + .help("output width in columns, reference excluded") + .value_name("NUMBER") + .takes_value(true), + ) + .get_matches_from(args); - let matches = return_if_err!(1, opts.parse(&args[1..])); + let input_files: Vec = match &matches.values_of(options::FILE) { + Some(v) => v.clone().map(|v| v.to_owned()).collect(), + None => vec!["-".to_string()], + }; - if matches.opt_present("help") { - print_usage(&opts); - return 0; - } - if matches.opt_present("version") { - print_version(); - return 0; - } let config = get_config(&matches); let word_filter = WordFilter::new(&matches, &config); - let file_map = read_input(&matches.free, &config); + let file_map = read_input(&input_files, &config); let word_set = create_word_set(&config, &word_filter, &file_map); - let output_file = if !config.gnu_ext && matches.free.len() == 2 { - matches.free[1].clone() + let output_file = if !config.gnu_ext && matches.args.len() == 2 { + matches.value_of(options::FILE).unwrap_or("-").to_string() } else { "-".to_owned() }; From a9786ce52804384dbf331aec43601c66dabac12f Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 25 Mar 2021 08:07:27 +0100 Subject: [PATCH 0119/1135] Reword the "why" a bit (#1903) --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dd60d2126..da92c80c2 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,8 @@ Why? Many GNU, Linux and other utilities are useful, and obviously [some](http://gnuwin32.sourceforge.net) [effort](http://unxutils.sourceforge.net) has been spent in the past to port them to Windows. However, those projects -are either old and abandoned, are hosted on CVS (which makes it more difficult -for new contributors to contribute to them), are written in platform-specific C, or -suffer from other issues. +are written in platform-specific C, a language considered unsafe compared to Rust, and +have other issues. Rust provides a good, platform-agnostic way of writing systems utilities that are easy to compile anywhere, and this is as good a way as any to try and learn it. From 99da9ea6ec985af34c0f88583465043013d30bd4 Mon Sep 17 00:00:00 2001 From: Mekka Date: Thu, 25 Mar 2021 02:36:48 -0700 Subject: [PATCH 0120/1135] Cleanup: Fix grammar in "cp" macro comments. (#1905) Replaced "they if" with "if they" in the comments above the "prompt_yes" macro. --- src/uu/cp/src/cp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 01ad4a8aa..569ee78bc 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -112,7 +112,7 @@ macro_rules! or_continue( }) ); -/// Prompts the user yes/no and returns `true` they if successfully +/// Prompts the user yes/no and returns `true` if they successfully /// answered yes. macro_rules! prompt_yes( ($($args:tt)+) => ({ From 52997b63fbdd6ee08c1ad5d32422819389ce5338 Mon Sep 17 00:00:00 2001 From: Sivachandran Date: Thu, 25 Mar 2021 15:57:34 +0530 Subject: [PATCH 0121/1135] pathchk: move from getopts to clap (#1897) --- src/uu/pathchk/Cargo.toml | 2 +- src/uu/pathchk/src/pathchk.rs | 143 ++++++++++++++++------------------ 2 files changed, 66 insertions(+), 79 deletions(-) diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index 452199f4f..c1d0d0dfa 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/pathchk.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/pathchk/src/pathchk.rs b/src/uu/pathchk/src/pathchk.rs index 745d0d36c..c27e52513 100644 --- a/src/uu/pathchk/src/pathchk.rs +++ b/src/uu/pathchk/src/pathchk.rs @@ -12,7 +12,7 @@ #[macro_use] extern crate uucore; -use getopts::Options; +use clap::{App, Arg}; use std::fs; use std::io::{ErrorKind, Write}; @@ -22,107 +22,94 @@ enum Mode { Basic, // check basic compatibility with POSIX Extra, // check for leading dashes and empty names Both, // a combination of `Basic` and `Extra` - Help, // show help - Version, // show version information } static NAME: &str = "pathchk"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Check whether file names are valid or portable"; + +mod options { + pub const POSIX: &str = "posix"; + pub const POSIX_SPECIAL: &str = "posix-special"; + pub const PORTABILITY: &str = "portability"; + pub const PATH: &str = "path"; +} // a few global constants as used in the GNU implementation const POSIX_PATH_MAX: usize = 256; const POSIX_NAME_MAX: usize = 14; -pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); +fn get_usage() -> String { + format!("{0} [OPTION]... NAME...", executable!()) +} - // add options - let mut opts = Options::new(); - opts.optflag("p", "posix", "check for (most) POSIX systems"); - opts.optflag( - "P", - "posix-special", - "check for empty names and leading \"-\"", - ); - opts.optflag( - "", - "portability", - "check for all POSIX systems (equivalent to -p -P)", - ); - opts.optflag("h", "help", "display this help text and exit"); - opts.optflag("V", "version", "output version information and exit"); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(e) => crash!(1, "{}", e), - }; +pub fn uumain(args: impl uucore::Args) -> i32 { + let usage = get_usage(); + + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(options::POSIX) + .short("p") + .help("check for most POSIX systems"), + ) + .arg( + Arg::with_name(options::POSIX_SPECIAL) + .short("P") + .help(r#"check for empty names and leading "-""#), + ) + .arg( + Arg::with_name(options::PORTABILITY) + .long(options::PORTABILITY) + .help("check for all POSIX systems (equivalent to -p -P)"), + ) + .arg(Arg::with_name(options::PATH).hidden(true).multiple(true)) + .get_matches_from(args); // set working mode - let mode = if matches.opt_present("version") { - Mode::Version - } else if matches.opt_present("help") { - Mode::Help - } else if (matches.opt_present("posix") && matches.opt_present("posix-special")) - || matches.opt_present("portability") - { + let is_posix = matches.values_of(options::POSIX).is_some(); + let is_posix_special = matches.values_of(options::POSIX_SPECIAL).is_some(); + let is_portability = matches.values_of(options::PORTABILITY).is_some(); + + let mode = if (is_posix && is_posix_special) || is_portability { Mode::Both - } else if matches.opt_present("posix") { + } else if is_posix { Mode::Basic - } else if matches.opt_present("posix-special") { + } else if is_posix_special { Mode::Extra } else { Mode::Default }; // take necessary actions - match mode { - Mode::Help => { - help(opts); - 0 - } - Mode::Version => { - version(); - 0 - } - _ => { - let mut res = if matches.free.is_empty() { - show_error!("missing operand\nTry {} --help for more information", NAME); - false - } else { - true - }; - // free strings are path operands - // FIXME: TCS, seems inefficient and overly verbose (?) - for p in matches.free { - let mut path = Vec::new(); - for path_segment in p.split('/') { - path.push(path_segment.to_string()); - } - res &= check_path(&mode, &path); - } - // determine error code - if res { - 0 - } else { - 1 + let paths = matches.values_of(options::PATH); + let mut res = if paths.is_none() { + show_error!("missing operand\nTry {} --help for more information", NAME); + false + } else { + true + }; + + if res { + // free strings are path operands + // FIXME: TCS, seems inefficient and overly verbose (?) + for p in paths.unwrap() { + let mut path = Vec::new(); + for path_segment in p.split('/') { + path.push(path_segment.to_string()); } + res &= check_path(&mode, &path); } } -} -// print help -fn help(opts: Options) { - let msg = format!( - "Usage: {} [OPTION]... NAME...\n\n\ - Diagnose invalid or unportable file names.", - NAME - ); - - print!("{}", opts.usage(&msg)); -} - -// print version information -fn version() { - println!("{} {}", NAME, VERSION); + // determine error code + if res { + 0 + } else { + 1 + } } // check a path, given as a slice of it's components and an operating mode From 23b70001a820404b1f50ff9f2dbf5bff7f213bf7 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 25 Mar 2021 20:24:53 +0100 Subject: [PATCH 0122/1135] ls: version sort (#1898) --- src/uu/ls/src/ls.rs | 26 ++- src/uu/ls/src/version_cmp.rs | 304 +++++++++++++++++++++++++++++++++++ tests/by-util/test_ls.rs | 79 ++++++++- 3 files changed, 407 insertions(+), 2 deletions(-) create mode 100644 src/uu/ls/src/version_cmp.rs diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 455b4f7b6..8714a0fa1 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -13,6 +13,8 @@ extern crate lazy_static; #[macro_use] extern crate uucore; +mod version_cmp; + use clap::{App, Arg}; use number_prefix::NumberPrefix; #[cfg(unix)] @@ -91,6 +93,7 @@ pub mod options { pub static SIZE: &str = "S"; pub static TIME: &str = "t"; pub static NONE: &str = "U"; + pub static VERSION: &str = "v"; } pub mod time { pub static ACCESS: &str = "u"; @@ -132,6 +135,7 @@ enum Sort { Name, Size, Time, + Version, } enum SizeFormat { @@ -270,6 +274,7 @@ impl Config { "name" => Sort::Name, "time" => Sort::Time, "size" => Sort::Size, + "version" => Sort::Version, // below should never happen as clap already restricts the values. _ => unreachable!("Invalid field for --sort"), } @@ -279,6 +284,8 @@ impl Config { Sort::Size } else if options.is_present(options::sort::NONE) { Sort::None + } else if options.is_present(options::sort::VERSION) { + Sort::Version } else { Sort::Name }; @@ -507,13 +514,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("Sort by : name, none (-U), time (-t) or size (-S)") .value_name("field") .takes_value(true) - .possible_values(&["name", "none", "time", "size"]) + .possible_values(&["name", "none", "time", "size", "version"]) .require_equals(true) .overrides_with_all(&[ options::SORT, options::sort::SIZE, options::sort::TIME, options::sort::NONE, + options::sort::VERSION, ]) ) .arg( @@ -525,6 +533,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::sort::SIZE, options::sort::TIME, options::sort::NONE, + options::sort::VERSION, ]) ) .arg( @@ -536,6 +545,19 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::sort::SIZE, options::sort::TIME, options::sort::NONE, + options::sort::VERSION, + ]) + ) + .arg( + Arg::with_name(options::sort::VERSION) + .short(options::sort::VERSION) + .help("Natural sort of (version) numbers in the filenames.") + .overrides_with_all(&[ + options::SORT, + options::sort::SIZE, + options::sort::TIME, + options::sort::NONE, + options::sort::VERSION, ]) ) .arg( @@ -549,6 +571,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::sort::SIZE, options::sort::TIME, options::sort::NONE, + options::sort::VERSION, ]) ) @@ -747,6 +770,7 @@ fn sort_entries(entries: &mut Vec, config: &Config) { .sort_by_key(|k| Reverse(get_metadata(k, config).map(|md| md.len()).unwrap_or(0))), // The default sort in GNU ls is case insensitive Sort::Name => entries.sort_by_key(|k| k.to_string_lossy().to_lowercase()), + Sort::Version => entries.sort_by(version_cmp::version_cmp), Sort::None => {} } diff --git a/src/uu/ls/src/version_cmp.rs b/src/uu/ls/src/version_cmp.rs new file mode 100644 index 000000000..3cd5989f1 --- /dev/null +++ b/src/uu/ls/src/version_cmp.rs @@ -0,0 +1,304 @@ +use std::{cmp::Ordering, path::PathBuf}; + +/// Compare pathbufs in a way that matches the GNU version sort, meaning that +/// numbers get sorted in a natural way. +pub(crate) fn version_cmp(a: &PathBuf, b: &PathBuf) -> Ordering { + let a_string = a.to_string_lossy(); + let b_string = b.to_string_lossy(); + let mut a = a_string.chars().peekable(); + let mut b = b_string.chars().peekable(); + + // The order determined from the number of leading zeroes. + // This is used if the filenames are equivalent up to leading zeroes. + let mut leading_zeroes = Ordering::Equal; + + loop { + match (a.next(), b.next()) { + // If the characters are both numerical. We collect the rest of the number + // and parse them to u64's and compare them. + (Some(a_char @ '0'..='9'), Some(b_char @ '0'..='9')) => { + let mut a_leading_zeroes = 0; + if a_char == '0' { + a_leading_zeroes = 1; + while let Some('0') = a.peek() { + a_leading_zeroes += 1; + a.next(); + } + } + + let mut b_leading_zeroes = 0; + if b_char == '0' { + b_leading_zeroes = 1; + while let Some('0') = b.peek() { + b_leading_zeroes += 1; + b.next(); + } + } + // The first different number of leading zeros determines the order + // so if it's already been determined by a previous number, we leave + // it as that ordering. + // It's b.cmp(&a), because the *largest* number of leading zeros + // should go first + if leading_zeroes == Ordering::Equal { + leading_zeroes = b_leading_zeroes.cmp(&a_leading_zeroes); + } + + let mut a_str = String::new(); + let mut b_str = String::new(); + if a_char != '0' { + a_str.push(a_char); + } + if b_char != '0' { + b_str.push(b_char); + } + + // Unwrapping here is fine because we only call next if peek returns + // Some(_), so next should also return Some(_). + while let Some('0'..='9') = a.peek() { + a_str.push(a.next().unwrap()); + } + + while let Some('0'..='9') = b.peek() { + b_str.push(b.next().unwrap()); + } + + // Since the leading zeroes are stripped, the length can be + // used to compare the numbers. + match a_str.len().cmp(&b_str.len()) { + Ordering::Equal => {} + x => return x, + } + + // At this point, leading zeroes are stripped and the lengths + // are equal, meaning that the strings can be compared using + // the standard compare function. + match a_str.cmp(&b_str) { + Ordering::Equal => {} + x => return x, + } + } + // If there are two characters we just compare the characters + (Some(a_char), Some(b_char)) => match a_char.cmp(&b_char) { + Ordering::Equal => {} + x => return x, + }, + // Otherise, we compare the options (because None < Some(_)) + (a_opt, b_opt) => match a_opt.cmp(&b_opt) { + // If they are completely equal except for leading zeroes, we use the leading zeroes. + Ordering::Equal => return leading_zeroes, + x => return x, + }, + } + } +} + +#[cfg(test)] +mod tests { + use crate::version_cmp::version_cmp; + use std::cmp::Ordering; + use std::path::PathBuf; + #[test] + fn test_version_cmp() { + // Identical strings + assert_eq!( + version_cmp(&PathBuf::from("hello"), &PathBuf::from("hello")), + Ordering::Equal + ); + + assert_eq!( + version_cmp(&PathBuf::from("file12"), &PathBuf::from("file12")), + Ordering::Equal + ); + + assert_eq!( + version_cmp( + &PathBuf::from("file12-suffix"), + &PathBuf::from("file12-suffix") + ), + Ordering::Equal + ); + + assert_eq!( + version_cmp( + &PathBuf::from("file12-suffix24"), + &PathBuf::from("file12-suffix24") + ), + Ordering::Equal + ); + + // Shortened names + assert_eq!( + version_cmp(&PathBuf::from("world"), &PathBuf::from("wo")), + Ordering::Greater, + ); + + assert_eq!( + version_cmp(&PathBuf::from("hello10wo"), &PathBuf::from("hello10world")), + Ordering::Less, + ); + + // Simple names + assert_eq!( + version_cmp(&PathBuf::from("world"), &PathBuf::from("hello")), + Ordering::Greater, + ); + + assert_eq!( + version_cmp(&PathBuf::from("hello"), &PathBuf::from("world")), + Ordering::Less + ); + + assert_eq!( + version_cmp(&PathBuf::from("apple"), &PathBuf::from("ant")), + Ordering::Greater + ); + + assert_eq!( + version_cmp(&PathBuf::from("ant"), &PathBuf::from("apple")), + Ordering::Less + ); + + // Uppercase letters + assert_eq!( + version_cmp(&PathBuf::from("Beef"), &PathBuf::from("apple")), + Ordering::Less, + "Uppercase letters are sorted before all lowercase letters" + ); + + assert_eq!( + version_cmp(&PathBuf::from("Apple"), &PathBuf::from("apple")), + Ordering::Less + ); + + assert_eq!( + version_cmp(&PathBuf::from("apple"), &PathBuf::from("aPple")), + Ordering::Greater + ); + + // Numbers + assert_eq!( + version_cmp(&PathBuf::from("100"), &PathBuf::from("20")), + Ordering::Greater, + "Greater numbers are greater even if they start with a smaller digit", + ); + + assert_eq!( + version_cmp(&PathBuf::from("20"), &PathBuf::from("20")), + Ordering::Equal, + "Equal numbers are equal" + ); + + assert_eq!( + version_cmp(&PathBuf::from("15"), &PathBuf::from("200")), + Ordering::Less, + "Small numbers are smaller" + ); + + // Comparing numbers with other characters + assert_eq!( + version_cmp(&PathBuf::from("1000"), &PathBuf::from("apple")), + Ordering::Less, + "Numbers are sorted before other characters" + ); + + assert_eq!( + version_cmp(&PathBuf::from("file1000"), &PathBuf::from("fileapple")), + Ordering::Less, + "Numbers in the middle of the name are sorted before other characters" + ); + + // Leading zeroes + assert_eq!( + version_cmp(&PathBuf::from("012"), &PathBuf::from("12")), + Ordering::Less, + "A single leading zero can make a difference" + ); + + assert_eq!( + version_cmp(&PathBuf::from("000800"), &PathBuf::from("0000800")), + Ordering::Greater, + "Leading number of zeroes is used even if both non-zero number of zeros" + ); + + // Numbers and other characters combined + assert_eq!( + version_cmp(&PathBuf::from("ab10"), &PathBuf::from("aa11")), + Ordering::Greater + ); + + assert_eq!( + version_cmp(&PathBuf::from("aa10"), &PathBuf::from("aa11")), + Ordering::Less, + "Numbers after other characters are handled correctly." + ); + + assert_eq!( + version_cmp(&PathBuf::from("aa2"), &PathBuf::from("aa100")), + Ordering::Less, + "Numbers after alphabetical characters are handled correctly." + ); + + assert_eq!( + version_cmp(&PathBuf::from("aa10bb"), &PathBuf::from("aa11aa")), + Ordering::Less, + "Number is used even if alphabetical characters after it differ." + ); + + assert_eq!( + version_cmp(&PathBuf::from("aa10aa0010"), &PathBuf::from("aa11aa1")), + Ordering::Less, + "Second number is ignored if the first number differs." + ); + + assert_eq!( + version_cmp(&PathBuf::from("aa10aa0010"), &PathBuf::from("aa10aa1")), + Ordering::Greater, + "Second number is used if the rest is equal." + ); + + assert_eq!( + version_cmp(&PathBuf::from("aa10aa0010"), &PathBuf::from("aa00010aa1")), + Ordering::Greater, + "Second number is used if the rest is equal up to leading zeroes of the first number." + ); + + assert_eq!( + version_cmp(&PathBuf::from("aa10aa0022"), &PathBuf::from("aa010aa022")), + Ordering::Greater, + "The leading zeroes of the first number has priority." + ); + + assert_eq!( + version_cmp(&PathBuf::from("aa10aa0022"), &PathBuf::from("aa10aa022")), + Ordering::Less, + "The leading zeroes of other numbers than the first are used." + ); + + assert_eq!( + version_cmp(&PathBuf::from("file-1.4"), &PathBuf::from("file-1.13")), + Ordering::Less, + "Periods are handled as normal text, not as a decimal point." + ); + + // Greater than u64::Max + // u64 == 18446744073709551615 so this should be plenty: + // 20000000000000000000000 + assert_eq!( + version_cmp( + &PathBuf::from("aa2000000000000000000000bb"), + &PathBuf::from("aa002000000000000000000001bb") + ), + Ordering::Less, + "Numbers larger than u64::MAX are handled correctly without crashing" + ); + + assert_eq!( + version_cmp( + &PathBuf::from("aa2000000000000000000000bb"), + &PathBuf::from("aa002000000000000000000000bb") + ), + Ordering::Greater, + "Leading zeroes for numbers larger than u64::MAX are handled correctly without crashing" + ); + } +} diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index ecd288735..091d47234 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -526,7 +526,6 @@ fn test_ls_order_time() { at.metadata("test-2").permissions(), ) .unwrap(); - let second_access = at.open("test-2").metadata().unwrap().accessed().unwrap(); let result = scene.ucmd().arg("-al").run(); println!("stderr = {:?}", result.stderr); @@ -870,3 +869,81 @@ fn test_ls_hidden_windows() { assert!(result.success); assert!(result.stdout.contains(file)); } + +#[test] +fn test_ls_version_sort() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + for filename in &[ + "a2", + "b1", + "b20", + "a1.4", + "a1.40", + "b3", + "b11", + "b20b", + "b20a", + "a100", + "a1.13", + "aa", + "a1", + "aaa", + "a1.00000040", + "abab", + "ab", + "a01.40", + "a001.001", + "a01.0000001", + "a01.001", + "a001.01", + ] { + at.touch(filename); + } + + let mut expected = vec![ + "a1", + "a001.001", + "a001.01", + "a01.0000001", + "a01.001", + "a1.4", + "a1.13", + "a01.40", + "a1.00000040", + "a1.40", + "a2", + "a100", + "aa", + "aaa", + "ab", + "abab", + "b1", + "b3", + "b11", + "b20", + "b20a", + "b20b", + "", // because of '\n' at the end of the output + ]; + + let result = scene.ucmd().arg("-1v").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + + assert_eq!(result.stdout.split('\n').collect::>(), expected); + + let result = scene.ucmd().arg("-1").arg("--sort=version").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + + assert_eq!(result.stdout.split('\n').collect::>(), expected); + + let result = scene.ucmd().arg("-a1v").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + + expected.insert(0, ".."); + expected.insert(0, "."); + assert_eq!(result.stdout.split('\n').collect::>(), expected,) +} From 61eb4f250d761e893168a6345fbf1f4c0338280b Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Thu, 25 Mar 2021 23:04:02 +0100 Subject: [PATCH 0123/1135] rm: add more tests --- src/uu/rm/src/rm.rs | 9 ++--- tests/by-util/test_rm.rs | 77 ++++++++++++++++++++++++++++++---------- 2 files changed, 61 insertions(+), 25 deletions(-) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 6e26cb82a..033a1a4aa 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -233,7 +233,7 @@ fn remove(files: Vec, options: Options) -> bool { // (e.g., permission), even rm -f should fail with // outputting the error, but there's no easy eay. if !options.force { - show_error!("no such file or directory '{}'", filename); + show_error!("cannot remove '{}': No such file or directory", filename); true } else { false @@ -289,7 +289,7 @@ fn handle_dir(path: &Path, options: &Options) -> bool { had_err = true; } else { show_error!( - "could not remove directory '{}' (did you mean to pass '-r' or '-R'?)", + "cannot remove '{}': Is a directory", // GNU's rm error message does not include help path.display() ); had_err = true; @@ -326,10 +326,7 @@ fn remove_dir(path: &Path, options: &Options) -> bool { } } else { // called to remove a symlink_dir (windows) without "-r"/"-R" or "-d" - show_error!( - "could not remove directory '{}' (did you mean to pass '-r' or '-R'?)", - path.display() - ); + show_error!("cannot remove '{}': Is a directory", path.display()); return true; } } else { diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 9556bf8e7..149d509c5 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -17,7 +17,12 @@ fn test_rm_failed() { let (_at, mut ucmd) = at_and_ucmd!(); let file = "test_rm_one_file"; - ucmd.arg(file).fails(); // Doesn't exist + let result = ucmd.arg(file).fails(); // Doesn't exist + + assert!(result.stderr.contains(&format!( + "cannot remove '{}': No such file or directory", + file + ))); } #[test] @@ -115,6 +120,22 @@ fn test_rm_empty_directory() { assert!(!at.dir_exists(dir)); } +#[test] +fn test_rm_empty_directory_verbose() { + let (at, mut ucmd) = at_and_ucmd!(); + let dir = "test_rm_empty_directory_verbose"; + + at.mkdir(dir); + + ucmd.arg("-d") + .arg("-v") + .arg(dir) + .succeeds() + .stdout_only(format!("removed directory '{}'\n", dir)); + + assert!(!at.dir_exists(dir)); +} + #[test] fn test_rm_non_empty_directory() { let (at, mut ucmd) = at_and_ucmd!(); @@ -151,22 +172,17 @@ fn test_rm_recursive() { } #[test] -fn test_rm_errors() { +fn test_rm_directory_without_flag() { let (at, mut ucmd) = at_and_ucmd!(); - let dir = "test_rm_errors_directory"; - let file_a = "test_rm_errors_directory/test_rm_errors_file_a"; - let file_b = "test_rm_errors_directory/test_rm_errors_file_b"; + let dir = "test_rm_directory_without_flag_dir"; at.mkdir(dir); - at.touch(file_a); - at.touch(file_b); - // $ rm test_rm_errors_directory - // rm: error: could not remove directory 'test_rm_errors_directory' (did you mean to pass '-r'?) - ucmd.arg(dir).fails().stderr_is( - "rm: error: could not remove directory 'test_rm_errors_directory' (did you mean \ - to pass '-r' or '-R'?)\n", - ); + let result = ucmd.arg(dir).fails(); + println!("{}", result.stderr); + assert!(result + .stderr + .contains(&format!("cannot remove '{}': Is a directory", dir))); } #[test] @@ -186,18 +202,41 @@ fn test_rm_verbose() { } #[test] -fn test_rm_dir_symlink() { +#[cfg(not(windows))] +// on unix symlink_dir is a file +fn test_rm_symlink_dir() { let (at, mut ucmd) = at_and_ucmd!(); - let dir = "test_rm_dir_symlink_dir"; - let link = "test_rm_dir_symlink_link"; + + let dir = "test_rm_symlink_dir_directory"; + let link = "test_rm_symlink_dir_link"; at.mkdir(dir); at.symlink_dir(dir, link); - #[cfg(not(windows))] ucmd.arg(link).succeeds(); - #[cfg(windows)] - ucmd.arg("-r").arg(link).succeeds(); +} + +#[test] +#[cfg(windows)] +// on windows removing symlink_dir requires "-r" or "-d" +fn test_rm_symlink_dir() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let dir = "test_rm_symlink_dir_directory"; + let link = "test_rm_symlink_dir_link"; + + at.mkdir(dir); + at.symlink_dir(dir, link); + + let result = scene.ucmd().arg(link).fails(); + assert!(result + .stderr + .contains(&format!("cannot remove '{}': Is a directory", link))); + + assert!(at.dir_exists(link)); + + scene.ucmd().arg("-r").arg(link).succeeds(); } #[test] From f431f58dd890ea9dad386233c18b9555182fcb46 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 25 Mar 2021 23:28:47 +0100 Subject: [PATCH 0124/1135] Bump min rustc to 1.40 (#1909) --- .github/workflows/CICD.yml | 2 +- .travis.yml | 2 +- Cargo.lock | 60 +++++++++++++------------------------- Cargo.toml | 8 ++--- README.md | 2 +- 5 files changed, 26 insertions(+), 48 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 97369a8e7..f1ddf9be1 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -11,7 +11,7 @@ env: PROJECT_NAME: coreutils PROJECT_DESC: "Core universal (cross-platform) utilities" PROJECT_AUTH: "uutils" - RUST_MIN_SRV: "1.33.0" ## v1.33.0 - minimum version for tempfile 3.1.0 and libc needed for aarch64 + RUST_MIN_SRV: "1.40.0" ## v1.40.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 on: [push, pull_request] diff --git a/.travis.yml b/.travis.yml index 3cd7db130..27525b5f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ matrix: - rust: nightly fast_finish: true include: - - rust: 1.33.0 + - rust: 1.40.0 env: FEATURES=unix # - rust: stable # os: linux diff --git a/Cargo.lock b/Cargo.lock index aabac3783..4851a6e13 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "advapi32-sys" version = "0.2.0" @@ -105,7 +107,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "byteorder" -version = "1.3.4" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -118,7 +120,7 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.61" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -180,8 +182,6 @@ dependencies = [ name = "coreutils" version = "0.0.4" dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -189,12 +189,9 @@ dependencies = [ "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -296,7 +293,6 @@ dependencies = [ "uu_yes 0.0.4", "uucore 0.0.7", "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -312,7 +308,7 @@ name = "cpp_build" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -347,7 +343,7 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -728,7 +724,7 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -791,7 +787,7 @@ name = "onig_sys" version = "69.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1033,7 +1029,7 @@ name = "regex-automata" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1054,11 +1050,6 @@ name = "rust-ini" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "rustc-demangle" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "rustc_version" version = "0.2.3" @@ -1074,10 +1065,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "same-file" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1263,14 +1254,6 @@ dependencies = [ "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "thread_local" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "time" version = "0.1.42" @@ -1866,7 +1849,7 @@ dependencies = [ name = "uu_od" version = "0.0.4" dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1887,7 +1870,7 @@ dependencies = [ name = "uu_pathchk" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1924,6 +1907,7 @@ name = "uu_ptx" version = "0.0.4" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2348,9 +2332,9 @@ name = "walkdir" version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2450,7 +2434,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winapi-util" -version = "0.1.2" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2484,9 +2468,9 @@ dependencies = [ "checksum bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" "checksum bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" -"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +"checksum byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" "checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" -"checksum cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)" = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" +"checksum cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)" = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" "checksum cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" "checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" @@ -2589,10 +2573,9 @@ dependencies = [ "checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" "checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" -"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -"checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" +"checksum same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" "checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" @@ -2614,7 +2597,6 @@ dependencies = [ "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" "checksum thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" -"checksum thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" "checksum typenum 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" @@ -2639,6 +2621,6 @@ dependencies = [ "checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" +"checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" diff --git a/Cargo.toml b/Cargo.toml index bf11e66fa..208fd5d9c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -326,12 +326,8 @@ whoami = { optional=true, version="0.0.4", package="uu_whoami", path="src/uu/w yes = { optional=true, version="0.0.4", package="uu_yes", path="src/uu/yes" } # # * pinned transitive dependencies -pin_cc = { version="1.0.61, < 1.0.62", package="cc" } ## cc v1.0.62 has compiler errors for MinRustV v1.32.0, requires 1.34 (for `std::str::split_ascii_whitespace()`) -pin_rustc-demangle = { version="0.1.16, < 0.1.17", package="rustc-demangle" } ## rust-demangle v0.1.17 has compiler errors for MinRustV v1.32.0, expects 1.33 -pin_same-file = { version="1.0.4, < 1.0.6", package="same-file" } ## same-file v1.0.6 has compiler errors for MinRustV v1.32.0, expects 1.34 -pin_winapi-util = { version="0.1.2, < 0.1.3", package="winapi-util" } ## winapi-util v0.1.3 has compiler errors for MinRustV v1.32.0, expects 1.34 -pin_byteorder = { version="1.3.4, < 1.4.0", package="byteorder" } ## byteorder v1.4 has compiler errors for MinRustV v1.32.0, requires 1.3 (for `use of unstable library feature 'try_from' (see issue #33417)`) -pin_thread_local = { version="1.1.0, < 1.1.1", package="thread_local" } ## thread_local v1.1.2 has compiler errors for MinRustV v1.32.0, requires 1.36 (for `use of unstable library feature 'maybe_uninit'`) +# Not needed for now. Keep as examples: +#pin_cc = { version="1.0.61, < 1.0.62", package="cc" } ## cc v1.0.62 has compiler errors for MinRustV v1.32.0, requires 1.34 (for `std::str::split_ascii_whitespace()`) [dev-dependencies] conv = "0.3" diff --git a/README.md b/README.md index da92c80c2..7433f49e6 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Requirements ### 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.33.0`. +The current oldest supported version of the Rust compiler is `1.40.0`. On both Windows and Redox, only the nightly version is tested currently. From 035f811dd06f934cde7bc7a4bd48eb91184c2be0 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Fri, 26 Mar 2021 13:09:16 +0300 Subject: [PATCH 0125/1135] Fix "panic message is not a string literal" warnings (#1915) New in Rust 1.51. Closes #1914 --- src/uu/tail/src/tail.rs | 6 +++--- src/uucore_procs/src/lib.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 3a6b04b29..ffe27e26c 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -382,7 +382,7 @@ fn follow(readers: &mut [BufReader], filenames: &[String], settings: } print!("{}", datum); } - Err(err) => panic!(err), + Err(err) => panic!("{}", err), } } } @@ -509,7 +509,7 @@ fn unbounded_tail(reader: &mut BufReader, settings: &Settings) { ringbuf.push_back(datum); } } - Err(err) => panic!(err), + Err(err) => panic!("{}", err), } } let mut stdout = stdout(); @@ -540,7 +540,7 @@ fn unbounded_tail(reader: &mut BufReader, settings: &Settings) { ringbuf.push_back(datum[0]); } } - Err(err) => panic!(err), + Err(err) => panic!("{}", err), } } let mut stdout = stdout(); diff --git a/src/uucore_procs/src/lib.rs b/src/uucore_procs/src/lib.rs index aa77316ee..10368a5bd 100644 --- a/src/uucore_procs/src/lib.rs +++ b/src/uucore_procs/src/lib.rs @@ -56,10 +56,10 @@ pub fn main(stream: proc_macro::TokenStream) -> proc_macro::TokenStream { let mut expr = match expr { syn::Expr::Lit(expr_lit) => match expr_lit.lit { syn::Lit::Str(ref lit_str) => lit_str.parse::().unwrap(), - _ => panic!(ARG_PANIC_TEXT), + _ => panic!("{}", ARG_PANIC_TEXT), }, syn::Expr::Path(expr_path) => expr_path, - _ => panic!(ARG_PANIC_TEXT), + _ => panic!("{}", ARG_PANIC_TEXT), }; proc_dbg!(&expr); From 2d58ea5f8bf3232a2339d130ad43364f1cd79329 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Sat, 8 Dec 2018 21:57:53 +0530 Subject: [PATCH 0126/1135] pr: print 56 lines of content with 5 blank trailer and header lines --- Cargo.toml | 2 + src/pr/Cargo.toml | 21 +++++++ src/pr/pr.rs | 139 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 162 insertions(+) create mode 100644 src/pr/Cargo.toml create mode 100644 src/pr/pr.rs diff --git a/Cargo.toml b/Cargo.toml index 208fd5d9c..8afd36761 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,6 +64,7 @@ feat_common_core = [ "nl", "od", "paste", + "pr", "printenv", "printf", "ptx", @@ -285,6 +286,7 @@ od = { optional=true, version="0.0.4", package="uu_od", path="src/uu/od" } paste = { optional=true, version="0.0.4", package="uu_paste", path="src/uu/paste" } pathchk = { optional=true, version="0.0.4", package="uu_pathchk", path="src/uu/pathchk" } pinky = { optional=true, version="0.0.4", package="uu_pinky", path="src/uu/pinky" } +pr = { optional=true, path="src/pr" } printenv = { optional=true, version="0.0.4", package="uu_printenv", path="src/uu/printenv" } printf = { optional=true, version="0.0.4", package="uu_printf", path="src/uu/printf" } ptx = { optional=true, version="0.0.4", package="uu_ptx", path="src/uu/ptx" } diff --git a/src/pr/Cargo.toml b/src/pr/Cargo.toml new file mode 100644 index 000000000..1093462af --- /dev/null +++ b/src/pr/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "pr" +version = "0.0.1" +authors = ["Tilak Patidar "] +build = "../../mkmain.rs" + +[lib] +name = "uu_pr" +path = "pr.rs" + +[dependencies] +getopts = "0.2.18" +time = "0.1.40" + +[dependencies.uucore] +path = "../uucore" +features = ["libc"] + +[[bin]] +name = "pr" +path = "../../uumain.rs" diff --git a/src/pr/pr.rs b/src/pr/pr.rs new file mode 100644 index 000000000..aec6fb208 --- /dev/null +++ b/src/pr/pr.rs @@ -0,0 +1,139 @@ +#![crate_name = "uu_pr"] + +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE file +// that was distributed with this source code. +// + +extern crate getopts; + +//#[macro_use] +//extern crate uucore; +use std::fs::File; +use std::io::{BufRead, BufReader}; +use std::vec::Vec; +//use uucore::fs::is_stdin_interactive; + + +static NAME: &str = "pr"; +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static LINES_PER_PAGE: usize = 66; +static HEADER_LINES_PER_PAGE: usize = 5; +static TRAILER_LINES_PER_PAGE: usize = 5; +static CONTENT_LINES_PER_PAGE: usize = LINES_PER_PAGE - HEADER_LINES_PER_PAGE - TRAILER_LINES_PER_PAGE; + +pub fn uumain(args: Vec) -> i32 { + let mut opts = getopts::Options::new(); + + opts.optopt( + "h", + "", + "Use the string header to replace the file name \ + in the header line.", + "STRING", + ); + opts.optflag("h", "help", "display this help and exit"); + opts.optflag("V", "version", "output version information and exit"); + + let matches = match opts.parse(&args[1..]) { + Ok(m) => m, + Err(e) => panic!("Invalid options\n{}", e), + }; + + if matches.opt_present("version") { + println!("{} {}", NAME, VERSION); + return 0; + } + + + if matches.opt_present("help") || matches.free.is_empty() { + println!("{} {} -- print files", NAME, VERSION); + println!(); + println!("Usage: {} [+page] [-column] [-adFfmprt] [[-e] [char] [gap]] + [-L locale] [-h header] [[-i] [char] [gap]] + [-l lines] [-o offset] [[-s] [char]] [[-n] [char] + [width]] [-w width] [-] [file ...].", NAME); + println!(); + println!( + "{}", + opts.usage( + "The pr utility is a printing and pagination filter + for text files. When multiple input files are spec- + ified, each is read, formatted, and written to stan- + dard output. By default, the input is separated + into 66-line pages, each with + + o A 5-line header with the page number, date, + time, and the pathname of the file. + + o A 5-line trailer consisting of blank lines. + + If standard output is associated with a terminal, + diagnostic messages are suppressed until the pr + utility has completed processing. + + When multiple column output is specified, text col- + umns are of equal width. By default text columns + are separated by at least one . Input lines + that do not fit into a text column are truncated. + Lines are not truncated under single column output." + ) + ); + if matches.free.is_empty() { + return 1; + } + return 0; + } + + let path = &matches.free[0]; + open(&path); + + 0 +} + +fn open(path: &str) -> std::io::Result<()> { + let file = File::open(path)?; + let lines = BufReader::new(file).lines(); + let mut i = 0; + let mut page: i32 = 0; + let mut buffered_content: Vec = Vec::new(); + for line in lines { + if i == CONTENT_LINES_PER_PAGE { + page = page + 1; + i = 0; + print!("{}", print_page(&buffered_content)); + buffered_content.clear(); + } + i = i + 1; + buffered_content.push(line?); + } + if i != 0 { + print!("{}", print_page(&buffered_content)); + buffered_content.clear(); + } + Ok(()) +} + +fn print_page(lines: &Vec) -> String { + let mut page_content: Vec = Vec::new(); + let header_content = header_content(); + let trailer_content = trailer_content(); + assert_eq!(lines.len() <= CONTENT_LINES_PER_PAGE, true, "Only {} lines of content allowed in a pr output page", CONTENT_LINES_PER_PAGE.to_string()); + assert_eq!(header_content.len(), HEADER_LINES_PER_PAGE, "Only {} lines of content allowed in a pr header", HEADER_LINES_PER_PAGE.to_string()); + assert_eq!(trailer_content.len(), TRAILER_LINES_PER_PAGE, "Only {} lines of content allowed in a pr trailer", TRAILER_LINES_PER_PAGE.to_string()); + page_content.extend(header_content); + for x in lines { + page_content.push(x.to_string()); + } + page_content.extend(trailer_content); + page_content.join("\n") +} + +fn header_content() -> Vec { + vec!["".to_string(), "".to_string(), "".to_string(), "".to_string(), "".to_string()] +} + +fn trailer_content() -> Vec { + vec!["".to_string(), "".to_string(), "".to_string(), "".to_string(), "".to_string()] +} From 2ee90ab09a61f28d8fb79af6dfb3eebc208a3b55 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Sat, 8 Dec 2018 23:03:15 +0530 Subject: [PATCH 0127/1135] pr: print pr header with file last modified time, path and page number --- src/pr/Cargo.toml | 1 + src/pr/pr.rs | 34 +++++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/pr/Cargo.toml b/src/pr/Cargo.toml index 1093462af..12ce16b5b 100644 --- a/src/pr/Cargo.toml +++ b/src/pr/Cargo.toml @@ -11,6 +11,7 @@ path = "pr.rs" [dependencies] getopts = "0.2.18" time = "0.1.40" +chrono = "0.4.6" [dependencies.uucore] path = "../uucore" diff --git a/src/pr/pr.rs b/src/pr/pr.rs index aec6fb208..d661ab1c6 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -7,12 +7,17 @@ // extern crate getopts; +extern crate chrono; //#[macro_use] //extern crate uucore; +use std::fs; use std::fs::File; use std::io::{BufRead, BufReader}; use std::vec::Vec; +use chrono::offset::Local; +use chrono::DateTime; + //use uucore::fs::is_stdin_interactive; @@ -94,6 +99,7 @@ pub fn uumain(args: Vec) -> i32 { fn open(path: &str) -> std::io::Result<()> { let file = File::open(path)?; + let file_last_modified_time = file_last_modified_time(path); let lines = BufReader::new(file).lines(); let mut i = 0; let mut page: i32 = 0; @@ -102,27 +108,30 @@ fn open(path: &str) -> std::io::Result<()> { if i == CONTENT_LINES_PER_PAGE { page = page + 1; i = 0; - print!("{}", print_page(&buffered_content)); + let header = header_content(&file_last_modified_time, path, page); + print!("{}", print_page(&header, &buffered_content)); buffered_content.clear(); } i = i + 1; buffered_content.push(line?); } if i != 0 { - print!("{}", print_page(&buffered_content)); + let header = header_content(&file_last_modified_time, path, page); + print!("{}", print_page(&header, &buffered_content)); buffered_content.clear(); } Ok(()) } -fn print_page(lines: &Vec) -> String { +fn print_page(header_content: &Vec, lines: &Vec) -> String { let mut page_content: Vec = Vec::new(); - let header_content = header_content(); let trailer_content = trailer_content(); assert_eq!(lines.len() <= CONTENT_LINES_PER_PAGE, true, "Only {} lines of content allowed in a pr output page", CONTENT_LINES_PER_PAGE.to_string()); assert_eq!(header_content.len(), HEADER_LINES_PER_PAGE, "Only {} lines of content allowed in a pr header", HEADER_LINES_PER_PAGE.to_string()); assert_eq!(trailer_content.len(), TRAILER_LINES_PER_PAGE, "Only {} lines of content allowed in a pr trailer", TRAILER_LINES_PER_PAGE.to_string()); - page_content.extend(header_content); + for x in header_content { + page_content.push(x.to_string()); + } for x in lines { page_content.push(x.to_string()); } @@ -130,8 +139,19 @@ fn print_page(lines: &Vec) -> String { page_content.join("\n") } -fn header_content() -> Vec { - vec!["".to_string(), "".to_string(), "".to_string(), "".to_string(), "".to_string()] +fn header_content(last_modified: &String, path: &str, page: i32) -> Vec { + let first_line: String = format!("{} {} Page {}", last_modified, path, page.to_string()); + vec![first_line, "".to_string(), "".to_string(), "".to_string(), "".to_string()] +} + +fn file_last_modified_time(path: &str) -> String { + let file_metadata = fs::metadata(path); + return file_metadata.map(|i| { + return i.modified().map(|x| { + let datetime: DateTime = x.into(); + datetime.format("%b %d %H:%M %Y").to_string() + }).unwrap_or(String::new()); + }).unwrap_or(String::new()); } fn trailer_content() -> Vec { From 9111f168aac0de081c6fdc682eebfcc4a405ab72 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Sat, 8 Dec 2018 23:13:01 +0530 Subject: [PATCH 0128/1135] pr: add -h to print header and -n to print line numbers pr: Add -h to print custom header instead of file name pr: Add -n to print line numbers --- src/pr/pr.rs | 132 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 110 insertions(+), 22 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index d661ab1c6..02403a6c4 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -27,6 +27,36 @@ static LINES_PER_PAGE: usize = 66; static HEADER_LINES_PER_PAGE: usize = 5; static TRAILER_LINES_PER_PAGE: usize = 5; static CONTENT_LINES_PER_PAGE: usize = LINES_PER_PAGE - HEADER_LINES_PER_PAGE - TRAILER_LINES_PER_PAGE; +static NUMBERING_MODE_DEFAULT_SEPARATOR: &str = "\t"; +static NUMBERING_MODE_DEFAULT_WIDTH: usize = 5; + +struct OutputOptions { + /// Line numbering mode + number: Option, + header: String, +} + +impl AsRef for OutputOptions { + fn as_ref(&self) -> &OutputOptions { + self + } +} + +struct NumberingMode { + /// Line numbering mode + width: usize, + separator: String, +} + +impl Default for NumberingMode { + fn default() -> NumberingMode { + NumberingMode { + width: NUMBERING_MODE_DEFAULT_WIDTH, + separator: NUMBERING_MODE_DEFAULT_SEPARATOR.to_string(), + } + } +} + pub fn uumain(args: Vec) -> i32 { let mut opts = getopts::Options::new(); @@ -38,7 +68,18 @@ pub fn uumain(args: Vec) -> i32 { in the header line.", "STRING", ); - opts.optflag("h", "help", "display this help and exit"); + + opts.optflagopt( + "n", + "", + "Provide width digit line numbering. The default for width, if not specified, is 5. The number occupies + the first width column positions of each text column or each line of -m output. If char (any nondigit + character) is given, it is appended to the line number to separate it from whatever follows. The default + for char is a . Line numbers longer than width columns are truncated.", + "[char][width]", + ); + + opts.optflag("", "help", "display this help and exit"); opts.optflag("V", "version", "output version information and exit"); let matches = match opts.parse(&args[1..]) { @@ -60,10 +101,7 @@ pub fn uumain(args: Vec) -> i32 { [-l lines] [-o offset] [[-s] [char]] [[-n] [char] [width]] [-w width] [-] [file ...].", NAME); println!(); - println!( - "{}", - opts.usage( - "The pr utility is a printing and pagination filter + let usage: &str = "The pr utility is a printing and pagination filter for text files. When multiple input files are spec- ified, each is read, formatted, and written to stan- dard output. By default, the input is separated @@ -82,9 +120,8 @@ pub fn uumain(args: Vec) -> i32 { umns are of equal width. By default text columns are separated by at least one . Input lines that do not fit into a text column are truncated. - Lines are not truncated under single column output." - ) - ); + Lines are not truncated under single column output."; + println!("{}", opts.usage(usage)); if matches.free.is_empty() { return 1; } @@ -92,38 +129,53 @@ pub fn uumain(args: Vec) -> i32 { } let path = &matches.free[0]; - open(&path); + let header: String = matches.opt_str("h").unwrap_or(path.to_string()); + let numbering_options = matches.opt_str("n").map(|i| { + NumberingMode { + width: i.parse::().unwrap_or(NumberingMode::default().width), + separator: NumberingMode::default().separator, + } + }).or_else(|| { + if matches.opt_present("n") { + return Some(NumberingMode::default()); + } + return None; + }); + + let options = OutputOptions { + number: numbering_options, + header, + }; + + pr(&path, options); 0 } -fn open(path: &str) -> std::io::Result<()> { +fn pr(path: &str, options: OutputOptions) -> std::io::Result<()> { let file = File::open(path)?; let file_last_modified_time = file_last_modified_time(path); let lines = BufReader::new(file).lines(); let mut i = 0; - let mut page: i32 = 0; + let mut page: usize = 0; let mut buffered_content: Vec = Vec::new(); for line in lines { if i == CONTENT_LINES_PER_PAGE { page = page + 1; i = 0; - let header = header_content(&file_last_modified_time, path, page); - print!("{}", print_page(&header, &buffered_content)); - buffered_content.clear(); + flush_buffered_page(&file_last_modified_time, &mut buffered_content, &options, page); } i = i + 1; buffered_content.push(line?); } if i != 0 { - let header = header_content(&file_last_modified_time, path, page); - print!("{}", print_page(&header, &buffered_content)); - buffered_content.clear(); + page = page + 1; + flush_buffered_page(&file_last_modified_time, &mut buffered_content, &options, page); } Ok(()) } -fn print_page(header_content: &Vec, lines: &Vec) -> String { +fn print_page(header_content: &Vec, lines: &Vec, options: &OutputOptions, page: usize) -> String { let mut page_content: Vec = Vec::new(); let trailer_content = trailer_content(); assert_eq!(lines.len() <= CONTENT_LINES_PER_PAGE, true, "Only {} lines of content allowed in a pr output page", CONTENT_LINES_PER_PAGE.to_string()); @@ -132,16 +184,52 @@ fn print_page(header_content: &Vec, lines: &Vec) -> String { for x in header_content { page_content.push(x.to_string()); } + + let width: usize = options.as_ref() + .number.as_ref() + .map(|i| i.width) + .unwrap_or(0); + let separator: String = options.as_ref() + .number.as_ref() + .map(|i| i.separator.to_string()) + .unwrap_or(NumberingMode::default().separator); + + let prev_lines = CONTENT_LINES_PER_PAGE * (page - 1); + let mut i = 1; for x in lines { - page_content.push(x.to_string()); + if options.number.is_none() { + page_content.push(x.to_string()); + } else { + let fmtd_line_number: String = get_fmtd_line_number(width, prev_lines + i, &separator); + page_content.push(format!("{}{}", fmtd_line_number, x.to_string())); + } + i = i + 1; } page_content.extend(trailer_content); page_content.join("\n") } -fn header_content(last_modified: &String, path: &str, page: i32) -> Vec { - let first_line: String = format!("{} {} Page {}", last_modified, path, page.to_string()); - vec![first_line, "".to_string(), "".to_string(), "".to_string(), "".to_string()] +fn get_fmtd_line_number(width: usize, line_number: usize, separator: &String) -> String { + format!("{:>width$}{}", take_last_n(&line_number.to_string(), width), separator, width = width) +} + +fn take_last_n(s: &String, n: usize) -> &str { + if s.len() >= n { + &s[s.len() - n..] + } else { + s + } +} + +fn flush_buffered_page(file_last_modified_time: &String, buffered_content: &mut Vec, options: &OutputOptions, page: usize) { + let header = header_content(file_last_modified_time, &options.header, page); + print!("{}", print_page(&header, buffered_content, &options, page)); + buffered_content.clear(); +} + +fn header_content(last_modified: &String, header: &String, page: usize) -> Vec { + let first_line: String = format!("{} {} Page {}", last_modified, header, page.to_string()); + vec!["".to_string(), "".to_string(), first_line, "".to_string(), "".to_string()] } fn file_last_modified_time(path: &str) -> String { From 7f87e42ad16d41db375e975a27b0e39e5c3d6d81 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Sun, 9 Dec 2018 19:04:58 +0530 Subject: [PATCH 0129/1135] pr: add support for multiple files --- src/pr/pr.rs | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 02403a6c4..4bd4d7fb1 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -17,6 +17,7 @@ use std::io::{BufRead, BufReader}; use std::vec::Vec; use chrono::offset::Local; use chrono::DateTime; +use getopts::Matches; //use uucore::fs::is_stdin_interactive; @@ -128,8 +129,23 @@ pub fn uumain(args: Vec) -> i32 { return 0; } - let path = &matches.free[0]; - let header: String = matches.opt_str("h").unwrap_or(path.to_string()); + + let mut files = matches.free.clone(); + if files.is_empty() { + //For stdin + files.push("-".to_owned()); + } + + for f in files { + let header: String = matches.opt_str("h").unwrap_or(f.to_string()); + let options = build_options(&matches, header); + pr(&f, options); + } + + 0 +} + +fn build_options(matches: &Matches, header: String) -> OutputOptions { let numbering_options = matches.opt_str("n").map(|i| { NumberingMode { width: i.parse::().unwrap_or(NumberingMode::default().width), @@ -141,15 +157,10 @@ pub fn uumain(args: Vec) -> i32 { } return None; }); - - let options = OutputOptions { + OutputOptions { number: numbering_options, header, - }; - - pr(&path, options); - - 0 + } } fn pr(path: &str, options: OutputOptions) -> std::io::Result<()> { From e69c9ada343063d2feadce4a989c9970016f240c Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Mon, 10 Dec 2018 18:56:51 +0530 Subject: [PATCH 0130/1135] pr: read from stdin --- src/pr/Cargo.toml | 3 + src/pr/pr.rs | 158 +++++++++++++++++++++++++++++++++++----------- 2 files changed, 124 insertions(+), 37 deletions(-) diff --git a/src/pr/Cargo.toml b/src/pr/Cargo.toml index 12ce16b5b..c53915747 100644 --- a/src/pr/Cargo.toml +++ b/src/pr/Cargo.toml @@ -17,6 +17,9 @@ chrono = "0.4.6" path = "../uucore" features = ["libc"] +[target.'cfg(unix)'.dependencies] +unix_socket = "0.5.0" + [[bin]] name = "pr" path = "../../uumain.rs" diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 4bd4d7fb1..fe9733274 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -8,18 +8,22 @@ extern crate getopts; extern crate chrono; +#[cfg(unix)] +extern crate unix_socket; -//#[macro_use] -//extern crate uucore; -use std::fs; -use std::fs::File; -use std::io::{BufRead, BufReader}; +#[macro_use] +extern crate uucore; + +use std::io::{BufRead, BufReader, Lines, stdin}; use std::vec::Vec; use chrono::offset::Local; use chrono::DateTime; use getopts::Matches; - -//use uucore::fs::is_stdin_interactive; +use getopts::Options; +use std::io::{self, Read}; +use std::fs::{metadata, File}; +#[cfg(unix)] +use std::os::unix::fs::FileTypeExt; static NAME: &str = "pr"; @@ -58,6 +62,21 @@ impl Default for NumberingMode { } } +enum InputType { + Directory, + File, + StdIn, + SymLink, + #[cfg(unix)] + BlockDevice, + #[cfg(unix)] + CharacterDevice, + #[cfg(unix)] + Fifo, + #[cfg(unix)] + Socket, +} + pub fn uumain(args: Vec) -> i32 { let mut opts = getopts::Options::new(); @@ -93,16 +112,35 @@ pub fn uumain(args: Vec) -> i32 { return 0; } + let mut files = matches.free.clone(); + if files.is_empty() { + //For stdin + files.push("-".to_owned()); + } - if matches.opt_present("help") || matches.free.is_empty() { - println!("{} {} -- print files", NAME, VERSION); - println!(); - println!("Usage: {} [+page] [-column] [-adFfmprt] [[-e] [char] [gap]] + if matches.opt_present("help") { + return print_usage(&mut opts, &matches); + } + + + for f in files { + let header: String = matches.opt_str("h").unwrap_or(f.to_string()); + let options = build_options(&matches, header); + pr(&f, options); + } + + 0 +} + +fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { + println!("{} {} -- print files", NAME, VERSION); + println!(); + println!("Usage: {} [+page] [-column] [-adFfmprt] [[-e] [char] [gap]] [-L locale] [-h header] [[-i] [char] [gap]] [-l lines] [-o offset] [[-s] [char]] [[-n] [char] [width]] [-w width] [-] [file ...].", NAME); - println!(); - let usage: &str = "The pr utility is a printing and pagination filter + println!(); + let usage: &str = "The pr utility is a printing and pagination filter for text files. When multiple input files are spec- ified, each is read, formatted, and written to stan- dard output. By default, the input is separated @@ -122,27 +160,11 @@ pub fn uumain(args: Vec) -> i32 { are separated by at least one . Input lines that do not fit into a text column are truncated. Lines are not truncated under single column output."; - println!("{}", opts.usage(usage)); - if matches.free.is_empty() { - return 1; - } - return 0; + println!("{}", opts.usage(usage)); + if matches.free.is_empty() { + return 1; } - - - let mut files = matches.free.clone(); - if files.is_empty() { - //For stdin - files.push("-".to_owned()); - } - - for f in files { - let header: String = matches.opt_str("h").unwrap_or(f.to_string()); - let options = build_options(&matches, header); - pr(&f, options); - } - - 0 + return 0; } fn build_options(matches: &Matches, header: String) -> OutputOptions { @@ -163,13 +185,40 @@ fn build_options(matches: &Matches, header: String) -> OutputOptions { } } +fn open(path: &str) -> Option> { + // TODO Use Result instead of Option + if path == "-" { + let stdin = stdin(); + return Some(Box::new(stdin) as Box); + } + + match get_input_type(path)? { + InputType::Directory => None, + #[cfg(unix)] + InputType::Socket => { + // TODO Add reading from socket + None + } + _ => { + match File::open(path) { + Ok(file) => Some(Box::new(file) as Box), + _ => None + } + } + } +} + fn pr(path: &str, options: OutputOptions) -> std::io::Result<()> { - let file = File::open(path)?; - let file_last_modified_time = file_last_modified_time(path); - let lines = BufReader::new(file).lines(); let mut i = 0; let mut page: usize = 0; let mut buffered_content: Vec = Vec::new(); + let file_last_modified_time = file_last_modified_time(path); + let reader = open(path); + // TODO Handle error here + let lines: Lines>> = reader.map(|i| { + BufReader::new(i).lines() + }).unwrap(); + for line in lines { if i == CONTENT_LINES_PER_PAGE { page = page + 1; @@ -244,7 +293,7 @@ fn header_content(last_modified: &String, header: &String, page: usize) -> Vec String { - let file_metadata = fs::metadata(path); + let file_metadata = metadata(path); return file_metadata.map(|i| { return i.modified().map(|x| { let datetime: DateTime = x.into(); @@ -256,3 +305,38 @@ fn file_last_modified_time(path: &str) -> String { fn trailer_content() -> Vec { vec!["".to_string(), "".to_string(), "".to_string(), "".to_string(), "".to_string()] } + +fn get_input_type(path: &str) -> Option { + if path == "-" { + return Some(InputType::StdIn); + } + + metadata(path).map(|i| { + match i.file_type() { + #[cfg(unix)] + ft if ft.is_block_device() => + { + Some(InputType::BlockDevice) + } + #[cfg(unix)] + ft if ft.is_char_device() => + { + Some(InputType::CharacterDevice) + } + #[cfg(unix)] + ft if ft.is_fifo() => + { + Some(InputType::Fifo) + } + #[cfg(unix)] + ft if ft.is_socket() => + { + Some(InputType::Socket) + } + ft if ft.is_dir() => Some(InputType::Directory), + ft if ft.is_file() => Some(InputType::File), + ft if ft.is_symlink() => Some(InputType::SymLink), + _ => None + } + }).unwrap_or(None) +} From 2d609b2cd17a88f1fbf8cfb70c9699ac898515ae Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Mon, 10 Dec 2018 22:07:16 +0530 Subject: [PATCH 0131/1135] pr: add custom errors pr: code refactoring for references --- src/pr/Cargo.toml | 1 + src/pr/pr.rs | 182 +++++++++++++++++++++++++++------------------- 2 files changed, 107 insertions(+), 76 deletions(-) diff --git a/src/pr/Cargo.toml b/src/pr/Cargo.toml index c53915747..08cc5ac30 100644 --- a/src/pr/Cargo.toml +++ b/src/pr/Cargo.toml @@ -12,6 +12,7 @@ path = "pr.rs" getopts = "0.2.18" time = "0.1.40" chrono = "0.4.6" +quick-error = "1.2.2" [dependencies.uucore] path = "../uucore" diff --git a/src/pr/pr.rs b/src/pr/pr.rs index fe9733274..058133422 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -6,24 +6,23 @@ // that was distributed with this source code. // -extern crate getopts; -extern crate chrono; #[cfg(unix)] extern crate unix_socket; - #[macro_use] +extern crate quick_error; +extern crate chrono; +extern crate getopts; extern crate uucore; -use std::io::{BufRead, BufReader, Lines, stdin}; +use std::io::{BufRead, BufReader, stdin, stdout, stderr, Error, Read, Write, Stdout}; use std::vec::Vec; use chrono::offset::Local; use chrono::DateTime; -use getopts::Matches; -use getopts::Options; -use std::io::{self, Read}; +use getopts::{Matches, Options}; use std::fs::{metadata, File}; #[cfg(unix)] use std::os::unix::fs::FileTypeExt; +use quick_error::ResultExt; static NAME: &str = "pr"; @@ -77,6 +76,27 @@ enum InputType { Socket, } +quick_error! { + #[derive(Debug)] + enum PrError { + Input(err: Error, path: String) { + context(path: &'a str, err: Error) -> (err, path.to_owned()) + display("pr: Reading from input {0} gave error", path) + cause(err) + } + + UnknownFiletype(path: String) { + display("pr: {0}: unknown filetype", path) + } + + EncounteredErrors(msg: String) { + display("pr: {0} encountered", msg) + } + IsDirectory(path: String) { + display("pr: {0}: Is a directory", path) + } + } +} pub fn uumain(args: Vec) -> i32 { let mut opts = getopts::Options::new(); @@ -112,7 +132,7 @@ pub fn uumain(args: Vec) -> i32 { return 0; } - let mut files = matches.free.clone(); + let mut files: Vec = matches.free.clone(); if files.is_empty() { //For stdin files.push("-".to_owned()); @@ -122,14 +142,15 @@ pub fn uumain(args: Vec) -> i32 { return print_usage(&mut opts, &matches); } - for f in files { - let header: String = matches.opt_str("h").unwrap_or(f.to_string()); - let options = build_options(&matches, header); - pr(&f, options); + let header: &String = &matches.opt_str("h").unwrap_or(f.to_string()); + let options: &OutputOptions = &build_options(&matches, header); + let status: i32 = pr(&f, options); + if status != 0 { + return status; + } } - - 0 + return 0; } fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { @@ -167,8 +188,8 @@ fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { return 0; } -fn build_options(matches: &Matches, header: String) -> OutputOptions { - let numbering_options = matches.opt_str("n").map(|i| { +fn build_options(matches: &Matches, header: &String) -> OutputOptions { + let numbering_options: Option = matches.opt_str("n").map(|i| { NumberingMode { width: i.parse::().unwrap_or(NumberingMode::default().width), separator: NumberingMode::default().separator, @@ -181,68 +202,75 @@ fn build_options(matches: &Matches, header: String) -> OutputOptions { }); OutputOptions { number: numbering_options, - header, + header: header.to_string(), } } -fn open(path: &str) -> Option> { - // TODO Use Result instead of Option - if path == "-" { - let stdin = stdin(); - return Some(Box::new(stdin) as Box); - } - - match get_input_type(path)? { - InputType::Directory => None, +fn open(path: &str) -> Result, PrError> { + match get_input_type(path) { + Some(InputType::Directory) => Err(PrError::IsDirectory(path.to_string())), #[cfg(unix)] - InputType::Socket => { + Some(InputType::Socket) => { // TODO Add reading from socket - None + Err(PrError::EncounteredErrors("Reading from socket not supported yet".to_string())) } - _ => { - match File::open(path) { - Ok(file) => Some(Box::new(file) as Box), - _ => None - } + Some(InputType::StdIn) => { + let stdin = stdin(); + Ok(Box::new(stdin) as Box) } + Some(_) => Ok(Box::new(File::open(path).context(path)?) as Box), + None => Err(PrError::UnknownFiletype(path.to_string())) } } -fn pr(path: &str, options: OutputOptions) -> std::io::Result<()> { +fn pr(path: &str, options: &OutputOptions) -> i32 { let mut i = 0; let mut page: usize = 0; let mut buffered_content: Vec = Vec::new(); let file_last_modified_time = file_last_modified_time(path); - let reader = open(path); - // TODO Handle error here - let lines: Lines>> = reader.map(|i| { - BufReader::new(i).lines() - }).unwrap(); + match open(path) { + Ok(reader) => { + // TODO Replace the loop + for line in BufReader::new(reader).lines() { + if i == CONTENT_LINES_PER_PAGE { + page = page + 1; + i = 0; + prepare_page(&file_last_modified_time, &mut buffered_content, options, &page); + } + match line { + Ok(content) => buffered_content.push(content), + Err(error) => { + writeln!(&mut stderr(), "pr: Unable to read from input type {}\n{}", path, error.to_string()); + return -1; + } + } + i = i + 1; + } - for line in lines { - if i == CONTENT_LINES_PER_PAGE { - page = page + 1; - i = 0; - flush_buffered_page(&file_last_modified_time, &mut buffered_content, &options, page); + if i != 0 { + page = page + 1; + prepare_page(&file_last_modified_time, &mut buffered_content, options, &page); + } + } + Err(error) => { + writeln!(&mut stderr(), "{}", error); + return -1; } - i = i + 1; - buffered_content.push(line?); } - if i != 0 { - page = page + 1; - flush_buffered_page(&file_last_modified_time, &mut buffered_content, &options, page); - } - Ok(()) + return 0; } -fn print_page(header_content: &Vec, lines: &Vec, options: &OutputOptions, page: usize) -> String { - let mut page_content: Vec = Vec::new(); - let trailer_content = trailer_content(); - assert_eq!(lines.len() <= CONTENT_LINES_PER_PAGE, true, "Only {} lines of content allowed in a pr output page", CONTENT_LINES_PER_PAGE.to_string()); - assert_eq!(header_content.len(), HEADER_LINES_PER_PAGE, "Only {} lines of content allowed in a pr header", HEADER_LINES_PER_PAGE.to_string()); - assert_eq!(trailer_content.len(), TRAILER_LINES_PER_PAGE, "Only {} lines of content allowed in a pr trailer", TRAILER_LINES_PER_PAGE.to_string()); +fn print_page(header_content: &Vec, lines: &Vec, options: &OutputOptions, page: &usize) { + let trailer_content: Vec = trailer_content(); + assert_eq!(lines.len() <= CONTENT_LINES_PER_PAGE, true, "Only {} lines of content allowed in a pr output page", CONTENT_LINES_PER_PAGE); + assert_eq!(header_content.len(), HEADER_LINES_PER_PAGE, "Only {} lines of content allowed in a pr header", HEADER_LINES_PER_PAGE); + assert_eq!(trailer_content.len(), TRAILER_LINES_PER_PAGE, "Only {} lines of content allowed in a pr trailer", TRAILER_LINES_PER_PAGE); + let out: &mut Stdout = &mut stdout(); + let new_line: &[u8] = "\n".as_bytes(); + out.lock(); for x in header_content { - page_content.push(x.to_string()); + out.write(x.as_bytes()); + out.write(new_line); } let width: usize = options.as_ref() @@ -258,37 +286,39 @@ fn print_page(header_content: &Vec, lines: &Vec, options: &Outpu let mut i = 1; for x in lines { if options.number.is_none() { - page_content.push(x.to_string()); + out.write(x.as_bytes()); } else { - let fmtd_line_number: String = get_fmtd_line_number(width, prev_lines + i, &separator); - page_content.push(format!("{}{}", fmtd_line_number, x.to_string())); + let fmtd_line_number: String = get_fmtd_line_number(&width, prev_lines + i, &separator); + out.write(format!("{}{}", fmtd_line_number, x).as_bytes()); } + out.write(new_line); i = i + 1; } - page_content.extend(trailer_content); - page_content.join("\n") + for x in trailer_content { + out.write(x.as_bytes()); + out.write(new_line); + } + out.flush(); } -fn get_fmtd_line_number(width: usize, line_number: usize, separator: &String) -> String { - format!("{:>width$}{}", take_last_n(&line_number.to_string(), width), separator, width = width) -} - -fn take_last_n(s: &String, n: usize) -> &str { - if s.len() >= n { - &s[s.len() - n..] +fn get_fmtd_line_number(width: &usize, line_number: usize, separator: &String) -> String { + let line_str = line_number.to_string(); + if line_str.len() >= *width { + format!("{:>width$}{}", &line_str[line_str.len() - *width..], separator, width = width) } else { - s + format!("{:>width$}{}", line_str, separator, width = width) } } -fn flush_buffered_page(file_last_modified_time: &String, buffered_content: &mut Vec, options: &OutputOptions, page: usize) { - let header = header_content(file_last_modified_time, &options.header, page); - print!("{}", print_page(&header, buffered_content, &options, page)); + +fn prepare_page(file_last_modified_time: &String, buffered_content: &mut Vec, options: &OutputOptions, page: &usize) { + let header: Vec = header_content(file_last_modified_time, &options.header, &page); + print_page(&header, buffered_content, &options, &page); buffered_content.clear(); } -fn header_content(last_modified: &String, header: &String, page: usize) -> Vec { - let first_line: String = format!("{} {} Page {}", last_modified, header, page.to_string()); +fn header_content(last_modified: &String, header: &String, page: &usize) -> Vec { + let first_line: String = format!("{} {} Page {}", last_modified, header, page); vec!["".to_string(), "".to_string(), first_line, "".to_string(), "".to_string()] } From 781d77eb3cacb861114a091f3c16c32b8ab29211 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Wed, 12 Dec 2018 15:52:22 +0530 Subject: [PATCH 0132/1135] pr: add support for -d option --- src/pr/pr.rs | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 058133422..264088076 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -38,6 +38,8 @@ struct OutputOptions { /// Line numbering mode number: Option, header: String, + double_spaced: bool, + line_separator: String } impl AsRef for OutputOptions { @@ -109,6 +111,13 @@ pub fn uumain(args: Vec) -> i32 { "STRING", ); + opts.optflag( + "d", + "", + "Produce output that is double spaced. An extra character is output following every + found in the input.", + ); + opts.optflagopt( "n", "", @@ -200,9 +209,18 @@ fn build_options(matches: &Matches, header: &String) -> OutputOptions { } return None; }); + + let line_separator: String = if matches.opt_present("d") { + "\n\n".to_string() + } else { + "\n".to_string() + }; + OutputOptions { number: numbering_options, header: header.to_string(), + double_spaced: matches.opt_present("d"), + line_separator } } @@ -266,11 +284,12 @@ fn print_page(header_content: &Vec, lines: &Vec, options: &Outpu assert_eq!(header_content.len(), HEADER_LINES_PER_PAGE, "Only {} lines of content allowed in a pr header", HEADER_LINES_PER_PAGE); assert_eq!(trailer_content.len(), TRAILER_LINES_PER_PAGE, "Only {} lines of content allowed in a pr trailer", TRAILER_LINES_PER_PAGE); let out: &mut Stdout = &mut stdout(); - let new_line: &[u8] = "\n".as_bytes(); + let line_separator = options.as_ref().line_separator.as_bytes(); + out.lock(); for x in header_content { out.write(x.as_bytes()); - out.write(new_line); + out.write(line_separator); } let width: usize = options.as_ref() @@ -291,12 +310,12 @@ fn print_page(header_content: &Vec, lines: &Vec, options: &Outpu let fmtd_line_number: String = get_fmtd_line_number(&width, prev_lines + i, &separator); out.write(format!("{}{}", fmtd_line_number, x).as_bytes()); } - out.write(new_line); + out.write(line_separator); i = i + 1; } for x in trailer_content { out.write(x.as_bytes()); - out.write(new_line); + out.write(line_separator); } out.flush(); } From 77d3d08f0bc8348e9470e21b80891f7c820ad707 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Wed, 12 Dec 2018 16:06:30 +0530 Subject: [PATCH 0133/1135] pr: show current time for stdin input --- src/pr/pr.rs | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 264088076..512e7308e 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -39,7 +39,8 @@ struct OutputOptions { number: Option, header: String, double_spaced: bool, - line_separator: String + line_separator: String, + last_modified_time: String, } impl AsRef for OutputOptions { @@ -153,7 +154,7 @@ pub fn uumain(args: Vec) -> i32 { for f in files { let header: &String = &matches.opt_str("h").unwrap_or(f.to_string()); - let options: &OutputOptions = &build_options(&matches, header); + let options: &OutputOptions = &build_options(&matches, header, &f); let status: i32 = pr(&f, options); if status != 0 { return status; @@ -197,7 +198,7 @@ fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { return 0; } -fn build_options(matches: &Matches, header: &String) -> OutputOptions { +fn build_options(matches: &Matches, header: &String, path: &String) -> OutputOptions { let numbering_options: Option = matches.opt_str("n").map(|i| { NumberingMode { width: i.parse::().unwrap_or(NumberingMode::default().width), @@ -216,11 +217,18 @@ fn build_options(matches: &Matches, header: &String) -> OutputOptions { "\n".to_string() }; + let last_modified_time = if path.eq("-") { + current_time() + } else { + file_last_modified_time(path) + }; + OutputOptions { number: numbering_options, header: header.to_string(), double_spaced: matches.opt_present("d"), - line_separator + line_separator, + last_modified_time, } } @@ -245,7 +253,6 @@ fn pr(path: &str, options: &OutputOptions) -> i32 { let mut i = 0; let mut page: usize = 0; let mut buffered_content: Vec = Vec::new(); - let file_last_modified_time = file_last_modified_time(path); match open(path) { Ok(reader) => { // TODO Replace the loop @@ -253,7 +260,7 @@ fn pr(path: &str, options: &OutputOptions) -> i32 { if i == CONTENT_LINES_PER_PAGE { page = page + 1; i = 0; - prepare_page(&file_last_modified_time, &mut buffered_content, options, &page); + prepare_page(&mut buffered_content, options, &page); } match line { Ok(content) => buffered_content.push(content), @@ -267,7 +274,7 @@ fn pr(path: &str, options: &OutputOptions) -> i32 { if i != 0 { page = page + 1; - prepare_page(&file_last_modified_time, &mut buffered_content, options, &page); + prepare_page(&mut buffered_content, options, &page); } } Err(error) => { @@ -330,14 +337,14 @@ fn get_fmtd_line_number(width: &usize, line_number: usize, separator: &String) - } -fn prepare_page(file_last_modified_time: &String, buffered_content: &mut Vec, options: &OutputOptions, page: &usize) { - let header: Vec = header_content(file_last_modified_time, &options.header, &page); +fn prepare_page(buffered_content: &mut Vec, options: &OutputOptions, page: &usize) { + let header: Vec = header_content(&options, &page); print_page(&header, buffered_content, &options, &page); buffered_content.clear(); } -fn header_content(last_modified: &String, header: &String, page: &usize) -> Vec { - let first_line: String = format!("{} {} Page {}", last_modified, header, page); +fn header_content(options: &OutputOptions, page: &usize) -> Vec { + let first_line: String = format!("{} {} Page {}", options.last_modified_time, options.header, page); vec!["".to_string(), "".to_string(), first_line, "".to_string(), "".to_string()] } @@ -351,6 +358,11 @@ fn file_last_modified_time(path: &str) -> String { }).unwrap_or(String::new()); } +fn current_time() -> String { + let datetime: DateTime = Local::now(); + datetime.format("%b %d %H:%M %Y").to_string() +} + fn trailer_content() -> Vec { vec!["".to_string(), "".to_string(), "".to_string(), "".to_string(), "".to_string()] } From 1cf84a730529359d0987aa25aae8b87fb63cc32f Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Wed, 12 Dec 2018 16:48:29 +0530 Subject: [PATCH 0134/1135] pr: refactor option flags into constants --- src/pr/pr.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 512e7308e..f86fd5adc 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -33,6 +33,9 @@ static TRAILER_LINES_PER_PAGE: usize = 5; static CONTENT_LINES_PER_PAGE: usize = LINES_PER_PAGE - HEADER_LINES_PER_PAGE - TRAILER_LINES_PER_PAGE; static NUMBERING_MODE_DEFAULT_SEPARATOR: &str = "\t"; static NUMBERING_MODE_DEFAULT_WIDTH: usize = 5; +static STRING_HEADER_OPTION: &str = "h"; +static NUMBERING_MODE_OPTION: &str = "n"; +static FILE_STDIN: &str = "-"; struct OutputOptions { /// Line numbering mode @@ -105,7 +108,7 @@ pub fn uumain(args: Vec) -> i32 { let mut opts = getopts::Options::new(); opts.optopt( - "h", + STRING_HEADER_OPTION, "", "Use the string header to replace the file name \ in the header line.", @@ -120,7 +123,7 @@ pub fn uumain(args: Vec) -> i32 { ); opts.optflagopt( - "n", + NUMBERING_MODE_OPTION, "", "Provide width digit line numbering. The default for width, if not specified, is 5. The number occupies the first width column positions of each text column or each line of -m output. If char (any nondigit @@ -145,7 +148,7 @@ pub fn uumain(args: Vec) -> i32 { let mut files: Vec = matches.free.clone(); if files.is_empty() { //For stdin - files.push("-".to_owned()); + files.push(FILE_STDIN.to_owned()); } if matches.opt_present("help") { @@ -153,7 +156,7 @@ pub fn uumain(args: Vec) -> i32 { } for f in files { - let header: &String = &matches.opt_str("h").unwrap_or(f.to_string()); + let header: &String = &matches.opt_str(STRING_HEADER_OPTION).unwrap_or(f.to_string()); let options: &OutputOptions = &build_options(&matches, header, &f); let status: i32 = pr(&f, options); if status != 0 { @@ -199,13 +202,13 @@ fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { } fn build_options(matches: &Matches, header: &String, path: &String) -> OutputOptions { - let numbering_options: Option = matches.opt_str("n").map(|i| { + let numbering_options: Option = matches.opt_str(NUMBERING_MODE_OPTION).map(|i| { NumberingMode { width: i.parse::().unwrap_or(NumberingMode::default().width), separator: NumberingMode::default().separator, } }).or_else(|| { - if matches.opt_present("n") { + if matches.opt_present(NUMBERING_MODE_OPTION) { return Some(NumberingMode::default()); } return None; @@ -217,7 +220,7 @@ fn build_options(matches: &Matches, header: &String, path: &String) -> OutputOpt "\n".to_string() }; - let last_modified_time = if path.eq("-") { + let last_modified_time = if path.eq(FILE_STDIN) { current_time() } else { file_last_modified_time(path) @@ -368,7 +371,7 @@ fn trailer_content() -> Vec { } fn get_input_type(path: &str) -> Option { - if path == "-" { + if path == FILE_STDIN { return Some(InputType::StdIn); } From 8c7cbf65a5f3f48a3bbce7026f4266b70c3fa906 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Wed, 12 Dec 2018 16:48:43 +0530 Subject: [PATCH 0135/1135] pr: throw error on reading from socket --- src/pr/pr.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index f86fd5adc..921dada45 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -98,9 +98,14 @@ quick_error! { EncounteredErrors(msg: String) { display("pr: {0} encountered", msg) } + IsDirectory(path: String) { display("pr: {0}: Is a directory", path) } + + IsSocket(path: String) { + display("pr: cannot open {}, Operation not supported on socket", path) + } } } @@ -240,8 +245,7 @@ fn open(path: &str) -> Result, PrError> { Some(InputType::Directory) => Err(PrError::IsDirectory(path.to_string())), #[cfg(unix)] Some(InputType::Socket) => { - // TODO Add reading from socket - Err(PrError::EncounteredErrors("Reading from socket not supported yet".to_string())) + Err(PrError::IsSocket(path.to_string())) } Some(InputType::StdIn) => { let stdin = stdin(); From 420a066312083fe8685dc756c01ebcea9388a7c6 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Wed, 12 Dec 2018 21:25:54 +0530 Subject: [PATCH 0136/1135] pr: add read buffer size and fix unused Result types --- src/pr/pr.rs | 96 +++++++++++++++++++++++++--------------------------- 1 file changed, 47 insertions(+), 49 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 921dada45..02945eb4f 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -23,7 +23,7 @@ use std::fs::{metadata, File}; #[cfg(unix)] use std::os::unix::fs::FileTypeExt; use quick_error::ResultExt; - +use std::convert::From; static NAME: &str = "pr"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -36,12 +36,12 @@ static NUMBERING_MODE_DEFAULT_WIDTH: usize = 5; static STRING_HEADER_OPTION: &str = "h"; static NUMBERING_MODE_OPTION: &str = "n"; static FILE_STDIN: &str = "-"; +static READ_BUFFER_SIZE: usize = 1024 * 64; struct OutputOptions { /// Line numbering mode number: Option, header: String, - double_spaced: bool, line_separator: String, last_modified_time: String, } @@ -82,6 +82,12 @@ enum InputType { Socket, } +impl From for PrError { + fn from(err: Error) -> Self { + PrError::EncounteredErrors(err.to_string()) + } +} + quick_error! { #[derive(Debug)] enum PrError { @@ -163,7 +169,13 @@ pub fn uumain(args: Vec) -> i32 { for f in files { let header: &String = &matches.opt_str(STRING_HEADER_OPTION).unwrap_or(f.to_string()); let options: &OutputOptions = &build_options(&matches, header, &f); - let status: i32 = pr(&f, options); + let status: i32 = match pr(&f, options) { + Err(error) => { + writeln!(&mut stderr(), "{}", error); + -1 + }, + _ => 0 + }; if status != 0 { return status; } @@ -234,7 +246,6 @@ fn build_options(matches: &Matches, header: &String, path: &String) -> OutputOpt OutputOptions { number: numbering_options, header: header.to_string(), - double_spaced: matches.opt_present("d"), line_separator, last_modified_time, } @@ -256,54 +267,44 @@ fn open(path: &str) -> Result, PrError> { } } -fn pr(path: &str, options: &OutputOptions) -> i32 { +fn pr(path: &str, options: &OutputOptions) -> Result { let mut i = 0; let mut page: usize = 0; let mut buffered_content: Vec = Vec::new(); - match open(path) { - Ok(reader) => { - // TODO Replace the loop - for line in BufReader::new(reader).lines() { - if i == CONTENT_LINES_PER_PAGE { - page = page + 1; - i = 0; - prepare_page(&mut buffered_content, options, &page); - } - match line { - Ok(content) => buffered_content.push(content), - Err(error) => { - writeln!(&mut stderr(), "pr: Unable to read from input type {}\n{}", path, error.to_string()); - return -1; - } - } - i = i + 1; - } - if i != 0 { - page = page + 1; - prepare_page(&mut buffered_content, options, &page); - } - } - Err(error) => { - writeln!(&mut stderr(), "{}", error); - return -1; + for line in BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?).lines() { + if i == CONTENT_LINES_PER_PAGE { + page = page + 1; + i = 0; + print_page(&buffered_content, options, &page)?; + buffered_content = Vec::new(); } + buffered_content.push(line?); + i = i + 1; } - return 0; + + if i != 0 { + page = page + 1; + print_page(&buffered_content, options, &page)?; + } + return Ok(0); } -fn print_page(header_content: &Vec, lines: &Vec, options: &OutputOptions, page: &usize) { +fn print_page(lines: &Vec, options: &OutputOptions, page: &usize) -> Result { + let header: Vec = header_content(options, page); let trailer_content: Vec = trailer_content(); assert_eq!(lines.len() <= CONTENT_LINES_PER_PAGE, true, "Only {} lines of content allowed in a pr output page", CONTENT_LINES_PER_PAGE); - assert_eq!(header_content.len(), HEADER_LINES_PER_PAGE, "Only {} lines of content allowed in a pr header", HEADER_LINES_PER_PAGE); + assert_eq!(header.len(), HEADER_LINES_PER_PAGE, "Only {} lines of content allowed in a pr header", HEADER_LINES_PER_PAGE); assert_eq!(trailer_content.len(), TRAILER_LINES_PER_PAGE, "Only {} lines of content allowed in a pr trailer", TRAILER_LINES_PER_PAGE); let out: &mut Stdout = &mut stdout(); let line_separator = options.as_ref().line_separator.as_bytes(); + let mut lines_written = 0; out.lock(); - for x in header_content { - out.write(x.as_bytes()); - out.write(line_separator); + for x in header { + out.write(x.as_bytes())?; + out.write(line_separator)?; + lines_written += 1; } let width: usize = options.as_ref() @@ -319,19 +320,22 @@ fn print_page(header_content: &Vec, lines: &Vec, options: &Outpu let mut i = 1; for x in lines { if options.number.is_none() { - out.write(x.as_bytes()); + out.write(x.as_bytes())?; } else { let fmtd_line_number: String = get_fmtd_line_number(&width, prev_lines + i, &separator); - out.write(format!("{}{}", fmtd_line_number, x).as_bytes()); + out.write(format!("{}{}", fmtd_line_number, x).as_bytes())?; } - out.write(line_separator); + out.write(line_separator)?; i = i + 1; } + lines_written += i - 1; for x in trailer_content { - out.write(x.as_bytes()); - out.write(line_separator); + out.write(x.as_bytes())?; + out.write(line_separator)?; + lines_written += 1; } - out.flush(); + out.flush()?; + Ok(lines_written) } fn get_fmtd_line_number(width: &usize, line_number: usize, separator: &String) -> String { @@ -344,12 +348,6 @@ fn get_fmtd_line_number(width: &usize, line_number: usize, separator: &String) - } -fn prepare_page(buffered_content: &mut Vec, options: &OutputOptions, page: &usize) { - let header: Vec = header_content(&options, &page); - print_page(&header, buffered_content, &options, &page); - buffered_content.clear(); -} - fn header_content(options: &OutputOptions, page: &usize) -> Vec { let first_line: String = format!("{} {} Page {}", options.last_modified_time, options.header, page); vec!["".to_string(), "".to_string(), first_line, "".to_string(), "".to_string()] From c58ee96abf38c7e1fca8eefdb106b72565ed5fa1 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Wed, 12 Dec 2018 22:45:48 +0530 Subject: [PATCH 0137/1135] pr: add long names for -d and -h --- src/pr/pr.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 02945eb4f..2a0ced6ff 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -34,6 +34,7 @@ static CONTENT_LINES_PER_PAGE: usize = LINES_PER_PAGE - HEADER_LINES_PER_PAGE - static NUMBERING_MODE_DEFAULT_SEPARATOR: &str = "\t"; static NUMBERING_MODE_DEFAULT_WIDTH: usize = 5; static STRING_HEADER_OPTION: &str = "h"; +static DOUBLE_SPACE_OPTION: &str = "d"; static NUMBERING_MODE_OPTION: &str = "n"; static FILE_STDIN: &str = "-"; static READ_BUFFER_SIZE: usize = 1024 * 64; @@ -120,15 +121,15 @@ pub fn uumain(args: Vec) -> i32 { opts.optopt( STRING_HEADER_OPTION, - "", + "header", "Use the string header to replace the file name \ in the header line.", "STRING", ); opts.optflag( - "d", - "", + DOUBLE_SPACE_OPTION, + "double-space", "Produce output that is double spaced. An extra character is output following every found in the input.", ); From 9a3c572de8ab2f3856b921a1585ebeeb69b090ce Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Wed, 12 Dec 2018 23:31:44 +0530 Subject: [PATCH 0138/1135] pr: add --page option --- src/pr/pr.rs | 66 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 7 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 2a0ced6ff..e54a3b11f 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -36,6 +36,7 @@ static NUMBERING_MODE_DEFAULT_WIDTH: usize = 5; static STRING_HEADER_OPTION: &str = "h"; static DOUBLE_SPACE_OPTION: &str = "d"; static NUMBERING_MODE_OPTION: &str = "n"; +static PAGE_RANGE_OPTION: &str = "page"; static FILE_STDIN: &str = "-"; static READ_BUFFER_SIZE: usize = 1024 * 64; @@ -45,6 +46,8 @@ struct OutputOptions { header: String, line_separator: String, last_modified_time: String, + start_page: Option, + end_page: Option, } impl AsRef for OutputOptions { @@ -89,6 +92,12 @@ impl From for PrError { } } +impl From for PrError { + fn from(err: std::num::ParseIntError) -> Self { + PrError::EncounteredErrors(err.to_string()) + } +} + quick_error! { #[derive(Debug)] enum PrError { @@ -103,7 +112,7 @@ quick_error! { } EncounteredErrors(msg: String) { - display("pr: {0} encountered", msg) + display("pr: {0}", msg) } IsDirectory(path: String) { @@ -119,6 +128,13 @@ quick_error! { pub fn uumain(args: Vec) -> i32 { let mut opts = getopts::Options::new(); + opts.optflagopt( + "", + PAGE_RANGE_OPTION, + "Begin and stop printing with page FIRST_PAGE[:LAST_PAGE]", + "FIRST_PAGE[:LAST_PAGE]", + ); + opts.optopt( STRING_HEADER_OPTION, "header", @@ -169,12 +185,17 @@ pub fn uumain(args: Vec) -> i32 { for f in files { let header: &String = &matches.opt_str(STRING_HEADER_OPTION).unwrap_or(f.to_string()); - let options: &OutputOptions = &build_options(&matches, header, &f); + let result_options = build_options(&matches, header, &f); + if result_options.is_err() { + writeln!(&mut stderr(), "{}", result_options.err().unwrap()); + return 1; + } + let options = &result_options.unwrap(); let status: i32 = match pr(&f, options) { Err(error) => { writeln!(&mut stderr(), "{}", error); - -1 - }, + 1 + } _ => 0 }; if status != 0 { @@ -219,7 +240,7 @@ fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { return 0; } -fn build_options(matches: &Matches, header: &String, path: &String) -> OutputOptions { +fn build_options(matches: &Matches, header: &String, path: &String) -> Result { let numbering_options: Option = matches.opt_str(NUMBERING_MODE_OPTION).map(|i| { NumberingMode { width: i.parse::().unwrap_or(NumberingMode::default().width), @@ -244,12 +265,36 @@ fn build_options(matches: &Matches, header: &String, path: &String) -> OutputOpt file_last_modified_time(path) }; - OutputOptions { + let start_page = match matches.opt_str(PAGE_RANGE_OPTION).map(|i| { + let x: Vec<&str> = i.split(":").collect(); + x[0].parse::() + }) { + Some(res) => Some(res?), + _ => None + }; + + let end_page = match matches.opt_str(PAGE_RANGE_OPTION) + .filter(|i| i.contains(":")) + .map(|i| { + let x: Vec<&str> = i.split(":").collect(); + x[1].parse::() + }) { + Some(res) => Some(res?), + _ => None + }; + + if start_page.is_some() && end_page.is_some() && start_page.unwrap() > end_page.unwrap() { + return Err(PrError::EncounteredErrors(format!("invalid page range ‘{}:{}’", start_page.unwrap(), end_page.unwrap()))); + } + + Ok(OutputOptions { number: numbering_options, header: header.to_string(), line_separator, last_modified_time, - } + start_page, + end_page, + }) } fn open(path: &str) -> Result, PrError> { @@ -292,6 +337,13 @@ fn pr(path: &str, options: &OutputOptions) -> Result { } fn print_page(lines: &Vec, options: &OutputOptions, page: &usize) -> Result { + let start_page = options.as_ref().start_page.as_ref(); + let last_page = options.as_ref().end_page.as_ref(); + let is_within_print_range = (start_page.is_none() || page >= start_page.unwrap()) && + (last_page.is_none() || page <= last_page.unwrap()); + if !is_within_print_range { + return Ok(0); + } let header: Vec = header_content(options, page); let trailer_content: Vec = trailer_content(); assert_eq!(lines.len() <= CONTENT_LINES_PER_PAGE, true, "Only {} lines of content allowed in a pr output page", CONTENT_LINES_PER_PAGE); From 55043d7a15a2fcc3b7328448101b68ed3ad43827 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Wed, 12 Dec 2018 23:38:59 +0530 Subject: [PATCH 0139/1135] pr: print only 28 lines if double spaced option is used --- src/pr/pr.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index e54a3b11f..a9bb0ce60 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -44,6 +44,7 @@ struct OutputOptions { /// Line numbering mode number: Option, header: String, + double_space: bool, line_separator: String, last_modified_time: String, start_page: Option, @@ -253,12 +254,16 @@ fn build_options(matches: &Matches, header: &String, path: &String) -> Result Result Result { let mut i = 0; let mut page: usize = 0; let mut buffered_content: Vec = Vec::new(); - + let lines_per_page = if options.as_ref().double_space { + CONTENT_LINES_PER_PAGE / 2 + } else { + CONTENT_LINES_PER_PAGE + }; for line in BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?).lines() { - if i == CONTENT_LINES_PER_PAGE { + if i == lines_per_page { page = page + 1; i = 0; print_page(&buffered_content, options, &page)?; From 9e023b8a91ee1f0e50e7ec969a2160320309251d Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Thu, 13 Dec 2018 09:59:25 +0530 Subject: [PATCH 0140/1135] pr: add -t option to not print header, trailer and -l to print line numbers pr: Add -l option set number of lines pr: Refactor opts --- src/pr/pr.rs | 89 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 74 insertions(+), 15 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index a9bb0ce60..8f9551de6 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -24,19 +24,22 @@ use std::fs::{metadata, File}; use std::os::unix::fs::FileTypeExt; use quick_error::ResultExt; use std::convert::From; +use getopts::HasArg; +use getopts::Occur; static NAME: &str = "pr"; static VERSION: &str = env!("CARGO_PKG_VERSION"); static LINES_PER_PAGE: usize = 66; static HEADER_LINES_PER_PAGE: usize = 5; static TRAILER_LINES_PER_PAGE: usize = 5; -static CONTENT_LINES_PER_PAGE: usize = LINES_PER_PAGE - HEADER_LINES_PER_PAGE - TRAILER_LINES_PER_PAGE; static NUMBERING_MODE_DEFAULT_SEPARATOR: &str = "\t"; static NUMBERING_MODE_DEFAULT_WIDTH: usize = 5; static STRING_HEADER_OPTION: &str = "h"; static DOUBLE_SPACE_OPTION: &str = "d"; static NUMBERING_MODE_OPTION: &str = "n"; static PAGE_RANGE_OPTION: &str = "page"; +static NO_HEADER_TRAILER_OPTION: &str = "t"; +static PAGE_LENGTH_OPTION: &str = "l"; static FILE_STDIN: &str = "-"; static READ_BUFFER_SIZE: usize = 1024 * 64; @@ -49,6 +52,9 @@ struct OutputOptions { last_modified_time: String, start_page: Option, end_page: Option, + display_header: bool, + display_trailer: bool, + content_lines_per_page: usize, } impl AsRef for OutputOptions { @@ -129,29 +135,36 @@ quick_error! { pub fn uumain(args: Vec) -> i32 { let mut opts = getopts::Options::new(); - opts.optflagopt( + opts.opt( "", PAGE_RANGE_OPTION, "Begin and stop printing with page FIRST_PAGE[:LAST_PAGE]", "FIRST_PAGE[:LAST_PAGE]", + HasArg::Yes, + Occur::Optional, ); - opts.optopt( + opts.opt( STRING_HEADER_OPTION, "header", "Use the string header to replace the file name \ in the header line.", "STRING", + HasArg::Yes, + Occur::Optional, ); - opts.optflag( + opts.opt( DOUBLE_SPACE_OPTION, "double-space", "Produce output that is double spaced. An extra character is output following every found in the input.", + "", + HasArg::No, + Occur::Optional, ); - opts.optflagopt( + opts.opt( NUMBERING_MODE_OPTION, "", "Provide width digit line numbering. The default for width, if not specified, is 5. The number occupies @@ -159,6 +172,29 @@ pub fn uumain(args: Vec) -> i32 { character) is given, it is appended to the line number to separate it from whatever follows. The default for char is a . Line numbers longer than width columns are truncated.", "[char][width]", + HasArg::Yes, + Occur::Optional, + ); + + opts.opt( + NO_HEADER_TRAILER_OPTION, + "omit-header", + "Write neither the five-line identifying header nor the five-line trailer usually supplied for each page. Quit + writing after the last line of each file without spacing to the end of the page.", + "", + HasArg::No, + Occur::Optional, + ); + + opts.opt( + PAGE_LENGTH_OPTION, + "length", + "Override the 66-line default and reset the page length to lines. If lines is not greater than the sum of both + the header and trailer depths (in lines), the pr utility shall suppress both the header and trailer, as if the + -t option were in effect.", + "lines", + HasArg::Yes, + Occur::Optional, ); opts.optflag("", "help", "display this help and exit"); @@ -262,8 +298,6 @@ fn build_options(matches: &Matches, header: &String, path: &String) -> Result Result() + }) { + Some(res) => res?, + _ => LINES_PER_PAGE + }; + + let content_lines_per_page = page_length - (HEADER_LINES_PER_PAGE - TRAILER_LINES_PER_PAGE); + + let display_header_and_trailer = !(page_length < (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE)) + && !matches.opt_present(NO_HEADER_TRAILER_OPTION); + + Ok(OutputOptions { number: numbering_options, header: header.to_string(), @@ -300,6 +347,9 @@ fn build_options(matches: &Matches, header: &String, path: &String) -> Result Result { let mut i = 0; let mut page: usize = 0; let mut buffered_content: Vec = Vec::new(); + let content_lines_per_page = options.as_ref().content_lines_per_page; let lines_per_page = if options.as_ref().double_space { - CONTENT_LINES_PER_PAGE / 2 + content_lines_per_page / 2 } else { - CONTENT_LINES_PER_PAGE + content_lines_per_page }; for line in BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?).lines() { if i == lines_per_page { @@ -349,16 +400,24 @@ fn pr(path: &str, options: &OutputOptions) -> Result { fn print_page(lines: &Vec, options: &OutputOptions, page: &usize) -> Result { let start_page = options.as_ref().start_page.as_ref(); let last_page = options.as_ref().end_page.as_ref(); + let content_lines_per_page = options.as_ref().content_lines_per_page; let is_within_print_range = (start_page.is_none() || page >= start_page.unwrap()) && (last_page.is_none() || page <= last_page.unwrap()); if !is_within_print_range { return Ok(0); } - let header: Vec = header_content(options, page); - let trailer_content: Vec = trailer_content(); - assert_eq!(lines.len() <= CONTENT_LINES_PER_PAGE, true, "Only {} lines of content allowed in a pr output page", CONTENT_LINES_PER_PAGE); - assert_eq!(header.len(), HEADER_LINES_PER_PAGE, "Only {} lines of content allowed in a pr header", HEADER_LINES_PER_PAGE); - assert_eq!(trailer_content.len(), TRAILER_LINES_PER_PAGE, "Only {} lines of content allowed in a pr trailer", TRAILER_LINES_PER_PAGE); + let header: Vec = if options.as_ref().display_header { + header_content(options, page) + } else { + Vec::new() + }; + + let trailer_content: Vec = if options.as_ref().display_trailer { + trailer_content() + } else { + Vec::new() + }; + let out: &mut Stdout = &mut stdout(); let line_separator = options.as_ref().line_separator.as_bytes(); let mut lines_written = 0; @@ -379,7 +438,7 @@ fn print_page(lines: &Vec, options: &OutputOptions, page: &usize) -> Res .map(|i| i.separator.to_string()) .unwrap_or(NumberingMode::default().separator); - let prev_lines = CONTENT_LINES_PER_PAGE * (page - 1); + let prev_lines = content_lines_per_page * (page - 1); let mut i = 1; for x in lines { if options.number.is_none() { From fd4447785b12ad1691ec5c885adb006f95209b10 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Thu, 13 Dec 2018 12:16:14 +0530 Subject: [PATCH 0141/1135] pr: add -r option to suppress errors and -F to use form feed separator pr: Add -F to print line feed character for page separator --- src/pr/pr.rs | 51 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 8f9551de6..c95ffa45a 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -40,6 +40,8 @@ static NUMBERING_MODE_OPTION: &str = "n"; static PAGE_RANGE_OPTION: &str = "page"; static NO_HEADER_TRAILER_OPTION: &str = "t"; static PAGE_LENGTH_OPTION: &str = "l"; +static SUPPRESS_PRINTING_ERROR: &str = "r"; +static FORM_FEED_OPTION: &str = "F"; static FILE_STDIN: &str = "-"; static READ_BUFFER_SIZE: usize = 1024 * 64; @@ -55,6 +57,8 @@ struct OutputOptions { display_header: bool, display_trailer: bool, content_lines_per_page: usize, + suppress_errors: bool, + page_separator_char: String, } impl AsRef for OutputOptions { @@ -197,6 +201,24 @@ pub fn uumain(args: Vec) -> i32 { Occur::Optional, ); + opts.opt( + SUPPRESS_PRINTING_ERROR, + "no-file-warnings", + "omit warning when a file cannot be opened", + "", + HasArg::No, + Occur::Optional, + ); + + opts.opt( + FORM_FEED_OPTION, + "form-feed", + "Use a for new pages, instead of the default behavior that uses a sequence of s.", + "", + HasArg::No, + Occur::Optional, + ); + opts.optflag("", "help", "display this help and exit"); opts.optflag("V", "version", "output version information and exit"); @@ -230,7 +252,9 @@ pub fn uumain(args: Vec) -> i32 { let options = &result_options.unwrap(); let status: i32 = match pr(&f, options) { Err(error) => { - writeln!(&mut stderr(), "{}", error); + if !options.suppress_errors { + writeln!(&mut stderr(), "{}", error); + } 1 } _ => 0 @@ -338,6 +362,11 @@ fn build_options(matches: &Matches, header: &String, path: &String) -> Result Result, options: &OutputOptions, page: &usize) -> Res let content_lines_per_page = options.as_ref().content_lines_per_page; let is_within_print_range = (start_page.is_none() || page >= start_page.unwrap()) && (last_page.is_none() || page <= last_page.unwrap()); + let page_separator = options.as_ref().page_separator_char.as_bytes(); if !is_within_print_range { return Ok(0); } @@ -447,13 +479,24 @@ fn print_page(lines: &Vec, options: &OutputOptions, page: &usize) -> Res let fmtd_line_number: String = get_fmtd_line_number(&width, prev_lines + i, &separator); out.write(format!("{}{}", fmtd_line_number, x).as_bytes())?; } - out.write(line_separator)?; + + if i == trailer_content.len() { + out.write(page_separator)?; + } else { + out.write(line_separator)?; + } + i = i + 1; } lines_written += i - 1; - for x in trailer_content { + for index in 0..trailer_content.len() { + let x: &String = trailer_content.get(index).unwrap(); out.write(x.as_bytes())?; - out.write(line_separator)?; + if index + 1 == trailer_content.len() { + out.write(page_separator)?; + } else { + out.write(line_separator)?; + } lines_written += 1; } out.flush()?; From 0098cfe5b7cc4b244b42b690632c418cc220f526 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Fri, 14 Dec 2018 09:09:19 +0530 Subject: [PATCH 0142/1135] pr: add ColumnModeOptions and fix reading of input after page range is finished --- src/pr/pr.rs | 184 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 121 insertions(+), 63 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index c95ffa45a..4b4632355 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -37,13 +37,17 @@ static NUMBERING_MODE_DEFAULT_WIDTH: usize = 5; static STRING_HEADER_OPTION: &str = "h"; static DOUBLE_SPACE_OPTION: &str = "d"; static NUMBERING_MODE_OPTION: &str = "n"; -static PAGE_RANGE_OPTION: &str = "page"; +static PAGE_RANGE_OPTION: &str = "pages"; static NO_HEADER_TRAILER_OPTION: &str = "t"; static PAGE_LENGTH_OPTION: &str = "l"; static SUPPRESS_PRINTING_ERROR: &str = "r"; static FORM_FEED_OPTION: &str = "F"; +static COLUMN_WIDTH_OPTION: &str = "w"; +static COLUMN_OPTION: &str = "column"; static FILE_STDIN: &str = "-"; static READ_BUFFER_SIZE: usize = 1024 * 64; +static DEFAULT_COLUMN_WIDTH: usize = 72; +static DEFAULT_COLUMN_SEPARATOR: &str = "\t"; struct OutputOptions { /// Line numbering mode @@ -59,6 +63,13 @@ struct OutputOptions { content_lines_per_page: usize, suppress_errors: bool, page_separator_char: String, + column_mode_options: Option, +} + +struct ColumnModeOptions { + width: usize, + columns: usize, + column_separator: String, } impl AsRef for OutputOptions { @@ -139,23 +150,19 @@ quick_error! { pub fn uumain(args: Vec) -> i32 { let mut opts = getopts::Options::new(); - opts.opt( + opts.optflagopt( "", PAGE_RANGE_OPTION, "Begin and stop printing with page FIRST_PAGE[:LAST_PAGE]", "FIRST_PAGE[:LAST_PAGE]", - HasArg::Yes, - Occur::Optional, ); - opts.opt( + opts.optopt( STRING_HEADER_OPTION, "header", "Use the string header to replace the file name \ in the header line.", - "STRING", - HasArg::Yes, - Occur::Optional, + "STRING" ); opts.opt( @@ -168,16 +175,14 @@ pub fn uumain(args: Vec) -> i32 { Occur::Optional, ); - opts.opt( + opts.optflagopt( NUMBERING_MODE_OPTION, "", "Provide width digit line numbering. The default for width, if not specified, is 5. The number occupies the first width column positions of each text column or each line of -m output. If char (any nondigit character) is given, it is appended to the line number to separate it from whatever follows. The default for char is a . Line numbers longer than width columns are truncated.", - "[char][width]", - HasArg::Yes, - Occur::Optional, + "[char][width]" ); opts.opt( @@ -219,6 +224,30 @@ pub fn uumain(args: Vec) -> i32 { Occur::Optional, ); + opts.opt( + "", + COLUMN_OPTION, + "Produce multi-column output that is arranged in column columns (the default shall be 1) and is written down each + column in the order in which the text is received from the input file. This option should not be used with -m. + The options -e and -i shall be assumed for multiple text-column output. Whether or not text columns are pro‐ + duced with identical vertical lengths is unspecified, but a text column shall never exceed the length of the + page (see the -l option). When used with -t, use the minimum number of lines to write the output.", + "[column]", + HasArg::Yes, + Occur::Optional, + ); + + opts.opt( + COLUMN_WIDTH_OPTION, + "width", + "Set the width of the line to width column positions for multiple text-column output only. If the -w option is + not specified and the -s option is not specified, the default width shall be 72. If the -w option is not speci‐ + fied and the -s option is specified, the default width shall be 512.", + "[width]", + HasArg::Yes, + Occur::Optional, + ); + opts.optflag("", "help", "display this help and exit"); opts.optflag("V", "version", "output version information and exit"); @@ -368,6 +397,24 @@ fn build_options(matches: &Matches, header: &String, path: &String) -> Result()) { + Some(res) => res?, + _ => DEFAULT_COLUMN_WIDTH + }; + + let column_mode_options = match matches.opt_str(COLUMN_OPTION).map(|i| { + i.parse::() + }) { + Some(res) => { + Some(ColumnModeOptions { + columns: res?, + width: column_width, + column_separator: DEFAULT_COLUMN_SEPARATOR.to_string(), + }) + } + _ => None + }; + Ok(OutputOptions { number: numbering_options, header: header.to_string(), @@ -381,6 +428,7 @@ fn build_options(matches: &Matches, header: &String, path: &String) -> Result Result { let mut page: usize = 0; let mut buffered_content: Vec = Vec::new(); let content_lines_per_page = options.as_ref().content_lines_per_page; + let columns = options.as_ref().column_mode_options.as_ref().map(|i| i.columns).unwrap_or(1); let lines_per_page = if options.as_ref().double_space { - content_lines_per_page / 2 + (content_lines_per_page / 2) * columns } else { - content_lines_per_page + content_lines_per_page * columns }; for line in BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?).lines() { if i == lines_per_page { page = page + 1; i = 0; + if !_is_within_page_range(options, &page) { + return Ok(0) + } print_page(&buffered_content, options, &page)?; buffered_content = Vec::new(); } @@ -422,33 +474,26 @@ fn pr(path: &str, options: &OutputOptions) -> Result { } if i != 0 { + if !_is_within_page_range(options, &page) { + return Ok(0) + } page = page + 1; print_page(&buffered_content, options, &page)?; } + return Ok(0); } -fn print_page(lines: &Vec, options: &OutputOptions, page: &usize) -> Result { +fn _is_within_page_range(options: &OutputOptions, page: &usize) -> bool { let start_page = options.as_ref().start_page.as_ref(); let last_page = options.as_ref().end_page.as_ref(); - let content_lines_per_page = options.as_ref().content_lines_per_page; - let is_within_print_range = (start_page.is_none() || page >= start_page.unwrap()) && - (last_page.is_none() || page <= last_page.unwrap()); - let page_separator = options.as_ref().page_separator_char.as_bytes(); - if !is_within_print_range { - return Ok(0); - } - let header: Vec = if options.as_ref().display_header { - header_content(options, page) - } else { - Vec::new() - }; + (start_page.is_none() || page >= start_page.unwrap()) && (last_page.is_none() || page <= last_page.unwrap()) +} - let trailer_content: Vec = if options.as_ref().display_trailer { - trailer_content() - } else { - Vec::new() - }; +fn print_page(lines: &Vec, options: &OutputOptions, page: &usize) -> Result { + let page_separator = options.as_ref().page_separator_char.as_bytes(); + let header: Vec = header_content(options, page); + let trailer_content: Vec = trailer_content(options); let out: &mut Stdout = &mut stdout(); let line_separator = options.as_ref().line_separator.as_bytes(); @@ -461,34 +506,8 @@ fn print_page(lines: &Vec, options: &OutputOptions, page: &usize) -> Res lines_written += 1; } - let width: usize = options.as_ref() - .number.as_ref() - .map(|i| i.width) - .unwrap_or(0); - let separator: String = options.as_ref() - .number.as_ref() - .map(|i| i.separator.to_string()) - .unwrap_or(NumberingMode::default().separator); + lines_written += write_columns(lines, options, page_separator, out, line_separator, page)?; - let prev_lines = content_lines_per_page * (page - 1); - let mut i = 1; - for x in lines { - if options.number.is_none() { - out.write(x.as_bytes())?; - } else { - let fmtd_line_number: String = get_fmtd_line_number(&width, prev_lines + i, &separator); - out.write(format!("{}{}", fmtd_line_number, x).as_bytes())?; - } - - if i == trailer_content.len() { - out.write(page_separator)?; - } else { - out.write(line_separator)?; - } - - i = i + 1; - } - lines_written += i - 1; for index in 0..trailer_content.len() { let x: &String = trailer_content.get(index).unwrap(); out.write(x.as_bytes())?; @@ -503,6 +522,37 @@ fn print_page(lines: &Vec, options: &OutputOptions, page: &usize) -> Res Ok(lines_written) } +fn write_columns(lines: &Vec, options: &OutputOptions, page_separator: &[u8], out: &mut Stdout, line_separator: &[u8], page: &usize) -> Result { + let content_lines_per_page = options.as_ref().content_lines_per_page; + let prev_lines = content_lines_per_page * (page - 1); + let width: usize = options.as_ref() + .number.as_ref() + .map(|i| i.width) + .unwrap_or(0); + let separator: String = options.as_ref() + .number.as_ref() + .map(|i| i.separator.to_string()) + .unwrap_or(NumberingMode::default().separator); + + let mut i = 0; + for x in lines { + if options.number.is_none() { + out.write(x.as_bytes())?; + } else { + let fmtd_line_number: String = get_fmtd_line_number(&width, prev_lines + i, &separator); + out.write(format!("{}{}", fmtd_line_number, x).as_bytes())?; + } + + if i == lines.len() { + out.write(page_separator)?; + } else { + out.write(line_separator)?; + } + i += 1; + } + Ok(i) +} + fn get_fmtd_line_number(width: &usize, line_number: usize, separator: &String) -> String { let line_str = line_number.to_string(); if line_str.len() >= *width { @@ -514,8 +564,12 @@ fn get_fmtd_line_number(width: &usize, line_number: usize, separator: &String) - fn header_content(options: &OutputOptions, page: &usize) -> Vec { - let first_line: String = format!("{} {} Page {}", options.last_modified_time, options.header, page); - vec!["".to_string(), "".to_string(), first_line, "".to_string(), "".to_string()] + if options.as_ref().display_header { + let first_line: String = format!("{} {} Page {}", options.last_modified_time, options.header, page); + vec!["".to_string(), "".to_string(), first_line, "".to_string(), "".to_string()] + } else { + Vec::new() + } } fn file_last_modified_time(path: &str) -> String { @@ -533,8 +587,12 @@ fn current_time() -> String { datetime.format("%b %d %H:%M %Y").to_string() } -fn trailer_content() -> Vec { - vec!["".to_string(), "".to_string(), "".to_string(), "".to_string(), "".to_string()] +fn trailer_content(options: &OutputOptions) -> Vec { + if options.as_ref().display_trailer { + vec!["".to_string(), "".to_string(), "".to_string(), "".to_string(), "".to_string()] + } else { + Vec::new() + } } fn get_input_type(path: &str) -> Option { From 2897039000f46cfb92a2aac19a85c7023629220c Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Fri, 14 Dec 2018 09:13:55 +0530 Subject: [PATCH 0143/1135] pr: fix number of lines printed per page and short pages getting skipped pr: Fix number of lines printed per page pr: Fix first short page getting skipped due to page range --- src/pr/pr.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 4b4632355..403fbc3bb 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -162,7 +162,7 @@ pub fn uumain(args: Vec) -> i32 { "header", "Use the string header to replace the file name \ in the header line.", - "STRING" + "STRING", ); opts.opt( @@ -182,7 +182,7 @@ pub fn uumain(args: Vec) -> i32 { the first width column positions of each text column or each line of -m output. If char (any nondigit character) is given, it is appended to the line number to separate it from whatever follows. The default for char is a . Line numbers longer than width columns are truncated.", - "[char][width]" + "[char][width]", ); opts.opt( @@ -386,7 +386,7 @@ fn build_options(matches: &Matches, header: &String, path: &String) -> Result LINES_PER_PAGE }; - let content_lines_per_page = page_length - (HEADER_LINES_PER_PAGE - TRAILER_LINES_PER_PAGE); + let content_lines_per_page = page_length - (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE); let display_header_and_trailer = !(page_length < (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE)) && !matches.opt_present(NO_HEADER_TRAILER_OPTION); @@ -453,7 +453,7 @@ fn pr(path: &str, options: &OutputOptions) -> Result { let mut page: usize = 0; let mut buffered_content: Vec = Vec::new(); let content_lines_per_page = options.as_ref().content_lines_per_page; - let columns = options.as_ref().column_mode_options.as_ref().map(|i| i.columns).unwrap_or(1); + let columns = _get_columns(options); let lines_per_page = if options.as_ref().double_space { (content_lines_per_page / 2) * columns } else { @@ -464,7 +464,7 @@ fn pr(path: &str, options: &OutputOptions) -> Result { page = page + 1; i = 0; if !_is_within_page_range(options, &page) { - return Ok(0) + return Ok(0); } print_page(&buffered_content, options, &page)?; buffered_content = Vec::new(); @@ -474,16 +474,20 @@ fn pr(path: &str, options: &OutputOptions) -> Result { } if i != 0 { - if !_is_within_page_range(options, &page) { - return Ok(0) - } page = page + 1; + if !_is_within_page_range(options, &page) { + return Ok(0); + } print_page(&buffered_content, options, &page)?; } return Ok(0); } +fn _get_columns(options: &OutputOptions) -> usize { + options.as_ref().column_mode_options.as_ref().map(|i| i.columns).unwrap_or(1) +} + fn _is_within_page_range(options: &OutputOptions, page: &usize) -> bool { let start_page = options.as_ref().start_page.as_ref(); let last_page = options.as_ref().end_page.as_ref(); From f799d22b7d7f83fd5f0608d12bb7eb7e6ec7d4c6 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Sat, 15 Dec 2018 09:18:41 +0530 Subject: [PATCH 0144/1135] pr: add multi column printing --- src/pr/pr.rs | 128 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 92 insertions(+), 36 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 403fbc3bb..c7a833402 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -67,7 +67,7 @@ struct OutputOptions { } struct ColumnModeOptions { - width: usize, + width: Option, columns: usize, column_separator: String, } @@ -78,6 +78,25 @@ impl AsRef for OutputOptions { } } +impl OutputOptions { + fn get_columns(&self) -> usize { + self.as_ref() + .column_mode_options.as_ref() + .map(|i| i.columns) + .unwrap_or(1) + } + + fn lines_to_read_for_page(&self) -> usize { + let content_lines_per_page = &self.as_ref().content_lines_per_page; + let columns = self.get_columns(); + if self.as_ref().double_space { + (content_lines_per_page / 2) * columns + } else { + content_lines_per_page * columns + } + } +} + struct NumberingMode { /// Line numbering mode width: usize, @@ -393,13 +412,13 @@ fn build_options(matches: &Matches, header: &String, path: &String) -> Result()) { - Some(res) => res?, - _ => DEFAULT_COLUMN_WIDTH + Some(res) => Some(res?), + _ => None }; let column_mode_options = match matches.opt_str(COLUMN_OPTION).map(|i| { @@ -408,7 +427,10 @@ fn build_options(matches: &Matches, header: &String, path: &String) -> Result { Some(ColumnModeOptions { columns: res?, - width: column_width, + width: match column_width { + Some(x) => Some(x), + None => Some(DEFAULT_COLUMN_WIDTH) + }, column_separator: DEFAULT_COLUMN_SEPARATOR.to_string(), }) } @@ -452,21 +474,16 @@ fn pr(path: &str, options: &OutputOptions) -> Result { let mut i = 0; let mut page: usize = 0; let mut buffered_content: Vec = Vec::new(); - let content_lines_per_page = options.as_ref().content_lines_per_page; - let columns = _get_columns(options); - let lines_per_page = if options.as_ref().double_space { - (content_lines_per_page / 2) * columns - } else { - content_lines_per_page * columns - }; + let read_lines_per_page = options.lines_to_read_for_page(); + let mut line_number = 0; for line in BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?).lines() { - if i == lines_per_page { + if i == read_lines_per_page { page = page + 1; i = 0; if !_is_within_page_range(options, &page) { return Ok(0); } - print_page(&buffered_content, options, &page)?; + line_number += print_page(&buffered_content, options, &page, &line_number)?; buffered_content = Vec::new(); } buffered_content.push(line?); @@ -478,39 +495,33 @@ fn pr(path: &str, options: &OutputOptions) -> Result { if !_is_within_page_range(options, &page) { return Ok(0); } - print_page(&buffered_content, options, &page)?; + print_page(&buffered_content, options, &page, &line_number)?; } return Ok(0); } -fn _get_columns(options: &OutputOptions) -> usize { - options.as_ref().column_mode_options.as_ref().map(|i| i.columns).unwrap_or(1) -} - fn _is_within_page_range(options: &OutputOptions, page: &usize) -> bool { let start_page = options.as_ref().start_page.as_ref(); let last_page = options.as_ref().end_page.as_ref(); (start_page.is_none() || page >= start_page.unwrap()) && (last_page.is_none() || page <= last_page.unwrap()) } -fn print_page(lines: &Vec, options: &OutputOptions, page: &usize) -> Result { +fn print_page(lines: &Vec, options: &OutputOptions, page: &usize, line_number: &usize) -> Result { let page_separator = options.as_ref().page_separator_char.as_bytes(); let header: Vec = header_content(options, page); let trailer_content: Vec = trailer_content(options); let out: &mut Stdout = &mut stdout(); let line_separator = options.as_ref().line_separator.as_bytes(); - let mut lines_written = 0; out.lock(); for x in header { out.write(x.as_bytes())?; out.write(line_separator)?; - lines_written += 1; } - lines_written += write_columns(lines, options, page_separator, out, line_separator, page)?; + let lines_written = write_columns(lines, options, out, line_number)?; for index in 0..trailer_content.len() { let x: &String = trailer_content.get(index).unwrap(); @@ -520,43 +531,88 @@ fn print_page(lines: &Vec, options: &OutputOptions, page: &usize) -> Res } else { out.write(line_separator)?; } - lines_written += 1; } out.flush()?; Ok(lines_written) } -fn write_columns(lines: &Vec, options: &OutputOptions, page_separator: &[u8], out: &mut Stdout, line_separator: &[u8], page: &usize) -> Result { +fn write_columns(lines: &Vec, options: &OutputOptions, out: &mut Stdout, line_number: &usize) -> Result { + let line_separator = options.as_ref().line_separator.as_bytes(); + let page_separator = options.as_ref().page_separator_char.as_bytes(); let content_lines_per_page = options.as_ref().content_lines_per_page; - let prev_lines = content_lines_per_page * (page - 1); let width: usize = options.as_ref() .number.as_ref() .map(|i| i.width) .unwrap_or(0); - let separator: String = options.as_ref() + let number_separator: String = options.as_ref() .number.as_ref() .map(|i| i.separator.to_string()) .unwrap_or(NumberingMode::default().separator); - let mut i = 0; - for x in lines { - if options.number.is_none() { - out.write(x.as_bytes())?; - } else { - let fmtd_line_number: String = get_fmtd_line_number(&width, prev_lines + i, &separator); - out.write(format!("{}{}", fmtd_line_number, x).as_bytes())?; - } + let blank_line = "".to_string(); + let columns = options.get_columns(); + let col_sep: &String = options.as_ref() + .column_mode_options.as_ref() + .map(|i| &i.column_separator) + .unwrap_or(&blank_line); + + let col_width: Option = options.as_ref() + .column_mode_options.as_ref() + .map(|i| i.width) + .unwrap_or(None); + + let mut i = 0; + let is_number_mode = options.number.is_some(); + for start in 0..content_lines_per_page { + let indexes: Vec = get_indexes(start, content_lines_per_page, columns); + let mut line = String::new(); + for index in indexes { + let read_line: &String = lines.get(index).unwrap_or(&blank_line); + let next_line_number = line_number + index + 1; + let trimmed_line = get_line_for_printing( + next_line_number, &width, + &number_separator, columns, + col_sep, col_width, + read_line, is_number_mode); + line.push_str(&trimmed_line); + i += 1; + } + out.write(line.as_bytes())?; if i == lines.len() { out.write(page_separator)?; } else { out.write(line_separator)?; } - i += 1; } Ok(i) } +fn get_line_for_printing(line_number: usize, width: &usize, + separator: &String, columns: usize, col_sep: &String, col_width: Option, + read_line: &String, is_number_mode: bool) -> String { + let fmtd_line_number: String = if is_number_mode { + get_fmtd_line_number(&width, line_number, &separator) + } else { + "".to_string() + }; + let complete_line = format!("{}{}{}", fmtd_line_number, read_line, col_sep); + // TODO Adjust the width according to -n option + // TODO Line has less content than the column width + col_width.map(|i| complete_line.chars().take(i / columns).collect()).unwrap_or(complete_line) +} + +fn get_indexes(start: usize, content_lines_per_page: usize, columns: usize) -> Vec { + let mut indexes: Vec = Vec::new(); + let mut offset = start; + indexes.push(offset); + for _col in 1..columns { + offset += content_lines_per_page; + indexes.push(offset); + } + indexes +} + fn get_fmtd_line_number(width: &usize, line_number: usize, separator: &String) -> String { let line_str = line_number.to_string(); if line_str.len() >= *width { From 629236bd39e75c5470448f69d60cee91489c7fe7 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Sat, 15 Dec 2018 11:27:40 +0530 Subject: [PATCH 0145/1135] pr: add first test --- tests/common/util.rs | 14 +++++ tests/fixtures/pr/test_one_page.log | 56 +++++++++++++++++ tests/fixtures/pr/test_one_page.log.expected | 66 ++++++++++++++++++++ tests/test_pr.rs | 29 +++++++++ 4 files changed, 165 insertions(+) create mode 100644 tests/fixtures/pr/test_one_page.log create mode 100644 tests/fixtures/pr/test_one_page.log.expected create mode 100644 tests/test_pr.rs diff --git a/tests/common/util.rs b/tests/common/util.rs index a2fab66c6..90b518619 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -127,6 +127,15 @@ impl CmdResult { let contents = read_scenario_fixture(&self.tmpd, file_rel_path); self.stdout_is(contents) } + /// like stdout_is_fixture(...), but replaces the data in fixture file based on values provided in template_vars + /// command output + pub fn stdout_is_templated_fixture>(&self, file_rel_path: T, template_vars: Vec<(String, String)>) -> Box<&CmdResult> { + let mut contents = read_scenario_fixture(&self.tmpd, file_rel_path); + for kv in template_vars { + contents = contents.replace(&kv.0, &kv.1); + } + self.stdout_is(contents) + } /// asserts that the command resulted in stderr stream output that equals the /// passed in value, when both are trimmed of trailing whitespace @@ -615,6 +624,11 @@ impl UCommand { cmd_result.failure(); cmd_result } + + pub fn get_full_fixture_path(&self, file_rel_path: &str) -> String{ + let tmpdir_path = self.tmpd.as_ref().unwrap().path(); + format!("{}/{}", tmpdir_path.to_str().unwrap(), file_rel_path) + } } pub fn read_size(child: &mut Child, size: usize) -> String { diff --git a/tests/fixtures/pr/test_one_page.log b/tests/fixtures/pr/test_one_page.log new file mode 100644 index 000000000..4de6f5bf3 --- /dev/null +++ b/tests/fixtures/pr/test_one_page.log @@ -0,0 +1,56 @@ +ntation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.705 Info: 802.1X changed +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.854 Info: 802.1X changed +Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.002 Info: 802.1X changed +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.152 Info: 802.1X changed +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.302 Info: 802.1X changed +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.449 Info: 802.1X changed +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.600 Info: 802.1X changed +Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.749 Info: 802.1X changed +Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.896 Info: 802.1X changed +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.045 Info: 802.1X changed +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.193 Info: 802.1X changed +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.342 Info: 802.1X changed +Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.491 Info: 802.1X changed +Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.640 Info: 802.1X changed +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.805 Info: 802.1X changed +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.958 Info: 802.1X changed +Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.155 Info: 802.1X changed +Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.352 Info: 802.1X changed diff --git a/tests/fixtures/pr/test_one_page.log.expected b/tests/fixtures/pr/test_one_page.log.expected new file mode 100644 index 000000000..54f772392 --- /dev/null +++ b/tests/fixtures/pr/test_one_page.log.expected @@ -0,0 +1,66 @@ + + +{last_modified_time} test_one_page.log Page 1 + + +ntation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.705 Info: 802.1X changed +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.854 Info: 802.1X changed +Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.002 Info: 802.1X changed +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.152 Info: 802.1X changed +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.302 Info: 802.1X changed +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.449 Info: 802.1X changed +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.600 Info: 802.1X changed +Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.749 Info: 802.1X changed +Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.896 Info: 802.1X changed +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.045 Info: 802.1X changed +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.193 Info: 802.1X changed +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.342 Info: 802.1X changed +Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.491 Info: 802.1X changed +Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.640 Info: 802.1X changed +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.805 Info: 802.1X changed +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.958 Info: 802.1X changed +Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.155 Info: 802.1X changed +Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + diff --git a/tests/test_pr.rs b/tests/test_pr.rs new file mode 100644 index 000000000..8ec8ebc0d --- /dev/null +++ b/tests/test_pr.rs @@ -0,0 +1,29 @@ +extern crate chrono; + +use common::util::*; +use std::fs::metadata; +use test_pr::chrono::DateTime; +use test_pr::chrono::offset::Local; + +fn file_last_modified_time(ucmd: &UCommand, path: &str) -> String { + let tmp_dir_path = ucmd.get_full_fixture_path(path); + let file_metadata = metadata(tmp_dir_path); + return file_metadata.map(|i| { + return i.modified().map(|x| { + let datetime: DateTime = x.into(); + datetime.format("%b %d %H:%M %Y").to_string() + }).unwrap_or(String::new()); + }).unwrap_or(String::new()); +} + + +#[test] +fn test_output_multi_files_print_all_chars() { + let test_file_path = "test_one_page.log"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["test_one_page.log"]) + .succeeds() + .stdout_is_templated_fixture("test_one_page.log.expected", vec![("{last_modified_time}".to_string(), value)]); +} \ No newline at end of file From 64e2e1dbac31faf427401197ec8392bb02973a22 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Sat, 15 Dec 2018 11:34:05 +0530 Subject: [PATCH 0146/1135] pr: remove parameter header and get_input_type pr: Remove parameter header from build_options pr: Remove unnecessary get_input_type --- src/pr/pr.rs | 106 ++++++++++++++++++----------------------------- tests/test_pr.rs | 2 +- 2 files changed, 41 insertions(+), 67 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index c7a833402..a6636eaa7 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -112,21 +112,6 @@ impl Default for NumberingMode { } } -enum InputType { - Directory, - File, - StdIn, - SymLink, - #[cfg(unix)] - BlockDevice, - #[cfg(unix)] - CharacterDevice, - #[cfg(unix)] - Fifo, - #[cfg(unix)] - Socket, -} - impl From for PrError { fn from(err: Error) -> Self { PrError::EncounteredErrors(err.to_string()) @@ -163,6 +148,10 @@ quick_error! { IsSocket(path: String) { display("pr: cannot open {}, Operation not supported on socket", path) } + + NotExists(path: String) { + display("pr: cannot open {}, No such file or directory", path) + } } } @@ -291,8 +280,7 @@ pub fn uumain(args: Vec) -> i32 { } for f in files { - let header: &String = &matches.opt_str(STRING_HEADER_OPTION).unwrap_or(f.to_string()); - let result_options = build_options(&matches, header, &f); + let result_options = build_options(&matches, &f); if result_options.is_err() { writeln!(&mut stderr(), "{}", result_options.err().unwrap()); return 1; @@ -349,7 +337,8 @@ fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { return 0; } -fn build_options(matches: &Matches, header: &String, path: &String) -> Result { +fn build_options(matches: &Matches, path: &String) -> Result { + let header: String = matches.opt_str(STRING_HEADER_OPTION).unwrap_or(path.to_string()); let numbering_options: Option = matches.opt_str(NUMBERING_MODE_OPTION).map(|i| { NumberingMode { width: i.parse::().unwrap_or(NumberingMode::default().width), @@ -439,7 +428,7 @@ fn build_options(matches: &Matches, header: &String, path: &String) -> Result Result Result, PrError> { - match get_input_type(path) { - Some(InputType::Directory) => Err(PrError::IsDirectory(path.to_string())), - #[cfg(unix)] - Some(InputType::Socket) => { - Err(PrError::IsSocket(path.to_string())) - } - Some(InputType::StdIn) => { - let stdin = stdin(); - Ok(Box::new(stdin) as Box) - } - Some(_) => Ok(Box::new(File::open(path).context(path)?) as Box), - None => Err(PrError::UnknownFiletype(path.to_string())) + if path == FILE_STDIN { + let stdin = stdin(); + return Ok(Box::new(stdin) as Box); } + + metadata(path).map(|i| { + let path_string = path.to_string(); + match i.file_type() { + #[cfg(unix)] + ft if ft.is_block_device() => + { + Err(PrError::UnknownFiletype(path_string)) + } + #[cfg(unix)] + ft if ft.is_char_device() => + { + Err(PrError::UnknownFiletype(path_string)) + } + #[cfg(unix)] + ft if ft.is_fifo() => + { + Err(PrError::UnknownFiletype(path_string)) + } + #[cfg(unix)] + ft if ft.is_socket() => + { + Err(PrError::IsSocket(path_string)) + } + ft if ft.is_dir() => Err(PrError::IsDirectory(path_string)), + ft if ft.is_file() || ft.is_symlink() => Ok(Box::new(File::open(path).context(path)?) as Box), + _ => Err(PrError::UnknownFiletype(path_string)) + } + }).unwrap_or(Err(PrError::NotExists(path.to_string()))) } fn pr(path: &str, options: &OutputOptions) -> Result { @@ -654,38 +663,3 @@ fn trailer_content(options: &OutputOptions) -> Vec { Vec::new() } } - -fn get_input_type(path: &str) -> Option { - if path == FILE_STDIN { - return Some(InputType::StdIn); - } - - metadata(path).map(|i| { - match i.file_type() { - #[cfg(unix)] - ft if ft.is_block_device() => - { - Some(InputType::BlockDevice) - } - #[cfg(unix)] - ft if ft.is_char_device() => - { - Some(InputType::CharacterDevice) - } - #[cfg(unix)] - ft if ft.is_fifo() => - { - Some(InputType::Fifo) - } - #[cfg(unix)] - ft if ft.is_socket() => - { - Some(InputType::Socket) - } - ft if ft.is_dir() => Some(InputType::Directory), - ft if ft.is_file() => Some(InputType::File), - ft if ft.is_symlink() => Some(InputType::SymLink), - _ => None - } - }).unwrap_or(None) -} diff --git a/tests/test_pr.rs b/tests/test_pr.rs index 8ec8ebc0d..5e839bc3a 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -18,7 +18,7 @@ fn file_last_modified_time(ucmd: &UCommand, path: &str) -> String { #[test] -fn test_output_multi_files_print_all_chars() { +fn test_without_any_options() { let test_file_path = "test_one_page.log"; let mut scenario = new_ucmd!(); let value = file_last_modified_time(&scenario, test_file_path); From afc58eb6ea7adf451f5cf518fdef6922e957ebc8 Mon Sep 17 00:00:00 2001 From: Tilak Patidar Date: Sat, 15 Dec 2018 22:54:01 +0530 Subject: [PATCH 0147/1135] pr: add tests for -n -h -d option pr: Add test for -h option pr: Add test for -d option --- src/pr/pr.rs | 44 +++- tests/fixtures/pr/test_num_page.log | 112 ++++++++++ tests/fixtures/pr/test_num_page.log.expected | 132 ++++++++++++ .../fixtures/pr/test_num_page_2.log.expected | 132 ++++++++++++ .../pr/test_num_page_less_content.log | 7 + .../test_num_page_less_content.log.expected | 19 ++ .../pr/test_one_page_double_line.log.expected | 204 ++++++++++++++++++ .../pr/test_one_page_header.log.expected | 66 ++++++ tests/test_pr.rs | 101 ++++++++- 9 files changed, 808 insertions(+), 9 deletions(-) create mode 100644 tests/fixtures/pr/test_num_page.log create mode 100644 tests/fixtures/pr/test_num_page.log.expected create mode 100644 tests/fixtures/pr/test_num_page_2.log.expected create mode 100644 tests/fixtures/pr/test_num_page_less_content.log create mode 100644 tests/fixtures/pr/test_num_page_less_content.log.expected create mode 100644 tests/fixtures/pr/test_one_page_double_line.log.expected create mode 100644 tests/fixtures/pr/test_one_page_header.log.expected diff --git a/src/pr/pr.rs b/src/pr/pr.rs index a6636eaa7..20db63d1b 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -158,19 +158,23 @@ quick_error! { pub fn uumain(args: Vec) -> i32 { let mut opts = getopts::Options::new(); - opts.optflagopt( + opts.opt( "", PAGE_RANGE_OPTION, "Begin and stop printing with page FIRST_PAGE[:LAST_PAGE]", "FIRST_PAGE[:LAST_PAGE]", + HasArg::Yes, + Occur::Optional, ); - opts.optopt( + opts.opt( STRING_HEADER_OPTION, "header", "Use the string header to replace the file name \ in the header line.", "STRING", + HasArg::Yes, + Occur::Optional, ); opts.opt( @@ -183,14 +187,16 @@ pub fn uumain(args: Vec) -> i32 { Occur::Optional, ); - opts.optflagopt( + opts.opt( NUMBERING_MODE_OPTION, - "", + "--number-lines", "Provide width digit line numbering. The default for width, if not specified, is 5. The number occupies the first width column positions of each text column or each line of -m output. If char (any nondigit character) is given, it is appended to the line number to separate it from whatever follows. The default for char is a . Line numbers longer than width columns are truncated.", "[char][width]", + HasArg::Maybe, + Occur::Optional, ); opts.opt( @@ -271,10 +277,22 @@ pub fn uumain(args: Vec) -> i32 { let mut files: Vec = matches.free.clone(); if files.is_empty() { - //For stdin - files.push(FILE_STDIN.to_owned()); + // -n value is optional if -n is given the opts gets confused + if matches.opt_present(NUMBERING_MODE_OPTION) { + let is_afile = is_a_file(&matches, &mut files); + if is_afile.is_err() { + writeln!(&mut stderr(), "{}", is_afile.err().unwrap()); + return 1; + } else { + files.push(is_afile.unwrap()); + } + } else { + //For stdin + files.push(FILE_STDIN.to_owned()); + } } + if matches.opt_present("help") { return print_usage(&mut opts, &matches); } @@ -302,6 +320,14 @@ pub fn uumain(args: Vec) -> i32 { return 0; } +fn is_a_file(matches: &Matches, files: &mut Vec) -> Result { + let could_be_file = matches.opt_str(NUMBERING_MODE_OPTION).unwrap(); + match File::open(&could_be_file) { + Ok(f) => Ok(could_be_file), + Err(e) => Err(PrError::NotExists(could_be_file)) + } +} + fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { println!("{} {} -- print files", NAME, VERSION); println!(); @@ -573,11 +599,15 @@ fn write_columns(lines: &Vec, options: &OutputOptions, out: &mut Stdout, let mut i = 0; let is_number_mode = options.number.is_some(); + for start in 0..content_lines_per_page { let indexes: Vec = get_indexes(start, content_lines_per_page, columns); let mut line = String::new(); for index in indexes { - let read_line: &String = lines.get(index).unwrap_or(&blank_line); + if lines.get(index).is_none() { + break; + } + let read_line = lines.get(index).unwrap(); let next_line_number = line_number + index + 1; let trimmed_line = get_line_for_printing( next_line_number, &width, diff --git a/tests/fixtures/pr/test_num_page.log b/tests/fixtures/pr/test_num_page.log new file mode 100644 index 000000000..da467dce2 --- /dev/null +++ b/tests/fixtures/pr/test_num_page.log @@ -0,0 +1,112 @@ +ntation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.705 Info: 802.1X changed +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.854 Info: 802.1X changed +Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.002 Info: 802.1X changed +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.152 Info: 802.1X changed +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.302 Info: 802.1X changed +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.449 Info: 802.1X changed +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.600 Info: 802.1X changed +Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.749 Info: 802.1X changed +Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.896 Info: 802.1X changed +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.045 Info: 802.1X changed +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.193 Info: 802.1X changed +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.342 Info: 802.1X changed +Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.491 Info: 802.1X changed +Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.640 Info: 802.1X changed +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.805 Info: 802.1X changed +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.958 Info: 802.1X changed +Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.155 Info: 802.1X changed +Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.352 Info: 802.1X changed +ntation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.705 Info: 802.1X changed +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.854 Info: 802.1X changed +Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.002 Info: 802.1X changed +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.152 Info: 802.1X changed +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.302 Info: 802.1X changed +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.449 Info: 802.1X changed +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.600 Info: 802.1X changed +Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.749 Info: 802.1X changed +Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.896 Info: 802.1X changed +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.045 Info: 802.1X changed +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.193 Info: 802.1X changed +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.342 Info: 802.1X changed +Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.491 Info: 802.1X changed +Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.640 Info: 802.1X changed +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.805 Info: 802.1X changed +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.958 Info: 802.1X changed +Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.155 Info: 802.1X changed +Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.352 Info: 802.1X changed diff --git a/tests/fixtures/pr/test_num_page.log.expected b/tests/fixtures/pr/test_num_page.log.expected new file mode 100644 index 000000000..076d3f212 --- /dev/null +++ b/tests/fixtures/pr/test_num_page.log.expected @@ -0,0 +1,132 @@ + + +{last_modified_time} test_num_page.log Page 1 + + + 1 ntation processAirPortStateChanges]: pppConnectionState 0 + 2 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 3 Mon Dec 10 11:42:56.705 Info: 802.1X changed + 4 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 5 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 6 Mon Dec 10 11:42:56.854 Info: 802.1X changed + 7 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 8 Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 9 Mon Dec 10 11:42:57.002 Info: 802.1X changed + 10 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 11 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 12 Mon Dec 10 11:42:57.152 Info: 802.1X changed + 13 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 14 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 15 Mon Dec 10 11:42:57.302 Info: 802.1X changed + 16 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 17 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 18 Mon Dec 10 11:42:57.449 Info: 802.1X changed + 19 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 20 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 21 Mon Dec 10 11:42:57.600 Info: 802.1X changed + 22 Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 23 Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 24 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 25 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 26 Mon Dec 10 11:42:57.749 Info: 802.1X changed + 27 Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 28 Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 29 Mon Dec 10 11:42:57.896 Info: 802.1X changed + 30 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 31 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 32 Mon Dec 10 11:42:58.045 Info: 802.1X changed + 33 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 34 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 35 Mon Dec 10 11:42:58.193 Info: 802.1X changed + 36 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 37 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 38 Mon Dec 10 11:42:58.342 Info: 802.1X changed + 39 Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 40 Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 41 Mon Dec 10 11:42:58.491 Info: 802.1X changed + 42 Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 43 Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 44 Mon Dec 10 11:42:58.640 Info: 802.1X changed + 45 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 46 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 47 Mon Dec 10 11:42:58.805 Info: 802.1X changed + 48 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 49 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 50 Mon Dec 10 11:42:58.958 Info: 802.1X changed + 51 Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 52 Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 53 Mon Dec 10 11:42:59.155 Info: 802.1X changed + 54 Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 55 Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 56 Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + + + +{last_modified_time} test_num_page.log Page 2 + + + 57 ntation processAirPortStateChanges]: pppConnectionState 0 + 58 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 59 Mon Dec 10 11:42:56.705 Info: 802.1X changed + 60 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 61 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 62 Mon Dec 10 11:42:56.854 Info: 802.1X changed + 63 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 64 Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 65 Mon Dec 10 11:42:57.002 Info: 802.1X changed + 66 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 67 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 68 Mon Dec 10 11:42:57.152 Info: 802.1X changed + 69 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 70 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 71 Mon Dec 10 11:42:57.302 Info: 802.1X changed + 72 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 73 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 74 Mon Dec 10 11:42:57.449 Info: 802.1X changed + 75 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 76 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 77 Mon Dec 10 11:42:57.600 Info: 802.1X changed + 78 Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 79 Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 80 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 81 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 82 Mon Dec 10 11:42:57.749 Info: 802.1X changed + 83 Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 84 Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 85 Mon Dec 10 11:42:57.896 Info: 802.1X changed + 86 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 87 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 88 Mon Dec 10 11:42:58.045 Info: 802.1X changed + 89 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 90 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 91 Mon Dec 10 11:42:58.193 Info: 802.1X changed + 92 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 93 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 94 Mon Dec 10 11:42:58.342 Info: 802.1X changed + 95 Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 96 Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 97 Mon Dec 10 11:42:58.491 Info: 802.1X changed + 98 Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 99 Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 100 Mon Dec 10 11:42:58.640 Info: 802.1X changed + 101 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 102 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 103 Mon Dec 10 11:42:58.805 Info: 802.1X changed + 104 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 105 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 106 Mon Dec 10 11:42:58.958 Info: 802.1X changed + 107 Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 108 Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 109 Mon Dec 10 11:42:59.155 Info: 802.1X changed + 110 Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 111 Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 112 Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + diff --git a/tests/fixtures/pr/test_num_page_2.log.expected b/tests/fixtures/pr/test_num_page_2.log.expected new file mode 100644 index 000000000..dae437ef8 --- /dev/null +++ b/tests/fixtures/pr/test_num_page_2.log.expected @@ -0,0 +1,132 @@ + + +{last_modified_time} test_num_page.log Page 1 + + + 1 ntation processAirPortStateChanges]: pppConnectionState 0 + 2 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 3 Mon Dec 10 11:42:56.705 Info: 802.1X changed + 4 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 5 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 6 Mon Dec 10 11:42:56.854 Info: 802.1X changed + 7 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 8 Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 9 Mon Dec 10 11:42:57.002 Info: 802.1X changed +10 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +11 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +12 Mon Dec 10 11:42:57.152 Info: 802.1X changed +13 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +14 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +15 Mon Dec 10 11:42:57.302 Info: 802.1X changed +16 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +17 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +18 Mon Dec 10 11:42:57.449 Info: 802.1X changed +19 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +20 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +21 Mon Dec 10 11:42:57.600 Info: 802.1X changed +22 Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +23 Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +24 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +25 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +26 Mon Dec 10 11:42:57.749 Info: 802.1X changed +27 Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +28 Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +29 Mon Dec 10 11:42:57.896 Info: 802.1X changed +30 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +31 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +32 Mon Dec 10 11:42:58.045 Info: 802.1X changed +33 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +34 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +35 Mon Dec 10 11:42:58.193 Info: 802.1X changed +36 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +37 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +38 Mon Dec 10 11:42:58.342 Info: 802.1X changed +39 Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +40 Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +41 Mon Dec 10 11:42:58.491 Info: 802.1X changed +42 Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +43 Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +44 Mon Dec 10 11:42:58.640 Info: 802.1X changed +45 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +46 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +47 Mon Dec 10 11:42:58.805 Info: 802.1X changed +48 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +49 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +50 Mon Dec 10 11:42:58.958 Info: 802.1X changed +51 Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +52 Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +53 Mon Dec 10 11:42:59.155 Info: 802.1X changed +54 Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +55 Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +56 Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + + + +{last_modified_time} test_num_page.log Page 2 + + +57 ntation processAirPortStateChanges]: pppConnectionState 0 +58 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +59 Mon Dec 10 11:42:56.705 Info: 802.1X changed +60 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +61 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +62 Mon Dec 10 11:42:56.854 Info: 802.1X changed +63 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +64 Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +65 Mon Dec 10 11:42:57.002 Info: 802.1X changed +66 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +67 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +68 Mon Dec 10 11:42:57.152 Info: 802.1X changed +69 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +70 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +71 Mon Dec 10 11:42:57.302 Info: 802.1X changed +72 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +73 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +74 Mon Dec 10 11:42:57.449 Info: 802.1X changed +75 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +76 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +77 Mon Dec 10 11:42:57.600 Info: 802.1X changed +78 Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +79 Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +80 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +81 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +82 Mon Dec 10 11:42:57.749 Info: 802.1X changed +83 Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +84 Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +85 Mon Dec 10 11:42:57.896 Info: 802.1X changed +86 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +87 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +88 Mon Dec 10 11:42:58.045 Info: 802.1X changed +89 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +90 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +91 Mon Dec 10 11:42:58.193 Info: 802.1X changed +92 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +93 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +94 Mon Dec 10 11:42:58.342 Info: 802.1X changed +95 Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +96 Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +97 Mon Dec 10 11:42:58.491 Info: 802.1X changed +98 Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +99 Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +00 Mon Dec 10 11:42:58.640 Info: 802.1X changed +01 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +02 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +03 Mon Dec 10 11:42:58.805 Info: 802.1X changed +04 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +05 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +06 Mon Dec 10 11:42:58.958 Info: 802.1X changed +07 Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +08 Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +09 Mon Dec 10 11:42:59.155 Info: 802.1X changed +10 Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +11 Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +12 Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + diff --git a/tests/fixtures/pr/test_num_page_less_content.log b/tests/fixtures/pr/test_num_page_less_content.log new file mode 100644 index 000000000..cf13a6862 --- /dev/null +++ b/tests/fixtures/pr/test_num_page_less_content.log @@ -0,0 +1,7 @@ +ntation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.705 Info: 802.1X changed +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.854 Info: 802.1X changed +Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 \ No newline at end of file diff --git a/tests/fixtures/pr/test_num_page_less_content.log.expected b/tests/fixtures/pr/test_num_page_less_content.log.expected new file mode 100644 index 000000000..a3c733e01 --- /dev/null +++ b/tests/fixtures/pr/test_num_page_less_content.log.expected @@ -0,0 +1,19 @@ + + +{last_modified_time} test_num_page_less_content.log Page 1 + + + 1 ntation processAirPortStateChanges]: pppConnectionState 0 + 2 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 3 Mon Dec 10 11:42:56.705 Info: 802.1X changed + 4 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 5 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 6 Mon Dec 10 11:42:56.854 Info: 802.1X changed + 7 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + + + + + + + diff --git a/tests/fixtures/pr/test_one_page_double_line.log.expected b/tests/fixtures/pr/test_one_page_double_line.log.expected new file mode 100644 index 000000000..831570103 --- /dev/null +++ b/tests/fixtures/pr/test_one_page_double_line.log.expected @@ -0,0 +1,204 @@ + + + + +{last_modified_time} test_one_page.log Page 1 + + + + + +ntation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:56.705 Info: 802.1X changed + +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:56.854 Info: 802.1X changed + +Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:57.002 Info: 802.1X changed + +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:57.152 Info: 802.1X changed + +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:57.302 Info: 802.1X changed + +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:57.449 Info: 802.1X changed + +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:57.600 Info: 802.1X changed + +Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:57.749 Info: 802.1X changed + +Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} test_one_page.log Page 2 + + + + + +Mon Dec 10 11:42:57.896 Info: 802.1X changed + +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:58.045 Info: 802.1X changed + +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:58.193 Info: 802.1X changed + +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:58.342 Info: 802.1X changed + +Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:58.491 Info: 802.1X changed + +Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:58.640 Info: 802.1X changed + +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:58.805 Info: 802.1X changed + +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:58.958 Info: 802.1X changed + +Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:59.155 Info: 802.1X changed + +Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/fixtures/pr/test_one_page_header.log.expected b/tests/fixtures/pr/test_one_page_header.log.expected new file mode 100644 index 000000000..a00d5f855 --- /dev/null +++ b/tests/fixtures/pr/test_one_page_header.log.expected @@ -0,0 +1,66 @@ + + +{last_modified_time} {header} Page 1 + + +ntation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.705 Info: 802.1X changed +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.854 Info: 802.1X changed +Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.002 Info: 802.1X changed +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.152 Info: 802.1X changed +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.302 Info: 802.1X changed +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.449 Info: 802.1X changed +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.600 Info: 802.1X changed +Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.749 Info: 802.1X changed +Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.896 Info: 802.1X changed +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.045 Info: 802.1X changed +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.193 Info: 802.1X changed +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.342 Info: 802.1X changed +Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.491 Info: 802.1X changed +Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.640 Info: 802.1X changed +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.805 Info: 802.1X changed +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.958 Info: 802.1X changed +Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.155 Info: 802.1X changed +Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + diff --git a/tests/test_pr.rs b/tests/test_pr.rs index 5e839bc3a..bb068181d 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -20,10 +20,107 @@ fn file_last_modified_time(ucmd: &UCommand, path: &str) -> String { #[test] fn test_without_any_options() { let test_file_path = "test_one_page.log"; + let expected_test_file_path = "test_one_page.log.expected"; let mut scenario = new_ucmd!(); let value = file_last_modified_time(&scenario, test_file_path); scenario - .args(&["test_one_page.log"]) + .args(&[test_file_path]) .succeeds() - .stdout_is_templated_fixture("test_one_page.log.expected", vec![("{last_modified_time}".to_string(), value)]); + .stdout_is_templated_fixture(expected_test_file_path, vec![("{last_modified_time}".to_string(), value)]); +} + +#[test] +fn test_with_numbering_option() { + let test_file_path = "test_num_page.log"; + let expected_test_file_path = "test_num_page.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["-n", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![("{last_modified_time}".to_string(), value)]); +} + +#[test] +fn test_with_numbering_option_when_content_is_less_than_page() { + let test_file_path = "test_num_page_less_content.log"; + let expected_test_file_path = "test_num_page_less_content.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["-n", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![("{last_modified_time}".to_string(), value)]); +} + +#[test] +fn test_with_numbering_option_with_number_width() { + let test_file_path = "test_num_page.log"; + let expected_test_file_path = "test_num_page_2.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["-n", "2", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![("{last_modified_time}".to_string(), value)]); +} + +#[test] +fn test_with_header_option() { + let test_file_path = "test_one_page.log"; + let expected_test_file_path = "test_one_page_header.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + let header = "new file"; + scenario + .args(&["-h", header, test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + ("{last_modified_time}".to_string(), value), + ("{header}".to_string(), header.to_string()) + ]); +} + +#[test] +fn test_with_long_header_option() { + let test_file_path = "test_one_page.log"; + let expected_test_file_path = "test_one_page_header.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + let header = "new file"; + scenario + .args(&["--header=new file", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + ("{last_modified_time}".to_string(), value), + ("{header}".to_string(), header.to_string()) + ]); +} + +#[test] +fn test_with_double_space_option() { + let test_file_path = "test_one_page.log"; + let expected_test_file_path = "test_one_page_double_line.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["-d", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + ("{last_modified_time}".to_string(), value), + ]); +} + +#[test] +fn test_with_long_double_space_option() { + let test_file_path = "test_one_page.log"; + let expected_test_file_path = "test_one_page_double_line.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["--double-space", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + ("{last_modified_time}".to_string(), value), + ]); } \ No newline at end of file From 88ec02a61c6db2eb8423f89999dc91c89a8ea5d2 Mon Sep 17 00:00:00 2001 From: Tilak Patidar Date: Sun, 16 Dec 2018 11:53:30 +0530 Subject: [PATCH 0148/1135] pr: add suport for -n [char][width] and -N pr: Fix long name for -n pr: Add -N first line number option pr: Add -n[char][width] support --- src/pr/pr.rs | 70 ++++++++-- .../pr/test_num_page_char.log.expected | 132 ++++++++++++++++++ .../pr/test_num_page_char_one.log.expected | 132 ++++++++++++++++++ .../pr/test_one_page_first_line.log.expected | 66 +++++++++ tests/test_pr.rs | 56 ++++++++ 5 files changed, 442 insertions(+), 14 deletions(-) create mode 100644 tests/fixtures/pr/test_num_page_char.log.expected create mode 100644 tests/fixtures/pr/test_num_page_char_one.log.expected create mode 100644 tests/fixtures/pr/test_one_page_first_line.log.expected diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 20db63d1b..afcc54164 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -37,6 +37,7 @@ static NUMBERING_MODE_DEFAULT_WIDTH: usize = 5; static STRING_HEADER_OPTION: &str = "h"; static DOUBLE_SPACE_OPTION: &str = "d"; static NUMBERING_MODE_OPTION: &str = "n"; +static FIRST_LINE_NUMBER_OPTION: &str = "N"; static PAGE_RANGE_OPTION: &str = "pages"; static NO_HEADER_TRAILER_OPTION: &str = "t"; static PAGE_LENGTH_OPTION: &str = "l"; @@ -101,6 +102,7 @@ struct NumberingMode { /// Line numbering mode width: usize, separator: String, + first_number: usize, } impl Default for NumberingMode { @@ -108,6 +110,7 @@ impl Default for NumberingMode { NumberingMode { width: NUMBERING_MODE_DEFAULT_WIDTH, separator: NUMBERING_MODE_DEFAULT_SEPARATOR.to_string(), + first_number: 1, } } } @@ -189,7 +192,7 @@ pub fn uumain(args: Vec) -> i32 { opts.opt( NUMBERING_MODE_OPTION, - "--number-lines", + "number-lines", "Provide width digit line numbering. The default for width, if not specified, is 5. The number occupies the first width column positions of each text column or each line of -m output. If char (any nondigit character) is given, it is appended to the line number to separate it from whatever follows. The default @@ -199,6 +202,15 @@ pub fn uumain(args: Vec) -> i32 { Occur::Optional, ); + opts.opt( + FIRST_LINE_NUMBER_OPTION, + "first-line-number", + "start counting with NUMBER at 1st line of first page printed", + "NUMBER", + HasArg::Yes, + Occur::Optional, + ); + opts.opt( NO_HEADER_TRAILER_OPTION, "omit-header", @@ -279,12 +291,13 @@ pub fn uumain(args: Vec) -> i32 { if files.is_empty() { // -n value is optional if -n is given the opts gets confused if matches.opt_present(NUMBERING_MODE_OPTION) { - let is_afile = is_a_file(&matches, &mut files); - if is_afile.is_err() { - writeln!(&mut stderr(), "{}", is_afile.err().unwrap()); + let maybe_file = matches.opt_str(NUMBERING_MODE_OPTION).unwrap(); + let is_afile = is_a_file(&maybe_file); + if !is_afile { + writeln!(&mut stderr(), "{}", PrError::NotExists(maybe_file)); return 1; } else { - files.push(is_afile.unwrap()); + files.push(maybe_file); } } else { //For stdin @@ -320,12 +333,8 @@ pub fn uumain(args: Vec) -> i32 { return 0; } -fn is_a_file(matches: &Matches, files: &mut Vec) -> Result { - let could_be_file = matches.opt_str(NUMBERING_MODE_OPTION).unwrap(); - match File::open(&could_be_file) { - Ok(f) => Ok(could_be_file), - Err(e) => Err(PrError::NotExists(could_be_file)) - } +fn is_a_file(could_be_file: &String) -> bool { + File::open(could_be_file).is_ok() } fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { @@ -365,10 +374,39 @@ fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { fn build_options(matches: &Matches, path: &String) -> Result { let header: String = matches.opt_str(STRING_HEADER_OPTION).unwrap_or(path.to_string()); + + let default_first_number = NumberingMode::default().first_number; + let first_number = matches.opt_str(FIRST_LINE_NUMBER_OPTION).map(|n| { + n.parse::().unwrap_or(default_first_number) + }).unwrap_or(default_first_number); + let numbering_options: Option = matches.opt_str(NUMBERING_MODE_OPTION).map(|i| { + let parse_result = i.parse::(); + + let separator = if parse_result.is_err() { + if is_a_file(&i) { + NumberingMode::default().separator + } else { + i[0..1].to_string() + } + } else { + NumberingMode::default().separator + }; + + let width = if parse_result.is_err() { + if is_a_file(&i) { + NumberingMode::default().width + } else { + i[1..].parse::().unwrap_or(NumberingMode::default().width) + } + } else { + parse_result.unwrap() + }; + NumberingMode { - width: i.parse::().unwrap_or(NumberingMode::default().width), - separator: NumberingMode::default().separator, + width, + separator, + first_number, } }).or_else(|| { if matches.opt_present(NUMBERING_MODE_OPTION) { @@ -510,7 +548,11 @@ fn pr(path: &str, options: &OutputOptions) -> Result { let mut page: usize = 0; let mut buffered_content: Vec = Vec::new(); let read_lines_per_page = options.lines_to_read_for_page(); - let mut line_number = 0; + let mut line_number = options.as_ref() + .number + .as_ref() + .map(|i| i.first_number) + .unwrap_or(1) - 1; for line in BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?).lines() { if i == read_lines_per_page { page = page + 1; diff --git a/tests/fixtures/pr/test_num_page_char.log.expected b/tests/fixtures/pr/test_num_page_char.log.expected new file mode 100644 index 000000000..169dbd844 --- /dev/null +++ b/tests/fixtures/pr/test_num_page_char.log.expected @@ -0,0 +1,132 @@ + + +{last_modified_time} test_num_page.log Page 1 + + + 1cntation processAirPortStateChanges]: pppConnectionState 0 + 2cMon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 3cMon Dec 10 11:42:56.705 Info: 802.1X changed + 4cMon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 5cMon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 6cMon Dec 10 11:42:56.854 Info: 802.1X changed + 7cMon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 8cMon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 9cMon Dec 10 11:42:57.002 Info: 802.1X changed + 10cMon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 11cMon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 12cMon Dec 10 11:42:57.152 Info: 802.1X changed + 13cMon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 14cMon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 15cMon Dec 10 11:42:57.302 Info: 802.1X changed + 16cMon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 17cMon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 18cMon Dec 10 11:42:57.449 Info: 802.1X changed + 19cMon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 20cMon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 21cMon Dec 10 11:42:57.600 Info: 802.1X changed + 22cMon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 23cMon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 24cMon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 25cMon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 26cMon Dec 10 11:42:57.749 Info: 802.1X changed + 27cMon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 28cMon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 29cMon Dec 10 11:42:57.896 Info: 802.1X changed + 30cMon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 31cMon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 32cMon Dec 10 11:42:58.045 Info: 802.1X changed + 33cMon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 34cMon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 35cMon Dec 10 11:42:58.193 Info: 802.1X changed + 36cMon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 37cMon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 38cMon Dec 10 11:42:58.342 Info: 802.1X changed + 39cMon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 40cMon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 41cMon Dec 10 11:42:58.491 Info: 802.1X changed + 42cMon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 43cMon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 44cMon Dec 10 11:42:58.640 Info: 802.1X changed + 45cMon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 46cMon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 47cMon Dec 10 11:42:58.805 Info: 802.1X changed + 48cMon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 49cMon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 50cMon Dec 10 11:42:58.958 Info: 802.1X changed + 51cMon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 52cMon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 53cMon Dec 10 11:42:59.155 Info: 802.1X changed + 54cMon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 55cMon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 56cMon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + + + +{last_modified_time} test_num_page.log Page 2 + + + 57cntation processAirPortStateChanges]: pppConnectionState 0 + 58cMon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 59cMon Dec 10 11:42:56.705 Info: 802.1X changed + 60cMon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 61cMon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 62cMon Dec 10 11:42:56.854 Info: 802.1X changed + 63cMon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 64cMon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 65cMon Dec 10 11:42:57.002 Info: 802.1X changed + 66cMon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 67cMon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 68cMon Dec 10 11:42:57.152 Info: 802.1X changed + 69cMon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 70cMon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 71cMon Dec 10 11:42:57.302 Info: 802.1X changed + 72cMon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 73cMon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 74cMon Dec 10 11:42:57.449 Info: 802.1X changed + 75cMon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 76cMon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 77cMon Dec 10 11:42:57.600 Info: 802.1X changed + 78cMon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 79cMon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 80cMon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 81cMon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 82cMon Dec 10 11:42:57.749 Info: 802.1X changed + 83cMon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 84cMon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 85cMon Dec 10 11:42:57.896 Info: 802.1X changed + 86cMon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 87cMon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 88cMon Dec 10 11:42:58.045 Info: 802.1X changed + 89cMon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 90cMon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 91cMon Dec 10 11:42:58.193 Info: 802.1X changed + 92cMon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 93cMon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 94cMon Dec 10 11:42:58.342 Info: 802.1X changed + 95cMon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 96cMon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 97cMon Dec 10 11:42:58.491 Info: 802.1X changed + 98cMon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 99cMon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 100cMon Dec 10 11:42:58.640 Info: 802.1X changed + 101cMon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 102cMon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 103cMon Dec 10 11:42:58.805 Info: 802.1X changed + 104cMon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 105cMon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 106cMon Dec 10 11:42:58.958 Info: 802.1X changed + 107cMon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 108cMon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 109cMon Dec 10 11:42:59.155 Info: 802.1X changed + 110cMon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 111cMon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 112cMon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + diff --git a/tests/fixtures/pr/test_num_page_char_one.log.expected b/tests/fixtures/pr/test_num_page_char_one.log.expected new file mode 100644 index 000000000..dd7813192 --- /dev/null +++ b/tests/fixtures/pr/test_num_page_char_one.log.expected @@ -0,0 +1,132 @@ + + +{last_modified_time} test_num_page.log Page 1 + + +1cntation processAirPortStateChanges]: pppConnectionState 0 +2cMon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +3cMon Dec 10 11:42:56.705 Info: 802.1X changed +4cMon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +5cMon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +6cMon Dec 10 11:42:56.854 Info: 802.1X changed +7cMon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +8cMon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +9cMon Dec 10 11:42:57.002 Info: 802.1X changed +0cMon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +1cMon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +2cMon Dec 10 11:42:57.152 Info: 802.1X changed +3cMon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +4cMon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +5cMon Dec 10 11:42:57.302 Info: 802.1X changed +6cMon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +7cMon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +8cMon Dec 10 11:42:57.449 Info: 802.1X changed +9cMon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +0cMon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +1cMon Dec 10 11:42:57.600 Info: 802.1X changed +2cMon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +3cMon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +4cMon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +5cMon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +6cMon Dec 10 11:42:57.749 Info: 802.1X changed +7cMon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +8cMon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +9cMon Dec 10 11:42:57.896 Info: 802.1X changed +0cMon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +1cMon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +2cMon Dec 10 11:42:58.045 Info: 802.1X changed +3cMon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +4cMon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +5cMon Dec 10 11:42:58.193 Info: 802.1X changed +6cMon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +7cMon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +8cMon Dec 10 11:42:58.342 Info: 802.1X changed +9cMon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +0cMon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +1cMon Dec 10 11:42:58.491 Info: 802.1X changed +2cMon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +3cMon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +4cMon Dec 10 11:42:58.640 Info: 802.1X changed +5cMon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +6cMon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +7cMon Dec 10 11:42:58.805 Info: 802.1X changed +8cMon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +9cMon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +0cMon Dec 10 11:42:58.958 Info: 802.1X changed +1cMon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +2cMon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +3cMon Dec 10 11:42:59.155 Info: 802.1X changed +4cMon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +5cMon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +6cMon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + + + +{last_modified_time} test_num_page.log Page 2 + + +7cntation processAirPortStateChanges]: pppConnectionState 0 +8cMon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +9cMon Dec 10 11:42:56.705 Info: 802.1X changed +0cMon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +1cMon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +2cMon Dec 10 11:42:56.854 Info: 802.1X changed +3cMon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +4cMon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +5cMon Dec 10 11:42:57.002 Info: 802.1X changed +6cMon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +7cMon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +8cMon Dec 10 11:42:57.152 Info: 802.1X changed +9cMon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +0cMon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +1cMon Dec 10 11:42:57.302 Info: 802.1X changed +2cMon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +3cMon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +4cMon Dec 10 11:42:57.449 Info: 802.1X changed +5cMon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +6cMon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +7cMon Dec 10 11:42:57.600 Info: 802.1X changed +8cMon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +9cMon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +0cMon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +1cMon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +2cMon Dec 10 11:42:57.749 Info: 802.1X changed +3cMon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +4cMon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +5cMon Dec 10 11:42:57.896 Info: 802.1X changed +6cMon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +7cMon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +8cMon Dec 10 11:42:58.045 Info: 802.1X changed +9cMon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +0cMon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +1cMon Dec 10 11:42:58.193 Info: 802.1X changed +2cMon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +3cMon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +4cMon Dec 10 11:42:58.342 Info: 802.1X changed +5cMon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +6cMon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +7cMon Dec 10 11:42:58.491 Info: 802.1X changed +8cMon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +9cMon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +0cMon Dec 10 11:42:58.640 Info: 802.1X changed +1cMon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +2cMon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +3cMon Dec 10 11:42:58.805 Info: 802.1X changed +4cMon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +5cMon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +6cMon Dec 10 11:42:58.958 Info: 802.1X changed +7cMon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +8cMon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +9cMon Dec 10 11:42:59.155 Info: 802.1X changed +0cMon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +1cMon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +2cMon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + diff --git a/tests/fixtures/pr/test_one_page_first_line.log.expected b/tests/fixtures/pr/test_one_page_first_line.log.expected new file mode 100644 index 000000000..303f01c73 --- /dev/null +++ b/tests/fixtures/pr/test_one_page_first_line.log.expected @@ -0,0 +1,66 @@ + + +{last_modified_time} test_one_page.log Page 1 + + + 5 ntation processAirPortStateChanges]: pppConnectionState 0 + 6 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 7 Mon Dec 10 11:42:56.705 Info: 802.1X changed + 8 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 9 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 10 Mon Dec 10 11:42:56.854 Info: 802.1X changed + 11 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 12 Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 13 Mon Dec 10 11:42:57.002 Info: 802.1X changed + 14 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 15 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 16 Mon Dec 10 11:42:57.152 Info: 802.1X changed + 17 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 18 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 19 Mon Dec 10 11:42:57.302 Info: 802.1X changed + 20 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 21 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 22 Mon Dec 10 11:42:57.449 Info: 802.1X changed + 23 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 24 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 25 Mon Dec 10 11:42:57.600 Info: 802.1X changed + 26 Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 27 Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 28 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 29 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 30 Mon Dec 10 11:42:57.749 Info: 802.1X changed + 31 Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 32 Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 33 Mon Dec 10 11:42:57.896 Info: 802.1X changed + 34 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 35 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 36 Mon Dec 10 11:42:58.045 Info: 802.1X changed + 37 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 38 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 39 Mon Dec 10 11:42:58.193 Info: 802.1X changed + 40 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 41 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 42 Mon Dec 10 11:42:58.342 Info: 802.1X changed + 43 Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 44 Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 45 Mon Dec 10 11:42:58.491 Info: 802.1X changed + 46 Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 47 Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 48 Mon Dec 10 11:42:58.640 Info: 802.1X changed + 49 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 50 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 51 Mon Dec 10 11:42:58.805 Info: 802.1X changed + 52 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 53 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 54 Mon Dec 10 11:42:58.958 Info: 802.1X changed + 55 Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 56 Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 57 Mon Dec 10 11:42:59.155 Info: 802.1X changed + 58 Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 59 Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 60 Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + diff --git a/tests/test_pr.rs b/tests/test_pr.rs index bb068181d..fb4523c0c 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -123,4 +123,60 @@ fn test_with_long_double_space_option() { .stdout_is_templated_fixture(expected_test_file_path, vec![ ("{last_modified_time}".to_string(), value), ]); +} + +#[test] +fn test_with_first_line_number_option() { + let test_file_path = "test_one_page.log"; + let expected_test_file_path = "test_one_page_first_line.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["-N", "5", "-n", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + ("{last_modified_time}".to_string(), value), + ]); +} + +#[test] +fn test_with_first_line_number_long_option() { + let test_file_path = "test_one_page.log"; + let expected_test_file_path = "test_one_page_first_line.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["--first-line-number=5", "-n", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + ("{last_modified_time}".to_string(), value), + ]); +} + +#[test] +fn test_with_number_option_with_custom_separator_char() { + let test_file_path = "test_num_page.log"; + let expected_test_file_path = "test_num_page_char.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["-nc", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + ("{last_modified_time}".to_string(), value), + ]); +} + +#[test] +fn test_with_number_option_with_custom_separator_char_and_width() { + let test_file_path = "test_num_page.log"; + let expected_test_file_path = "test_num_page_char_one.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["-nc1", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + ("{last_modified_time}".to_string(), value), + ]); } \ No newline at end of file From b742230dbbd32115c4f3aabf753f41383b56f6e3 Mon Sep 17 00:00:00 2001 From: Tilak Patidar Date: Sun, 16 Dec 2018 21:36:42 +0530 Subject: [PATCH 0149/1135] pr: fix page ranges pr: Fix page ranges --- src/pr/pr.rs | 68 +- tests/common/util.rs | 4 +- tests/fixtures/pr/test.log | 1000 +++++++++++++++++ .../pr/test_page_range_1.log.expected | 264 +++++ .../pr/test_page_range_2.log.expected | 200 ++++ tests/test_pr.rs | 82 +- 6 files changed, 1584 insertions(+), 34 deletions(-) create mode 100644 tests/fixtures/pr/test.log create mode 100644 tests/fixtures/pr/test_page_range_1.log.expected create mode 100644 tests/fixtures/pr/test_page_range_2.log.expected diff --git a/src/pr/pr.rs b/src/pr/pr.rs index afcc54164..08681c0de 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -26,6 +26,7 @@ use quick_error::ResultExt; use std::convert::From; use getopts::HasArg; use getopts::Occur; +use std::num::ParseIntError; static NAME: &str = "pr"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -73,6 +74,13 @@ struct ColumnModeOptions { column_separator: String, } +#[derive(PartialEq, Eq)] +enum PrintPageCommand { + Skip, + Abort, + Print, +} + impl AsRef for OutputOptions { fn as_ref(&self) -> &OutputOptions { self @@ -429,26 +437,37 @@ fn build_options(matches: &Matches, path: &String) -> Result| { + let unparsed_value = matches.opt_str(PAGE_RANGE_OPTION).unwrap(); + match i { + Ok(val) => Ok(val), + Err(_e) => Err(PrError::EncounteredErrors(format!("invalid --pages argument '{}'", unparsed_value))) + } + }; + let start_page = match matches.opt_str(PAGE_RANGE_OPTION).map(|i| { let x: Vec<&str> = i.split(":").collect(); x[0].parse::() - }) { - Some(res) => Some(res?), - _ => None - }; + }).map(invalid_pages_map) + { + Some(res) => Some(res?), + _ => None + }; let end_page = match matches.opt_str(PAGE_RANGE_OPTION) .filter(|i| i.contains(":")) .map(|i| { let x: Vec<&str> = i.split(":").collect(); x[1].parse::() - }) { - Some(res) => Some(res?), - _ => None - }; + }) + .map(invalid_pages_map) + { + Some(res) => Some(res?), + _ => None + }; if start_page.is_some() && end_page.is_some() && start_page.unwrap() > end_page.unwrap() { - return Err(PrError::EncounteredErrors(format!("invalid page range ‘{}:{}’", start_page.unwrap(), end_page.unwrap()))); + return Err(PrError::EncounteredErrors(format!("invalid --pages argument '{}:{}'", start_page.unwrap(), end_page.unwrap()))); } let page_length = match matches.opt_str(PAGE_LENGTH_OPTION).map(|i| { @@ -548,6 +567,8 @@ fn pr(path: &str, options: &OutputOptions) -> Result { let mut page: usize = 0; let mut buffered_content: Vec = Vec::new(); let read_lines_per_page = options.lines_to_read_for_page(); + let start_page = options.as_ref().start_page.as_ref(); + let last_page = options.as_ref().end_page.as_ref(); let mut line_number = options.as_ref() .number .as_ref() @@ -557,11 +578,14 @@ fn pr(path: &str, options: &OutputOptions) -> Result { if i == read_lines_per_page { page = page + 1; i = 0; - if !_is_within_page_range(options, &page) { + + let cmd = _get_print_command(start_page, last_page, &page); + if cmd == PrintPageCommand::Print { + line_number += print_page(&buffered_content, options, &page, &line_number)?; + buffered_content = Vec::new(); + } else if cmd == PrintPageCommand::Abort { return Ok(0); } - line_number += print_page(&buffered_content, options, &page, &line_number)?; - buffered_content = Vec::new(); } buffered_content.push(line?); i = i + 1; @@ -569,19 +593,27 @@ fn pr(path: &str, options: &OutputOptions) -> Result { if i != 0 { page = page + 1; - if !_is_within_page_range(options, &page) { + let cmd = _get_print_command(start_page, last_page, &page); + if cmd == PrintPageCommand::Print { + print_page(&buffered_content, options, &page, &line_number)?; + } else if cmd == PrintPageCommand::Abort { return Ok(0); } - print_page(&buffered_content, options, &page, &line_number)?; } return Ok(0); } -fn _is_within_page_range(options: &OutputOptions, page: &usize) -> bool { - let start_page = options.as_ref().start_page.as_ref(); - let last_page = options.as_ref().end_page.as_ref(); - (start_page.is_none() || page >= start_page.unwrap()) && (last_page.is_none() || page <= last_page.unwrap()) +fn _get_print_command(start_page: Option<&usize>, last_page: Option<&usize>, page: &usize) -> PrintPageCommand { + let below_page_range = start_page.is_some() && page < start_page.unwrap(); + let is_within_page_range = (start_page.is_none() || page >= start_page.unwrap()) + && (last_page.is_none() || page <= last_page.unwrap()); + if below_page_range { + return PrintPageCommand::Skip; + } else if is_within_page_range { + return PrintPageCommand::Print; + } + return PrintPageCommand::Abort; } fn print_page(lines: &Vec, options: &OutputOptions, page: &usize, line_number: &usize) -> Result { diff --git a/tests/common/util.rs b/tests/common/util.rs index 90b518619..4f0178a39 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -129,10 +129,10 @@ impl CmdResult { } /// like stdout_is_fixture(...), but replaces the data in fixture file based on values provided in template_vars /// command output - pub fn stdout_is_templated_fixture>(&self, file_rel_path: T, template_vars: Vec<(String, String)>) -> Box<&CmdResult> { + pub fn stdout_is_templated_fixture>(&self, file_rel_path: T, template_vars: Vec<(&String, &String)>) -> Box<&CmdResult> { let mut contents = read_scenario_fixture(&self.tmpd, file_rel_path); for kv in template_vars { - contents = contents.replace(&kv.0, &kv.1); + contents = contents.replace(kv.0, kv.1); } self.stdout_is(contents) } diff --git a/tests/fixtures/pr/test.log b/tests/fixtures/pr/test.log new file mode 100644 index 000000000..53aaa0151 --- /dev/null +++ b/tests/fixtures/pr/test.log @@ -0,0 +1,1000 @@ +ntation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.705 Info: 802.1X changed +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.854 Info: 802.1X changed +Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.002 Info: 802.1X changed +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.152 Info: 802.1X changed +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.302 Info: 802.1X changed +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.449 Info: 802.1X changed +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.600 Info: 802.1X changed +Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.749 Info: 802.1X changed +Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.896 Info: 802.1X changed +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.045 Info: 802.1X changed +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.193 Info: 802.1X changed +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.342 Info: 802.1X changed +Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.491 Info: 802.1X changed +Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.640 Info: 802.1X changed +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.805 Info: 802.1X changed +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.958 Info: 802.1X changed +Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.155 Info: 802.1X changed +Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.352 Info: 802.1X changed +Mon Dec 10 11:42:59.354 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.354 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.372 Driver Event: _bsd_80211_event_callback: APPLE80211_M_ROAM_END (en0) +Mon Dec 10 11:42:59.372 Info: Roaming ended on interface en0 +Mon Dec 10 11:42:59.372 Driver Event: _bsd_80211_event_callback: RSN_HANDSHAKE_DONE (en0) +Mon Dec 10 11:42:59.373 Info: -[CWXPCInterfaceContext setRoamInProgress:reason:]_block_invoke: roam status metric data: CWAWDMetricRoamStatus: status:0 security: 4 profile:5 origin:<34fcb9>(-69) target:<6cf37f>(-56) latency:6.083439s +Mon Dec 10 11:42:59.373 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90046 +Mon Dec 10 11:42:59.373 Info: RESUME AWDL for interface en0, reason=Roam token=2685 +Mon Dec 10 11:42:59.373 Info: PRIORITY LOCK REMOVED [client=airportd, type=4, interface=en0, priority=5] +Mon Dec 10 11:42:59.374 Info: -[CWXPCInterfaceContext __setAWDLOperatingMode:interface:error:]: attempting to set AWDL mode to 0 +Mon Dec 10 11:43:01.072 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Service/18E14EA7-4641-4104-B315-A9315814912A/DHCP' +Mon Dec 10 11:43:01.072 SC: _processDHCPChanges: State:/Network/Service/18E14EA7-4641-4104-B315-A9315814912A/DHCP +Mon Dec 10 11:43:01.072 SC: _processDHCPChanges: DHCP airport_changed = 1 +Mon Dec 10 11:43:01.073 Info: -[CWXPCSubsystem internal_submitIPConfigLatencyMetric:leaseDuration:]: IPConfig Latency metric data: CWAWDMetricIPConfigLatencyData: DHCP latency: 29010 msecs, duration: 480 mins, security: 4 +Mon Dec 10 11:43:01.073 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90007 +Mon Dec 10 11:43:01.073 SC: _setDHCPMessage: dhcpInfoKey "State:/Network/Interface/en0/AirPort/DHCP Message" = (null) +Mon Dec 10 11:43:10.369 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 11:43:10.369 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=162 Mbps +Mon Dec 10 11:43:10.369 Info: link quality changed +Mon Dec 10 11:43:23.376 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 11:43:23.377 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=243 Mbps +Mon Dec 10 11:43:23.377 Info: link quality changed +Mon Dec 10 11:43:28.380 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 11:43:28.380 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=216 Mbps +Mon Dec 10 11:43:28.380 Info: link quality changed +Mon Dec 10 11:43:31.744 AutoJoin: BACKGROUND SCAN request on interface en0 with SSID list (null) +Mon Dec 10 11:43:31.747 Scan: Cache-assisted scan request on channel 1 does not require a live scan +Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 2 does not require a live scan +Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 3 does not require a live scan +Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 11:43:31.748 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 11:43:31.748 [channelNumber=1(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.748 [channelNumber=2(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.748 [channelNumber=3(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 11:43:31.748 )} took 0.0025 seconds, returned 10 results +Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 4 does not require a live scan +Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 5 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 6 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 11:43:31.749 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 11:43:31.749 [channelNumber=4(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.749 [channelNumber=5(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.749 [channelNumber=6(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 11:43:31.749 )} took 0.0008 seconds, returned 7 results +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 7 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 8 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 9 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 11:43:31.749 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 11:43:31.749 [channelNumber=7(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.749 [channelNumber=8(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.749 [channelNumber=9(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 11:43:31.749 )} took 0.0002 seconds, returned 1 results +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 10 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 11 does not require a live scan +Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 12 does not require a live scan +Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 11:43:31.750 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 11:43:31.750 [channelNumber=10(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.750 [channelNumber=11(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.750 [channelNumber=12(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 11:43:31.750 )} took 0.0004 seconds, returned 4 results +Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 13 does not require a live scan +Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 36 does not require a live scan +Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 40 does not require a live scan +Mon Dec 10 11:43:31.751 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 11:43:31.751 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 11:43:31.751 [channelNumber=13(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.751 [channelNumber=36(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 11:43:31.751 [channelNumber=40(5GHz), channelWidth={40MHz(-1)}, active] +Mon Dec 10 11:43:31.751 )} took 0.0009 seconds, returned 9 results +Mon Dec 10 11:43:31.751 Scan: Cache-assisted scan request on channel 44 does not require a live scan +Mon Dec 10 11:43:31.751 Scan: Cache-assisted scan request on channel 48 does not require a live scan +Mon Dec 10 11:43:31.751 Scan: Cache-assisted scan request on channel 149 does not require a live scan +Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 11:43:31.752 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 11:43:31.752 [channelNumber=44(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 11:43:31.752 [channelNumber=48(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 11:43:31.752 [channelNumber=149(5GHz), channelWidth={20MHz}, active] +Mon Dec 10 11:43:31.752 )} took 0.0010 seconds, returned 9 results +Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request on channel 153 does not require a live scan +Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request on channel 157 does not require a live scan +Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request on channel 161 does not require a live scan +Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 11:43:31.753 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 11:43:31.753 [channelNumber=153(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 11:43:31.753 [channelNumber=157(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.753 [channelNumber=161(5GHz), channelWidth={40MHz(-1)}, active] +Mon Dec 10 11:43:31.753 )} took 0.0007 seconds, returned 9 results +Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 165 does not require a live scan +Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 52 does not require a live scan +Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 56 does not require a live scan +Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 11:43:31.753 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 11:43:31.753 [channelNumber=165(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.753 [channelNumber=52(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 11:43:31.753 [channelNumber=56(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 11:43:31.753 )} took 0.0005 seconds, returned 6 results +Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 60 does not require a live scan +Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 64 does not require a live scan +Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 11:43:31.753 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 11:43:31.754 [channelNumber=60(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 11:43:31.754 [channelNumber=64(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 11:43:31.754 )} took 0.0003 seconds, returned 4 results +Mon Dec 10 11:43:42.382 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 11:43:42.382 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=270 Mbps +Mon Dec 10 11:43:42.383 Info: link quality changed +Mon Dec 10 11:49:12.347 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 11:49:12.350 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 11:52:32.194 Info: SCAN request received from pid 92 (locationd) with priority 2 +Mon Dec 10 11:52:32.448 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 11:52:32.450 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 11:52:32.451 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 11:52:32.451 [channelNumber=1(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:52:32.451 [channelNumber=2(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:52:32.451 [channelNumber=3(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:52:32.451 [channelNumber=4(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:52:32.451 [channelNumber=5(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:52:32.451 [channelNumber=6(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 11:52:32.451 )} took 0.2566 seconds, returned 10 results +Mon Dec 10 11:52:32.451 Info: scan cache updated +Mon Dec 10 11:52:32.712 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 11:52:32.715 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 11:52:32.715 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 11:52:32.715 [channelNumber=7(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:52:32.715 [channelNumber=8(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:52:32.715 [channelNumber=9(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:52:32.715 [channelNumber=10(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:52:32.715 [channelNumber=11(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:52:32.715 [channelNumber=12(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 11:52:32.715 )} took 0.2636 seconds, returned 10 results +Mon Dec 10 11:52:32.994 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 11:52:32.997 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 11:52:32.998 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 11:52:32.998 [channelNumber=13(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:52:32.998 [channelNumber=36(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 11:52:32.998 [channelNumber=40(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 11:52:32.998 [channelNumber=44(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 11:52:32.998 [channelNumber=48(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 11:52:32.998 [channelNumber=149(5GHz), channelWidth={20MHz}, active] +Mon Dec 10 11:52:32.998 )} took 0.2822 seconds, returned 14 results +Mon Dec 10 11:52:33.405 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 11:52:33.408 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 11:52:33.409 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 11:52:33.409 [channelNumber=153(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 11:52:33.409 [channelNumber=157(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:52:33.409 [channelNumber=161(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 11:52:33.409 [channelNumber=165(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:52:33.409 [channelNumber=52(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 11:52:33.409 [channelNumber=56(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 11:52:33.409 )} took 0.4099 seconds, returned 11 results +Mon Dec 10 11:52:33.669 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 11:52:33.672 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 11:52:33.672 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 11:52:33.672 [channelNumber=60(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 11:52:33.672 [channelNumber=64(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 11:52:33.672 )} took 0.2625 seconds, returned 8 results +Mon Dec 10 11:52:33.673 Info: scan cache updated +Mon Dec 10 11:52:33.693 Info: SCAN request received from pid 92 (locationd) with priority 2 +Mon Dec 10 11:52:33.693 Scan: locationd requested a live scan less than 10 seconds after previous request (1.4991s) returning cached scan results +Mon Dec 10 11:52:33.728 Info: SCAN request received from pid 92 (locationd) with priority 2 +Mon Dec 10 11:52:33.728 Scan: locationd requested a live scan less than 10 seconds after previous request (1.5339s) returning cached scan results +Mon Dec 10 11:55:47.609 Driver Discovery: _PMConnectionHandler: caps = CPU Net Disk +Mon Dec 10 11:55:47.609 Driver Discovery: _PMConnectionHandler: Being put into maintenance wake mode while fully awake. +Mon Dec 10 11:55:47.610 Info: psCallback: powerSource = AC Power +Mon Dec 10 11:55:47.610 Info: psCallback: set powersave disabled on en0 +Mon Dec 10 11:55:47.637 Info: RELINQUISH BT PAGING LOCK request received from pid 106 (bluetoothd) +Mon Dec 10 11:55:47.637 Info: RELINQUISH BT PAGING LOCK request received from pid 106 (bluetoothd) +Mon Dec 10 11:55:47.638 BTC: BT PAGING state already set to 0 +Mon Dec 10 11:55:47.638 BTC: BT PAGING state already set to 0 +Mon Dec 10 11:55:47.638 Info: BT PAGING LOCK RELINQUISHED after 0.0 seconds +Mon Dec 10 11:55:47.638 Info: BT PAGING LOCK RELINQUISHED after 0.0 seconds +Mon Dec 10 11:55:47.638 Info: BT PAGING LOCK RELINQUISHED, re-enabling deferred WiFi requests +Mon Dec 10 11:55:47.638 Info: BT PAGING LOCK RELINQUISHED, re-enabling deferred WiFi requests +Mon Dec 10 11:55:48.093 IPC: ADDED XPC CLIENT CONNECTION [loginwindow (pid=101, euid=1651299376, egid=604256670)] +Mon Dec 10 11:55:48.093 Info: START MONITORING EVENT request received from pid 101 (loginwindow) +Mon Dec 10 11:55:48.093 Info: START MONITORING EVENT request received from pid 101 (loginwindow) +Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) +Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) +Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) +Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) +Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) +Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) +Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) +Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) +Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) +Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) +Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) +Mon Dec 10 11:55:48.105 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) +Mon Dec 10 11:56:07.629 Driver Discovery: _PMConnectionHandler: caps = +Mon Dec 10 11:56:07.629 AutoJoin: BEST CONNECTED SCAN CANCELLED on interface en0 +Mon Dec 10 11:56:07.629 AutoJoin: BACKGROUND SCAN CANCELLED on interface en0 +Mon Dec 10 11:56:07.629 AutoJoin: Auto-join retry cancelled on interface en0 +Mon Dec 10 11:56:07.629 Offload: _tcpKeepAliveActive: TCP keep-alive is active. +Mon Dec 10 11:56:07.637 P2P: _changeInterfaceFlags: Marking p2p0 down +Mon Dec 10 11:56:07.637 Info: SleepAcknowledgementCheckForHostAP: Checking sleep readiness for HostAP +Mon Dec 10 11:56:07.637 SleepAcknowledgementCheck: Checking sleep readiness +Mon Dec 10 11:56:07.637 SleepAcknowledgementCheck: Delaying sleep acknowledgement because of VifUp +Mon Dec 10 11:56:07.638 _interfaceFlagsChanged: KEV_DL_SIFFLAGS received for p2p0 [flags=0xffff8802 (down)]. +Mon Dec 10 11:56:07.638 _interfaceFlagsChanged: Flags changed for p2p0 (0xffff8843 -> 0xffff8802) (down). +Mon Dec 10 11:56:07.638 P2P: _deviceInterfaceMarkedDown: p2p0 marked down +Mon Dec 10 11:56:07.638 P2P: _removeTimeoutForActionAndParam: Attempting to remove 'Stop GO' action (param = 0x0) +Mon Dec 10 11:56:07.638 P2P: _removeTimeoutForActionAndParam: Attempting to remove 'Scan' action (param = 0x0) +Mon Dec 10 11:56:07.638 P2P: _p2pSupervisorEventRunLoopCallback: Mark down complete for p2p0 +Mon Dec 10 11:56:07.638 SleepAcknowledgementCheck: Checking sleep readiness +Mon Dec 10 11:56:07.638 WoW: SleepAcknowledgementCheck: Checking if auto-join is in progress before sleep acknowledgement +Mon Dec 10 11:56:07.638 WoW: SleepAcknowledgementDelayForAutoJoinAttempt_block_invoke: AUTO-JOIN attempt complete for en0, re-checking sleep readiness +Mon Dec 10 11:56:07.638 SleepAcknowledgementCheck: Checking sleep readiness +Mon Dec 10 11:56:07.639 WoW: _wowEnabled: WoW is active on en0 +Mon Dec 10 11:56:07.639 WoW: wowExchangeRequiredForNode: WoW exchange not required for en0 +Mon Dec 10 11:56:07.639 _acknowledgeSleepEvent: Acknowledging sleep event +Mon Dec 10 11:56:07.639 Info: PRIORITY LOCK ADDED [client=airportd, type=4, interface=(null), priority=7] +Mon Dec 10 11:56:07.640 AutoJoin: Auto-join retry cancelled on interface en0 +Mon Dec 10 11:56:07.640 Info: -[CWXPCSubsystem resetAutoJoinDisableState]_block_invoke: Auto-join disabled state reset +Mon Dec 10 11:56:17.640 Info: PRIORITY LOCK REMOVED [client=airportd, type=4, interface=(null), priority=7] +Mon Dec 10 12:04:46.023 Driver Discovery: _PMConnectionHandler: caps = CPU Net Disk Early +Mon Dec 10 12:04:46.023 Info: _systemWokenByWiFi: System wake reason: , was not woken by WiFi +Mon Dec 10 12:04:46.023 Info: _updateWakeLimitCounters: TCP keep alive timed out 0 times on awdl0 +Mon Dec 10 12:04:46.023 Info: _systemWokenByWiFi: System wake reason: , was not woken by WiFi +Mon Dec 10 12:04:46.023 Info: _updateWakeLimitCounters: TCP keep alive timed out 0 times on p2p0 +Mon Dec 10 12:04:46.023 Info: _systemWokenByWiFi: System wake reason: , was not woken by WiFi +Mon Dec 10 12:04:46.023 Info: _updateWakeLimitCounters: TCP keep alive timed out 0 times on en0 +Mon Dec 10 12:04:46.023 Driver Discovery: _PMConnectionHandler: DARK WAKE with maintenance SSID, performing maintenance wake auto-join for interface en0 +Mon Dec 10 12:04:46.023 AutoJoin: AUTO-JOIN trigger requested (Maintenance Wake) +Mon Dec 10 12:04:46.026 Info: psCallback: powerSource = AC Power +Mon Dec 10 12:04:46.026 Info: psCallback: set powersave disabled on en0 +Mon Dec 10 12:04:46.331 BTC: BluetoothCoexStatusMonitoringCallback: Bluetooth Status Notification +Mon Dec 10 12:04:46.331 BTC: BluetoothCoexStatusNotificationProcess: BT: ON, Num HID Devices is <0>, Num SCO Devices is <0>, Num A2DP Devices is <0>, Bluetooth Bandwidth Utilization is <3>, LWM <5>, HWM <26> +Mon Dec 10 12:04:46.332 Driver Event: _bsd_80211_event_callback: AWDL_REALTIME_MODE_END (awdl0) +Mon Dec 10 12:04:46.332 BTC: __BluetoothCoexHandleUpdateForNode: Handle Bluetooth Coex: FrequencyBand <2>, Bluetooth Bandwidth Utilization <3>, Clamshell Mode <0> +Mon Dec 10 12:04:46.332 Info: AWDL real time mode ended +Mon Dec 10 12:04:46.332 BTC: BluetoothCoexSetProfile: profile for band 2.4GHz didn't change +Mon Dec 10 12:04:46.332 BTC: BluetoothCoexSetProfile: profile for band 5GHz didn't change +Mon Dec 10 12:04:46.332 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: band = 0x2 +Mon Dec 10 12:04:46.332 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: hosting AP = NO, assoc as STA = YES, assoced in 2.4GHz = NO +Mon Dec 10 12:04:46.332 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: band = 2 +Mon Dec 10 12:04:46.332 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 12:04:46.332 BTC: BluetoothCoexGetCurrentBssidPhyMode: Bluetooth Coex: Active PHY Mode 16. PHY Mode +Mon Dec 10 12:04:46.332 {type = mutable dict, count = 2, +Mon Dec 10 12:04:46.332 entries => +Mon Dec 10 12:04:46.332 0 : {contents = "PHYMODE_ACTIVE"} = {value = +16, type = kCFNumberSInt32Type} +Mon Dec 10 12:04:46.332 1 : {contents = "PHYMODE_SUPPORTED"} = {value = +159, type = kCFNumberSInt32Type} +Mon Dec 10 12:04:46.332 } +Mon Dec 10 12:04:46.332 +Mon Dec 10 12:04:46.332 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: PHY mode: <10> 5GHz: YES +Mon Dec 10 12:04:46.332 BTC: BluetoothCoexHandle_ReconfigureAntennas: MCS index set size = 16, NSS = 2SS, need to re-assoc = YES +Mon Dec 10 12:04:46.333 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: 11bg only = NO, BT on = YES, # HIDs = 0, # A2DP = 0, # SCO = 0, fallback = normal -> Middle Chain is ON +Mon Dec 10 12:04:46.333 BTC: BluetoothCoexSettingPerChainPower: Chain Power Setting does not need to be updated +Mon Dec 10 12:04:46.333 AutoJoin: user: patidar +Mon Dec 10 12:04:46.333 BTC: BluetoothCoexHandle_ReconfigureAntennas: Skipping REASSOC - The # of chains did not change. +Mon Dec 10 12:04:46.333 Driver Event: _bsd_80211_event_callback: AWDL_REALTIME_MODE_END (awdl0) +Mon Dec 10 12:04:46.333 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 12:04:46.333 BTC: __BluetoothCoexHandleUpdateForNode: Handle Bluetooth Coex: FrequencyBand <2>, Bluetooth Bandwidth Utilization <3>, Clamshell Mode <0> +Mon Dec 10 12:04:46.333 Info: AWDL real time mode ended +Mon Dec 10 12:04:46.333 BTC: BluetoothCoexSetProfile: profile for band 2.4GHz didn't change +Mon Dec 10 12:04:46.333 BTC: BluetoothCoexSetProfile: profile for band 5GHz didn't change +Mon Dec 10 12:04:46.333 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: band = 0x2 +Mon Dec 10 12:04:46.333 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: hosting AP = NO, assoc as STA = YES, assoced in 2.4GHz = NO +Mon Dec 10 12:04:46.333 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 12:04:46.333 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: band = 2 +Mon Dec 10 12:04:46.333 BTC: BluetoothCoexGetCurrentBssidPhyMode: Bluetooth Coex: Active PHY Mode 16. PHY Mode +Mon Dec 10 12:04:46.333 {type = mutable dict, count = 2, +Mon Dec 10 12:04:46.333 entries => +Mon Dec 10 12:04:46.333 0 : {contents = "PHYMODE_ACTIVE"} = {value = +16, type = kCFNumberSInt32Type} +Mon Dec 10 12:04:46.333 1 : {contents = "PHYMODE_SUPPORTED"} = {value = +159, type = kCFNumberSInt32Type} +Mon Dec 10 12:04:46.333 } +Mon Dec 10 12:04:46.333 +Mon Dec 10 12:04:46.333 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: PHY mode: <10> 5GHz: YES +Mon Dec 10 12:04:46.333 BTC: BluetoothCoexHandle_ReconfigureAntennas: MCS index set size = 16, NSS = 2SS, need to re-assoc = YES +Mon Dec 10 12:04:46.333 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: 11bg only = NO, BT on = YES, # HIDs = 0, # A2DP = 0, # SCO = 0, fallback = normal -> Middle Chain is ON +Mon Dec 10 12:04:46.334 Info: SCAN request received from pid 92 (locationd) with priority 2 +Mon Dec 10 12:04:46.334 BTC: BluetoothCoexSettingPerChainPower: Chain Power Setting does not need to be updated +Mon Dec 10 12:04:46.334 BTC: BluetoothCoexHandle_ReconfigureAntennas: Skipping REASSOC - The # of chains did not change. +Mon Dec 10 12:04:46.334 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 12:04:46.334 Driver Event: _bsd_80211_event_callback: AWDL_SYNC_STATE_CHANGED (awdl0) +Mon Dec 10 12:04:46.334 Info: -[CWXPCSubsystem clearScanCacheWithInterfaceName:connection:error:]: Clearing scan cache for interface en0 +Mon Dec 10 12:04:46.334 Info: -[CWXPCSubsystem clearScanCacheWithInterfaceName:connection:error:]: Clearing family+driver scan cache for interface en0 +Mon Dec 10 12:04:46.334 AutoJoin: AUTO-JOIN STARTED for interface en0 (Maintenance Wake) +Mon Dec 10 12:04:46.334 Info: PRIORITY LOCK ADDED [client=airportd, type=4, interface=en0, priority=7] +Mon Dec 10 12:04:46.334 AutoJoin: NOT RECOVERY MODE => continuing +Mon Dec 10 12:04:46.334 Info: scan cache updated +Mon Dec 10 12:04:46.335 AutoJoin: NOT LOGINWINDOW MODE 802.1X => continuing +Mon Dec 10 12:04:46.335 BTC: __BluetoothCoexHandleUpdateForNode: Handle Bluetooth Coex: FrequencyBand <2>, Bluetooth Bandwidth Utilization <3>, Clamshell Mode <0> +Mon Dec 10 12:04:46.335 BTC: BluetoothCoexSetProfile: profile for band 2.4GHz didn't change +Mon Dec 10 12:04:46.335 BTC: BluetoothCoexSetProfile: profile for band 5GHz didn't change +Mon Dec 10 12:04:46.335 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: band = 0x2 +Mon Dec 10 12:04:46.335 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: hosting AP = NO, assoc as STA = YES, assoced in 2.4GHz = NO +Mon Dec 10 12:04:46.336 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: band = 2 +Mon Dec 10 12:04:46.336 BTC: BluetoothCoexGetCurrentBssidPhyMode: Bluetooth Coex: Active PHY Mode 16. PHY Mode +Mon Dec 10 12:04:46.336 {type = mutable dict, count = 2, +Mon Dec 10 12:04:46.336 entries => +Mon Dec 10 12:04:46.336 0 : {contents = "PHYMODE_ACTIVE"} = {value = +16, type = kCFNumberSInt32Type} +Mon Dec 10 12:04:46.336 1 : {contents = "PHYMODE_SUPPORTED"} = {value = +159, type = kCFNumberSInt32Type} +Mon Dec 10 12:04:46.336 } +Mon Dec 10 12:04:46.336 +Mon Dec 10 12:04:46.336 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: PHY mode: <10> 5GHz: YES +Mon Dec 10 12:04:46.336 BTC: BluetoothCoexHandle_ReconfigureAntennas: MCS index set size = 16, NSS = 2SS, need to re-assoc = YES +Mon Dec 10 12:04:46.336 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: 11bg only = NO, BT on = YES, # HIDs = 0, # A2DP = 0, # SCO = 0, fallback = normal -> Middle Chain is ON +Mon Dec 10 12:04:46.336 BTC: BluetoothCoexSettingPerChainPower: Chain Power Setting does not need to be updated +Mon Dec 10 12:04:46.336 BTC: BluetoothCoexHandle_ReconfigureAntennas: Skipping REASSOC - The # of chains did not change. +Mon Dec 10 12:04:46.336 Info: REQUEST DEFERRED minimum=7 [client=locationd, type=4, interface=en0, priority=5] +Mon Dec 10 12:04:46.336 Driver Event: _bsd_80211_event_callback: AWDL_REALTIME_MODE_END (awdl0) +Mon Dec 10 12:04:46.336 P2P: _interfaceLinkChanged: Stopping IPv6 link local on awdl0 +Mon Dec 10 12:04:46.336 BTC: __BluetoothCoexHandleUpdateForNode: Handle Bluetooth Coex: FrequencyBand <2>, Bluetooth Bandwidth Utilization <3>, Clamshell Mode <0> +Mon Dec 10 12:04:46.337 Info: AWDL real time mode ended +Mon Dec 10 12:04:46.337 BTC: BluetoothCoexSetProfile: profile for band 2.4GHz didn't change +Mon Dec 10 12:04:46.337 BTC: BluetoothCoexSetProfile: profile for band 5GHz didn't change +Mon Dec 10 12:04:46.337 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: band = 0x2 +Mon Dec 10 12:04:46.337 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: hosting AP = NO, assoc as STA = YES, assoced in 2.4GHz = NO +Mon Dec 10 12:04:46.337 AutoJoin: Reviewing the preferred networks list +Mon Dec 10 12:04:46.337 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: band = 2 +Mon Dec 10 12:04:46.337 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 12:04:46.337 AutoJoin: Adding network ['XT1635-02 9086' (wifi.ssid.5854313633352d30322039303836) - WPA2 Personal] +Mon Dec 10 12:04:46.337 AutoJoin: Adding network ['Prawin' (wifi.ssid.50726177696e) - WPA/WPA2 Personal] +Mon Dec 10 12:04:46.337 AutoJoin: Adding network ['Tilak' (wifi.ssid.54696c616b) - WPA Personal] +Mon Dec 10 12:04:46.337 AutoJoin: Ignoring disabled network ['Redmi' (wifi.ssid.5265646d69) - Open] +Mon Dec 10 12:04:46.337 BTC: BluetoothCoexGetCurrentBssidPhyMode: Bluetooth Coex: Active PHY Mode 16. PHY Mode +Mon Dec 10 12:04:46.337 {type = mutable dict, count = 2, +Mon Dec 10 12:04:46.337 entries => +Mon Dec 10 12:04:46.337 0 : {contents = "PHYMODE_ACTIVE"} = {value = +16, type = kCFNumberSInt32Type} +Mon Dec 10 12:04:46.337 1 : {contents = "PHYMODE_SUPPORTED"} = {value = +159, type = kCFNumberSInt32Type} +Mon Dec 10 12:04:46.337 } +Mon Dec 10 12:04:46.337 +Mon Dec 10 12:04:46.337 AutoJoin: Adding network ['twdata' (wifi.ssid.747764617461) - WPA2 Enterprise] +Mon Dec 10 12:04:46.337 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: PHY mode: <10> 5GHz: YES +Mon Dec 10 12:04:46.337 BTC: BluetoothCoexHandle_ReconfigureAntennas: MCS index set size = 16, NSS = 2SS, need to re-assoc = YES +Mon Dec 10 12:04:46.337 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: 11bg only = NO, BT on = YES, # HIDs = 0, # A2DP = 0, # SCO = 0, fallback = normal -> Middle Chain is ON +Mon Dec 10 12:04:46.337 AutoJoin: Adding network ['401UnauthorizedAccess' (wifi.ssid.343031556e617574686f72697a6564416363657373) - WPA2 Personal] +Mon Dec 10 12:04:46.338 AutoJoin: Adding network ['Ayush' (wifi.ssid.4179757368) - WPA/WPA2 Personal] +Mon Dec 10 12:04:46.338 AutoJoin: Adding network ['twguest' (wifi.ssid.74776775657374) - WPA2 Personal] +Mon Dec 10 12:04:46.338 BTC: BluetoothCoexSettingPerChainPower: Chain Power Setting does not need to be updated +Mon Dec 10 12:04:46.338 BTC: BluetoothCoexHandle_ReconfigureAntennas: Skipping REASSOC - The # of chains did not change. +Mon Dec 10 12:04:46.338 Driver Event: _bsd_80211_event_callback: AWDL_REALTIME_MODE_END (awdl0) +Mon Dec 10 12:04:46.338 AutoJoin: Ignoring disabled network ['Illiad' (wifi.ssid.496c6c696164) - WPA2 Personal] +Mon Dec 10 12:04:46.338 AutoJoin: Adding network ['NOSI' (wifi.ssid.4e4f5349) - WPA2 Enterprise] +Mon Dec 10 12:04:46.338 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 12:04:46.338 AutoJoin: Adding network ['Network Not Found' (wifi.ssid.4e6574776f726b204e6f7420466f756e64) - WPA2 Personal] +Mon Dec 10 12:04:46.338 Driver Event: _bsd_80211_event_callback: AWDL_SYNC_STATE_CHANGED (awdl0) +Mon Dec 10 12:04:46.338 AutoJoin: Adding network ['403Forbidden' (wifi.ssid.343033466f7262696464656e) - WPA2 Personal] +Mon Dec 10 12:04:46.338 AutoJoin: Adding network ['NETGEAR' (wifi.ssid.4e455447454152) - WPA2 Personal] +Mon Dec 10 12:04:46.338 AutoJoin: Adding network ['No' (wifi.ssid.4e6f) - WPA2 Personal] +Mon Dec 10 12:04:46.338 Info: AWDL real time mode ended +Mon Dec 10 12:04:46.338 AutoJoin: Adding network ['gruppopam' (wifi.ssid.67727570706f70616d) - WPA2 Personal] +Mon Dec 10 12:04:46.338 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 12:04:46.339 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 12:04:46.340 AutoJoin: NOT LINK DOWN RECOVERY => continuing +Mon Dec 10 12:04:46.340 AutoJoin: MAINTENANCE WAKE => will attempt to restore maintenance wake association +Mon Dec 10 12:04:46.340 AutoJoin: Already associated to 'NOSI' (<4e4f5349>), will not continue auto-join +Mon Dec 10 12:04:46.340 AutoJoin: AUTO-JOIN COMPLETED for interface en0, took 0.0056 seconds, returned result 'success', error [NO ERROR] +Mon Dec 10 12:04:46.340 Info: PRIORITY LOCK REMOVED [client=airportd, type=4, interface=en0, priority=7] +Mon Dec 10 12:04:46.340 BTC: __BluetoothCoexHandleUpdateForNode: Handle Bluetooth Coex: FrequencyBand <2>, Bluetooth Bandwidth Utilization <3>, Clamshell Mode <0> +Mon Dec 10 12:04:46.340 Info: REQUEST UN-DEFERRED minimum=-9223372036854775808 [client=locationd, type=4, interface=en0, priority=5] +Mon Dec 10 12:04:46.340 BTC: BluetoothCoexSetProfile: profile for band 2.4GHz didn't change +Mon Dec 10 12:04:46.340 BTC: BluetoothCoexSetProfile: profile for band 5GHz didn't change +Mon Dec 10 12:04:46.340 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: band = 0x2 +Mon Dec 10 12:04:46.341 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: hosting AP = NO, assoc as STA = YES, assoced in 2.4GHz = NO +Mon Dec 10 12:04:46.341 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: band = 2 +Mon Dec 10 12:04:46.341 BTC: BluetoothCoexGetCurrentBssidPhyMode: Bluetooth Coex: Active PHY Mode 16. PHY Mode +Mon Dec 10 12:04:46.341 {type = mutable dict, count = 2, +Mon Dec 10 12:04:46.341 entries => +Mon Dec 10 12:04:46.341 0 : {contents = "PHYMODE_ACTIVE"} = {value = +16, type = kCFNumberSInt32Type} +Mon Dec 10 12:04:46.341 1 : {contents = "PHYMODE_SUPPORTED"} = {value = +159, type = kCFNumberSInt32Type} +Mon Dec 10 12:04:46.341 } +Mon Dec 10 12:04:46.341 +Mon Dec 10 12:04:46.341 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: PHY mode: <10> 5GHz: YES +Mon Dec 10 12:04:46.341 BTC: BluetoothCoexHandle_ReconfigureAntennas: MCS index set size = 16, NSS = 2SS, need to re-assoc = YES +Mon Dec 10 12:04:46.341 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: 11bg only = NO, BT on = YES, # HIDs = 0, # A2DP = 0, # SCO = 0, fallback = normal -> Middle Chain is ON +Mon Dec 10 12:04:46.341 BTC: BluetoothCoexSettingPerChainPower: Chain Power Setting does not need to be updated +Mon Dec 10 12:04:46.341 BTC: BluetoothCoexHandle_ReconfigureAntennas: Skipping REASSOC - The # of chains did not change. +Mon Dec 10 12:04:46.341 Driver Event: _bsd_80211_event_callback: POWER_CHANGED (en0) +Mon Dec 10 12:04:46.341 BTC: BluetoothCoexistenceTickle: Triggering BTC status notification +Mon Dec 10 12:04:46.341 P2P: _bsd_80211_event_callback: Marking p2p0 up because en0 was powered on +Mon Dec 10 12:04:46.341 P2P: _changeInterfaceFlags: Marking p2p0 up +Mon Dec 10 12:04:46.342 Info: -[CWXPCSubsystem performScanWithChannelList:ssidList:legacyScanSSID:dwellTimeOverride:includeHiddenNetworks:mergeScanResults:interfaceName:connection:error:]: Failed to perform Wi-Fi scan, returned error code 16, will try again in 200 ms +Mon Dec 10 12:04:46.342 P2P: AwdlNodeShouldBeMarkedUp: awdl0 should be marked up +Mon Dec 10 12:04:46.342 P2P: _bsd_80211_event_callback: Marking awdl0 up because en0 was powered on +Mon Dec 10 12:04:46.342 P2P: _interfaceLinkChanged: Starting IPv6 link local on awdl0 +Mon Dec 10 12:04:46.342 Info: power changed +Mon Dec 10 12:04:46.342 _interfaceFlagsChanged: KEV_DL_SIFFLAGS received for p2p0 [flags=0xffff8843 (up)]. +Mon Dec 10 12:04:46.342 _interfaceFlagsChanged: Flags changed for p2p0 (0xffff8802 -> 0xffff8843) (up). +Mon Dec 10 12:04:46.342 Driver Discovery: _interfaceFlagsChanged: p2p0 transitioning from down to up. +Mon Dec 10 12:04:46.342 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 12:04:46.342 P2P: _deviceInterfaceMarkedUp: p2p0 marked up +Mon Dec 10 12:04:46.342 P2P: _deviceInterfaceMarkedUp: on p2p0 Num Advertised[0] +Mon Dec 10 12:04:46.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 12:04:46.343 BTC: BluetoothCoexStatusMonitoringCallback: Bluetooth Status Notification +Mon Dec 10 12:04:46.343 BTC: BluetoothCoexStatusNotificationProcess: BT: ON, Num HID Devices is <0>, Num SCO Devices is <0>, Num A2DP Devices is <0>, Bluetooth Bandwidth Utilization is <3>, LWM <5>, HWM <26> +Mon Dec 10 12:04:46.344 AutoJoin: BACKGROUND SCAN SCHEDULED on interface en0 in 60.0s with SSID list (null), remaining SSID list (null) +Mon Dec 10 12:04:46.501 P2P: _interfaceLinkChanged: Starting IPv6 link local on awdl0 +Mon Dec 10 12:04:46.501 Driver Event: _bsd_80211_event_callback: CHANNEL_SWITCH (en0) +Mon Dec 10 12:04:46.509 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/ProfileID' +Mon Dec 10 12:04:46.509 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/WEP40' +Mon Dec 10 12:04:46.509 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/SSID_STR' +Mon Dec 10 12:04:46.509 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/AirPlay' +Mon Dec 10 12:04:46.509 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/AutoJoinTimestamp' +Mon Dec 10 12:04:46.509 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/BSSID' +Mon Dec 10 12:04:46.509 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/SSID' +Mon Dec 10 12:04:46.509 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/CHANNEL' +Mon Dec 10 12:04:46.509 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/Busy' +Mon Dec 10 12:04:46.509 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/Power Status' +Mon Dec 10 12:04:46.509 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/WEPOPENSYSTEM' +Mon Dec 10 12:04:46.509 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/CachedScanRecord' +Mon Dec 10 12:04:46.509 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/UserMode8021X' +Mon Dec 10 12:04:46.509 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/BusyUI' +Mon Dec 10 12:04:47.037 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:04:47.041 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:04:47.041 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 12:04:47.041 [channelNumber=1(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:04:47.041 [channelNumber=2(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:04:47.041 [channelNumber=3(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:04:47.041 [channelNumber=4(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:04:47.041 [channelNumber=5(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:04:47.041 [channelNumber=6(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:04:47.041 )} took 0.7073 seconds, returned 11 results +Mon Dec 10 12:04:47.041 BTC: __BluetoothCoexHandleUpdateForNode: Handle Bluetooth Coex: FrequencyBand <2>, Bluetooth Bandwidth Utilization <3>, Clamshell Mode <0> +Mon Dec 10 12:04:47.041 BTC: BluetoothCoexSetProfile: profile for band 2.4GHz didn't change +Mon Dec 10 12:04:47.041 BTC: BluetoothCoexSetProfile: profile for band 5GHz didn't change +Mon Dec 10 12:04:47.041 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: band = 0x2 +Mon Dec 10 12:04:47.042 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: hosting AP = NO, assoc as STA = YES, assoced in 2.4GHz = NO +Mon Dec 10 12:04:47.042 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: band = 2 +Mon Dec 10 12:04:47.042 BTC: BluetoothCoexGetCurrentBssidPhyMode: Bluetooth Coex: Active PHY Mode 16. PHY Mode +Mon Dec 10 12:04:47.042 {type = mutable dict, count = 2, +Mon Dec 10 12:04:47.042 entries => +Mon Dec 10 12:04:47.042 0 : {contents = "PHYMODE_ACTIVE"} = {value = +16, type = kCFNumberSInt32Type} +Mon Dec 10 12:04:47.042 1 : {contents = "PHYMODE_SUPPORTED"} = {value = +159, type = kCFNumberSInt32Type} +Mon Dec 10 12:04:47.042 } +Mon Dec 10 12:04:47.042 +Mon Dec 10 12:04:47.042 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: PHY mode: <10> 5GHz: YES +Mon Dec 10 12:04:47.042 BTC: BluetoothCoexHandle_ReconfigureAntennas: MCS index set size = 16, NSS = 2SS, need to re-assoc = YES +Mon Dec 10 12:04:47.042 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: 11bg only = NO, BT on = YES, # HIDs = 0, # A2DP = 0, # SCO = 0, fallback = normal -> Middle Chain is ON +Mon Dec 10 12:04:47.042 BTC: BluetoothCoexSettingPerChainPower: Chain Power Setting does not need to be updated +Mon Dec 10 12:04:47.042 BTC: BluetoothCoexHandle_ReconfigureAntennas: Skipping REASSOC - The # of chains did not change. +Mon Dec 10 12:04:47.288 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:04:47.290 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 12:04:47.290 [channelNumber=7(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:04:47.290 [channelNumber=8(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:04:47.290 [channelNumber=9(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:04:47.290 [channelNumber=10(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:04:47.290 [channelNumber=11(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:04:47.290 [channelNumber=12(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:04:47.290 )} took 0.2476 seconds, returned 3 results +Mon Dec 10 12:04:47.291 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:04:47.559 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:04:47.562 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:04:47.562 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 12:04:47.562 [channelNumber=13(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:04:47.562 [channelNumber=36(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 12:04:47.562 [channelNumber=40(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:04:47.562 [channelNumber=44(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 12:04:47.562 [channelNumber=48(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:04:47.562 [channelNumber=149(5GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:04:47.562 )} took 0.2715 seconds, returned 11 results +Mon Dec 10 12:04:47.563 Info: scan cache updated +Mon Dec 10 12:04:47.807 Driver Discovery: _PMConnectionHandler: caps = CPU Net Disk +Mon Dec 10 12:04:47.808 Info: _systemWokenByWiFi: System wake reason: , was not woken by WiFi +Mon Dec 10 12:04:47.808 Info: _updateWakeLimitCounters: TCP keep alive timed out 0 times on awdl0 +Mon Dec 10 12:04:47.808 Info: _systemWokenByWiFi: System wake reason: , was not woken by WiFi +Mon Dec 10 12:04:47.808 Info: _updateWakeLimitCounters: TCP keep alive timed out 0 times on p2p0 +Mon Dec 10 12:04:47.809 Info: _systemWokenByWiFi: System wake reason: , was not woken by WiFi +Mon Dec 10 12:04:47.809 Info: _updateWakeLimitCounters: TCP keep alive timed out 0 times on en0 +Mon Dec 10 12:04:47.809 Driver Discovery: _PMConnectionHandler: DARK WAKE with maintenance SSID, performing maintenance wake auto-join for interface en0 +Mon Dec 10 12:04:47.811 AutoJoin: AUTO-JOIN trigger requested (Maintenance Wake) +Mon Dec 10 12:04:47.811 Info: psCallback: powerSource = AC Power +Mon Dec 10 12:04:47.811 Info: psCallback: set powersave disabled on en0 +Mon Dec 10 12:04:47.815 IPC: INVALIDATED XPC CLIENT CONNECTION [loginwindow (pid=101, euid=1651299376, egid=604256670)] +Mon Dec 10 12:04:47.815 WoW: WoW not supported on awdl0, skipping +Mon Dec 10 12:04:47.815 WoW: WoW not supported on p2p0, skipping +Mon Dec 10 12:04:47.815 AutoJoin: user: patidar +Mon Dec 10 12:04:47.816 Info: -[CWXPCSubsystem clearScanCacheWithInterfaceName:connection:error:]: Clearing scan cache for interface en0 +Mon Dec 10 12:04:47.816 Info: -[CWXPCSubsystem clearScanCacheWithInterfaceName:connection:error:]: Clearing family+driver scan cache for interface en0 +Mon Dec 10 12:04:47.816 Info: PRIORITY LOCK ADDED [client=airportd, type=4, interface=en0, priority=7] +Mon Dec 10 12:04:47.816 AutoJoin: AUTO-JOIN STARTED for interface en0 (Maintenance Wake) +Mon Dec 10 12:04:47.816 AutoJoin: NOT RECOVERY MODE => continuing +Mon Dec 10 12:04:47.818 AutoJoin: NOT LOGINWINDOW MODE 802.1X => continuing +Mon Dec 10 12:04:47.821 AutoJoin: Reviewing the preferred networks list +Mon Dec 10 12:04:47.821 AutoJoin: Adding network ['XT1635-02 9086' (wifi.ssid.5854313633352d30322039303836) - WPA2 Personal] +Mon Dec 10 12:04:47.821 AutoJoin: Adding network ['Prawin' (wifi.ssid.50726177696e) - WPA/WPA2 Personal] +Mon Dec 10 12:04:47.821 AutoJoin: Adding network ['Tilak' (wifi.ssid.54696c616b) - WPA Personal] +Mon Dec 10 12:04:47.821 AutoJoin: Ignoring disabled network ['Redmi' (wifi.ssid.5265646d69) - Open] +Mon Dec 10 12:04:47.821 AutoJoin: Adding network ['twdata' (wifi.ssid.747764617461) - WPA2 Enterprise] +Mon Dec 10 12:04:47.821 AutoJoin: Adding network ['401UnauthorizedAccess' (wifi.ssid.343031556e617574686f72697a6564416363657373) - WPA2 Personal] +Mon Dec 10 12:04:47.821 AutoJoin: Adding network ['Ayush' (wifi.ssid.4179757368) - WPA/WPA2 Personal] +Mon Dec 10 12:04:47.821 AutoJoin: Adding network ['twguest' (wifi.ssid.74776775657374) - WPA2 Personal] +Mon Dec 10 12:04:47.821 AutoJoin: Ignoring disabled network ['Illiad' (wifi.ssid.496c6c696164) - WPA2 Personal] +Mon Dec 10 12:04:47.821 AutoJoin: Adding network ['NOSI' (wifi.ssid.4e4f5349) - WPA2 Enterprise] +Mon Dec 10 12:04:47.822 AutoJoin: Adding network ['Network Not Found' (wifi.ssid.4e6574776f726b204e6f7420466f756e64) - WPA2 Personal] +Mon Dec 10 12:04:47.822 AutoJoin: Adding network ['403Forbidden' (wifi.ssid.343033466f7262696464656e) - WPA2 Personal] +Mon Dec 10 12:04:47.822 AutoJoin: Adding network ['NETGEAR' (wifi.ssid.4e455447454152) - WPA2 Personal] +Mon Dec 10 12:04:47.822 AutoJoin: Adding network ['No' (wifi.ssid.4e6f) - WPA2 Personal] +Mon Dec 10 12:04:47.822 AutoJoin: Adding network ['gruppopam' (wifi.ssid.67727570706f70616d) - WPA2 Personal] +Mon Dec 10 12:04:47.823 AutoJoin: NOT LINK DOWN RECOVERY => continuing +Mon Dec 10 12:04:47.823 AutoJoin: MAINTENANCE WAKE => will attempt to restore maintenance wake association +Mon Dec 10 12:04:47.823 AutoJoin: Already associated to 'NOSI' (<4e4f5349>), will not continue auto-join +Mon Dec 10 12:04:47.823 AutoJoin: AUTO-JOIN COMPLETED for interface en0, took 0.0074 seconds, returned result 'success', error [NO ERROR] +Mon Dec 10 12:04:47.823 Info: PRIORITY LOCK REMOVED [client=airportd, type=4, interface=en0, priority=7] +Mon Dec 10 12:04:48.030 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:04:48.031 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:04:48.032 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 12:04:48.032 [channelNumber=153(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:04:48.032 [channelNumber=157(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:04:48.032 [channelNumber=161(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:04:48.032 [channelNumber=165(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:04:48.032 [channelNumber=52(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 12:04:48.032 [channelNumber=56(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 12:04:48.032 )} took 0.4685 seconds, returned 8 results +Mon Dec 10 12:04:48.177 Driver Discovery: _PMConnectionHandler: caps = CPU Video Audio Net Disk +Mon Dec 10 12:04:48.177 Info: _systemWokenByWiFi: System wake reason: , was not woken by WiFi +Mon Dec 10 12:04:48.177 Info: _updateWakeLimitCounters: TCP keep alive timed out 0 times on awdl0 +Mon Dec 10 12:04:48.178 Info: _systemWokenByWiFi: System wake reason: , was not woken by WiFi +Mon Dec 10 12:04:48.178 Info: _updateWakeLimitCounters: TCP keep alive timed out 0 times on p2p0 +Mon Dec 10 12:04:48.178 Info: _systemWokenByWiFi: System wake reason: , was not woken by WiFi +Mon Dec 10 12:04:48.178 Info: _updateWakeLimitCounters: TCP keep alive timed out 0 times on en0 +Mon Dec 10 12:04:48.178 AutoJoin: -[CWXPCInterfaceContext clearAllProblematicNetworks]_block_invoke: Unblacklisting all networks. +Mon Dec 10 12:04:48.178 AutoJoin: -[CWXPCInterfaceContext clearAllNetworksBlacklistedForScanOffload]_block_invoke: Clearing all networks blacklisted for scan offload. +Mon Dec 10 12:04:48.178 Offload: _tcpKeepAliveActive: TCP keep-alive is active. +Mon Dec 10 12:04:48.178 AutoJoin: airportdProcessFullWake: Received full wake event for en0 +Mon Dec 10 12:04:48.178 AutoJoin: airportdProcessFullWake: Invoking auto-join for full wake event for en0 +Mon Dec 10 12:04:48.178 Info: __enableTemporarilyDisabledNetworks: Attempting to re-enable any temporarily-disabled network profiles +Mon Dec 10 12:04:48.178 Info: psCallback: powerSource = AC Power +Mon Dec 10 12:04:48.178 Info: psCallback: set powersave disabled on en0 +Mon Dec 10 12:04:48.180 AutoJoin: AUTO-JOIN trigger requested (Full Wake) +Mon Dec 10 12:04:48.180 AutoJoin: BEST CONNECTED SCAN SCHEDULED on interface en0 in 20.0s for network 'NOSI' +Mon Dec 10 12:04:48.181 AutoJoin: user: patidar +Mon Dec 10 12:04:48.182 AutoJoin: BACKGROUND SCAN SCHEDULED on interface en0 in 60.0s with SSID list (null), remaining SSID list (null) +Mon Dec 10 12:04:48.182 Info: -[CWXPCSubsystem clearScanCacheWithInterfaceName:connection:error:]: Clearing scan cache for interface en0 +Mon Dec 10 12:04:48.182 Info: -[CWXPCSubsystem clearScanCacheWithInterfaceName:connection:error:]: Clearing family+driver scan cache for interface en0 +Mon Dec 10 12:04:48.182 Info: PRIORITY LOCK ADDED [client=airportd, type=4, interface=en0, priority=7] +Mon Dec 10 12:04:48.182 AutoJoin: AUTO-JOIN STARTED for interface en0 (Full Wake) +Mon Dec 10 12:04:48.182 AutoJoin: NOT RECOVERY MODE => continuing +Mon Dec 10 12:04:48.183 AutoJoin: NOT LOGINWINDOW MODE 802.1X => continuing +Mon Dec 10 12:04:48.185 AutoJoin: Reviewing the preferred networks list +Mon Dec 10 12:04:48.185 AutoJoin: Adding network ['XT1635-02 9086' (wifi.ssid.5854313633352d30322039303836) - WPA2 Personal] +Mon Dec 10 12:04:48.185 AutoJoin: Adding network ['Prawin' (wifi.ssid.50726177696e) - WPA/WPA2 Personal] +Mon Dec 10 12:04:48.185 AutoJoin: Adding network ['Tilak' (wifi.ssid.54696c616b) - WPA Personal] +Mon Dec 10 12:04:48.185 AutoJoin: Ignoring disabled network ['Redmi' (wifi.ssid.5265646d69) - Open] +Mon Dec 10 12:04:48.185 AutoJoin: Adding network ['twdata' (wifi.ssid.747764617461) - WPA2 Enterprise] +Mon Dec 10 12:04:48.185 AutoJoin: Adding network ['401UnauthorizedAccess' (wifi.ssid.343031556e617574686f72697a6564416363657373) - WPA2 Personal] +Mon Dec 10 12:04:48.185 AutoJoin: Adding network ['Ayush' (wifi.ssid.4179757368) - WPA/WPA2 Personal] +Mon Dec 10 12:04:48.185 AutoJoin: Adding network ['twguest' (wifi.ssid.74776775657374) - WPA2 Personal] +Mon Dec 10 12:04:48.185 AutoJoin: Ignoring disabled network ['Illiad' (wifi.ssid.496c6c696164) - WPA2 Personal] +Mon Dec 10 12:04:48.185 AutoJoin: Adding network ['NOSI' (wifi.ssid.4e4f5349) - WPA2 Enterprise] +Mon Dec 10 12:04:48.185 AutoJoin: Adding network ['Network Not Found' (wifi.ssid.4e6574776f726b204e6f7420466f756e64) - WPA2 Personal] +Mon Dec 10 12:04:48.186 AutoJoin: Adding network ['403Forbidden' (wifi.ssid.343033466f7262696464656e) - WPA2 Personal] +Mon Dec 10 12:04:48.186 AutoJoin: Adding network ['NETGEAR' (wifi.ssid.4e455447454152) - WPA2 Personal] +Mon Dec 10 12:04:48.186 AutoJoin: Adding network ['No' (wifi.ssid.4e6f) - WPA2 Personal] +Mon Dec 10 12:04:48.186 AutoJoin: Adding network ['gruppopam' (wifi.ssid.67727570706f70616d) - WPA2 Personal] +Mon Dec 10 12:04:48.187 AutoJoin: NOT LINK DOWN RECOVERY => continuing +Mon Dec 10 12:04:48.187 AutoJoin: NOT MAINTENANCE WAKE => continuing +Mon Dec 10 12:04:48.189 AutoJoin: No known colocated network for preferred network wifi.ssid.4e4f5349 +Mon Dec 10 12:04:48.189 AutoJoin: NOT MORE-PREFERRED USER MODE 802.1X NETWORKS => continuing +Mon Dec 10 12:04:48.189 AutoJoin: NOT SYSTEM MODE 802.1X => continuing +Mon Dec 10 12:04:48.189 AutoJoin: NOT WOW => continuing +Mon Dec 10 12:04:48.189 AutoJoin: NOT Power On / Reinit => continuing +Mon Dec 10 12:04:48.189 AutoJoin: NOT PNL Changed => continuing +Mon Dec 10 12:04:48.189 AutoJoin: AUTOJOIN => auto-join using the entire preferred networks list +Mon Dec 10 12:04:48.189 AutoJoin: Already associated to 'NOSI' (<4e4f5349>), will not continue auto-join +Mon Dec 10 12:04:48.189 AutoJoin: AUTO-JOIN COMPLETED for interface en0, took 0.0069 seconds, returned result 'success', error [NO ERROR] +Mon Dec 10 12:04:48.189 Info: PRIORITY LOCK REMOVED [client=airportd, type=4, interface=en0, priority=7] +Mon Dec 10 12:04:48.216 Info: machine wake +Mon Dec 10 12:04:48.216 Info: START MONITORING EVENT request received from pid 383 (WiFiProxy) +Mon Dec 10 12:04:48.216 Info: START MONITORING EVENT request received from pid 383 (WiFiProxy) +Mon Dec 10 12:04:48.216 Info: START MONITORING EVENT request received from pid 383 (WiFiProxy) +Mon Dec 10 12:04:48.216 Info: START MONITORING EVENT request received from pid 383 (WiFiProxy) +Mon Dec 10 12:04:48.216 Info: START MONITORING EVENT request received from pid 383 (WiFiProxy) +Mon Dec 10 12:04:48.216 Info: START MONITORING EVENT request received from pid 383 (WiFiProxy) +Mon Dec 10 12:04:48.216 Info: START MONITORING EVENT request received from pid 383 (WiFiProxy) +Mon Dec 10 12:04:48.216 Info: START MONITORING EVENT request received from pid 383 (WiFiProxy) +Mon Dec 10 12:04:48.217 Info: START MONITORING EVENT request received from pid 383 (WiFiProxy) +Mon Dec 10 12:04:48.217 Info: START MONITORING EVENT request received from pid 383 (WiFiProxy) +Mon Dec 10 12:04:48.217 Info: START MONITORING EVENT request received from pid 383 (WiFiProxy) +Mon Dec 10 12:04:48.217 Info: START MONITORING EVENT request received from pid 383 (WiFiProxy) +Mon Dec 10 12:04:48.218 Info: START MONITORING EVENT request received from pid 383 (WiFiProxy) +Mon Dec 10 12:04:48.218 Info: START MONITORING EVENT request received from pid 383 (WiFiProxy) +Mon Dec 10 12:04:48.225 Info: -[AirPortExtraImplementation initBackend]_block_invoke: _isBusy 0 +Mon Dec 10 12:04:48.226 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 12:04:48.227 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 12:04:48.344 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 12:04:48.344 [channelNumber=60(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 12:04:48.344 [channelNumber=64(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 12:04:48.344 )} took 0.3106 seconds, returned 8 results +Mon Dec 10 12:04:48.344 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:04:48.345 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:04:48.957 Info: SCAN request received from pid 92 (locationd) with priority 2 +Mon Dec 10 12:04:48.957 Scan: locationd requested a live scan less than 10 seconds after previous request (2.6229s) returning cached scan results +Mon Dec 10 12:04:48.969 Info: SCAN request received from pid 92 (locationd) with priority 2 +Mon Dec 10 12:04:48.969 Scan: locationd requested a live scan less than 10 seconds after previous request (2.6358s) returning cached scan results +Mon Dec 10 12:04:49.319 Info: ACQUIRE BT PAGING LOCK request received from pid 106 (bluetoothd) +Mon Dec 10 12:04:49.320 Info: BT PAGING LOCK GRANTED immediately, auto-join has had a chance to run since wake +Mon Dec 10 12:04:49.320 Info: BT PAGING LOCK GRANTED after 0.0 seconds +Mon Dec 10 12:04:49.321 Info: RELINQUISH BT PAGING LOCK request received from pid 106 (bluetoothd) +Mon Dec 10 12:04:49.321 Info: BT PAGING LOCK RELINQUISHED after 0.0 seconds +Mon Dec 10 12:04:49.321 Info: BT PAGING LOCK RELINQUISHED, re-enabling deferred WiFi requests +Mon Dec 10 12:05:06.345 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:05:06.345 Info: _bsd_80211_event_callback: link quality: RSSI=-56 dBm TxRate=162 Mbps +Mon Dec 10 12:05:06.345 Info: link quality changed +Mon Dec 10 12:05:08.180 AutoJoin: BEST CONNECTED SCAN request on interface en0 for network 'XT1635-02 9086' +Mon Dec 10 12:05:08.281 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:05:08.284 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:08.284 [channelNumber=1(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:08.284 [channelNumber=2(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:08.284 [channelNumber=3(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:05:08.284 )} took 0.1034 seconds, returned 7 results +Mon Dec 10 12:05:08.284 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:05:08.284 Info: scan cache updated +Mon Dec 10 12:05:08.383 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:05:08.386 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:08.386 [channelNumber=4(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:08.386 [channelNumber=5(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:08.386 [channelNumber=6(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:05:08.386 )} took 0.1023 seconds, returned 7 results +Mon Dec 10 12:05:08.386 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:05:08.486 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:05:08.488 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:08.488 [channelNumber=7(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:08.488 [channelNumber=8(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:08.488 [channelNumber=9(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:05:08.488 )} took 0.1016 seconds, returned 1 results +Mon Dec 10 12:05:08.488 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:05:08.589 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:05:08.592 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:08.592 [channelNumber=10(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:08.592 [channelNumber=11(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:08.592 [channelNumber=12(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:05:08.592 )} took 0.1036 seconds, returned 4 results +Mon Dec 10 12:05:08.592 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:05:08.719 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:05:08.722 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:08.722 [channelNumber=13(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:08.722 [channelNumber=36(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 12:05:08.722 [channelNumber=40(5GHz), channelWidth={40MHz(-1)}, active] +Mon Dec 10 12:05:08.722 )} took 0.1298 seconds, returned 5 results +Mon Dec 10 12:05:08.722 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:05:08.826 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:05:08.828 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:08.828 [channelNumber=44(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 12:05:08.828 [channelNumber=48(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:05:08.828 [channelNumber=149(5GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:05:08.828 )} took 0.1067 seconds, returned 4 results +Mon Dec 10 12:05:08.829 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:05:08.929 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:05:08.932 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:05:08.932 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:08.932 [channelNumber=153(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:05:08.932 [channelNumber=157(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:08.932 [channelNumber=161(5GHz), channelWidth={40MHz(-1)}, active] +Mon Dec 10 12:05:08.932 )} took 0.1035 seconds, returned 7 results +Mon Dec 10 12:05:09.215 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:05:09.217 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:09.217 [channelNumber=165(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:09.217 [channelNumber=52(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 12:05:09.217 [channelNumber=56(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 12:05:09.217 )} took 0.2851 seconds, returned 5 results +Mon Dec 10 12:05:09.217 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:05:09.482 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:05:09.485 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:05:09.485 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:09.485 [channelNumber=60(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 12:05:09.485 [channelNumber=64(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 12:05:09.485 )} took 0.2679 seconds, returned 8 results +Mon Dec 10 12:05:09.486 Info: scan cache updated +Mon Dec 10 12:05:09.487 Roam: ROAMING PROFILES already set to AC POWER for 2.4GHz on en0 +Mon Dec 10 12:05:09.487 Roam: ROAMING PROFILES already set to AC POWER for 5GHz on en0 +Mon Dec 10 12:05:09.487 AutoJoin: BEST CONNECTED ROAM triggered +Mon Dec 10 12:05:09.488 Driver Event: _bsd_80211_event_callback: APPLE80211_M_ROAM_START (en0) +Mon Dec 10 12:05:09.488 Info: Roaming started on interface en0 +Mon Dec 10 12:05:09.488 Info: PRIORITY LOCK ADDED [client=airportd, type=4, interface=en0, priority=5] +Mon Dec 10 12:05:09.490 Info: -[CWXPCInterfaceContext __setAWDLOperatingMode:interface:error:]: attempting to set AWDL mode to 2 +Mon Dec 10 12:05:09.490 Info: SUSPEND AWDL for interface en0, timeout=10.0s, reason=Roam, token=2686 +Mon Dec 10 12:05:10.934 Driver Event: _bsd_80211_event_callback: APPLE80211_M_ROAM_END (en0) +Mon Dec 10 12:05:10.934 Info: Roaming ended on interface en0 +Mon Dec 10 12:05:10.935 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:05:10.935 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:05:10.935 Info: -[CWXPCInterfaceContext setRoamInProgress:reason:]_block_invoke: roam status metric data: CWAWDMetricRoamStatus: status:3 security: 4 profile:5 origin:<6cf37f>(-56) target:<6cf37f>(-57) latency:1.445767s +Mon Dec 10 12:05:10.935 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90046 +Mon Dec 10 12:05:10.935 Info: RESUME AWDL for interface en0, reason=Roam token=2686 +Mon Dec 10 12:05:10.935 Info: PRIORITY LOCK REMOVED [client=airportd, type=4, interface=en0, priority=5] +Mon Dec 10 12:05:10.936 Info: -[CWXPCInterfaceContext __setAWDLOperatingMode:interface:error:]: attempting to set AWDL mode to 0 +Mon Dec 10 12:05:11.354 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:05:11.354 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=243 Mbps +Mon Dec 10 12:05:11.354 Info: link quality changed +Mon Dec 10 12:05:16.355 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:05:16.355 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=216 Mbps +Mon Dec 10 12:05:16.356 Info: link quality changed +Mon Dec 10 12:05:21.359 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:05:21.359 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=300 Mbps +Mon Dec 10 12:05:21.360 Info: link quality changed +Mon Dec 10 12:05:29.363 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:05:29.363 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=216 Mbps +Mon Dec 10 12:05:29.364 Info: link quality changed +Mon Dec 10 12:05:38.367 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:05:38.367 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=243 Mbps +Mon Dec 10 12:05:38.368 Info: link quality changed +Mon Dec 10 12:05:48.180 AutoJoin: BACKGROUND SCAN request on interface en0 with SSID list (null) +Mon Dec 10 12:05:48.181 Scan: Cache-assisted scan request on channel 1 does not require a live scan +Mon Dec 10 12:05:48.181 Scan: Cache-assisted scan request on channel 2 does not require a live scan +Mon Dec 10 12:05:48.181 Scan: Cache-assisted scan request on channel 3 does not require a live scan +Mon Dec 10 12:05:48.181 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.181 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.181 [channelNumber=1(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:48.181 [channelNumber=2(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:48.181 [channelNumber=3(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:05:48.181 )} took 0.0006 seconds, returned 7 results +Mon Dec 10 12:05:48.181 Scan: Cache-assisted scan request on channel 4 does not require a live scan +Mon Dec 10 12:05:48.181 Scan: Cache-assisted scan request on channel 5 does not require a live scan +Mon Dec 10 12:05:48.182 Scan: Cache-assisted scan request on channel 6 does not require a live scan +Mon Dec 10 12:05:48.182 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.182 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.182 [channelNumber=4(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:48.182 [channelNumber=5(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:48.182 [channelNumber=6(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:05:48.182 )} took 0.0006 seconds, returned 7 results +Mon Dec 10 12:05:48.182 Scan: Cache-assisted scan request on channel 7 does not require a live scan +Mon Dec 10 12:05:48.182 Scan: Cache-assisted scan request on channel 8 does not require a live scan +Mon Dec 10 12:05:48.182 Scan: Cache-assisted scan request on channel 9 does not require a live scan +Mon Dec 10 12:05:48.182 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.182 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.182 [channelNumber=7(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:48.182 [channelNumber=8(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:48.182 [channelNumber=9(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:05:48.182 )} took 0.0003 seconds, returned 1 results +Mon Dec 10 12:05:48.182 Scan: Cache-assisted scan request on channel 10 does not require a live scan +Mon Dec 10 12:05:48.183 Scan: Cache-assisted scan request on channel 11 does not require a live scan +Mon Dec 10 12:05:48.183 Scan: Cache-assisted scan request on channel 12 does not require a live scan +Mon Dec 10 12:05:48.183 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.183 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.183 [channelNumber=10(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:48.183 [channelNumber=11(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:48.183 [channelNumber=12(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:05:48.183 )} took 0.0007 seconds, returned 4 results +Mon Dec 10 12:05:48.183 Scan: Cache-assisted scan request on channel 13 does not require a live scan +Mon Dec 10 12:05:48.183 Scan: Cache-assisted scan request on channel 36 does not require a live scan +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request on channel 40 does not require a live scan +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.184 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.184 [channelNumber=13(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:48.184 [channelNumber=36(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 12:05:48.184 [channelNumber=40(5GHz), channelWidth={40MHz(-1)}, active] +Mon Dec 10 12:05:48.184 )} took 0.0007 seconds, returned 5 results +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request on channel 44 does not require a live scan +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request on channel 48 does not require a live scan +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request on channel 149 does not require a live scan +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.185 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.185 [channelNumber=44(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 12:05:48.185 [channelNumber=48(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:05:48.185 [channelNumber=149(5GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:05:48.185 )} took 0.0006 seconds, returned 4 results +Mon Dec 10 12:05:48.185 Scan: Cache-assisted scan request on channel 153 does not require a live scan +Mon Dec 10 12:05:48.185 Scan: Cache-assisted scan request on channel 157 does not require a live scan +Mon Dec 10 12:05:48.185 Scan: Cache-assisted scan request on channel 161 does not require a live scan +Mon Dec 10 12:05:48.186 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.186 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.186 [channelNumber=153(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:05:48.186 [channelNumber=157(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:48.186 [channelNumber=161(5GHz), channelWidth={40MHz(-1)}, active] +Mon Dec 10 12:05:48.186 )} took 0.0010 seconds, returned 7 results +Mon Dec 10 12:05:48.186 Scan: Cache-assisted scan request on channel 165 does not require a live scan +Mon Dec 10 12:05:48.186 Scan: Cache-assisted scan request on channel 52 does not require a live scan +Mon Dec 10 12:05:48.186 Scan: Cache-assisted scan request on channel 56 does not require a live scan +Mon Dec 10 12:05:48.186 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.187 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.187 [channelNumber=165(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:48.187 [channelNumber=52(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 12:05:48.187 [channelNumber=56(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 12:05:48.187 )} took 0.0008 seconds, returned 5 results +Mon Dec 10 12:05:48.187 Scan: Cache-assisted scan request on channel 60 does not require a live scan +Mon Dec 10 12:05:48.187 Scan: Cache-assisted scan request on channel 64 does not require a live scan +Mon Dec 10 12:05:48.188 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.188 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.188 [channelNumber=60(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 12:05:48.188 [channelNumber=64(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 12:05:48.188 )} took 0.0013 seconds, returned 8 results +Mon Dec 10 12:05:50.375 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:05:50.375 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=216 Mbps +Mon Dec 10 12:05:50.376 Info: link quality changed +Mon Dec 10 12:05:55.378 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:05:55.378 Info: _bsd_80211_event_callback: link quality: RSSI=-56 dBm TxRate=243 Mbps +Mon Dec 10 12:05:55.379 Info: link quality changed +Mon Dec 10 12:06:28.759 Driver Event: _bsd_80211_event_callback: AWDL_SYNC_STATE_CHANGED (awdl0) +Mon Dec 10 12:06:28.763 Info: AWDL started +Mon Dec 10 12:06:28.763 Driver Event: _bsd_80211_event_callback: CHANNEL_SWITCH (en0) +Mon Dec 10 12:06:28.765 Roam: ROAMING PROFILES updated to SINGLE-BAND, SINGLE-AP for 2.4GHz on en0 +Mon Dec 10 12:06:28.765 Roam: ROAMING PROFILES updated to SINGLE-BAND, SINGLE-AP for 5GHz on en0 +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/ProfileID' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/WEP40' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/SSID_STR' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/AirPlay' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/AutoJoinTimestamp' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/BSSID' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/SSID' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/CHANNEL' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/Busy' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/Power Status' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/WEPOPENSYSTEM' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/CachedScanRecord' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/UserMode8021X' +Mon Dec 10 12:06:28.771 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/BusyUI' +Mon Dec 10 12:06:28.945 Info: INTERFACE STATE INFO request received from pid 362 (sharingd) +Mon Dec 10 12:06:28.946 Info: -[CWXPCInterfaceContext __copyMACAddressForInterface:]: MAC address: <82cd0ac3 bf73> +Mon Dec 10 12:06:30.064 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:30.151 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:30.151 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:31.137 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:31.138 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:31.832 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:31.832 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:48.742 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:48.742 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:49.121 P2P: _terminateGroupOwnerTimer: Terminate group owner timer notification received. +Mon Dec 10 12:06:49.267 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:49.267 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:49.793 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:49.793 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.931 Driver Event: _bsd_80211_event_callback: AWDL_REALTIME_MODE_END (awdl0) +Mon Dec 10 12:06:50.931 Driver Event: _bsd_80211_event_callback: AWDL_STATISTICS (awdl0) +Mon Dec 10 12:06:50.932 Info: AWDL real time mode ended +Mon Dec 10 12:06:50.945 BTC: __BluetoothCoexHandleUpdateForNode: Handle Bluetooth Coex: FrequencyBand <2>, Bluetooth Bandwidth Utilization <3>, Clamshell Mode <0> +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexSetProfile: profile for band 2.4GHz didn't change +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexSetProfile: profile for band 5GHz didn't change +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: band = 0x2 +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: hosting AP = NO, assoc as STA = YES, assoced in 2.4GHz = NO +Mon Dec 10 12:06:50.945 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: band = 2 +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexGetCurrentBssidPhyMode: Bluetooth Coex: Active PHY Mode 16. PHY Mode +Mon Dec 10 12:06:50.945 {type = mutable dict, count = 2, +Mon Dec 10 12:06:50.945 entries => +Mon Dec 10 12:06:50.945 0 : {contents = "PHYMODE_ACTIVE"} = {value = +16, type = kCFNumberSInt32Type} +Mon Dec 10 12:06:50.945 1 : {contents = "PHYMODE_SUPPORTED"} = {value = +159, type = kCFNumberSInt32Type} +Mon Dec 10 12:06:50.945 } +Mon Dec 10 12:06:50.945 +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: PHY mode: <10> 5GHz: YES +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ReconfigureAntennas: MCS index set size = 16, NSS = 2SS, need to re-assoc = YES +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: 11bg only = NO, BT on = YES, # HIDs = 0, # A2DP = 0, # SCO = 0, fallback = normal -> Middle Chain is ON +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexSettingPerChainPower: Chain Power Setting does not need to be updated +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ReconfigureAntennas: Skipping REASSOC - The # of chains did not change. +Mon Dec 10 12:06:50.945 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 12:06:50.945 Driver Event: _bsd_80211_event_callback: AWDL_REALTIME_MODE_END (awdl0) +Mon Dec 10 12:06:50.945 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.945 BTC: __BluetoothCoexHandleUpdateForNode: Handle Bluetooth Coex: FrequencyBand <2>, Bluetooth Bandwidth Utilization <3>, Clamshell Mode <0> +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexSetProfile: profile for band 2.4GHz didn't change +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexSetProfile: profile for band 5GHz didn't change +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: band = 0x2 +Mon Dec 10 12:06:50.945 Info: AWDL real time mode ended +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: hosting AP = NO, assoc as STA = YES, assoced in 2.4GHz = NO +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: band = 2 +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexGetCurrentBssidPhyMode: Bluetooth Coex: Active PHY Mode 16. PHY Mode +Mon Dec 10 12:06:50.946 {type = mutable dict, count = 2, +Mon Dec 10 12:06:50.946 entries => +Mon Dec 10 12:06:50.946 0 : {contents = "PHYMODE_ACTIVE"} = {value = +16, type = kCFNumberSInt32Type} +Mon Dec 10 12:06:50.946 1 : {contents = "PHYMODE_SUPPORTED"} = {value = +159, type = kCFNumberSInt32Type} +Mon Dec 10 12:06:50.946 } +Mon Dec 10 12:06:50.946 +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: PHY mode: <10> 5GHz: YES +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexHandle_ReconfigureAntennas: MCS index set size = 16, NSS = 2SS, need to re-assoc = YES +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: 11bg only = NO, BT on = YES, # HIDs = 0, # A2DP = 0, # SCO = 0, fallback = normal -> Middle Chain is ON +Mon Dec 10 12:06:50.946 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexSettingPerChainPower: Chain Power Setting does not need to be updated +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexHandle_ReconfigureAntennas: Skipping REASSOC - The # of chains did not change. +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.946 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_SYNC_STATE_CHANGED (awdl0) +Mon Dec 10 12:06:50.947 Info: AWDL ended +Mon Dec 10 12:06:50.951 Info: -[CWXPCInterfaceContext __submitAWDLUsageMetric:duration:]: AWDL usage metric data: CWAWDMetricAwdlUsageData: selfInfraChannel 40, peerInfraChannel 0, numOfPeers 6. Keys: Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90013 +Mon Dec 10 12:06:50.952 Info: INTERFACE STATE INFO request received from pid 362 (sharingd) +Mon Dec 10 12:06:50.952 Info: -[CWXPCInterfaceContext __copyMACAddressForInterface:]: MAC address: <82cd0ac3 bf73> +Mon Dec 10 12:06:50.953 Roam: ROAMING PROFILES updated to AC POWER for 2.4GHz on en0 +Mon Dec 10 12:06:50.953 Roam: ROAMING PROFILES updated to AC POWER for 5GHz on en0 +Mon Dec 10 12:06:53.680 Info: -[CWXPCSubsystem handleDeviceCountMetricQuery:]_block_invoke: DeviceCount metric data: CWAWDMetricDeviceCountData: timeSinceBoot: 1515466.360642, deviceCount: 1 +Mon Dec 10 12:06:53.684 Info: -[CWXPCSubsystem handleNetworkPrefsMetricQuery:]: NetworkPrefs metric data: CWAWDMetricNetworkPrefsData: preferred 15 hidden 0 open 1 wep 0 wpa 12 eap 2 +Mon Dec 10 12:06:53.684 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90004 +Mon Dec 10 12:06:53.852 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90001 +Mon Dec 10 12:06:53.852 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x9000d +Mon Dec 10 12:06:53.852 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x9000b +Mon Dec 10 12:12:03.594 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:12:03.594 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=216 Mbps +Mon Dec 10 12:12:03.595 Info: link quality changed +Mon Dec 10 12:12:09.598 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:12:09.598 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=270 Mbps +Mon Dec 10 12:12:09.599 Info: link quality changed +Mon Dec 10 12:12:56.625 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:12:56.625 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=216 Mbps +Mon Dec 10 12:12:56.625 Info: link quality changed +Mon Dec 10 12:13:01.625 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:13:01.625 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=243 Mbps +Mon Dec 10 12:13:01.626 Info: link quality changed +Mon Dec 10 12:13:06.628 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:13:06.628 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=216 Mbps +Mon Dec 10 12:13:06.628 Info: link quality changed +Mon Dec 10 12:13:27.639 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:13:27.639 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=243 Mbps +Mon Dec 10 12:13:27.640 Info: link quality changed +Mon Dec 10 12:14:46.658 Info: SCAN request received from pid 92 (locationd) with priority 2 +Mon Dec 10 12:14:46.902 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:14:46.905 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:14:46.906 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 12:14:46.906 [channelNumber=1(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:46.906 [channelNumber=2(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:46.906 [channelNumber=3(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:46.906 [channelNumber=4(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:46.906 [channelNumber=5(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:46.906 [channelNumber=6(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:14:46.906 )} took 0.2478 seconds, returned 13 results +Mon Dec 10 12:14:46.906 Info: scan cache updated +Mon Dec 10 12:14:47.158 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:14:47.160 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 12:14:47.160 [channelNumber=7(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:47.160 [channelNumber=8(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:47.160 [channelNumber=9(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:47.160 [channelNumber=10(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:47.160 [channelNumber=11(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:47.160 [channelNumber=12(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:14:47.160 )} took 0.2532 seconds, returned 4 results +Mon Dec 10 12:14:47.161 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:14:47.433 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:14:47.436 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:14:47.437 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 12:14:47.437 [channelNumber=13(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:47.437 [channelNumber=36(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 12:14:47.437 [channelNumber=40(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:14:47.437 [channelNumber=44(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 12:14:47.437 [channelNumber=48(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:14:47.437 [channelNumber=149(5GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:14:47.437 )} took 0.2763 seconds, returned 11 results +Mon Dec 10 12:14:47.778 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:14:47.781 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:14:47.782 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 12:14:47.782 [channelNumber=153(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:14:47.782 [channelNumber=157(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:47.782 [channelNumber=161(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:14:47.782 [channelNumber=165(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:47.782 [channelNumber=52(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 12:14:47.782 [channelNumber=56(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 12:14:47.782 )} took 0.3436 seconds, returned 9 results +Mon Dec 10 12:14:48.052 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:14:48.055 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 12:14:48.055 [channelNumber=60(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 12:14:48.055 [channelNumber=64(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 12:14:48.055 )} took 0.2714 seconds, returned 6 results +Mon Dec 10 12:14:48.055 Info: QUERY SCAN CACHE request received from pid 92 (locationd) diff --git a/tests/fixtures/pr/test_page_range_1.log.expected b/tests/fixtures/pr/test_page_range_1.log.expected new file mode 100644 index 000000000..67fbf88a5 --- /dev/null +++ b/tests/fixtures/pr/test_page_range_1.log.expected @@ -0,0 +1,264 @@ + + +{last_modified_time} test.log Page 15 + + +ntation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.705 Info: 802.1X changed +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.854 Info: 802.1X changed +Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.002 Info: 802.1X changed +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.152 Info: 802.1X changed +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.302 Info: 802.1X changed +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.449 Info: 802.1X changed +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.600 Info: 802.1X changed +Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.749 Info: 802.1X changed +Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.896 Info: 802.1X changed +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.045 Info: 802.1X changed +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.193 Info: 802.1X changed +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.342 Info: 802.1X changed +Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.491 Info: 802.1X changed +Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.640 Info: 802.1X changed +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.805 Info: 802.1X changed +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.958 Info: 802.1X changed +Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.155 Info: 802.1X changed +Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + + + +{last_modified_time} test.log Page 16 + + +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/ProfileID' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/WEP40' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/SSID_STR' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/AirPlay' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/AutoJoinTimestamp' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/BSSID' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/SSID' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/CHANNEL' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/Busy' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/Power Status' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/WEPOPENSYSTEM' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/CachedScanRecord' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/UserMode8021X' +Mon Dec 10 12:06:28.771 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/BusyUI' +Mon Dec 10 12:06:28.945 Info: INTERFACE STATE INFO request received from pid 362 (sharingd) +Mon Dec 10 12:06:28.946 Info: -[CWXPCInterfaceContext __copyMACAddressForInterface:]: MAC address: <82cd0ac3 bf73> +Mon Dec 10 12:06:30.064 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:30.151 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:30.151 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:31.137 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:31.138 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:31.832 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:31.832 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:48.742 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:48.742 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:49.121 P2P: _terminateGroupOwnerTimer: Terminate group owner timer notification received. +Mon Dec 10 12:06:49.267 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:49.267 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:49.793 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:49.793 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.931 Driver Event: _bsd_80211_event_callback: AWDL_REALTIME_MODE_END (awdl0) +Mon Dec 10 12:06:50.931 Driver Event: _bsd_80211_event_callback: AWDL_STATISTICS (awdl0) +Mon Dec 10 12:06:50.932 Info: AWDL real time mode ended +Mon Dec 10 12:06:50.945 BTC: __BluetoothCoexHandleUpdateForNode: Handle Bluetooth Coex: FrequencyBand <2>, Bluetooth Bandwidth Utilization <3>, Clamshell Mode <0> +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexSetProfile: profile for band 2.4GHz didn't change +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexSetProfile: profile for band 5GHz didn't change +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: band = 0x2 +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: hosting AP = NO, assoc as STA = YES, assoced in 2.4GHz = NO +Mon Dec 10 12:06:50.945 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: band = 2 +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexGetCurrentBssidPhyMode: Bluetooth Coex: Active PHY Mode 16. PHY Mode +Mon Dec 10 12:06:50.945 {type = mutable dict, count = 2, +Mon Dec 10 12:06:50.945 entries => +Mon Dec 10 12:06:50.945 0 : {contents = "PHYMODE_ACTIVE"} = {value = +16, type = kCFNumberSInt32Type} +Mon Dec 10 12:06:50.945 1 : {contents = "PHYMODE_SUPPORTED"} = {value = +159, type = kCFNumberSInt32Type} +Mon Dec 10 12:06:50.945 } +Mon Dec 10 12:06:50.945 +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: PHY mode: <10> 5GHz: YES +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ReconfigureAntennas: MCS index set size = 16, NSS = 2SS, need to re-assoc = YES +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: 11bg only = NO, BT on = YES, # HIDs = 0, # A2DP = 0, # SCO = 0, fallback = normal -> Middle Chain is ON +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexSettingPerChainPower: Chain Power Setting does not need to be updated +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ReconfigureAntennas: Skipping REASSOC - The # of chains did not change. +Mon Dec 10 12:06:50.945 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 12:06:50.945 Driver Event: _bsd_80211_event_callback: AWDL_REALTIME_MODE_END (awdl0) +Mon Dec 10 12:06:50.945 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.945 BTC: __BluetoothCoexHandleUpdateForNode: Handle Bluetooth Coex: FrequencyBand <2>, Bluetooth Bandwidth Utilization <3>, Clamshell Mode <0> + + + + + + + +{last_modified_time} test.log Page 17 + + +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexSetProfile: profile for band 2.4GHz didn't change +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexSetProfile: profile for band 5GHz didn't change +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: band = 0x2 +Mon Dec 10 12:06:50.945 Info: AWDL real time mode ended +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: hosting AP = NO, assoc as STA = YES, assoced in 2.4GHz = NO +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: band = 2 +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexGetCurrentBssidPhyMode: Bluetooth Coex: Active PHY Mode 16. PHY Mode +Mon Dec 10 12:06:50.946 {type = mutable dict, count = 2, +Mon Dec 10 12:06:50.946 entries => +Mon Dec 10 12:06:50.946 0 : {contents = "PHYMODE_ACTIVE"} = {value = +16, type = kCFNumberSInt32Type} +Mon Dec 10 12:06:50.946 1 : {contents = "PHYMODE_SUPPORTED"} = {value = +159, type = kCFNumberSInt32Type} +Mon Dec 10 12:06:50.946 } +Mon Dec 10 12:06:50.946 +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: PHY mode: <10> 5GHz: YES +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexHandle_ReconfigureAntennas: MCS index set size = 16, NSS = 2SS, need to re-assoc = YES +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: 11bg only = NO, BT on = YES, # HIDs = 0, # A2DP = 0, # SCO = 0, fallback = normal -> Middle Chain is ON +Mon Dec 10 12:06:50.946 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexSettingPerChainPower: Chain Power Setting does not need to be updated +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexHandle_ReconfigureAntennas: Skipping REASSOC - The # of chains did not change. +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.946 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_SYNC_STATE_CHANGED (awdl0) +Mon Dec 10 12:06:50.947 Info: AWDL ended +Mon Dec 10 12:06:50.951 Info: -[CWXPCInterfaceContext __submitAWDLUsageMetric:duration:]: AWDL usage metric data: CWAWDMetricAwdlUsageData: selfInfraChannel 40, peerInfraChannel 0, numOfPeers 6. Keys: Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90013 +Mon Dec 10 12:06:50.952 Info: INTERFACE STATE INFO request received from pid 362 (sharingd) +Mon Dec 10 12:06:50.952 Info: -[CWXPCInterfaceContext __copyMACAddressForInterface:]: MAC address: <82cd0ac3 bf73> +Mon Dec 10 12:06:50.953 Roam: ROAMING PROFILES updated to AC POWER for 2.4GHz on en0 +Mon Dec 10 12:06:50.953 Roam: ROAMING PROFILES updated to AC POWER for 5GHz on en0 +Mon Dec 10 12:06:53.680 Info: -[CWXPCSubsystem handleDeviceCountMetricQuery:]_block_invoke: DeviceCount metric data: CWAWDMetricDeviceCountData: timeSinceBoot: 1515466.360642, deviceCount: 1 +Mon Dec 10 12:06:53.684 Info: -[CWXPCSubsystem handleNetworkPrefsMetricQuery:]: NetworkPrefs metric data: CWAWDMetricNetworkPrefsData: preferred 15 hidden 0 open 1 wep 0 wpa 12 eap 2 +Mon Dec 10 12:06:53.684 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90004 +Mon Dec 10 12:06:53.852 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90001 +Mon Dec 10 12:06:53.852 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x9000d +Mon Dec 10 12:06:53.852 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x9000b +Mon Dec 10 12:12:03.594 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:12:03.594 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=216 Mbps +Mon Dec 10 12:12:03.595 Info: link quality changed +Mon Dec 10 12:12:09.598 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:12:09.598 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=270 Mbps +Mon Dec 10 12:12:09.599 Info: link quality changed +Mon Dec 10 12:12:56.625 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:12:56.625 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=216 Mbps +Mon Dec 10 12:12:56.625 Info: link quality changed +Mon Dec 10 12:13:01.625 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:13:01.625 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=243 Mbps +Mon Dec 10 12:13:01.626 Info: link quality changed +Mon Dec 10 12:13:06.628 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:13:06.628 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=216 Mbps +Mon Dec 10 12:13:06.628 Info: link quality changed +Mon Dec 10 12:13:27.639 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:13:27.639 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=243 Mbps +Mon Dec 10 12:13:27.640 Info: link quality changed + + + + + + + +{last_modified_time} test.log Page 18 + + +Mon Dec 10 12:14:46.658 Info: SCAN request received from pid 92 (locationd) with priority 2 +Mon Dec 10 12:14:46.902 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:14:46.905 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:14:46.906 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 12:14:46.906 [channelNumber=1(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:46.906 [channelNumber=2(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:46.906 [channelNumber=3(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:46.906 [channelNumber=4(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:46.906 [channelNumber=5(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:46.906 [channelNumber=6(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:14:46.906 )} took 0.2478 seconds, returned 13 results +Mon Dec 10 12:14:46.906 Info: scan cache updated +Mon Dec 10 12:14:47.158 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:14:47.160 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 12:14:47.160 [channelNumber=7(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:47.160 [channelNumber=8(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:47.160 [channelNumber=9(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:47.160 [channelNumber=10(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:47.160 [channelNumber=11(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:47.160 [channelNumber=12(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:14:47.160 )} took 0.2532 seconds, returned 4 results +Mon Dec 10 12:14:47.161 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:14:47.433 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:14:47.436 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:14:47.437 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 12:14:47.437 [channelNumber=13(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:47.437 [channelNumber=36(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 12:14:47.437 [channelNumber=40(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:14:47.437 [channelNumber=44(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 12:14:47.437 [channelNumber=48(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:14:47.437 [channelNumber=149(5GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:14:47.437 )} took 0.2763 seconds, returned 11 results +Mon Dec 10 12:14:47.778 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:14:47.781 Info: QUERY SCAN CACHE request received from pid 92 (locationd) +Mon Dec 10 12:14:47.782 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 12:14:47.782 [channelNumber=153(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:14:47.782 [channelNumber=157(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:47.782 [channelNumber=161(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:14:47.782 [channelNumber=165(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:14:47.782 [channelNumber=52(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 12:14:47.782 [channelNumber=56(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 12:14:47.782 )} took 0.3436 seconds, returned 9 results +Mon Dec 10 12:14:48.052 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) +Mon Dec 10 12:14:48.055 AutoJoin: Successful cache-assisted scan request for locationd with channels {( +Mon Dec 10 12:14:48.055 [channelNumber=60(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 12:14:48.055 [channelNumber=64(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 12:14:48.055 )} took 0.2714 seconds, returned 6 results +Mon Dec 10 12:14:48.055 Info: QUERY SCAN CACHE request received from pid 92 (locationd) + + + + + + + + + + + + + diff --git a/tests/fixtures/pr/test_page_range_2.log.expected b/tests/fixtures/pr/test_page_range_2.log.expected new file mode 100644 index 000000000..d90166b19 --- /dev/null +++ b/tests/fixtures/pr/test_page_range_2.log.expected @@ -0,0 +1,200 @@ + + +{last_modified_time} test.log Page 15 + + +ntation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.705 Info: 802.1X changed +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.854 Info: 802.1X changed +Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.002 Info: 802.1X changed +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.152 Info: 802.1X changed +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.302 Info: 802.1X changed +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.449 Info: 802.1X changed +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.600 Info: 802.1X changed +Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.749 Info: 802.1X changed +Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.896 Info: 802.1X changed +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.045 Info: 802.1X changed +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.193 Info: 802.1X changed +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.342 Info: 802.1X changed +Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.491 Info: 802.1X changed +Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.640 Info: 802.1X changed +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.805 Info: 802.1X changed +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.958 Info: 802.1X changed +Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.155 Info: 802.1X changed +Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + + + +{last_modified_time} test.log Page 16 + + +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/ProfileID' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/WEP40' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/SSID_STR' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/AirPlay' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/AutoJoinTimestamp' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/BSSID' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/SSID' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/CHANNEL' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/Busy' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/Power Status' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/WEPOPENSYSTEM' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/CachedScanRecord' +Mon Dec 10 12:06:28.770 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/UserMode8021X' +Mon Dec 10 12:06:28.771 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Interface/en0/AirPort/BusyUI' +Mon Dec 10 12:06:28.945 Info: INTERFACE STATE INFO request received from pid 362 (sharingd) +Mon Dec 10 12:06:28.946 Info: -[CWXPCInterfaceContext __copyMACAddressForInterface:]: MAC address: <82cd0ac3 bf73> +Mon Dec 10 12:06:30.064 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:30.151 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:30.151 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:31.137 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:31.138 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:31.832 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:31.832 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:48.742 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:48.742 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:49.121 P2P: _terminateGroupOwnerTimer: Terminate group owner timer notification received. +Mon Dec 10 12:06:49.267 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:49.267 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:49.793 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:49.793 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.931 Driver Event: _bsd_80211_event_callback: AWDL_REALTIME_MODE_END (awdl0) +Mon Dec 10 12:06:50.931 Driver Event: _bsd_80211_event_callback: AWDL_STATISTICS (awdl0) +Mon Dec 10 12:06:50.932 Info: AWDL real time mode ended +Mon Dec 10 12:06:50.945 BTC: __BluetoothCoexHandleUpdateForNode: Handle Bluetooth Coex: FrequencyBand <2>, Bluetooth Bandwidth Utilization <3>, Clamshell Mode <0> +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexSetProfile: profile for band 2.4GHz didn't change +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexSetProfile: profile for band 5GHz didn't change +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: band = 0x2 +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: hosting AP = NO, assoc as STA = YES, assoced in 2.4GHz = NO +Mon Dec 10 12:06:50.945 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: band = 2 +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexGetCurrentBssidPhyMode: Bluetooth Coex: Active PHY Mode 16. PHY Mode +Mon Dec 10 12:06:50.945 {type = mutable dict, count = 2, +Mon Dec 10 12:06:50.945 entries => +Mon Dec 10 12:06:50.945 0 : {contents = "PHYMODE_ACTIVE"} = {value = +16, type = kCFNumberSInt32Type} +Mon Dec 10 12:06:50.945 1 : {contents = "PHYMODE_SUPPORTED"} = {value = +159, type = kCFNumberSInt32Type} +Mon Dec 10 12:06:50.945 } +Mon Dec 10 12:06:50.945 +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: PHY mode: <10> 5GHz: YES +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ReconfigureAntennas: MCS index set size = 16, NSS = 2SS, need to re-assoc = YES +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: 11bg only = NO, BT on = YES, # HIDs = 0, # A2DP = 0, # SCO = 0, fallback = normal -> Middle Chain is ON +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexSettingPerChainPower: Chain Power Setting does not need to be updated +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ReconfigureAntennas: Skipping REASSOC - The # of chains did not change. +Mon Dec 10 12:06:50.945 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 12:06:50.945 Driver Event: _bsd_80211_event_callback: AWDL_REALTIME_MODE_END (awdl0) +Mon Dec 10 12:06:50.945 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.945 BTC: __BluetoothCoexHandleUpdateForNode: Handle Bluetooth Coex: FrequencyBand <2>, Bluetooth Bandwidth Utilization <3>, Clamshell Mode <0> + + + + + + + +{last_modified_time} test.log Page 17 + + +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexSetProfile: profile for band 2.4GHz didn't change +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexSetProfile: profile for band 5GHz didn't change +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: band = 0x2 +Mon Dec 10 12:06:50.945 Info: AWDL real time mode ended +Mon Dec 10 12:06:50.945 BTC: BluetoothCoexHandle_ApplyPolicy: Bluetooth Coex: hosting AP = NO, assoc as STA = YES, assoced in 2.4GHz = NO +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: band = 2 +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexGetCurrentBssidPhyMode: Bluetooth Coex: Active PHY Mode 16. PHY Mode +Mon Dec 10 12:06:50.946 {type = mutable dict, count = 2, +Mon Dec 10 12:06:50.946 entries => +Mon Dec 10 12:06:50.946 0 : {contents = "PHYMODE_ACTIVE"} = {value = +16, type = kCFNumberSInt32Type} +Mon Dec 10 12:06:50.946 1 : {contents = "PHYMODE_SUPPORTED"} = {value = +159, type = kCFNumberSInt32Type} +Mon Dec 10 12:06:50.946 } +Mon Dec 10 12:06:50.946 +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: PHY mode: <10> 5GHz: YES +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexHandle_ReconfigureAntennas: MCS index set size = 16, NSS = 2SS, need to re-assoc = YES +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexHandle_ReconfigureAntennas: Bluetooth Coex: 11bg only = NO, BT on = YES, # HIDs = 0, # A2DP = 0, # SCO = 0, fallback = normal -> Middle Chain is ON +Mon Dec 10 12:06:50.946 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexSettingPerChainPower: Chain Power Setting does not need to be updated +Mon Dec 10 12:06:50.946 BTC: BluetoothCoexHandle_ReconfigureAntennas: Skipping REASSOC - The # of chains did not change. +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.946 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_PEER_PRESENCE (awdl0) +Mon Dec 10 12:06:50.946 Driver Event: _bsd_80211_event_callback: AWDL_SYNC_STATE_CHANGED (awdl0) +Mon Dec 10 12:06:50.947 Info: AWDL ended +Mon Dec 10 12:06:50.951 Info: -[CWXPCInterfaceContext __submitAWDLUsageMetric:duration:]: AWDL usage metric data: CWAWDMetricAwdlUsageData: selfInfraChannel 40, peerInfraChannel 0, numOfPeers 6. Keys: Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90013 +Mon Dec 10 12:06:50.952 Info: INTERFACE STATE INFO request received from pid 362 (sharingd) +Mon Dec 10 12:06:50.952 Info: -[CWXPCInterfaceContext __copyMACAddressForInterface:]: MAC address: <82cd0ac3 bf73> +Mon Dec 10 12:06:50.953 Roam: ROAMING PROFILES updated to AC POWER for 2.4GHz on en0 +Mon Dec 10 12:06:50.953 Roam: ROAMING PROFILES updated to AC POWER for 5GHz on en0 +Mon Dec 10 12:06:53.680 Info: -[CWXPCSubsystem handleDeviceCountMetricQuery:]_block_invoke: DeviceCount metric data: CWAWDMetricDeviceCountData: timeSinceBoot: 1515466.360642, deviceCount: 1 +Mon Dec 10 12:06:53.684 Info: -[CWXPCSubsystem handleNetworkPrefsMetricQuery:]: NetworkPrefs metric data: CWAWDMetricNetworkPrefsData: preferred 15 hidden 0 open 1 wep 0 wpa 12 eap 2 +Mon Dec 10 12:06:53.684 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90004 +Mon Dec 10 12:06:53.852 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90001 +Mon Dec 10 12:06:53.852 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x9000d +Mon Dec 10 12:06:53.852 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x9000b +Mon Dec 10 12:12:03.594 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:12:03.594 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=216 Mbps +Mon Dec 10 12:12:03.595 Info: link quality changed +Mon Dec 10 12:12:09.598 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:12:09.598 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=270 Mbps +Mon Dec 10 12:12:09.599 Info: link quality changed +Mon Dec 10 12:12:56.625 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:12:56.625 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=216 Mbps +Mon Dec 10 12:12:56.625 Info: link quality changed +Mon Dec 10 12:13:01.625 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:13:01.625 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=243 Mbps +Mon Dec 10 12:13:01.626 Info: link quality changed +Mon Dec 10 12:13:06.628 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:13:06.628 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=216 Mbps +Mon Dec 10 12:13:06.628 Info: link quality changed +Mon Dec 10 12:13:27.639 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:13:27.639 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=243 Mbps +Mon Dec 10 12:13:27.640 Info: link quality changed + + + + + + + diff --git a/tests/test_pr.rs b/tests/test_pr.rs index fb4523c0c..da0785839 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -26,7 +26,7 @@ fn test_without_any_options() { scenario .args(&[test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![("{last_modified_time}".to_string(), value)]); + .stdout_is_templated_fixture(expected_test_file_path, vec![(&"{last_modified_time}".to_string(), &value)]); } #[test] @@ -38,7 +38,7 @@ fn test_with_numbering_option() { scenario .args(&["-n", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![("{last_modified_time}".to_string(), value)]); + .stdout_is_templated_fixture(expected_test_file_path, vec![(&"{last_modified_time}".to_string(), &value)]); } #[test] @@ -50,7 +50,7 @@ fn test_with_numbering_option_when_content_is_less_than_page() { scenario .args(&["-n", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![("{last_modified_time}".to_string(), value)]); + .stdout_is_templated_fixture(expected_test_file_path, vec![(&"{last_modified_time}".to_string(), &value)]); } #[test] @@ -62,7 +62,7 @@ fn test_with_numbering_option_with_number_width() { scenario .args(&["-n", "2", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![("{last_modified_time}".to_string(), value)]); + .stdout_is_templated_fixture(expected_test_file_path, vec![(&"{last_modified_time}".to_string(), &value)]); } #[test] @@ -76,8 +76,8 @@ fn test_with_header_option() { .args(&["-h", header, test_file_path]) .succeeds() .stdout_is_templated_fixture(expected_test_file_path, vec![ - ("{last_modified_time}".to_string(), value), - ("{header}".to_string(), header.to_string()) + (&"{last_modified_time}".to_string(), &value), + (&"{header}".to_string(), &header.to_string()) ]); } @@ -92,8 +92,8 @@ fn test_with_long_header_option() { .args(&["--header=new file", test_file_path]) .succeeds() .stdout_is_templated_fixture(expected_test_file_path, vec![ - ("{last_modified_time}".to_string(), value), - ("{header}".to_string(), header.to_string()) + (&"{last_modified_time}".to_string(), &value), + (&"{header}".to_string(), &header.to_string()) ]); } @@ -107,7 +107,7 @@ fn test_with_double_space_option() { .args(&["-d", test_file_path]) .succeeds() .stdout_is_templated_fixture(expected_test_file_path, vec![ - ("{last_modified_time}".to_string(), value), + (&"{last_modified_time}".to_string(), &value), ]); } @@ -121,7 +121,7 @@ fn test_with_long_double_space_option() { .args(&["--double-space", test_file_path]) .succeeds() .stdout_is_templated_fixture(expected_test_file_path, vec![ - ("{last_modified_time}".to_string(), value), + (&"{last_modified_time}".to_string(), &value), ]); } @@ -135,7 +135,7 @@ fn test_with_first_line_number_option() { .args(&["-N", "5", "-n", test_file_path]) .succeeds() .stdout_is_templated_fixture(expected_test_file_path, vec![ - ("{last_modified_time}".to_string(), value), + (&"{last_modified_time}".to_string(), &value), ]); } @@ -149,7 +149,7 @@ fn test_with_first_line_number_long_option() { .args(&["--first-line-number=5", "-n", test_file_path]) .succeeds() .stdout_is_templated_fixture(expected_test_file_path, vec![ - ("{last_modified_time}".to_string(), value), + (&"{last_modified_time}".to_string(), &value), ]); } @@ -163,7 +163,7 @@ fn test_with_number_option_with_custom_separator_char() { .args(&["-nc", test_file_path]) .succeeds() .stdout_is_templated_fixture(expected_test_file_path, vec![ - ("{last_modified_time}".to_string(), value), + (&"{last_modified_time}".to_string(), &value), ]); } @@ -177,6 +177,60 @@ fn test_with_number_option_with_custom_separator_char_and_width() { .args(&["-nc1", test_file_path]) .succeeds() .stdout_is_templated_fixture(expected_test_file_path, vec![ - ("{last_modified_time}".to_string(), value), + (&"{last_modified_time}".to_string(), &value), + ]); +} + +#[test] +fn test_valid_page_ranges() { + let test_file_path = "test_num_page.log"; + let mut scenario = new_ucmd!(); + scenario + .args(&["--pages=20:5", test_file_path]) + .fails() + .stderr_is("pr: invalid --pages argument '20:5'") + .stdout_is(""); + new_ucmd!() + .args(&["--pages=1:5", test_file_path]) + .succeeds(); + new_ucmd!() + .args(&["--pages=1", test_file_path]) + .succeeds(); + new_ucmd!() + .args(&["--pages=-1:5", test_file_path]) + .fails() + .stderr_is("pr: invalid --pages argument '-1:5'") + .stdout_is(""); + new_ucmd!() + .args(&["--pages=1:-5", test_file_path]) + .fails() + .stderr_is("pr: invalid --pages argument '1:-5'") + .stdout_is(""); + new_ucmd!() + .args(&["--pages=5:1", test_file_path]) + .fails() + .stderr_is("pr: invalid --pages argument '5:1'") + .stdout_is(""); + +} + +#[test] +fn test_page_range() { + let test_file_path = "test.log"; + let expected_test_file_path = "test_page_range_1.log.expected"; + let expected_test_file_path1 = "test_page_range_2.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["--pages=15", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + (&"{last_modified_time}".to_string(), &value), + ]); + new_ucmd!() + .args(&["--pages=15:17", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path1, vec![ + (&"{last_modified_time}".to_string(), &value), ]); } \ No newline at end of file From b578bb6563e01da21c97f7987d51dda1b3f74840 Mon Sep 17 00:00:00 2001 From: Tilak Patidar Date: Sun, 16 Dec 2018 22:54:09 +0530 Subject: [PATCH 0150/1135] pr: add test for -t -l -r option pr: Add test for -l option pr: Add test for -r suppress error option --- src/pr/pr.rs | 24 ++- .../pr/test_one_page_no_ht.log.expected | 56 +++++ .../fixtures/pr/test_page_length.log.expected | 200 ++++++++++++++++++ .../pr/test_page_length1.log.expected | 10 + tests/test_pr.rs | 49 ++++- 5 files changed, 327 insertions(+), 12 deletions(-) create mode 100644 tests/fixtures/pr/test_one_page_no_ht.log.expected create mode 100644 tests/fixtures/pr/test_page_length.log.expected create mode 100644 tests/fixtures/pr/test_page_length1.log.expected diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 08681c0de..1cc81bfe2 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -302,7 +302,7 @@ pub fn uumain(args: Vec) -> i32 { let maybe_file = matches.opt_str(NUMBERING_MODE_OPTION).unwrap(); let is_afile = is_a_file(&maybe_file); if !is_afile { - writeln!(&mut stderr(), "{}", PrError::NotExists(maybe_file)); + print_error(&matches, PrError::NotExists(maybe_file)); return 1; } else { files.push(maybe_file); @@ -321,15 +321,13 @@ pub fn uumain(args: Vec) -> i32 { for f in files { let result_options = build_options(&matches, &f); if result_options.is_err() { - writeln!(&mut stderr(), "{}", result_options.err().unwrap()); + print_error(&matches, result_options.err().unwrap()); return 1; } let options = &result_options.unwrap(); let status: i32 = match pr(&f, options) { Err(error) => { - if !options.suppress_errors { - writeln!(&mut stderr(), "{}", error); - } + print_error(&matches, error); 1 } _ => 0 @@ -345,6 +343,12 @@ fn is_a_file(could_be_file: &String) -> bool { File::open(could_be_file).is_ok() } +fn print_error(matches: &Matches, err: PrError) { + if !matches.opt_present(SUPPRESS_PRINTING_ERROR) { + writeln!(&mut stderr(), "{}", err); + } +} + fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { println!("{} {} -- print files", NAME, VERSION); println!(); @@ -476,11 +480,15 @@ fn build_options(matches: &Matches, path: &String) -> Result res?, _ => LINES_PER_PAGE }; + let page_length_le_ht = page_length < (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE); - let content_lines_per_page = page_length - (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE); + let display_header_and_trailer = !(page_length_le_ht) && !matches.opt_present(NO_HEADER_TRAILER_OPTION); - let display_header_and_trailer = !(page_length < (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE)) - && !matches.opt_present(NO_HEADER_TRAILER_OPTION); + let content_lines_per_page = if page_length_le_ht { + page_length + } else { + page_length - (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE) + }; let suppress_errors = matches.opt_present(SUPPRESS_PRINTING_ERROR); diff --git a/tests/fixtures/pr/test_one_page_no_ht.log.expected b/tests/fixtures/pr/test_one_page_no_ht.log.expected new file mode 100644 index 000000000..3d5131358 --- /dev/null +++ b/tests/fixtures/pr/test_one_page_no_ht.log.expected @@ -0,0 +1,56 @@ +ntation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.705 Info: 802.1X changed +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.854 Info: 802.1X changed +Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.002 Info: 802.1X changed +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.152 Info: 802.1X changed +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.302 Info: 802.1X changed +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.449 Info: 802.1X changed +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.600 Info: 802.1X changed +Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.749 Info: 802.1X changed +Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.896 Info: 802.1X changed +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.045 Info: 802.1X changed +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.193 Info: 802.1X changed +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.342 Info: 802.1X changed +Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.491 Info: 802.1X changed +Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.640 Info: 802.1X changed +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.805 Info: 802.1X changed +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.958 Info: 802.1X changed +Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.155 Info: 802.1X changed +Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.352 Info: 802.1X changed \ No newline at end of file diff --git a/tests/fixtures/pr/test_page_length.log.expected b/tests/fixtures/pr/test_page_length.log.expected new file mode 100644 index 000000000..02425a8e6 --- /dev/null +++ b/tests/fixtures/pr/test_page_length.log.expected @@ -0,0 +1,200 @@ + + +{last_modified_time} test.log Page 2 + + + 1 ntation processAirPortStateChanges]: pppConnectionState 0 + 2 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 3 Mon Dec 10 11:42:56.705 Info: 802.1X changed + 4 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 5 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 6 Mon Dec 10 11:42:56.854 Info: 802.1X changed + 7 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 8 Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 9 Mon Dec 10 11:42:57.002 Info: 802.1X changed + 10 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 11 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 12 Mon Dec 10 11:42:57.152 Info: 802.1X changed + 13 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 14 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 15 Mon Dec 10 11:42:57.302 Info: 802.1X changed + 16 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 17 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 18 Mon Dec 10 11:42:57.449 Info: 802.1X changed + 19 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 20 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 21 Mon Dec 10 11:42:57.600 Info: 802.1X changed + 22 Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 23 Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 24 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 25 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 26 Mon Dec 10 11:42:57.749 Info: 802.1X changed + 27 Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 28 Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 29 Mon Dec 10 11:42:57.896 Info: 802.1X changed + 30 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 31 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 32 Mon Dec 10 11:42:58.045 Info: 802.1X changed + 33 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 34 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 35 Mon Dec 10 11:42:58.193 Info: 802.1X changed + 36 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 37 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 38 Mon Dec 10 11:42:58.342 Info: 802.1X changed + 39 Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 40 Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 41 Mon Dec 10 11:42:58.491 Info: 802.1X changed + 42 Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 43 Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 44 Mon Dec 10 11:42:58.640 Info: 802.1X changed + 45 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 46 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 47 Mon Dec 10 11:42:58.805 Info: 802.1X changed + 48 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 49 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 50 Mon Dec 10 11:42:58.958 Info: 802.1X changed + 51 Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 52 Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 53 Mon Dec 10 11:42:59.155 Info: 802.1X changed + 54 Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 55 Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 56 Mon Dec 10 11:42:59.352 Info: 802.1X changed + 57 Mon Dec 10 11:42:59.354 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 58 Mon Dec 10 11:42:59.354 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 59 Mon Dec 10 11:42:59.372 Driver Event: _bsd_80211_event_callback: APPLE80211_M_ROAM_END (en0) + 60 Mon Dec 10 11:42:59.372 Info: Roaming ended on interface en0 + 61 Mon Dec 10 11:42:59.372 Driver Event: _bsd_80211_event_callback: RSN_HANDSHAKE_DONE (en0) + 62 Mon Dec 10 11:42:59.373 Info: -[CWXPCInterfaceContext setRoamInProgress:reason:]_block_invoke: roam status metric data: CWAWDMetricRoamStatus: status:0 security: 4 profile:5 origin:<34fcb9>(-69) target:<6cf37f>(-56) latency:6.083439s + 63 Mon Dec 10 11:42:59.373 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90046 + 64 Mon Dec 10 11:42:59.373 Info: RESUME AWDL for interface en0, reason=Roam token=2685 + 65 Mon Dec 10 11:42:59.373 Info: PRIORITY LOCK REMOVED [client=airportd, type=4, interface=en0, priority=5] + 66 Mon Dec 10 11:42:59.374 Info: -[CWXPCInterfaceContext __setAWDLOperatingMode:interface:error:]: attempting to set AWDL mode to 0 + 67 Mon Dec 10 11:43:01.072 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Service/18E14EA7-4641-4104-B315-A9315814912A/DHCP' + 68 Mon Dec 10 11:43:01.072 SC: _processDHCPChanges: State:/Network/Service/18E14EA7-4641-4104-B315-A9315814912A/DHCP + 69 Mon Dec 10 11:43:01.072 SC: _processDHCPChanges: DHCP airport_changed = 1 + 70 Mon Dec 10 11:43:01.073 Info: -[CWXPCSubsystem internal_submitIPConfigLatencyMetric:leaseDuration:]: IPConfig Latency metric data: CWAWDMetricIPConfigLatencyData: DHCP latency: 29010 msecs, duration: 480 mins, security: 4 + 71 Mon Dec 10 11:43:01.073 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90007 + 72 Mon Dec 10 11:43:01.073 SC: _setDHCPMessage: dhcpInfoKey "State:/Network/Interface/en0/AirPort/DHCP Message" = (null) + 73 Mon Dec 10 11:43:10.369 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) + 74 Mon Dec 10 11:43:10.369 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=162 Mbps + 75 Mon Dec 10 11:43:10.369 Info: link quality changed + 76 Mon Dec 10 11:43:23.376 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) + 77 Mon Dec 10 11:43:23.377 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=243 Mbps + 78 Mon Dec 10 11:43:23.377 Info: link quality changed + 79 Mon Dec 10 11:43:28.380 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) + 80 Mon Dec 10 11:43:28.380 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=216 Mbps + 81 Mon Dec 10 11:43:28.380 Info: link quality changed + 82 Mon Dec 10 11:43:31.744 AutoJoin: BACKGROUND SCAN request on interface en0 with SSID list (null) + 83 Mon Dec 10 11:43:31.747 Scan: Cache-assisted scan request on channel 1 does not require a live scan + 84 Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 2 does not require a live scan + 85 Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 3 does not require a live scan + 86 Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request does not require a live scan + 87 Mon Dec 10 11:43:31.748 AutoJoin: Successful cache-assisted background scan request with channels {( + 88 Mon Dec 10 11:43:31.748 [channelNumber=1(2GHz), channelWidth={20MHz}, active], + 89 Mon Dec 10 11:43:31.748 [channelNumber=2(2GHz), channelWidth={20MHz}, active], + 90 Mon Dec 10 11:43:31.748 [channelNumber=3(2GHz), channelWidth={20MHz}, active] + + + + + + + +{last_modified_time} test.log Page 3 + + + 91 Mon Dec 10 11:52:32.715 AutoJoin: Successful cache-assisted scan request for locationd with channels {( + 92 Mon Dec 10 11:52:32.715 [channelNumber=7(2GHz), channelWidth={20MHz}, active], + 93 Mon Dec 10 11:52:32.715 [channelNumber=8(2GHz), channelWidth={20MHz}, active], + 94 Mon Dec 10 11:52:32.715 [channelNumber=9(2GHz), channelWidth={20MHz}, active], + 95 Mon Dec 10 11:52:32.715 [channelNumber=10(2GHz), channelWidth={20MHz}, active], + 96 Mon Dec 10 11:52:32.715 [channelNumber=11(2GHz), channelWidth={20MHz}, active], + 97 Mon Dec 10 11:52:32.715 [channelNumber=12(2GHz), channelWidth={20MHz}, active] + 98 Mon Dec 10 11:52:32.715 )} took 0.2636 seconds, returned 10 results + 99 Mon Dec 10 11:52:32.994 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) + 100 Mon Dec 10 11:52:32.997 Info: QUERY SCAN CACHE request received from pid 92 (locationd) + 101 Mon Dec 10 11:52:32.998 AutoJoin: Successful cache-assisted scan request for locationd with channels {( + 102 Mon Dec 10 11:52:32.998 [channelNumber=13(2GHz), channelWidth={20MHz}, active], + 103 Mon Dec 10 11:52:32.998 [channelNumber=36(5GHz), channelWidth={40MHz(+1)}, active], + 104 Mon Dec 10 11:52:32.998 [channelNumber=40(5GHz), channelWidth={40MHz(-1)}, active], + 105 Mon Dec 10 11:52:32.998 [channelNumber=44(5GHz), channelWidth={40MHz(+1)}, active], + 106 Mon Dec 10 11:52:32.998 [channelNumber=48(5GHz), channelWidth={40MHz(-1)}, active], + 107 Mon Dec 10 11:52:32.998 [channelNumber=149(5GHz), channelWidth={20MHz}, active] + 108 Mon Dec 10 11:52:32.998 )} took 0.2822 seconds, returned 14 results + 109 Mon Dec 10 11:52:33.405 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) + 110 Mon Dec 10 11:52:33.408 Info: QUERY SCAN CACHE request received from pid 92 (locationd) + 111 Mon Dec 10 11:52:33.409 AutoJoin: Successful cache-assisted scan request for locationd with channels {( + 112 Mon Dec 10 11:52:33.409 [channelNumber=153(5GHz), channelWidth={40MHz(-1)}, active], + 113 Mon Dec 10 11:52:33.409 [channelNumber=157(5GHz), channelWidth={20MHz}, active], + 114 Mon Dec 10 11:52:33.409 [channelNumber=161(5GHz), channelWidth={40MHz(-1)}, active], + 115 Mon Dec 10 11:52:33.409 [channelNumber=165(5GHz), channelWidth={20MHz}, active], + 116 Mon Dec 10 11:52:33.409 [channelNumber=52(5GHz), channelWidth={40MHz(+1)}, DFS], + 117 Mon Dec 10 11:52:33.409 [channelNumber=56(5GHz), channelWidth={40MHz(-1)}, DFS] + 118 Mon Dec 10 11:52:33.409 )} took 0.4099 seconds, returned 11 results + 119 Mon Dec 10 11:52:33.669 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) + 120 Mon Dec 10 11:52:33.672 Info: QUERY SCAN CACHE request received from pid 92 (locationd) + 121 Mon Dec 10 11:52:33.672 AutoJoin: Successful cache-assisted scan request for locationd with channels {( + 122 Mon Dec 10 11:52:33.672 [channelNumber=60(5GHz), channelWidth={40MHz(+1)}, DFS], + 123 Mon Dec 10 11:52:33.672 [channelNumber=64(5GHz), channelWidth={40MHz(-1)}, DFS] + 124 Mon Dec 10 11:52:33.672 )} took 0.2625 seconds, returned 8 results + 125 Mon Dec 10 11:52:33.673 Info: scan cache updated + 126 Mon Dec 10 11:52:33.693 Info: SCAN request received from pid 92 (locationd) with priority 2 + 127 Mon Dec 10 11:52:33.693 Scan: locationd requested a live scan less than 10 seconds after previous request (1.4991s) returning cached scan results + 128 Mon Dec 10 11:52:33.728 Info: SCAN request received from pid 92 (locationd) with priority 2 + 129 Mon Dec 10 11:52:33.728 Scan: locationd requested a live scan less than 10 seconds after previous request (1.5339s) returning cached scan results + 130 Mon Dec 10 11:55:47.609 Driver Discovery: _PMConnectionHandler: caps = CPU Net Disk + 131 Mon Dec 10 11:55:47.609 Driver Discovery: _PMConnectionHandler: Being put into maintenance wake mode while fully awake. + 132 Mon Dec 10 11:55:47.610 Info: psCallback: powerSource = AC Power + 133 Mon Dec 10 11:55:47.610 Info: psCallback: set powersave disabled on en0 + 134 Mon Dec 10 11:55:47.637 Info: RELINQUISH BT PAGING LOCK request received from pid 106 (bluetoothd) + 135 Mon Dec 10 11:55:47.637 Info: RELINQUISH BT PAGING LOCK request received from pid 106 (bluetoothd) + 136 Mon Dec 10 11:55:47.638 BTC: BT PAGING state already set to 0 + 137 Mon Dec 10 11:55:47.638 BTC: BT PAGING state already set to 0 + 138 Mon Dec 10 11:55:47.638 Info: BT PAGING LOCK RELINQUISHED after 0.0 seconds + 139 Mon Dec 10 11:55:47.638 Info: BT PAGING LOCK RELINQUISHED after 0.0 seconds + 140 Mon Dec 10 11:55:47.638 Info: BT PAGING LOCK RELINQUISHED, re-enabling deferred WiFi requests + 141 Mon Dec 10 11:55:47.638 Info: BT PAGING LOCK RELINQUISHED, re-enabling deferred WiFi requests + 142 Mon Dec 10 11:55:48.093 IPC: ADDED XPC CLIENT CONNECTION [loginwindow (pid=101, euid=1651299376, egid=604256670)] + 143 Mon Dec 10 11:55:48.093 Info: START MONITORING EVENT request received from pid 101 (loginwindow) + 144 Mon Dec 10 11:55:48.093 Info: START MONITORING EVENT request received from pid 101 (loginwindow) + 145 Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) + 146 Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) + 147 Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) + 148 Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) + 149 Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) + 150 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) + 151 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) + 152 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) + 153 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) + 154 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) + 155 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) + 156 Mon Dec 10 11:55:48.105 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) + 157 Mon Dec 10 11:56:07.629 Driver Discovery: _PMConnectionHandler: caps = + 158 Mon Dec 10 11:56:07.629 AutoJoin: BEST CONNECTED SCAN CANCELLED on interface en0 + 159 Mon Dec 10 11:56:07.629 AutoJoin: BACKGROUND SCAN CANCELLED on interface en0 + 160 Mon Dec 10 11:56:07.629 AutoJoin: Auto-join retry cancelled on interface en0 + 161 Mon Dec 10 11:56:07.629 Offload: _tcpKeepAliveActive: TCP keep-alive is active. + 162 Mon Dec 10 11:56:07.637 P2P: _changeInterfaceFlags: Marking p2p0 down + 163 Mon Dec 10 11:56:07.637 Info: SleepAcknowledgementCheckForHostAP: Checking sleep readiness for HostAP + 164 Mon Dec 10 11:56:07.637 SleepAcknowledgementCheck: Checking sleep readiness + 165 Mon Dec 10 11:56:07.637 SleepAcknowledgementCheck: Delaying sleep acknowledgement because of VifUp + 166 Mon Dec 10 11:56:07.638 _interfaceFlagsChanged: KEV_DL_SIFFLAGS received for p2p0 [flags=0xffff8802 (down)]. + 167 Mon Dec 10 11:56:07.638 _interfaceFlagsChanged: Flags changed for p2p0 (0xffff8843 -> 0xffff8802) (down). + 168 Mon Dec 10 11:56:07.638 P2P: _deviceInterfaceMarkedDown: p2p0 marked down + 169 Mon Dec 10 11:56:07.638 P2P: _removeTimeoutForActionAndParam: Attempting to remove 'Stop GO' action (param = 0x0) + 170 Mon Dec 10 11:56:07.638 P2P: _removeTimeoutForActionAndParam: Attempting to remove 'Scan' action (param = 0x0) + 171 Mon Dec 10 11:56:07.638 P2P: _p2pSupervisorEventRunLoopCallback: Mark down complete for p2p0 + 172 Mon Dec 10 11:56:07.638 SleepAcknowledgementCheck: Checking sleep readiness + 173 Mon Dec 10 11:56:07.638 WoW: SleepAcknowledgementCheck: Checking if auto-join is in progress before sleep acknowledgement + 174 Mon Dec 10 11:56:07.638 WoW: SleepAcknowledgementDelayForAutoJoinAttempt_block_invoke: AUTO-JOIN attempt complete for en0, re-checking sleep readiness + 175 Mon Dec 10 11:56:07.638 SleepAcknowledgementCheck: Checking sleep readiness + 176 Mon Dec 10 11:56:07.639 WoW: _wowEnabled: WoW is active on en0 + 177 Mon Dec 10 11:56:07.639 WoW: wowExchangeRequiredForNode: WoW exchange not required for en0 + 178 Mon Dec 10 11:56:07.639 _acknowledgeSleepEvent: Acknowledging sleep event + 179 Mon Dec 10 11:56:07.639 Info: PRIORITY LOCK ADDED [client=airportd, type=4, interface=(null), priority=7] + 180 Mon Dec 10 11:56:07.640 AutoJoin: Auto-join retry cancelled on interface en0 + + + + + diff --git a/tests/fixtures/pr/test_page_length1.log.expected b/tests/fixtures/pr/test_page_length1.log.expected new file mode 100644 index 000000000..7162fe499 --- /dev/null +++ b/tests/fixtures/pr/test_page_length1.log.expected @@ -0,0 +1,10 @@ + 1 ntation processAirPortStateChanges]: pppConnectionState 0 + 2 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 3 Mon Dec 10 11:42:56.705 Info: 802.1X changed + 4 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 5 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 6 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 7 Mon Dec 10 11:42:57.152 Info: 802.1X changed + 8 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 9 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 10 Mon Dec 10 11:42:57.302 Info: 802.1X changed \ No newline at end of file diff --git a/tests/test_pr.rs b/tests/test_pr.rs index da0785839..6063e569b 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -182,7 +182,7 @@ fn test_with_number_option_with_custom_separator_char_and_width() { } #[test] -fn test_valid_page_ranges() { +fn test_with_valid_page_ranges() { let test_file_path = "test_num_page.log"; let mut scenario = new_ucmd!(); scenario @@ -211,11 +211,10 @@ fn test_valid_page_ranges() { .fails() .stderr_is("pr: invalid --pages argument '5:1'") .stdout_is(""); - } #[test] -fn test_page_range() { +fn test_with_page_range() { let test_file_path = "test.log"; let expected_test_file_path = "test_page_range_1.log.expected"; let expected_test_file_path1 = "test_page_range_2.log.expected"; @@ -233,4 +232,46 @@ fn test_page_range() { .stdout_is_templated_fixture(expected_test_file_path1, vec![ (&"{last_modified_time}".to_string(), &value), ]); -} \ No newline at end of file +} + +#[test] +fn test_with_no_header_trailer_option() { + let test_file_path = "test_one_page.log"; + let expected_test_file_path = "test_one_page_no_ht.log.expected"; + let mut scenario = new_ucmd!(); + scenario + .args(&["-t", test_file_path]) + .succeeds() + .stdout_is_fixture(expected_test_file_path); +} + +#[test] +fn test_with_page_length_option() { + let test_file_path = "test.log"; + let expected_test_file_path = "test_page_length.log.expected"; + let expected_test_file_path1 = "test_page_length1.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["--pages=2:3", "-l", "100", "-n", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + (&"{last_modified_time}".to_string(), &value), + ]); + + new_ucmd!() + .args(&["--pages=2:3", "-l", "5", "-n", test_file_path]) + .succeeds() + .stdout_is_fixture(expected_test_file_path1); +} + +#[test] +fn test_with_suppress_error_option() { + let test_file_path = "test_num_page.log"; + let mut scenario = new_ucmd!(); + scenario + .args(&["--pages=20:5", "-r", test_file_path]) + .fails() + .stderr_is("") + .stdout_is(""); +} From f3676573b5ee21162aad3b359517b228198ffb50 Mon Sep 17 00:00:00 2001 From: Tilak Patidar Date: Mon, 17 Dec 2018 12:40:35 +0530 Subject: [PATCH 0151/1135] pr: print padded string for each column and handle tab issues pr: Print fixed padded string for each column pr: Fix display length vs str length due to tabs --- src/pr/pr.rs | 40 +++- .../fixtures/pr/test_page_length.log.expected | 180 +++++++++--------- .../pr/test_page_length1.log.expected | 12 +- .../pr/test_page_range_1.log.expected | 112 +++++------ .../pr/test_page_range_2.log.expected | 114 ++++++----- 5 files changed, 239 insertions(+), 219 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 1cc81bfe2..ef5358255 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -27,9 +27,11 @@ use std::convert::From; use getopts::HasArg; use getopts::Occur; use std::num::ParseIntError; +use std::str::Chars; static NAME: &str = "pr"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static TAB: char = '\t'; static LINES_PER_PAGE: usize = 66; static HEADER_LINES_PER_PAGE: usize = 5; static TRAILER_LINES_PER_PAGE: usize = 5; @@ -684,7 +686,7 @@ fn write_columns(lines: &Vec, options: &OutputOptions, out: &mut Stdout, for start in 0..content_lines_per_page { let indexes: Vec = get_indexes(start, content_lines_per_page, columns); - let mut line = String::new(); + let mut line: Vec = Vec::new(); for index in indexes { if lines.get(index).is_none() { break; @@ -693,13 +695,13 @@ fn write_columns(lines: &Vec, options: &OutputOptions, out: &mut Stdout, let next_line_number = line_number + index + 1; let trimmed_line = get_line_for_printing( next_line_number, &width, - &number_separator, columns, - col_sep, col_width, + &number_separator, columns, col_width, read_line, is_number_mode); - line.push_str(&trimmed_line); + line.push(trimmed_line); i += 1; } - out.write(line.as_bytes())?; + + out.write(line.join(col_sep).as_bytes())?; if i == lines.len() { out.write(page_separator)?; } else { @@ -710,17 +712,37 @@ fn write_columns(lines: &Vec, options: &OutputOptions, out: &mut Stdout, } fn get_line_for_printing(line_number: usize, width: &usize, - separator: &String, columns: usize, col_sep: &String, col_width: Option, + separator: &String, columns: usize, + col_width: Option, read_line: &String, is_number_mode: bool) -> String { let fmtd_line_number: String = if is_number_mode { get_fmtd_line_number(&width, line_number, &separator) } else { "".to_string() }; - let complete_line = format!("{}{}{}", fmtd_line_number, read_line, col_sep); + let mut complete_line = format!("{}{}", fmtd_line_number, read_line); + + let tab_count: usize = complete_line + .chars() + .filter(|i| i == &TAB) + .count(); + + let display_length = complete_line.len() + (tab_count * 7); // TODO Adjust the width according to -n option - // TODO Line has less content than the column width - col_width.map(|i| complete_line.chars().take(i / columns).collect()).unwrap_or(complete_line) + // TODO actual len of the string vs display len of string because of tabs + col_width.map(|i| { + let min_width = (i - (columns - 1)) / columns; + if display_length < min_width { + for _i in 0..(min_width - display_length) { + complete_line.push(' '); + } + } + + complete_line + .chars() + .take(min_width) + .collect() + }).unwrap_or(complete_line) } fn get_indexes(start: usize, content_lines_per_page: usize, columns: usize) -> Vec { diff --git a/tests/fixtures/pr/test_page_length.log.expected b/tests/fixtures/pr/test_page_length.log.expected index 02425a8e6..412f53a77 100644 --- a/tests/fixtures/pr/test_page_length.log.expected +++ b/tests/fixtures/pr/test_page_length.log.expected @@ -3,96 +3,96 @@ {last_modified_time} test.log Page 2 - 1 ntation processAirPortStateChanges]: pppConnectionState 0 - 2 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 3 Mon Dec 10 11:42:56.705 Info: 802.1X changed - 4 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 5 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 6 Mon Dec 10 11:42:56.854 Info: 802.1X changed - 7 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 8 Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 9 Mon Dec 10 11:42:57.002 Info: 802.1X changed - 10 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 11 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 12 Mon Dec 10 11:42:57.152 Info: 802.1X changed - 13 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 14 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 15 Mon Dec 10 11:42:57.302 Info: 802.1X changed - 16 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 17 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 18 Mon Dec 10 11:42:57.449 Info: 802.1X changed - 19 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 20 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 21 Mon Dec 10 11:42:57.600 Info: 802.1X changed - 22 Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 23 Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 24 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 25 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 26 Mon Dec 10 11:42:57.749 Info: 802.1X changed - 27 Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 28 Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 29 Mon Dec 10 11:42:57.896 Info: 802.1X changed - 30 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 31 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 32 Mon Dec 10 11:42:58.045 Info: 802.1X changed - 33 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 34 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 35 Mon Dec 10 11:42:58.193 Info: 802.1X changed - 36 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 37 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 38 Mon Dec 10 11:42:58.342 Info: 802.1X changed - 39 Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 40 Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 41 Mon Dec 10 11:42:58.491 Info: 802.1X changed - 42 Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 43 Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 44 Mon Dec 10 11:42:58.640 Info: 802.1X changed - 45 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 46 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 47 Mon Dec 10 11:42:58.805 Info: 802.1X changed - 48 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 49 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 50 Mon Dec 10 11:42:58.958 Info: 802.1X changed - 51 Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 52 Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 53 Mon Dec 10 11:42:59.155 Info: 802.1X changed - 54 Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 55 Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 56 Mon Dec 10 11:42:59.352 Info: 802.1X changed - 57 Mon Dec 10 11:42:59.354 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 58 Mon Dec 10 11:42:59.354 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 59 Mon Dec 10 11:42:59.372 Driver Event: _bsd_80211_event_callback: APPLE80211_M_ROAM_END (en0) - 60 Mon Dec 10 11:42:59.372 Info: Roaming ended on interface en0 - 61 Mon Dec 10 11:42:59.372 Driver Event: _bsd_80211_event_callback: RSN_HANDSHAKE_DONE (en0) - 62 Mon Dec 10 11:42:59.373 Info: -[CWXPCInterfaceContext setRoamInProgress:reason:]_block_invoke: roam status metric data: CWAWDMetricRoamStatus: status:0 security: 4 profile:5 origin:<34fcb9>(-69) target:<6cf37f>(-56) latency:6.083439s - 63 Mon Dec 10 11:42:59.373 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90046 - 64 Mon Dec 10 11:42:59.373 Info: RESUME AWDL for interface en0, reason=Roam token=2685 - 65 Mon Dec 10 11:42:59.373 Info: PRIORITY LOCK REMOVED [client=airportd, type=4, interface=en0, priority=5] - 66 Mon Dec 10 11:42:59.374 Info: -[CWXPCInterfaceContext __setAWDLOperatingMode:interface:error:]: attempting to set AWDL mode to 0 - 67 Mon Dec 10 11:43:01.072 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Service/18E14EA7-4641-4104-B315-A9315814912A/DHCP' - 68 Mon Dec 10 11:43:01.072 SC: _processDHCPChanges: State:/Network/Service/18E14EA7-4641-4104-B315-A9315814912A/DHCP - 69 Mon Dec 10 11:43:01.072 SC: _processDHCPChanges: DHCP airport_changed = 1 - 70 Mon Dec 10 11:43:01.073 Info: -[CWXPCSubsystem internal_submitIPConfigLatencyMetric:leaseDuration:]: IPConfig Latency metric data: CWAWDMetricIPConfigLatencyData: DHCP latency: 29010 msecs, duration: 480 mins, security: 4 - 71 Mon Dec 10 11:43:01.073 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90007 - 72 Mon Dec 10 11:43:01.073 SC: _setDHCPMessage: dhcpInfoKey "State:/Network/Interface/en0/AirPort/DHCP Message" = (null) - 73 Mon Dec 10 11:43:10.369 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) - 74 Mon Dec 10 11:43:10.369 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=162 Mbps - 75 Mon Dec 10 11:43:10.369 Info: link quality changed - 76 Mon Dec 10 11:43:23.376 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) - 77 Mon Dec 10 11:43:23.377 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=243 Mbps - 78 Mon Dec 10 11:43:23.377 Info: link quality changed - 79 Mon Dec 10 11:43:28.380 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) - 80 Mon Dec 10 11:43:28.380 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=216 Mbps - 81 Mon Dec 10 11:43:28.380 Info: link quality changed - 82 Mon Dec 10 11:43:31.744 AutoJoin: BACKGROUND SCAN request on interface en0 with SSID list (null) - 83 Mon Dec 10 11:43:31.747 Scan: Cache-assisted scan request on channel 1 does not require a live scan - 84 Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 2 does not require a live scan - 85 Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 3 does not require a live scan - 86 Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request does not require a live scan - 87 Mon Dec 10 11:43:31.748 AutoJoin: Successful cache-assisted background scan request with channels {( - 88 Mon Dec 10 11:43:31.748 [channelNumber=1(2GHz), channelWidth={20MHz}, active], - 89 Mon Dec 10 11:43:31.748 [channelNumber=2(2GHz), channelWidth={20MHz}, active], - 90 Mon Dec 10 11:43:31.748 [channelNumber=3(2GHz), channelWidth={20MHz}, active] + 1 Mon Dec 10 11:43:31.748 )} took 0.0025 seconds, returned 10 results + 2 Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 4 does not require a live scan + 3 Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 5 does not require a live scan + 4 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 6 does not require a live scan + 5 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request does not require a live scan + 6 Mon Dec 10 11:43:31.749 AutoJoin: Successful cache-assisted background scan request with channels {( + 7 Mon Dec 10 11:43:31.749 [channelNumber=4(2GHz), channelWidth={20MHz}, active], + 8 Mon Dec 10 11:43:31.749 [channelNumber=5(2GHz), channelWidth={20MHz}, active], + 9 Mon Dec 10 11:43:31.749 [channelNumber=6(2GHz), channelWidth={20MHz}, active] + 10 Mon Dec 10 11:43:31.749 )} took 0.0008 seconds, returned 7 results + 11 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 7 does not require a live scan + 12 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 8 does not require a live scan + 13 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 9 does not require a live scan + 14 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request does not require a live scan + 15 Mon Dec 10 11:43:31.749 AutoJoin: Successful cache-assisted background scan request with channels {( + 16 Mon Dec 10 11:43:31.749 [channelNumber=7(2GHz), channelWidth={20MHz}, active], + 17 Mon Dec 10 11:43:31.749 [channelNumber=8(2GHz), channelWidth={20MHz}, active], + 18 Mon Dec 10 11:43:31.749 [channelNumber=9(2GHz), channelWidth={20MHz}, active] + 19 Mon Dec 10 11:43:31.749 )} took 0.0002 seconds, returned 1 results + 20 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 10 does not require a live scan + 21 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 11 does not require a live scan + 22 Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 12 does not require a live scan + 23 Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request does not require a live scan + 24 Mon Dec 10 11:43:31.750 AutoJoin: Successful cache-assisted background scan request with channels {( + 25 Mon Dec 10 11:43:31.750 [channelNumber=10(2GHz), channelWidth={20MHz}, active], + 26 Mon Dec 10 11:43:31.750 [channelNumber=11(2GHz), channelWidth={20MHz}, active], + 27 Mon Dec 10 11:43:31.750 [channelNumber=12(2GHz), channelWidth={20MHz}, active] + 28 Mon Dec 10 11:43:31.750 )} took 0.0004 seconds, returned 4 results + 29 Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 13 does not require a live scan + 30 Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 36 does not require a live scan + 31 Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 40 does not require a live scan + 32 Mon Dec 10 11:43:31.751 Scan: Cache-assisted scan request does not require a live scan + 33 Mon Dec 10 11:43:31.751 AutoJoin: Successful cache-assisted background scan request with channels {( + 34 Mon Dec 10 11:43:31.751 [channelNumber=13(2GHz), channelWidth={20MHz}, active], + 35 Mon Dec 10 11:43:31.751 [channelNumber=36(5GHz), channelWidth={40MHz(+1)}, active], + 36 Mon Dec 10 11:43:31.751 [channelNumber=40(5GHz), channelWidth={40MHz(-1)}, active] + 37 Mon Dec 10 11:43:31.751 )} took 0.0009 seconds, returned 9 results + 38 Mon Dec 10 11:43:31.751 Scan: Cache-assisted scan request on channel 44 does not require a live scan + 39 Mon Dec 10 11:43:31.751 Scan: Cache-assisted scan request on channel 48 does not require a live scan + 40 Mon Dec 10 11:43:31.751 Scan: Cache-assisted scan request on channel 149 does not require a live scan + 41 Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request does not require a live scan + 42 Mon Dec 10 11:43:31.752 AutoJoin: Successful cache-assisted background scan request with channels {( + 43 Mon Dec 10 11:43:31.752 [channelNumber=44(5GHz), channelWidth={40MHz(+1)}, active], + 44 Mon Dec 10 11:43:31.752 [channelNumber=48(5GHz), channelWidth={40MHz(-1)}, active], + 45 Mon Dec 10 11:43:31.752 [channelNumber=149(5GHz), channelWidth={20MHz}, active] + 46 Mon Dec 10 11:43:31.752 )} took 0.0010 seconds, returned 9 results + 47 Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request on channel 153 does not require a live scan + 48 Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request on channel 157 does not require a live scan + 49 Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request on channel 161 does not require a live scan + 50 Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request does not require a live scan + 51 Mon Dec 10 11:43:31.753 AutoJoin: Successful cache-assisted background scan request with channels {( + 52 Mon Dec 10 11:43:31.753 [channelNumber=153(5GHz), channelWidth={40MHz(-1)}, active], + 53 Mon Dec 10 11:43:31.753 [channelNumber=157(5GHz), channelWidth={20MHz}, active], + 54 Mon Dec 10 11:43:31.753 [channelNumber=161(5GHz), channelWidth={40MHz(-1)}, active] + 55 Mon Dec 10 11:43:31.753 )} took 0.0007 seconds, returned 9 results + 56 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 165 does not require a live scan + 57 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 52 does not require a live scan + 58 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 56 does not require a live scan + 59 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request does not require a live scan + 60 Mon Dec 10 11:43:31.753 AutoJoin: Successful cache-assisted background scan request with channels {( + 61 Mon Dec 10 11:43:31.753 [channelNumber=165(5GHz), channelWidth={20MHz}, active], + 62 Mon Dec 10 11:43:31.753 [channelNumber=52(5GHz), channelWidth={40MHz(+1)}, DFS], + 63 Mon Dec 10 11:43:31.753 [channelNumber=56(5GHz), channelWidth={40MHz(-1)}, DFS] + 64 Mon Dec 10 11:43:31.753 )} took 0.0005 seconds, returned 6 results + 65 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 60 does not require a live scan + 66 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 64 does not require a live scan + 67 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request does not require a live scan + 68 Mon Dec 10 11:43:31.753 AutoJoin: Successful cache-assisted background scan request with channels {( + 69 Mon Dec 10 11:43:31.754 [channelNumber=60(5GHz), channelWidth={40MHz(+1)}, DFS], + 70 Mon Dec 10 11:43:31.754 [channelNumber=64(5GHz), channelWidth={40MHz(-1)}, DFS] + 71 Mon Dec 10 11:43:31.754 )} took 0.0003 seconds, returned 4 results + 72 Mon Dec 10 11:43:42.382 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) + 73 Mon Dec 10 11:43:42.382 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=270 Mbps + 74 Mon Dec 10 11:43:42.383 Info: link quality changed + 75 Mon Dec 10 11:49:12.347 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) + 76 Mon Dec 10 11:49:12.350 Info: QUERY SCAN CACHE request received from pid 92 (locationd) + 77 Mon Dec 10 11:52:32.194 Info: SCAN request received from pid 92 (locationd) with priority 2 + 78 Mon Dec 10 11:52:32.448 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) + 79 Mon Dec 10 11:52:32.450 Info: QUERY SCAN CACHE request received from pid 92 (locationd) + 80 Mon Dec 10 11:52:32.451 AutoJoin: Successful cache-assisted scan request for locationd with channels {( + 81 Mon Dec 10 11:52:32.451 [channelNumber=1(2GHz), channelWidth={20MHz}, active], + 82 Mon Dec 10 11:52:32.451 [channelNumber=2(2GHz), channelWidth={20MHz}, active], + 83 Mon Dec 10 11:52:32.451 [channelNumber=3(2GHz), channelWidth={20MHz}, active], + 84 Mon Dec 10 11:52:32.451 [channelNumber=4(2GHz), channelWidth={20MHz}, active], + 85 Mon Dec 10 11:52:32.451 [channelNumber=5(2GHz), channelWidth={20MHz}, active], + 86 Mon Dec 10 11:52:32.451 [channelNumber=6(2GHz), channelWidth={20MHz}, active] + 87 Mon Dec 10 11:52:32.451 )} took 0.2566 seconds, returned 10 results + 88 Mon Dec 10 11:52:32.451 Info: scan cache updated + 89 Mon Dec 10 11:52:32.712 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) + 90 Mon Dec 10 11:52:32.715 Info: QUERY SCAN CACHE request received from pid 92 (locationd) diff --git a/tests/fixtures/pr/test_page_length1.log.expected b/tests/fixtures/pr/test_page_length1.log.expected index 7162fe499..09d8e3ce6 100644 --- a/tests/fixtures/pr/test_page_length1.log.expected +++ b/tests/fixtures/pr/test_page_length1.log.expected @@ -1,10 +1,10 @@ - 1 ntation processAirPortStateChanges]: pppConnectionState 0 - 2 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 3 Mon Dec 10 11:42:56.705 Info: 802.1X changed - 4 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 5 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 1 Mon Dec 10 11:42:56.854 Info: 802.1X changed + 2 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 3 Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 4 Mon Dec 10 11:42:57.002 Info: 802.1X changed + 5 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 6 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars 7 Mon Dec 10 11:42:57.152 Info: 802.1X changed 8 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 9 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 10 Mon Dec 10 11:42:57.302 Info: 802.1X changed \ No newline at end of file + 10 Mon Dec 10 11:42:57.302 Info: 802.1X changed diff --git a/tests/fixtures/pr/test_page_range_1.log.expected b/tests/fixtures/pr/test_page_range_1.log.expected index 67fbf88a5..f254261d4 100644 --- a/tests/fixtures/pr/test_page_range_1.log.expected +++ b/tests/fixtures/pr/test_page_range_1.log.expected @@ -3,62 +3,62 @@ {last_modified_time} test.log Page 15 -ntation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:56.705 Info: 802.1X changed -Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:56.854 Info: 802.1X changed -Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:57.002 Info: 802.1X changed -Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:57.152 Info: 802.1X changed -Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:57.302 Info: 802.1X changed -Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:57.449 Info: 802.1X changed -Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:57.600 Info: 802.1X changed -Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:57.749 Info: 802.1X changed -Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:57.896 Info: 802.1X changed -Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:58.045 Info: 802.1X changed -Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:58.193 Info: 802.1X changed -Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:58.342 Info: 802.1X changed -Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:58.491 Info: 802.1X changed -Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:58.640 Info: 802.1X changed -Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:58.805 Info: 802.1X changed -Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:58.958 Info: 802.1X changed -Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:59.155 Info: 802.1X changed -Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:59.352 Info: 802.1X changed +Mon Dec 10 12:05:48.183 [channelNumber=12(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:05:48.183 )} took 0.0007 seconds, returned 4 results +Mon Dec 10 12:05:48.183 Scan: Cache-assisted scan request on channel 13 does not require a live scan +Mon Dec 10 12:05:48.183 Scan: Cache-assisted scan request on channel 36 does not require a live scan +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request on channel 40 does not require a live scan +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.184 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.184 [channelNumber=13(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:48.184 [channelNumber=36(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 12:05:48.184 [channelNumber=40(5GHz), channelWidth={40MHz(-1)}, active] +Mon Dec 10 12:05:48.184 )} took 0.0007 seconds, returned 5 results +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request on channel 44 does not require a live scan +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request on channel 48 does not require a live scan +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request on channel 149 does not require a live scan +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.185 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.185 [channelNumber=44(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 12:05:48.185 [channelNumber=48(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:05:48.185 [channelNumber=149(5GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:05:48.185 )} took 0.0006 seconds, returned 4 results +Mon Dec 10 12:05:48.185 Scan: Cache-assisted scan request on channel 153 does not require a live scan +Mon Dec 10 12:05:48.185 Scan: Cache-assisted scan request on channel 157 does not require a live scan +Mon Dec 10 12:05:48.185 Scan: Cache-assisted scan request on channel 161 does not require a live scan +Mon Dec 10 12:05:48.186 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.186 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.186 [channelNumber=153(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:05:48.186 [channelNumber=157(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:48.186 [channelNumber=161(5GHz), channelWidth={40MHz(-1)}, active] +Mon Dec 10 12:05:48.186 )} took 0.0010 seconds, returned 7 results +Mon Dec 10 12:05:48.186 Scan: Cache-assisted scan request on channel 165 does not require a live scan +Mon Dec 10 12:05:48.186 Scan: Cache-assisted scan request on channel 52 does not require a live scan +Mon Dec 10 12:05:48.186 Scan: Cache-assisted scan request on channel 56 does not require a live scan +Mon Dec 10 12:05:48.186 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.187 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.187 [channelNumber=165(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:48.187 [channelNumber=52(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 12:05:48.187 [channelNumber=56(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 12:05:48.187 )} took 0.0008 seconds, returned 5 results +Mon Dec 10 12:05:48.187 Scan: Cache-assisted scan request on channel 60 does not require a live scan +Mon Dec 10 12:05:48.187 Scan: Cache-assisted scan request on channel 64 does not require a live scan +Mon Dec 10 12:05:48.188 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.188 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.188 [channelNumber=60(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 12:05:48.188 [channelNumber=64(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 12:05:48.188 )} took 0.0013 seconds, returned 8 results +Mon Dec 10 12:05:50.375 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:05:50.375 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=216 Mbps +Mon Dec 10 12:05:50.376 Info: link quality changed +Mon Dec 10 12:05:55.378 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:05:55.378 Info: _bsd_80211_event_callback: link quality: RSSI=-56 dBm TxRate=243 Mbps +Mon Dec 10 12:05:55.379 Info: link quality changed +Mon Dec 10 12:06:28.759 Driver Event: _bsd_80211_event_callback: AWDL_SYNC_STATE_CHANGED (awdl0) +Mon Dec 10 12:06:28.763 Info: AWDL started +Mon Dec 10 12:06:28.763 Driver Event: _bsd_80211_event_callback: CHANNEL_SWITCH (en0) +Mon Dec 10 12:06:28.765 Roam: ROAMING PROFILES updated to SINGLE-BAND, SINGLE-AP for 2.4GHz on en0 +Mon Dec 10 12:06:28.765 Roam: ROAMING PROFILES updated to SINGLE-BAND, SINGLE-AP for 5GHz on en0 diff --git a/tests/fixtures/pr/test_page_range_2.log.expected b/tests/fixtures/pr/test_page_range_2.log.expected index d90166b19..4f260eb65 100644 --- a/tests/fixtures/pr/test_page_range_2.log.expected +++ b/tests/fixtures/pr/test_page_range_2.log.expected @@ -3,62 +3,62 @@ {last_modified_time} test.log Page 15 -ntation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:56.705 Info: 802.1X changed -Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:56.854 Info: 802.1X changed -Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:57.002 Info: 802.1X changed -Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:57.152 Info: 802.1X changed -Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:57.302 Info: 802.1X changed -Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:57.449 Info: 802.1X changed -Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:57.600 Info: 802.1X changed -Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:57.749 Info: 802.1X changed -Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:57.896 Info: 802.1X changed -Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:58.045 Info: 802.1X changed -Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:58.193 Info: 802.1X changed -Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:58.342 Info: 802.1X changed -Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:58.491 Info: 802.1X changed -Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:58.640 Info: 802.1X changed -Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:58.805 Info: 802.1X changed -Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:58.958 Info: 802.1X changed -Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:59.155 Info: 802.1X changed -Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:59.352 Info: 802.1X changed +Mon Dec 10 12:05:48.183 [channelNumber=12(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:05:48.183 )} took 0.0007 seconds, returned 4 results +Mon Dec 10 12:05:48.183 Scan: Cache-assisted scan request on channel 13 does not require a live scan +Mon Dec 10 12:05:48.183 Scan: Cache-assisted scan request on channel 36 does not require a live scan +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request on channel 40 does not require a live scan +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.184 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.184 [channelNumber=13(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:48.184 [channelNumber=36(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 12:05:48.184 [channelNumber=40(5GHz), channelWidth={40MHz(-1)}, active] +Mon Dec 10 12:05:48.184 )} took 0.0007 seconds, returned 5 results +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request on channel 44 does not require a live scan +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request on channel 48 does not require a live scan +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request on channel 149 does not require a live scan +Mon Dec 10 12:05:48.184 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.185 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.185 [channelNumber=44(5GHz), channelWidth={40MHz(+1)}, active], +Mon Dec 10 12:05:48.185 [channelNumber=48(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:05:48.185 [channelNumber=149(5GHz), channelWidth={20MHz}, active] +Mon Dec 10 12:05:48.185 )} took 0.0006 seconds, returned 4 results +Mon Dec 10 12:05:48.185 Scan: Cache-assisted scan request on channel 153 does not require a live scan +Mon Dec 10 12:05:48.185 Scan: Cache-assisted scan request on channel 157 does not require a live scan +Mon Dec 10 12:05:48.185 Scan: Cache-assisted scan request on channel 161 does not require a live scan +Mon Dec 10 12:05:48.186 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.186 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.186 [channelNumber=153(5GHz), channelWidth={40MHz(-1)}, active], +Mon Dec 10 12:05:48.186 [channelNumber=157(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:48.186 [channelNumber=161(5GHz), channelWidth={40MHz(-1)}, active] +Mon Dec 10 12:05:48.186 )} took 0.0010 seconds, returned 7 results +Mon Dec 10 12:05:48.186 Scan: Cache-assisted scan request on channel 165 does not require a live scan +Mon Dec 10 12:05:48.186 Scan: Cache-assisted scan request on channel 52 does not require a live scan +Mon Dec 10 12:05:48.186 Scan: Cache-assisted scan request on channel 56 does not require a live scan +Mon Dec 10 12:05:48.186 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.187 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.187 [channelNumber=165(5GHz), channelWidth={20MHz}, active], +Mon Dec 10 12:05:48.187 [channelNumber=52(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 12:05:48.187 [channelNumber=56(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 12:05:48.187 )} took 0.0008 seconds, returned 5 results +Mon Dec 10 12:05:48.187 Scan: Cache-assisted scan request on channel 60 does not require a live scan +Mon Dec 10 12:05:48.187 Scan: Cache-assisted scan request on channel 64 does not require a live scan +Mon Dec 10 12:05:48.188 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 12:05:48.188 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 12:05:48.188 [channelNumber=60(5GHz), channelWidth={40MHz(+1)}, DFS], +Mon Dec 10 12:05:48.188 [channelNumber=64(5GHz), channelWidth={40MHz(-1)}, DFS] +Mon Dec 10 12:05:48.188 )} took 0.0013 seconds, returned 8 results +Mon Dec 10 12:05:50.375 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:05:50.375 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=216 Mbps +Mon Dec 10 12:05:50.376 Info: link quality changed +Mon Dec 10 12:05:55.378 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 12:05:55.378 Info: _bsd_80211_event_callback: link quality: RSSI=-56 dBm TxRate=243 Mbps +Mon Dec 10 12:05:55.379 Info: link quality changed +Mon Dec 10 12:06:28.759 Driver Event: _bsd_80211_event_callback: AWDL_SYNC_STATE_CHANGED (awdl0) +Mon Dec 10 12:06:28.763 Info: AWDL started +Mon Dec 10 12:06:28.763 Driver Event: _bsd_80211_event_callback: CHANNEL_SWITCH (en0) +Mon Dec 10 12:06:28.765 Roam: ROAMING PROFILES updated to SINGLE-BAND, SINGLE-AP for 2.4GHz on en0 +Mon Dec 10 12:06:28.765 Roam: ROAMING PROFILES updated to SINGLE-BAND, SINGLE-AP for 5GHz on en0 @@ -196,5 +196,3 @@ Mon Dec 10 12:13:27.640 Info: link quality changed - - From 5705ed142ff20ad8e2eae7c7f0c3f2d2f5016a7a Mon Sep 17 00:00:00 2001 From: Tilak Patidar Date: Wed, 19 Dec 2018 22:06:36 +0530 Subject: [PATCH 0152/1135] pr: write pagination logic of reading file using iterators --- src/pr/Cargo.toml | 1 + src/pr/pr.rs | 173 +++++++++++++++++++++++----------------------- 2 files changed, 87 insertions(+), 87 deletions(-) diff --git a/src/pr/Cargo.toml b/src/pr/Cargo.toml index 08cc5ac30..d33681b5f 100644 --- a/src/pr/Cargo.toml +++ b/src/pr/Cargo.toml @@ -13,6 +13,7 @@ getopts = "0.2.18" time = "0.1.40" chrono = "0.4.6" quick-error = "1.2.2" +itertools = "0.7.8" [dependencies.uucore] path = "../uucore" diff --git a/src/pr/pr.rs b/src/pr/pr.rs index ef5358255..7460bc674 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -10,11 +10,12 @@ extern crate unix_socket; #[macro_use] extern crate quick_error; +extern crate itertools; extern crate chrono; extern crate getopts; extern crate uucore; -use std::io::{BufRead, BufReader, stdin, stdout, stderr, Error, Read, Write, Stdout}; +use std::io::{BufRead, BufReader, stdin, stdout, stderr, Error, Read, Write, Stdout, Lines}; use std::vec::Vec; use chrono::offset::Local; use chrono::DateTime; @@ -24,10 +25,10 @@ use std::fs::{metadata, File}; use std::os::unix::fs::FileTypeExt; use quick_error::ResultExt; use std::convert::From; -use getopts::HasArg; -use getopts::Occur; +use getopts::{HasArg, Occur}; use std::num::ParseIntError; -use std::str::Chars; +use itertools::{Itertools, GroupBy}; +use std::iter::{Enumerate, Map, TakeWhile, SkipWhile}; static NAME: &str = "pr"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -65,7 +66,6 @@ struct OutputOptions { display_header: bool, display_trailer: bool, content_lines_per_page: usize, - suppress_errors: bool, page_separator_char: String, column_mode_options: Option, } @@ -76,38 +76,12 @@ struct ColumnModeOptions { column_separator: String, } -#[derive(PartialEq, Eq)] -enum PrintPageCommand { - Skip, - Abort, - Print, -} - impl AsRef for OutputOptions { fn as_ref(&self) -> &OutputOptions { self } } -impl OutputOptions { - fn get_columns(&self) -> usize { - self.as_ref() - .column_mode_options.as_ref() - .map(|i| i.columns) - .unwrap_or(1) - } - - fn lines_to_read_for_page(&self) -> usize { - let content_lines_per_page = &self.as_ref().content_lines_per_page; - let columns = self.get_columns(); - if self.as_ref().double_space { - (content_lines_per_page / 2) * columns - } else { - content_lines_per_page * columns - } - } -} - struct NumberingMode { /// Line numbering mode width: usize, @@ -492,8 +466,6 @@ fn build_options(matches: &Matches, path: &String) -> Result Result Result, PrError> { } fn pr(path: &str, options: &OutputOptions) -> Result { - let mut i = 0; - let mut page: usize = 0; - let mut buffered_content: Vec = Vec::new(); - let read_lines_per_page = options.lines_to_read_for_page(); - let start_page = options.as_ref().start_page.as_ref(); - let last_page = options.as_ref().end_page.as_ref(); - let mut line_number = options.as_ref() - .number - .as_ref() - .map(|i| i.first_number) - .unwrap_or(1) - 1; - for line in BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?).lines() { - if i == read_lines_per_page { - page = page + 1; - i = 0; + let start_page: &usize = options.start_page.as_ref().unwrap_or(&1); + let last_page: Option<&usize> = options.end_page.as_ref(); + let lines_needed_per_page: usize = lines_to_read_for_page(options); + let start_line_number: usize = get_start_line_number(options); - let cmd = _get_print_command(start_page, last_page, &page); - if cmd == PrintPageCommand::Print { - line_number += print_page(&buffered_content, options, &page, &line_number)?; - buffered_content = Vec::new(); - } else if cmd == PrintPageCommand::Abort { - return Ok(0); - } + let pages: GroupBy>>>, _>, _>, _>>, _>, _> = + BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?) + .lines() + .enumerate() + .skip_while(|line_index: &(usize, Result)| { + // Skip the initial lines if not in page range + let start_line_index_of_start_page = (*start_page - 1) * lines_needed_per_page; + line_index.0 < (start_line_index_of_start_page) + }) + .take_while(|i: &(usize, Result)| { + // Only read the file until provided last page reached + last_page + .map(|lp| i.0 < ((*lp) * lines_needed_per_page)) + .unwrap_or(true) + }) + .map(|i: (usize, Result)| i.1) // just get lines remove real line number + .enumerate() + .map(|i: (usize, Result)| (i.0 + start_line_number, i.1)) // get display line number with line content + .group_by(|i: &(usize, Result)| { + ((i.0 - start_line_number + 1) as f64 / lines_needed_per_page as f64).ceil() as usize + (start_page - 1) + }); // group them by page number + + + for (page_number, content_with_line_number) in pages.into_iter() { + let mut lines: Vec<(usize, String)> = Vec::new(); + for line_number_and_line in content_with_line_number { + let line_number: usize = line_number_and_line.0; + let line: Result = line_number_and_line.1; + let x = line?; + lines.push((line_number, x)); } - buffered_content.push(line?); - i = i + 1; + + print_page(&lines, options, &page_number); } - if i != 0 { - page = page + 1; - let cmd = _get_print_command(start_page, last_page, &page); - if cmd == PrintPageCommand::Print { - print_page(&buffered_content, options, &page, &line_number)?; - } else if cmd == PrintPageCommand::Abort { - return Ok(0); - } - } return Ok(0); } -fn _get_print_command(start_page: Option<&usize>, last_page: Option<&usize>, page: &usize) -> PrintPageCommand { - let below_page_range = start_page.is_some() && page < start_page.unwrap(); - let is_within_page_range = (start_page.is_none() || page >= start_page.unwrap()) - && (last_page.is_none() || page <= last_page.unwrap()); - if below_page_range { - return PrintPageCommand::Skip; - } else if is_within_page_range { - return PrintPageCommand::Print; - } - return PrintPageCommand::Abort; -} - -fn print_page(lines: &Vec, options: &OutputOptions, page: &usize, line_number: &usize) -> Result { +fn print_page(lines: &Vec<(usize, String)>, options: &OutputOptions, page: &usize) -> Result { let page_separator = options.as_ref().page_separator_char.as_bytes(); let header: Vec = header_content(options, page); let trailer_content: Vec = trailer_content(options); @@ -640,7 +602,7 @@ fn print_page(lines: &Vec, options: &OutputOptions, page: &usize, line_n out.write(line_separator)?; } - let lines_written = write_columns(lines, options, out, line_number)?; + let lines_written = write_columns(lines, options, out)?; for index in 0..trailer_content.len() { let x: &String = trailer_content.get(index).unwrap(); @@ -655,7 +617,7 @@ fn print_page(lines: &Vec, options: &OutputOptions, page: &usize, line_n Ok(lines_written) } -fn write_columns(lines: &Vec, options: &OutputOptions, out: &mut Stdout, line_number: &usize) -> Result { +fn write_columns(lines: &Vec<(usize, String)>, options: &OutputOptions, out: &mut Stdout) -> Result { let line_separator = options.as_ref().line_separator.as_bytes(); let page_separator = options.as_ref().page_separator_char.as_bytes(); let content_lines_per_page = options.as_ref().content_lines_per_page; @@ -669,7 +631,7 @@ fn write_columns(lines: &Vec, options: &OutputOptions, out: &mut Stdout, .unwrap_or(NumberingMode::default().separator); let blank_line = "".to_string(); - let columns = options.get_columns(); + let columns = get_columns(options); let col_sep: &String = options.as_ref() .column_mode_options.as_ref() @@ -691,8 +653,8 @@ fn write_columns(lines: &Vec, options: &OutputOptions, out: &mut Stdout, if lines.get(index).is_none() { break; } - let read_line = lines.get(index).unwrap(); - let next_line_number = line_number + index + 1; + let read_line: &String = &lines.get(index).unwrap().1; + let next_line_number: usize = lines.get(index).unwrap().0; let trimmed_line = get_line_for_printing( next_line_number, &width, &number_separator, columns, col_width, @@ -728,8 +690,8 @@ fn get_line_for_printing(line_number: usize, width: &usize, .count(); let display_length = complete_line.len() + (tab_count * 7); - // TODO Adjust the width according to -n option - // TODO actual len of the string vs display len of string because of tabs +// TODO Adjust the width according to -n option +// TODO actual len of the string vs display len of string because of tabs col_width.map(|i| { let min_width = (i - (columns - 1)) / columns; if display_length < min_width { @@ -797,3 +759,40 @@ fn trailer_content(options: &OutputOptions) -> Vec { Vec::new() } } + +/// Returns starting line number for the file to be printed. +/// If -N is specified the first line number changes otherwise +/// default is 1. +/// # Arguments +/// * `opts` - A reference to OutputOptions +fn get_start_line_number(opts: &OutputOptions) -> usize { + opts.number + .as_ref() + .map(|i| i.first_number) + .unwrap_or(1) +} + +/// Returns number of lines to read from input for constructing one page of pr output. +/// If double space -d is used lines are halved. +/// If columns --columns is used the lines are multiplied by the value. +/// # Arguments +/// * `opts` - A reference to OutputOptions +fn lines_to_read_for_page(opts: &OutputOptions) -> usize { + let content_lines_per_page = opts.content_lines_per_page; + let columns = get_columns(opts); + if opts.double_space { + (content_lines_per_page / 2) * columns + } else { + content_lines_per_page * columns + } +} + +/// Returns number of columns to output +/// # Arguments +/// * `opts` - A reference to OutputOptions +fn get_columns(opts: &OutputOptions) -> usize { + opts.column_mode_options + .as_ref() + .map(|i| i.columns) + .unwrap_or(1) +} From d9084a7399fc6c37703acab4896d7b4a4a69d406 Mon Sep 17 00:00:00 2001 From: Tilak Patidar Date: Thu, 20 Dec 2018 21:19:42 +0530 Subject: [PATCH 0153/1135] pr: implement across option and fix tests --- src/pr/pr.rs | 116 +++--- .../pr/test_one_page_double_line.log.expected | 72 ---- .../fixtures/pr/test_page_length.log.expected | 360 +++++++++--------- .../pr/test_page_length1.log.expected | 22 +- 4 files changed, 264 insertions(+), 306 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 7460bc674..0f1fffcd8 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -48,6 +48,7 @@ static PAGE_LENGTH_OPTION: &str = "l"; static SUPPRESS_PRINTING_ERROR: &str = "r"; static FORM_FEED_OPTION: &str = "F"; static COLUMN_WIDTH_OPTION: &str = "w"; +static ACROSS_OPTION: &str = "a"; static COLUMN_OPTION: &str = "column"; static FILE_STDIN: &str = "-"; static READ_BUFFER_SIZE: usize = 1024 * 64; @@ -60,6 +61,7 @@ struct OutputOptions { header: String, double_space: bool, line_separator: String, + content_line_separator: String, last_modified_time: String, start_page: Option, end_page: Option, @@ -74,6 +76,7 @@ struct ColumnModeOptions { width: Option, columns: usize, column_separator: String, + across_mode: bool, } impl AsRef for OutputOptions { @@ -258,6 +261,17 @@ pub fn uumain(args: Vec) -> i32 { Occur::Optional, ); + opts.opt( + ACROSS_OPTION, + "across", + "Modify the effect of the - column option so that the columns are filled across the page in a round-robin order + (for example, when column is 2, the first input line heads column 1, the second heads column 2, the third is the + second line in column 1, and so on).", + "", + HasArg::No, + Occur::Optional, + ); + opts.optflag("", "help", "display this help and exit"); opts.optflag("V", "version", "output version information and exit"); @@ -405,12 +419,14 @@ fn build_options(matches: &Matches, path: &String) -> Result Result None }; + let across_mode = matches.opt_present(ACROSS_OPTION); + let column_mode_options = match matches.opt_str(COLUMN_OPTION).map(|i| { i.parse::() }) { @@ -486,6 +504,7 @@ fn build_options(matches: &Matches, path: &String) -> Result Some(DEFAULT_COLUMN_WIDTH) }, column_separator: DEFAULT_COLUMN_SEPARATOR.to_string(), + across_mode, }) } _ => None @@ -496,6 +515,7 @@ fn build_options(matches: &Matches, path: &String) -> Result Result { let lines_needed_per_page: usize = lines_to_read_for_page(options); let start_line_number: usize = get_start_line_number(options); - let pages: GroupBy>>>, _>, _>, _>>, _>, _> = + let pages: GroupBy>>>, _>, _>, _>, _> = BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?) .lines() .enumerate() @@ -564,11 +584,9 @@ fn pr(path: &str, options: &OutputOptions) -> Result { .map(|lp| i.0 < ((*lp) * lines_needed_per_page)) .unwrap_or(true) }) - .map(|i: (usize, Result)| i.1) // just get lines remove real line number - .enumerate() .map(|i: (usize, Result)| (i.0 + start_line_number, i.1)) // get display line number with line content .group_by(|i: &(usize, Result)| { - ((i.0 - start_line_number + 1) as f64 / lines_needed_per_page as f64).ceil() as usize + (start_page - 1) + ((i.0 - start_line_number + 1) as f64 / lines_needed_per_page as f64).ceil() as usize }); // group them by page number @@ -589,12 +607,12 @@ fn pr(path: &str, options: &OutputOptions) -> Result { } fn print_page(lines: &Vec<(usize, String)>, options: &OutputOptions, page: &usize) -> Result { - let page_separator = options.as_ref().page_separator_char.as_bytes(); + let page_separator = options.page_separator_char.as_bytes(); let header: Vec = header_content(options, page); let trailer_content: Vec = trailer_content(options); let out: &mut Stdout = &mut stdout(); - let line_separator = options.as_ref().line_separator.as_bytes(); + let line_separator = options.line_separator.as_bytes(); out.lock(); for x in header { @@ -607,25 +625,28 @@ fn print_page(lines: &Vec<(usize, String)>, options: &OutputOptions, page: &usiz for index in 0..trailer_content.len() { let x: &String = trailer_content.get(index).unwrap(); out.write(x.as_bytes())?; - if index + 1 == trailer_content.len() { - out.write(page_separator)?; - } else { + if index + 1 != trailer_content.len() { out.write(line_separator)?; } } + out.write(page_separator)?; out.flush()?; Ok(lines_written) } fn write_columns(lines: &Vec<(usize, String)>, options: &OutputOptions, out: &mut Stdout) -> Result { - let line_separator = options.as_ref().line_separator.as_bytes(); - let page_separator = options.as_ref().page_separator_char.as_bytes(); - let content_lines_per_page = options.as_ref().content_lines_per_page; - let width: usize = options.as_ref() + let line_separator = options.content_line_separator.as_bytes(); + let content_lines_per_page = if options.double_space { + options.content_lines_per_page / 2 + } else { + options.content_lines_per_page + }; + + let width: usize = options .number.as_ref() .map(|i| i.width) .unwrap_or(0); - let number_separator: String = options.as_ref() + let number_separator: String = options .number.as_ref() .map(|i| i.separator.to_string()) .unwrap_or(NumberingMode::default().separator); @@ -633,23 +654,44 @@ fn write_columns(lines: &Vec<(usize, String)>, options: &OutputOptions, out: &mu let blank_line = "".to_string(); let columns = get_columns(options); - let col_sep: &String = options.as_ref() + let col_sep: &String = options .column_mode_options.as_ref() .map(|i| &i.column_separator) .unwrap_or(&blank_line); - let col_width: Option = options.as_ref() + let col_width: Option = options .column_mode_options.as_ref() .map(|i| i.width) .unwrap_or(None); - let mut i = 0; + let across_mode = options + .column_mode_options.as_ref() + .map(|i| i.across_mode) + .unwrap_or(false); + + let mut lines_printed = 0; let is_number_mode = options.number.is_some(); - for start in 0..content_lines_per_page { - let indexes: Vec = get_indexes(start, content_lines_per_page, columns); - let mut line: Vec = Vec::new(); - for index in indexes { + let fetch_indexes: Vec> = if across_mode { + (0..content_lines_per_page) + .map(|a| + (0..columns) + .map(|i| a * columns + i) + .collect() + ).collect() + } else { + (0..content_lines_per_page) + .map(|start| + (0..columns) + .map(|i| start + content_lines_per_page * i) + .collect() + ).collect() + }; + + for fetch_index in fetch_indexes { + let indexes = fetch_index.len(); + for i in 0..indexes { + let index = fetch_index[i]; if lines.get(index).is_none() { break; } @@ -659,18 +701,15 @@ fn write_columns(lines: &Vec<(usize, String)>, options: &OutputOptions, out: &mu next_line_number, &width, &number_separator, columns, col_width, read_line, is_number_mode); - line.push(trimmed_line); - i += 1; - } - - out.write(line.join(col_sep).as_bytes())?; - if i == lines.len() { - out.write(page_separator)?; - } else { - out.write(line_separator)?; + out.write(trimmed_line.as_bytes())?; + if (i + 1) != indexes { + out.write(col_sep.as_bytes())?; + } + lines_printed += 1; } + out.write(line_separator)?; } - Ok(i) + Ok(lines_printed) } fn get_line_for_printing(line_number: usize, width: &usize, @@ -707,17 +746,6 @@ fn get_line_for_printing(line_number: usize, width: &usize, }).unwrap_or(complete_line) } -fn get_indexes(start: usize, content_lines_per_page: usize, columns: usize) -> Vec { - let mut indexes: Vec = Vec::new(); - let mut offset = start; - indexes.push(offset); - for _col in 1..columns { - offset += content_lines_per_page; - indexes.push(offset); - } - indexes -} - fn get_fmtd_line_number(width: &usize, line_number: usize, separator: &String) -> String { let line_str = line_number.to_string(); if line_str.len() >= *width { @@ -729,7 +757,7 @@ fn get_fmtd_line_number(width: &usize, line_number: usize, separator: &String) - fn header_content(options: &OutputOptions, page: &usize) -> Vec { - if options.as_ref().display_header { + if options.display_header { let first_line: String = format!("{} {} Page {}", options.last_modified_time, options.header, page); vec!["".to_string(), "".to_string(), first_line, "".to_string(), "".to_string()] } else { diff --git a/tests/fixtures/pr/test_one_page_double_line.log.expected b/tests/fixtures/pr/test_one_page_double_line.log.expected index 831570103..e32101fcf 100644 --- a/tests/fixtures/pr/test_one_page_double_line.log.expected +++ b/tests/fixtures/pr/test_one_page_double_line.log.expected @@ -1,13 +1,8 @@ - - {last_modified_time} test_one_page.log Page 1 - - - ntation processAirPortStateChanges]: pppConnectionState 0 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars @@ -71,45 +66,9 @@ Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementati - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {last_modified_time} test_one_page.log Page 2 - - - Mon Dec 10 11:42:57.896 Info: 802.1X changed Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 @@ -171,34 +130,3 @@ Mon Dec 10 11:42:59.352 Info: 802.1X changed - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/fixtures/pr/test_page_length.log.expected b/tests/fixtures/pr/test_page_length.log.expected index 412f53a77..8f4ab82d1 100644 --- a/tests/fixtures/pr/test_page_length.log.expected +++ b/tests/fixtures/pr/test_page_length.log.expected @@ -3,96 +3,96 @@ {last_modified_time} test.log Page 2 - 1 Mon Dec 10 11:43:31.748 )} took 0.0025 seconds, returned 10 results - 2 Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 4 does not require a live scan - 3 Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 5 does not require a live scan - 4 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 6 does not require a live scan - 5 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request does not require a live scan - 6 Mon Dec 10 11:43:31.749 AutoJoin: Successful cache-assisted background scan request with channels {( - 7 Mon Dec 10 11:43:31.749 [channelNumber=4(2GHz), channelWidth={20MHz}, active], - 8 Mon Dec 10 11:43:31.749 [channelNumber=5(2GHz), channelWidth={20MHz}, active], - 9 Mon Dec 10 11:43:31.749 [channelNumber=6(2GHz), channelWidth={20MHz}, active] - 10 Mon Dec 10 11:43:31.749 )} took 0.0008 seconds, returned 7 results - 11 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 7 does not require a live scan - 12 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 8 does not require a live scan - 13 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 9 does not require a live scan - 14 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request does not require a live scan - 15 Mon Dec 10 11:43:31.749 AutoJoin: Successful cache-assisted background scan request with channels {( - 16 Mon Dec 10 11:43:31.749 [channelNumber=7(2GHz), channelWidth={20MHz}, active], - 17 Mon Dec 10 11:43:31.749 [channelNumber=8(2GHz), channelWidth={20MHz}, active], - 18 Mon Dec 10 11:43:31.749 [channelNumber=9(2GHz), channelWidth={20MHz}, active] - 19 Mon Dec 10 11:43:31.749 )} took 0.0002 seconds, returned 1 results - 20 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 10 does not require a live scan - 21 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 11 does not require a live scan - 22 Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 12 does not require a live scan - 23 Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request does not require a live scan - 24 Mon Dec 10 11:43:31.750 AutoJoin: Successful cache-assisted background scan request with channels {( - 25 Mon Dec 10 11:43:31.750 [channelNumber=10(2GHz), channelWidth={20MHz}, active], - 26 Mon Dec 10 11:43:31.750 [channelNumber=11(2GHz), channelWidth={20MHz}, active], - 27 Mon Dec 10 11:43:31.750 [channelNumber=12(2GHz), channelWidth={20MHz}, active] - 28 Mon Dec 10 11:43:31.750 )} took 0.0004 seconds, returned 4 results - 29 Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 13 does not require a live scan - 30 Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 36 does not require a live scan - 31 Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 40 does not require a live scan - 32 Mon Dec 10 11:43:31.751 Scan: Cache-assisted scan request does not require a live scan - 33 Mon Dec 10 11:43:31.751 AutoJoin: Successful cache-assisted background scan request with channels {( - 34 Mon Dec 10 11:43:31.751 [channelNumber=13(2GHz), channelWidth={20MHz}, active], - 35 Mon Dec 10 11:43:31.751 [channelNumber=36(5GHz), channelWidth={40MHz(+1)}, active], - 36 Mon Dec 10 11:43:31.751 [channelNumber=40(5GHz), channelWidth={40MHz(-1)}, active] - 37 Mon Dec 10 11:43:31.751 )} took 0.0009 seconds, returned 9 results - 38 Mon Dec 10 11:43:31.751 Scan: Cache-assisted scan request on channel 44 does not require a live scan - 39 Mon Dec 10 11:43:31.751 Scan: Cache-assisted scan request on channel 48 does not require a live scan - 40 Mon Dec 10 11:43:31.751 Scan: Cache-assisted scan request on channel 149 does not require a live scan - 41 Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request does not require a live scan - 42 Mon Dec 10 11:43:31.752 AutoJoin: Successful cache-assisted background scan request with channels {( - 43 Mon Dec 10 11:43:31.752 [channelNumber=44(5GHz), channelWidth={40MHz(+1)}, active], - 44 Mon Dec 10 11:43:31.752 [channelNumber=48(5GHz), channelWidth={40MHz(-1)}, active], - 45 Mon Dec 10 11:43:31.752 [channelNumber=149(5GHz), channelWidth={20MHz}, active] - 46 Mon Dec 10 11:43:31.752 )} took 0.0010 seconds, returned 9 results - 47 Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request on channel 153 does not require a live scan - 48 Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request on channel 157 does not require a live scan - 49 Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request on channel 161 does not require a live scan - 50 Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request does not require a live scan - 51 Mon Dec 10 11:43:31.753 AutoJoin: Successful cache-assisted background scan request with channels {( - 52 Mon Dec 10 11:43:31.753 [channelNumber=153(5GHz), channelWidth={40MHz(-1)}, active], - 53 Mon Dec 10 11:43:31.753 [channelNumber=157(5GHz), channelWidth={20MHz}, active], - 54 Mon Dec 10 11:43:31.753 [channelNumber=161(5GHz), channelWidth={40MHz(-1)}, active] - 55 Mon Dec 10 11:43:31.753 )} took 0.0007 seconds, returned 9 results - 56 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 165 does not require a live scan - 57 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 52 does not require a live scan - 58 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 56 does not require a live scan - 59 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request does not require a live scan - 60 Mon Dec 10 11:43:31.753 AutoJoin: Successful cache-assisted background scan request with channels {( - 61 Mon Dec 10 11:43:31.753 [channelNumber=165(5GHz), channelWidth={20MHz}, active], - 62 Mon Dec 10 11:43:31.753 [channelNumber=52(5GHz), channelWidth={40MHz(+1)}, DFS], - 63 Mon Dec 10 11:43:31.753 [channelNumber=56(5GHz), channelWidth={40MHz(-1)}, DFS] - 64 Mon Dec 10 11:43:31.753 )} took 0.0005 seconds, returned 6 results - 65 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 60 does not require a live scan - 66 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 64 does not require a live scan - 67 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request does not require a live scan - 68 Mon Dec 10 11:43:31.753 AutoJoin: Successful cache-assisted background scan request with channels {( - 69 Mon Dec 10 11:43:31.754 [channelNumber=60(5GHz), channelWidth={40MHz(+1)}, DFS], - 70 Mon Dec 10 11:43:31.754 [channelNumber=64(5GHz), channelWidth={40MHz(-1)}, DFS] - 71 Mon Dec 10 11:43:31.754 )} took 0.0003 seconds, returned 4 results - 72 Mon Dec 10 11:43:42.382 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) - 73 Mon Dec 10 11:43:42.382 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=270 Mbps - 74 Mon Dec 10 11:43:42.383 Info: link quality changed - 75 Mon Dec 10 11:49:12.347 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) - 76 Mon Dec 10 11:49:12.350 Info: QUERY SCAN CACHE request received from pid 92 (locationd) - 77 Mon Dec 10 11:52:32.194 Info: SCAN request received from pid 92 (locationd) with priority 2 - 78 Mon Dec 10 11:52:32.448 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) - 79 Mon Dec 10 11:52:32.450 Info: QUERY SCAN CACHE request received from pid 92 (locationd) - 80 Mon Dec 10 11:52:32.451 AutoJoin: Successful cache-assisted scan request for locationd with channels {( - 81 Mon Dec 10 11:52:32.451 [channelNumber=1(2GHz), channelWidth={20MHz}, active], - 82 Mon Dec 10 11:52:32.451 [channelNumber=2(2GHz), channelWidth={20MHz}, active], - 83 Mon Dec 10 11:52:32.451 [channelNumber=3(2GHz), channelWidth={20MHz}, active], - 84 Mon Dec 10 11:52:32.451 [channelNumber=4(2GHz), channelWidth={20MHz}, active], - 85 Mon Dec 10 11:52:32.451 [channelNumber=5(2GHz), channelWidth={20MHz}, active], - 86 Mon Dec 10 11:52:32.451 [channelNumber=6(2GHz), channelWidth={20MHz}, active] - 87 Mon Dec 10 11:52:32.451 )} took 0.2566 seconds, returned 10 results - 88 Mon Dec 10 11:52:32.451 Info: scan cache updated - 89 Mon Dec 10 11:52:32.712 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) - 90 Mon Dec 10 11:52:32.715 Info: QUERY SCAN CACHE request received from pid 92 (locationd) + 91 Mon Dec 10 11:43:31.748 )} took 0.0025 seconds, returned 10 results + 92 Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 4 does not require a live scan + 93 Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 5 does not require a live scan + 94 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 6 does not require a live scan + 95 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request does not require a live scan + 96 Mon Dec 10 11:43:31.749 AutoJoin: Successful cache-assisted background scan request with channels {( + 97 Mon Dec 10 11:43:31.749 [channelNumber=4(2GHz), channelWidth={20MHz}, active], + 98 Mon Dec 10 11:43:31.749 [channelNumber=5(2GHz), channelWidth={20MHz}, active], + 99 Mon Dec 10 11:43:31.749 [channelNumber=6(2GHz), channelWidth={20MHz}, active] + 100 Mon Dec 10 11:43:31.749 )} took 0.0008 seconds, returned 7 results + 101 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 7 does not require a live scan + 102 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 8 does not require a live scan + 103 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 9 does not require a live scan + 104 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request does not require a live scan + 105 Mon Dec 10 11:43:31.749 AutoJoin: Successful cache-assisted background scan request with channels {( + 106 Mon Dec 10 11:43:31.749 [channelNumber=7(2GHz), channelWidth={20MHz}, active], + 107 Mon Dec 10 11:43:31.749 [channelNumber=8(2GHz), channelWidth={20MHz}, active], + 108 Mon Dec 10 11:43:31.749 [channelNumber=9(2GHz), channelWidth={20MHz}, active] + 109 Mon Dec 10 11:43:31.749 )} took 0.0002 seconds, returned 1 results + 110 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 10 does not require a live scan + 111 Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 11 does not require a live scan + 112 Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 12 does not require a live scan + 113 Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request does not require a live scan + 114 Mon Dec 10 11:43:31.750 AutoJoin: Successful cache-assisted background scan request with channels {( + 115 Mon Dec 10 11:43:31.750 [channelNumber=10(2GHz), channelWidth={20MHz}, active], + 116 Mon Dec 10 11:43:31.750 [channelNumber=11(2GHz), channelWidth={20MHz}, active], + 117 Mon Dec 10 11:43:31.750 [channelNumber=12(2GHz), channelWidth={20MHz}, active] + 118 Mon Dec 10 11:43:31.750 )} took 0.0004 seconds, returned 4 results + 119 Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 13 does not require a live scan + 120 Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 36 does not require a live scan + 121 Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 40 does not require a live scan + 122 Mon Dec 10 11:43:31.751 Scan: Cache-assisted scan request does not require a live scan + 123 Mon Dec 10 11:43:31.751 AutoJoin: Successful cache-assisted background scan request with channels {( + 124 Mon Dec 10 11:43:31.751 [channelNumber=13(2GHz), channelWidth={20MHz}, active], + 125 Mon Dec 10 11:43:31.751 [channelNumber=36(5GHz), channelWidth={40MHz(+1)}, active], + 126 Mon Dec 10 11:43:31.751 [channelNumber=40(5GHz), channelWidth={40MHz(-1)}, active] + 127 Mon Dec 10 11:43:31.751 )} took 0.0009 seconds, returned 9 results + 128 Mon Dec 10 11:43:31.751 Scan: Cache-assisted scan request on channel 44 does not require a live scan + 129 Mon Dec 10 11:43:31.751 Scan: Cache-assisted scan request on channel 48 does not require a live scan + 130 Mon Dec 10 11:43:31.751 Scan: Cache-assisted scan request on channel 149 does not require a live scan + 131 Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request does not require a live scan + 132 Mon Dec 10 11:43:31.752 AutoJoin: Successful cache-assisted background scan request with channels {( + 133 Mon Dec 10 11:43:31.752 [channelNumber=44(5GHz), channelWidth={40MHz(+1)}, active], + 134 Mon Dec 10 11:43:31.752 [channelNumber=48(5GHz), channelWidth={40MHz(-1)}, active], + 135 Mon Dec 10 11:43:31.752 [channelNumber=149(5GHz), channelWidth={20MHz}, active] + 136 Mon Dec 10 11:43:31.752 )} took 0.0010 seconds, returned 9 results + 137 Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request on channel 153 does not require a live scan + 138 Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request on channel 157 does not require a live scan + 139 Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request on channel 161 does not require a live scan + 140 Mon Dec 10 11:43:31.752 Scan: Cache-assisted scan request does not require a live scan + 141 Mon Dec 10 11:43:31.753 AutoJoin: Successful cache-assisted background scan request with channels {( + 142 Mon Dec 10 11:43:31.753 [channelNumber=153(5GHz), channelWidth={40MHz(-1)}, active], + 143 Mon Dec 10 11:43:31.753 [channelNumber=157(5GHz), channelWidth={20MHz}, active], + 144 Mon Dec 10 11:43:31.753 [channelNumber=161(5GHz), channelWidth={40MHz(-1)}, active] + 145 Mon Dec 10 11:43:31.753 )} took 0.0007 seconds, returned 9 results + 146 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 165 does not require a live scan + 147 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 52 does not require a live scan + 148 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 56 does not require a live scan + 149 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request does not require a live scan + 150 Mon Dec 10 11:43:31.753 AutoJoin: Successful cache-assisted background scan request with channels {( + 151 Mon Dec 10 11:43:31.753 [channelNumber=165(5GHz), channelWidth={20MHz}, active], + 152 Mon Dec 10 11:43:31.753 [channelNumber=52(5GHz), channelWidth={40MHz(+1)}, DFS], + 153 Mon Dec 10 11:43:31.753 [channelNumber=56(5GHz), channelWidth={40MHz(-1)}, DFS] + 154 Mon Dec 10 11:43:31.753 )} took 0.0005 seconds, returned 6 results + 155 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 60 does not require a live scan + 156 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request on channel 64 does not require a live scan + 157 Mon Dec 10 11:43:31.753 Scan: Cache-assisted scan request does not require a live scan + 158 Mon Dec 10 11:43:31.753 AutoJoin: Successful cache-assisted background scan request with channels {( + 159 Mon Dec 10 11:43:31.754 [channelNumber=60(5GHz), channelWidth={40MHz(+1)}, DFS], + 160 Mon Dec 10 11:43:31.754 [channelNumber=64(5GHz), channelWidth={40MHz(-1)}, DFS] + 161 Mon Dec 10 11:43:31.754 )} took 0.0003 seconds, returned 4 results + 162 Mon Dec 10 11:43:42.382 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) + 163 Mon Dec 10 11:43:42.382 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=270 Mbps + 164 Mon Dec 10 11:43:42.383 Info: link quality changed + 165 Mon Dec 10 11:49:12.347 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) + 166 Mon Dec 10 11:49:12.350 Info: QUERY SCAN CACHE request received from pid 92 (locationd) + 167 Mon Dec 10 11:52:32.194 Info: SCAN request received from pid 92 (locationd) with priority 2 + 168 Mon Dec 10 11:52:32.448 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) + 169 Mon Dec 10 11:52:32.450 Info: QUERY SCAN CACHE request received from pid 92 (locationd) + 170 Mon Dec 10 11:52:32.451 AutoJoin: Successful cache-assisted scan request for locationd with channels {( + 171 Mon Dec 10 11:52:32.451 [channelNumber=1(2GHz), channelWidth={20MHz}, active], + 172 Mon Dec 10 11:52:32.451 [channelNumber=2(2GHz), channelWidth={20MHz}, active], + 173 Mon Dec 10 11:52:32.451 [channelNumber=3(2GHz), channelWidth={20MHz}, active], + 174 Mon Dec 10 11:52:32.451 [channelNumber=4(2GHz), channelWidth={20MHz}, active], + 175 Mon Dec 10 11:52:32.451 [channelNumber=5(2GHz), channelWidth={20MHz}, active], + 176 Mon Dec 10 11:52:32.451 [channelNumber=6(2GHz), channelWidth={20MHz}, active] + 177 Mon Dec 10 11:52:32.451 )} took 0.2566 seconds, returned 10 results + 178 Mon Dec 10 11:52:32.451 Info: scan cache updated + 179 Mon Dec 10 11:52:32.712 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) + 180 Mon Dec 10 11:52:32.715 Info: QUERY SCAN CACHE request received from pid 92 (locationd) @@ -103,96 +103,96 @@ {last_modified_time} test.log Page 3 - 91 Mon Dec 10 11:52:32.715 AutoJoin: Successful cache-assisted scan request for locationd with channels {( - 92 Mon Dec 10 11:52:32.715 [channelNumber=7(2GHz), channelWidth={20MHz}, active], - 93 Mon Dec 10 11:52:32.715 [channelNumber=8(2GHz), channelWidth={20MHz}, active], - 94 Mon Dec 10 11:52:32.715 [channelNumber=9(2GHz), channelWidth={20MHz}, active], - 95 Mon Dec 10 11:52:32.715 [channelNumber=10(2GHz), channelWidth={20MHz}, active], - 96 Mon Dec 10 11:52:32.715 [channelNumber=11(2GHz), channelWidth={20MHz}, active], - 97 Mon Dec 10 11:52:32.715 [channelNumber=12(2GHz), channelWidth={20MHz}, active] - 98 Mon Dec 10 11:52:32.715 )} took 0.2636 seconds, returned 10 results - 99 Mon Dec 10 11:52:32.994 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) - 100 Mon Dec 10 11:52:32.997 Info: QUERY SCAN CACHE request received from pid 92 (locationd) - 101 Mon Dec 10 11:52:32.998 AutoJoin: Successful cache-assisted scan request for locationd with channels {( - 102 Mon Dec 10 11:52:32.998 [channelNumber=13(2GHz), channelWidth={20MHz}, active], - 103 Mon Dec 10 11:52:32.998 [channelNumber=36(5GHz), channelWidth={40MHz(+1)}, active], - 104 Mon Dec 10 11:52:32.998 [channelNumber=40(5GHz), channelWidth={40MHz(-1)}, active], - 105 Mon Dec 10 11:52:32.998 [channelNumber=44(5GHz), channelWidth={40MHz(+1)}, active], - 106 Mon Dec 10 11:52:32.998 [channelNumber=48(5GHz), channelWidth={40MHz(-1)}, active], - 107 Mon Dec 10 11:52:32.998 [channelNumber=149(5GHz), channelWidth={20MHz}, active] - 108 Mon Dec 10 11:52:32.998 )} took 0.2822 seconds, returned 14 results - 109 Mon Dec 10 11:52:33.405 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) - 110 Mon Dec 10 11:52:33.408 Info: QUERY SCAN CACHE request received from pid 92 (locationd) - 111 Mon Dec 10 11:52:33.409 AutoJoin: Successful cache-assisted scan request for locationd with channels {( - 112 Mon Dec 10 11:52:33.409 [channelNumber=153(5GHz), channelWidth={40MHz(-1)}, active], - 113 Mon Dec 10 11:52:33.409 [channelNumber=157(5GHz), channelWidth={20MHz}, active], - 114 Mon Dec 10 11:52:33.409 [channelNumber=161(5GHz), channelWidth={40MHz(-1)}, active], - 115 Mon Dec 10 11:52:33.409 [channelNumber=165(5GHz), channelWidth={20MHz}, active], - 116 Mon Dec 10 11:52:33.409 [channelNumber=52(5GHz), channelWidth={40MHz(+1)}, DFS], - 117 Mon Dec 10 11:52:33.409 [channelNumber=56(5GHz), channelWidth={40MHz(-1)}, DFS] - 118 Mon Dec 10 11:52:33.409 )} took 0.4099 seconds, returned 11 results - 119 Mon Dec 10 11:52:33.669 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) - 120 Mon Dec 10 11:52:33.672 Info: QUERY SCAN CACHE request received from pid 92 (locationd) - 121 Mon Dec 10 11:52:33.672 AutoJoin: Successful cache-assisted scan request for locationd with channels {( - 122 Mon Dec 10 11:52:33.672 [channelNumber=60(5GHz), channelWidth={40MHz(+1)}, DFS], - 123 Mon Dec 10 11:52:33.672 [channelNumber=64(5GHz), channelWidth={40MHz(-1)}, DFS] - 124 Mon Dec 10 11:52:33.672 )} took 0.2625 seconds, returned 8 results - 125 Mon Dec 10 11:52:33.673 Info: scan cache updated - 126 Mon Dec 10 11:52:33.693 Info: SCAN request received from pid 92 (locationd) with priority 2 - 127 Mon Dec 10 11:52:33.693 Scan: locationd requested a live scan less than 10 seconds after previous request (1.4991s) returning cached scan results - 128 Mon Dec 10 11:52:33.728 Info: SCAN request received from pid 92 (locationd) with priority 2 - 129 Mon Dec 10 11:52:33.728 Scan: locationd requested a live scan less than 10 seconds after previous request (1.5339s) returning cached scan results - 130 Mon Dec 10 11:55:47.609 Driver Discovery: _PMConnectionHandler: caps = CPU Net Disk - 131 Mon Dec 10 11:55:47.609 Driver Discovery: _PMConnectionHandler: Being put into maintenance wake mode while fully awake. - 132 Mon Dec 10 11:55:47.610 Info: psCallback: powerSource = AC Power - 133 Mon Dec 10 11:55:47.610 Info: psCallback: set powersave disabled on en0 - 134 Mon Dec 10 11:55:47.637 Info: RELINQUISH BT PAGING LOCK request received from pid 106 (bluetoothd) - 135 Mon Dec 10 11:55:47.637 Info: RELINQUISH BT PAGING LOCK request received from pid 106 (bluetoothd) - 136 Mon Dec 10 11:55:47.638 BTC: BT PAGING state already set to 0 - 137 Mon Dec 10 11:55:47.638 BTC: BT PAGING state already set to 0 - 138 Mon Dec 10 11:55:47.638 Info: BT PAGING LOCK RELINQUISHED after 0.0 seconds - 139 Mon Dec 10 11:55:47.638 Info: BT PAGING LOCK RELINQUISHED after 0.0 seconds - 140 Mon Dec 10 11:55:47.638 Info: BT PAGING LOCK RELINQUISHED, re-enabling deferred WiFi requests - 141 Mon Dec 10 11:55:47.638 Info: BT PAGING LOCK RELINQUISHED, re-enabling deferred WiFi requests - 142 Mon Dec 10 11:55:48.093 IPC: ADDED XPC CLIENT CONNECTION [loginwindow (pid=101, euid=1651299376, egid=604256670)] - 143 Mon Dec 10 11:55:48.093 Info: START MONITORING EVENT request received from pid 101 (loginwindow) - 144 Mon Dec 10 11:55:48.093 Info: START MONITORING EVENT request received from pid 101 (loginwindow) - 145 Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) - 146 Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) - 147 Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) - 148 Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) - 149 Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) - 150 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) - 151 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) - 152 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) - 153 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) - 154 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) - 155 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) - 156 Mon Dec 10 11:55:48.105 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) - 157 Mon Dec 10 11:56:07.629 Driver Discovery: _PMConnectionHandler: caps = - 158 Mon Dec 10 11:56:07.629 AutoJoin: BEST CONNECTED SCAN CANCELLED on interface en0 - 159 Mon Dec 10 11:56:07.629 AutoJoin: BACKGROUND SCAN CANCELLED on interface en0 - 160 Mon Dec 10 11:56:07.629 AutoJoin: Auto-join retry cancelled on interface en0 - 161 Mon Dec 10 11:56:07.629 Offload: _tcpKeepAliveActive: TCP keep-alive is active. - 162 Mon Dec 10 11:56:07.637 P2P: _changeInterfaceFlags: Marking p2p0 down - 163 Mon Dec 10 11:56:07.637 Info: SleepAcknowledgementCheckForHostAP: Checking sleep readiness for HostAP - 164 Mon Dec 10 11:56:07.637 SleepAcknowledgementCheck: Checking sleep readiness - 165 Mon Dec 10 11:56:07.637 SleepAcknowledgementCheck: Delaying sleep acknowledgement because of VifUp - 166 Mon Dec 10 11:56:07.638 _interfaceFlagsChanged: KEV_DL_SIFFLAGS received for p2p0 [flags=0xffff8802 (down)]. - 167 Mon Dec 10 11:56:07.638 _interfaceFlagsChanged: Flags changed for p2p0 (0xffff8843 -> 0xffff8802) (down). - 168 Mon Dec 10 11:56:07.638 P2P: _deviceInterfaceMarkedDown: p2p0 marked down - 169 Mon Dec 10 11:56:07.638 P2P: _removeTimeoutForActionAndParam: Attempting to remove 'Stop GO' action (param = 0x0) - 170 Mon Dec 10 11:56:07.638 P2P: _removeTimeoutForActionAndParam: Attempting to remove 'Scan' action (param = 0x0) - 171 Mon Dec 10 11:56:07.638 P2P: _p2pSupervisorEventRunLoopCallback: Mark down complete for p2p0 - 172 Mon Dec 10 11:56:07.638 SleepAcknowledgementCheck: Checking sleep readiness - 173 Mon Dec 10 11:56:07.638 WoW: SleepAcknowledgementCheck: Checking if auto-join is in progress before sleep acknowledgement - 174 Mon Dec 10 11:56:07.638 WoW: SleepAcknowledgementDelayForAutoJoinAttempt_block_invoke: AUTO-JOIN attempt complete for en0, re-checking sleep readiness - 175 Mon Dec 10 11:56:07.638 SleepAcknowledgementCheck: Checking sleep readiness - 176 Mon Dec 10 11:56:07.639 WoW: _wowEnabled: WoW is active on en0 - 177 Mon Dec 10 11:56:07.639 WoW: wowExchangeRequiredForNode: WoW exchange not required for en0 - 178 Mon Dec 10 11:56:07.639 _acknowledgeSleepEvent: Acknowledging sleep event - 179 Mon Dec 10 11:56:07.639 Info: PRIORITY LOCK ADDED [client=airportd, type=4, interface=(null), priority=7] - 180 Mon Dec 10 11:56:07.640 AutoJoin: Auto-join retry cancelled on interface en0 + 181 Mon Dec 10 11:52:32.715 AutoJoin: Successful cache-assisted scan request for locationd with channels {( + 182 Mon Dec 10 11:52:32.715 [channelNumber=7(2GHz), channelWidth={20MHz}, active], + 183 Mon Dec 10 11:52:32.715 [channelNumber=8(2GHz), channelWidth={20MHz}, active], + 184 Mon Dec 10 11:52:32.715 [channelNumber=9(2GHz), channelWidth={20MHz}, active], + 185 Mon Dec 10 11:52:32.715 [channelNumber=10(2GHz), channelWidth={20MHz}, active], + 186 Mon Dec 10 11:52:32.715 [channelNumber=11(2GHz), channelWidth={20MHz}, active], + 187 Mon Dec 10 11:52:32.715 [channelNumber=12(2GHz), channelWidth={20MHz}, active] + 188 Mon Dec 10 11:52:32.715 )} took 0.2636 seconds, returned 10 results + 189 Mon Dec 10 11:52:32.994 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) + 190 Mon Dec 10 11:52:32.997 Info: QUERY SCAN CACHE request received from pid 92 (locationd) + 191 Mon Dec 10 11:52:32.998 AutoJoin: Successful cache-assisted scan request for locationd with channels {( + 192 Mon Dec 10 11:52:32.998 [channelNumber=13(2GHz), channelWidth={20MHz}, active], + 193 Mon Dec 10 11:52:32.998 [channelNumber=36(5GHz), channelWidth={40MHz(+1)}, active], + 194 Mon Dec 10 11:52:32.998 [channelNumber=40(5GHz), channelWidth={40MHz(-1)}, active], + 195 Mon Dec 10 11:52:32.998 [channelNumber=44(5GHz), channelWidth={40MHz(+1)}, active], + 196 Mon Dec 10 11:52:32.998 [channelNumber=48(5GHz), channelWidth={40MHz(-1)}, active], + 197 Mon Dec 10 11:52:32.998 [channelNumber=149(5GHz), channelWidth={20MHz}, active] + 198 Mon Dec 10 11:52:32.998 )} took 0.2822 seconds, returned 14 results + 199 Mon Dec 10 11:52:33.405 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) + 200 Mon Dec 10 11:52:33.408 Info: QUERY SCAN CACHE request received from pid 92 (locationd) + 201 Mon Dec 10 11:52:33.409 AutoJoin: Successful cache-assisted scan request for locationd with channels {( + 202 Mon Dec 10 11:52:33.409 [channelNumber=153(5GHz), channelWidth={40MHz(-1)}, active], + 203 Mon Dec 10 11:52:33.409 [channelNumber=157(5GHz), channelWidth={20MHz}, active], + 204 Mon Dec 10 11:52:33.409 [channelNumber=161(5GHz), channelWidth={40MHz(-1)}, active], + 205 Mon Dec 10 11:52:33.409 [channelNumber=165(5GHz), channelWidth={20MHz}, active], + 206 Mon Dec 10 11:52:33.409 [channelNumber=52(5GHz), channelWidth={40MHz(+1)}, DFS], + 207 Mon Dec 10 11:52:33.409 [channelNumber=56(5GHz), channelWidth={40MHz(-1)}, DFS] + 208 Mon Dec 10 11:52:33.409 )} took 0.4099 seconds, returned 11 results + 209 Mon Dec 10 11:52:33.669 Driver Event: _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0) + 210 Mon Dec 10 11:52:33.672 Info: QUERY SCAN CACHE request received from pid 92 (locationd) + 211 Mon Dec 10 11:52:33.672 AutoJoin: Successful cache-assisted scan request for locationd with channels {( + 212 Mon Dec 10 11:52:33.672 [channelNumber=60(5GHz), channelWidth={40MHz(+1)}, DFS], + 213 Mon Dec 10 11:52:33.672 [channelNumber=64(5GHz), channelWidth={40MHz(-1)}, DFS] + 214 Mon Dec 10 11:52:33.672 )} took 0.2625 seconds, returned 8 results + 215 Mon Dec 10 11:52:33.673 Info: scan cache updated + 216 Mon Dec 10 11:52:33.693 Info: SCAN request received from pid 92 (locationd) with priority 2 + 217 Mon Dec 10 11:52:33.693 Scan: locationd requested a live scan less than 10 seconds after previous request (1.4991s) returning cached scan results + 218 Mon Dec 10 11:52:33.728 Info: SCAN request received from pid 92 (locationd) with priority 2 + 219 Mon Dec 10 11:52:33.728 Scan: locationd requested a live scan less than 10 seconds after previous request (1.5339s) returning cached scan results + 220 Mon Dec 10 11:55:47.609 Driver Discovery: _PMConnectionHandler: caps = CPU Net Disk + 221 Mon Dec 10 11:55:47.609 Driver Discovery: _PMConnectionHandler: Being put into maintenance wake mode while fully awake. + 222 Mon Dec 10 11:55:47.610 Info: psCallback: powerSource = AC Power + 223 Mon Dec 10 11:55:47.610 Info: psCallback: set powersave disabled on en0 + 224 Mon Dec 10 11:55:47.637 Info: RELINQUISH BT PAGING LOCK request received from pid 106 (bluetoothd) + 225 Mon Dec 10 11:55:47.637 Info: RELINQUISH BT PAGING LOCK request received from pid 106 (bluetoothd) + 226 Mon Dec 10 11:55:47.638 BTC: BT PAGING state already set to 0 + 227 Mon Dec 10 11:55:47.638 BTC: BT PAGING state already set to 0 + 228 Mon Dec 10 11:55:47.638 Info: BT PAGING LOCK RELINQUISHED after 0.0 seconds + 229 Mon Dec 10 11:55:47.638 Info: BT PAGING LOCK RELINQUISHED after 0.0 seconds + 230 Mon Dec 10 11:55:47.638 Info: BT PAGING LOCK RELINQUISHED, re-enabling deferred WiFi requests + 231 Mon Dec 10 11:55:47.638 Info: BT PAGING LOCK RELINQUISHED, re-enabling deferred WiFi requests + 232 Mon Dec 10 11:55:48.093 IPC: ADDED XPC CLIENT CONNECTION [loginwindow (pid=101, euid=1651299376, egid=604256670)] + 233 Mon Dec 10 11:55:48.093 Info: START MONITORING EVENT request received from pid 101 (loginwindow) + 234 Mon Dec 10 11:55:48.093 Info: START MONITORING EVENT request received from pid 101 (loginwindow) + 235 Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) + 236 Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) + 237 Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) + 238 Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) + 239 Mon Dec 10 11:55:48.094 Info: START MONITORING EVENT request received from pid 101 (loginwindow) + 240 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) + 241 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) + 242 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) + 243 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) + 244 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) + 245 Mon Dec 10 11:55:48.104 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) + 246 Mon Dec 10 11:55:48.105 Info: STOP MONITORING EVENT request received from pid 101 (loginwindow) + 247 Mon Dec 10 11:56:07.629 Driver Discovery: _PMConnectionHandler: caps = + 248 Mon Dec 10 11:56:07.629 AutoJoin: BEST CONNECTED SCAN CANCELLED on interface en0 + 249 Mon Dec 10 11:56:07.629 AutoJoin: BACKGROUND SCAN CANCELLED on interface en0 + 250 Mon Dec 10 11:56:07.629 AutoJoin: Auto-join retry cancelled on interface en0 + 251 Mon Dec 10 11:56:07.629 Offload: _tcpKeepAliveActive: TCP keep-alive is active. + 252 Mon Dec 10 11:56:07.637 P2P: _changeInterfaceFlags: Marking p2p0 down + 253 Mon Dec 10 11:56:07.637 Info: SleepAcknowledgementCheckForHostAP: Checking sleep readiness for HostAP + 254 Mon Dec 10 11:56:07.637 SleepAcknowledgementCheck: Checking sleep readiness + 255 Mon Dec 10 11:56:07.637 SleepAcknowledgementCheck: Delaying sleep acknowledgement because of VifUp + 256 Mon Dec 10 11:56:07.638 _interfaceFlagsChanged: KEV_DL_SIFFLAGS received for p2p0 [flags=0xffff8802 (down)]. + 257 Mon Dec 10 11:56:07.638 _interfaceFlagsChanged: Flags changed for p2p0 (0xffff8843 -> 0xffff8802) (down). + 258 Mon Dec 10 11:56:07.638 P2P: _deviceInterfaceMarkedDown: p2p0 marked down + 259 Mon Dec 10 11:56:07.638 P2P: _removeTimeoutForActionAndParam: Attempting to remove 'Stop GO' action (param = 0x0) + 260 Mon Dec 10 11:56:07.638 P2P: _removeTimeoutForActionAndParam: Attempting to remove 'Scan' action (param = 0x0) + 261 Mon Dec 10 11:56:07.638 P2P: _p2pSupervisorEventRunLoopCallback: Mark down complete for p2p0 + 262 Mon Dec 10 11:56:07.638 SleepAcknowledgementCheck: Checking sleep readiness + 263 Mon Dec 10 11:56:07.638 WoW: SleepAcknowledgementCheck: Checking if auto-join is in progress before sleep acknowledgement + 264 Mon Dec 10 11:56:07.638 WoW: SleepAcknowledgementDelayForAutoJoinAttempt_block_invoke: AUTO-JOIN attempt complete for en0, re-checking sleep readiness + 265 Mon Dec 10 11:56:07.638 SleepAcknowledgementCheck: Checking sleep readiness + 266 Mon Dec 10 11:56:07.639 WoW: _wowEnabled: WoW is active on en0 + 267 Mon Dec 10 11:56:07.639 WoW: wowExchangeRequiredForNode: WoW exchange not required for en0 + 268 Mon Dec 10 11:56:07.639 _acknowledgeSleepEvent: Acknowledging sleep event + 269 Mon Dec 10 11:56:07.639 Info: PRIORITY LOCK ADDED [client=airportd, type=4, interface=(null), priority=7] + 270 Mon Dec 10 11:56:07.640 AutoJoin: Auto-join retry cancelled on interface en0 diff --git a/tests/fixtures/pr/test_page_length1.log.expected b/tests/fixtures/pr/test_page_length1.log.expected index 09d8e3ce6..a09a2a986 100644 --- a/tests/fixtures/pr/test_page_length1.log.expected +++ b/tests/fixtures/pr/test_page_length1.log.expected @@ -1,10 +1,12 @@ - 1 Mon Dec 10 11:42:56.854 Info: 802.1X changed - 2 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 3 Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 4 Mon Dec 10 11:42:57.002 Info: 802.1X changed - 5 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 6 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 7 Mon Dec 10 11:42:57.152 Info: 802.1X changed - 8 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 9 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 10 Mon Dec 10 11:42:57.302 Info: 802.1X changed + 6 Mon Dec 10 11:42:56.854 Info: 802.1X changed + 7 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 8 Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 9 Mon Dec 10 11:42:57.002 Info: 802.1X changed + 10 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + + 11 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 12 Mon Dec 10 11:42:57.152 Info: 802.1X changed + 13 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 14 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 15 Mon Dec 10 11:42:57.302 Info: 802.1X changed + From f497fb9d8896a9fc659e99cd7c7b783249fdebee Mon Sep 17 00:00:00 2001 From: Tilak Patidar Date: Sat, 22 Dec 2018 12:30:10 +0530 Subject: [PATCH 0154/1135] pr: read from stdin --- src/pr/pr.rs | 8 +- tests/fixtures/pr/stdin.log | 82 +++++++++++++++++ tests/fixtures/pr/stdin.log.expected | 132 +++++++++++++++++++++++++++ tests/test_pr.rs | 18 ++++ 4 files changed, 238 insertions(+), 2 deletions(-) create mode 100644 tests/fixtures/pr/stdin.log create mode 100644 tests/fixtures/pr/stdin.log.expected diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 0f1fffcd8..87ef46120 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -330,7 +330,7 @@ pub fn uumain(args: Vec) -> i32 { } fn is_a_file(could_be_file: &String) -> bool { - File::open(could_be_file).is_ok() + could_be_file == FILE_STDIN || File::open(could_be_file).is_ok() } fn print_error(matches: &Matches, err: PrError) { @@ -375,7 +375,11 @@ fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { } fn build_options(matches: &Matches, path: &String) -> Result { - let header: String = matches.opt_str(STRING_HEADER_OPTION).unwrap_or(path.to_string()); + let header: String = matches.opt_str(STRING_HEADER_OPTION).unwrap_or(if path == FILE_STDIN { + "".to_string() + } else { + path.to_string() + }); let default_first_number = NumberingMode::default().first_number; let first_number = matches.opt_str(FIRST_LINE_NUMBER_OPTION).map(|n| { diff --git a/tests/fixtures/pr/stdin.log b/tests/fixtures/pr/stdin.log new file mode 100644 index 000000000..72c7f4604 --- /dev/null +++ b/tests/fixtures/pr/stdin.log @@ -0,0 +1,82 @@ +ntation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.705 Info: 802.1X changed +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.854 Info: 802.1X changed +Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.002 Info: 802.1X changed +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.152 Info: 802.1X changed +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.302 Info: 802.1X changed +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.449 Info: 802.1X changed +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.600 Info: 802.1X changed +Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.749 Info: 802.1X changed +Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.896 Info: 802.1X changed +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.045 Info: 802.1X changed +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.193 Info: 802.1X changed +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.342 Info: 802.1X changed +Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.491 Info: 802.1X changed +Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.640 Info: 802.1X changed +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.805 Info: 802.1X changed +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.958 Info: 802.1X changed +Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.155 Info: 802.1X changed +Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.352 Info: 802.1X changed +Mon Dec 10 11:42:59.354 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.354 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.372 Driver Event: _bsd_80211_event_callback: APPLE80211_M_ROAM_END (en0) +Mon Dec 10 11:42:59.372 Info: Roaming ended on interface en0 +Mon Dec 10 11:42:59.372 Driver Event: _bsd_80211_event_callback: RSN_HANDSHAKE_DONE (en0) +Mon Dec 10 11:42:59.373 Info: -[CWXPCInterfaceContext setRoamInProgress:reason:]_block_invoke: roam status metric data: CWAWDMetricRoamStatus: status:0 security: 4 profile:5 origin:<34fcb9>(-69) target:<6cf37f>(-56) latency:6.083439s +Mon Dec 10 11:42:59.373 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90046 +Mon Dec 10 11:42:59.373 Info: RESUME AWDL for interface en0, reason=Roam token=2685 +Mon Dec 10 11:42:59.373 Info: PRIORITY LOCK REMOVED [client=airportd, type=4, interface=en0, priority=5] +Mon Dec 10 11:42:59.374 Info: -[CWXPCInterfaceContext __setAWDLOperatingMode:interface:error:]: attempting to set AWDL mode to 0 +Mon Dec 10 11:43:01.072 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Service/18E14EA7-4641-4104-B315-A9315814912A/DHCP' +Mon Dec 10 11:43:01.072 SC: _processDHCPChanges: State:/Network/Service/18E14EA7-4641-4104-B315-A9315814912A/DHCP +Mon Dec 10 11:43:01.072 SC: _processDHCPChanges: DHCP airport_changed = 1 +Mon Dec 10 11:43:01.073 Info: -[CWXPCSubsystem internal_submitIPConfigLatencyMetric:leaseDuration:]: IPConfig Latency metric data: CWAWDMetricIPConfigLatencyData: DHCP latency: 29010 msecs, duration: 480 mins, security: 4 +Mon Dec 10 11:43:01.073 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90007 +Mon Dec 10 11:43:01.073 SC: _setDHCPMessage: dhcpInfoKey "State:/Network/Interface/en0/AirPort/DHCP Message" = (null) +Mon Dec 10 11:43:10.369 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 11:43:10.369 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=162 Mbps +Mon Dec 10 11:43:10.369 Info: link quality changed +Mon Dec 10 11:43:23.376 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 11:43:23.377 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=243 Mbps +Mon Dec 10 11:43:23.377 Info: link quality changed +Mon Dec 10 11:43:28.380 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 11:43:28.380 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=216 Mbps +Mon Dec 10 11:43:28.380 Info: link quality changed +Mon Dec 10 11:43:31.744 AutoJoin: BACKGROUND SCAN request on interface en0 with SSID list (null) diff --git a/tests/fixtures/pr/stdin.log.expected b/tests/fixtures/pr/stdin.log.expected new file mode 100644 index 000000000..6922ee594 --- /dev/null +++ b/tests/fixtures/pr/stdin.log.expected @@ -0,0 +1,132 @@ + + +{last_modified_time} Page 1 + + + 1 ntation processAirPortStateChanges]: pppConnectionState 0 + 2 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 3 Mon Dec 10 11:42:56.705 Info: 802.1X changed + 4 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 5 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 6 Mon Dec 10 11:42:56.854 Info: 802.1X changed + 7 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 8 Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 9 Mon Dec 10 11:42:57.002 Info: 802.1X changed + 10 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 11 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 12 Mon Dec 10 11:42:57.152 Info: 802.1X changed + 13 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 14 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 15 Mon Dec 10 11:42:57.302 Info: 802.1X changed + 16 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 17 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 18 Mon Dec 10 11:42:57.449 Info: 802.1X changed + 19 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 20 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 21 Mon Dec 10 11:42:57.600 Info: 802.1X changed + 22 Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 23 Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 24 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 25 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 26 Mon Dec 10 11:42:57.749 Info: 802.1X changed + 27 Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 28 Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 29 Mon Dec 10 11:42:57.896 Info: 802.1X changed + 30 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 31 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 32 Mon Dec 10 11:42:58.045 Info: 802.1X changed + 33 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 34 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 35 Mon Dec 10 11:42:58.193 Info: 802.1X changed + 36 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 37 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 38 Mon Dec 10 11:42:58.342 Info: 802.1X changed + 39 Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 40 Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 41 Mon Dec 10 11:42:58.491 Info: 802.1X changed + 42 Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 43 Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 44 Mon Dec 10 11:42:58.640 Info: 802.1X changed + 45 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 46 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 47 Mon Dec 10 11:42:58.805 Info: 802.1X changed + 48 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 49 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 50 Mon Dec 10 11:42:58.958 Info: 802.1X changed + 51 Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 52 Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 53 Mon Dec 10 11:42:59.155 Info: 802.1X changed + 54 Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 55 Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 56 Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + + + +{last_modified_time} Page 2 + + + 57 Mon Dec 10 11:42:59.354 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 58 Mon Dec 10 11:42:59.354 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 59 Mon Dec 10 11:42:59.372 Driver Event: _bsd_80211_event_callback: APPLE80211_M_ROAM_END (en0) + 60 Mon Dec 10 11:42:59.372 Info: Roaming ended on interface en0 + 61 Mon Dec 10 11:42:59.372 Driver Event: _bsd_80211_event_callback: RSN_HANDSHAKE_DONE (en0) + 62 Mon Dec 10 11:42:59.373 Info: -[CWXPCInterfaceContext setRoamInProgress:reason:]_block_invoke: roam status metric data: CWAWDMetricRoamStatus: status:0 security: 4 profile:5 origin:<34fcb9>(-69) target:<6cf37f>(-56) latency:6.083439s + 63 Mon Dec 10 11:42:59.373 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90046 + 64 Mon Dec 10 11:42:59.373 Info: RESUME AWDL for interface en0, reason=Roam token=2685 + 65 Mon Dec 10 11:42:59.373 Info: PRIORITY LOCK REMOVED [client=airportd, type=4, interface=en0, priority=5] + 66 Mon Dec 10 11:42:59.374 Info: -[CWXPCInterfaceContext __setAWDLOperatingMode:interface:error:]: attempting to set AWDL mode to 0 + 67 Mon Dec 10 11:43:01.072 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Service/18E14EA7-4641-4104-B315-A9315814912A/DHCP' + 68 Mon Dec 10 11:43:01.072 SC: _processDHCPChanges: State:/Network/Service/18E14EA7-4641-4104-B315-A9315814912A/DHCP + 69 Mon Dec 10 11:43:01.072 SC: _processDHCPChanges: DHCP airport_changed = 1 + 70 Mon Dec 10 11:43:01.073 Info: -[CWXPCSubsystem internal_submitIPConfigLatencyMetric:leaseDuration:]: IPConfig Latency metric data: CWAWDMetricIPConfigLatencyData: DHCP latency: 29010 msecs, duration: 480 mins, security: 4 + 71 Mon Dec 10 11:43:01.073 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90007 + 72 Mon Dec 10 11:43:01.073 SC: _setDHCPMessage: dhcpInfoKey "State:/Network/Interface/en0/AirPort/DHCP Message" = (null) + 73 Mon Dec 10 11:43:10.369 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) + 74 Mon Dec 10 11:43:10.369 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=162 Mbps + 75 Mon Dec 10 11:43:10.369 Info: link quality changed + 76 Mon Dec 10 11:43:23.376 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) + 77 Mon Dec 10 11:43:23.377 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=243 Mbps + 78 Mon Dec 10 11:43:23.377 Info: link quality changed + 79 Mon Dec 10 11:43:28.380 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) + 80 Mon Dec 10 11:43:28.380 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=216 Mbps + 81 Mon Dec 10 11:43:28.380 Info: link quality changed + 82 Mon Dec 10 11:43:31.744 AutoJoin: BACKGROUND SCAN request on interface en0 with SSID list (null) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_pr.rs b/tests/test_pr.rs index 6063e569b..1594a98d0 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -16,6 +16,10 @@ fn file_last_modified_time(ucmd: &UCommand, path: &str) -> String { }).unwrap_or(String::new()); } +fn now_time() -> String { + Local::now().format("%b %d %H:%M %Y").to_string() +} + #[test] fn test_without_any_options() { @@ -275,3 +279,17 @@ fn test_with_suppress_error_option() { .stderr_is("") .stdout_is(""); } + +#[test] +fn test_with_stdin() { + let test_file_path = "stdin.log"; + let expected_file_path = "stdin.log.expected"; + let mut scenario = new_ucmd!(); + scenario + .pipe_in_fixture("stdin.log") + .args(&["--pages=1:2", "-n", "-"]) + .run() + .stdout_is_templated_fixture(expected_file_path, vec![ + (&"{last_modified_time}".to_string(), &now_time()), + ]); +} From 69371ce3ceeceacde449b561cd599d0594231d43 Mon Sep 17 00:00:00 2001 From: Tilak Patidar Date: Sat, 22 Dec 2018 13:00:16 +0530 Subject: [PATCH 0155/1135] pr: add tests for --column with across option --- tests/fixtures/pr/column.log | 2000 ++++++++++++++++++ tests/fixtures/pr/column.log.expected | 198 ++ tests/fixtures/pr/column_across.log.expected | 198 ++ tests/test_pr.rs | 31 + 4 files changed, 2427 insertions(+) create mode 100644 tests/fixtures/pr/column.log create mode 100644 tests/fixtures/pr/column.log.expected create mode 100644 tests/fixtures/pr/column_across.log.expected diff --git a/tests/fixtures/pr/column.log b/tests/fixtures/pr/column.log new file mode 100644 index 000000000..7972c09aa --- /dev/null +++ b/tests/fixtures/pr/column.log @@ -0,0 +1,2000 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 +512 +513 +514 +515 +516 +517 +518 +519 +520 +521 +522 +523 +524 +525 +526 +527 +528 +529 +530 +531 +532 +533 +534 +535 +536 +537 +538 +539 +540 +541 +542 +543 +544 +545 +546 +547 +548 +549 +550 +551 +552 +553 +554 +555 +556 +557 +558 +559 +560 +561 +562 +563 +564 +565 +566 +567 +568 +569 +570 +571 +572 +573 +574 +575 +576 +577 +578 +579 +580 +581 +582 +583 +584 +585 +586 +587 +588 +589 +590 +591 +592 +593 +594 +595 +596 +597 +598 +599 +600 +601 +602 +603 +604 +605 +606 +607 +608 +609 +610 +611 +612 +613 +614 +615 +616 +617 +618 +619 +620 +621 +622 +623 +624 +625 +626 +627 +628 +629 +630 +631 +632 +633 +634 +635 +636 +637 +638 +639 +640 +641 +642 +643 +644 +645 +646 +647 +648 +649 +650 +651 +652 +653 +654 +655 +656 +657 +658 +659 +660 +661 +662 +663 +664 +665 +666 +667 +668 +669 +670 +671 +672 +673 +674 +675 +676 +677 +678 +679 +680 +681 +682 +683 +684 +685 +686 +687 +688 +689 +690 +691 +692 +693 +694 +695 +696 +697 +698 +699 +700 +701 +702 +703 +704 +705 +706 +707 +708 +709 +710 +711 +712 +713 +714 +715 +716 +717 +718 +719 +720 +721 +722 +723 +724 +725 +726 +727 +728 +729 +730 +731 +732 +733 +734 +735 +736 +737 +738 +739 +740 +741 +742 +743 +744 +745 +746 +747 +748 +749 +750 +751 +752 +753 +754 +755 +756 +757 +758 +759 +760 +761 +762 +763 +764 +765 +766 +767 +768 +769 +770 +771 +772 +773 +774 +775 +776 +777 +778 +779 +780 +781 +782 +783 +784 +785 +786 +787 +788 +789 +790 +791 +792 +793 +794 +795 +796 +797 +798 +799 +800 +801 +802 +803 +804 +805 +806 +807 +808 +809 +810 +811 +812 +813 +814 +815 +816 +817 +818 +819 +820 +821 +822 +823 +824 +825 +826 +827 +828 +829 +830 +831 +832 +833 +834 +835 +836 +837 +838 +839 +840 +841 +842 +843 +844 +845 +846 +847 +848 +849 +850 +851 +852 +853 +854 +855 +856 +857 +858 +859 +860 +861 +862 +863 +864 +865 +866 +867 +868 +869 +870 +871 +872 +873 +874 +875 +876 +877 +878 +879 +880 +881 +882 +883 +884 +885 +886 +887 +888 +889 +890 +891 +892 +893 +894 +895 +896 +897 +898 +899 +900 +901 +902 +903 +904 +905 +906 +907 +908 +909 +910 +911 +912 +913 +914 +915 +916 +917 +918 +919 +920 +921 +922 +923 +924 +925 +926 +927 +928 +929 +930 +931 +932 +933 +934 +935 +936 +937 +938 +939 +940 +941 +942 +943 +944 +945 +946 +947 +948 +949 +950 +951 +952 +953 +954 +955 +956 +957 +958 +959 +960 +961 +962 +963 +964 +965 +966 +967 +968 +969 +970 +971 +972 +973 +974 +975 +976 +977 +978 +979 +980 +981 +982 +983 +984 +985 +986 +987 +988 +989 +990 +991 +992 +993 +994 +995 +996 +997 +998 +999 +1000 +1001 +1002 +1003 +1004 +1005 +1006 +1007 +1008 +1009 +1010 +1011 +1012 +1013 +1014 +1015 +1016 +1017 +1018 +1019 +1020 +1021 +1022 +1023 +1024 +1025 +1026 +1027 +1028 +1029 +1030 +1031 +1032 +1033 +1034 +1035 +1036 +1037 +1038 +1039 +1040 +1041 +1042 +1043 +1044 +1045 +1046 +1047 +1048 +1049 +1050 +1051 +1052 +1053 +1054 +1055 +1056 +1057 +1058 +1059 +1060 +1061 +1062 +1063 +1064 +1065 +1066 +1067 +1068 +1069 +1070 +1071 +1072 +1073 +1074 +1075 +1076 +1077 +1078 +1079 +1080 +1081 +1082 +1083 +1084 +1085 +1086 +1087 +1088 +1089 +1090 +1091 +1092 +1093 +1094 +1095 +1096 +1097 +1098 +1099 +1100 +1101 +1102 +1103 +1104 +1105 +1106 +1107 +1108 +1109 +1110 +1111 +1112 +1113 +1114 +1115 +1116 +1117 +1118 +1119 +1120 +1121 +1122 +1123 +1124 +1125 +1126 +1127 +1128 +1129 +1130 +1131 +1132 +1133 +1134 +1135 +1136 +1137 +1138 +1139 +1140 +1141 +1142 +1143 +1144 +1145 +1146 +1147 +1148 +1149 +1150 +1151 +1152 +1153 +1154 +1155 +1156 +1157 +1158 +1159 +1160 +1161 +1162 +1163 +1164 +1165 +1166 +1167 +1168 +1169 +1170 +1171 +1172 +1173 +1174 +1175 +1176 +1177 +1178 +1179 +1180 +1181 +1182 +1183 +1184 +1185 +1186 +1187 +1188 +1189 +1190 +1191 +1192 +1193 +1194 +1195 +1196 +1197 +1198 +1199 +1200 +1201 +1202 +1203 +1204 +1205 +1206 +1207 +1208 +1209 +1210 +1211 +1212 +1213 +1214 +1215 +1216 +1217 +1218 +1219 +1220 +1221 +1222 +1223 +1224 +1225 +1226 +1227 +1228 +1229 +1230 +1231 +1232 +1233 +1234 +1235 +1236 +1237 +1238 +1239 +1240 +1241 +1242 +1243 +1244 +1245 +1246 +1247 +1248 +1249 +1250 +1251 +1252 +1253 +1254 +1255 +1256 +1257 +1258 +1259 +1260 +1261 +1262 +1263 +1264 +1265 +1266 +1267 +1268 +1269 +1270 +1271 +1272 +1273 +1274 +1275 +1276 +1277 +1278 +1279 +1280 +1281 +1282 +1283 +1284 +1285 +1286 +1287 +1288 +1289 +1290 +1291 +1292 +1293 +1294 +1295 +1296 +1297 +1298 +1299 +1300 +1301 +1302 +1303 +1304 +1305 +1306 +1307 +1308 +1309 +1310 +1311 +1312 +1313 +1314 +1315 +1316 +1317 +1318 +1319 +1320 +1321 +1322 +1323 +1324 +1325 +1326 +1327 +1328 +1329 +1330 +1331 +1332 +1333 +1334 +1335 +1336 +1337 +1338 +1339 +1340 +1341 +1342 +1343 +1344 +1345 +1346 +1347 +1348 +1349 +1350 +1351 +1352 +1353 +1354 +1355 +1356 +1357 +1358 +1359 +1360 +1361 +1362 +1363 +1364 +1365 +1366 +1367 +1368 +1369 +1370 +1371 +1372 +1373 +1374 +1375 +1376 +1377 +1378 +1379 +1380 +1381 +1382 +1383 +1384 +1385 +1386 +1387 +1388 +1389 +1390 +1391 +1392 +1393 +1394 +1395 +1396 +1397 +1398 +1399 +1400 +1401 +1402 +1403 +1404 +1405 +1406 +1407 +1408 +1409 +1410 +1411 +1412 +1413 +1414 +1415 +1416 +1417 +1418 +1419 +1420 +1421 +1422 +1423 +1424 +1425 +1426 +1427 +1428 +1429 +1430 +1431 +1432 +1433 +1434 +1435 +1436 +1437 +1438 +1439 +1440 +1441 +1442 +1443 +1444 +1445 +1446 +1447 +1448 +1449 +1450 +1451 +1452 +1453 +1454 +1455 +1456 +1457 +1458 +1459 +1460 +1461 +1462 +1463 +1464 +1465 +1466 +1467 +1468 +1469 +1470 +1471 +1472 +1473 +1474 +1475 +1476 +1477 +1478 +1479 +1480 +1481 +1482 +1483 +1484 +1485 +1486 +1487 +1488 +1489 +1490 +1491 +1492 +1493 +1494 +1495 +1496 +1497 +1498 +1499 +1500 +1501 +1502 +1503 +1504 +1505 +1506 +1507 +1508 +1509 +1510 +1511 +1512 +1513 +1514 +1515 +1516 +1517 +1518 +1519 +1520 +1521 +1522 +1523 +1524 +1525 +1526 +1527 +1528 +1529 +1530 +1531 +1532 +1533 +1534 +1535 +1536 +1537 +1538 +1539 +1540 +1541 +1542 +1543 +1544 +1545 +1546 +1547 +1548 +1549 +1550 +1551 +1552 +1553 +1554 +1555 +1556 +1557 +1558 +1559 +1560 +1561 +1562 +1563 +1564 +1565 +1566 +1567 +1568 +1569 +1570 +1571 +1572 +1573 +1574 +1575 +1576 +1577 +1578 +1579 +1580 +1581 +1582 +1583 +1584 +1585 +1586 +1587 +1588 +1589 +1590 +1591 +1592 +1593 +1594 +1595 +1596 +1597 +1598 +1599 +1600 +1601 +1602 +1603 +1604 +1605 +1606 +1607 +1608 +1609 +1610 +1611 +1612 +1613 +1614 +1615 +1616 +1617 +1618 +1619 +1620 +1621 +1622 +1623 +1624 +1625 +1626 +1627 +1628 +1629 +1630 +1631 +1632 +1633 +1634 +1635 +1636 +1637 +1638 +1639 +1640 +1641 +1642 +1643 +1644 +1645 +1646 +1647 +1648 +1649 +1650 +1651 +1652 +1653 +1654 +1655 +1656 +1657 +1658 +1659 +1660 +1661 +1662 +1663 +1664 +1665 +1666 +1667 +1668 +1669 +1670 +1671 +1672 +1673 +1674 +1675 +1676 +1677 +1678 +1679 +1680 +1681 +1682 +1683 +1684 +1685 +1686 +1687 +1688 +1689 +1690 +1691 +1692 +1693 +1694 +1695 +1696 +1697 +1698 +1699 +1700 +1701 +1702 +1703 +1704 +1705 +1706 +1707 +1708 +1709 +1710 +1711 +1712 +1713 +1714 +1715 +1716 +1717 +1718 +1719 +1720 +1721 +1722 +1723 +1724 +1725 +1726 +1727 +1728 +1729 +1730 +1731 +1732 +1733 +1734 +1735 +1736 +1737 +1738 +1739 +1740 +1741 +1742 +1743 +1744 +1745 +1746 +1747 +1748 +1749 +1750 +1751 +1752 +1753 +1754 +1755 +1756 +1757 +1758 +1759 +1760 +1761 +1762 +1763 +1764 +1765 +1766 +1767 +1768 +1769 +1770 +1771 +1772 +1773 +1774 +1775 +1776 +1777 +1778 +1779 +1780 +1781 +1782 +1783 +1784 +1785 +1786 +1787 +1788 +1789 +1790 +1791 +1792 +1793 +1794 +1795 +1796 +1797 +1798 +1799 +1800 +1801 +1802 +1803 +1804 +1805 +1806 +1807 +1808 +1809 +1810 +1811 +1812 +1813 +1814 +1815 +1816 +1817 +1818 +1819 +1820 +1821 +1822 +1823 +1824 +1825 +1826 +1827 +1828 +1829 +1830 +1831 +1832 +1833 +1834 +1835 +1836 +1837 +1838 +1839 +1840 +1841 +1842 +1843 +1844 +1845 +1846 +1847 +1848 +1849 +1850 +1851 +1852 +1853 +1854 +1855 +1856 +1857 +1858 +1859 +1860 +1861 +1862 +1863 +1864 +1865 +1866 +1867 +1868 +1869 +1870 +1871 +1872 +1873 +1874 +1875 +1876 +1877 +1878 +1879 +1880 +1881 +1882 +1883 +1884 +1885 +1886 +1887 +1888 +1889 +1890 +1891 +1892 +1893 +1894 +1895 +1896 +1897 +1898 +1899 +1900 +1901 +1902 +1903 +1904 +1905 +1906 +1907 +1908 +1909 +1910 +1911 +1912 +1913 +1914 +1915 +1916 +1917 +1918 +1919 +1920 +1921 +1922 +1923 +1924 +1925 +1926 +1927 +1928 +1929 +1930 +1931 +1932 +1933 +1934 +1935 +1936 +1937 +1938 +1939 +1940 +1941 +1942 +1943 +1944 +1945 +1946 +1947 +1948 +1949 +1950 +1951 +1952 +1953 +1954 +1955 +1956 +1957 +1958 +1959 +1960 +1961 +1962 +1963 +1964 +1965 +1966 +1967 +1968 +1969 +1970 +1971 +1972 +1973 +1974 +1975 +1976 +1977 +1978 +1979 +1980 +1981 +1982 +1983 +1984 +1985 +1986 +1987 +1988 +1989 +1990 +1991 +1992 +1993 +1994 +1995 +1996 +1997 +1998 +1999 +2000 diff --git a/tests/fixtures/pr/column.log.expected b/tests/fixtures/pr/column.log.expected new file mode 100644 index 000000000..e548d4128 --- /dev/null +++ b/tests/fixtures/pr/column.log.expected @@ -0,0 +1,198 @@ + + +{last_modified_time} column.log Page 3 + + + 337 337 393 393 449 449 + 338 338 394 394 450 450 + 339 339 395 395 451 451 + 340 340 396 396 452 452 + 341 341 397 397 453 453 + 342 342 398 398 454 454 + 343 343 399 399 455 455 + 344 344 400 400 456 456 + 345 345 401 401 457 457 + 346 346 402 402 458 458 + 347 347 403 403 459 459 + 348 348 404 404 460 460 + 349 349 405 405 461 461 + 350 350 406 406 462 462 + 351 351 407 407 463 463 + 352 352 408 408 464 464 + 353 353 409 409 465 465 + 354 354 410 410 466 466 + 355 355 411 411 467 467 + 356 356 412 412 468 468 + 357 357 413 413 469 469 + 358 358 414 414 470 470 + 359 359 415 415 471 471 + 360 360 416 416 472 472 + 361 361 417 417 473 473 + 362 362 418 418 474 474 + 363 363 419 419 475 475 + 364 364 420 420 476 476 + 365 365 421 421 477 477 + 366 366 422 422 478 478 + 367 367 423 423 479 479 + 368 368 424 424 480 480 + 369 369 425 425 481 481 + 370 370 426 426 482 482 + 371 371 427 427 483 483 + 372 372 428 428 484 484 + 373 373 429 429 485 485 + 374 374 430 430 486 486 + 375 375 431 431 487 487 + 376 376 432 432 488 488 + 377 377 433 433 489 489 + 378 378 434 434 490 490 + 379 379 435 435 491 491 + 380 380 436 436 492 492 + 381 381 437 437 493 493 + 382 382 438 438 494 494 + 383 383 439 439 495 495 + 384 384 440 440 496 496 + 385 385 441 441 497 497 + 386 386 442 442 498 498 + 387 387 443 443 499 499 + 388 388 444 444 500 500 + 389 389 445 445 501 501 + 390 390 446 446 502 502 + 391 391 447 447 503 503 + 392 392 448 448 504 504 + + + + + + + +{last_modified_time} column.log Page 4 + + + 505 505 561 561 617 617 + 506 506 562 562 618 618 + 507 507 563 563 619 619 + 508 508 564 564 620 620 + 509 509 565 565 621 621 + 510 510 566 566 622 622 + 511 511 567 567 623 623 + 512 512 568 568 624 624 + 513 513 569 569 625 625 + 514 514 570 570 626 626 + 515 515 571 571 627 627 + 516 516 572 572 628 628 + 517 517 573 573 629 629 + 518 518 574 574 630 630 + 519 519 575 575 631 631 + 520 520 576 576 632 632 + 521 521 577 577 633 633 + 522 522 578 578 634 634 + 523 523 579 579 635 635 + 524 524 580 580 636 636 + 525 525 581 581 637 637 + 526 526 582 582 638 638 + 527 527 583 583 639 639 + 528 528 584 584 640 640 + 529 529 585 585 641 641 + 530 530 586 586 642 642 + 531 531 587 587 643 643 + 532 532 588 588 644 644 + 533 533 589 589 645 645 + 534 534 590 590 646 646 + 535 535 591 591 647 647 + 536 536 592 592 648 648 + 537 537 593 593 649 649 + 538 538 594 594 650 650 + 539 539 595 595 651 651 + 540 540 596 596 652 652 + 541 541 597 597 653 653 + 542 542 598 598 654 654 + 543 543 599 599 655 655 + 544 544 600 600 656 656 + 545 545 601 601 657 657 + 546 546 602 602 658 658 + 547 547 603 603 659 659 + 548 548 604 604 660 660 + 549 549 605 605 661 661 + 550 550 606 606 662 662 + 551 551 607 607 663 663 + 552 552 608 608 664 664 + 553 553 609 609 665 665 + 554 554 610 610 666 666 + 555 555 611 611 667 667 + 556 556 612 612 668 668 + 557 557 613 613 669 669 + 558 558 614 614 670 670 + 559 559 615 615 671 671 + 560 560 616 616 672 672 + + + + + + + +{last_modified_time} column.log Page 5 + + + 673 673 729 729 785 785 + 674 674 730 730 786 786 + 675 675 731 731 787 787 + 676 676 732 732 788 788 + 677 677 733 733 789 789 + 678 678 734 734 790 790 + 679 679 735 735 791 791 + 680 680 736 736 792 792 + 681 681 737 737 793 793 + 682 682 738 738 794 794 + 683 683 739 739 795 795 + 684 684 740 740 796 796 + 685 685 741 741 797 797 + 686 686 742 742 798 798 + 687 687 743 743 799 799 + 688 688 744 744 800 800 + 689 689 745 745 801 801 + 690 690 746 746 802 802 + 691 691 747 747 803 803 + 692 692 748 748 804 804 + 693 693 749 749 805 805 + 694 694 750 750 806 806 + 695 695 751 751 807 807 + 696 696 752 752 808 808 + 697 697 753 753 809 809 + 698 698 754 754 810 810 + 699 699 755 755 811 811 + 700 700 756 756 812 812 + 701 701 757 757 813 813 + 702 702 758 758 814 814 + 703 703 759 759 815 815 + 704 704 760 760 816 816 + 705 705 761 761 817 817 + 706 706 762 762 818 818 + 707 707 763 763 819 819 + 708 708 764 764 820 820 + 709 709 765 765 821 821 + 710 710 766 766 822 822 + 711 711 767 767 823 823 + 712 712 768 768 824 824 + 713 713 769 769 825 825 + 714 714 770 770 826 826 + 715 715 771 771 827 827 + 716 716 772 772 828 828 + 717 717 773 773 829 829 + 718 718 774 774 830 830 + 719 719 775 775 831 831 + 720 720 776 776 832 832 + 721 721 777 777 833 833 + 722 722 778 778 834 834 + 723 723 779 779 835 835 + 724 724 780 780 836 836 + 725 725 781 781 837 837 + 726 726 782 782 838 838 + 727 727 783 783 839 839 + 728 728 784 784 840 840 + + + + + diff --git a/tests/fixtures/pr/column_across.log.expected b/tests/fixtures/pr/column_across.log.expected new file mode 100644 index 000000000..9d5a1dc1c --- /dev/null +++ b/tests/fixtures/pr/column_across.log.expected @@ -0,0 +1,198 @@ + + +{last_modified_time} column.log Page 3 + + + 337 337 338 338 339 339 + 340 340 341 341 342 342 + 343 343 344 344 345 345 + 346 346 347 347 348 348 + 349 349 350 350 351 351 + 352 352 353 353 354 354 + 355 355 356 356 357 357 + 358 358 359 359 360 360 + 361 361 362 362 363 363 + 364 364 365 365 366 366 + 367 367 368 368 369 369 + 370 370 371 371 372 372 + 373 373 374 374 375 375 + 376 376 377 377 378 378 + 379 379 380 380 381 381 + 382 382 383 383 384 384 + 385 385 386 386 387 387 + 388 388 389 389 390 390 + 391 391 392 392 393 393 + 394 394 395 395 396 396 + 397 397 398 398 399 399 + 400 400 401 401 402 402 + 403 403 404 404 405 405 + 406 406 407 407 408 408 + 409 409 410 410 411 411 + 412 412 413 413 414 414 + 415 415 416 416 417 417 + 418 418 419 419 420 420 + 421 421 422 422 423 423 + 424 424 425 425 426 426 + 427 427 428 428 429 429 + 430 430 431 431 432 432 + 433 433 434 434 435 435 + 436 436 437 437 438 438 + 439 439 440 440 441 441 + 442 442 443 443 444 444 + 445 445 446 446 447 447 + 448 448 449 449 450 450 + 451 451 452 452 453 453 + 454 454 455 455 456 456 + 457 457 458 458 459 459 + 460 460 461 461 462 462 + 463 463 464 464 465 465 + 466 466 467 467 468 468 + 469 469 470 470 471 471 + 472 472 473 473 474 474 + 475 475 476 476 477 477 + 478 478 479 479 480 480 + 481 481 482 482 483 483 + 484 484 485 485 486 486 + 487 487 488 488 489 489 + 490 490 491 491 492 492 + 493 493 494 494 495 495 + 496 496 497 497 498 498 + 499 499 500 500 501 501 + 502 502 503 503 504 504 + + + + + + + +{last_modified_time} column.log Page 4 + + + 505 505 506 506 507 507 + 508 508 509 509 510 510 + 511 511 512 512 513 513 + 514 514 515 515 516 516 + 517 517 518 518 519 519 + 520 520 521 521 522 522 + 523 523 524 524 525 525 + 526 526 527 527 528 528 + 529 529 530 530 531 531 + 532 532 533 533 534 534 + 535 535 536 536 537 537 + 538 538 539 539 540 540 + 541 541 542 542 543 543 + 544 544 545 545 546 546 + 547 547 548 548 549 549 + 550 550 551 551 552 552 + 553 553 554 554 555 555 + 556 556 557 557 558 558 + 559 559 560 560 561 561 + 562 562 563 563 564 564 + 565 565 566 566 567 567 + 568 568 569 569 570 570 + 571 571 572 572 573 573 + 574 574 575 575 576 576 + 577 577 578 578 579 579 + 580 580 581 581 582 582 + 583 583 584 584 585 585 + 586 586 587 587 588 588 + 589 589 590 590 591 591 + 592 592 593 593 594 594 + 595 595 596 596 597 597 + 598 598 599 599 600 600 + 601 601 602 602 603 603 + 604 604 605 605 606 606 + 607 607 608 608 609 609 + 610 610 611 611 612 612 + 613 613 614 614 615 615 + 616 616 617 617 618 618 + 619 619 620 620 621 621 + 622 622 623 623 624 624 + 625 625 626 626 627 627 + 628 628 629 629 630 630 + 631 631 632 632 633 633 + 634 634 635 635 636 636 + 637 637 638 638 639 639 + 640 640 641 641 642 642 + 643 643 644 644 645 645 + 646 646 647 647 648 648 + 649 649 650 650 651 651 + 652 652 653 653 654 654 + 655 655 656 656 657 657 + 658 658 659 659 660 660 + 661 661 662 662 663 663 + 664 664 665 665 666 666 + 667 667 668 668 669 669 + 670 670 671 671 672 672 + + + + + + + +{last_modified_time} column.log Page 5 + + + 673 673 674 674 675 675 + 676 676 677 677 678 678 + 679 679 680 680 681 681 + 682 682 683 683 684 684 + 685 685 686 686 687 687 + 688 688 689 689 690 690 + 691 691 692 692 693 693 + 694 694 695 695 696 696 + 697 697 698 698 699 699 + 700 700 701 701 702 702 + 703 703 704 704 705 705 + 706 706 707 707 708 708 + 709 709 710 710 711 711 + 712 712 713 713 714 714 + 715 715 716 716 717 717 + 718 718 719 719 720 720 + 721 721 722 722 723 723 + 724 724 725 725 726 726 + 727 727 728 728 729 729 + 730 730 731 731 732 732 + 733 733 734 734 735 735 + 736 736 737 737 738 738 + 739 739 740 740 741 741 + 742 742 743 743 744 744 + 745 745 746 746 747 747 + 748 748 749 749 750 750 + 751 751 752 752 753 753 + 754 754 755 755 756 756 + 757 757 758 758 759 759 + 760 760 761 761 762 762 + 763 763 764 764 765 765 + 766 766 767 767 768 768 + 769 769 770 770 771 771 + 772 772 773 773 774 774 + 775 775 776 776 777 777 + 778 778 779 779 780 780 + 781 781 782 782 783 783 + 784 784 785 785 786 786 + 787 787 788 788 789 789 + 790 790 791 791 792 792 + 793 793 794 794 795 795 + 796 796 797 797 798 798 + 799 799 800 800 801 801 + 802 802 803 803 804 804 + 805 805 806 806 807 807 + 808 808 809 809 810 810 + 811 811 812 812 813 813 + 814 814 815 815 816 816 + 817 817 818 818 819 819 + 820 820 821 821 822 822 + 823 823 824 824 825 825 + 826 826 827 827 828 828 + 829 829 830 830 831 831 + 832 832 833 833 834 834 + 835 835 836 836 837 837 + 838 838 839 839 840 840 + + + + + diff --git a/tests/test_pr.rs b/tests/test_pr.rs index 1594a98d0..efe69c29a 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -293,3 +293,34 @@ fn test_with_stdin() { (&"{last_modified_time}".to_string(), &now_time()), ]); } + +#[test] +fn test_with_column() { + let test_file_path = "column.log"; + let expected_test_file_path = "column.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["--pages=3:5", "--column=3", "-n", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + (&"{last_modified_time}".to_string(), &value), + ]); + +} + +#[test] +fn test_with_column_across_option() { + let test_file_path = "column.log"; + let expected_test_file_path = "column_across.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["--pages=3:5", "--column=3", "-a", "-n", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + (&"{last_modified_time}".to_string(), &value), + ]); + +} + From dd07aed4d173044b57498801e834577898253d31 Mon Sep 17 00:00:00 2001 From: Tilak Patidar Date: Sat, 22 Dec 2018 14:15:50 +0530 Subject: [PATCH 0156/1135] pr: add column separator option --- src/pr/pr.rs | 17 +- .../pr/column_across_sep.log.expected | 198 ++++++++++++++++++ tests/test_pr.rs | 15 ++ 3 files changed, 229 insertions(+), 1 deletion(-) create mode 100644 tests/fixtures/pr/column_across_sep.log.expected diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 87ef46120..0fe3be3a7 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -50,6 +50,7 @@ static FORM_FEED_OPTION: &str = "F"; static COLUMN_WIDTH_OPTION: &str = "w"; static ACROSS_OPTION: &str = "a"; static COLUMN_OPTION: &str = "column"; +static COLUMN_SEPARATOR_OPTION: &str = "s"; static FILE_STDIN: &str = "-"; static READ_BUFFER_SIZE: usize = 1024 * 64; static DEFAULT_COLUMN_WIDTH: usize = 72; @@ -272,6 +273,16 @@ pub fn uumain(args: Vec) -> i32 { Occur::Optional, ); + opts.opt( + COLUMN_SEPARATOR_OPTION, + "", + "Separate text columns by the single character char instead of by the appropriate number of s + (default for char is the character).", + "char", + HasArg::Yes, + Occur::Optional, + ); + opts.optflag("", "help", "display this help and exit"); opts.optflag("V", "version", "output version information and exit"); @@ -497,6 +508,10 @@ fn build_options(matches: &Matches, path: &String) -> Result() }) { @@ -507,7 +522,7 @@ fn build_options(matches: &Matches, path: &String) -> Result Some(x), None => Some(DEFAULT_COLUMN_WIDTH) }, - column_separator: DEFAULT_COLUMN_SEPARATOR.to_string(), + column_separator, across_mode, }) } diff --git a/tests/fixtures/pr/column_across_sep.log.expected b/tests/fixtures/pr/column_across_sep.log.expected new file mode 100644 index 000000000..65c3e71c8 --- /dev/null +++ b/tests/fixtures/pr/column_across_sep.log.expected @@ -0,0 +1,198 @@ + + +{last_modified_time} column.log Page 3 + + + 337 337 | 338 338 | 339 339 + 340 340 | 341 341 | 342 342 + 343 343 | 344 344 | 345 345 + 346 346 | 347 347 | 348 348 + 349 349 | 350 350 | 351 351 + 352 352 | 353 353 | 354 354 + 355 355 | 356 356 | 357 357 + 358 358 | 359 359 | 360 360 + 361 361 | 362 362 | 363 363 + 364 364 | 365 365 | 366 366 + 367 367 | 368 368 | 369 369 + 370 370 | 371 371 | 372 372 + 373 373 | 374 374 | 375 375 + 376 376 | 377 377 | 378 378 + 379 379 | 380 380 | 381 381 + 382 382 | 383 383 | 384 384 + 385 385 | 386 386 | 387 387 + 388 388 | 389 389 | 390 390 + 391 391 | 392 392 | 393 393 + 394 394 | 395 395 | 396 396 + 397 397 | 398 398 | 399 399 + 400 400 | 401 401 | 402 402 + 403 403 | 404 404 | 405 405 + 406 406 | 407 407 | 408 408 + 409 409 | 410 410 | 411 411 + 412 412 | 413 413 | 414 414 + 415 415 | 416 416 | 417 417 + 418 418 | 419 419 | 420 420 + 421 421 | 422 422 | 423 423 + 424 424 | 425 425 | 426 426 + 427 427 | 428 428 | 429 429 + 430 430 | 431 431 | 432 432 + 433 433 | 434 434 | 435 435 + 436 436 | 437 437 | 438 438 + 439 439 | 440 440 | 441 441 + 442 442 | 443 443 | 444 444 + 445 445 | 446 446 | 447 447 + 448 448 | 449 449 | 450 450 + 451 451 | 452 452 | 453 453 + 454 454 | 455 455 | 456 456 + 457 457 | 458 458 | 459 459 + 460 460 | 461 461 | 462 462 + 463 463 | 464 464 | 465 465 + 466 466 | 467 467 | 468 468 + 469 469 | 470 470 | 471 471 + 472 472 | 473 473 | 474 474 + 475 475 | 476 476 | 477 477 + 478 478 | 479 479 | 480 480 + 481 481 | 482 482 | 483 483 + 484 484 | 485 485 | 486 486 + 487 487 | 488 488 | 489 489 + 490 490 | 491 491 | 492 492 + 493 493 | 494 494 | 495 495 + 496 496 | 497 497 | 498 498 + 499 499 | 500 500 | 501 501 + 502 502 | 503 503 | 504 504 + + + + + + + +{last_modified_time} column.log Page 4 + + + 505 505 | 506 506 | 507 507 + 508 508 | 509 509 | 510 510 + 511 511 | 512 512 | 513 513 + 514 514 | 515 515 | 516 516 + 517 517 | 518 518 | 519 519 + 520 520 | 521 521 | 522 522 + 523 523 | 524 524 | 525 525 + 526 526 | 527 527 | 528 528 + 529 529 | 530 530 | 531 531 + 532 532 | 533 533 | 534 534 + 535 535 | 536 536 | 537 537 + 538 538 | 539 539 | 540 540 + 541 541 | 542 542 | 543 543 + 544 544 | 545 545 | 546 546 + 547 547 | 548 548 | 549 549 + 550 550 | 551 551 | 552 552 + 553 553 | 554 554 | 555 555 + 556 556 | 557 557 | 558 558 + 559 559 | 560 560 | 561 561 + 562 562 | 563 563 | 564 564 + 565 565 | 566 566 | 567 567 + 568 568 | 569 569 | 570 570 + 571 571 | 572 572 | 573 573 + 574 574 | 575 575 | 576 576 + 577 577 | 578 578 | 579 579 + 580 580 | 581 581 | 582 582 + 583 583 | 584 584 | 585 585 + 586 586 | 587 587 | 588 588 + 589 589 | 590 590 | 591 591 + 592 592 | 593 593 | 594 594 + 595 595 | 596 596 | 597 597 + 598 598 | 599 599 | 600 600 + 601 601 | 602 602 | 603 603 + 604 604 | 605 605 | 606 606 + 607 607 | 608 608 | 609 609 + 610 610 | 611 611 | 612 612 + 613 613 | 614 614 | 615 615 + 616 616 | 617 617 | 618 618 + 619 619 | 620 620 | 621 621 + 622 622 | 623 623 | 624 624 + 625 625 | 626 626 | 627 627 + 628 628 | 629 629 | 630 630 + 631 631 | 632 632 | 633 633 + 634 634 | 635 635 | 636 636 + 637 637 | 638 638 | 639 639 + 640 640 | 641 641 | 642 642 + 643 643 | 644 644 | 645 645 + 646 646 | 647 647 | 648 648 + 649 649 | 650 650 | 651 651 + 652 652 | 653 653 | 654 654 + 655 655 | 656 656 | 657 657 + 658 658 | 659 659 | 660 660 + 661 661 | 662 662 | 663 663 + 664 664 | 665 665 | 666 666 + 667 667 | 668 668 | 669 669 + 670 670 | 671 671 | 672 672 + + + + + + + +{last_modified_time} column.log Page 5 + + + 673 673 | 674 674 | 675 675 + 676 676 | 677 677 | 678 678 + 679 679 | 680 680 | 681 681 + 682 682 | 683 683 | 684 684 + 685 685 | 686 686 | 687 687 + 688 688 | 689 689 | 690 690 + 691 691 | 692 692 | 693 693 + 694 694 | 695 695 | 696 696 + 697 697 | 698 698 | 699 699 + 700 700 | 701 701 | 702 702 + 703 703 | 704 704 | 705 705 + 706 706 | 707 707 | 708 708 + 709 709 | 710 710 | 711 711 + 712 712 | 713 713 | 714 714 + 715 715 | 716 716 | 717 717 + 718 718 | 719 719 | 720 720 + 721 721 | 722 722 | 723 723 + 724 724 | 725 725 | 726 726 + 727 727 | 728 728 | 729 729 + 730 730 | 731 731 | 732 732 + 733 733 | 734 734 | 735 735 + 736 736 | 737 737 | 738 738 + 739 739 | 740 740 | 741 741 + 742 742 | 743 743 | 744 744 + 745 745 | 746 746 | 747 747 + 748 748 | 749 749 | 750 750 + 751 751 | 752 752 | 753 753 + 754 754 | 755 755 | 756 756 + 757 757 | 758 758 | 759 759 + 760 760 | 761 761 | 762 762 + 763 763 | 764 764 | 765 765 + 766 766 | 767 767 | 768 768 + 769 769 | 770 770 | 771 771 + 772 772 | 773 773 | 774 774 + 775 775 | 776 776 | 777 777 + 778 778 | 779 779 | 780 780 + 781 781 | 782 782 | 783 783 + 784 784 | 785 785 | 786 786 + 787 787 | 788 788 | 789 789 + 790 790 | 791 791 | 792 792 + 793 793 | 794 794 | 795 795 + 796 796 | 797 797 | 798 798 + 799 799 | 800 800 | 801 801 + 802 802 | 803 803 | 804 804 + 805 805 | 806 806 | 807 807 + 808 808 | 809 809 | 810 810 + 811 811 | 812 812 | 813 813 + 814 814 | 815 815 | 816 816 + 817 817 | 818 818 | 819 819 + 820 820 | 821 821 | 822 822 + 823 823 | 824 824 | 825 825 + 826 826 | 827 827 | 828 828 + 829 829 | 830 830 | 831 831 + 832 832 | 833 833 | 834 834 + 835 835 | 836 836 | 837 837 + 838 838 | 839 839 | 840 840 + + + + + diff --git a/tests/test_pr.rs b/tests/test_pr.rs index efe69c29a..6faa48348 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -324,3 +324,18 @@ fn test_with_column_across_option() { } +#[test] +fn test_with_column_across_option_and_column_separator() { + let test_file_path = "column.log"; + let expected_test_file_path = "column_across_sep.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["--pages=3:5", "--column=3", "-s|", "-a", "-n", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + (&"{last_modified_time}".to_string(), &value), + ]); + +} + From 5956894d00477a599868f16ca867dfbae6d45cee Mon Sep 17 00:00:00 2001 From: Tilak Patidar Date: Mon, 24 Dec 2018 11:59:12 +0530 Subject: [PATCH 0157/1135] pr: add -m and -o option pr: Add -o option --- src/pr/pr.rs | 443 ++++++++++++++---- .../pr/column_spaces_across.log.expected | 198 ++++++++ tests/fixtures/pr/hosts.log | 11 + tests/fixtures/pr/mpr.log.expected | 132 ++++++ tests/fixtures/pr/mpr1.log.expected | 198 ++++++++ tests/fixtures/pr/mpr2.log.expected | 200 ++++++++ tests/test_pr.rs | 63 ++- 7 files changed, 1151 insertions(+), 94 deletions(-) create mode 100644 tests/fixtures/pr/column_spaces_across.log.expected create mode 100644 tests/fixtures/pr/hosts.log create mode 100644 tests/fixtures/pr/mpr.log.expected create mode 100644 tests/fixtures/pr/mpr1.log.expected create mode 100644 tests/fixtures/pr/mpr2.log.expected diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 0fe3be3a7..06c991c29 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -15,12 +15,12 @@ extern crate chrono; extern crate getopts; extern crate uucore; -use std::io::{BufRead, BufReader, stdin, stdout, stderr, Error, Read, Write, Stdout, Lines}; +use std::io::{BufRead, BufReader, stdin, stdout, stderr, Error, Read, Write, Stdout, Lines, Stdin}; use std::vec::Vec; use chrono::offset::Local; use chrono::DateTime; use getopts::{Matches, Options}; -use std::fs::{metadata, File}; +use std::fs::{metadata, File, Metadata}; #[cfg(unix)] use std::os::unix::fs::FileTypeExt; use quick_error::ResultExt; @@ -29,6 +29,7 @@ use getopts::{HasArg, Occur}; use std::num::ParseIntError; use itertools::{Itertools, GroupBy}; use std::iter::{Enumerate, Map, TakeWhile, SkipWhile}; +use itertools::structs::KMergeBy; static NAME: &str = "pr"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -51,6 +52,8 @@ static COLUMN_WIDTH_OPTION: &str = "w"; static ACROSS_OPTION: &str = "a"; static COLUMN_OPTION: &str = "column"; static COLUMN_SEPARATOR_OPTION: &str = "s"; +static MERGE_FILES_PRINT: &str = "m"; +static OFFSET_SPACES_OPTION: &str = "o"; static FILE_STDIN: &str = "-"; static READ_BUFFER_SIZE: usize = 1024 * 64; static DEFAULT_COLUMN_WIDTH: usize = 72; @@ -71,6 +74,22 @@ struct OutputOptions { content_lines_per_page: usize, page_separator_char: String, column_mode_options: Option, + merge_files_print: Option, + offset_spaces: usize +} + +struct FileLine { + file_id: usize, + line_number: usize, + page_number: usize, + key: usize, + line_content: Result, +} + +impl AsRef for FileLine { + fn as_ref(&self) -> &FileLine { + self + } } struct ColumnModeOptions { @@ -283,6 +302,27 @@ pub fn uumain(args: Vec) -> i32 { Occur::Optional, ); + opts.opt( + MERGE_FILES_PRINT, + "merge", + "Merge files. Standard output shall be formatted so the pr utility writes one line from each file specified by a + file operand, side by side into text columns of equal fixed widths, in terms of the number of column positions. + Implementations shall support merging of at least nine file operands.", + "", + HasArg::No, + Occur::Optional, + ); + + opts.opt( + OFFSET_SPACES_OPTION, + "indent", + "Each line of output shall be preceded by offset s. If the -o option is not specified, the default offset + shall be zero. The space taken is in addition to the output line width (see the -w option below).", + "offset", + HasArg::Yes, + Occur::Optional, + ); + opts.optflag("", "help", "display this help and exit"); opts.optflag("V", "version", "output version information and exit"); @@ -297,21 +337,20 @@ pub fn uumain(args: Vec) -> i32 { } let mut files: Vec = matches.free.clone(); - if files.is_empty() { - // -n value is optional if -n is given the opts gets confused - if matches.opt_present(NUMBERING_MODE_OPTION) { - let maybe_file = matches.opt_str(NUMBERING_MODE_OPTION).unwrap(); - let is_afile = is_a_file(&maybe_file); - if !is_afile { - print_error(&matches, PrError::NotExists(maybe_file)); - return 1; - } else { - files.push(maybe_file); - } - } else { - //For stdin - files.push(FILE_STDIN.to_owned()); + // -n value is optional if -n is given the opts gets confused + // if -n is used just before file path it might be captured as value of -n + if matches.opt_str(NUMBERING_MODE_OPTION).is_some() { + let maybe_a_file_path: String = matches.opt_str(NUMBERING_MODE_OPTION).unwrap(); + let is_file: bool = is_a_file(&maybe_a_file_path); + if !is_file && files.is_empty() { + print_error(&matches, PrError::NotExists(maybe_a_file_path)); + return 1; + } else if is_file { + files.insert(0, maybe_a_file_path); } + } else if files.is_empty() { + //For stdin + files.insert(0, FILE_STDIN.to_owned()); } @@ -319,14 +358,25 @@ pub fn uumain(args: Vec) -> i32 { return print_usage(&mut opts, &matches); } - for f in files { - let result_options = build_options(&matches, &f); + let file_groups: Vec> = if matches.opt_present(MERGE_FILES_PRINT) { + vec![files] + } else { + files.into_iter().map(|i| vec![i]).collect() + }; + + for file_group in file_groups { + let result_options: Result = build_options(&matches, &file_group); if result_options.is_err() { print_error(&matches, result_options.err().unwrap()); return 1; } - let options = &result_options.unwrap(); - let status: i32 = match pr(&f, options) { + let options: &OutputOptions = &result_options.unwrap(); + let cmd_result: Result = if file_group.len() == 1 { + pr(&file_group.get(0).unwrap(), options) + } else { + mpr(&file_group, options) + }; + let status: i32 = match cmd_result { Err(error) => { print_error(&matches, error); 1 @@ -385,22 +435,44 @@ fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { return 0; } -fn build_options(matches: &Matches, path: &String) -> Result { - let header: String = matches.opt_str(STRING_HEADER_OPTION).unwrap_or(if path == FILE_STDIN { +fn build_options(matches: &Matches, paths: &Vec) -> Result { + let is_merge_mode: bool = matches.opt_present(MERGE_FILES_PRINT); + + if is_merge_mode && matches.opt_present(COLUMN_OPTION) { + let err_msg: String = "cannot specify number of columns when printing in parallel".to_string(); + return Err(PrError::EncounteredErrors(err_msg)); + } + + if is_merge_mode && matches.opt_present(ACROSS_OPTION) { + let err_msg: String = "cannot specify both printing across and printing in parallel".to_string(); + return Err(PrError::EncounteredErrors(err_msg)); + } + + let merge_files_print: Option = if matches.opt_present(MERGE_FILES_PRINT) { + Some(paths.len()) + } else { + None + }; + + let header: String = matches.opt_str(STRING_HEADER_OPTION).unwrap_or(if is_merge_mode { "".to_string() } else { - path.to_string() + if paths[0].to_string() == FILE_STDIN { + "".to_string() + } else { + paths[0].to_string() + } }); - let default_first_number = NumberingMode::default().first_number; - let first_number = matches.opt_str(FIRST_LINE_NUMBER_OPTION).map(|n| { + let default_first_number: usize = NumberingMode::default().first_number; + let first_number: usize = matches.opt_str(FIRST_LINE_NUMBER_OPTION).map(|n| { n.parse::().unwrap_or(default_first_number) }).unwrap_or(default_first_number); let numbering_options: Option = matches.opt_str(NUMBERING_MODE_OPTION).map(|i| { - let parse_result = i.parse::(); + let parse_result: Result = i.parse::(); - let separator = if parse_result.is_err() { + let separator: String = if parse_result.is_err() { if is_a_file(&i) { NumberingMode::default().separator } else { @@ -410,7 +482,7 @@ fn build_options(matches: &Matches, path: &String) -> Result Result Result| { - let unparsed_value = matches.opt_str(PAGE_RANGE_OPTION).unwrap(); + let unparsed_value: String = matches.opt_str(PAGE_RANGE_OPTION).unwrap(); match i { Ok(val) => Ok(val), Err(_e) => Err(PrError::EncounteredErrors(format!("invalid --pages argument '{}'", unparsed_value))) } }; - let start_page = match matches.opt_str(PAGE_RANGE_OPTION).map(|i| { + let start_page: Option = match matches.opt_str(PAGE_RANGE_OPTION).map(|i| { let x: Vec<&str> = i.split(":").collect(); x[0].parse::() }).map(invalid_pages_map) @@ -465,9 +537,9 @@ fn build_options(matches: &Matches, path: &String) -> Result None }; - let end_page = match matches.opt_str(PAGE_RANGE_OPTION) - .filter(|i| i.contains(":")) - .map(|i| { + let end_page: Option = match matches.opt_str(PAGE_RANGE_OPTION) + .filter(|i: &String| i.contains(":")) + .map(|i: String| { let x: Vec<&str> = i.split(":").collect(); x[1].parse::() }) @@ -481,38 +553,38 @@ fn build_options(matches: &Matches, path: &String) -> Result() }) { Some(res) => res?, _ => LINES_PER_PAGE }; - let page_length_le_ht = page_length < (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE); + let page_length_le_ht: bool = page_length < (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE); - let display_header_and_trailer = !(page_length_le_ht) && !matches.opt_present(NO_HEADER_TRAILER_OPTION); + let display_header_and_trailer: bool = !(page_length_le_ht) && !matches.opt_present(NO_HEADER_TRAILER_OPTION); - let content_lines_per_page = if page_length_le_ht { + let content_lines_per_page: usize = if page_length_le_ht { page_length } else { page_length - (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE) }; - let page_separator_char = matches.opt_str(FORM_FEED_OPTION).map(|_i| { + let page_separator_char: String = matches.opt_str(FORM_FEED_OPTION).map(|_i| { '\u{000A}'.to_string() }).unwrap_or("\n".to_string()); - let column_width = match matches.opt_str(COLUMN_WIDTH_OPTION).map(|i| i.parse::()) { + let column_width: Option = match matches.opt_str(COLUMN_WIDTH_OPTION).map(|i| i.parse::()) { Some(res) => Some(res?), _ => None }; - let across_mode = matches.opt_present(ACROSS_OPTION); + let across_mode: bool = matches.opt_present(ACROSS_OPTION); - let column_separator = matches.opt_str(COLUMN_SEPARATOR_OPTION) + let column_separator: String = matches.opt_str(COLUMN_SEPARATOR_OPTION) .unwrap_or(DEFAULT_COLUMN_SEPARATOR.to_string()); - let column_mode_options = match matches.opt_str(COLUMN_OPTION).map(|i| { + let column_mode_options: Option = match matches.opt_str(COLUMN_OPTION).map(|i| { i.parse::() }) { Some(res) => { @@ -528,6 +600,14 @@ fn build_options(matches: &Matches, path: &String) -> Result None }; + + let offset_spaces: usize = matches.opt_str(OFFSET_SPACES_OPTION) + .map(|i| { + match i.parse::() { + Ok(val)=> Ok(val), + Err(e)=> Err(PrError::EncounteredErrors("".to_string())) + } + }).unwrap_or(Ok(0))?; Ok(OutputOptions { number: numbering_options, @@ -543,16 +623,18 @@ fn build_options(matches: &Matches, path: &String) -> Result Result, PrError> { if path == FILE_STDIN { - let stdin = stdin(); + let stdin: Stdin = stdin(); return Ok(Box::new(stdin) as Box); } - metadata(path).map(|i| { + metadata(path).map(|i: Metadata| { let path_string = path.to_string(); match i.file_type() { #[cfg(unix)] @@ -582,50 +664,217 @@ fn open(path: &str) -> Result, PrError> { }).unwrap_or(Err(PrError::NotExists(path.to_string()))) } -fn pr(path: &str, options: &OutputOptions) -> Result { +fn pr(path: &String, options: &OutputOptions) -> Result { let start_page: &usize = options.start_page.as_ref().unwrap_or(&1); + let start_line_number: usize = get_start_line_number(options); let last_page: Option<&usize> = options.end_page.as_ref(); let lines_needed_per_page: usize = lines_to_read_for_page(options); - let start_line_number: usize = get_start_line_number(options); - - let pages: GroupBy>>>, _>, _>, _>, _> = - BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?) + let file_line_groups: GroupBy>>>, _>, _>, _>, _>, _> = + BufReader::with_capacity(READ_BUFFER_SIZE, open(path).unwrap()) .lines() .enumerate() - .skip_while(|line_index: &(usize, Result)| { - // Skip the initial lines if not in page range - let start_line_index_of_start_page = (*start_page - 1) * lines_needed_per_page; - line_index.0 < (start_line_index_of_start_page) + .map(move |i: (usize, Result)| { + FileLine { + file_id: 0, + line_number: i.0, + line_content: i.1, + page_number: 0, + key: 0, + } }) - .take_while(|i: &(usize, Result)| { + .skip_while(move |file_line: &FileLine| { + // Skip the initial lines if not in page range + let start_line_index_of_start_page = (start_page - 1) * lines_needed_per_page; + file_line.line_number < (start_line_index_of_start_page) + }) + .take_while(move |file_line: &FileLine| { // Only read the file until provided last page reached last_page - .map(|lp| i.0 < ((*lp) * lines_needed_per_page)) + .map(|lp| file_line.line_number < ((*lp) * lines_needed_per_page)) .unwrap_or(true) }) - .map(|i: (usize, Result)| (i.0 + start_line_number, i.1)) // get display line number with line content - .group_by(|i: &(usize, Result)| { - ((i.0 - start_line_number + 1) as f64 / lines_needed_per_page as f64).ceil() as usize - }); // group them by page number + .map(move |file_line: FileLine| { + let page_number = ((file_line.line_number + 1) as f64 / lines_needed_per_page as f64).ceil() as usize; + FileLine { + line_number: file_line.line_number + start_line_number, + page_number, + key: page_number, + ..file_line + } + }) // get display line number with line content + .group_by(|file_line: &FileLine| { + file_line.page_number + }); - for (page_number, content_with_line_number) in pages.into_iter() { - let mut lines: Vec<(usize, String)> = Vec::new(); - for line_number_and_line in content_with_line_number { - let line_number: usize = line_number_and_line.0; - let line: Result = line_number_and_line.1; - let x = line?; - lines.push((line_number, x)); + for (page_number, file_line_group) in file_line_groups.into_iter() { + let mut lines: Vec = Vec::new(); + for file_line in file_line_group { + if file_line.line_content.is_err() { + return Err(PrError::from(file_line.line_content.unwrap_err())); + } + lines.push(file_line); + } + let print_status: Result = print_page(&lines, options, &page_number); + if print_status.is_err() { + return Err(PrError::from(print_status.unwrap_err())); } - - print_page(&lines, options, &page_number); } return Ok(0); } -fn print_page(lines: &Vec<(usize, String)>, options: &OutputOptions, page: &usize) -> Result { +fn mpr(paths: &Vec, options: &OutputOptions) -> Result { + let nfiles = paths.len(); + + let lines_needed_per_page: usize = lines_to_read_for_page(options); + let lines_needed_per_page_f64: f64 = lines_needed_per_page as f64; + let start_page: &usize = options.start_page.as_ref().unwrap_or(&1); + let last_page: Option<&usize> = options.end_page.as_ref(); + + let file_line_groups: GroupBy>>>, _>, _>, _>, _>, _>, _> = paths + .into_iter() + .enumerate() + .map(|indexed_path: (usize, &String)| { + let start_line_number: usize = get_start_line_number(options); + BufReader::with_capacity(READ_BUFFER_SIZE, open(indexed_path.1).unwrap()) + .lines() + .enumerate() + .map(move |i: (usize, Result)| { + FileLine { + file_id: indexed_path.0, + line_number: i.0, + line_content: i.1, + page_number: 0, + key: 0, + } + }) + .skip_while(move |file_line: &FileLine| { + // Skip the initial lines if not in page range + let start_line_index_of_start_page = (start_page - 1) * lines_needed_per_page; + file_line.line_number < (start_line_index_of_start_page) + }) + .take_while(move |file_line: &FileLine| { + // Only read the file until provided last page reached + + last_page + .map(|lp| file_line.line_number < ((*lp) * lines_needed_per_page)) + .unwrap_or(true) + }) + .map(move |file_line: FileLine| { + let page_number = ((file_line.line_number + 2 - start_line_number) as f64 / (lines_needed_per_page_f64)).ceil() as usize; + FileLine { + line_number: file_line.line_number + start_line_number, + page_number, + key: page_number * nfiles + file_line.file_id, + ..file_line + } + }) // get display line number with line content + }) + .kmerge_by(|a: &FileLine, b: &FileLine| { + if a.key == b.key { + a.line_number < b.line_number + } else { + a.key < b.key + } + }) + .group_by(|file_line: &FileLine| { + file_line.key + }); + + let mut lines: Vec = Vec::new(); + let start_page: &usize = options.start_page.as_ref().unwrap_or(&1); + let mut page_counter: usize = *start_page; + for (_key, file_line_group) in file_line_groups.into_iter() { + for file_line in file_line_group { + if file_line.line_content.is_err() { + return Err(PrError::from(file_line.line_content.unwrap_err())); + } + let new_page_number = file_line.page_number; + if page_counter != new_page_number { + fill_missing_files(&mut lines, lines_needed_per_page, &nfiles, page_counter); + let print_status: Result = print_page(&lines, options, &page_counter); + if print_status.is_err() { + return Err(PrError::from(print_status.unwrap_err())); + } + lines = Vec::new(); + } + lines.push(file_line); + page_counter = new_page_number; + } + } + + fill_missing_files(&mut lines, lines_needed_per_page, &nfiles, page_counter); + let print_status: Result = print_page(&lines, options, &page_counter); + if print_status.is_err() { + return Err(PrError::from(print_status.unwrap_err())); + } + + + return Ok(0); +} + +fn fill_missing_files(lines: &mut Vec, lines_per_file: usize, nfiles: &usize, page_number: usize) { + let init_line_number = (page_number - 1) * lines_per_file + 1; + let final_line_number = page_number * lines_per_file; + let mut file_id_counter: usize = 0; + let mut line_number_counter: usize = init_line_number; + let mut lines_processed: usize = 0; + let mut file_id_missing: bool = false; + for mut i in 0..lines_per_file * nfiles { + let file_id = lines.get(i).map(|i: &FileLine| i.file_id).unwrap_or(file_id_counter); + let line_number = lines.get(i).map(|i: &FileLine| i.line_number).unwrap_or(1); + if lines_processed == lines_per_file { + line_number_counter = init_line_number; + file_id_counter += 1; + lines_processed = 0; + file_id_missing = false; + } + + if file_id_counter >= *nfiles { + file_id_counter = 0; + file_id_missing = false; + } + + if file_id != file_id_counter { + file_id_missing = true; + } + + if file_id_missing { + // Insert missing file_ids + lines.insert(i, FileLine { + file_id: file_id_counter, + line_number: line_number_counter, + line_content: Ok("".to_string()), + page_number, + key: 0, + }); + line_number_counter += 1; + } else { + // Insert missing lines for a file_id + if line_number < line_number_counter { + line_number_counter += 1; + lines.insert(i, FileLine { + file_id, + line_number: line_number_counter, + line_content: Ok("".to_string()), + page_number, + key: 0, + }); + } else { + line_number_counter = line_number; + if line_number_counter == final_line_number { + line_number_counter = init_line_number; + } + } + } + + lines_processed += 1; + } +} + +fn print_page(lines: &Vec, options: &OutputOptions, page: &usize) -> Result { let page_separator = options.page_separator_char.as_bytes(); let header: Vec = header_content(options, page); let trailer_content: Vec = trailer_content(options); @@ -653,7 +902,7 @@ fn print_page(lines: &Vec<(usize, String)>, options: &OutputOptions, page: &usiz Ok(lines_written) } -fn write_columns(lines: &Vec<(usize, String)>, options: &OutputOptions, out: &mut Stdout) -> Result { +fn write_columns(lines: &Vec, options: &OutputOptions, out: &mut Stdout) -> Result { let line_separator = options.content_line_separator.as_bytes(); let content_lines_per_page = if options.double_space { options.content_lines_per_page / 2 @@ -671,26 +920,35 @@ fn write_columns(lines: &Vec<(usize, String)>, options: &OutputOptions, out: &mu .unwrap_or(NumberingMode::default().separator); let blank_line = "".to_string(); - let columns = get_columns(options); - + let columns = options.merge_files_print.unwrap_or(get_columns(options)); + let def_sep = DEFAULT_COLUMN_SEPARATOR.to_string(); let col_sep: &String = options .column_mode_options.as_ref() .map(|i| &i.column_separator) - .unwrap_or(&blank_line); + .unwrap_or(options + .merge_files_print + .map(|_k| &def_sep) + .unwrap_or(&blank_line) + ); let col_width: Option = options .column_mode_options.as_ref() .map(|i| i.width) - .unwrap_or(None); + .unwrap_or(options + .merge_files_print + .map(|_k| Some(DEFAULT_COLUMN_WIDTH)) + .unwrap_or(None) + ); let across_mode = options .column_mode_options.as_ref() .map(|i| i.across_mode) .unwrap_or(false); + + let offset_spaces: &usize = &options.offset_spaces; let mut lines_printed = 0; let is_number_mode = options.number.is_some(); - let fetch_indexes: Vec> = if across_mode { (0..content_lines_per_page) .map(|a| @@ -707,19 +965,20 @@ fn write_columns(lines: &Vec<(usize, String)>, options: &OutputOptions, out: &mu ).collect() }; + let spaces = " ".repeat(*offset_spaces); + for fetch_index in fetch_indexes { let indexes = fetch_index.len(); for i in 0..indexes { - let index = fetch_index[i]; + let index: usize = fetch_index[i]; if lines.get(index).is_none() { break; } - let read_line: &String = &lines.get(index).unwrap().1; - let next_line_number: usize = lines.get(index).unwrap().0; - let trimmed_line = get_line_for_printing( - next_line_number, &width, - &number_separator, columns, col_width, - read_line, is_number_mode); + let file_line: &FileLine = lines.get(index).unwrap(); + let trimmed_line: String = format!("{}{}", spaces, get_line_for_printing( + file_line, &width, &number_separator, columns, col_width, + is_number_mode, &options.merge_files_print, &i, + )); out.write(trimmed_line.as_bytes())?; if (i + 1) != indexes { out.write(col_sep.as_bytes())?; @@ -731,16 +990,20 @@ fn write_columns(lines: &Vec<(usize, String)>, options: &OutputOptions, out: &mu Ok(lines_printed) } -fn get_line_for_printing(line_number: usize, width: &usize, +fn get_line_for_printing(file_line: &FileLine, width: &usize, separator: &String, columns: usize, col_width: Option, - read_line: &String, is_number_mode: bool) -> String { - let fmtd_line_number: String = if is_number_mode { - get_fmtd_line_number(&width, line_number, &separator) + is_number_mode: bool, merge_files_print: &Option, + index: &usize, +) -> String { + let should_show_line_number_merge_file = merge_files_print.is_none() || index == &usize::min_value(); + let should_show_line_number = is_number_mode && should_show_line_number_merge_file; + let fmtd_line_number: String = if should_show_line_number { + get_fmtd_line_number(&width, file_line.line_number, &separator) } else { "".to_string() }; - let mut complete_line = format!("{}{}", fmtd_line_number, read_line); + let mut complete_line = format!("{}{}", fmtd_line_number, file_line.line_content.as_ref().unwrap()); let tab_count: usize = complete_line .chars() diff --git a/tests/fixtures/pr/column_spaces_across.log.expected b/tests/fixtures/pr/column_spaces_across.log.expected new file mode 100644 index 000000000..037dd814b --- /dev/null +++ b/tests/fixtures/pr/column_spaces_across.log.expected @@ -0,0 +1,198 @@ + + +{last_modified_time} column.log Page 3 + + + 337 337 338 338 339 339 + 340 340 341 341 342 342 + 343 343 344 344 345 345 + 346 346 347 347 348 348 + 349 349 350 350 351 351 + 352 352 353 353 354 354 + 355 355 356 356 357 357 + 358 358 359 359 360 360 + 361 361 362 362 363 363 + 364 364 365 365 366 366 + 367 367 368 368 369 369 + 370 370 371 371 372 372 + 373 373 374 374 375 375 + 376 376 377 377 378 378 + 379 379 380 380 381 381 + 382 382 383 383 384 384 + 385 385 386 386 387 387 + 388 388 389 389 390 390 + 391 391 392 392 393 393 + 394 394 395 395 396 396 + 397 397 398 398 399 399 + 400 400 401 401 402 402 + 403 403 404 404 405 405 + 406 406 407 407 408 408 + 409 409 410 410 411 411 + 412 412 413 413 414 414 + 415 415 416 416 417 417 + 418 418 419 419 420 420 + 421 421 422 422 423 423 + 424 424 425 425 426 426 + 427 427 428 428 429 429 + 430 430 431 431 432 432 + 433 433 434 434 435 435 + 436 436 437 437 438 438 + 439 439 440 440 441 441 + 442 442 443 443 444 444 + 445 445 446 446 447 447 + 448 448 449 449 450 450 + 451 451 452 452 453 453 + 454 454 455 455 456 456 + 457 457 458 458 459 459 + 460 460 461 461 462 462 + 463 463 464 464 465 465 + 466 466 467 467 468 468 + 469 469 470 470 471 471 + 472 472 473 473 474 474 + 475 475 476 476 477 477 + 478 478 479 479 480 480 + 481 481 482 482 483 483 + 484 484 485 485 486 486 + 487 487 488 488 489 489 + 490 490 491 491 492 492 + 493 493 494 494 495 495 + 496 496 497 497 498 498 + 499 499 500 500 501 501 + 502 502 503 503 504 504 + + + + + + + +{last_modified_time} column.log Page 4 + + + 505 505 506 506 507 507 + 508 508 509 509 510 510 + 511 511 512 512 513 513 + 514 514 515 515 516 516 + 517 517 518 518 519 519 + 520 520 521 521 522 522 + 523 523 524 524 525 525 + 526 526 527 527 528 528 + 529 529 530 530 531 531 + 532 532 533 533 534 534 + 535 535 536 536 537 537 + 538 538 539 539 540 540 + 541 541 542 542 543 543 + 544 544 545 545 546 546 + 547 547 548 548 549 549 + 550 550 551 551 552 552 + 553 553 554 554 555 555 + 556 556 557 557 558 558 + 559 559 560 560 561 561 + 562 562 563 563 564 564 + 565 565 566 566 567 567 + 568 568 569 569 570 570 + 571 571 572 572 573 573 + 574 574 575 575 576 576 + 577 577 578 578 579 579 + 580 580 581 581 582 582 + 583 583 584 584 585 585 + 586 586 587 587 588 588 + 589 589 590 590 591 591 + 592 592 593 593 594 594 + 595 595 596 596 597 597 + 598 598 599 599 600 600 + 601 601 602 602 603 603 + 604 604 605 605 606 606 + 607 607 608 608 609 609 + 610 610 611 611 612 612 + 613 613 614 614 615 615 + 616 616 617 617 618 618 + 619 619 620 620 621 621 + 622 622 623 623 624 624 + 625 625 626 626 627 627 + 628 628 629 629 630 630 + 631 631 632 632 633 633 + 634 634 635 635 636 636 + 637 637 638 638 639 639 + 640 640 641 641 642 642 + 643 643 644 644 645 645 + 646 646 647 647 648 648 + 649 649 650 650 651 651 + 652 652 653 653 654 654 + 655 655 656 656 657 657 + 658 658 659 659 660 660 + 661 661 662 662 663 663 + 664 664 665 665 666 666 + 667 667 668 668 669 669 + 670 670 671 671 672 672 + + + + + + + +{last_modified_time} column.log Page 5 + + + 673 673 674 674 675 675 + 676 676 677 677 678 678 + 679 679 680 680 681 681 + 682 682 683 683 684 684 + 685 685 686 686 687 687 + 688 688 689 689 690 690 + 691 691 692 692 693 693 + 694 694 695 695 696 696 + 697 697 698 698 699 699 + 700 700 701 701 702 702 + 703 703 704 704 705 705 + 706 706 707 707 708 708 + 709 709 710 710 711 711 + 712 712 713 713 714 714 + 715 715 716 716 717 717 + 718 718 719 719 720 720 + 721 721 722 722 723 723 + 724 724 725 725 726 726 + 727 727 728 728 729 729 + 730 730 731 731 732 732 + 733 733 734 734 735 735 + 736 736 737 737 738 738 + 739 739 740 740 741 741 + 742 742 743 743 744 744 + 745 745 746 746 747 747 + 748 748 749 749 750 750 + 751 751 752 752 753 753 + 754 754 755 755 756 756 + 757 757 758 758 759 759 + 760 760 761 761 762 762 + 763 763 764 764 765 765 + 766 766 767 767 768 768 + 769 769 770 770 771 771 + 772 772 773 773 774 774 + 775 775 776 776 777 777 + 778 778 779 779 780 780 + 781 781 782 782 783 783 + 784 784 785 785 786 786 + 787 787 788 788 789 789 + 790 790 791 791 792 792 + 793 793 794 794 795 795 + 796 796 797 797 798 798 + 799 799 800 800 801 801 + 802 802 803 803 804 804 + 805 805 806 806 807 807 + 808 808 809 809 810 810 + 811 811 812 812 813 813 + 814 814 815 815 816 816 + 817 817 818 818 819 819 + 820 820 821 821 822 822 + 823 823 824 824 825 825 + 826 826 827 827 828 828 + 829 829 830 830 831 831 + 832 832 833 833 834 834 + 835 835 836 836 837 837 + 838 838 839 839 840 840 + + + + + diff --git a/tests/fixtures/pr/hosts.log b/tests/fixtures/pr/hosts.log new file mode 100644 index 000000000..8d725920c --- /dev/null +++ b/tests/fixtures/pr/hosts.log @@ -0,0 +1,11 @@ +## +# Host Database +# +# localhost is used to configure the loopback interface +# when the system is booting. Do not change this entry. +## +127.0.0.1 localhost +127.0.0.1 Techopss-MacBook-Pro.local +127.0.0.1 tilakpr +255.255.255.255 broadcasthost +::1 localhost \ No newline at end of file diff --git a/tests/fixtures/pr/mpr.log.expected b/tests/fixtures/pr/mpr.log.expected new file mode 100644 index 000000000..f6fffd191 --- /dev/null +++ b/tests/fixtures/pr/mpr.log.expected @@ -0,0 +1,132 @@ + + +{last_modified_time} Page 1 + + + 1 1 ## + 2 2 # Host Database + 3 3 # + 4 4 # localhost is used to configure th + 5 5 # when the system is booting. Do n + 6 6 ## + 7 7 127.0.0.1 localhost + 8 8 127.0.0.1 Techopss-MacBook-Pro.loca + 9 9 127.0.0.1 tilakpr + 10 10 255.255.255.255 broadcasthost + 11 11 ::1 localhost + 12 12 + 13 13 + 14 14 + 15 15 + 16 16 + 17 17 + 18 18 + 19 19 + 20 20 + 21 21 + 22 22 + 23 23 + 24 24 + 25 25 + 26 26 + 27 27 + 28 28 + 29 29 + 30 30 + 31 31 + 32 32 + 33 33 + 34 34 + 35 35 + 36 36 + 37 37 + 38 38 + 39 39 + 40 40 + 41 41 + 42 42 + 43 43 + 44 44 + 45 45 + 46 46 + 47 47 + 48 48 + 49 49 + 50 50 + 51 51 + 52 52 + 53 53 + 54 54 + 55 55 + 56 56 + + + + + + + +{last_modified_time} Page 2 + + + 57 57 + 58 58 + 59 59 + 60 60 + 61 61 + 62 62 + 63 63 + 64 64 + 65 65 + 66 66 + 67 67 + 68 68 + 69 69 + 70 70 + 71 71 + 72 72 + 73 73 + 74 74 + 75 75 + 76 76 + 77 77 + 78 78 + 79 79 + 80 80 + 81 81 + 82 82 + 83 83 + 84 84 + 85 85 + 86 86 + 87 87 + 88 88 + 89 89 + 90 90 + 91 91 + 92 92 + 93 93 + 94 94 + 95 95 + 96 96 + 97 97 + 98 98 + 99 99 + 100 100 + 101 101 + 102 102 + 103 103 + 104 104 + 105 105 + 106 106 + 107 107 + 108 108 + 109 109 + 110 110 + 111 111 + 112 112 + + + + + diff --git a/tests/fixtures/pr/mpr1.log.expected b/tests/fixtures/pr/mpr1.log.expected new file mode 100644 index 000000000..64d786d90 --- /dev/null +++ b/tests/fixtures/pr/mpr1.log.expected @@ -0,0 +1,198 @@ + + +{last_modified_time} Page 2 + + + 57 57 + 58 58 + 59 59 + 60 60 + 61 61 + 62 62 + 63 63 + 64 64 + 65 65 + 66 66 + 67 67 + 68 68 + 69 69 + 70 70 + 71 71 + 72 72 + 73 73 + 74 74 + 75 75 + 76 76 + 77 77 + 78 78 + 79 79 + 80 80 + 81 81 + 82 82 + 83 83 + 84 84 + 85 85 + 86 86 + 87 87 + 88 88 + 89 89 + 90 90 + 91 91 + 92 92 + 93 93 + 94 94 + 95 95 + 96 96 + 97 97 + 98 98 + 99 99 + 100 100 + 101 101 + 102 102 + 103 103 + 104 104 + 105 105 + 106 106 + 107 107 + 108 108 + 109 109 + 110 110 + 111 111 + 112 112 + + + + + + + +{last_modified_time} Page 3 + + + 113 113 + 114 114 + 115 115 + 116 116 + 117 117 + 118 118 + 119 119 + 120 120 + 121 121 + 122 122 + 123 123 + 124 124 + 125 125 + 126 126 + 127 127 + 128 128 + 129 129 + 130 130 + 131 131 + 132 132 + 133 133 + 134 134 + 135 135 + 136 136 + 137 137 + 138 138 + 139 139 + 140 140 + 141 141 + 142 142 + 143 143 + 144 144 + 145 145 + 146 146 + 147 147 + 148 148 + 149 149 + 150 150 + 151 151 + 152 152 + 153 153 + 154 154 + 155 155 + 156 156 + 157 157 + 158 158 + 159 159 + 160 160 + 161 161 + 162 162 + 163 163 + 164 164 + 165 165 + 166 166 + 167 167 + 168 168 + + + + + + + +{last_modified_time} Page 4 + + + 169 169 + 170 170 + 171 171 + 172 172 + 173 173 + 174 174 + 175 175 + 176 176 + 177 177 + 178 178 + 179 179 + 180 180 + 181 181 + 182 182 + 183 183 + 184 184 + 185 185 + 186 186 + 187 187 + 188 188 + 189 189 + 190 190 + 191 191 + 192 192 + 193 193 + 194 194 + 195 195 + 196 196 + 197 197 + 198 198 + 199 199 + 200 200 + 201 201 + 202 202 + 203 203 + 204 204 + 205 205 + 206 206 + 207 207 + 208 208 + 209 209 + 210 210 + 211 211 + 212 212 + 213 213 + 214 214 + 215 215 + 216 216 + 217 217 + 218 218 + 219 219 + 220 220 + 221 221 + 222 222 + 223 223 + 224 224 + + + + + diff --git a/tests/fixtures/pr/mpr2.log.expected b/tests/fixtures/pr/mpr2.log.expected new file mode 100644 index 000000000..091f0f228 --- /dev/null +++ b/tests/fixtures/pr/mpr2.log.expected @@ -0,0 +1,200 @@ + + +{last_modified_time} Page 1 + + + 1 1 ## 1 + 2 2 # Host Database 2 + 3 3 # 3 + 4 4 # localhost is used to 4 + 5 5 # when the system is bo 5 + 6 6 ## 6 + 7 7 127.0.0.1 localhost 7 + 8 8 127.0.0.1 Techopss-MacB 8 + 9 9 127.0.0.1 tilakpr 9 + 10 10 255.255.255.255 broadca 10 + 11 11 ::1 localho 11 + 12 12 12 + 13 13 13 + 14 14 14 + 15 15 15 + 16 16 16 + 17 17 17 + 18 18 18 + 19 19 19 + 20 20 20 + 21 21 21 + 22 22 22 + 23 23 23 + 24 24 24 + 25 25 25 + 26 26 26 + 27 27 27 + 28 28 28 + 29 29 29 + 30 30 30 + 31 31 31 + 32 32 32 + 33 33 33 + 34 34 34 + 35 35 35 + 36 36 36 + 37 37 37 + 38 38 38 + 39 39 39 + 40 40 40 + 41 41 41 + 42 42 42 + 43 43 43 + 44 44 44 + 45 45 45 + 46 46 46 + 47 47 47 + 48 48 48 + 49 49 49 + 50 50 50 + 51 51 51 + 52 52 52 + 53 53 53 + 54 54 54 + 55 55 55 + 56 56 56 + 57 57 57 + 58 58 58 + 59 59 59 + 60 60 60 + 61 61 61 + 62 62 62 + 63 63 63 + 64 64 64 + 65 65 65 + 66 66 66 + 67 67 67 + 68 68 68 + 69 69 69 + 70 70 70 + 71 71 71 + 72 72 72 + 73 73 73 + 74 74 74 + 75 75 75 + 76 76 76 + 77 77 77 + 78 78 78 + 79 79 79 + 80 80 80 + 81 81 81 + 82 82 82 + 83 83 83 + 84 84 84 + 85 85 85 + 86 86 86 + 87 87 87 + 88 88 88 + 89 89 89 + 90 90 90 + + + + + + + +{last_modified_time} Page 2 + + + 91 91 91 + 92 92 92 + 93 93 93 + 94 94 94 + 95 95 95 + 96 96 96 + 97 97 97 + 98 98 98 + 99 99 99 + 100 100 100 + 101 101 101 + 102 102 102 + 103 103 103 + 104 104 104 + 105 105 105 + 106 106 106 + 107 107 107 + 108 108 108 + 109 109 109 + 110 110 110 + 111 111 111 + 112 112 112 + 113 113 113 + 114 114 114 + 115 115 115 + 116 116 116 + 117 117 117 + 118 118 118 + 119 119 119 + 120 120 120 + 121 121 121 + 122 122 122 + 123 123 123 + 124 124 124 + 125 125 125 + 126 126 126 + 127 127 127 + 128 128 128 + 129 129 129 + 130 130 130 + 131 131 131 + 132 132 132 + 133 133 133 + 134 134 134 + 135 135 135 + 136 136 136 + 137 137 137 + 138 138 138 + 139 139 139 + 140 140 140 + 141 141 141 + 142 142 142 + 143 143 143 + 144 144 144 + 145 145 145 + 146 146 146 + 147 147 147 + 148 148 148 + 149 149 149 + 150 150 150 + 151 151 151 + 152 152 152 + 153 153 153 + 154 154 154 + 155 155 155 + 156 156 156 + 157 157 157 + 158 158 158 + 159 159 159 + 160 160 160 + 161 161 161 + 162 162 162 + 163 163 163 + 164 164 164 + 165 165 165 + 166 166 166 + 167 167 167 + 168 168 168 + 169 169 169 + 170 170 170 + 171 171 171 + 172 172 172 + 173 173 173 + 174 174 174 + 175 175 175 + 176 176 176 + 177 177 177 + 178 178 178 + 179 179 179 + 180 180 180 + + + + + diff --git a/tests/test_pr.rs b/tests/test_pr.rs index 6faa48348..7b8c77d34 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -282,7 +282,6 @@ fn test_with_suppress_error_option() { #[test] fn test_with_stdin() { - let test_file_path = "stdin.log"; let expected_file_path = "stdin.log.expected"; let mut scenario = new_ucmd!(); scenario @@ -306,7 +305,6 @@ fn test_with_column() { .stdout_is_templated_fixture(expected_test_file_path, vec![ (&"{last_modified_time}".to_string(), &value), ]); - } #[test] @@ -321,7 +319,6 @@ fn test_with_column_across_option() { .stdout_is_templated_fixture(expected_test_file_path, vec![ (&"{last_modified_time}".to_string(), &value), ]); - } #[test] @@ -336,6 +333,64 @@ fn test_with_column_across_option_and_column_separator() { .stdout_is_templated_fixture(expected_test_file_path, vec![ (&"{last_modified_time}".to_string(), &value), ]); - } +#[test] +fn test_with_mpr() { + let test_file_path = "column.log"; + let test_file_path1 = "hosts.log"; + let expected_test_file_path = "mpr.log.expected"; + let expected_test_file_path1 = "mpr1.log.expected"; + let expected_test_file_path2 = "mpr2.log.expected"; + new_ucmd!() + .args(&["--pages=1:2", "-m", "-n", test_file_path, test_file_path1]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + (&"{last_modified_time}".to_string(), &now_time()), + ]); + + new_ucmd!() + .args(&["--pages=2:4", "-m", "-n", test_file_path, test_file_path1]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path1, vec![ + (&"{last_modified_time}".to_string(), &now_time()), + ]); + + new_ucmd!() + .args(&["--pages=1:2", "-l", "100", "-n", "-m", test_file_path, test_file_path1, test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path2, vec![ + (&"{last_modified_time}".to_string(), &now_time()), + ]); +} + +#[test] +fn test_with_mpr_and_column_options() { + let test_file_path = "column.log"; + new_ucmd!() + .args(&["--column=2", "-m", "-n", test_file_path]) + .fails() + .stderr_is("pr: cannot specify number of columns when printing in parallel") + .stdout_is(""); + + new_ucmd!() + .args(&["-a", "-m", "-n", test_file_path]) + .fails() + .stderr_is("pr: cannot specify both printing across and printing in parallel") + .stdout_is(""); +} + + +#[test] +fn test_with_offset_space_option() { + let test_file_path = "column.log"; + let expected_test_file_path = "column_spaces_across.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["-o", "5", "--pages=3:5", "--column=3", "-a", "-n", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + (&"{last_modified_time}".to_string(), &value), + ]); +} From 5c6c5243349e3544fefcc9c0a0cfc501db8b48e2 Mon Sep 17 00:00:00 2001 From: Tilak Patidar Date: Sat, 29 Dec 2018 14:10:43 +0530 Subject: [PATCH 0158/1135] pr: refactor and fmt fill_missing_lines and error checks pr: Remove unwanted brancing in fill_missing_lines pr: Remove unnecessary error check pr: Rename key to group_key in FileLine pr: Reformat test_pr with rustfmt --- src/pr/pr.rs | 742 +++++++++++++++++++++++++---------------------- tests/test_pr.rs | 216 +++++++++----- 2 files changed, 528 insertions(+), 430 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 06c991c29..87aadf80c 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -10,35 +10,36 @@ extern crate unix_socket; #[macro_use] extern crate quick_error; -extern crate itertools; extern crate chrono; extern crate getopts; +extern crate itertools; extern crate uucore; -use std::io::{BufRead, BufReader, stdin, stdout, stderr, Error, Read, Write, Stdout, Lines, Stdin}; -use std::vec::Vec; use chrono::offset::Local; use chrono::DateTime; +use getopts::{HasArg, Occur}; use getopts::{Matches, Options}; -use std::fs::{metadata, File, Metadata}; -#[cfg(unix)] -use std::os::unix::fs::FileTypeExt; +use itertools::structs::KMergeBy; +use itertools::{GroupBy, Itertools}; use quick_error::ResultExt; use std::convert::From; -use getopts::{HasArg, Occur}; +use std::fs::{metadata, File, Metadata}; +use std::io::{stderr, stdin, stdout, BufRead, BufReader, Lines, Read, Stdin, Stdout, Write}; +use std::iter::{Enumerate, Map, SkipWhile, TakeWhile}; use std::num::ParseIntError; -use itertools::{Itertools, GroupBy}; -use std::iter::{Enumerate, Map, TakeWhile, SkipWhile}; -use itertools::structs::KMergeBy; +#[cfg(unix)] +use std::os::unix::fs::FileTypeExt; +use std::vec::Vec; + +type IOError = std::io::Error; static NAME: &str = "pr"; static VERSION: &str = env!("CARGO_PKG_VERSION"); static TAB: char = '\t'; +static NEW_LINE: &str = "\n"; static LINES_PER_PAGE: usize = 66; static HEADER_LINES_PER_PAGE: usize = 5; static TRAILER_LINES_PER_PAGE: usize = 5; -static NUMBERING_MODE_DEFAULT_SEPARATOR: &str = "\t"; -static NUMBERING_MODE_DEFAULT_WIDTH: usize = 5; static STRING_HEADER_OPTION: &str = "h"; static DOUBLE_SPACE_OPTION: &str = "d"; static NUMBERING_MODE_OPTION: &str = "n"; @@ -57,7 +58,8 @@ static OFFSET_SPACES_OPTION: &str = "o"; static FILE_STDIN: &str = "-"; static READ_BUFFER_SIZE: usize = 1024 * 64; static DEFAULT_COLUMN_WIDTH: usize = 72; -static DEFAULT_COLUMN_SEPARATOR: &str = "\t"; +static DEFAULT_COLUMN_SEPARATOR: &char = &TAB; +static BLANK_STRING: &str = ""; struct OutputOptions { /// Line numbering mode @@ -67,7 +69,7 @@ struct OutputOptions { line_separator: String, content_line_separator: String, last_modified_time: String, - start_page: Option, + start_page: usize, end_page: Option, display_header: bool, display_trailer: bool, @@ -75,15 +77,15 @@ struct OutputOptions { page_separator_char: String, column_mode_options: Option, merge_files_print: Option, - offset_spaces: usize + offset_spaces: usize, } struct FileLine { file_id: usize, line_number: usize, page_number: usize, - key: usize, - line_content: Result, + group_key: usize, + line_content: Result, } impl AsRef for FileLine { @@ -93,7 +95,7 @@ impl AsRef for FileLine { } struct ColumnModeOptions { - width: Option, + width: usize, columns: usize, column_separator: String, across_mode: bool, @@ -115,21 +117,15 @@ struct NumberingMode { impl Default for NumberingMode { fn default() -> NumberingMode { NumberingMode { - width: NUMBERING_MODE_DEFAULT_WIDTH, - separator: NUMBERING_MODE_DEFAULT_SEPARATOR.to_string(), + width: 5, + separator: TAB.to_string(), first_number: 1, } } } -impl From for PrError { - fn from(err: Error) -> Self { - PrError::EncounteredErrors(err.to_string()) - } -} - -impl From for PrError { - fn from(err: std::num::ParseIntError) -> Self { +impl From for PrError { + fn from(err: IOError) -> Self { PrError::EncounteredErrors(err.to_string()) } } @@ -137,8 +133,8 @@ impl From for PrError { quick_error! { #[derive(Debug)] enum PrError { - Input(err: Error, path: String) { - context(path: &'a str, err: Error) -> (err, path.to_owned()) + Input(err: IOError, path: String) { + context(path: &'a str, err: IOError) -> (err, path.to_owned()) display("pr: Reading from input {0} gave error", path) cause(err) } @@ -181,7 +177,7 @@ pub fn uumain(args: Vec) -> i32 { STRING_HEADER_OPTION, "header", "Use the string header to replace the file name \ - in the header line.", + in the header line.", "STRING", HasArg::Yes, Occur::Optional, @@ -353,7 +349,6 @@ pub fn uumain(args: Vec) -> i32 { files.insert(0, FILE_STDIN.to_owned()); } - if matches.opt_present("help") { return print_usage(&mut opts, &matches); } @@ -381,7 +376,7 @@ pub fn uumain(args: Vec) -> i32 { print_error(&matches, error); 1 } - _ => 0 + _ => 0, }; if status != 0 { return status; @@ -403,10 +398,13 @@ fn print_error(matches: &Matches, err: PrError) { fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { println!("{} {} -- print files", NAME, VERSION); println!(); - println!("Usage: {} [+page] [-column] [-adFfmprt] [[-e] [char] [gap]] + println!( + "Usage: {} [+page] [-column] [-adFfmprt] [[-e] [char] [gap]] [-L locale] [-h header] [[-i] [char] [gap]] [-l lines] [-o offset] [[-s] [char]] [[-n] [char] - [width]] [-w width] [-] [file ...].", NAME); + [width]] [-w width] [-] [file ...].", + NAME + ); println!(); let usage: &str = "The pr utility is a printing and pagination filter for text files. When multiple input files are spec- @@ -435,16 +433,39 @@ fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { return 0; } +fn parse_usize(matches: &Matches, opt: &str) -> Option> { + let from_parse_error_to_pr_error = |value_to_parse: (String, String)| { + let i = value_to_parse.0; + let option = value_to_parse.1; + i.parse::().map_err(|_e| { + PrError::EncounteredErrors(format!("invalid {} argument '{}'", option, i)) + }) + }; + matches + .opt_str(opt) + .map(|i| (i, format!("-{}", opt))) + .map(from_parse_error_to_pr_error) +} + fn build_options(matches: &Matches, paths: &Vec) -> Result { + let invalid_pages_map = |i: String| { + let unparsed_value: String = matches.opt_str(PAGE_RANGE_OPTION).unwrap(); + i.parse::().map_err(|_e| { + PrError::EncounteredErrors(format!("invalid --pages argument '{}'", unparsed_value)) + }) + }; + let is_merge_mode: bool = matches.opt_present(MERGE_FILES_PRINT); if is_merge_mode && matches.opt_present(COLUMN_OPTION) { - let err_msg: String = "cannot specify number of columns when printing in parallel".to_string(); + let err_msg: String = + "cannot specify number of columns when printing in parallel".to_string(); return Err(PrError::EncounteredErrors(err_msg)); } if is_merge_mode && matches.opt_present(ACROSS_OPTION) { - let err_msg: String = "cannot specify both printing across and printing in parallel".to_string(); + let err_msg: String = + "cannot specify both printing across and printing in parallel".to_string(); return Err(PrError::EncounteredErrors(err_msg)); } @@ -454,65 +475,71 @@ fn build_options(matches: &Matches, paths: &Vec) -> Result().unwrap_or(default_first_number) - }).unwrap_or(default_first_number); + let first_number: usize = + parse_usize(matches, FIRST_LINE_NUMBER_OPTION).unwrap_or(Ok(default_first_number))?; - let numbering_options: Option = matches.opt_str(NUMBERING_MODE_OPTION).map(|i| { - let parse_result: Result = i.parse::(); + let numbering_options: Option = matches + .opt_str(NUMBERING_MODE_OPTION) + .map(|i| { + let parse_result: Result = i.parse::(); - let separator: String = if parse_result.is_err() { - if is_a_file(&i) { + let separator: String = if parse_result.is_err() { + if is_a_file(&i) { + NumberingMode::default().separator + } else { + i[0..1].to_string() + } + } else { NumberingMode::default().separator - } else { - i[0..1].to_string() - } - } else { - NumberingMode::default().separator - }; + }; - let width: usize = if parse_result.is_err() { - if is_a_file(&i) { - NumberingMode::default().width + let width: usize = if parse_result.is_err() { + if is_a_file(&i) { + NumberingMode::default().width + } else { + i[1..] + .parse::() + .unwrap_or(NumberingMode::default().width) + } } else { - i[1..].parse::().unwrap_or(NumberingMode::default().width) - } - } else { - parse_result.unwrap() - }; + parse_result.unwrap() + }; - NumberingMode { - width, - separator, - first_number, - } - }).or_else(|| { - if matches.opt_present(NUMBERING_MODE_OPTION) { - return Some(NumberingMode::default()); - } - return None; - }); + NumberingMode { + width, + separator, + first_number, + } + }) + .or_else(|| { + if matches.opt_present(NUMBERING_MODE_OPTION) { + return Some(NumberingMode::default()); + } + return None; + }); let double_space: bool = matches.opt_present(DOUBLE_SPACE_OPTION); let content_line_separator: String = if double_space { - "\n\n".to_string() + NEW_LINE.repeat(2) } else { - "\n".to_string() + NEW_LINE.to_string() }; - let line_separator: String = "\n".to_string(); + let line_separator: String = NEW_LINE.to_string(); let last_modified_time: String = if is_merge_mode || paths[0].eq(FILE_STDIN) { current_time() @@ -520,48 +547,46 @@ fn build_options(matches: &Matches, paths: &Vec) -> Result| { - let unparsed_value: String = matches.opt_str(PAGE_RANGE_OPTION).unwrap(); - match i { - Ok(val) => Ok(val), - Err(_e) => Err(PrError::EncounteredErrors(format!("invalid --pages argument '{}'", unparsed_value))) - } + let start_page: usize = match matches + .opt_str(PAGE_RANGE_OPTION) + .map(|i| { + let x: Vec<&str> = i.split(":").collect(); + x[0].to_string() + }) + .map(invalid_pages_map) + { + Some(res) => res?, + _ => 1, }; - let start_page: Option = match matches.opt_str(PAGE_RANGE_OPTION).map(|i| { - let x: Vec<&str> = i.split(":").collect(); - x[0].parse::() - }).map(invalid_pages_map) - { - Some(res) => Some(res?), - _ => None - }; - - let end_page: Option = match matches.opt_str(PAGE_RANGE_OPTION) + let end_page: Option = match matches + .opt_str(PAGE_RANGE_OPTION) .filter(|i: &String| i.contains(":")) .map(|i: String| { let x: Vec<&str> = i.split(":").collect(); - x[1].parse::() + x[1].to_string() }) .map(invalid_pages_map) - { - Some(res) => Some(res?), - _ => None - }; + { + Some(res) => Some(res?), + _ => None, + }; - if start_page.is_some() && end_page.is_some() && start_page.unwrap() > end_page.unwrap() { - return Err(PrError::EncounteredErrors(format!("invalid --pages argument '{}:{}'", start_page.unwrap(), end_page.unwrap()))); + if end_page.is_some() && start_page > end_page.unwrap() { + return Err(PrError::EncounteredErrors(format!( + "invalid --pages argument '{}:{}'", + start_page, + end_page.unwrap() + ))); } - let page_length: usize = match matches.opt_str(PAGE_LENGTH_OPTION).map(|i| { - i.parse::() - }) { - Some(res) => res?, - _ => LINES_PER_PAGE - }; + let page_length: usize = + parse_usize(matches, PAGE_LENGTH_OPTION).unwrap_or(Ok(LINES_PER_PAGE))?; + let page_length_le_ht: bool = page_length < (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE); - let display_header_and_trailer: bool = !(page_length_le_ht) && !matches.opt_present(NO_HEADER_TRAILER_OPTION); + let display_header_and_trailer: bool = + !(page_length_le_ht) && !matches.opt_present(NO_HEADER_TRAILER_OPTION); let content_lines_per_page: usize = if page_length_le_ht { page_length @@ -569,45 +594,31 @@ fn build_options(matches: &Matches, paths: &Vec) -> Result = match matches.opt_str(COLUMN_WIDTH_OPTION).map(|i| i.parse::()) { - Some(res) => Some(res?), - _ => None - }; + let column_width: usize = + parse_usize(matches, COLUMN_WIDTH_OPTION).unwrap_or(Ok(DEFAULT_COLUMN_WIDTH))?; let across_mode: bool = matches.opt_present(ACROSS_OPTION); - let column_separator: String = matches.opt_str(COLUMN_SEPARATOR_OPTION) + let column_separator: String = matches + .opt_str(COLUMN_SEPARATOR_OPTION) .unwrap_or(DEFAULT_COLUMN_SEPARATOR.to_string()); - - let column_mode_options: Option = match matches.opt_str(COLUMN_OPTION).map(|i| { - i.parse::() - }) { - Some(res) => { - Some(ColumnModeOptions { - columns: res?, - width: match column_width { - Some(x) => Some(x), - None => Some(DEFAULT_COLUMN_WIDTH) - }, - column_separator, - across_mode, - }) - } - _ => None + let column_mode_options: Option = match parse_usize(matches, COLUMN_OPTION) { + Some(res) => Some(ColumnModeOptions { + columns: res?, + width: column_width, + column_separator, + across_mode, + }), + _ => None, }; - - let offset_spaces: usize = matches.opt_str(OFFSET_SPACES_OPTION) - .map(|i| { - match i.parse::() { - Ok(val)=> Ok(val), - Err(e)=> Err(PrError::EncounteredErrors("".to_string())) - } - }).unwrap_or(Ok(0))?; + + let offset_spaces: usize = parse_usize(matches, OFFSET_SPACES_OPTION).unwrap_or(Ok(0))?; Ok(OutputOptions { number: numbering_options, @@ -634,94 +645,81 @@ fn open(path: &str) -> Result, PrError> { return Ok(Box::new(stdin) as Box); } - metadata(path).map(|i: Metadata| { - let path_string = path.to_string(); - match i.file_type() { - #[cfg(unix)] - ft if ft.is_block_device() => - { - Err(PrError::UnknownFiletype(path_string)) + metadata(path) + .map(|i: Metadata| { + let path_string = path.to_string(); + match i.file_type() { + #[cfg(unix)] + ft if ft.is_block_device() => Err(PrError::UnknownFiletype(path_string)), + #[cfg(unix)] + ft if ft.is_char_device() => Err(PrError::UnknownFiletype(path_string)), + #[cfg(unix)] + ft if ft.is_fifo() => Err(PrError::UnknownFiletype(path_string)), + #[cfg(unix)] + ft if ft.is_socket() => Err(PrError::IsSocket(path_string)), + ft if ft.is_dir() => Err(PrError::IsDirectory(path_string)), + ft if ft.is_file() || ft.is_symlink() => { + Ok(Box::new(File::open(path).context(path)?) as Box) } - #[cfg(unix)] - ft if ft.is_char_device() => - { - Err(PrError::UnknownFiletype(path_string)) - } - #[cfg(unix)] - ft if ft.is_fifo() => - { - Err(PrError::UnknownFiletype(path_string)) - } - #[cfg(unix)] - ft if ft.is_socket() => - { - Err(PrError::IsSocket(path_string)) - } - ft if ft.is_dir() => Err(PrError::IsDirectory(path_string)), - ft if ft.is_file() || ft.is_symlink() => Ok(Box::new(File::open(path).context(path)?) as Box), - _ => Err(PrError::UnknownFiletype(path_string)) - } - }).unwrap_or(Err(PrError::NotExists(path.to_string()))) + _ => Err(PrError::UnknownFiletype(path_string)), + } + }) + .unwrap_or(Err(PrError::NotExists(path.to_string()))) } fn pr(path: &String, options: &OutputOptions) -> Result { - let start_page: &usize = options.start_page.as_ref().unwrap_or(&1); + let start_page: &usize = &options.start_page; let start_line_number: usize = get_start_line_number(options); let last_page: Option<&usize> = options.end_page.as_ref(); let lines_needed_per_page: usize = lines_to_read_for_page(options); - let file_line_groups: GroupBy>>>, _>, _>, _>, _>, _> = - BufReader::with_capacity(READ_BUFFER_SIZE, open(path).unwrap()) - .lines() - .enumerate() - .map(move |i: (usize, Result)| { - FileLine { - file_id: 0, - line_number: i.0, - line_content: i.1, - page_number: 0, - key: 0, - } - }) - .skip_while(move |file_line: &FileLine| { - // Skip the initial lines if not in page range - let start_line_index_of_start_page = (start_page - 1) * lines_needed_per_page; - file_line.line_number < (start_line_index_of_start_page) - }) - .take_while(move |file_line: &FileLine| { - // Only read the file until provided last page reached - last_page - .map(|lp| file_line.line_number < ((*lp) * lines_needed_per_page)) - .unwrap_or(true) - }) - .map(move |file_line: FileLine| { - let page_number = ((file_line.line_number + 1) as f64 / lines_needed_per_page as f64).ceil() as usize; - FileLine { - line_number: file_line.line_number + start_line_number, - page_number, - key: page_number, - ..file_line - } - }) // get display line number with line content - .group_by(|file_line: &FileLine| { - file_line.page_number - }); - + let start_line_index_of_start_page = (start_page - 1) * lines_needed_per_page; + let file_line_groups: GroupBy< + usize, + Map>>>, _>, _>, _>, _>, + _, + > = BufReader::with_capacity(READ_BUFFER_SIZE, open(path).unwrap()) + .lines() + .enumerate() + .map(|i: (usize, Result)| FileLine { + file_id: 0, + line_number: i.0, + line_content: i.1, + page_number: 0, + group_key: 0, + }) + .skip_while(|file_line: &FileLine| { + // Skip the initial lines if not in page range + file_line.line_number < (start_line_index_of_start_page) + }) + .take_while(|file_line: &FileLine| { + // Only read the file until provided last page reached + last_page + .map(|lp| file_line.line_number < ((*lp) * lines_needed_per_page)) + .unwrap_or(true) + }) + .map(|file_line: FileLine| { + let page_number = + ((file_line.line_number + 1) as f64 / lines_needed_per_page as f64).ceil() as usize; + FileLine { + line_number: file_line.line_number + start_line_number, + page_number, + group_key: page_number, + ..file_line + } + }) // get display line number with line content + .group_by(|file_line: &FileLine| file_line.group_key); for (page_number, file_line_group) in file_line_groups.into_iter() { let mut lines: Vec = Vec::new(); for file_line in file_line_group { if file_line.line_content.is_err() { - return Err(PrError::from(file_line.line_content.unwrap_err())); + return Err(file_line.line_content.unwrap_err().into()); } lines.push(file_line); } - let print_status: Result = print_page(&lines, options, &page_number); - if print_status.is_err() { - return Err(PrError::from(print_status.unwrap_err())); - } + print_page(&lines, options, &page_number)?; } - return Ok(0); } @@ -730,10 +728,18 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { let lines_needed_per_page: usize = lines_to_read_for_page(options); let lines_needed_per_page_f64: f64 = lines_needed_per_page as f64; - let start_page: &usize = options.start_page.as_ref().unwrap_or(&1); + let start_page: &usize = &options.start_page; let last_page: Option<&usize> = options.end_page.as_ref(); + let start_line_index_of_start_page = (start_page - 1) * lines_needed_per_page; - let file_line_groups: GroupBy>>>, _>, _>, _>, _>, _>, _> = paths + let file_line_groups: GroupBy< + usize, + KMergeBy< + Map>>>, _>, _>, _>, _>, + _, + >, + _, + > = paths .into_iter() .enumerate() .map(|indexed_path: (usize, &String)| { @@ -741,63 +747,56 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { BufReader::with_capacity(READ_BUFFER_SIZE, open(indexed_path.1).unwrap()) .lines() .enumerate() - .map(move |i: (usize, Result)| { - FileLine { - file_id: indexed_path.0, - line_number: i.0, - line_content: i.1, - page_number: 0, - key: 0, - } + .map(move |i: (usize, Result)| FileLine { + file_id: indexed_path.0, + line_number: i.0, + line_content: i.1, + page_number: 0, + group_key: 0, }) .skip_while(move |file_line: &FileLine| { // Skip the initial lines if not in page range - let start_line_index_of_start_page = (start_page - 1) * lines_needed_per_page; file_line.line_number < (start_line_index_of_start_page) }) .take_while(move |file_line: &FileLine| { - // Only read the file until provided last page reached - + // Only read the file until provided last page reached last_page .map(|lp| file_line.line_number < ((*lp) * lines_needed_per_page)) .unwrap_or(true) }) .map(move |file_line: FileLine| { - let page_number = ((file_line.line_number + 2 - start_line_number) as f64 / (lines_needed_per_page_f64)).ceil() as usize; + let page_number = ((file_line.line_number + 2 - start_line_number) as f64 + / (lines_needed_per_page_f64)) + .ceil() as usize; FileLine { line_number: file_line.line_number + start_line_number, page_number, - key: page_number * nfiles + file_line.file_id, + group_key: page_number * nfiles + file_line.file_id, ..file_line } }) // get display line number with line content }) .kmerge_by(|a: &FileLine, b: &FileLine| { - if a.key == b.key { + if a.group_key == b.group_key { a.line_number < b.line_number } else { - a.key < b.key + a.group_key < b.group_key } }) - .group_by(|file_line: &FileLine| { - file_line.key - }); + .group_by(|file_line: &FileLine| file_line.group_key); let mut lines: Vec = Vec::new(); - let start_page: &usize = options.start_page.as_ref().unwrap_or(&1); + let start_page: &usize = &options.start_page; let mut page_counter: usize = *start_page; for (_key, file_line_group) in file_line_groups.into_iter() { for file_line in file_line_group { if file_line.line_content.is_err() { - return Err(PrError::from(file_line.line_content.unwrap_err())); + return Err(file_line.line_content.unwrap_err().into()); } let new_page_number = file_line.page_number; if page_counter != new_page_number { - fill_missing_files(&mut lines, lines_needed_per_page, &nfiles, page_counter); - let print_status: Result = print_page(&lines, options, &page_counter); - if print_status.is_err() { - return Err(PrError::from(print_status.unwrap_err())); - } + fill_missing_lines(&mut lines, lines_needed_per_page, &nfiles, page_counter); + print_page(&lines, options, &page_counter)?; lines = Vec::new(); } lines.push(file_line); @@ -805,76 +804,73 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { } } - fill_missing_files(&mut lines, lines_needed_per_page, &nfiles, page_counter); - let print_status: Result = print_page(&lines, options, &page_counter); - if print_status.is_err() { - return Err(PrError::from(print_status.unwrap_err())); - } - + fill_missing_lines(&mut lines, lines_needed_per_page, &nfiles, page_counter); + print_page(&lines, options, &page_counter)?; return Ok(0); } -fn fill_missing_files(lines: &mut Vec, lines_per_file: usize, nfiles: &usize, page_number: usize) { +fn fill_missing_lines( + lines: &mut Vec, + lines_per_file: usize, + nfiles: &usize, + page_number: usize, +) { let init_line_number = (page_number - 1) * lines_per_file + 1; - let final_line_number = page_number * lines_per_file; let mut file_id_counter: usize = 0; let mut line_number_counter: usize = init_line_number; - let mut lines_processed: usize = 0; - let mut file_id_missing: bool = false; + let mut lines_processed_per_file: usize = 0; for mut i in 0..lines_per_file * nfiles { - let file_id = lines.get(i).map(|i: &FileLine| i.file_id).unwrap_or(file_id_counter); + let file_id = lines + .get(i) + .map(|i: &FileLine| i.file_id) + .unwrap_or(file_id_counter); let line_number = lines.get(i).map(|i: &FileLine| i.line_number).unwrap_or(1); - if lines_processed == lines_per_file { + if lines_processed_per_file == lines_per_file { line_number_counter = init_line_number; file_id_counter += 1; - lines_processed = 0; - file_id_missing = false; - } - - if file_id_counter >= *nfiles { - file_id_counter = 0; - file_id_missing = false; + lines_processed_per_file = 0; } if file_id != file_id_counter { - file_id_missing = true; - } - - if file_id_missing { // Insert missing file_ids - lines.insert(i, FileLine { - file_id: file_id_counter, - line_number: line_number_counter, - line_content: Ok("".to_string()), - page_number, - key: 0, - }); + lines.insert( + i, + FileLine { + file_id: file_id_counter, + line_number: line_number_counter, + line_content: Ok("".to_string()), + page_number, + group_key: 0, + }, + ); line_number_counter += 1; - } else { + } else if line_number < line_number_counter { // Insert missing lines for a file_id - if line_number < line_number_counter { - line_number_counter += 1; - lines.insert(i, FileLine { + line_number_counter += 1; + lines.insert( + i, + FileLine { file_id, line_number: line_number_counter, line_content: Ok("".to_string()), page_number, - key: 0, - }); - } else { - line_number_counter = line_number; - if line_number_counter == final_line_number { - line_number_counter = init_line_number; - } - } + group_key: 0, + }, + ); + } else { + line_number_counter = line_number; } - lines_processed += 1; + lines_processed_per_file += 1; } } -fn print_page(lines: &Vec, options: &OutputOptions, page: &usize) -> Result { +fn print_page( + lines: &Vec, + options: &OutputOptions, + page: &usize, +) -> Result { let page_separator = options.page_separator_char.as_bytes(); let header: Vec = header_content(options, page); let trailer_content: Vec = trailer_content(options); @@ -902,7 +898,11 @@ fn print_page(lines: &Vec, options: &OutputOptions, page: &usize) -> R Ok(lines_written) } -fn write_columns(lines: &Vec, options: &OutputOptions, out: &mut Stdout) -> Result { +fn write_columns( + lines: &Vec, + options: &OutputOptions, + out: &mut Stdout, +) -> Result { let line_separator = options.content_line_separator.as_bytes(); let content_lines_per_page = if options.double_space { options.content_lines_per_page / 2 @@ -910,12 +910,10 @@ fn write_columns(lines: &Vec, options: &OutputOptions, out: &mut Stdou options.content_lines_per_page }; - let width: usize = options - .number.as_ref() - .map(|i| i.width) - .unwrap_or(0); + let width: usize = options.number.as_ref().map(|i| i.width).unwrap_or(0); let number_separator: String = options - .number.as_ref() + .number + .as_ref() .map(|i| i.separator.to_string()) .unwrap_or(NumberingMode::default().separator); @@ -923,46 +921,50 @@ fn write_columns(lines: &Vec, options: &OutputOptions, out: &mut Stdou let columns = options.merge_files_print.unwrap_or(get_columns(options)); let def_sep = DEFAULT_COLUMN_SEPARATOR.to_string(); let col_sep: &String = options - .column_mode_options.as_ref() + .column_mode_options + .as_ref() .map(|i| &i.column_separator) - .unwrap_or(options - .merge_files_print - .map(|_k| &def_sep) - .unwrap_or(&blank_line) + .unwrap_or( + options + .merge_files_print + .map(|_k| &def_sep) + .unwrap_or(&blank_line), ); + // TODO simplify let col_width: Option = options - .column_mode_options.as_ref() - .map(|i| i.width) - .unwrap_or(options - .merge_files_print - .map(|_k| Some(DEFAULT_COLUMN_WIDTH)) - .unwrap_or(None) + .column_mode_options + .as_ref() + .map(|i| Some(i.width)) + .unwrap_or( + options + .merge_files_print + .map(|_k| Some(DEFAULT_COLUMN_WIDTH)) + .unwrap_or(None), ); let across_mode = options - .column_mode_options.as_ref() + .column_mode_options + .as_ref() .map(|i| i.across_mode) .unwrap_or(false); - + let offset_spaces: &usize = &options.offset_spaces; let mut lines_printed = 0; let is_number_mode = options.number.is_some(); let fetch_indexes: Vec> = if across_mode { (0..content_lines_per_page) - .map(|a| - (0..columns) - .map(|i| a * columns + i) - .collect() - ).collect() + .map(|a| (0..columns).map(|i| a * columns + i).collect()) + .collect() } else { (0..content_lines_per_page) - .map(|start| + .map(|start| { (0..columns) .map(|i| start + content_lines_per_page * i) .collect() - ).collect() + }) + .collect() }; let spaces = " ".repeat(*offset_spaces); @@ -975,10 +977,20 @@ fn write_columns(lines: &Vec, options: &OutputOptions, out: &mut Stdou break; } let file_line: &FileLine = lines.get(index).unwrap(); - let trimmed_line: String = format!("{}{}", spaces, get_line_for_printing( - file_line, &width, &number_separator, columns, col_width, - is_number_mode, &options.merge_files_print, &i, - )); + let trimmed_line: String = format!( + "{}{}", + spaces, + get_line_for_printing( + file_line, + &width, + &number_separator, + columns, + col_width, + is_number_mode, + &options.merge_files_print, + &i, + ) + ); out.write(trimmed_line.as_bytes())?; if (i + 1) != indexes { out.write(col_sep.as_bytes())?; @@ -990,58 +1002,76 @@ fn write_columns(lines: &Vec, options: &OutputOptions, out: &mut Stdou Ok(lines_printed) } -fn get_line_for_printing(file_line: &FileLine, width: &usize, - separator: &String, columns: usize, - col_width: Option, - is_number_mode: bool, merge_files_print: &Option, - index: &usize, +fn get_line_for_printing( + file_line: &FileLine, + width: &usize, + separator: &String, + columns: usize, + col_width: Option, + is_number_mode: bool, + merge_files_print: &Option, + index: &usize, ) -> String { - let should_show_line_number_merge_file = merge_files_print.is_none() || index == &usize::min_value(); + let should_show_line_number_merge_file = + merge_files_print.is_none() || index == &usize::min_value(); let should_show_line_number = is_number_mode && should_show_line_number_merge_file; let fmtd_line_number: String = if should_show_line_number { get_fmtd_line_number(&width, file_line.line_number, &separator) } else { "".to_string() }; - let mut complete_line = format!("{}{}", fmtd_line_number, file_line.line_content.as_ref().unwrap()); + let mut complete_line = format!( + "{}{}", + fmtd_line_number, + file_line.line_content.as_ref().unwrap() + ); - let tab_count: usize = complete_line - .chars() - .filter(|i| i == &TAB) - .count(); + let tab_count: usize = complete_line.chars().filter(|i| i == &TAB).count(); let display_length = complete_line.len() + (tab_count * 7); -// TODO Adjust the width according to -n option -// TODO actual len of the string vs display len of string because of tabs - col_width.map(|i| { - let min_width = (i - (columns - 1)) / columns; - if display_length < min_width { - for _i in 0..(min_width - display_length) { - complete_line.push(' '); + // TODO Adjust the width according to -n option + // TODO actual len of the string vs display len of string because of tabs + col_width + .map(|i| { + let min_width = (i - (columns - 1)) / columns; + if display_length < min_width { + for _i in 0..(min_width - display_length) { + complete_line.push(' '); + } } - } - complete_line - .chars() - .take(min_width) - .collect() - }).unwrap_or(complete_line) + complete_line.chars().take(min_width).collect() + }) + .unwrap_or(complete_line) } fn get_fmtd_line_number(width: &usize, line_number: usize, separator: &String) -> String { let line_str = line_number.to_string(); if line_str.len() >= *width { - format!("{:>width$}{}", &line_str[line_str.len() - *width..], separator, width = width) + format!( + "{:>width$}{}", + &line_str[line_str.len() - *width..], + separator, + width = width + ) } else { format!("{:>width$}{}", line_str, separator, width = width) } } - fn header_content(options: &OutputOptions, page: &usize) -> Vec { if options.display_header { - let first_line: String = format!("{} {} Page {}", options.last_modified_time, options.header, page); - vec!["".to_string(), "".to_string(), first_line, "".to_string(), "".to_string()] + let first_line: String = format!( + "{} {} Page {}", + options.last_modified_time, options.header, page + ); + vec![ + BLANK_STRING.to_string(), + BLANK_STRING.to_string(), + first_line, + BLANK_STRING.to_string(), + BLANK_STRING.to_string(), + ] } else { Vec::new() } @@ -1049,12 +1079,17 @@ fn header_content(options: &OutputOptions, page: &usize) -> Vec { fn file_last_modified_time(path: &str) -> String { let file_metadata = metadata(path); - return file_metadata.map(|i| { - return i.modified().map(|x| { - let datetime: DateTime = x.into(); - datetime.format("%b %d %H:%M %Y").to_string() - }).unwrap_or(String::new()); - }).unwrap_or(String::new()); + return file_metadata + .map(|i| { + return i + .modified() + .map(|x| { + let datetime: DateTime = x.into(); + datetime.format("%b %d %H:%M %Y").to_string() + }) + .unwrap_or(String::new()); + }) + .unwrap_or(String::new()); } fn current_time() -> String { @@ -1064,7 +1099,13 @@ fn current_time() -> String { fn trailer_content(options: &OutputOptions) -> Vec { if options.as_ref().display_trailer { - vec!["".to_string(), "".to_string(), "".to_string(), "".to_string(), "".to_string()] + vec![ + BLANK_STRING.to_string(), + BLANK_STRING.to_string(), + BLANK_STRING.to_string(), + BLANK_STRING.to_string(), + BLANK_STRING.to_string(), + ] } else { Vec::new() } @@ -1076,10 +1117,7 @@ fn trailer_content(options: &OutputOptions) -> Vec { /// # Arguments /// * `opts` - A reference to OutputOptions fn get_start_line_number(opts: &OutputOptions) -> usize { - opts.number - .as_ref() - .map(|i| i.first_number) - .unwrap_or(1) + opts.number.as_ref().map(|i| i.first_number).unwrap_or(1) } /// Returns number of lines to read from input for constructing one page of pr output. diff --git a/tests/test_pr.rs b/tests/test_pr.rs index 7b8c77d34..00d602b55 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -2,25 +2,29 @@ extern crate chrono; use common::util::*; use std::fs::metadata; -use test_pr::chrono::DateTime; use test_pr::chrono::offset::Local; +use test_pr::chrono::DateTime; fn file_last_modified_time(ucmd: &UCommand, path: &str) -> String { let tmp_dir_path = ucmd.get_full_fixture_path(path); let file_metadata = metadata(tmp_dir_path); - return file_metadata.map(|i| { - return i.modified().map(|x| { - let datetime: DateTime = x.into(); - datetime.format("%b %d %H:%M %Y").to_string() - }).unwrap_or(String::new()); - }).unwrap_or(String::new()); + return file_metadata + .map(|i| { + return i + .modified() + .map(|x| { + let datetime: DateTime = x.into(); + datetime.format("%b %d %H:%M %Y").to_string() + }) + .unwrap_or(String::new()); + }) + .unwrap_or(String::new()); } fn now_time() -> String { Local::now().format("%b %d %H:%M %Y").to_string() } - #[test] fn test_without_any_options() { let test_file_path = "test_one_page.log"; @@ -30,7 +34,10 @@ fn test_without_any_options() { scenario .args(&[test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![(&"{last_modified_time}".to_string(), &value)]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] @@ -42,7 +49,10 @@ fn test_with_numbering_option() { scenario .args(&["-n", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![(&"{last_modified_time}".to_string(), &value)]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] @@ -54,7 +64,10 @@ fn test_with_numbering_option_when_content_is_less_than_page() { scenario .args(&["-n", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![(&"{last_modified_time}".to_string(), &value)]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] @@ -66,7 +79,10 @@ fn test_with_numbering_option_with_number_width() { scenario .args(&["-n", "2", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![(&"{last_modified_time}".to_string(), &value)]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] @@ -79,10 +95,13 @@ fn test_with_header_option() { scenario .args(&["-h", header, test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![ - (&"{last_modified_time}".to_string(), &value), - (&"{header}".to_string(), &header.to_string()) - ]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![ + (&"{last_modified_time}".to_string(), &value), + (&"{header}".to_string(), &header.to_string()), + ], + ); } #[test] @@ -95,10 +114,13 @@ fn test_with_long_header_option() { scenario .args(&["--header=new file", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![ - (&"{last_modified_time}".to_string(), &value), - (&"{header}".to_string(), &header.to_string()) - ]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![ + (&"{last_modified_time}".to_string(), &value), + (&"{header}".to_string(), &header.to_string()), + ], + ); } #[test] @@ -110,9 +132,10 @@ fn test_with_double_space_option() { scenario .args(&["-d", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![ - (&"{last_modified_time}".to_string(), &value), - ]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] @@ -124,9 +147,10 @@ fn test_with_long_double_space_option() { scenario .args(&["--double-space", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![ - (&"{last_modified_time}".to_string(), &value), - ]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] @@ -138,9 +162,10 @@ fn test_with_first_line_number_option() { scenario .args(&["-N", "5", "-n", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![ - (&"{last_modified_time}".to_string(), &value), - ]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] @@ -152,9 +177,10 @@ fn test_with_first_line_number_long_option() { scenario .args(&["--first-line-number=5", "-n", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![ - (&"{last_modified_time}".to_string(), &value), - ]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] @@ -166,9 +192,10 @@ fn test_with_number_option_with_custom_separator_char() { scenario .args(&["-nc", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![ - (&"{last_modified_time}".to_string(), &value), - ]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] @@ -180,9 +207,10 @@ fn test_with_number_option_with_custom_separator_char_and_width() { scenario .args(&["-nc1", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![ - (&"{last_modified_time}".to_string(), &value), - ]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] @@ -197,9 +225,7 @@ fn test_with_valid_page_ranges() { new_ucmd!() .args(&["--pages=1:5", test_file_path]) .succeeds(); - new_ucmd!() - .args(&["--pages=1", test_file_path]) - .succeeds(); + new_ucmd!().args(&["--pages=1", test_file_path]).succeeds(); new_ucmd!() .args(&["--pages=-1:5", test_file_path]) .fails() @@ -227,15 +253,17 @@ fn test_with_page_range() { scenario .args(&["--pages=15", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![ - (&"{last_modified_time}".to_string(), &value), - ]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); new_ucmd!() .args(&["--pages=15:17", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path1, vec![ - (&"{last_modified_time}".to_string(), &value), - ]); + .stdout_is_templated_fixture( + expected_test_file_path1, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] @@ -259,9 +287,10 @@ fn test_with_page_length_option() { scenario .args(&["--pages=2:3", "-l", "100", "-n", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![ - (&"{last_modified_time}".to_string(), &value), - ]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); new_ucmd!() .args(&["--pages=2:3", "-l", "5", "-n", test_file_path]) @@ -288,9 +317,10 @@ fn test_with_stdin() { .pipe_in_fixture("stdin.log") .args(&["--pages=1:2", "-n", "-"]) .run() - .stdout_is_templated_fixture(expected_file_path, vec![ - (&"{last_modified_time}".to_string(), &now_time()), - ]); + .stdout_is_templated_fixture( + expected_file_path, + vec![(&"{last_modified_time}".to_string(), &now_time())], + ); } #[test] @@ -302,9 +332,10 @@ fn test_with_column() { scenario .args(&["--pages=3:5", "--column=3", "-n", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![ - (&"{last_modified_time}".to_string(), &value), - ]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] @@ -316,9 +347,10 @@ fn test_with_column_across_option() { scenario .args(&["--pages=3:5", "--column=3", "-a", "-n", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![ - (&"{last_modified_time}".to_string(), &value), - ]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] @@ -328,11 +360,19 @@ fn test_with_column_across_option_and_column_separator() { let mut scenario = new_ucmd!(); let value = file_last_modified_time(&scenario, test_file_path); scenario - .args(&["--pages=3:5", "--column=3", "-s|", "-a", "-n", test_file_path]) + .args(&[ + "--pages=3:5", + "--column=3", + "-s|", + "-a", + "-n", + test_file_path, + ]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![ - (&"{last_modified_time}".to_string(), &value), - ]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] @@ -345,23 +385,35 @@ fn test_with_mpr() { new_ucmd!() .args(&["--pages=1:2", "-m", "-n", test_file_path, test_file_path1]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![ - (&"{last_modified_time}".to_string(), &now_time()), - ]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &now_time())], + ); new_ucmd!() .args(&["--pages=2:4", "-m", "-n", test_file_path, test_file_path1]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path1, vec![ - (&"{last_modified_time}".to_string(), &now_time()), - ]); + .stdout_is_templated_fixture( + expected_test_file_path1, + vec![(&"{last_modified_time}".to_string(), &now_time())], + ); new_ucmd!() - .args(&["--pages=1:2", "-l", "100", "-n", "-m", test_file_path, test_file_path1, test_file_path]) + .args(&[ + "--pages=1:2", + "-l", + "100", + "-n", + "-m", + test_file_path, + test_file_path1, + test_file_path, + ]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path2, vec![ - (&"{last_modified_time}".to_string(), &now_time()), - ]); + .stdout_is_templated_fixture( + expected_test_file_path2, + vec![(&"{last_modified_time}".to_string(), &now_time())], + ); } #[test] @@ -380,7 +432,6 @@ fn test_with_mpr_and_column_options() { .stdout_is(""); } - #[test] fn test_with_offset_space_option() { let test_file_path = "column.log"; @@ -388,9 +439,18 @@ fn test_with_offset_space_option() { let mut scenario = new_ucmd!(); let value = file_last_modified_time(&scenario, test_file_path); scenario - .args(&["-o", "5", "--pages=3:5", "--column=3", "-a", "-n", test_file_path]) + .args(&[ + "-o", + "5", + "--pages=3:5", + "--column=3", + "-a", + "-n", + test_file_path, + ]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![ - (&"{last_modified_time}".to_string(), &value), - ]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } From 847046f3deabe69d0111b531e89f89a2ceca21ba Mon Sep 17 00:00:00 2001 From: Tilak Patidar Date: Sun, 30 Dec 2018 12:08:30 +0530 Subject: [PATCH 0159/1135] pr: add +page and -column --- src/pr/Cargo.toml | 1 + src/pr/pr.rs | 71 +++++++++++++++++++++++++++++++++++++++++------ tests/test_pr.rs | 17 ++++++++++++ 3 files changed, 81 insertions(+), 8 deletions(-) diff --git a/src/pr/Cargo.toml b/src/pr/Cargo.toml index d33681b5f..481404b3a 100644 --- a/src/pr/Cargo.toml +++ b/src/pr/Cargo.toml @@ -14,6 +14,7 @@ time = "0.1.40" chrono = "0.4.6" quick-error = "1.2.2" itertools = "0.7.8" +regex = "1.0.1" [dependencies.uucore] path = "../uucore" diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 87aadf80c..297d9637d 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -13,6 +13,7 @@ extern crate quick_error; extern crate chrono; extern crate getopts; extern crate itertools; +extern crate regex; extern crate uucore; use chrono::offset::Local; @@ -22,6 +23,7 @@ use getopts::{Matches, Options}; use itertools::structs::KMergeBy; use itertools::{GroupBy, Itertools}; use quick_error::ResultExt; +use regex::Regex; use std::convert::From; use std::fs::{metadata, File, Metadata}; use std::io::{stderr, stdin, stdout, BufRead, BufReader, Lines, Read, Stdin, Stdout, Write}; @@ -322,7 +324,11 @@ pub fn uumain(args: Vec) -> i32 { opts.optflag("", "help", "display this help and exit"); opts.optflag("V", "version", "output version information and exit"); - let matches = match opts.parse(&args[1..]) { + // Remove -column option as getopts cannot parse things like -3 etc + let re = Regex::new(r"^-\d+").unwrap(); + let opt_args: Vec<&String> = args.iter().filter(|i| !re.is_match(i)).collect(); + + let matches = match opts.parse(&opt_args[1..]) { Ok(m) => m, Err(e) => panic!("Invalid options\n{}", e), }; @@ -332,7 +338,14 @@ pub fn uumain(args: Vec) -> i32 { return 0; } - let mut files: Vec = matches.free.clone(); + let mut files: Vec = matches + .free + .clone() + .iter() + .filter(|i| !i.starts_with('+') && !i.starts_with('-')) + .map(|i| i.to_string()) + .collect(); + // -n value is optional if -n is given the opts gets confused // if -n is used just before file path it might be captured as value of -n if matches.opt_str(NUMBERING_MODE_OPTION).is_some() { @@ -360,7 +373,8 @@ pub fn uumain(args: Vec) -> i32 { }; for file_group in file_groups { - let result_options: Result = build_options(&matches, &file_group); + let result_options: Result = + build_options(&matches, &file_group, args.join(" ")); if result_options.is_err() { print_error(&matches, result_options.err().unwrap()); return 1; @@ -427,6 +441,11 @@ fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { that do not fit into a text column are truncated. Lines are not truncated under single column output."; println!("{}", opts.usage(usage)); + println!(" +page \t\tBegin output at page number page of the formatted input."); + println!( + " -column \t\tProduce multi-column output. Refer --{}", + COLUMN_OPTION + ); if matches.free.is_empty() { return 1; } @@ -447,7 +466,11 @@ fn parse_usize(matches: &Matches, opt: &str) -> Option> { .map(from_parse_error_to_pr_error) } -fn build_options(matches: &Matches, paths: &Vec) -> Result { +fn build_options( + matches: &Matches, + paths: &Vec, + free_args: String, +) -> Result { let invalid_pages_map = |i: String| { let unparsed_value: String = matches.opt_str(PAGE_RANGE_OPTION).unwrap(); i.parse::().map_err(|_e| { @@ -547,6 +570,19 @@ fn build_options(matches: &Matches, paths: &Vec) -> Result().map_err(|_e| { + PrError::EncounteredErrors(format!("invalid {} argument '{}'", "+", unparsed_num)) + }) + }) { + Some(res) => res?, + _ => 1, + }; + let start_page: usize = match matches .opt_str(PAGE_RANGE_OPTION) .map(|i| { @@ -556,7 +592,7 @@ fn build_options(matches: &Matches, paths: &Vec) -> Result res?, - _ => 1, + _ => start_page_in_plus_option, }; let end_page: Option = match matches @@ -608,9 +644,28 @@ fn build_options(matches: &Matches, paths: &Vec) -> Result = match parse_usize(matches, COLUMN_OPTION) { - Some(res) => Some(ColumnModeOptions { - columns: res?, + let re_col = Regex::new(r"\s*-(\d+)\s*").unwrap(); + + let start_column_option: Option = match re_col.captures(&free_args).map(|i| { + let unparsed_num = i.get(1).unwrap().as_str().trim(); + unparsed_num.parse::().map_err(|_e| { + PrError::EncounteredErrors(format!("invalid {} argument '{}'", "-", unparsed_num)) + }) + }) { + Some(res) => Some(res?), + _ => None, + }; + + // --column has more priority than -column + + let column_option_value: Option = match parse_usize(matches, COLUMN_OPTION) { + Some(res) => Some(res?), + _ => start_column_option, + }; + + let column_mode_options: Option = match column_option_value { + Some(columns) => Some(ColumnModeOptions { + columns, width: column_width, column_separator, across_mode, diff --git a/tests/test_pr.rs b/tests/test_pr.rs index 00d602b55..d02b42436 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -257,6 +257,15 @@ fn test_with_page_range() { expected_test_file_path, vec![(&"{last_modified_time}".to_string(), &value)], ); + + new_ucmd!() + .args(&["+15", test_file_path]) + .succeeds() + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); + new_ucmd!() .args(&["--pages=15:17", test_file_path]) .succeeds() @@ -336,6 +345,14 @@ fn test_with_column() { expected_test_file_path, vec![(&"{last_modified_time}".to_string(), &value)], ); + + new_ucmd!() + .args(&["--pages=3:5", "-3", "-n", test_file_path]) + .succeeds() + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] From 87227addc162921b74b001b53d24f27682b3ba7b Mon Sep 17 00:00:00 2001 From: Tilak Patidar Date: Sun, 30 Dec 2018 20:42:48 +0530 Subject: [PATCH 0160/1135] pr: fix printing form feed --- src/pr/pr.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 297d9637d..799507018 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -62,6 +62,7 @@ static READ_BUFFER_SIZE: usize = 1024 * 64; static DEFAULT_COLUMN_WIDTH: usize = 72; static DEFAULT_COLUMN_SEPARATOR: &char = &TAB; static BLANK_STRING: &str = ""; +static FF: u8 = 0x0C as u8; struct OutputOptions { /// Line numbering mode @@ -630,10 +631,12 @@ fn build_options( page_length - (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE) }; - let page_separator_char: String = matches - .opt_str(FORM_FEED_OPTION) - .map(|_i| '\u{000A}'.to_string()) - .unwrap_or(NEW_LINE.to_string()); + let page_separator_char: String = if matches.opt_present(FORM_FEED_OPTION) { + let bytes = vec![FF]; + String::from_utf8(bytes).unwrap() + } else { + NEW_LINE.to_string() + }; let column_width: usize = parse_usize(matches, COLUMN_WIDTH_OPTION).unwrap_or(Ok(DEFAULT_COLUMN_WIDTH))?; From 8f9b3228978b73f9963c495edeee1fa10f5865e6 Mon Sep 17 00:00:00 2001 From: Tilak Patidar Date: Sun, 30 Dec 2018 21:05:24 +0530 Subject: [PATCH 0161/1135] pr: fix file not found in pr and mpr --- src/pr/pr.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 799507018..b799f8938 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -735,7 +735,7 @@ fn pr(path: &String, options: &OutputOptions) -> Result { usize, Map>>>, _>, _>, _>, _>, _, - > = BufReader::with_capacity(READ_BUFFER_SIZE, open(path).unwrap()) + > = BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?) .lines() .enumerate() .map(|i: (usize, Result)| FileLine { @@ -790,6 +790,11 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { let last_page: Option<&usize> = options.end_page.as_ref(); let start_line_index_of_start_page = (start_page - 1) * lines_needed_per_page; + // Check if files exists + for path in paths { + open(path)?; + } + let file_line_groups: GroupBy< usize, KMergeBy< From 3be5dc69235c58acdd7e8a1e66564d7b58264586 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Fri, 4 Jan 2019 22:34:29 +0530 Subject: [PATCH 0162/1135] pr: fix form feed pr: fix form feed pr: Rustfmt pr: add test for ff and -l option --- src/pr/pr.rs | 229 +++++++++++++++++++------- tests/fixtures/pr/0F | 330 ++++++++++++++++++++++++++++++++++++++ tests/fixtures/pr/0Fnt | 36 +++++ tests/fixtures/pr/0Ft | 35 ++++ tests/fixtures/pr/3-0F | 198 +++++++++++++++++++++++ tests/fixtures/pr/3a3f-0F | 21 +++ tests/fixtures/pr/3f-0F | 86 ++++++++++ tests/fixtures/pr/FnFn | 68 ++++++++ tests/fixtures/pr/a3-0F | 330 ++++++++++++++++++++++++++++++++++++++ tests/fixtures/pr/a3f-0F | 35 ++++ tests/fixtures/pr/l24-FF | 216 +++++++++++++++++++++++++ tests/test_pr.rs | 46 ++++++ 12 files changed, 1573 insertions(+), 57 deletions(-) create mode 100644 tests/fixtures/pr/0F create mode 100644 tests/fixtures/pr/0Fnt create mode 100644 tests/fixtures/pr/0Ft create mode 100644 tests/fixtures/pr/3-0F create mode 100644 tests/fixtures/pr/3a3f-0F create mode 100644 tests/fixtures/pr/3f-0F create mode 100644 tests/fixtures/pr/FnFn create mode 100644 tests/fixtures/pr/a3-0F create mode 100644 tests/fixtures/pr/a3f-0F create mode 100644 tests/fixtures/pr/l24-FF diff --git a/src/pr/pr.rs b/src/pr/pr.rs index b799f8938..6617f0bb1 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -27,6 +27,7 @@ use regex::Regex; use std::convert::From; use std::fs::{metadata, File, Metadata}; use std::io::{stderr, stdin, stdout, BufRead, BufReader, Lines, Read, Stdin, Stdout, Write}; +use std::iter::FlatMap; use std::iter::{Enumerate, Map, SkipWhile, TakeWhile}; use std::num::ParseIntError; #[cfg(unix)] @@ -51,6 +52,7 @@ static NO_HEADER_TRAILER_OPTION: &str = "t"; static PAGE_LENGTH_OPTION: &str = "l"; static SUPPRESS_PRINTING_ERROR: &str = "r"; static FORM_FEED_OPTION: &str = "F"; +static FORM_FEED_OPTION_SMALL: &str = "f"; static COLUMN_WIDTH_OPTION: &str = "w"; static ACROSS_OPTION: &str = "a"; static COLUMN_OPTION: &str = "column"; @@ -81,6 +83,7 @@ struct OutputOptions { column_mode_options: Option, merge_files_print: Option, offset_spaces: usize, + form_feed_used: bool, } struct FileLine { @@ -89,6 +92,7 @@ struct FileLine { page_number: usize, group_key: usize, line_content: Result, + form_feeds_after: usize, } impl AsRef for FileLine { @@ -127,6 +131,19 @@ impl Default for NumberingMode { } } +impl Default for FileLine { + fn default() -> FileLine { + FileLine { + file_id: 0, + line_number: 0, + page_number: 0, + group_key: 0, + line_content: Ok(BLANK_STRING.to_string()), + form_feeds_after: 0, + } + } +} + impl From for PrError { fn from(err: IOError) -> Self { PrError::EncounteredErrors(err.to_string()) @@ -255,6 +272,15 @@ pub fn uumain(args: Vec) -> i32 { HasArg::No, Occur::Optional, ); + opts.opt( + FORM_FEED_OPTION_SMALL, + "form-feed", + "Same as -F but pause before beginning the first page if standard output is a + terminal.", + "", + HasArg::No, + Occur::Optional, + ); opts.opt( "", @@ -572,7 +598,6 @@ fn build_options( }; // +page option is less priority than --pages - let flags = &matches.free.join(" "); let re = Regex::new(r"\s*\+(\d+)\s*").unwrap(); let start_page_in_plus_option: usize = match re.captures(&free_args).map(|i| { let unparsed_num = i.get(1).unwrap().as_str().trim(); @@ -677,7 +702,8 @@ fn build_options( }; let offset_spaces: usize = parse_usize(matches, OFFSET_SPACES_OPTION).unwrap_or(Ok(0))?; - + let form_feed_used = + matches.opt_present(FORM_FEED_OPTION) || matches.opt_present(FORM_FEED_OPTION_SMALL); Ok(OutputOptions { number: numbering_options, header, @@ -694,6 +720,7 @@ fn build_options( column_mode_options, merge_files_print, offset_spaces, + form_feed_used, }) } @@ -730,53 +757,117 @@ fn pr(path: &String, options: &OutputOptions) -> Result { let start_line_number: usize = get_start_line_number(options); let last_page: Option<&usize> = options.end_page.as_ref(); let lines_needed_per_page: usize = lines_to_read_for_page(options); - let start_line_index_of_start_page = (start_page - 1) * lines_needed_per_page; - let file_line_groups: GroupBy< - usize, - Map>>>, _>, _>, _>, _>, - _, - > = BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?) - .lines() - .enumerate() - .map(|i: (usize, Result)| FileLine { - file_id: 0, - line_number: i.0, - line_content: i.1, - page_number: 0, - group_key: 0, - }) - .skip_while(|file_line: &FileLine| { - // Skip the initial lines if not in page range - file_line.line_number < (start_line_index_of_start_page) - }) - .take_while(|file_line: &FileLine| { - // Only read the file until provided last page reached - last_page - .map(|lp| file_line.line_number < ((*lp) * lines_needed_per_page)) - .unwrap_or(true) - }) - .map(|file_line: FileLine| { - let page_number = - ((file_line.line_number + 1) as f64 / lines_needed_per_page as f64).ceil() as usize; - FileLine { - line_number: file_line.line_number + start_line_number, - page_number, - group_key: page_number, - ..file_line - } - }) // get display line number with line content - .group_by(|file_line: &FileLine| file_line.group_key); + let is_form_feed_used = options.form_feed_used; + let lines: Map>>, _>, _, _>>, _>, _> = + BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?) + .lines() + .map(|file_content: Result| { + file_content + .map(|content| { + let mut lines: Vec = Vec::new(); + let mut f_occurred: usize = 0; + let mut chunk: Vec = Vec::new(); + for byte in content.as_bytes() { + if byte == &FF { + f_occurred += 1; + } else { + if f_occurred != 0 { + // First time byte occurred in the scan + lines.push(FileLine { + line_content: Ok(String::from_utf8(chunk.clone()).unwrap()), + form_feeds_after: f_occurred, + ..FileLine::default() + }); + chunk.clear(); + } + chunk.push(*byte); + f_occurred = 0; + } + } - for (page_number, file_line_group) in file_line_groups.into_iter() { - let mut lines: Vec = Vec::new(); - for file_line in file_line_group { - if file_line.line_content.is_err() { - return Err(file_line.line_content.unwrap_err().into()); - } - lines.push(file_line); + // First time byte occurred in the scan + lines.push(FileLine { + line_content: Ok(String::from_utf8(chunk.clone()).unwrap()), + form_feeds_after: f_occurred, + ..FileLine::default() + }); + + lines + }) + .unwrap_or_else(|e| { + vec![FileLine { + line_content: Err(e), + ..FileLine::default() + }] + }) + }) + .flat_map(|i| i) + .enumerate() + .map(|i: (usize, FileLine)| FileLine { + line_number: i.0, + ..i.1 + }) + .map(|file_line: FileLine| FileLine { + line_number: file_line.line_number + start_line_number, + ..file_line + }); // get display line number with line content + + let mut page_number = 1; + let mut page_lines: Vec = Vec::new(); + let mut feed_line_present = false; + for file_line in lines { + if file_line.line_content.is_err() { + return Err(file_line.line_content.unwrap_err().into()); + } + + feed_line_present = is_form_feed_used; + + if page_lines.len() == lines_needed_per_page || file_line.form_feeds_after > 0 { + if file_line.form_feeds_after > 1 { + print_page( + &page_lines, + options, + &page_number, + &start_page, + &last_page, + feed_line_present, + )?; + page_lines.clear(); + page_number += 1; + print_page( + &page_lines, + options, + &page_number, + &start_page, + &last_page, + feed_line_present, + )?; + page_number += 1; + } else { + print_page( + &page_lines, + options, + &page_number, + &start_page, + &last_page, + feed_line_present, + )?; + page_number += 1; + } + page_lines.clear(); + } + if file_line.form_feeds_after == 0 { + page_lines.push(file_line); } - print_page(&lines, options, &page_number)?; } + print_page( + &page_lines, + options, + &page_number, + &start_page, + &last_page, + feed_line_present, + )?; return Ok(0); } @@ -814,8 +905,7 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { file_id: indexed_path.0, line_number: i.0, line_content: i.1, - page_number: 0, - group_key: 0, + ..FileLine::default() }) .skip_while(move |file_line: &FileLine| { // Skip the initial lines if not in page range @@ -859,7 +949,14 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { let new_page_number = file_line.page_number; if page_counter != new_page_number { fill_missing_lines(&mut lines, lines_needed_per_page, &nfiles, page_counter); - print_page(&lines, options, &page_counter)?; + print_page( + &lines, + options, + &page_counter, + &start_page, + &last_page, + false, + )?; lines = Vec::new(); } lines.push(file_line); @@ -868,7 +965,14 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { } fill_missing_lines(&mut lines, lines_needed_per_page, &nfiles, page_counter); - print_page(&lines, options, &page_counter)?; + print_page( + &lines, + options, + &page_counter, + &start_page, + &last_page, + false, + )?; return Ok(0); } @@ -904,7 +1008,7 @@ fn fill_missing_lines( line_number: line_number_counter, line_content: Ok("".to_string()), page_number, - group_key: 0, + ..FileLine::default() }, ); line_number_counter += 1; @@ -918,7 +1022,7 @@ fn fill_missing_lines( line_number: line_number_counter, line_content: Ok("".to_string()), page_number, - group_key: 0, + ..FileLine::default() }, ); } else { @@ -933,7 +1037,13 @@ fn print_page( lines: &Vec, options: &OutputOptions, page: &usize, + start_page: &usize, + last_page: &Option<&usize>, + feed_line_present: bool, ) -> Result { + if (last_page.is_some() && page > last_page.unwrap()) || page < start_page { + return Ok(0); + } let page_separator = options.page_separator_char.as_bytes(); let header: Vec = header_content(options, page); let trailer_content: Vec = trailer_content(options); @@ -946,8 +1056,7 @@ fn print_page( out.write(x.as_bytes())?; out.write(line_separator)?; } - - let lines_written = write_columns(lines, options, out)?; + let lines_written = write_columns(lines, options, out, feed_line_present)?; for index in 0..trailer_content.len() { let x: &String = trailer_content.get(index).unwrap(); @@ -965,6 +1074,7 @@ fn write_columns( lines: &Vec, options: &OutputOptions, out: &mut Stdout, + feed_line_present: bool, ) -> Result { let line_separator = options.content_line_separator.as_bytes(); let content_lines_per_page = if options.double_space { @@ -1031,12 +1141,13 @@ fn write_columns( }; let spaces = " ".repeat(*offset_spaces); - + let mut not_found_break = false; for fetch_index in fetch_indexes { let indexes = fetch_index.len(); for i in 0..indexes { let index: usize = fetch_index[i]; if lines.get(index).is_none() { + not_found_break = true; break; } let file_line: &FileLine = lines.get(index).unwrap(); @@ -1060,7 +1171,11 @@ fn write_columns( } lines_printed += 1; } - out.write(line_separator)?; + if not_found_break && feed_line_present { + break; + } else { + out.write(line_separator)?; + } } Ok(lines_printed) } @@ -1161,7 +1276,7 @@ fn current_time() -> String { } fn trailer_content(options: &OutputOptions) -> Vec { - if options.as_ref().display_trailer { + if options.as_ref().display_trailer && !options.form_feed_used { vec![ BLANK_STRING.to_string(), BLANK_STRING.to_string(), diff --git a/tests/fixtures/pr/0F b/tests/fixtures/pr/0F new file mode 100644 index 000000000..223765391 --- /dev/null +++ b/tests/fixtures/pr/0F @@ -0,0 +1,330 @@ + + +{last_modified_time} {file_name} Page 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 2 + + +1 FF-Test: FF's at Start of File V +2 Options -b -3 / -a -3 / ... +3 -------------------------------------------- +4 3456789 123456789 123456789 123456789 12345678 +5 3 Columns downwards ..., <= 5 lines per page +6 FF-Arangements: Empty Pages at start +7 \ftext; \f\ntext; +8 \f\ftext; \f\f\ntext; \f\n\ftext; \f\n\f\n; +9 3456789 123456789 123456789 +10 zzzzzzzzzzzzzzzzzzzzzzzzzz123456789 +1 12345678 +2 12345678 +3 line truncation before FF; r_r_o_l-test: +14 456789 123456789 123456789 123456789 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 4 + + +15 xyzxyzxyz XYZXYZXYZ abcabcab +16 456789 123456789 xyzxyzxyz XYZXYZXYZ +7 12345678 +8 12345678 +9 3456789 ab +20 DEFGHI 123 +1 12345678 +2 12345678 +3 12345678 +4 12345678 +5 12345678 +6 12345678 +27 no truncation before FF; (r_l-test): +28 no trunc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 5 + + +29 xyzxyzxyz XYZXYZXYZ abcabcab +30 456789 123456789 xyzxyzxyz XYZXYZXYZ +1 12345678 +2 3456789 abcdefghi +3 12345678 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/fixtures/pr/0Fnt b/tests/fixtures/pr/0Fnt new file mode 100644 index 000000000..9ba3a906c --- /dev/null +++ b/tests/fixtures/pr/0Fnt @@ -0,0 +1,36 @@ + +1 FF-Test: FF's at Start of File V +2 Options -b -3 / -a -3 / ... +3 -------------------------------------------- +4 3456789 123456789 123456789 123456789 12345678 +5 3 Columns downwards ..., <= 5 lines per page +6 FF-Arangements: Empty Pages at start +7 \ftext; \f\ntext; +8 \f\ftext; \f\f\ntext; \f\n\ftext; \f\n\f\n; +9 3456789 123456789 123456789 +10 zzzzzzzzzzzzzzzzzzzzzzzzzz123456789 +1 12345678 +2 12345678 +3 line truncation before FF; r_r_o_l-test: +14 456789 123456789 123456789 123456789 + +15 xyzxyzxyz XYZXYZXYZ abcabcab +16 456789 123456789 xyzxyzxyz XYZXYZXYZ +7 12345678 +8 12345678 +9 3456789 ab +20 DEFGHI 123 +1 12345678 +2 12345678 +3 12345678 +4 12345678 +5 12345678 +6 12345678 +27 no truncation before FF; (r_l-test): +28 no trunc + +29 xyzxyzxyz XYZXYZXYZ abcabcab +30 456789 123456789 xyzxyzxyz XYZXYZXYZ +1 12345678 +2 3456789 abcdefghi +3 12345678 diff --git a/tests/fixtures/pr/0Ft b/tests/fixtures/pr/0Ft new file mode 100644 index 000000000..bdd599d47 --- /dev/null +++ b/tests/fixtures/pr/0Ft @@ -0,0 +1,35 @@ + 1 FF-Test: FF's at Start of File V +2 Options -b -3 / -a -3 / ... +3 -------------------------------------------- +4 3456789 123456789 123456789 123456789 12345678 +5 3 Columns downwards ..., <= 5 lines per page +6 FF-Arangements: Empty Pages at start +7 \ftext; \f\ntext; +8 \f\ftext; \f\f\ntext; \f\n\ftext; \f\n\f\n; +9 3456789 123456789 123456789 +10 zzzzzzzzzzzzzzzzzzzzzzzzzz123456789 +1 12345678 +2 12345678 +3 line truncation before FF; r_r_o_l-test: +14 456789 123456789 123456789 123456789 + +15 xyzxyzxyz XYZXYZXYZ abcabcab +16 456789 123456789 xyzxyzxyz XYZXYZXYZ +7 12345678 +8 12345678 +9 3456789 ab +20 DEFGHI 123 +1 12345678 +2 12345678 +3 12345678 +4 12345678 +5 12345678 +6 12345678 +27 no truncation before FF; (r_l-test): +28 no trunc + +29 xyzxyzxyz XYZXYZXYZ abcabcab +30 456789 123456789 xyzxyzxyz XYZXYZXYZ +1 12345678 +2 3456789 abcdefghi +3 12345678 diff --git a/tests/fixtures/pr/3-0F b/tests/fixtures/pr/3-0F new file mode 100644 index 000000000..25a9db171 --- /dev/null +++ b/tests/fixtures/pr/3-0F @@ -0,0 +1,198 @@ + + +{last_modified_time} {file_name} Page 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 4 + + +15 xyzxyzxyz XYZXYZXYZ abcabcab +16 456789 123456789 xyzxyzxyz XYZXYZXYZ +7 12345678 +8 12345678 +9 3456789 ab +20 DEFGHI 123 +1 12345678 +2 12345678 +3 12345678 +4 12345678 +5 12345678 +6 12345678 +27 no truncation before FF; (r_l-test): +28 no trunc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 5 + + +29 xyzxyzxyz XYZXYZXYZ abcabcab +30 456789 123456789 xyzxyzxyz XYZXYZXYZ +1 12345678 +2 3456789 abcdefghi +3 12345678 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/fixtures/pr/3a3f-0F b/tests/fixtures/pr/3a3f-0F new file mode 100644 index 000000000..a2535574f --- /dev/null +++ b/tests/fixtures/pr/3a3f-0F @@ -0,0 +1,21 @@ + + +{last_modified_time} {file_name} Page 3 + + + + +{last_modified_time} {file_name} Page 4 + + +15 xyzxyzxyz XYZXYZXYZ 16 456789 123456789 xyz 7 +8 9 3456789 ab 20 DEFGHI 123 +1 2 3 +4 5 6 +27 no truncation before 28 no trunc + +{last_modified_time} {file_name} Page 5 + + +29 xyzxyzxyz XYZXYZXYZ 30 456789 123456789 xyz 1 +2 3456789 abcdefghi 3 \ No newline at end of file diff --git a/tests/fixtures/pr/3f-0F b/tests/fixtures/pr/3f-0F new file mode 100644 index 000000000..06e47aa66 --- /dev/null +++ b/tests/fixtures/pr/3f-0F @@ -0,0 +1,86 @@ + + +{last_modified_time} {file_name} Page 3 + + + + +{last_modified_time} {file_name} Page 4 + + +15 xyzxyzxyz XYZXYZXYZ abcabcab +16 456789 123456789 xyzxyzxyz XYZXYZXYZ +7 12345678 +8 12345678 +9 3456789 ab +20 DEFGHI 123 +1 12345678 +2 12345678 +3 12345678 +4 12345678 +5 12345678 +6 12345678 +27 no truncation before FF; (r_l-test): +28 no trunc + + +{last_modified_time} {file_name} Page 5 + + +29 xyzxyzxyz XYZXYZXYZ abcabcab +30 456789 123456789 xyzxyzxyz XYZXYZXYZ +1 12345678 +2 3456789 abcdefghi +3 12345678 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/fixtures/pr/FnFn b/tests/fixtures/pr/FnFn new file mode 100644 index 000000000..fa91abafc --- /dev/null +++ b/tests/fixtures/pr/FnFn @@ -0,0 +1,68 @@ +1 FF-Test: FF's in Text V +2 Options -b -3 / -a -3 / ... +3 -------------------------------------------- +4 3456789 123456789 123456789 123456789 12345678 +5 3 Columns downwards ..., <= 5 lines per page +6 FF-Arangements: One Empty Page +7 text\f\f\n; text\f\n\ftext; \f\ftext; +8 \f\f\n; \f\n\f\n; +9 +10 zzzzzzzzzzzzzzzzzzzzzzzzzz123456789 +1 12345678 +2 12345678 +3 line truncation before FF; r_r_o_l-test: +14 456789 123456789 123456789 123456789 + + +15 xyzxyzxyz XYZXYZXYZ abcabcab +16 456789 123456789 xyzxyzxyz XYZXYZXYZ +7 12345678 +8 12345678 +9 3456789 ab +20 DEFGHI 123 +1 12345678 +2 12345678 +3 12345678 +4 12345678 +5 12345678 +6 12345678 +27 no truncation before FF; (r_l-test): +28 no trunc + + +29 xyzxyzxyz XYZXYZXYZ abcabcab +30 456789 123456789 xyzxyzxyz XYZXYZXYZ +1 12345678 +2 3456789 abcdefghi +3 12345678 +4 12345678 +5 12345678 +6 12345678 +7 12345678 +8 12345678 +9 3456789 abcdefghi +40 DEFGHI 123456789 +41 yzxyzxyz XYZXYZXYZ abcabcab +42 456789 123456789 abcdefghi ABCDEDFHI + + + +43 xyzxyzxyz XYZXYZXYZ abcabcab +44 456789 123456789 xyzxyzxyz XYZXYZXYZ +5 12345678 +6 12345678 +7 12345678 +8 12345678 +9 12345678 +50 12345678 +1 12345678 +2 12345678 +3 12345678 +4 12345678 +55 yzxyzxyz XYZXYZXYZ abcabcab +56 456789 123456789 abcdefghi ABCDEDFHI + +57 xyzxyzxyz XYZXYZXYZ abcabcab +58 456789 123456789 xyzxyzxyz XYZXYZXYZ +9 12345678 +60 DEFGHI 123456789 diff --git a/tests/fixtures/pr/a3-0F b/tests/fixtures/pr/a3-0F new file mode 100644 index 000000000..8f0b06290 --- /dev/null +++ b/tests/fixtures/pr/a3-0F @@ -0,0 +1,330 @@ + + +{last_modified_time} {file_name} Page 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 2 + + +1 FF-Test: FF's at St 2 Options -b -3 / -a 3 ------------------- +4 3456789 123456789 123 5 3 Columns downwards 6 FF-Arangements: Emp +7 \ftext; \f\ntext; 8 \f\ftext; \f\f\ntex 9 3456789 123456789 123 +10 zzzzzzzzzzzzzzzzzzz 1 2 +3 line truncation befor 14 456789 123456789 123 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 4 + + +15 xyzxyzxyz XYZXYZXYZ 16 456789 123456789 xyz 7 +8 9 3456789 ab 20 DEFGHI 123 +1 2 3 +4 5 6 +27 no truncation before 28 no trunc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 5 + + +29 xyzxyzxyz XYZXYZXYZ 30 456789 123456789 xyz 1 +2 3456789 abcdefghi 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/fixtures/pr/a3f-0F b/tests/fixtures/pr/a3f-0F new file mode 100644 index 000000000..9da2bb439 --- /dev/null +++ b/tests/fixtures/pr/a3f-0F @@ -0,0 +1,35 @@ + + +{last_modified_time} {file_name} Page 1 + + + + +{last_modified_time} {file_name} Page 2 + + +1 FF-Test: FF's at St 2 Options -b -3 / -a 3 ------------------- +4 3456789 123456789 123 5 3 Columns downwards 6 FF-Arangements: Emp +7 \ftext; \f\ntext; 8 \f\ftext; \f\f\ntex 9 3456789 123456789 123 +10 zzzzzzzzzzzzzzzzzzz 1 2 +3 line truncation befor 14 456789 123456789 123 + +{last_modified_time} {file_name} Page 3 + + + + +{last_modified_time} {file_name} Page 4 + + +15 xyzxyzxyz XYZXYZXYZ 16 456789 123456789 xyz 7 +8 9 3456789 ab 20 DEFGHI 123 +1 2 3 +4 5 6 +27 no truncation before 28 no trunc + +{last_modified_time} {file_name} Page 5 + + +29 xyzxyzxyz XYZXYZXYZ 30 456789 123456789 xyz 1 +2 3456789 abcdefghi 3 \ No newline at end of file diff --git a/tests/fixtures/pr/l24-FF b/tests/fixtures/pr/l24-FF new file mode 100644 index 000000000..497d2f33a --- /dev/null +++ b/tests/fixtures/pr/l24-FF @@ -0,0 +1,216 @@ + + +{last_modified_time} {file_name} Page 1 + + +1 FF-Test: FF's in Text V +2 Options -b -3 / -a -3 / ... +3 -------------------------------------------- +4 3456789 123456789 123456789 123456789 12345678 +5 3 Columns downwards ..., <= 5 lines per page +6 FF-Arangements: One Empty Page +7 text\f\f\n; text\f\n\ftext; \f\ftext; +8 \f\f\n; \f\n\f\n; +9 +10 zzzzzzzzzzzzzzzzzzzzzzzzzz123456789 +1 12345678 +2 12345678 +3 line truncation before FF; r_r_o_l-test: +14 456789 123456789 123456789 123456789 + + + + + + + +{last_modified_time} {file_name} Page 2 + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 3 + + +15 xyzxyzxyz XYZXYZXYZ abcabcab +16 456789 123456789 xyzxyzxyz XYZXYZXYZ +7 12345678 +8 12345678 +9 3456789 ab +20 DEFGHI 123 +1 12345678 +2 12345678 +3 12345678 +4 12345678 +5 12345678 +6 12345678 +27 no truncation before FF; (r_l-test): +28 no trunc + + + + + + + +{last_modified_time} {file_name} Page 4 + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 5 + + +29 xyzxyzxyz XYZXYZXYZ abcabcab +30 456789 123456789 xyzxyzxyz XYZXYZXYZ +1 12345678 +2 3456789 abcdefghi +3 12345678 +4 12345678 +5 12345678 +6 12345678 +7 12345678 +8 12345678 +9 3456789 abcdefghi +40 DEFGHI 123456789 +41 yzxyzxyz XYZXYZXYZ abcabcab +42 456789 123456789 abcdefghi ABCDEDFHI + + + + + + + +{last_modified_time} {file_name} Page 6 + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 7 + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 8 + + +43 xyzxyzxyz XYZXYZXYZ abcabcab +44 456789 123456789 xyzxyzxyz XYZXYZXYZ +5 12345678 +6 12345678 +7 12345678 +8 12345678 +9 12345678 +50 12345678 +1 12345678 +2 12345678 +3 12345678 +4 12345678 +55 yzxyzxyz XYZXYZXYZ abcabcab +56 456789 123456789 abcdefghi ABCDEDFHI + + + + + + + +{last_modified_time} {file_name} Page 9 + + +57 xyzxyzxyz XYZXYZXYZ abcabcab +58 456789 123456789 xyzxyzxyz XYZXYZXYZ +9 12345678 +60 DEFGHI 123456789 + + + + + + + + + + + + + + + diff --git a/tests/test_pr.rs b/tests/test_pr.rs index d02b42436..af93d949f 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -471,3 +471,49 @@ fn test_with_offset_space_option() { vec![(&"{last_modified_time}".to_string(), &value)], ); } + +#[test] +fn test_with_pr_core_utils_tests() { + let test_cases = vec![ + ("", vec!["0Ft"], vec!["0F"], 0), + ("", vec!["0Fnt"], vec!["0F"], 0), + ("+3", vec!["0Ft"], vec!["3-0F"], 0), + ("+3 -f", vec!["0Ft"], vec!["3f-0F"], 0), + ("-a -3", vec!["0Ft"], vec!["a3-0F"], 0), + ("-a -3 -f", vec!["0Ft"], vec!["a3f-0F"], 0), + ("-a -3 -f", vec!["0Fnt"], vec!["a3f-0F"], 0), + ("+3 -a -3 -f", vec!["0Ft"], vec!["3a3f-0F"], 0), + ("-l 24", vec!["FnFn"], vec!["l24-FF"], 0), + ]; + + for test_case in test_cases { + let (flags, input_file, expected_file, return_code) = test_case; + let mut scenario = new_ucmd!(); + let input_file_path = input_file.get(0).unwrap(); + let test_file_path = expected_file.get(0).unwrap(); + let value = file_last_modified_time(&scenario, test_file_path); + let mut arguments: Vec<&str> = flags + .split(' ') + .into_iter() + .filter(|i| i.trim() != "") + .collect::>(); + + arguments.extend(input_file.clone()); + + let mut scenario_with_args = scenario.args(&arguments); + + let scenario_with_expected_status = if return_code == 0 { + scenario_with_args.succeeds() + } else { + scenario_with_args.fails() + }; + + scenario_with_expected_status.stdout_is_templated_fixture( + test_file_path, + vec![ + (&"{last_modified_time}".to_string(), &value), + (&"{file_name}".to_string(), &input_file_path.to_string()), + ], + ); + } +} From 4bf5b86cde2b8173b1b11cb82eb4014e8288e2f9 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Fri, 4 Jan 2019 23:14:04 +0530 Subject: [PATCH 0163/1135] pr: add last page option in +page --- src/pr/pr.rs | 21 ++++++++++++++++++--- tests/test_pr.rs | 8 ++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 6617f0bb1..2de3a663f 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -598,10 +598,11 @@ fn build_options( }; // +page option is less priority than --pages - let re = Regex::new(r"\s*\+(\d+)\s*").unwrap(); + let re = Regex::new(r"\s*\+(\d+:*\d*)\s*").unwrap(); let start_page_in_plus_option: usize = match re.captures(&free_args).map(|i| { let unparsed_num = i.get(1).unwrap().as_str().trim(); - unparsed_num.parse::().map_err(|_e| { + let x: Vec<&str> = unparsed_num.split(":").collect(); + x[0].to_string().parse::().map_err(|_e| { PrError::EncounteredErrors(format!("invalid {} argument '{}'", "+", unparsed_num)) }) }) { @@ -609,6 +610,20 @@ fn build_options( _ => 1, }; + let end_page_in_plus_option: Option = match re + .captures(&free_args) + .map(|i| i.get(1).unwrap().as_str().trim()) + .filter(|i| i.contains(":")) + .map(|unparsed_num| { + let x: Vec<&str> = unparsed_num.split(":").collect(); + x[1].to_string().parse::().map_err(|_e| { + PrError::EncounteredErrors(format!("invalid {} argument '{}'", "+", unparsed_num)) + }) + }) { + Some(res) => Some(res?), + _ => None, + }; + let start_page: usize = match matches .opt_str(PAGE_RANGE_OPTION) .map(|i| { @@ -631,7 +646,7 @@ fn build_options( .map(invalid_pages_map) { Some(res) => Some(res?), - _ => None, + _ => end_page_in_plus_option, }; if end_page.is_some() && start_page > end_page.unwrap() { diff --git a/tests/test_pr.rs b/tests/test_pr.rs index af93d949f..863486878 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -273,6 +273,14 @@ fn test_with_page_range() { expected_test_file_path1, vec![(&"{last_modified_time}".to_string(), &value)], ); + + new_ucmd!() + .args(&["+15:17", test_file_path]) + .succeeds() + .stdout_is_templated_fixture( + expected_test_file_path1, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] From a4b723233a26e51220d1c0287f4c31994b02f59b Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Sun, 6 Jan 2019 14:49:32 +0530 Subject: [PATCH 0164/1135] pr: add more tests for form feed and include page_width option W --- src/pr/pr.rs | 109 +++++++++++++------ tests/fixtures/pr/3a3f-0F | 3 +- tests/fixtures/pr/3f-0F | 52 +-------- tests/fixtures/pr/W20l24f-ll | 106 ++++++++++++++++++ tests/fixtures/pr/a3-0F | 6 +- tests/fixtures/pr/a3f-0F | 8 +- tests/fixtures/pr/l24-FF | 202 ++++++++++++++++++++++++++--------- tests/fixtures/pr/tFFt-ll | 56 ++++++++++ tests/test_pr.rs | 1 + 9 files changed, 400 insertions(+), 143 deletions(-) create mode 100644 tests/fixtures/pr/W20l24f-ll create mode 100644 tests/fixtures/pr/tFFt-ll diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 2de3a663f..f463a9890 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -54,6 +54,7 @@ static SUPPRESS_PRINTING_ERROR: &str = "r"; static FORM_FEED_OPTION: &str = "F"; static FORM_FEED_OPTION_SMALL: &str = "f"; static COLUMN_WIDTH_OPTION: &str = "w"; +static PAGE_WIDTH_OPTION: &str = "W"; static ACROSS_OPTION: &str = "a"; static COLUMN_OPTION: &str = "column"; static COLUMN_SEPARATOR_OPTION: &str = "s"; @@ -62,6 +63,7 @@ static OFFSET_SPACES_OPTION: &str = "o"; static FILE_STDIN: &str = "-"; static READ_BUFFER_SIZE: usize = 1024 * 64; static DEFAULT_COLUMN_WIDTH: usize = 72; +static DEFAULT_COLUMN_WIDTH_WITH_S_OPTION: usize = 512; static DEFAULT_COLUMN_SEPARATOR: &char = &TAB; static BLANK_STRING: &str = ""; static FF: u8 = 0x0C as u8; @@ -84,6 +86,7 @@ struct OutputOptions { merge_files_print: Option, offset_spaces: usize, form_feed_used: bool, + page_width: Option, } struct FileLine { @@ -247,9 +250,9 @@ pub fn uumain(args: Vec) -> i32 { opts.opt( PAGE_LENGTH_OPTION, "length", - "Override the 66-line default and reset the page length to lines. If lines is not greater than the sum of both + "Override the 66-line default (default number of lines of text 56, and with -F 63) and reset the page length to lines. If lines is not greater than the sum of both the header and trailer depths (in lines), the pr utility shall suppress both the header and trailer, as if the - -t option were in effect.", + -t option were in effect. ", "lines", HasArg::Yes, Occur::Optional, @@ -306,6 +309,17 @@ pub fn uumain(args: Vec) -> i32 { Occur::Optional, ); + opts.opt( + PAGE_WIDTH_OPTION, + "page-width", + "set page width to PAGE_WIDTH (72) characters always, + truncate lines, except -J option is set, no interference + with -S or -s", + "[width]", + HasArg::Yes, + Occur::Optional, + ); + opts.opt( ACROSS_OPTION, "across", @@ -498,6 +512,9 @@ fn build_options( paths: &Vec, free_args: String, ) -> Result { + let form_feed_used = + matches.opt_present(FORM_FEED_OPTION) || matches.opt_present(FORM_FEED_OPTION_SMALL); + let invalid_pages_map = |i: String| { let unparsed_value: String = matches.opt_str(PAGE_RANGE_OPTION).unwrap(); i.parse::().map_err(|_e| { @@ -657,8 +674,10 @@ fn build_options( ))); } + let default_lines_per_page = if form_feed_used { 63 } else { LINES_PER_PAGE }; + let page_length: usize = - parse_usize(matches, PAGE_LENGTH_OPTION).unwrap_or(Ok(LINES_PER_PAGE))?; + parse_usize(matches, PAGE_LENGTH_OPTION).unwrap_or(Ok(default_lines_per_page))?; let page_length_le_ht: bool = page_length < (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE); @@ -678,15 +697,27 @@ fn build_options( NEW_LINE.to_string() }; - let column_width: usize = - parse_usize(matches, COLUMN_WIDTH_OPTION).unwrap_or(Ok(DEFAULT_COLUMN_WIDTH))?; - let across_mode: bool = matches.opt_present(ACROSS_OPTION); let column_separator: String = matches .opt_str(COLUMN_SEPARATOR_OPTION) .unwrap_or(DEFAULT_COLUMN_SEPARATOR.to_string()); + let default_column_width = if matches.opt_present(COLUMN_WIDTH_OPTION) + && matches.opt_present(COLUMN_SEPARATOR_OPTION) + { + DEFAULT_COLUMN_WIDTH_WITH_S_OPTION + } else { + DEFAULT_COLUMN_WIDTH + }; + + let column_width: usize = + parse_usize(matches, COLUMN_WIDTH_OPTION).unwrap_or(Ok(default_column_width))?; + let page_width: Option = match parse_usize(matches, PAGE_WIDTH_OPTION) { + Some(res) => Some(res?), + None => None, + }; + let re_col = Regex::new(r"\s*-(\d+)\s*").unwrap(); let start_column_option: Option = match re_col.captures(&free_args).map(|i| { @@ -717,8 +748,6 @@ fn build_options( }; let offset_spaces: usize = parse_usize(matches, OFFSET_SPACES_OPTION).unwrap_or(Ok(0))?; - let form_feed_used = - matches.opt_present(FORM_FEED_OPTION) || matches.opt_present(FORM_FEED_OPTION_SMALL); Ok(OutputOptions { number: numbering_options, header, @@ -736,6 +765,7 @@ fn build_options( merge_files_print, offset_spaces, form_feed_used, + page_width, }) } @@ -834,11 +864,12 @@ fn pr(path: &String, options: &OutputOptions) -> Result { if file_line.line_content.is_err() { return Err(file_line.line_content.unwrap_err().into()); } - feed_line_present = is_form_feed_used; + let form_feeds_after: usize = file_line.form_feeds_after; + page_lines.push(file_line); - if page_lines.len() == lines_needed_per_page || file_line.form_feeds_after > 0 { - if file_line.form_feeds_after > 1 { + if page_lines.len() == lines_needed_per_page || form_feeds_after > 0 { + if form_feeds_after > 1 { print_page( &page_lines, options, @@ -849,15 +880,20 @@ fn pr(path: &String, options: &OutputOptions) -> Result { )?; page_lines.clear(); page_number += 1; - print_page( - &page_lines, - options, - &page_number, - &start_page, - &last_page, - feed_line_present, - )?; - page_number += 1; + + // insert empty pages + let empty_pages_required = form_feeds_after - 1; + for _i in 0..empty_pages_required { + print_page( + &page_lines, + options, + &page_number, + &start_page, + &last_page, + feed_line_present, + )?; + page_number += 1; + } } else { print_page( &page_lines, @@ -871,18 +907,17 @@ fn pr(path: &String, options: &OutputOptions) -> Result { } page_lines.clear(); } - if file_line.form_feeds_after == 0 { - page_lines.push(file_line); - } } - print_page( - &page_lines, - options, - &page_number, - &start_page, - &last_page, - feed_line_present, - )?; + if page_lines.len() != 0 { + print_page( + &page_lines, + options, + &page_number, + &start_page, + &last_page, + feed_line_present, + )?; + } return Ok(0); } @@ -1131,6 +1166,8 @@ fn write_columns( .unwrap_or(None), ); + let page_width: Option = options.page_width; + let across_mode = options .column_mode_options .as_ref() @@ -1178,6 +1215,7 @@ fn write_columns( is_number_mode, &options.merge_files_print, &i, + page_width ) ); out.write(trimmed_line.as_bytes())?; @@ -1204,6 +1242,7 @@ fn get_line_for_printing( is_number_mode: bool, merge_files_print: &Option, index: &usize, + page_width: Option, ) -> String { let should_show_line_number_merge_file = merge_files_print.is_none() || index == &usize::min_value(); @@ -1224,7 +1263,13 @@ fn get_line_for_printing( let display_length = complete_line.len() + (tab_count * 7); // TODO Adjust the width according to -n option // TODO actual len of the string vs display len of string because of tabs - col_width + + let width: Option = match col_width { + Some(x) => Some(x), + None => page_width, + }; + + width .map(|i| { let min_width = (i - (columns - 1)) / columns; if display_length < min_width { diff --git a/tests/fixtures/pr/3a3f-0F b/tests/fixtures/pr/3a3f-0F index a2535574f..6097374c7 100644 --- a/tests/fixtures/pr/3a3f-0F +++ b/tests/fixtures/pr/3a3f-0F @@ -12,7 +12,8 @@ 8 9 3456789 ab 20 DEFGHI 123 1 2 3 4 5 6 -27 no truncation before 28 no trunc +27 no truncation before 28 no trunc + {last_modified_time} {file_name} Page 5 diff --git a/tests/fixtures/pr/3f-0F b/tests/fixtures/pr/3f-0F index 06e47aa66..d32c1f8f6 100644 --- a/tests/fixtures/pr/3f-0F +++ b/tests/fixtures/pr/3f-0F @@ -22,6 +22,7 @@ 6 12345678 27 no truncation before FF; (r_l-test): 28 no trunc + {last_modified_time} {file_name} Page 5 @@ -32,55 +33,4 @@ 1 12345678 2 3456789 abcdefghi 3 12345678 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/fixtures/pr/W20l24f-ll b/tests/fixtures/pr/W20l24f-ll new file mode 100644 index 000000000..d95c04c37 --- /dev/null +++ b/tests/fixtures/pr/W20l24f-ll @@ -0,0 +1,106 @@ + + +{last_modified_time} {file_name} Page 1 + + +1<<< -Test: FF's in +2<<< -b -3 / -a -3 +3<<< >>> +4<<< 123456789 1234 + +6<<< -Arangements: +7<<< \f\f\n; text\f +8<<< f\f\n; \f\n\f\ +9<<< >>> +10<<< >>> +1<<< >>> +2<<< >>> +3<<< truncation bef +14<<< 123456789 123 + + +{last_modified_time} {file_name} Page 2 + + + + +{last_modified_time} {file_name} Page 3 + + +15<<< xyzxyzxyz XYZ +16<<< 123456789 xyz +7<<< >>> +8<<< >>> +9<<< >>> +20<<< >>> +1<<< >>> + + +4<<< >>> +5<<< >>> +6<<< >>> +27<<< truncation be +28<<< trunc + + +{last_modified_time} {file_name} Page 4 + + + + +{last_modified_time} {file_name} Page 5 + + +29<<>> +2<<< abcdefghi >>> +3<<< >>> +4<<< >>> +5<<< >>> +6<<< >>> +7<<< >>> +8<<< >>> +9<<< abcdefghi >>> +40<<< 123456789 >> +41<<< XYZXYZXYZ abc +42<<< 123456789 abc + + +{last_modified_time} {file_name} Page 6 + + + + +{last_modified_time} {file_name} Page 7 + + + + +{last_modified_time} {file_name} Page 8 + + +43<<< xyzxyzxyz XYZ +44<<< 123456789 xyz +5<<< >>> +6<<< >>> +7<<< >>> +8<<< >>> +9<<< >>> +50<<< >>> +1<<< >>> +2<<< >>> +3<<< >>> +4<<< >>> +55<<< XYZXYZXYZ abc +56<<< 123456789 abc + + +{last_modified_time} {file_name} Page 9 + + +57<<< xyzxyzxyz XYZ +58<<< 123456789 xyz +9<<< >>> +60<<< 123456789 >> + \ No newline at end of file diff --git a/tests/fixtures/pr/a3-0F b/tests/fixtures/pr/a3-0F index 8f0b06290..58aeb07c2 100644 --- a/tests/fixtures/pr/a3-0F +++ b/tests/fixtures/pr/a3-0F @@ -3,7 +3,7 @@ {last_modified_time} {file_name} Page 1 - + @@ -73,7 +73,7 @@ 4 3456789 123456789 123 5 3 Columns downwards 6 FF-Arangements: Emp 7 \ftext; \f\ntext; 8 \f\ftext; \f\f\ntex 9 3456789 123456789 123 10 zzzzzzzzzzzzzzzzzzz 1 2 -3 line truncation befor 14 456789 123456789 123 +3 line truncation befor 14 456789 123456789 123 @@ -205,7 +205,7 @@ 8 9 3456789 ab 20 DEFGHI 123 1 2 3 4 5 6 -27 no truncation before 28 no trunc +27 no truncation before 28 no trunc diff --git a/tests/fixtures/pr/a3f-0F b/tests/fixtures/pr/a3f-0F index 9da2bb439..24939c004 100644 --- a/tests/fixtures/pr/a3f-0F +++ b/tests/fixtures/pr/a3f-0F @@ -3,7 +3,7 @@ {last_modified_time} {file_name} Page 1 - + {last_modified_time} {file_name} Page 2 @@ -12,7 +12,8 @@ 4 3456789 123456789 123 5 3 Columns downwards 6 FF-Arangements: Emp 7 \ftext; \f\ntext; 8 \f\ftext; \f\f\ntex 9 3456789 123456789 123 10 zzzzzzzzzzzzzzzzzzz 1 2 -3 line truncation befor 14 456789 123456789 123 +3 line truncation befor 14 456789 123456789 123 + {last_modified_time} {file_name} Page 3 @@ -26,7 +27,8 @@ 8 9 3456789 ab 20 DEFGHI 123 1 2 3 4 5 6 -27 no truncation before 28 no trunc +27 no truncation before 28 no trunc + {last_modified_time} {file_name} Page 5 diff --git a/tests/fixtures/pr/l24-FF b/tests/fixtures/pr/l24-FF index 497d2f33a..de219b2fb 100644 --- a/tests/fixtures/pr/l24-FF +++ b/tests/fixtures/pr/l24-FF @@ -51,6 +51,30 @@ {last_modified_time} {file_name} Page 3 + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 4 + + 15 xyzxyzxyz XYZXYZXYZ abcabcab 16 456789 123456789 xyzxyzxyz XYZXYZXYZ 7 12345678 @@ -69,50 +93,26 @@ - - - -{last_modified_time} {file_name} Page 4 - - - - - - - - - - - - - - - - - - - - {last_modified_time} {file_name} Page 5 -29 xyzxyzxyz XYZXYZXYZ abcabcab -30 456789 123456789 xyzxyzxyz XYZXYZXYZ -1 12345678 -2 3456789 abcdefghi -3 12345678 -4 12345678 -5 12345678 -6 12345678 -7 12345678 -8 12345678 -9 3456789 abcdefghi -40 DEFGHI 123456789 -41 yzxyzxyz XYZXYZXYZ abcabcab -42 456789 123456789 abcdefghi ABCDEDFHI + + + + + + + + + + + + + + @@ -147,20 +147,20 @@ {last_modified_time} {file_name} Page 7 - - - - - - - - - - - - - - +29 xyzxyzxyz XYZXYZXYZ abcabcab +30 456789 123456789 xyzxyzxyz XYZXYZXYZ +1 12345678 +2 3456789 abcdefghi +3 12345678 +4 12345678 +5 12345678 +6 12345678 +7 12345678 +8 12345678 +9 3456789 abcdefghi +40 DEFGHI 123456789 +41 yzxyzxyz XYZXYZXYZ abcabcab +42 456789 123456789 abcdefghi ABCDEDFHI @@ -171,6 +171,78 @@ {last_modified_time} {file_name} Page 8 + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 9 + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 10 + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 11 + + 43 xyzxyzxyz XYZXYZXYZ abcabcab 44 456789 123456789 xyzxyzxyz XYZXYZXYZ 5 12345678 @@ -192,7 +264,31 @@ -{last_modified_time} {file_name} Page 9 +{last_modified_time} {file_name} Page 12 + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} {file_name} Page 13 57 xyzxyzxyz XYZXYZXYZ abcabcab diff --git a/tests/fixtures/pr/tFFt-ll b/tests/fixtures/pr/tFFt-ll new file mode 100644 index 000000000..39eca655f --- /dev/null +++ b/tests/fixtures/pr/tFFt-ll @@ -0,0 +1,56 @@ +1<<< -Test: FF's in Text >>> +2<<< -b -3 / -a -3 / ... >>> +3<<< >>> +4<<< 123456789 123456789 123456789 123456789 123456789 123456789 123456789 >>> + +6<<< -Arangements: One Empty Page >>> +7<<< \f\f\n; text\f\n\ftext; \f\ftext; >>> +8<<< f\f\n; \f\n\f\n; >>> +9<<< >>> +10<<< >>> +1<<< >>> +2<<< >>> +3<<< truncation before FF; r_r_o_l-test: >>> +14<<< 123456789 123456789 123456789 >>> 15<<< xyzxyzxyz XYZXYZXYZ abcabcab >>> +16<<< 123456789 xyzxyzxyz XYZXYZXYZ >>> +7<<< >>> +8<<< >>> +9<<< >>> +20<<< >>> +1<<< >>> + + +4<<< >>> +5<<< >>> +6<<< >>> +27<<< truncation before FF; (r_l-test): >>> +28<<< trunc 29<<>> +30<<< 123456789 xyzxyzxyz XYZXYZXYZ >>> +1<<< >>> +2<<< abcdefghi >>> +3<<< >>> +4<<< >>> +5<<< >>> +6<<< >>> +7<<< >>> +8<<< >>> +9<<< abcdefghi >>> +40<<< 123456789 >>> +41<<< XYZXYZXYZ abcabcab >>> +42<<< 123456789 abcdefghi ABCDEDFHI >>> 43<<< xyzxyzxyz XYZXYZXYZ abcabcab >>> +44<<< 123456789 xyzxyzxyz XYZXYZXYZ >>> +5<<< >>> +6<<< >>> +7<<< >>> +8<<< >>> +9<<< >>> +50<<< >>> +1<<< >>> +2<<< >>> +3<<< >>> +4<<< >>> +55<<< XYZXYZXYZ abcabcab >>> +56<<< 123456789 abcdefghi ABCDEDFHI >>> 57<<< xyzxyzxyz XYZXYZXYZ abcabcab >>> +58<<< 123456789 xyzxyzxyz XYZXYZXYZ >>> +9<<< >>> +60<<< 123456789 >>> diff --git a/tests/test_pr.rs b/tests/test_pr.rs index 863486878..1026b77a9 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -492,6 +492,7 @@ fn test_with_pr_core_utils_tests() { ("-a -3 -f", vec!["0Fnt"], vec!["a3f-0F"], 0), ("+3 -a -3 -f", vec!["0Ft"], vec!["3a3f-0F"], 0), ("-l 24", vec!["FnFn"], vec!["l24-FF"], 0), + ("-W 20 -l24 -f", vec!["tFFt-ll"], vec!["W20l24f-ll"], 0), ]; for test_case in test_cases { From 40e7f3d9009e8caaa42b3033a69177635f39d111 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Sun, 6 Jan 2019 16:12:23 +0530 Subject: [PATCH 0165/1135] pr: add -J and -S option pr: add -J option pr: add -S option --- src/pr/pr.rs | 105 +++++++--- .../pr/column_across_sep1.log.expected | 198 ++++++++++++++++++ tests/fixtures/pr/joined.log.expected | 132 ++++++++++++ tests/test_pr.rs | 31 +++ 4 files changed, 433 insertions(+), 33 deletions(-) create mode 100644 tests/fixtures/pr/column_across_sep1.log.expected create mode 100644 tests/fixtures/pr/joined.log.expected diff --git a/src/pr/pr.rs b/src/pr/pr.rs index f463a9890..f60d24a4c 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -57,9 +57,11 @@ static COLUMN_WIDTH_OPTION: &str = "w"; static PAGE_WIDTH_OPTION: &str = "W"; static ACROSS_OPTION: &str = "a"; static COLUMN_OPTION: &str = "column"; -static COLUMN_SEPARATOR_OPTION: &str = "s"; +static COLUMN_CHAR_SEPARATOR_OPTION: &str = "s"; +static COLUMN_STRING_SEPARATOR_OPTION: &str = "S"; static MERGE_FILES_PRINT: &str = "m"; static OFFSET_SPACES_OPTION: &str = "o"; +static JOIN_LINES_OPTION: &str = "J"; static FILE_STDIN: &str = "-"; static READ_BUFFER_SIZE: usize = 1024 * 64; static DEFAULT_COLUMN_WIDTH: usize = 72; @@ -87,6 +89,7 @@ struct OutputOptions { offset_spaces: usize, form_feed_used: bool, page_width: Option, + join_lines: bool, } struct FileLine { @@ -332,8 +335,8 @@ pub fn uumain(args: Vec) -> i32 { ); opts.opt( - COLUMN_SEPARATOR_OPTION, - "", + COLUMN_CHAR_SEPARATOR_OPTION, + "separator", "Separate text columns by the single character char instead of by the appropriate number of s (default for char is the character).", "char", @@ -341,6 +344,17 @@ pub fn uumain(args: Vec) -> i32 { Occur::Optional, ); + opts.opt( + COLUMN_STRING_SEPARATOR_OPTION, + "sep-string", + "separate columns by STRING, + without -S: Default separator with -J and + otherwise (same as -S\" \"), no effect on column options", + "string", + HasArg::Yes, + Occur::Optional, + ); + opts.opt( MERGE_FILES_PRINT, "merge", @@ -362,6 +376,16 @@ pub fn uumain(args: Vec) -> i32 { Occur::Optional, ); + opts.opt( + JOIN_LINES_OPTION, + "join-lines", + "merge full lines, turns off -W line truncation, no column + alignment, --sep-string[=STRING] sets separators", + "offset", + HasArg::No, + Occur::Optional, + ); + opts.optflag("", "help", "display this help and exit"); opts.optflag("V", "version", "output version information and exit"); @@ -648,10 +672,10 @@ fn build_options( x[0].to_string() }) .map(invalid_pages_map) - { - Some(res) => res?, - _ => start_page_in_plus_option, - }; + { + Some(res) => res?, + _ => start_page_in_plus_option, + }; let end_page: Option = match matches .opt_str(PAGE_RANGE_OPTION) @@ -661,10 +685,10 @@ fn build_options( x[1].to_string() }) .map(invalid_pages_map) - { - Some(res) => Some(res?), - _ => end_page_in_plus_option, - }; + { + Some(res) => Some(res?), + _ => end_page_in_plus_option, + }; if end_page.is_some() && start_page > end_page.unwrap() { return Err(PrError::EncounteredErrors(format!( @@ -699,12 +723,15 @@ fn build_options( let across_mode: bool = matches.opt_present(ACROSS_OPTION); - let column_separator: String = matches - .opt_str(COLUMN_SEPARATOR_OPTION) + let column_separator: String = match matches.opt_str(COLUMN_STRING_SEPARATOR_OPTION) + { + Some(x) => Some(x), + None => matches.opt_str(COLUMN_CHAR_SEPARATOR_OPTION), + } .unwrap_or(DEFAULT_COLUMN_SEPARATOR.to_string()); let default_column_width = if matches.opt_present(COLUMN_WIDTH_OPTION) - && matches.opt_present(COLUMN_SEPARATOR_OPTION) + && matches.opt_present(COLUMN_CHAR_SEPARATOR_OPTION) { DEFAULT_COLUMN_WIDTH_WITH_S_OPTION } else { @@ -713,9 +740,14 @@ fn build_options( let column_width: usize = parse_usize(matches, COLUMN_WIDTH_OPTION).unwrap_or(Ok(default_column_width))?; - let page_width: Option = match parse_usize(matches, PAGE_WIDTH_OPTION) { - Some(res) => Some(res?), - None => None, + + let page_width: Option = if matches.opt_present(JOIN_LINES_OPTION) { + None + } else { + match parse_usize(matches, PAGE_WIDTH_OPTION) { + Some(res) => Some(res?), + None => None, + } }; let re_col = Regex::new(r"\s*-(\d+)\s*").unwrap(); @@ -748,6 +780,8 @@ fn build_options( }; let offset_spaces: usize = parse_usize(matches, OFFSET_SPACES_OPTION).unwrap_or(Ok(0))?; + let join_lines: bool = matches.opt_present(JOIN_LINES_OPTION); + Ok(OutputOptions { number: numbering_options, header, @@ -766,6 +800,7 @@ fn build_options( offset_spaces, form_feed_used, page_width, + join_lines, }) } @@ -1133,7 +1168,7 @@ fn write_columns( options.content_lines_per_page }; - let width: usize = options.number.as_ref().map(|i| i.width).unwrap_or(0); + let number_width: usize = options.number.as_ref().map(|i| i.width).unwrap_or(0); let number_separator: String = options .number .as_ref() @@ -1168,6 +1203,18 @@ fn write_columns( let page_width: Option = options.page_width; + let line_width: Option = if options.join_lines { + None + } else if columns > 1 { + options + .column_mode_options + .as_ref() + .map(|i| Some(i.width)) + .unwrap_or(Some(DEFAULT_COLUMN_WIDTH)) + } else { + options.page_width + }; + let across_mode = options .column_mode_options .as_ref() @@ -1208,18 +1255,17 @@ fn write_columns( spaces, get_line_for_printing( file_line, - &width, + &number_width, &number_separator, columns, - col_width, is_number_mode, &options.merge_files_print, &i, - page_width + line_width, ) ); out.write(trimmed_line.as_bytes())?; - if (i + 1) != indexes { + if (i + 1) != indexes && !options.join_lines { out.write(col_sep.as_bytes())?; } lines_printed += 1; @@ -1235,20 +1281,19 @@ fn write_columns( fn get_line_for_printing( file_line: &FileLine, - width: &usize, + number_width: &usize, separator: &String, columns: usize, - col_width: Option, is_number_mode: bool, merge_files_print: &Option, index: &usize, - page_width: Option, + line_width: Option, ) -> String { let should_show_line_number_merge_file = merge_files_print.is_none() || index == &usize::min_value(); let should_show_line_number = is_number_mode && should_show_line_number_merge_file; let fmtd_line_number: String = if should_show_line_number { - get_fmtd_line_number(&width, file_line.line_number, &separator) + get_fmtd_line_number(&number_width, file_line.line_number, &separator) } else { "".to_string() }; @@ -1263,13 +1308,7 @@ fn get_line_for_printing( let display_length = complete_line.len() + (tab_count * 7); // TODO Adjust the width according to -n option // TODO actual len of the string vs display len of string because of tabs - - let width: Option = match col_width { - Some(x) => Some(x), - None => page_width, - }; - - width + line_width .map(|i| { let min_width = (i - (columns - 1)) / columns; if display_length < min_width { diff --git a/tests/fixtures/pr/column_across_sep1.log.expected b/tests/fixtures/pr/column_across_sep1.log.expected new file mode 100644 index 000000000..f9dd454d7 --- /dev/null +++ b/tests/fixtures/pr/column_across_sep1.log.expected @@ -0,0 +1,198 @@ + + +{last_modified_time} column.log Page 3 + + + 337 337 divide 338 338 divide 339 339 + 340 340 divide 341 341 divide 342 342 + 343 343 divide 344 344 divide 345 345 + 346 346 divide 347 347 divide 348 348 + 349 349 divide 350 350 divide 351 351 + 352 352 divide 353 353 divide 354 354 + 355 355 divide 356 356 divide 357 357 + 358 358 divide 359 359 divide 360 360 + 361 361 divide 362 362 divide 363 363 + 364 364 divide 365 365 divide 366 366 + 367 367 divide 368 368 divide 369 369 + 370 370 divide 371 371 divide 372 372 + 373 373 divide 374 374 divide 375 375 + 376 376 divide 377 377 divide 378 378 + 379 379 divide 380 380 divide 381 381 + 382 382 divide 383 383 divide 384 384 + 385 385 divide 386 386 divide 387 387 + 388 388 divide 389 389 divide 390 390 + 391 391 divide 392 392 divide 393 393 + 394 394 divide 395 395 divide 396 396 + 397 397 divide 398 398 divide 399 399 + 400 400 divide 401 401 divide 402 402 + 403 403 divide 404 404 divide 405 405 + 406 406 divide 407 407 divide 408 408 + 409 409 divide 410 410 divide 411 411 + 412 412 divide 413 413 divide 414 414 + 415 415 divide 416 416 divide 417 417 + 418 418 divide 419 419 divide 420 420 + 421 421 divide 422 422 divide 423 423 + 424 424 divide 425 425 divide 426 426 + 427 427 divide 428 428 divide 429 429 + 430 430 divide 431 431 divide 432 432 + 433 433 divide 434 434 divide 435 435 + 436 436 divide 437 437 divide 438 438 + 439 439 divide 440 440 divide 441 441 + 442 442 divide 443 443 divide 444 444 + 445 445 divide 446 446 divide 447 447 + 448 448 divide 449 449 divide 450 450 + 451 451 divide 452 452 divide 453 453 + 454 454 divide 455 455 divide 456 456 + 457 457 divide 458 458 divide 459 459 + 460 460 divide 461 461 divide 462 462 + 463 463 divide 464 464 divide 465 465 + 466 466 divide 467 467 divide 468 468 + 469 469 divide 470 470 divide 471 471 + 472 472 divide 473 473 divide 474 474 + 475 475 divide 476 476 divide 477 477 + 478 478 divide 479 479 divide 480 480 + 481 481 divide 482 482 divide 483 483 + 484 484 divide 485 485 divide 486 486 + 487 487 divide 488 488 divide 489 489 + 490 490 divide 491 491 divide 492 492 + 493 493 divide 494 494 divide 495 495 + 496 496 divide 497 497 divide 498 498 + 499 499 divide 500 500 divide 501 501 + 502 502 divide 503 503 divide 504 504 + + + + + + + +{last_modified_time} column.log Page 4 + + + 505 505 divide 506 506 divide 507 507 + 508 508 divide 509 509 divide 510 510 + 511 511 divide 512 512 divide 513 513 + 514 514 divide 515 515 divide 516 516 + 517 517 divide 518 518 divide 519 519 + 520 520 divide 521 521 divide 522 522 + 523 523 divide 524 524 divide 525 525 + 526 526 divide 527 527 divide 528 528 + 529 529 divide 530 530 divide 531 531 + 532 532 divide 533 533 divide 534 534 + 535 535 divide 536 536 divide 537 537 + 538 538 divide 539 539 divide 540 540 + 541 541 divide 542 542 divide 543 543 + 544 544 divide 545 545 divide 546 546 + 547 547 divide 548 548 divide 549 549 + 550 550 divide 551 551 divide 552 552 + 553 553 divide 554 554 divide 555 555 + 556 556 divide 557 557 divide 558 558 + 559 559 divide 560 560 divide 561 561 + 562 562 divide 563 563 divide 564 564 + 565 565 divide 566 566 divide 567 567 + 568 568 divide 569 569 divide 570 570 + 571 571 divide 572 572 divide 573 573 + 574 574 divide 575 575 divide 576 576 + 577 577 divide 578 578 divide 579 579 + 580 580 divide 581 581 divide 582 582 + 583 583 divide 584 584 divide 585 585 + 586 586 divide 587 587 divide 588 588 + 589 589 divide 590 590 divide 591 591 + 592 592 divide 593 593 divide 594 594 + 595 595 divide 596 596 divide 597 597 + 598 598 divide 599 599 divide 600 600 + 601 601 divide 602 602 divide 603 603 + 604 604 divide 605 605 divide 606 606 + 607 607 divide 608 608 divide 609 609 + 610 610 divide 611 611 divide 612 612 + 613 613 divide 614 614 divide 615 615 + 616 616 divide 617 617 divide 618 618 + 619 619 divide 620 620 divide 621 621 + 622 622 divide 623 623 divide 624 624 + 625 625 divide 626 626 divide 627 627 + 628 628 divide 629 629 divide 630 630 + 631 631 divide 632 632 divide 633 633 + 634 634 divide 635 635 divide 636 636 + 637 637 divide 638 638 divide 639 639 + 640 640 divide 641 641 divide 642 642 + 643 643 divide 644 644 divide 645 645 + 646 646 divide 647 647 divide 648 648 + 649 649 divide 650 650 divide 651 651 + 652 652 divide 653 653 divide 654 654 + 655 655 divide 656 656 divide 657 657 + 658 658 divide 659 659 divide 660 660 + 661 661 divide 662 662 divide 663 663 + 664 664 divide 665 665 divide 666 666 + 667 667 divide 668 668 divide 669 669 + 670 670 divide 671 671 divide 672 672 + + + + + + + +{last_modified_time} column.log Page 5 + + + 673 673 divide 674 674 divide 675 675 + 676 676 divide 677 677 divide 678 678 + 679 679 divide 680 680 divide 681 681 + 682 682 divide 683 683 divide 684 684 + 685 685 divide 686 686 divide 687 687 + 688 688 divide 689 689 divide 690 690 + 691 691 divide 692 692 divide 693 693 + 694 694 divide 695 695 divide 696 696 + 697 697 divide 698 698 divide 699 699 + 700 700 divide 701 701 divide 702 702 + 703 703 divide 704 704 divide 705 705 + 706 706 divide 707 707 divide 708 708 + 709 709 divide 710 710 divide 711 711 + 712 712 divide 713 713 divide 714 714 + 715 715 divide 716 716 divide 717 717 + 718 718 divide 719 719 divide 720 720 + 721 721 divide 722 722 divide 723 723 + 724 724 divide 725 725 divide 726 726 + 727 727 divide 728 728 divide 729 729 + 730 730 divide 731 731 divide 732 732 + 733 733 divide 734 734 divide 735 735 + 736 736 divide 737 737 divide 738 738 + 739 739 divide 740 740 divide 741 741 + 742 742 divide 743 743 divide 744 744 + 745 745 divide 746 746 divide 747 747 + 748 748 divide 749 749 divide 750 750 + 751 751 divide 752 752 divide 753 753 + 754 754 divide 755 755 divide 756 756 + 757 757 divide 758 758 divide 759 759 + 760 760 divide 761 761 divide 762 762 + 763 763 divide 764 764 divide 765 765 + 766 766 divide 767 767 divide 768 768 + 769 769 divide 770 770 divide 771 771 + 772 772 divide 773 773 divide 774 774 + 775 775 divide 776 776 divide 777 777 + 778 778 divide 779 779 divide 780 780 + 781 781 divide 782 782 divide 783 783 + 784 784 divide 785 785 divide 786 786 + 787 787 divide 788 788 divide 789 789 + 790 790 divide 791 791 divide 792 792 + 793 793 divide 794 794 divide 795 795 + 796 796 divide 797 797 divide 798 798 + 799 799 divide 800 800 divide 801 801 + 802 802 divide 803 803 divide 804 804 + 805 805 divide 806 806 divide 807 807 + 808 808 divide 809 809 divide 810 810 + 811 811 divide 812 812 divide 813 813 + 814 814 divide 815 815 divide 816 816 + 817 817 divide 818 818 divide 819 819 + 820 820 divide 821 821 divide 822 822 + 823 823 divide 824 824 divide 825 825 + 826 826 divide 827 827 divide 828 828 + 829 829 divide 830 830 divide 831 831 + 832 832 divide 833 833 divide 834 834 + 835 835 divide 836 836 divide 837 837 + 838 838 divide 839 839 divide 840 840 + + + + + diff --git a/tests/fixtures/pr/joined.log.expected b/tests/fixtures/pr/joined.log.expected new file mode 100644 index 000000000..a9cee6e4f --- /dev/null +++ b/tests/fixtures/pr/joined.log.expected @@ -0,0 +1,132 @@ + + +{last_modified_time} Page 1 + + +##ntation processAirPortStateChanges]: pppConnectionState 0 +# Host DatabaseMon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +#Mon Dec 10 11:42:56.705 Info: 802.1X changed +# localhost is used to configure the loopback interfaceMon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +# when the system is booting. Do not change this entry.Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +##Mon Dec 10 11:42:56.854 Info: 802.1X changed +127.0.0.1 localhostMon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +127.0.0.1 Techopss-MacBook-Pro.localMon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +127.0.0.1 tilakprMon Dec 10 11:42:57.002 Info: 802.1X changed +255.255.255.255 broadcasthostMon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +::1 localhostMon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.152 Info: 802.1X changed +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.302 Info: 802.1X changed +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.449 Info: 802.1X changed +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.600 Info: 802.1X changed +Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.749 Info: 802.1X changed +Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.896 Info: 802.1X changed +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.045 Info: 802.1X changed +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.193 Info: 802.1X changed +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.342 Info: 802.1X changed +Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.491 Info: 802.1X changed +Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.640 Info: 802.1X changed +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.805 Info: 802.1X changed +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.958 Info: 802.1X changed +Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.155 Info: 802.1X changed +Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + + + +{last_modified_time} Page 2 + + +Mon Dec 10 11:42:59.354 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.354 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.372 Driver Event: _bsd_80211_event_callback: APPLE80211_M_ROAM_END (en0) +Mon Dec 10 11:42:59.372 Info: Roaming ended on interface en0 +Mon Dec 10 11:42:59.372 Driver Event: _bsd_80211_event_callback: RSN_HANDSHAKE_DONE (en0) +Mon Dec 10 11:42:59.373 Info: -[CWXPCInterfaceContext setRoamInProgress:reason:]_block_invoke: roam status metric data: CWAWDMetricRoamStatus: status:0 security: 4 profile:5 origin:<34fcb9>(-69) target:<6cf37f>(-56) latency:6.083439s +Mon Dec 10 11:42:59.373 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90046 +Mon Dec 10 11:42:59.373 Info: RESUME AWDL for interface en0, reason=Roam token=2685 +Mon Dec 10 11:42:59.373 Info: PRIORITY LOCK REMOVED [client=airportd, type=4, interface=en0, priority=5] +Mon Dec 10 11:42:59.374 Info: -[CWXPCInterfaceContext __setAWDLOperatingMode:interface:error:]: attempting to set AWDL mode to 0 +Mon Dec 10 11:43:01.072 SC: airportdProcessSystemConfigurationEvent: Processing 'State:/Network/Service/18E14EA7-4641-4104-B315-A9315814912A/DHCP' +Mon Dec 10 11:43:01.072 SC: _processDHCPChanges: State:/Network/Service/18E14EA7-4641-4104-B315-A9315814912A/DHCP +Mon Dec 10 11:43:01.072 SC: _processDHCPChanges: DHCP airport_changed = 1 +Mon Dec 10 11:43:01.073 Info: -[CWXPCSubsystem internal_submitIPConfigLatencyMetric:leaseDuration:]: IPConfig Latency metric data: CWAWDMetricIPConfigLatencyData: DHCP latency: 29010 msecs, duration: 480 mins, security: 4 +Mon Dec 10 11:43:01.073 Info: -[CWAWDManager submitMetric:]: submitting metric id 0x90007 +Mon Dec 10 11:43:01.073 SC: _setDHCPMessage: dhcpInfoKey "State:/Network/Interface/en0/AirPort/DHCP Message" = (null) +Mon Dec 10 11:43:10.369 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 11:43:10.369 Info: _bsd_80211_event_callback: link quality: RSSI=-57 dBm TxRate=162 Mbps +Mon Dec 10 11:43:10.369 Info: link quality changed +Mon Dec 10 11:43:23.376 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 11:43:23.377 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=243 Mbps +Mon Dec 10 11:43:23.377 Info: link quality changed +Mon Dec 10 11:43:28.380 Driver Event: _bsd_80211_event_callback: LINK_QUALITY (en0) +Mon Dec 10 11:43:28.380 Info: _bsd_80211_event_callback: link quality: RSSI=-58 dBm TxRate=216 Mbps +Mon Dec 10 11:43:28.380 Info: link quality changed +Mon Dec 10 11:43:31.744 AutoJoin: BACKGROUND SCAN request on interface en0 with SSID list (null) +Mon Dec 10 11:43:31.747 Scan: Cache-assisted scan request on channel 1 does not require a live scan +Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 2 does not require a live scan +Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 3 does not require a live scan +Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 11:43:31.748 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 11:43:31.748 [channelNumber=1(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.748 [channelNumber=2(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.748 [channelNumber=3(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 11:43:31.748 )} took 0.0025 seconds, returned 10 results +Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 4 does not require a live scan +Mon Dec 10 11:43:31.748 Scan: Cache-assisted scan request on channel 5 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 6 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 11:43:31.749 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 11:43:31.749 [channelNumber=4(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.749 [channelNumber=5(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.749 [channelNumber=6(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 11:43:31.749 )} took 0.0008 seconds, returned 7 results +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 7 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 8 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 9 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request does not require a live scan +Mon Dec 10 11:43:31.749 AutoJoin: Successful cache-assisted background scan request with channels {( +Mon Dec 10 11:43:31.749 [channelNumber=7(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.749 [channelNumber=8(2GHz), channelWidth={20MHz}, active], +Mon Dec 10 11:43:31.749 [channelNumber=9(2GHz), channelWidth={20MHz}, active] +Mon Dec 10 11:43:31.749 )} took 0.0002 seconds, returned 1 results +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 10 does not require a live scan +Mon Dec 10 11:43:31.749 Scan: Cache-assisted scan request on channel 11 does not require a live scan +Mon Dec 10 11:43:31.750 Scan: Cache-assisted scan request on channel 12 does not require a live scan + + + + + diff --git a/tests/test_pr.rs b/tests/test_pr.rs index 1026b77a9..b4ff61ed7 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -382,6 +382,7 @@ fn test_with_column_across_option() { fn test_with_column_across_option_and_column_separator() { let test_file_path = "column.log"; let expected_test_file_path = "column_across_sep.log.expected"; + let expected_test_file_path1 = "column_across_sep1.log.expected"; let mut scenario = new_ucmd!(); let value = file_last_modified_time(&scenario, test_file_path); scenario @@ -398,6 +399,21 @@ fn test_with_column_across_option_and_column_separator() { expected_test_file_path, vec![(&"{last_modified_time}".to_string(), &value)], ); + + new_ucmd!() + .args(&[ + "--pages=3:5", + "--column=3", + "-Sdivide", + "-a", + "-n", + test_file_path, + ]) + .succeeds() + .stdout_is_templated_fixture( + expected_test_file_path1, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] @@ -526,3 +542,18 @@ fn test_with_pr_core_utils_tests() { ); } } + +#[test] +fn test_with_join_lines_option() { + let test_file_1 = "hosts.log"; + let test_file_2 = "test.log"; + let expected_file_path = "joined.log.expected"; + let mut scenario = new_ucmd!(); + scenario + .args(&["+1:2", "-J", "-m", test_file_1, test_file_2]) + .run() + .stdout_is_templated_fixture( + expected_file_path, + vec![(&"{last_modified_time}".to_string(), &now_time())], + ); +} From aefc2eb5402766551713be02e8f3c042b8ce783f Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Sun, 13 Jan 2019 19:49:51 +0530 Subject: [PATCH 0166/1135] pr: reformat with rustfmt pr: refactor batching of pages in pr --- src/pr/pr.rs | 268 ++++++++++++++++++++------------------------------- 1 file changed, 106 insertions(+), 162 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index f60d24a4c..90387a7da 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -20,6 +20,7 @@ use chrono::offset::Local; use chrono::DateTime; use getopts::{HasArg, Occur}; use getopts::{Matches, Options}; +use itertools::structs::Batching; use itertools::structs::KMergeBy; use itertools::{GroupBy, Itertools}; use quick_error::ResultExt; @@ -350,9 +351,9 @@ pub fn uumain(args: Vec) -> i32 { "separate columns by STRING, without -S: Default separator with -J and otherwise (same as -S\" \"), no effect on column options", - "string", - HasArg::Yes, - Occur::Optional, + "string", + HasArg::Yes, + Occur::Optional, ); opts.opt( @@ -672,10 +673,10 @@ fn build_options( x[0].to_string() }) .map(invalid_pages_map) - { - Some(res) => res?, - _ => start_page_in_plus_option, - }; + { + Some(res) => res?, + _ => start_page_in_plus_option, + }; let end_page: Option = match matches .opt_str(PAGE_RANGE_OPTION) @@ -685,10 +686,10 @@ fn build_options( x[1].to_string() }) .map(invalid_pages_map) - { - Some(res) => Some(res?), - _ => end_page_in_plus_option, - }; + { + Some(res) => Some(res?), + _ => end_page_in_plus_option, + }; if end_page.is_some() && start_page > end_page.unwrap() { return Err(PrError::EncounteredErrors(format!( @@ -723,12 +724,11 @@ fn build_options( let across_mode: bool = matches.opt_present(ACROSS_OPTION); - let column_separator: String = match matches.opt_str(COLUMN_STRING_SEPARATOR_OPTION) - { - Some(x) => Some(x), - None => matches.opt_str(COLUMN_CHAR_SEPARATOR_OPTION), - } - .unwrap_or(DEFAULT_COLUMN_SEPARATOR.to_string()); + let column_separator: String = match matches.opt_str(COLUMN_STRING_SEPARATOR_OPTION) { + Some(x) => Some(x), + None => matches.opt_str(COLUMN_CHAR_SEPARATOR_OPTION), + } + .unwrap_or(DEFAULT_COLUMN_SEPARATOR.to_string()); let default_column_width = if matches.opt_present(COLUMN_WIDTH_OPTION) && matches.opt_present(COLUMN_CHAR_SEPARATOR_OPTION) @@ -832,128 +832,102 @@ fn open(path: &str) -> Result, PrError> { .unwrap_or(Err(PrError::NotExists(path.to_string()))) } -fn pr(path: &String, options: &OutputOptions) -> Result { - let start_page: &usize = &options.start_page; - let start_line_number: usize = get_start_line_number(options); - let last_page: Option<&usize> = options.end_page.as_ref(); - let lines_needed_per_page: usize = lines_to_read_for_page(options); - let is_form_feed_used = options.form_feed_used; - let lines: Map>>, _>, _, _>>, _>, _> = - BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?) - .lines() - .map(|file_content: Result| { - file_content - .map(|content| { - let mut lines: Vec = Vec::new(); - let mut f_occurred: usize = 0; - let mut chunk: Vec = Vec::new(); - for byte in content.as_bytes() { - if byte == &FF { - f_occurred += 1; - } else { - if f_occurred != 0 { - // First time byte occurred in the scan - lines.push(FileLine { - line_content: Ok(String::from_utf8(chunk.clone()).unwrap()), - form_feeds_after: f_occurred, - ..FileLine::default() - }); - chunk.clear(); - } - chunk.push(*byte); - f_occurred = 0; - } - } - +fn split_lines_if_form_feed(file_content: Result) -> Vec { + file_content + .map(|content| { + let mut lines: Vec = Vec::new(); + let mut f_occurred: usize = 0; + let mut chunk: Vec = Vec::new(); + for byte in content.as_bytes() { + if byte == &FF { + f_occurred += 1; + } else { + if f_occurred != 0 { // First time byte occurred in the scan lines.push(FileLine { line_content: Ok(String::from_utf8(chunk.clone()).unwrap()), form_feeds_after: f_occurred, ..FileLine::default() }); + chunk.clear(); + } + chunk.push(*byte); + f_occurred = 0; + } + } - lines - }) - .unwrap_or_else(|e| { - vec![FileLine { - line_content: Err(e), - ..FileLine::default() - }] - }) - }) - .flat_map(|i| i) - .enumerate() - .map(|i: (usize, FileLine)| FileLine { - line_number: i.0, - ..i.1 - }) - .map(|file_line: FileLine| FileLine { - line_number: file_line.line_number + start_line_number, - ..file_line - }); // get display line number with line content + lines.push(FileLine { + line_content: Ok(String::from_utf8(chunk.clone()).unwrap()), + form_feeds_after: f_occurred, + ..FileLine::default() + }); + + lines + }) + .unwrap_or_else(|e| { + vec![FileLine { + line_content: Err(e), + ..FileLine::default() + }] + }) +} + +fn pr(path: &String, options: &OutputOptions) -> Result { + let start_page: &usize = &options.start_page; + let start_line_number: usize = get_start_line_number(options); + let last_page: Option<&usize> = options.end_page.as_ref(); + let lines_needed_per_page: usize = lines_to_read_for_page(options); + let pages: Batching< + Map>>, _>, _, _>>, _>, _>, + _, + > = BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?) + .lines() + .map(split_lines_if_form_feed) + .flat_map(|i: Vec| i) + .enumerate() + .map(|i: (usize, FileLine)| FileLine { + line_number: i.0, + ..i.1 + }) + .map(|file_line: FileLine| FileLine { + line_number: file_line.line_number + start_line_number, + ..file_line + }) // get display line number with line content + .batching(|it| { + let mut first_page: Vec = Vec::new(); + let mut page_with_lines: Vec> = Vec::new(); + for line in it { + let form_feeds_after = line.form_feeds_after; + first_page.push(line); + + if form_feeds_after > 1 { + // insert empty pages + page_with_lines.push(first_page); + for _i in 1..form_feeds_after { + page_with_lines.push(vec![]); + } + return Some(page_with_lines); + } + + if first_page.len() == lines_needed_per_page || form_feeds_after == 1 { + break; + } + } + + if first_page.len() == 0 { + return None; + } + page_with_lines.push(first_page); + return Some(page_with_lines); + }); let mut page_number = 1; - let mut page_lines: Vec = Vec::new(); - let mut feed_line_present = false; - for file_line in lines { - if file_line.line_content.is_err() { - return Err(file_line.line_content.unwrap_err().into()); - } - feed_line_present = is_form_feed_used; - let form_feeds_after: usize = file_line.form_feeds_after; - page_lines.push(file_line); - - if page_lines.len() == lines_needed_per_page || form_feeds_after > 0 { - if form_feeds_after > 1 { - print_page( - &page_lines, - options, - &page_number, - &start_page, - &last_page, - feed_line_present, - )?; - page_lines.clear(); - page_number += 1; - - // insert empty pages - let empty_pages_required = form_feeds_after - 1; - for _i in 0..empty_pages_required { - print_page( - &page_lines, - options, - &page_number, - &start_page, - &last_page, - feed_line_present, - )?; - page_number += 1; - } - } else { - print_page( - &page_lines, - options, - &page_number, - &start_page, - &last_page, - feed_line_present, - )?; - page_number += 1; - } - page_lines.clear(); + for page_set in pages { + for page in page_set { + print_page(&page, options, &page_number, &start_page, &last_page)?; + page_number += 1; } } - if page_lines.len() != 0 { - print_page( - &page_lines, - options, - &page_number, - &start_page, - &last_page, - feed_line_present, - )?; - } - return Ok(0); } @@ -1034,14 +1008,7 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { let new_page_number = file_line.page_number; if page_counter != new_page_number { fill_missing_lines(&mut lines, lines_needed_per_page, &nfiles, page_counter); - print_page( - &lines, - options, - &page_counter, - &start_page, - &last_page, - false, - )?; + print_page(&lines, options, &page_counter, &start_page, &last_page)?; lines = Vec::new(); } lines.push(file_line); @@ -1050,14 +1017,7 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { } fill_missing_lines(&mut lines, lines_needed_per_page, &nfiles, page_counter); - print_page( - &lines, - options, - &page_counter, - &start_page, - &last_page, - false, - )?; + print_page(&lines, options, &page_counter, &start_page, &last_page)?; return Ok(0); } @@ -1124,7 +1084,6 @@ fn print_page( page: &usize, start_page: &usize, last_page: &Option<&usize>, - feed_line_present: bool, ) -> Result { if (last_page.is_some() && page > last_page.unwrap()) || page < start_page { return Ok(0); @@ -1141,7 +1100,7 @@ fn print_page( out.write(x.as_bytes())?; out.write(line_separator)?; } - let lines_written = write_columns(lines, options, out, feed_line_present)?; + let lines_written = write_columns(lines, options, out)?; for index in 0..trailer_content.len() { let x: &String = trailer_content.get(index).unwrap(); @@ -1159,7 +1118,6 @@ fn write_columns( lines: &Vec, options: &OutputOptions, out: &mut Stdout, - feed_line_present: bool, ) -> Result { let line_separator = options.content_line_separator.as_bytes(); let content_lines_per_page = if options.double_space { @@ -1189,20 +1147,6 @@ fn write_columns( .unwrap_or(&blank_line), ); - // TODO simplify - let col_width: Option = options - .column_mode_options - .as_ref() - .map(|i| Some(i.width)) - .unwrap_or( - options - .merge_files_print - .map(|_k| Some(DEFAULT_COLUMN_WIDTH)) - .unwrap_or(None), - ); - - let page_width: Option = options.page_width; - let line_width: Option = if options.join_lines { None } else if columns > 1 { @@ -1238,7 +1182,7 @@ fn write_columns( }) .collect() }; - + let feed_line_present = options.form_feed_used; let spaces = " ".repeat(*offset_spaces); let mut not_found_break = false; for fetch_index in fetch_indexes { From a7def9386b1e731a7678814cdb80d86b620ae686 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Mon, 14 Jan 2019 20:29:20 +0530 Subject: [PATCH 0167/1135] pr: refactor common iterator between pr and mpr pr: refactor common iterator between pr and mpr pr: remove fill lines in mpr --- src/pr/pr.rs | 426 ++++++++++++++++++++++++++------------------------- 1 file changed, 217 insertions(+), 209 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 90387a7da..460d241a7 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -20,7 +20,6 @@ use chrono::offset::Local; use chrono::DateTime; use getopts::{HasArg, Occur}; use getopts::{Matches, Options}; -use itertools::structs::Batching; use itertools::structs::KMergeBy; use itertools::{GroupBy, Itertools}; use quick_error::ResultExt; @@ -28,8 +27,7 @@ use regex::Regex; use std::convert::From; use std::fs::{metadata, File, Metadata}; use std::io::{stderr, stdin, stdout, BufRead, BufReader, Lines, Read, Stdin, Stdout, Write}; -use std::iter::FlatMap; -use std::iter::{Enumerate, Map, SkipWhile, TakeWhile}; +use std::iter::{FlatMap, Map}; use std::num::ParseIntError; #[cfg(unix)] use std::os::unix::fs::FileTypeExt; @@ -873,72 +871,97 @@ fn split_lines_if_form_feed(file_content: Result) -> Vec Result { - let start_page: &usize = &options.start_page; + let start_page: usize = options.start_page; let start_line_number: usize = get_start_line_number(options); - let last_page: Option<&usize> = options.end_page.as_ref(); + let last_page: Option = options.end_page; let lines_needed_per_page: usize = lines_to_read_for_page(options); - let pages: Batching< - Map>>, _>, _, _>>, _>, _>, - _, - > = BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?) - .lines() - .map(split_lines_if_form_feed) - .flat_map(|i: Vec| i) - .enumerate() - .map(|i: (usize, FileLine)| FileLine { - line_number: i.0, - ..i.1 - }) - .map(|file_line: FileLine| FileLine { - line_number: file_line.line_number + start_line_number, - ..file_line - }) // get display line number with line content - .batching(|it| { - let mut first_page: Vec = Vec::new(); - let mut page_with_lines: Vec> = Vec::new(); - for line in it { - let form_feeds_after = line.form_feeds_after; - first_page.push(line); + let lines: Lines>> = + BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?).lines(); - if form_feeds_after > 1 { - // insert empty pages - page_with_lines.push(first_page); - for _i in 1..form_feeds_after { - page_with_lines.push(vec![]); - } - return Some(page_with_lines); - } + let pages: Box)>> = read_stream_and_create_pages( + lines, + start_line_number, + lines_needed_per_page, + start_page, + last_page, + 0, + ); - if first_page.len() == lines_needed_per_page || form_feeds_after == 1 { - break; - } - } - - if first_page.len() == 0 { - return None; - } - page_with_lines.push(first_page); - return Some(page_with_lines); - }); - - let mut page_number = 1; - for page_set in pages { - for page in page_set { - print_page(&page, options, &page_number, &start_page, &last_page)?; - page_number += 1; - } + for page_with_page_number in pages { + let page_number = page_with_page_number.0 + 1; + let page = page_with_page_number.1; + print_page(&page, options, &page_number)?; } return Ok(0); } +fn read_stream_and_create_pages( + lines: Lines>>, + start_line_number: usize, + lines_needed_per_page: usize, + start_page: usize, + last_page: Option, + file_id: usize, +) -> Box)>> { + return Box::new( + lines + .map(split_lines_if_form_feed) + .flat_map(|i: Vec| i) + .enumerate() + .map(move |i: (usize, FileLine)| FileLine { + line_number: i.0 + start_line_number, + file_id, + ..i.1 + }) // Add line number and file_id + .batching(move |it| { + let mut first_page: Vec = Vec::new(); + let mut page_with_lines: Vec> = Vec::new(); + for line in it { + let form_feeds_after = line.form_feeds_after; + first_page.push(line); + + if form_feeds_after > 1 { + // insert empty pages + page_with_lines.push(first_page); + for _i in 1..form_feeds_after { + page_with_lines.push(vec![]); + } + return Some(page_with_lines); + } + + if first_page.len() == lines_needed_per_page || form_feeds_after == 1 { + break; + } + } + + if first_page.len() == 0 { + return None; + } + page_with_lines.push(first_page); + return Some(page_with_lines); + }) // Create set of pages as form feeds could lead to empty pages + .flat_map(|x| x) // Flatten to pages from page sets + .enumerate() // Assign page number + .skip_while(move |x: &(usize, Vec)| { + // Skip the not needed pages + let current_page = x.0 + 1; + return current_page < start_page; + }) + .take_while(move |x: &(usize, Vec)| { + // Take only the required pages + let current_page = x.0 + 1; + return current_page >= start_page + && (last_page.is_none() || current_page <= last_page.unwrap()); + }), + ); +} + fn mpr(paths: &Vec, options: &OutputOptions) -> Result { let nfiles = paths.len(); let lines_needed_per_page: usize = lines_to_read_for_page(options); - let lines_needed_per_page_f64: f64 = lines_needed_per_page as f64; - let start_page: &usize = &options.start_page; - let last_page: Option<&usize> = options.end_page.as_ref(); - let start_line_index_of_start_page = (start_page - 1) * lines_needed_per_page; + let start_page: usize = options.start_page; + let last_page: Option = options.end_page; // Check if files exists for path in paths { @@ -947,46 +970,37 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { let file_line_groups: GroupBy< usize, - KMergeBy< - Map>>>, _>, _>, _>, _>, - _, - >, + KMergeBy)>>, _>, _, _>, _>, _, > = paths .into_iter() .enumerate() .map(|indexed_path: (usize, &String)| { let start_line_number: usize = get_start_line_number(options); - BufReader::with_capacity(READ_BUFFER_SIZE, open(indexed_path.1).unwrap()) - .lines() - .enumerate() - .map(move |i: (usize, Result)| FileLine { - file_id: indexed_path.0, - line_number: i.0, - line_content: i.1, - ..FileLine::default() - }) - .skip_while(move |file_line: &FileLine| { - // Skip the initial lines if not in page range - file_line.line_number < (start_line_index_of_start_page) - }) - .take_while(move |file_line: &FileLine| { - // Only read the file until provided last page reached - last_page - .map(|lp| file_line.line_number < ((*lp) * lines_needed_per_page)) - .unwrap_or(true) - }) - .map(move |file_line: FileLine| { - let page_number = ((file_line.line_number + 2 - start_line_number) as f64 - / (lines_needed_per_page_f64)) - .ceil() as usize; - FileLine { - line_number: file_line.line_number + start_line_number, + let lines = + BufReader::with_capacity(READ_BUFFER_SIZE, open(indexed_path.1).unwrap()).lines(); + + read_stream_and_create_pages( + lines, + start_line_number, + lines_needed_per_page, + start_page, + last_page, + indexed_path.0, + ) + .map(move |x: (usize, Vec)| { + let file_line = x.1; + let page_number = x.0 + 1; + file_line + .into_iter() + .map(|fl| FileLine { page_number, - group_key: page_number * nfiles + file_line.file_id, - ..file_line - } - }) // get display line number with line content + group_key: page_number * nfiles + fl.file_id, + ..fl + }) + .collect() + }) + .flat_map(|x: Vec| x) }) .kmerge_by(|a: &FileLine, b: &FileLine| { if a.group_key == b.group_key { @@ -997,9 +1011,10 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { }) .group_by(|file_line: &FileLine| file_line.group_key); - let mut lines: Vec = Vec::new(); let start_page: &usize = &options.start_page; + let mut lines: Vec = Vec::new(); let mut page_counter: usize = *start_page; + for (_key, file_line_group) in file_line_groups.into_iter() { for file_line in file_line_group { if file_line.line_content.is_err() { @@ -1007,87 +1022,24 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { } let new_page_number = file_line.page_number; if page_counter != new_page_number { - fill_missing_lines(&mut lines, lines_needed_per_page, &nfiles, page_counter); - print_page(&lines, options, &page_counter, &start_page, &last_page)?; + print_page(&lines, options, &page_counter)?; lines = Vec::new(); + page_counter = new_page_number; } lines.push(file_line); - page_counter = new_page_number; } } - fill_missing_lines(&mut lines, lines_needed_per_page, &nfiles, page_counter); - print_page(&lines, options, &page_counter, &start_page, &last_page)?; + print_page(&lines, options, &page_counter)?; return Ok(0); } -fn fill_missing_lines( - lines: &mut Vec, - lines_per_file: usize, - nfiles: &usize, - page_number: usize, -) { - let init_line_number = (page_number - 1) * lines_per_file + 1; - let mut file_id_counter: usize = 0; - let mut line_number_counter: usize = init_line_number; - let mut lines_processed_per_file: usize = 0; - for mut i in 0..lines_per_file * nfiles { - let file_id = lines - .get(i) - .map(|i: &FileLine| i.file_id) - .unwrap_or(file_id_counter); - let line_number = lines.get(i).map(|i: &FileLine| i.line_number).unwrap_or(1); - if lines_processed_per_file == lines_per_file { - line_number_counter = init_line_number; - file_id_counter += 1; - lines_processed_per_file = 0; - } - - if file_id != file_id_counter { - // Insert missing file_ids - lines.insert( - i, - FileLine { - file_id: file_id_counter, - line_number: line_number_counter, - line_content: Ok("".to_string()), - page_number, - ..FileLine::default() - }, - ); - line_number_counter += 1; - } else if line_number < line_number_counter { - // Insert missing lines for a file_id - line_number_counter += 1; - lines.insert( - i, - FileLine { - file_id, - line_number: line_number_counter, - line_content: Ok("".to_string()), - page_number, - ..FileLine::default() - }, - ); - } else { - line_number_counter = line_number; - } - - lines_processed_per_file += 1; - } -} - fn print_page( lines: &Vec, options: &OutputOptions, page: &usize, - start_page: &usize, - last_page: &Option<&usize>, ) -> Result { - if (last_page.is_some() && page > last_page.unwrap()) || page < start_page { - return Ok(0); - } let page_separator = options.page_separator_char.as_bytes(); let header: Vec = header_content(options, page); let trailer_content: Vec = trailer_content(options); @@ -1159,67 +1111,123 @@ fn write_columns( options.page_width }; - let across_mode = options - .column_mode_options - .as_ref() - .map(|i| i.across_mode) - .unwrap_or(false); - let offset_spaces: &usize = &options.offset_spaces; - let mut lines_printed = 0; let is_number_mode = options.number.is_some(); - let fetch_indexes: Vec> = if across_mode { - (0..content_lines_per_page) - .map(|a| (0..columns).map(|i| a * columns + i).collect()) - .collect() - } else { - (0..content_lines_per_page) - .map(|start| { - (0..columns) - .map(|i| start + content_lines_per_page * i) - .collect() - }) - .collect() - }; let feed_line_present = options.form_feed_used; let spaces = " ".repeat(*offset_spaces); let mut not_found_break = false; - for fetch_index in fetch_indexes { - let indexes = fetch_index.len(); - for i in 0..indexes { - let index: usize = fetch_index[i]; - if lines.get(index).is_none() { - not_found_break = true; - break; - } - let file_line: &FileLine = lines.get(index).unwrap(); - let trimmed_line: String = format!( - "{}{}", - spaces, - get_line_for_printing( - file_line, - &number_width, - &number_separator, - columns, - is_number_mode, - &options.merge_files_print, - &i, - line_width, - ) - ); - out.write(trimmed_line.as_bytes())?; - if (i + 1) != indexes && !options.join_lines { - out.write(col_sep.as_bytes())?; - } - lines_printed += 1; - } - if not_found_break && feed_line_present { - break; + if options.merge_files_print.is_none() { + let across_mode = options + .column_mode_options + .as_ref() + .map(|i| i.across_mode) + .unwrap_or(false); + + let fetch_indexes: Vec> = if across_mode { + (0..content_lines_per_page) + .map(|a| (0..columns).map(|i| a * columns + i).collect()) + .collect() } else { - out.write(line_separator)?; + (0..content_lines_per_page) + .map(|start| { + (0..columns) + .map(|i| start + content_lines_per_page * i) + .collect() + }) + .collect() + }; + for fetch_index in fetch_indexes { + let indexes = fetch_index.len(); + for i in 0..indexes { + let index: usize = fetch_index[i]; + if lines.get(index).is_none() { + not_found_break = true; + break; + } + let file_line: &FileLine = lines.get(index).unwrap(); + let trimmed_line: String = format!( + "{}{}", + spaces, + get_line_for_printing( + file_line, + &number_width, + &number_separator, + columns, + is_number_mode, + &options.merge_files_print, + &i, + line_width, + ) + ); + out.write(trimmed_line.as_bytes())?; + if (i + 1) != indexes && !options.join_lines { + out.write(col_sep.as_bytes())?; + } + lines_printed += 1; + } + if not_found_break && feed_line_present { + break; + } else { + out.write(line_separator)?; + } + } + } else { + let mut index: usize = 0; + let mut batches: Vec> = Vec::new(); + for col in 0..columns { + let mut batch: Vec<&FileLine> = vec![]; + for i in index..lines.len() { + let line = lines.get(i).unwrap(); + if line.file_id != col { + break; + } + batch.push(line); + index += 1; + } + batches.push(batch); + } + + let blank_line = &&FileLine::default(); + + for _i in 0..content_lines_per_page { + for col_index in 0..columns { + let col: Option<&Vec<&FileLine>> = batches.get(col_index); + let file_line = if col.is_some() { + let opt_file_line: Option<&&FileLine> = col.unwrap().get(_i); + opt_file_line.unwrap_or(blank_line) + } else { + blank_line + }; + + let trimmed_line: String = format!( + "{}{}", + spaces, + get_line_for_printing( + file_line, + &number_width, + &number_separator, + columns, + is_number_mode, + &options.merge_files_print, + &col_index, + line_width, + ) + ); + out.write(trimmed_line.as_bytes())?; + if (col_index + 1) != columns && !options.join_lines { + out.write(col_sep.as_bytes())?; + } + lines_printed += 1; + } + if feed_line_present { + break; + } else { + out.write(line_separator)?; + } } } + Ok(lines_printed) } From f87ada5a11a766e3a680a226a7fe6bc1bedc48b2 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Wed, 16 Jan 2019 21:12:09 +0530 Subject: [PATCH 0168/1135] pr: refactor logic for -n --- src/pr/pr.rs | 79 +++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 41 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 460d241a7..0b02df778 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -388,9 +388,34 @@ pub fn uumain(args: Vec) -> i32 { opts.optflag("", "help", "display this help and exit"); opts.optflag("V", "version", "output version information and exit"); - // Remove -column option as getopts cannot parse things like -3 etc - let re = Regex::new(r"^-\d+").unwrap(); - let opt_args: Vec<&String> = args.iter().filter(|i| !re.is_match(i)).collect(); + // Remove -column and +page option as getopts cannot parse things like -3 etc + let column_page_option = Regex::new(r"^[-+]\d+.*").unwrap(); + let num_regex: Regex = Regex::new(r"(.\d+)|(\d+)|^[^-]$").unwrap(); + let a_file: Regex = Regex::new(r"^[^-+].*").unwrap(); + let n_regex: Regex = Regex::new(r"^-n\s*$").unwrap(); + let mut arguments = args.clone(); + let num_option: Option<(usize, &String)> = + args.iter().find_position(|x| n_regex.is_match(x.trim())); + if num_option.is_some() { + let (pos, _value) = num_option.unwrap(); + let num_val_opt = args.get(pos + 1); + if num_val_opt.is_some() { + if !num_regex.is_match(num_val_opt.unwrap()) { + let could_be_file = arguments.remove(pos + 1); + arguments.insert(pos + 1, format!("{}", NumberingMode::default().width)); + if a_file.is_match(could_be_file.trim().as_ref()) { + arguments.insert(pos + 2, could_be_file); + } else { + arguments.insert(pos + 2, could_be_file); + } + } + } + } + + let opt_args: Vec<&String> = arguments + .iter() + .filter(|i| !column_page_option.is_match(i)) + .collect(); let matches = match opts.parse(&opt_args[1..]) { Ok(m) => m, @@ -402,26 +427,8 @@ pub fn uumain(args: Vec) -> i32 { return 0; } - let mut files: Vec = matches - .free - .clone() - .iter() - .filter(|i| !i.starts_with('+') && !i.starts_with('-')) - .map(|i| i.to_string()) - .collect(); - - // -n value is optional if -n is given the opts gets confused - // if -n is used just before file path it might be captured as value of -n - if matches.opt_str(NUMBERING_MODE_OPTION).is_some() { - let maybe_a_file_path: String = matches.opt_str(NUMBERING_MODE_OPTION).unwrap(); - let is_file: bool = is_a_file(&maybe_a_file_path); - if !is_file && files.is_empty() { - print_error(&matches, PrError::NotExists(maybe_a_file_path)); - return 1; - } else if is_file { - files.insert(0, maybe_a_file_path); - } - } else if files.is_empty() { + let mut files: Vec = matches.free.clone(); + if files.is_empty() { //For stdin files.insert(0, FILE_STDIN.to_owned()); } @@ -439,16 +446,20 @@ pub fn uumain(args: Vec) -> i32 { for file_group in file_groups { let result_options: Result = build_options(&matches, &file_group, args.join(" ")); + if result_options.is_err() { print_error(&matches, result_options.err().unwrap()); return 1; } + let options: &OutputOptions = &result_options.unwrap(); + let cmd_result: Result = if file_group.len() == 1 { pr(&file_group.get(0).unwrap(), options) } else { mpr(&file_group, options) }; + let status: i32 = match cmd_result { Err(error) => { print_error(&matches, error); @@ -463,10 +474,6 @@ pub fn uumain(args: Vec) -> i32 { return 0; } -fn is_a_file(could_be_file: &String) -> bool { - could_be_file == FILE_STDIN || File::open(could_be_file).is_ok() -} - fn print_error(matches: &Matches, err: PrError) { if !matches.opt_present(SUPPRESS_PRINTING_ERROR) { writeln!(&mut stderr(), "{}", err); @@ -587,23 +594,15 @@ fn build_options( let parse_result: Result = i.parse::(); let separator: String = if parse_result.is_err() { - if is_a_file(&i) { - NumberingMode::default().separator - } else { - i[0..1].to_string() - } + i[0..1].to_string() } else { NumberingMode::default().separator }; let width: usize = if parse_result.is_err() { - if is_a_file(&i) { - NumberingMode::default().width - } else { - i[1..] - .parse::() - .unwrap_or(NumberingMode::default().width) - } + i[1..] + .parse::() + .unwrap_or(NumberingMode::default().width) } else { parse_result.unwrap() }; @@ -1258,8 +1257,6 @@ fn get_line_for_printing( let tab_count: usize = complete_line.chars().filter(|i| i == &TAB).count(); let display_length = complete_line.len() + (tab_count * 7); - // TODO Adjust the width according to -n option - // TODO actual len of the string vs display len of string because of tabs line_width .map(|i| { let min_width = (i - (columns - 1)) / columns; From 054c05d5d835d55540c982f0743e99bd7abf9d01 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Thu, 17 Jan 2019 12:35:20 +0530 Subject: [PATCH 0169/1135] pr: refactor get_lines_for_printing, write_columns, recreate_arguments pr: extract recreate_arguments pr: refactor get_line_for_printing pr: refactor get_lines_for_printing pr: refactor fetch_indexes generate for write_columns pr: refactor write_columns pr: refactor write_columns --- src/pr/pr.rs | 544 +++++++++--------- .../test_num_page_less_content.log.expected | 47 ++ 2 files changed, 304 insertions(+), 287 deletions(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 0b02df778..ca35b6c1c 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -38,8 +38,8 @@ type IOError = std::io::Error; static NAME: &str = "pr"; static VERSION: &str = env!("CARGO_PKG_VERSION"); static TAB: char = '\t'; -static NEW_LINE: &str = "\n"; static LINES_PER_PAGE: usize = 66; +static LINES_PER_PAGE_FOR_FORM_FEED: usize = 63; static HEADER_LINES_PER_PAGE: usize = 5; static TRAILER_LINES_PER_PAGE: usize = 5; static STRING_HEADER_OPTION: &str = "h"; @@ -66,7 +66,6 @@ static READ_BUFFER_SIZE: usize = 1024 * 64; static DEFAULT_COLUMN_WIDTH: usize = 72; static DEFAULT_COLUMN_WIDTH_WITH_S_OPTION: usize = 512; static DEFAULT_COLUMN_SEPARATOR: &char = &TAB; -static BLANK_STRING: &str = ""; static FF: u8 = 0x0C as u8; struct OutputOptions { @@ -79,16 +78,16 @@ struct OutputOptions { last_modified_time: String, start_page: usize, end_page: Option, - display_header: bool, - display_trailer: bool, + display_header_and_trailer: bool, content_lines_per_page: usize, page_separator_char: String, column_mode_options: Option, merge_files_print: Option, - offset_spaces: usize, + offset_spaces: String, form_feed_used: bool, - page_width: Option, join_lines: bool, + col_sep_for_printing: String, + line_width: Option, } struct FileLine { @@ -143,7 +142,7 @@ impl Default for FileLine { line_number: 0, page_number: 0, group_key: 0, - line_content: Ok(BLANK_STRING.to_string()), + line_content: Ok(String::new()), form_feeds_after: 0, } } @@ -388,34 +387,7 @@ pub fn uumain(args: Vec) -> i32 { opts.optflag("", "help", "display this help and exit"); opts.optflag("V", "version", "output version information and exit"); - // Remove -column and +page option as getopts cannot parse things like -3 etc - let column_page_option = Regex::new(r"^[-+]\d+.*").unwrap(); - let num_regex: Regex = Regex::new(r"(.\d+)|(\d+)|^[^-]$").unwrap(); - let a_file: Regex = Regex::new(r"^[^-+].*").unwrap(); - let n_regex: Regex = Regex::new(r"^-n\s*$").unwrap(); - let mut arguments = args.clone(); - let num_option: Option<(usize, &String)> = - args.iter().find_position(|x| n_regex.is_match(x.trim())); - if num_option.is_some() { - let (pos, _value) = num_option.unwrap(); - let num_val_opt = args.get(pos + 1); - if num_val_opt.is_some() { - if !num_regex.is_match(num_val_opt.unwrap()) { - let could_be_file = arguments.remove(pos + 1); - arguments.insert(pos + 1, format!("{}", NumberingMode::default().width)); - if a_file.is_match(could_be_file.trim().as_ref()) { - arguments.insert(pos + 2, could_be_file); - } else { - arguments.insert(pos + 2, could_be_file); - } - } - } - } - - let opt_args: Vec<&String> = arguments - .iter() - .filter(|i| !column_page_option.is_match(i)) - .collect(); + let opt_args: Vec = recreate_arguments(&args); let matches = match opts.parse(&opt_args[1..]) { Ok(m) => m, @@ -474,6 +446,40 @@ pub fn uumain(args: Vec) -> i32 { return 0; } +/// Returns re-written arguments which are passed to the program. +/// Removes -column and +page option as getopts cannot parse things like -3 etc +/// # Arguments +/// * `args` - Command line arguments +fn recreate_arguments(args: &Vec) -> Vec { + let column_page_option = Regex::new(r"^[-+]\d+.*").unwrap(); + let num_regex: Regex = Regex::new(r"(.\d+)|(\d+)|^[^-]$").unwrap(); + let a_file: Regex = Regex::new(r"^[^-+].*").unwrap(); + let n_regex: Regex = Regex::new(r"^-n\s*$").unwrap(); + let mut arguments = args.clone(); + let num_option: Option<(usize, &String)> = + args.iter().find_position(|x| n_regex.is_match(x.trim())); + if num_option.is_some() { + let (pos, _value) = num_option.unwrap(); + let num_val_opt = args.get(pos + 1); + if num_val_opt.is_some() { + if !num_regex.is_match(num_val_opt.unwrap()) { + let could_be_file = arguments.remove(pos + 1); + arguments.insert(pos + 1, format!("{}", NumberingMode::default().width)); + if a_file.is_match(could_be_file.trim().as_ref()) { + arguments.insert(pos + 2, could_be_file); + } else { + arguments.insert(pos + 2, could_be_file); + } + } + } + } + + return arguments + .into_iter() + .filter(|i| !column_page_option.is_match(i)) + .collect(); +} + fn print_error(matches: &Matches, err: PrError) { if !matches.opt_present(SUPPRESS_PRINTING_ERROR) { writeln!(&mut stderr(), "{}", err); @@ -545,24 +551,17 @@ fn build_options( let form_feed_used = matches.opt_present(FORM_FEED_OPTION) || matches.opt_present(FORM_FEED_OPTION_SMALL); - let invalid_pages_map = |i: String| { - let unparsed_value: String = matches.opt_str(PAGE_RANGE_OPTION).unwrap(); - i.parse::().map_err(|_e| { - PrError::EncounteredErrors(format!("invalid --pages argument '{}'", unparsed_value)) - }) - }; - let is_merge_mode: bool = matches.opt_present(MERGE_FILES_PRINT); if is_merge_mode && matches.opt_present(COLUMN_OPTION) { let err_msg: String = - "cannot specify number of columns when printing in parallel".to_string(); + String::from("cannot specify number of columns when printing in parallel"); return Err(PrError::EncounteredErrors(err_msg)); } if is_merge_mode && matches.opt_present(ACROSS_OPTION) { let err_msg: String = - "cannot specify both printing across and printing in parallel".to_string(); + String::from("cannot specify both printing across and printing in parallel"); return Err(PrError::EncounteredErrors(err_msg)); } @@ -575,10 +574,10 @@ fn build_options( let header: String = matches .opt_str(STRING_HEADER_OPTION) .unwrap_or(if is_merge_mode { - "".to_string() + String::new() } else { if paths[0].to_string() == FILE_STDIN { - "".to_string() + String::new() } else { paths[0].to_string() } @@ -588,7 +587,7 @@ fn build_options( let first_number: usize = parse_usize(matches, FIRST_LINE_NUMBER_OPTION).unwrap_or(Ok(default_first_number))?; - let numbering_options: Option = matches + let number: Option = matches .opt_str(NUMBERING_MODE_OPTION) .map(|i| { let parse_result: Result = i.parse::(); @@ -623,22 +622,23 @@ fn build_options( let double_space: bool = matches.opt_present(DOUBLE_SPACE_OPTION); let content_line_separator: String = if double_space { - NEW_LINE.repeat(2) + "\n".repeat(2) } else { - NEW_LINE.to_string() + "\n".to_string() }; - let line_separator: String = NEW_LINE.to_string(); + let line_separator: String = "\n".to_string(); let last_modified_time: String = if is_merge_mode || paths[0].eq(FILE_STDIN) { - current_time() + let datetime: DateTime = Local::now(); + datetime.format("%b %d %H:%M %Y").to_string() } else { file_last_modified_time(paths.get(0).unwrap()) }; // +page option is less priority than --pages - let re = Regex::new(r"\s*\+(\d+:*\d*)\s*").unwrap(); - let start_page_in_plus_option: usize = match re.captures(&free_args).map(|i| { + let page_plus_re = Regex::new(r"\s*\+(\d+:*\d*)\s*").unwrap(); + let start_page_in_plus_option: usize = match page_plus_re.captures(&free_args).map(|i| { let unparsed_num = i.get(1).unwrap().as_str().trim(); let x: Vec<&str> = unparsed_num.split(":").collect(); x[0].to_string().parse::().map_err(|_e| { @@ -649,7 +649,7 @@ fn build_options( _ => 1, }; - let end_page_in_plus_option: Option = match re + let end_page_in_plus_option: Option = match page_plus_re .captures(&free_args) .map(|i| i.get(1).unwrap().as_str().trim()) .filter(|i| i.contains(":")) @@ -663,6 +663,13 @@ fn build_options( _ => None, }; + let invalid_pages_map = |i: String| { + let unparsed_value: String = matches.opt_str(PAGE_RANGE_OPTION).unwrap(); + i.parse::().map_err(|_e| { + PrError::EncounteredErrors(format!("invalid --pages argument '{}'", unparsed_value)) + }) + }; + let start_page: usize = match matches .opt_str(PAGE_RANGE_OPTION) .map(|i| { @@ -696,7 +703,11 @@ fn build_options( ))); } - let default_lines_per_page = if form_feed_used { 63 } else { LINES_PER_PAGE }; + let default_lines_per_page = if form_feed_used { + LINES_PER_PAGE_FOR_FORM_FEED + } else { + LINES_PER_PAGE + }; let page_length: usize = parse_usize(matches, PAGE_LENGTH_OPTION).unwrap_or(Ok(default_lines_per_page))?; @@ -716,7 +727,7 @@ fn build_options( let bytes = vec![FF]; String::from_utf8(bytes).unwrap() } else { - NEW_LINE.to_string() + "\n".to_string() }; let across_mode: bool = matches.opt_present(ACROSS_OPTION); @@ -776,11 +787,37 @@ fn build_options( _ => None, }; - let offset_spaces: usize = parse_usize(matches, OFFSET_SPACES_OPTION).unwrap_or(Ok(0))?; + let offset_spaces: String = + " ".repeat(parse_usize(matches, OFFSET_SPACES_OPTION).unwrap_or(Ok(0))?); let join_lines: bool = matches.opt_present(JOIN_LINES_OPTION); + let col_sep_for_printing = column_mode_options + .as_ref() + .map(|i| i.column_separator.clone()) + .unwrap_or( + merge_files_print + .map(|_k| DEFAULT_COLUMN_SEPARATOR.to_string()) + .unwrap_or(String::new()), + ); + + let columns_to_print = + merge_files_print.unwrap_or(column_mode_options.as_ref().map(|i| i.columns).unwrap_or(1)); + + let line_width: Option = if join_lines { + None + } else if columns_to_print > 1 { + Some( + column_mode_options + .as_ref() + .map(|i| i.width) + .unwrap_or(DEFAULT_COLUMN_WIDTH), + ) + } else { + page_width + }; + Ok(OutputOptions { - number: numbering_options, + number, header, double_space, line_separator, @@ -788,16 +825,16 @@ fn build_options( last_modified_time, start_page, end_page, - display_header: display_header_and_trailer, - display_trailer: display_header_and_trailer, + display_header_and_trailer, content_lines_per_page, page_separator_char, column_mode_options, merge_files_print, offset_spaces, form_feed_used, - page_width, join_lines, + col_sep_for_printing, + line_width, }) } @@ -870,21 +907,11 @@ fn split_lines_if_form_feed(file_content: Result) -> Vec Result { - let start_page: usize = options.start_page; - let start_line_number: usize = get_start_line_number(options); - let last_page: Option = options.end_page; - let lines_needed_per_page: usize = lines_to_read_for_page(options); let lines: Lines>> = BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?).lines(); - let pages: Box)>> = read_stream_and_create_pages( - lines, - start_line_number, - lines_needed_per_page, - start_page, - last_page, - 0, - ); + let pages: Box)>> = + read_stream_and_create_pages(options, lines, 0); for page_with_page_number in pages { let page_number = page_with_page_number.0 + 1; @@ -895,13 +922,15 @@ fn pr(path: &String, options: &OutputOptions) -> Result { } fn read_stream_and_create_pages( + options: &OutputOptions, lines: Lines>>, - start_line_number: usize, - lines_needed_per_page: usize, - start_page: usize, - last_page: Option, file_id: usize, ) -> Box)>> { + let start_page: usize = options.start_page; + let start_line_number: usize = get_start_line_number(options); + let last_page: Option = options.end_page; + let lines_needed_per_page: usize = lines_to_read_for_page(options); + return Box::new( lines .map(split_lines_if_form_feed) @@ -958,10 +987,6 @@ fn read_stream_and_create_pages( fn mpr(paths: &Vec, options: &OutputOptions) -> Result { let nfiles = paths.len(); - let lines_needed_per_page: usize = lines_to_read_for_page(options); - let start_page: usize = options.start_page; - let last_page: Option = options.end_page; - // Check if files exists for path in paths { open(path)?; @@ -972,34 +997,26 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { KMergeBy)>>, _>, _, _>, _>, _, > = paths - .into_iter() + .iter() .enumerate() .map(|indexed_path: (usize, &String)| { - let start_line_number: usize = get_start_line_number(options); let lines = BufReader::with_capacity(READ_BUFFER_SIZE, open(indexed_path.1).unwrap()).lines(); - read_stream_and_create_pages( - lines, - start_line_number, - lines_needed_per_page, - start_page, - last_page, - indexed_path.0, - ) - .map(move |x: (usize, Vec)| { - let file_line = x.1; - let page_number = x.0 + 1; - file_line - .into_iter() - .map(|fl| FileLine { - page_number, - group_key: page_number * nfiles + fl.file_id, - ..fl - }) - .collect() - }) - .flat_map(|x: Vec| x) + read_stream_and_create_pages(options, lines, indexed_path.0) + .map(move |x: (usize, Vec)| { + let file_line = x.1; + let page_number = x.0 + 1; + file_line + .into_iter() + .map(|fl| FileLine { + page_number, + group_key: page_number * nfiles + fl.file_id, + ..fl + }) + .collect() + }) + .flat_map(|x: Vec| x) }) .kmerge_by(|a: &FileLine, b: &FileLine| { if a.group_key == b.group_key { @@ -1039,18 +1056,19 @@ fn print_page( options: &OutputOptions, page: &usize, ) -> Result { + let line_separator = options.line_separator.as_bytes(); let page_separator = options.page_separator_char.as_bytes(); + let header: Vec = header_content(options, page); let trailer_content: Vec = trailer_content(options); - let out: &mut Stdout = &mut stdout(); - let line_separator = options.line_separator.as_bytes(); out.lock(); for x in header { out.write(x.as_bytes())?; out.write(line_separator)?; } + let lines_written = write_columns(lines, options, out)?; for index in 0..trailer_content.len() { @@ -1071,159 +1089,90 @@ fn write_columns( out: &mut Stdout, ) -> Result { let line_separator = options.content_line_separator.as_bytes(); + let content_lines_per_page = if options.double_space { options.content_lines_per_page / 2 } else { options.content_lines_per_page }; - let number_width: usize = options.number.as_ref().map(|i| i.width).unwrap_or(0); - let number_separator: String = options - .number - .as_ref() - .map(|i| i.separator.to_string()) - .unwrap_or(NumberingMode::default().separator); - - let blank_line = "".to_string(); let columns = options.merge_files_print.unwrap_or(get_columns(options)); - let def_sep = DEFAULT_COLUMN_SEPARATOR.to_string(); - let col_sep: &String = options + let line_width: Option = options.line_width; + let mut lines_printed = 0; + let feed_line_present = options.form_feed_used; + let mut not_found_break = false; + + let across_mode = options .column_mode_options .as_ref() - .map(|i| &i.column_separator) - .unwrap_or( - options - .merge_files_print - .map(|_k| &def_sep) - .unwrap_or(&blank_line), - ); + .map(|i| i.across_mode) + .unwrap_or(false); - let line_width: Option = if options.join_lines { - None - } else if columns > 1 { - options - .column_mode_options - .as_ref() - .map(|i| Some(i.width)) - .unwrap_or(Some(DEFAULT_COLUMN_WIDTH)) - } else { - options.page_width - }; - - let offset_spaces: &usize = &options.offset_spaces; - let mut lines_printed = 0; - let is_number_mode = options.number.is_some(); - let feed_line_present = options.form_feed_used; - let spaces = " ".repeat(*offset_spaces); - let mut not_found_break = false; - if options.merge_files_print.is_none() { - let across_mode = options - .column_mode_options - .as_ref() - .map(|i| i.across_mode) - .unwrap_or(false); - - let fetch_indexes: Vec> = if across_mode { - (0..content_lines_per_page) - .map(|a| (0..columns).map(|i| a * columns + i).collect()) - .collect() - } else { - (0..content_lines_per_page) - .map(|start| { - (0..columns) - .map(|i| start + content_lines_per_page * i) - .collect() - }) - .collect() - }; - for fetch_index in fetch_indexes { - let indexes = fetch_index.len(); - for i in 0..indexes { - let index: usize = fetch_index[i]; - if lines.get(index).is_none() { - not_found_break = true; - break; - } - let file_line: &FileLine = lines.get(index).unwrap(); - let trimmed_line: String = format!( - "{}{}", - spaces, - get_line_for_printing( - file_line, - &number_width, - &number_separator, - columns, - is_number_mode, - &options.merge_files_print, - &i, - line_width, - ) - ); - out.write(trimmed_line.as_bytes())?; - if (i + 1) != indexes && !options.join_lines { - out.write(col_sep.as_bytes())?; - } - lines_printed += 1; - } - if not_found_break && feed_line_present { - break; - } else { - out.write(line_separator)?; - } - } - } else { - let mut index: usize = 0; - let mut batches: Vec> = Vec::new(); + let mut filled_lines: Vec> = Vec::new(); + if options.merge_files_print.is_some() { + let mut offset: usize = 0; for col in 0..columns { - let mut batch: Vec<&FileLine> = vec![]; - for i in index..lines.len() { + let mut inserted = 0; + for i in offset..lines.len() { let line = lines.get(i).unwrap(); if line.file_id != col { break; } - batch.push(line); - index += 1; + filled_lines.push(Some(line)); + offset += 1; + inserted += 1; + } + + for _i in inserted..content_lines_per_page { + filled_lines.push(None); } - batches.push(batch); } + } - let blank_line = &&FileLine::default(); + let table: Vec>> = (0..content_lines_per_page) + .map(move |a| { + (0..columns) + .map(|i| { + if across_mode { + lines.get(a * columns + i) + } else if options.merge_files_print.is_some() { + *filled_lines + .get(content_lines_per_page * i + a) + .unwrap_or(&None) + } else { + lines.get(content_lines_per_page * i + a) + } + }) + .collect() + }) + .collect(); - for _i in 0..content_lines_per_page { - for col_index in 0..columns { - let col: Option<&Vec<&FileLine>> = batches.get(col_index); - let file_line = if col.is_some() { - let opt_file_line: Option<&&FileLine> = col.unwrap().get(_i); - opt_file_line.unwrap_or(blank_line) - } else { - blank_line - }; + let blank_line: FileLine = FileLine::default(); + for row in table { + let indexes = row.len(); + for (i, cell) in row.iter().enumerate() { + if cell.is_none() && options.merge_files_print.is_some() { + out.write( + get_line_for_printing(&options, &blank_line, columns, &i, &line_width, indexes) + .as_bytes(), + )?; + } else if cell.is_none() { + not_found_break = true; + break; + } else if cell.is_some() { + let file_line: &FileLine = cell.unwrap(); - let trimmed_line: String = format!( - "{}{}", - spaces, - get_line_for_printing( - file_line, - &number_width, - &number_separator, - columns, - is_number_mode, - &options.merge_files_print, - &col_index, - line_width, - ) - ); - out.write(trimmed_line.as_bytes())?; - if (col_index + 1) != columns && !options.join_lines { - out.write(col_sep.as_bytes())?; - } + out.write( + get_line_for_printing(&options, file_line, columns, &i, &line_width, indexes) + .as_bytes(), + )?; lines_printed += 1; } - if feed_line_present { - break; - } else { - out.write(line_separator)?; - } + } + if not_found_break && feed_line_present { + break; + } else { + out.write(line_separator)?; } } @@ -1231,72 +1180,94 @@ fn write_columns( } fn get_line_for_printing( + options: &OutputOptions, file_line: &FileLine, - number_width: &usize, - separator: &String, columns: usize, - is_number_mode: bool, - merge_files_print: &Option, index: &usize, - line_width: Option, + line_width: &Option, + indexes: usize, ) -> String { - let should_show_line_number_merge_file = - merge_files_print.is_none() || index == &usize::min_value(); - let should_show_line_number = is_number_mode && should_show_line_number_merge_file; - let fmtd_line_number: String = if should_show_line_number { - get_fmtd_line_number(&number_width, file_line.line_number, &separator) - } else { - "".to_string() - }; + // Check this condition + let blank_line = String::new(); + let fmtd_line_number: String = get_fmtd_line_number(&options, file_line.line_number, index); + let mut complete_line = format!( "{}{}", fmtd_line_number, file_line.line_content.as_ref().unwrap() ); + let offset_spaces: &String = &options.offset_spaces; + let tab_count: usize = complete_line.chars().filter(|i| i == &TAB).count(); let display_length = complete_line.len() + (tab_count * 7); - line_width - .map(|i| { - let min_width = (i - (columns - 1)) / columns; - if display_length < min_width { - for _i in 0..(min_width - display_length) { - complete_line.push(' '); - } - } - complete_line.chars().take(min_width).collect() - }) - .unwrap_or(complete_line) + let sep = if (index + 1) != indexes && !options.join_lines { + &options.col_sep_for_printing + } else { + &blank_line + }; + + format!( + "{}{}{}", + offset_spaces, + line_width + .map(|i| { + let min_width = (i - (columns - 1)) / columns; + if display_length < min_width { + for _i in 0..(min_width - display_length) { + complete_line.push(' '); + } + } + + complete_line.chars().take(min_width).collect() + }) + .unwrap_or(complete_line), + sep + ) } -fn get_fmtd_line_number(width: &usize, line_number: usize, separator: &String) -> String { - let line_str = line_number.to_string(); - if line_str.len() >= *width { - format!( - "{:>width$}{}", - &line_str[line_str.len() - *width..], - separator, - width = width - ) +fn get_fmtd_line_number(opts: &OutputOptions, line_number: usize, index: &usize) -> String { + let should_show_line_number = + opts.number.is_some() && (opts.merge_files_print.is_none() || index == &0); + if should_show_line_number && line_number != 0 { + let line_str = line_number.to_string(); + let num_opt = opts.number.as_ref().unwrap(); + let width = num_opt.width; + let separator = &num_opt.separator; + if line_str.len() >= width { + format!( + "{:>width$}{}", + &line_str[line_str.len() - width..], + separator, + width = width + ) + } else { + format!("{:>width$}{}", line_str, separator, width = width) + } } else { - format!("{:>width$}{}", line_str, separator, width = width) + String::new() } } +/// Returns a five line header content if displaying header is not disabled by +/// using `NO_HEADER_TRAILER_OPTION` option. +/// # Arguments +/// * `options` - A reference to OutputOptions +/// * `page` - A reference to page number fn header_content(options: &OutputOptions, page: &usize) -> Vec { - if options.display_header { + if options.display_header_and_trailer { let first_line: String = format!( "{} {} Page {}", options.last_modified_time, options.header, page ); vec![ - BLANK_STRING.to_string(), - BLANK_STRING.to_string(), + String::new(), + String::new(), first_line, - BLANK_STRING.to_string(), - BLANK_STRING.to_string(), + String::new(), + String::new(), ] } else { Vec::new() @@ -1318,19 +1289,18 @@ fn file_last_modified_time(path: &str) -> String { .unwrap_or(String::new()); } -fn current_time() -> String { - let datetime: DateTime = Local::now(); - datetime.format("%b %d %H:%M %Y").to_string() -} - +/// Returns five empty lines as trailer content if displaying trailer +/// is not disabled by using `NO_HEADER_TRAILER_OPTION`option. +/// # Arguments +/// * `opts` - A reference to OutputOptions fn trailer_content(options: &OutputOptions) -> Vec { - if options.as_ref().display_trailer && !options.form_feed_used { + if options.display_header_and_trailer && !options.form_feed_used { vec![ - BLANK_STRING.to_string(), - BLANK_STRING.to_string(), - BLANK_STRING.to_string(), - BLANK_STRING.to_string(), - BLANK_STRING.to_string(), + String::new(), + String::new(), + String::new(), + String::new(), + String::new(), ] } else { Vec::new() diff --git a/tests/fixtures/pr/test_num_page_less_content.log.expected b/tests/fixtures/pr/test_num_page_less_content.log.expected index a3c733e01..8cd3cf6bc 100644 --- a/tests/fixtures/pr/test_num_page_less_content.log.expected +++ b/tests/fixtures/pr/test_num_page_less_content.log.expected @@ -17,3 +17,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 837780c3253581fae12886316574a7a6c004d99c Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Mon, 21 Jan 2019 20:55:52 +0530 Subject: [PATCH 0170/1135] pr: pre PR tasks --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7433f49e6..8071e66b2 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Why? Many GNU, Linux and other utilities are useful, and obviously [some](http://gnuwin32.sourceforge.net) [effort](http://unxutils.sourceforge.net) has been spent in the past to port them to Windows. However, those projects -are written in platform-specific C, a language considered unsafe compared to Rust, and +are written in platform-specific C, a language considered unsafe compared to Rust, and have other issues. Rust provides a good, platform-agnostic way of writing systems utilities that are easy @@ -287,12 +287,12 @@ Utilities | Done | Semi-Done | To Do | |-----------|-----------|--------| | arch | cp | chcon | -| base32 | expr | dd | -| base64 | install | numfmt | -| basename | ls | pr | -| cat | more | runcon | -| chgrp | od (`--strings` and 128-bit data types missing) | stty | -| chmod | printf | | +| base32 | expr | csplit | +| base64 | install | dd | +| basename | ls | df | +| cat | more | numfmt | +| chgrp | od (`--strings` and 128-bit data types missing) | runcon | +| chmod | printf | stty | | chown | sort | | | chroot | split | | | cksum | tail | | From 75b35e600287e422c6258dbefcc4f88053bb4a23 Mon Sep 17 00:00:00 2001 From: tilakpatidar Date: Sun, 28 Apr 2019 12:51:37 +0530 Subject: [PATCH 0171/1135] pr: remove not required tests --- tests/fixtures/pr/test_num_page.log.expected | 132 ------------------ .../pr/test_num_page_less_content.log | 7 - .../test_num_page_less_content.log.expected | 66 --------- tests/test_pr.rs | 69 ++------- 4 files changed, 12 insertions(+), 262 deletions(-) delete mode 100644 tests/fixtures/pr/test_num_page.log.expected delete mode 100644 tests/fixtures/pr/test_num_page_less_content.log delete mode 100644 tests/fixtures/pr/test_num_page_less_content.log.expected diff --git a/tests/fixtures/pr/test_num_page.log.expected b/tests/fixtures/pr/test_num_page.log.expected deleted file mode 100644 index 076d3f212..000000000 --- a/tests/fixtures/pr/test_num_page.log.expected +++ /dev/null @@ -1,132 +0,0 @@ - - -{last_modified_time} test_num_page.log Page 1 - - - 1 ntation processAirPortStateChanges]: pppConnectionState 0 - 2 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 3 Mon Dec 10 11:42:56.705 Info: 802.1X changed - 4 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 5 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 6 Mon Dec 10 11:42:56.854 Info: 802.1X changed - 7 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 8 Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 9 Mon Dec 10 11:42:57.002 Info: 802.1X changed - 10 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 11 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 12 Mon Dec 10 11:42:57.152 Info: 802.1X changed - 13 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 14 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 15 Mon Dec 10 11:42:57.302 Info: 802.1X changed - 16 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 17 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 18 Mon Dec 10 11:42:57.449 Info: 802.1X changed - 19 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 20 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 21 Mon Dec 10 11:42:57.600 Info: 802.1X changed - 22 Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 23 Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 24 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 25 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 26 Mon Dec 10 11:42:57.749 Info: 802.1X changed - 27 Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 28 Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 29 Mon Dec 10 11:42:57.896 Info: 802.1X changed - 30 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 31 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 32 Mon Dec 10 11:42:58.045 Info: 802.1X changed - 33 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 34 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 35 Mon Dec 10 11:42:58.193 Info: 802.1X changed - 36 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 37 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 38 Mon Dec 10 11:42:58.342 Info: 802.1X changed - 39 Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 40 Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 41 Mon Dec 10 11:42:58.491 Info: 802.1X changed - 42 Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 43 Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 44 Mon Dec 10 11:42:58.640 Info: 802.1X changed - 45 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 46 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 47 Mon Dec 10 11:42:58.805 Info: 802.1X changed - 48 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 49 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 50 Mon Dec 10 11:42:58.958 Info: 802.1X changed - 51 Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 52 Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 53 Mon Dec 10 11:42:59.155 Info: 802.1X changed - 54 Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 55 Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 56 Mon Dec 10 11:42:59.352 Info: 802.1X changed - - - - - - - -{last_modified_time} test_num_page.log Page 2 - - - 57 ntation processAirPortStateChanges]: pppConnectionState 0 - 58 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 59 Mon Dec 10 11:42:56.705 Info: 802.1X changed - 60 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 61 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 62 Mon Dec 10 11:42:56.854 Info: 802.1X changed - 63 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 64 Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 65 Mon Dec 10 11:42:57.002 Info: 802.1X changed - 66 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 67 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 68 Mon Dec 10 11:42:57.152 Info: 802.1X changed - 69 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 70 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 71 Mon Dec 10 11:42:57.302 Info: 802.1X changed - 72 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 73 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 74 Mon Dec 10 11:42:57.449 Info: 802.1X changed - 75 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 76 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 77 Mon Dec 10 11:42:57.600 Info: 802.1X changed - 78 Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 79 Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 80 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 81 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 82 Mon Dec 10 11:42:57.749 Info: 802.1X changed - 83 Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 84 Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 85 Mon Dec 10 11:42:57.896 Info: 802.1X changed - 86 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 87 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 88 Mon Dec 10 11:42:58.045 Info: 802.1X changed - 89 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 90 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 91 Mon Dec 10 11:42:58.193 Info: 802.1X changed - 92 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 93 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 94 Mon Dec 10 11:42:58.342 Info: 802.1X changed - 95 Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 96 Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 97 Mon Dec 10 11:42:58.491 Info: 802.1X changed - 98 Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 99 Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 100 Mon Dec 10 11:42:58.640 Info: 802.1X changed - 101 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 102 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 103 Mon Dec 10 11:42:58.805 Info: 802.1X changed - 104 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 105 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 106 Mon Dec 10 11:42:58.958 Info: 802.1X changed - 107 Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 108 Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 109 Mon Dec 10 11:42:59.155 Info: 802.1X changed - 110 Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 111 Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 112 Mon Dec 10 11:42:59.352 Info: 802.1X changed - - - - - diff --git a/tests/fixtures/pr/test_num_page_less_content.log b/tests/fixtures/pr/test_num_page_less_content.log deleted file mode 100644 index cf13a6862..000000000 --- a/tests/fixtures/pr/test_num_page_less_content.log +++ /dev/null @@ -1,7 +0,0 @@ -ntation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:56.705 Info: 802.1X changed -Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 -Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:56.854 Info: 802.1X changed -Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 \ No newline at end of file diff --git a/tests/fixtures/pr/test_num_page_less_content.log.expected b/tests/fixtures/pr/test_num_page_less_content.log.expected deleted file mode 100644 index 8cd3cf6bc..000000000 --- a/tests/fixtures/pr/test_num_page_less_content.log.expected +++ /dev/null @@ -1,66 +0,0 @@ - - -{last_modified_time} test_num_page_less_content.log Page 1 - - - 1 ntation processAirPortStateChanges]: pppConnectionState 0 - 2 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 3 Mon Dec 10 11:42:56.705 Info: 802.1X changed - 4 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - 5 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars - 6 Mon Dec 10 11:42:56.854 Info: 802.1X changed - 7 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_pr.rs b/tests/test_pr.rs index b4ff61ed7..61b9a647c 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -40,36 +40,6 @@ fn test_without_any_options() { ); } -#[test] -fn test_with_numbering_option() { - let test_file_path = "test_num_page.log"; - let expected_test_file_path = "test_num_page.log.expected"; - let mut scenario = new_ucmd!(); - let value = file_last_modified_time(&scenario, test_file_path); - scenario - .args(&["-n", test_file_path]) - .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); -} - -#[test] -fn test_with_numbering_option_when_content_is_less_than_page() { - let test_file_path = "test_num_page_less_content.log"; - let expected_test_file_path = "test_num_page_less_content.log.expected"; - let mut scenario = new_ucmd!(); - let value = file_last_modified_time(&scenario, test_file_path); - scenario - .args(&["-n", test_file_path]) - .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); -} - #[test] fn test_with_numbering_option_with_number_width() { let test_file_path = "test_num_page.log"; @@ -85,25 +55,6 @@ fn test_with_numbering_option_with_number_width() { ); } -#[test] -fn test_with_header_option() { - let test_file_path = "test_one_page.log"; - let expected_test_file_path = "test_one_page_header.log.expected"; - let mut scenario = new_ucmd!(); - let value = file_last_modified_time(&scenario, test_file_path); - let header = "new file"; - scenario - .args(&["-h", header, test_file_path]) - .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![ - (&"{last_modified_time}".to_string(), &value), - (&"{header}".to_string(), &header.to_string()), - ], - ); -} - #[test] fn test_with_long_header_option() { let test_file_path = "test_one_page.log"; @@ -121,6 +72,17 @@ fn test_with_long_header_option() { (&"{header}".to_string(), &header.to_string()), ], ); + + new_ucmd!() + .args(&["-h", header, test_file_path]) + .succeeds() + .stdout_is_templated_fixture( + expected_test_file_path, + vec![ + (&"{last_modified_time}".to_string(), &value), + (&"{header}".to_string(), &header.to_string()), + ], + ); } #[test] @@ -136,15 +98,8 @@ fn test_with_double_space_option() { expected_test_file_path, vec![(&"{last_modified_time}".to_string(), &value)], ); -} -#[test] -fn test_with_long_double_space_option() { - let test_file_path = "test_one_page.log"; - let expected_test_file_path = "test_one_page_double_line.log.expected"; - let mut scenario = new_ucmd!(); - let value = file_last_modified_time(&scenario, test_file_path); - scenario + new_ucmd!() .args(&["--double-space", test_file_path]) .succeeds() .stdout_is_templated_fixture( From 62fe68850e185672de62f63df79a97dce3be5083 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Fri, 26 Mar 2021 10:35:51 +0300 Subject: [PATCH 0172/1135] pr: Fixes after rebasing Only the minimum needed to: * Make everything compile without warnings * Move files according to the new project structure * Make tests pass --- Cargo.lock | 22 +++++++++++-- Cargo.toml | 3 +- README.md | 2 +- src/pr/Cargo.toml | 28 ---------------- src/uu/pr/Cargo.toml | 33 +++++++++++++++++++ src/uu/pr/src/main.rs | 1 + src/{pr => uu/pr/src}/pr.rs | 30 +++++++---------- tests/{ => by-util}/test_pr.rs | 13 ++++---- .../pr/test_one_page_no_ht.log.expected | 3 +- 9 files changed, 76 insertions(+), 59 deletions(-) delete mode 100644 src/pr/Cargo.toml create mode 100644 src/uu/pr/Cargo.toml create mode 100644 src/uu/pr/src/main.rs rename src/{pr => uu/pr/src}/pr.rs (98%) rename tests/{ => by-util}/test_pr.rs (98%) diff --git a/Cargo.lock b/Cargo.lock index 4851a6e13..4f61fb1b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -182,6 +182,7 @@ dependencies = [ name = "coreutils" version = "0.0.4" dependencies = [ + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -251,6 +252,7 @@ dependencies = [ "uu_paste 0.0.4", "uu_pathchk 0.0.4", "uu_pinky 0.0.4", + "uu_pr 0.0.4", "uu_printenv 0.0.4", "uu_printf 0.0.4", "uu_ptx 0.0.4", @@ -441,7 +443,7 @@ dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -712,7 +714,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "memoffset" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1884,6 +1886,20 @@ dependencies = [ "uucore_procs 0.0.5", ] +[[package]] +name = "uu_pr" +version = "0.0.4" +dependencies = [ + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", +] + [[package]] name = "uu_printenv" version = "0.0.4" @@ -2530,7 +2546,7 @@ dependencies = [ "checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" "checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" -"checksum memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" +"checksum memoffset 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cc14fc54a812b4472b4113facc3e44d099fbc0ea2ce0551fa5c703f8edfbfd38" "checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" "checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" "checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" diff --git a/Cargo.toml b/Cargo.toml index 8afd36761..1bd559763 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -286,7 +286,7 @@ od = { optional=true, version="0.0.4", package="uu_od", path="src/uu/od" } paste = { optional=true, version="0.0.4", package="uu_paste", path="src/uu/paste" } pathchk = { optional=true, version="0.0.4", package="uu_pathchk", path="src/uu/pathchk" } pinky = { optional=true, version="0.0.4", package="uu_pinky", path="src/uu/pinky" } -pr = { optional=true, path="src/pr" } +pr = { optional=true, version="0.0.4", package="uu_pr", path="src/uu/pr" } printenv = { optional=true, version="0.0.4", package="uu_printenv", path="src/uu/printenv" } printf = { optional=true, version="0.0.4", package="uu_printf", path="src/uu/printf" } ptx = { optional=true, version="0.0.4", package="uu_ptx", path="src/uu/ptx" } @@ -332,6 +332,7 @@ yes = { optional=true, version="0.0.4", package="uu_yes", path="src/uu/yes" #pin_cc = { version="1.0.61, < 1.0.62", package="cc" } ## cc v1.0.62 has compiler errors for MinRustV v1.32.0, requires 1.34 (for `std::str::split_ascii_whitespace()`) [dev-dependencies] +chrono = "0.4.11" conv = "0.3" filetime = "0.2" glob = "0.3.0" diff --git a/README.md b/README.md index 8071e66b2..f292b7184 100644 --- a/README.md +++ b/README.md @@ -301,7 +301,7 @@ Utilities | cut | join | | | dircolors | df | | | dirname | tac | | -| du | | | +| du | pr | | | echo | | | | env | | | | expand | | | diff --git a/src/pr/Cargo.toml b/src/pr/Cargo.toml deleted file mode 100644 index 481404b3a..000000000 --- a/src/pr/Cargo.toml +++ /dev/null @@ -1,28 +0,0 @@ -[package] -name = "pr" -version = "0.0.1" -authors = ["Tilak Patidar "] -build = "../../mkmain.rs" - -[lib] -name = "uu_pr" -path = "pr.rs" - -[dependencies] -getopts = "0.2.18" -time = "0.1.40" -chrono = "0.4.6" -quick-error = "1.2.2" -itertools = "0.7.8" -regex = "1.0.1" - -[dependencies.uucore] -path = "../uucore" -features = ["libc"] - -[target.'cfg(unix)'.dependencies] -unix_socket = "0.5.0" - -[[bin]] -name = "pr" -path = "../../uumain.rs" diff --git a/src/uu/pr/Cargo.toml b/src/uu/pr/Cargo.toml new file mode 100644 index 000000000..2eb8a03fe --- /dev/null +++ b/src/uu/pr/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "uu_pr" +version = "0.0.4" +authors = ["uutils developers"] +license = "MIT" +description = "pr ~ (uutils) convert text files for printing" + +homepage = "https://github.com/uutils/coreutils" +repository = "https://github.com/uutils/coreutils/tree/master/src/uu/pinky" +keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"] +categories = ["command-line-utilities"] +edition = "2018" + +[lib] +path = "src/pr.rs" + +[dependencies] +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["utmpx", "entries"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +getopts = "0.2.21" +time = "0.1.41" +# A higher version would cause a conflict with time +chrono = "0.4.11" +quick-error = "1.2.3" +itertools = "0.10" +regex = "1.0" + +#[target.'cfg(unix)'.dependencies] +#unix_socket = "0.5.0" + +[[bin]] +name = "pr" +path = "src/main.rs" diff --git a/src/uu/pr/src/main.rs b/src/uu/pr/src/main.rs new file mode 100644 index 000000000..893145c3e --- /dev/null +++ b/src/uu/pr/src/main.rs @@ -0,0 +1 @@ +uucore_procs::main!(uu_pr); // spell-checker:ignore procs uucore diff --git a/src/pr/pr.rs b/src/uu/pr/src/pr.rs similarity index 98% rename from src/pr/pr.rs rename to src/uu/pr/src/pr.rs index ca35b6c1c..73386eaf0 100644 --- a/src/pr/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -6,15 +6,8 @@ // that was distributed with this source code. // -#[cfg(unix)] -extern crate unix_socket; #[macro_use] extern crate quick_error; -extern crate chrono; -extern crate getopts; -extern crate itertools; -extern crate regex; -extern crate uucore; use chrono::offset::Local; use chrono::DateTime; @@ -26,7 +19,7 @@ use quick_error::ResultExt; use regex::Regex; use std::convert::From; use std::fs::{metadata, File, Metadata}; -use std::io::{stderr, stdin, stdout, BufRead, BufReader, Lines, Read, Stdin, Stdout, Write}; +use std::io::{stdin, stdout, BufRead, BufReader, Lines, Read, Stdin, Stdout, Write}; use std::iter::{FlatMap, Map}; use std::num::ParseIntError; #[cfg(unix)] @@ -185,7 +178,8 @@ quick_error! { } } -pub fn uumain(args: Vec) -> i32 { +pub fn uumain(args: impl uucore::Args) -> i32 { + let args = args.collect_str(); let mut opts = getopts::Options::new(); opts.opt( @@ -482,7 +476,7 @@ fn recreate_arguments(args: &Vec) -> Vec { fn print_error(matches: &Matches, err: PrError) { if !matches.opt_present(SUPPRESS_PRINTING_ERROR) { - writeln!(&mut stderr(), "{}", err); + eprintln!("{}", err); } } @@ -838,10 +832,10 @@ fn build_options( }) } -fn open(path: &str) -> Result, PrError> { +fn open(path: &str) -> Result, PrError> { if path == FILE_STDIN { let stdin: Stdin = stdin(); - return Ok(Box::new(stdin) as Box); + return Ok(Box::new(stdin) as Box); } metadata(path) @@ -858,7 +852,7 @@ fn open(path: &str) -> Result, PrError> { ft if ft.is_socket() => Err(PrError::IsSocket(path_string)), ft if ft.is_dir() => Err(PrError::IsDirectory(path_string)), ft if ft.is_file() || ft.is_symlink() => { - Ok(Box::new(File::open(path).context(path)?) as Box) + Ok(Box::new(File::open(path).context(path)?) as Box) } _ => Err(PrError::UnknownFiletype(path_string)), } @@ -907,10 +901,10 @@ fn split_lines_if_form_feed(file_content: Result) -> Vec Result { - let lines: Lines>> = + let lines: Lines>> = BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?).lines(); - let pages: Box)>> = + let pages: Box)>> = read_stream_and_create_pages(options, lines, 0); for page_with_page_number in pages { @@ -923,9 +917,9 @@ fn pr(path: &String, options: &OutputOptions) -> Result { fn read_stream_and_create_pages( options: &OutputOptions, - lines: Lines>>, + lines: Lines>>, file_id: usize, -) -> Box)>> { +) -> Box)>> { let start_page: usize = options.start_page; let start_line_number: usize = get_start_line_number(options); let last_page: Option = options.end_page; @@ -994,7 +988,7 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { let file_line_groups: GroupBy< usize, - KMergeBy)>>, _>, _, _>, _>, + KMergeBy)>>, _>, _, _>, _>, _, > = paths .iter() diff --git a/tests/test_pr.rs b/tests/by-util/test_pr.rs similarity index 98% rename from tests/test_pr.rs rename to tests/by-util/test_pr.rs index 61b9a647c..1cd8fbdc8 100644 --- a/tests/test_pr.rs +++ b/tests/by-util/test_pr.rs @@ -1,9 +1,7 @@ -extern crate chrono; - -use common::util::*; +use crate::common::util::*; use std::fs::metadata; -use test_pr::chrono::offset::Local; -use test_pr::chrono::DateTime; +use chrono::offset::Local; +use chrono::DateTime; fn file_last_modified_time(ucmd: &UCommand, path: &str) -> String { let tmp_dir_path = ucmd.get_full_fixture_path(path); @@ -243,10 +241,11 @@ fn test_with_no_header_trailer_option() { let test_file_path = "test_one_page.log"; let expected_test_file_path = "test_one_page_no_ht.log.expected"; let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); scenario .args(&["-t", test_file_path]) .succeeds() - .stdout_is_fixture(expected_test_file_path); + .stdout_is_templated_fixture(expected_test_file_path, vec![(&"{last_modified_time}".to_string(), &value)]); } #[test] @@ -480,7 +479,7 @@ fn test_with_pr_core_utils_tests() { arguments.extend(input_file.clone()); - let mut scenario_with_args = scenario.args(&arguments); + let scenario_with_args = scenario.args(&arguments); let scenario_with_expected_status = if return_code == 0 { scenario_with_args.succeeds() diff --git a/tests/fixtures/pr/test_one_page_no_ht.log.expected b/tests/fixtures/pr/test_one_page_no_ht.log.expected index 3d5131358..2abea9890 100644 --- a/tests/fixtures/pr/test_one_page_no_ht.log.expected +++ b/tests/fixtures/pr/test_one_page_no_ht.log.expected @@ -53,4 +53,5 @@ Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementati Mon Dec 10 11:42:59.155 Info: 802.1X changed Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars -Mon Dec 10 11:42:59.352 Info: 802.1X changed \ No newline at end of file +Mon Dec 10 11:42:59.352 Info: 802.1X changed + From bc2b385744e045d5f5499e0c8c4c44be0ae649d6 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Fri, 26 Mar 2021 17:16:05 +0300 Subject: [PATCH 0173/1135] pr: Fix a bunch of Clippy problems --- src/uu/pr/src/pr.rs | 119 +++++++++++++++++++++++--------------------- 1 file changed, 63 insertions(+), 56 deletions(-) diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index 73386eaf0..81a3dfe9a 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -437,7 +437,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return status; } } - return 0; + + 0 } /// Returns re-written arguments which are passed to the program. @@ -447,7 +448,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { fn recreate_arguments(args: &Vec) -> Vec { let column_page_option = Regex::new(r"^[-+]\d+.*").unwrap(); let num_regex: Regex = Regex::new(r"(.\d+)|(\d+)|^[^-]$").unwrap(); - let a_file: Regex = Regex::new(r"^[^-+].*").unwrap(); + //let a_file: Regex = Regex::new(r"^[^-+].*").unwrap(); let n_regex: Regex = Regex::new(r"^-n\s*$").unwrap(); let mut arguments = args.clone(); let num_option: Option<(usize, &String)> = @@ -455,23 +456,24 @@ fn recreate_arguments(args: &Vec) -> Vec { if num_option.is_some() { let (pos, _value) = num_option.unwrap(); let num_val_opt = args.get(pos + 1); - if num_val_opt.is_some() { - if !num_regex.is_match(num_val_opt.unwrap()) { - let could_be_file = arguments.remove(pos + 1); - arguments.insert(pos + 1, format!("{}", NumberingMode::default().width)); - if a_file.is_match(could_be_file.trim().as_ref()) { - arguments.insert(pos + 2, could_be_file); - } else { - arguments.insert(pos + 2, could_be_file); - } - } + if num_val_opt.is_some() && !num_regex.is_match(num_val_opt.unwrap()) { + let could_be_file = arguments.remove(pos + 1); + arguments.insert(pos + 1, format!("{}", NumberingMode::default().width)); + // FIXME: the following line replaces the block below that had the same + // code for both conditional branches. Figure this out. + arguments.insert(pos + 2, could_be_file); + // if a_file.is_match(could_be_file.trim().as_ref()) { + // arguments.insert(pos + 2, could_be_file); + // } else { + // arguments.insert(pos + 2, could_be_file); + // } } } - return arguments + arguments .into_iter() .filter(|i| !column_page_option.is_match(i)) - .collect(); + .collect() } fn print_error(matches: &Matches, err: PrError) { @@ -520,7 +522,8 @@ fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { if matches.free.is_empty() { return 1; } - return 0; + + 0 } fn parse_usize(matches: &Matches, opt: &str) -> Option> { @@ -570,7 +573,7 @@ fn build_options( .unwrap_or(if is_merge_mode { String::new() } else { - if paths[0].to_string() == FILE_STDIN { + if paths[0] == FILE_STDIN { String::new() } else { paths[0].to_string() @@ -610,7 +613,8 @@ fn build_options( if matches.opt_present(NUMBERING_MODE_OPTION) { return Some(NumberingMode::default()); } - return None; + + None }); let double_space: bool = matches.opt_present(DOUBLE_SPACE_OPTION); @@ -634,7 +638,7 @@ fn build_options( let page_plus_re = Regex::new(r"\s*\+(\d+:*\d*)\s*").unwrap(); let start_page_in_plus_option: usize = match page_plus_re.captures(&free_args).map(|i| { let unparsed_num = i.get(1).unwrap().as_str().trim(); - let x: Vec<&str> = unparsed_num.split(":").collect(); + let x: Vec<&str> = unparsed_num.split(':').collect(); x[0].to_string().parse::().map_err(|_e| { PrError::EncounteredErrors(format!("invalid {} argument '{}'", "+", unparsed_num)) }) @@ -646,9 +650,9 @@ fn build_options( let end_page_in_plus_option: Option = match page_plus_re .captures(&free_args) .map(|i| i.get(1).unwrap().as_str().trim()) - .filter(|i| i.contains(":")) + .filter(|i| i.contains(':')) .map(|unparsed_num| { - let x: Vec<&str> = unparsed_num.split(":").collect(); + let x: Vec<&str> = unparsed_num.split(':').collect(); x[1].to_string().parse::().map_err(|_e| { PrError::EncounteredErrors(format!("invalid {} argument '{}'", "+", unparsed_num)) }) @@ -667,7 +671,7 @@ fn build_options( let start_page: usize = match matches .opt_str(PAGE_RANGE_OPTION) .map(|i| { - let x: Vec<&str> = i.split(":").collect(); + let x: Vec<&str> = i.split(':').collect(); x[0].to_string() }) .map(invalid_pages_map) @@ -678,9 +682,9 @@ fn build_options( let end_page: Option = match matches .opt_str(PAGE_RANGE_OPTION) - .filter(|i: &String| i.contains(":")) + .filter(|i: &String| i.contains(':')) .map(|i: String| { - let x: Vec<&str> = i.split(":").collect(); + let x: Vec<&str> = i.split(':').collect(); x[1].to_string() }) .map(invalid_pages_map) @@ -885,7 +889,7 @@ fn split_lines_if_form_feed(file_content: Result) -> Vec) -> Vec Result { +fn pr(path: &str, options: &OutputOptions) -> Result { let lines: Lines>> = BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?).lines(); @@ -910,9 +914,10 @@ fn pr(path: &String, options: &OutputOptions) -> Result { for page_with_page_number in pages { let page_number = page_with_page_number.0 + 1; let page = page_with_page_number.1; - print_page(&page, options, &page_number)?; + print_page(&page, options, page_number)?; } - return Ok(0); + + Ok(0) } fn read_stream_and_create_pages( @@ -925,10 +930,10 @@ fn read_stream_and_create_pages( let last_page: Option = options.end_page; let lines_needed_per_page: usize = lines_to_read_for_page(options); - return Box::new( + Box::new( lines .map(split_lines_if_form_feed) - .flat_map(|i: Vec| i) + .flatten() .enumerate() .map(move |i: (usize, FileLine)| FileLine { line_number: i.0 + start_line_number, @@ -956,26 +961,28 @@ fn read_stream_and_create_pages( } } - if first_page.len() == 0 { + if first_page.is_empty() { return None; } page_with_lines.push(first_page); - return Some(page_with_lines); + Some(page_with_lines) }) // Create set of pages as form feeds could lead to empty pages - .flat_map(|x| x) // Flatten to pages from page sets + .flatten() // Flatten to pages from page sets .enumerate() // Assign page number .skip_while(move |x: &(usize, Vec)| { // Skip the not needed pages let current_page = x.0 + 1; - return current_page < start_page; + + current_page < start_page }) .take_while(move |x: &(usize, Vec)| { // Take only the required pages let current_page = x.0 + 1; - return current_page >= start_page - && (last_page.is_none() || current_page <= last_page.unwrap()); + + current_page >= start_page + && (last_page.is_none() || current_page <= last_page.unwrap()) }), - ); + ) } fn mpr(paths: &Vec, options: &OutputOptions) -> Result { @@ -1021,9 +1028,9 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { }) .group_by(|file_line: &FileLine| file_line.group_key); - let start_page: &usize = &options.start_page; + let start_page: usize = options.start_page; let mut lines: Vec = Vec::new(); - let mut page_counter: usize = *start_page; + let mut page_counter = start_page; for (_key, file_line_group) in file_line_groups.into_iter() { for file_line in file_line_group { @@ -1032,7 +1039,7 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { } let new_page_number = file_line.page_number; if page_counter != new_page_number { - print_page(&lines, options, &page_counter)?; + print_page(&lines, options, page_counter)?; lines = Vec::new(); page_counter = new_page_number; } @@ -1040,15 +1047,15 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { } } - print_page(&lines, options, &page_counter)?; + print_page(&lines, options, page_counter)?; - return Ok(0); + Ok(0) } fn print_page( lines: &Vec, options: &OutputOptions, - page: &usize, + page: usize, ) -> Result { let line_separator = options.line_separator.as_bytes(); let page_separator = options.page_separator_char.as_bytes(); @@ -1059,20 +1066,20 @@ fn print_page( out.lock(); for x in header { - out.write(x.as_bytes())?; - out.write(line_separator)?; + out.write_all(x.as_bytes())?; + out.write_all(line_separator)?; } let lines_written = write_columns(lines, options, out)?; for index in 0..trailer_content.len() { let x: &String = trailer_content.get(index).unwrap(); - out.write(x.as_bytes())?; + out.write_all(x.as_bytes())?; if index + 1 != trailer_content.len() { - out.write(line_separator)?; + out.write_all(line_separator)?; } } - out.write(page_separator)?; + out.write_all(page_separator)?; out.flush()?; Ok(lines_written) } @@ -1146,8 +1153,8 @@ fn write_columns( let indexes = row.len(); for (i, cell) in row.iter().enumerate() { if cell.is_none() && options.merge_files_print.is_some() { - out.write( - get_line_for_printing(&options, &blank_line, columns, &i, &line_width, indexes) + out.write_all( + get_line_for_printing(&options, &blank_line, columns, i, &line_width, indexes) .as_bytes(), )?; } else if cell.is_none() { @@ -1156,8 +1163,8 @@ fn write_columns( } else if cell.is_some() { let file_line: &FileLine = cell.unwrap(); - out.write( - get_line_for_printing(&options, file_line, columns, &i, &line_width, indexes) + out.write_all( + get_line_for_printing(&options, file_line, columns, i, &line_width, indexes) .as_bytes(), )?; lines_printed += 1; @@ -1166,7 +1173,7 @@ fn write_columns( if not_found_break && feed_line_present { break; } else { - out.write(line_separator)?; + out.write_all(line_separator)?; } } @@ -1177,7 +1184,7 @@ fn get_line_for_printing( options: &OutputOptions, file_line: &FileLine, columns: usize, - index: &usize, + index: usize, line_width: &Option, indexes: usize, ) -> String { @@ -1222,9 +1229,9 @@ fn get_line_for_printing( ) } -fn get_fmtd_line_number(opts: &OutputOptions, line_number: usize, index: &usize) -> String { +fn get_fmtd_line_number(opts: &OutputOptions, line_number: usize, index: usize) -> String { let should_show_line_number = - opts.number.is_some() && (opts.merge_files_print.is_none() || index == &0); + opts.number.is_some() && (opts.merge_files_print.is_none() || index == 0); if should_show_line_number && line_number != 0 { let line_str = line_number.to_string(); let num_opt = opts.number.as_ref().unwrap(); @@ -1250,7 +1257,7 @@ fn get_fmtd_line_number(opts: &OutputOptions, line_number: usize, index: &usize) /// # Arguments /// * `options` - A reference to OutputOptions /// * `page` - A reference to page number -fn header_content(options: &OutputOptions, page: &usize) -> Vec { +fn header_content(options: &OutputOptions, page: usize) -> Vec { if options.display_header_and_trailer { let first_line: String = format!( "{} {} Page {}", From 9e759267ee8215fd34b5bd1ecc6e1675fcd71d7a Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Fri, 26 Mar 2021 18:19:52 +0300 Subject: [PATCH 0174/1135] pr: Remove commented out stuff from Cargo.toml --- src/uu/pr/Cargo.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/uu/pr/Cargo.toml b/src/uu/pr/Cargo.toml index 2eb8a03fe..0a86d3ac8 100644 --- a/src/uu/pr/Cargo.toml +++ b/src/uu/pr/Cargo.toml @@ -25,9 +25,6 @@ quick-error = "1.2.3" itertools = "0.10" regex = "1.0" -#[target.'cfg(unix)'.dependencies] -#unix_socket = "0.5.0" - [[bin]] name = "pr" path = "src/main.rs" From 83f8140aafe80a9683eb008362caedef87edd831 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Fri, 26 Mar 2021 19:26:37 +0300 Subject: [PATCH 0175/1135] cat: move cat to clap (#1910) --- src/uu/cat/Cargo.toml | 1 + src/uu/cat/src/cat.rs | 142 ++++++++++++++++++++++++++++++++---------- 2 files changed, 109 insertions(+), 34 deletions(-) diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 415477588..b6254cf6b 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/cat.rs" [dependencies] +clap = "2.33" quick-error = "1.2.3" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index 0a35e243b..cf5a384a4 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -17,6 +17,7 @@ extern crate unix_socket; extern crate uucore; // last synced with: cat (GNU coreutils) 8.13 +use clap::{App, Arg}; use quick_error::ResultExt; use std::fs::{metadata, File}; use std::io::{self, stderr, stdin, stdout, BufWriter, Read, Write}; @@ -30,10 +31,11 @@ use std::os::unix::fs::FileTypeExt; #[cfg(unix)] use unix_socket::UnixStream; +static NAME: &str = "cat"; +static VERSION: &str = env!("CARGO_PKG_VERSION"); static SYNTAX: &str = "[OPTION]... [FILE]..."; static SUMMARY: &str = "Concatenate FILE(s), or standard input, to standard output With no FILE, or when FILE is -, read standard input."; -static LONG_HELP: &str = ""; #[derive(PartialEq)] enum NumberingMode { @@ -124,50 +126,122 @@ enum InputType { type CatResult = Result; +mod options { + pub static FILE: &str = "file"; + pub static SHOW_ALL: &str = "show-all"; + pub static NUMBER_NONBLANK: &str = "number-nonblank"; + pub static SHOW_NONPRINTING_ENDS: &str = "e"; + pub static SHOW_ENDS: &str = "show-ends"; + pub static NUMBER: &str = "number"; + pub static SQUEEZE_BLANK: &str = "squeeze-blank"; + pub static SHOW_NONPRINTING_TABS: &str = "t"; + pub static SHOW_TABS: &str = "show-tabs"; + pub static SHOW_NONPRINTING: &str = "show-nonprinting"; +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optflag("A", "show-all", "equivalent to -vET") - .optflag( - "b", - "number-nonblank", - "number nonempty output lines, overrides -n", + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(SYNTAX) + .about(SUMMARY) + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) + .arg( + Arg::with_name(options::SHOW_ALL) + .short("A") + .long(options::SHOW_ALL) + .help("equivalent to -vET"), ) - .optflag("e", "", "equivalent to -vE") - .optflag("E", "show-ends", "display $ at end of each line") - .optflag("n", "number", "number all output lines") - .optflag("s", "squeeze-blank", "suppress repeated empty output lines") - .optflag("t", "", "equivalent to -vT") - .optflag("T", "show-tabs", "display TAB characters as ^I") - .optflag( - "v", - "show-nonprinting", - "use ^ and M- notation, except for LF (\\n) and TAB (\\t)", + .arg( + Arg::with_name(options::NUMBER_NONBLANK) + .short("b") + .long(options::NUMBER_NONBLANK) + .help("number nonempty output lines, overrides -n") + .overrides_with(options::NUMBER), ) - .parse(args); + .arg( + Arg::with_name(options::SHOW_NONPRINTING_ENDS) + .short("e") + .help("equivalent to -vE"), + ) + .arg( + Arg::with_name(options::SHOW_ENDS) + .short("E") + .long(options::SHOW_ENDS) + .help("display $ at end of each line"), + ) + .arg( + Arg::with_name(options::NUMBER) + .short("n") + .long(options::NUMBER) + .help("number all output lines"), + ) + .arg( + Arg::with_name(options::SQUEEZE_BLANK) + .short("s") + .long(options::SQUEEZE_BLANK) + .help("suppress repeated empty output lines"), + ) + .arg( + Arg::with_name(options::SHOW_NONPRINTING_TABS) + .short("t") + .long(options::SHOW_NONPRINTING_TABS) + .help("equivalent to -vT"), + ) + .arg( + Arg::with_name(options::SHOW_TABS) + .short("T") + .long(options::SHOW_TABS) + .help("display TAB characters at ^I"), + ) + .arg( + Arg::with_name(options::SHOW_NONPRINTING) + .short("v") + .long(options::SHOW_NONPRINTING) + .help("use ^ and M- notation, except for LF (\\n) and TAB (\\t)"), + ) + .get_matches_from(args); - let number_mode = if matches.opt_present("b") { + let number_mode = if matches.is_present(options::NUMBER_NONBLANK) { NumberingMode::NonEmpty - } else if matches.opt_present("n") { + } else if matches.is_present(options::NUMBER) { NumberingMode::All } else { NumberingMode::None }; - let show_nonprint = matches.opts_present(&[ - "A".to_owned(), - "e".to_owned(), - "t".to_owned(), - "v".to_owned(), - ]); - let show_ends = matches.opts_present(&["E".to_owned(), "A".to_owned(), "e".to_owned()]); - let show_tabs = matches.opts_present(&["A".to_owned(), "T".to_owned(), "t".to_owned()]); - let squeeze_blank = matches.opt_present("s"); - let mut files = matches.free; - if files.is_empty() { - files.push("-".to_owned()); - } + let show_nonprint = vec![ + options::SHOW_ALL.to_owned(), + options::SHOW_NONPRINTING_ENDS.to_owned(), + options::SHOW_NONPRINTING_TABS.to_owned(), + options::SHOW_NONPRINTING.to_owned(), + ] + .iter() + .any(|v| matches.is_present(v)); + + let show_ends = vec![ + options::SHOW_ENDS.to_owned(), + options::SHOW_ALL.to_owned(), + options::SHOW_NONPRINTING_ENDS.to_owned(), + ] + .iter() + .any(|v| matches.is_present(v)); + + let show_tabs = vec![ + options::SHOW_ALL.to_owned(), + options::SHOW_TABS.to_owned(), + options::SHOW_NONPRINTING_TABS.to_owned(), + ] + .iter() + .any(|v| matches.is_present(v)); + + let squeeze_blank = matches.is_present(options::SQUEEZE_BLANK); + let files: Vec = match matches.values_of(options::FILE) { + Some(v) => v.clone().map(|v| v.to_owned()).collect(), + None => vec!["-".to_owned()], + }; let can_write_fast = !(show_tabs || show_nonprint @@ -361,7 +435,7 @@ fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState } writer.write_all(options.end_of_line.as_bytes())?; if handle.is_interactive { - writer.flush().context(&file[..])?; + writer.flush().context(file)?; } } state.at_line_start = true; From 955c547adffda3546ab6b9fb58d7d508f439eb3f Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 26 Mar 2021 19:12:01 +0100 Subject: [PATCH 0176/1135] ls: overrideable `-n` option (#1917) --- src/uu/ls/src/ls.rs | 87 +++++++++++++++++++--------------------- tests/by-util/test_ls.rs | 61 ++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 45 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 8714a0fa1..201ddc7a6 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -84,6 +84,7 @@ pub mod options { pub static COMMAS: &str = "m"; pub static LONG_NO_OWNER: &str = "g"; pub static LONG_NO_GROUP: &str = "o"; + pub static LONG_NUMERIC_UID_GID: &str = "numeric-uid-gid"; } pub mod files { pub static ALL: &str = "all"; @@ -114,7 +115,6 @@ pub mod options { pub static CLASSIFY: &str = "classify"; pub static INODE: &str = "inode"; pub static DEREFERENCE: &str = "dereference"; - pub static NUMERIC_UID_GID: &str = "numeric-uid-gid"; pub static REVERSE: &str = "reverse"; pub static RECURSIVE: &str = "recursive"; pub static COLOR: &str = "color"; @@ -167,7 +167,6 @@ struct Config { classify: bool, ignore_backups: bool, size_format: SizeFormat, - numeric_uid_gid: bool, directory: bool, time: Time, #[cfg(unix)] @@ -183,6 +182,8 @@ struct LongFormat { author: bool, group: bool, owner: bool, + #[cfg(unix)] + numeric_uid_gid: bool, } impl Config { @@ -210,7 +211,7 @@ impl Config { (Format::Columns, options::format::COLUMNS) }; - // The -o and -g options are tricky. They cannot override with each + // The -o, -n and -g options are tricky. They cannot override with each // other because it's possible to combine them. For example, the option // -og should hide both owner and group. Furthermore, they are not // reset if -l or --format=long is used. So these should just show the @@ -223,42 +224,26 @@ impl Config { // which always applies. // // The idea here is to not let these options override with the other - // options, but manually check the last index they occur. If this index - // is larger than the index for the other format options, we apply the - // long format. - match options.indices_of(opt).map(|x| x.max().unwrap()) { - None => { - if options.is_present(options::format::LONG_NO_GROUP) - || options.is_present(options::format::LONG_NO_OWNER) - { - format = Format::Long; - } else if options.is_present(options::format::ONELINE) { - format = Format::OneLine; - } - } - Some(mut idx) => { - if let Some(indices) = options.indices_of(options::format::LONG_NO_OWNER) { - let i = indices.max().unwrap(); - if i > idx { - format = Format::Long; - idx = i; - } - } - if let Some(indices) = options.indices_of(options::format::LONG_NO_GROUP) { - let i = indices.max().unwrap(); - if i > idx { - format = Format::Long; - idx = i; - } - } - if let Some(indices) = options.indices_of(options::format::ONELINE) { - let i = indices.max().unwrap(); - if i > idx && format != Format::Long { + // options, but manually whether they have an index that's greater than + // the other format options. If so, we set the appropriate format. + if format != Format::Long { + let idx = options.indices_of(opt).map(|x| x.max().unwrap()).unwrap_or(0); + if [options::format::LONG_NO_OWNER, options::format::LONG_NO_GROUP, options::format::LONG_NUMERIC_UID_GID] + .iter() + .flat_map(|opt| options.indices_of(opt)) + .flatten() + .any(|i| i >= idx) + { + format = Format::Long; + } else { + if let Some(mut indices) = options.indices_of(options::format::ONELINE) { + if indices.any(|i| i > idx) { format = Format::OneLine; } } } } + let files = if options.is_present(options::files::ALL) { Files::All @@ -328,10 +313,14 @@ impl Config { let group = !options.is_present(options::NO_GROUP) && !options.is_present(options::format::LONG_NO_GROUP); let owner = !options.is_present(options::format::LONG_NO_OWNER); + #[cfg(unix)] + let numeric_uid_gid = options.is_present(options::format::LONG_NUMERIC_UID_GID); LongFormat { author, group, owner, + #[cfg(unix)] + numeric_uid_gid, } }; @@ -355,7 +344,6 @@ impl Config { classify: options.is_present(options::CLASSIFY), ignore_backups: options.is_present(options::IGNORE_BACKUPS), size_format, - numeric_uid_gid: options.is_present(options::NUMERIC_UID_GID), directory: options.is_present(options::DIRECTORY), time, #[cfg(unix)] @@ -444,22 +432,36 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::format::COLUMNS, ]), ) - // The next three arguments do not override with the other format + // The next four arguments do not override with the other format // options, see the comment in Config::from for the reason. + // Ideally, they would use Arg::override_with, with their own name + // but that doesn't seem to work in all cases. Example: + // ls -1g1 + // even though `ls -11` and `ls -1 -g -1` work. .arg( Arg::with_name(options::format::ONELINE) .short(options::format::ONELINE) .help("List one file per line.") + .multiple(true) ) .arg( Arg::with_name(options::format::LONG_NO_GROUP) .short(options::format::LONG_NO_GROUP) .help("Long format without group information. Identical to --format=long with --no-group.") + .multiple(true) ) .arg( Arg::with_name(options::format::LONG_NO_OWNER) .short(options::format::LONG_NO_OWNER) .help("Long format without owner information.") + .multiple(true) + ) + .arg( + Arg::with_name(options::format::LONG_NUMERIC_UID_GID) + .short("n") + .long(options::format::LONG_NUMERIC_UID_GID) + .help("-l with numeric UIDs and GIDs.") + .multiple(true) ) // Time arguments @@ -657,12 +659,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { file the link references rather than the link itself.", ), ) - .arg( - Arg::with_name(options::NUMERIC_UID_GID) - .short("n") - .long(options::NUMERIC_UID_GID) - .help("-l with numeric UIDs and GIDs."), - ) + .arg( Arg::with_name(options::REVERSE) .short("r") @@ -852,7 +849,7 @@ fn pad_left(string: String, count: usize) -> String { } fn display_items(items: &[PathBuf], strip: Option<&Path>, config: &Config) { - if config.format == Format::Long || config.numeric_uid_gid { + if config.format == Format::Long { let (mut max_links, mut max_size) = (1, 1); for item in items { let (links, size) = display_dir_entry_size(item, config); @@ -994,7 +991,7 @@ use uucore::entries; #[cfg(unix)] fn display_uname(metadata: &Metadata, config: &Config) -> String { - if config.numeric_uid_gid { + if config.long.numeric_uid_gid { metadata.uid().to_string() } else { entries::uid2usr(metadata.uid()).unwrap_or_else(|_| metadata.uid().to_string()) @@ -1003,7 +1000,7 @@ fn display_uname(metadata: &Metadata, config: &Config) -> String { #[cfg(unix)] fn display_group(metadata: &Metadata, config: &Config) -> String { - if config.numeric_uid_gid { + if config.long.numeric_uid_gid { metadata.gid().to_string() } else { entries::gid2grp(metadata.gid()).unwrap_or_else(|_| metadata.gid().to_string()) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 091d47234..7d5a3da7b 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -297,15 +297,24 @@ fn test_ls_long_formats() { // Regex for three names, so all of author, group and owner let re_three = Regex::new(r"[xrw-]{9} \d ([-0-9_a-z]+ ){3}0").unwrap(); + #[cfg(unix)] + let re_three_num = Regex::new(r"[xrw-]{9} \d (\d+ ){3}0").unwrap(); + // Regex for two names, either: // - group and owner // - author and owner // - author and group let re_two = Regex::new(r"[xrw-]{9} \d ([-0-9_a-z]+ ){2}0").unwrap(); + #[cfg(unix)] + let re_two_num = Regex::new(r"[xrw-]{9} \d (\d+ ){2}0").unwrap(); + // Regex for one name: author, group or owner let re_one = Regex::new(r"[xrw-]{9} \d [-0-9_a-z]+ 0").unwrap(); + #[cfg(unix)] + let re_one_num = Regex::new(r"[xrw-]{9} \d \d+ 0").unwrap(); + // Regex for no names let re_zero = Regex::new(r"[xrw-]{9} \d 0").unwrap(); @@ -329,6 +338,19 @@ fn test_ls_long_formats() { println!("stdout = {:?}", result.stdout); assert!(re_three.is_match(&result.stdout)); + #[cfg(unix)] + { + let result = scene + .ucmd() + .arg("-n") + .arg("--author") + .arg("test-long-formats") + .succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_three_num.is_match(&result.stdout)); + } + for arg in &[ "-l", // only group and owner "-g --author", // only author and group @@ -344,6 +366,19 @@ fn test_ls_long_formats() { println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); assert!(re_two.is_match(&result.stdout)); + + #[cfg(unix)] + { + let result = scene + .ucmd() + .arg("-n") + .args(&arg.split(" ").collect::>()) + .arg("test-long-formats") + .succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_two_num.is_match(&result.stdout)); + } } for arg in &[ @@ -364,6 +399,19 @@ fn test_ls_long_formats() { println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); assert!(re_one.is_match(&result.stdout)); + + #[cfg(unix)] + { + let result = scene + .ucmd() + .arg("-n") + .args(&arg.split(" ").collect::>()) + .arg("test-long-formats") + .succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_one_num.is_match(&result.stdout)); + } } for arg in &[ @@ -387,6 +435,19 @@ fn test_ls_long_formats() { println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); assert!(re_zero.is_match(&result.stdout)); + + #[cfg(unix)] + { + let result = scene + .ucmd() + .arg("-n") + .args(&arg.split(" ").collect::>()) + .arg("test-long-formats") + .succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_zero.is_match(&result.stdout)); + } } } From 3ca21940f8c8f75c3948ed07465a26cf0dc0f960 Mon Sep 17 00:00:00 2001 From: Rein F Date: Sat, 27 Mar 2021 08:55:31 +0100 Subject: [PATCH 0177/1135] nl: move from getopts to clap (#1921) --- src/uu/nl/Cargo.toml | 2 +- src/uu/nl/src/helper.rs | 26 +++--- src/uu/nl/src/nl.rs | 202 +++++++++++++++++++++------------------- 3 files changed, 119 insertions(+), 111 deletions(-) diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index d5cddbde2..41f7c60ab 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/nl.rs" [dependencies] +clap = "2.33.3" aho-corasick = "0.7.3" -getopts = "0.2.18" libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" diff --git a/src/uu/nl/src/helper.rs b/src/uu/nl/src/helper.rs index 9b98129f1..94ff835d7 100644 --- a/src/uu/nl/src/helper.rs +++ b/src/uu/nl/src/helper.rs @@ -1,5 +1,7 @@ // spell-checker:ignore (ToDO) conv +use crate::options; + // parse_style parses a style string into a NumberingStyle. fn parse_style(chars: &[char]) -> Result { if chars.len() == 1 && chars[0] == 'a' { @@ -23,17 +25,17 @@ fn parse_style(chars: &[char]) -> Result { // parse_options loads the options into the settings, returning an array of // error messages. -pub fn parse_options(settings: &mut crate::Settings, opts: &getopts::Matches) -> Vec { +pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> Vec { // This vector holds error messages encountered. let mut errs: Vec = vec![]; - settings.renumber = !opts.opt_present("p"); - match opts.opt_str("s") { + settings.renumber = !opts.is_present(options::NO_RENUMBER); + match opts.value_of(options::NUMER_SEPARATOR) { None => {} Some(val) => { - settings.number_separator = val; + settings.number_separator = val.to_owned(); } } - match opts.opt_str("n") { + match opts.value_of(options::NUMBER_FORMAT) { None => {} Some(val) => match val.as_ref() { "ln" => { @@ -50,7 +52,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &getopts::Matches) -> } }, } - match opts.opt_str("b") { + match opts.value_of(options::BODY_NUMBERING) { None => {} Some(val) => { let chars: Vec = val.chars().collect(); @@ -64,7 +66,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &getopts::Matches) -> } } } - match opts.opt_str("f") { + match opts.value_of(options::FOOTER_NUMBERING) { None => {} Some(val) => { let chars: Vec = val.chars().collect(); @@ -78,7 +80,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &getopts::Matches) -> } } } - match opts.opt_str("h") { + match opts.value_of(options::HEADER_NUMBERING) { None => {} Some(val) => { let chars: Vec = val.chars().collect(); @@ -92,7 +94,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &getopts::Matches) -> } } } - match opts.opt_str("i") { + match opts.value_of(options::LINE_INCREMENT) { None => {} Some(val) => { let conv: Option = val.parse().ok(); @@ -104,7 +106,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &getopts::Matches) -> } } } - match opts.opt_str("w") { + match opts.value_of(options::NUMBER_WIDTH) { None => {} Some(val) => { let conv: Option = val.parse().ok(); @@ -116,7 +118,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &getopts::Matches) -> } } } - match opts.opt_str("v") { + match opts.value_of(options::STARTING_LINE_NUMER) { None => {} Some(val) => { let conv: Option = val.parse().ok(); @@ -128,7 +130,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &getopts::Matches) -> } } } - match opts.opt_str("l") { + match opts.value_of(options::JOIN_BLANK_LINES) { None => {} Some(val) => { let conv: Option = val.parse().ok(); diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 47b6c3ae9..3b5b5a2e8 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -11,6 +11,7 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; use std::iter::repeat; @@ -67,78 +68,106 @@ enum NumberFormat { RightZero, } +pub mod options { + pub const FILE: &str = "file"; + pub const BODY_NUMBERING: &str = "body-numbering"; + pub const SECTION_DELIMITER: &str = "section-delimiter"; + pub const FOOTER_NUMBERING: &str = "footer-numbering"; + pub const HEADER_NUMBERING: &str = "header-numbering"; + pub const LINE_INCREMENT: &str = "line-increment"; + pub const JOIN_BLANK_LINES: &str = "join-blank-lines"; + pub const NUMBER_FORMAT: &str = "number-format"; + pub const NO_RENUMBER: &str = "no-renumber"; + pub const NUMER_SEPARATOR: &str = "number-separator"; + pub const STARTING_LINE_NUMER: &str = "starting-line-number"; + pub const NUMBER_WIDTH: &str = "number-width"; +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = getopts::Options::new(); - - opts.optopt( - "b", - "body-numbering", - "use STYLE for numbering body lines", - "STYLE", - ); - opts.optopt( - "d", - "section-delimiter", - "use CC for separating logical pages", - "CC", - ); - opts.optopt( - "f", - "footer-numbering", - "use STYLE for numbering footer lines", - "STYLE", - ); - opts.optopt( - "h", - "header-numbering", - "use STYLE for numbering header lines", - "STYLE", - ); - opts.optopt( - "i", - "line-increment", - "line number increment at each line", - "", - ); - opts.optopt( - "l", - "join-blank-lines", - "group of NUMBER empty lines counted as one", - "NUMBER", - ); - opts.optopt( - "n", - "number-format", - "insert line numbers according to FORMAT", - "FORMAT", - ); - opts.optflag( - "p", - "no-renumber", - "do not reset line numbers at logical pages", - ); - opts.optopt( - "s", - "number-separator", - "add STRING after (possible) line number", - "STRING", - ); - opts.optopt( - "v", - "starting-line-number", - "first line number on each logical page", - "NUMBER", - ); - opts.optopt( - "w", - "number-width", - "use NUMBER columns for line numbers", - "NUMBER", - ); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("V", "version", "version"); + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(USAGE) + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) + .arg( + Arg::with_name(options::BODY_NUMBERING) + .short("b") + .long(options::BODY_NUMBERING) + .help("use STYLE for numbering body lines") + .value_name("SYNTAX"), + ) + .arg( + Arg::with_name(options::SECTION_DELIMITER) + .short("d") + .long(options::SECTION_DELIMITER) + .help("use CC for separating logical pages") + .value_name("CC"), + ) + .arg( + Arg::with_name(options::FOOTER_NUMBERING) + .short("f") + .long(options::FOOTER_NUMBERING) + .help("use STYLE for numbering footer lines") + .value_name("STYLE"), + ) + .arg( + Arg::with_name(options::HEADER_NUMBERING) + .short("h") + .long(options::HEADER_NUMBERING) + .help("use STYLE for numbering header lines") + .value_name("STYLE"), + ) + .arg( + Arg::with_name(options::LINE_INCREMENT) + .short("i") + .long(options::LINE_INCREMENT) + .help("line number increment at each line") + .value_name("NUMBER"), + ) + .arg( + Arg::with_name(options::JOIN_BLANK_LINES) + .short("l") + .long(options::JOIN_BLANK_LINES) + .help("group of NUMBER empty lines counted as one") + .value_name("NUMBER"), + ) + .arg( + Arg::with_name(options::NUMBER_FORMAT) + .short("n") + .long(options::NUMBER_FORMAT) + .help("insert line numbers according to FORMAT") + .value_name("FORMAT"), + ) + .arg( + Arg::with_name(options::NO_RENUMBER) + .short("p") + .long(options::NO_RENUMBER) + .help("do not reset line numbers at logical pages"), + ) + .arg( + Arg::with_name(options::NUMER_SEPARATOR) + .short("s") + .long(options::NUMER_SEPARATOR) + .help("add STRING after (possible) line number") + .value_name("STRING"), + ) + .arg( + Arg::with_name(options::STARTING_LINE_NUMER) + .short("v") + .long(options::STARTING_LINE_NUMER) + .help("first line number on each logical page") + .value_name("NUMBER"), + ) + .arg( + Arg::with_name(options::NUMBER_WIDTH) + .short("w") + .long(options::NUMBER_WIDTH) + .help("use NUMBER columns for line numbers") + .value_name("NUMBER"), + ) + .get_matches_from(args); // A mutable settings object, initialized with the defaults. let mut settings = Settings { @@ -155,27 +184,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { number_separator: String::from("\t"), }; - let given_options = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("{}", f); - print_usage(&opts); - return 1; - } - }; - - if given_options.opt_present("help") { - print_usage(&opts); - return 0; - } - if given_options.opt_present("version") { - version(); - return 0; - } - // Update the settings from the command line options, and terminate the // program if some options could not successfully be parsed. - let parse_errors = helper::parse_options(&mut settings, &given_options); + let parse_errors = helper::parse_options(&mut settings, &matches); if !parse_errors.is_empty() { show_error!("Invalid arguments supplied."); for message in &parse_errors { @@ -184,8 +195,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return 1; } - let files = given_options.free; - let mut read_stdin = files.is_empty(); + let mut read_stdin = false; + let files: Vec = match matches.values_of(options::FILE) { + Some(v) => v.clone().map(|v| v.to_owned()).collect(), + None => vec!["-".to_owned()], + }; for file in &files { if file == "-" { @@ -370,11 +384,3 @@ fn pass_none(_: &str, _: ®ex::Regex) -> bool { fn pass_all(_: &str, _: ®ex::Regex) -> bool { true } - -fn print_usage(opts: &getopts::Options) { - println!("{}", opts.usage(USAGE)); -} - -fn version() { - println!("{} {}", NAME, VERSION); -} From 3ae714e88cdf2e2176ac5386e175794ab5bdf48a Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sat, 27 Mar 2021 09:16:45 +0100 Subject: [PATCH 0178/1135] tests/tee: implemented tests for tee (#1804) These tests are ported from `https://github.com/coreutils/coreutils/tests/misc/tee.sh`. --- tests/by-util/test_tee.rs | 103 +++++++++++++++++++++++++++++++++++++- 1 file changed, 102 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_tee.rs b/tests/by-util/test_tee.rs index 651491045..5819b3044 100644 --- a/tests/by-util/test_tee.rs +++ b/tests/by-util/test_tee.rs @@ -1 +1,102 @@ -// ToDO: add tests +use crate::common::util::*; + +// tests for basic tee functionality. +// inspired by: +// https://github.com/coreutils/coreutils/tests/misc/tee.sh + +#[test] +fn test_tee_processing_multiple_operands() { + // POSIX says: "Processing of at least 13 file operands shall be supported." + + let content = "tee_sample_content"; + for &n in [1, 2, 12, 13].iter() { + let files = (1..=n).map(|x| x.to_string()).collect::>(); + let (at, mut ucmd) = at_and_ucmd!(); + + ucmd.args(&files) + .pipe_in(content) + .succeeds() + .stdout_is(content); + + for file in files.iter() { + assert!(at.file_exists(file)); + assert_eq!(at.read(file), content); + } + } +} + +#[test] +fn test_tee_treat_minus_as_filename() { + // Ensure tee treats '-' as the name of a file, as mandated by POSIX. + + let (at, mut ucmd) = at_and_ucmd!(); + let content = "tee_sample_content"; + let file = "-"; + + ucmd.arg("-").pipe_in(content).succeeds().stdout_is(content); + + assert!(at.file_exists(file)); + assert_eq!(at.read(file), content); +} + +#[test] +fn test_tee_append() { + let (at, mut ucmd) = at_and_ucmd!(); + let content = "tee_sample_content"; + let file = "tee_out"; + + at.touch(file); + at.write(file, content); + assert_eq!(at.read(file), content); + + ucmd.arg("-a") + .arg(file) + .pipe_in(content) + .succeeds() + .stdout_is(content); + assert!(at.file_exists(file)); + assert_eq!(at.read(file), content.repeat(2)); +} + +#[test] +#[cfg(target_os = "linux")] +fn test_tee_no_more_writeable_stdout() { + let (_at, mut ucmd) = at_and_ucmd!(); + let content = (1..=10) + .map(|x| format!("{}\n", x.to_string())) + .collect::(); + let file_out = "tee_file_out"; + + let _result = ucmd + .arg("/dev/full") + .arg(file_out) + .pipe_in(&content[..]) + .fails(); + + // TODO: comment in after https://github.com/uutils/coreutils/issues/1805 is fixed + // assert_eq!(at.read(file_out), content); + // assert!(result.stdout.contains(&content)); + // assert!(result.stderr.contains("No space left on device")); +} + +#[test] +#[cfg(target_os = "linux")] +fn test_tee_no_more_writeable_stdin() { + let (_at, mut ucmd) = at_and_ucmd!(); + let _content = (1..=10) + .map(|x| format!("{}\n", x.to_string())) + .collect::(); + let file_out_a = "tee_file_out_a"; + let file_out_b = "tee_file_out_b"; + + let _result = ucmd + .arg(file_out_a) + .arg(file_out_b) + .pipe_in("/dev/full") + .succeeds(); // TODO: expected to succeed currently; change to fails() when required + + // TODO: comment in after https://github.com/uutils/coreutils/issues/1805 is fixed + // assert_eq!(at.read(file_out_a), content); + // assert_eq!(at.read(file_out_b), content); + // assert!(result.stderr.contains("No space left on device")); +} From 35675fdfe7639acdb81c0bdc97a3f59780a52a04 Mon Sep 17 00:00:00 2001 From: Antonio Gurgel Date: Sat, 27 Mar 2021 01:18:47 -0700 Subject: [PATCH 0179/1135] install: implement `-C` / `--compare` (#1811) * install: implement `-C` / `--compare` GNU coreutils [1] checks the following: whether - either file is nonexistent, - there's a sticky bit or set[ug]id bit in play, - either file isn't a regular file, - the sizes of both files mismatch, - the destination file's owner differs from intended, or - the contents of both files mismatch. [1] https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/install.c?h=v8.32#n174 * Add test: non-regular files * Forgot a #[test] * Give up on non-regular file test * `cargo fmt` install.rs --- Cargo.lock | 20 ++++++++ Cargo.toml | 1 + src/uu/install/Cargo.toml | 1 + src/uu/install/src/install.rs | 95 +++++++++++++++++++++++++++++++++-- tests/by-util/test_install.rs | 85 +++++++++++++++++++++++++++++++ 5 files changed, 197 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4851a6e13..12cfe7ed6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -187,6 +187,7 @@ dependencies = [ "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -517,6 +518,11 @@ name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "file_diff" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "filetime" version = "0.2.14" @@ -730,6 +736,17 @@ dependencies = [ "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "nix" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "nodrop" version = "0.1.14" @@ -1658,6 +1675,7 @@ name = "uu_install" version = "0.0.4" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "file_diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2501,6 +2519,7 @@ dependencies = [ "checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" "checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +"checksum file_diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "31a7a908b8f32538a2143e59a6e4e2508988832d5d4d6f7c156b3cbc762643a5" "checksum filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" "checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" "checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" @@ -2532,6 +2551,7 @@ dependencies = [ "checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" "checksum memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" "checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" +"checksum nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" "checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" "checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" "checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" diff --git a/Cargo.toml b/Cargo.toml index 208fd5d9c..08e9a3bb2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -334,6 +334,7 @@ conv = "0.3" filetime = "0.2" glob = "0.3.0" libc = "0.2" +nix = "0.20.0" rand = "0.7" regex = "1.0" sha1 = { version="0.6", features=["std"] } diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 9841ac64a..5aec0b07c 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -20,6 +20,7 @@ path = "src/install.rs" [dependencies] clap = "2.33" filetime = "0.2" +file_diff = "1.0.0" libc = ">= 0.2" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["mode", "perms", "entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 1ac9bc743..db54ee22d 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -13,10 +13,12 @@ mod mode; extern crate uucore; use clap::{App, Arg, ArgMatches}; +use file_diff::diff; use filetime::{set_file_times, FileTime}; use uucore::entries::{grp2gid, usr2uid}; use uucore::perms::{wrap_chgrp, wrap_chown, Verbosity}; +use libc::{getegid, geteuid}; use std::fs; use std::fs::File; use std::os::unix::fs::MetadataExt; @@ -34,6 +36,7 @@ pub struct Behavior { group: String, verbose: bool, preserve_timestamps: bool, + compare: bool, } #[derive(Clone, Eq, PartialEq)] @@ -112,11 +115,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("ignored") ) .arg( - // TODO implement flag Arg::with_name(OPT_COMPARE) .short("C") .long(OPT_COMPARE) - .help("(unimplemented) compare each pair of source and destination files, and in some cases, do not modify the destination at all") + .help("compare each pair of source and destination files, and in some cases, do not modify the destination at all") ) .arg( Arg::with_name(OPT_DIRECTORY) @@ -262,8 +264,6 @@ fn check_unimplemented<'a>(matches: &ArgMatches) -> Result<(), &'a str> { Err("--backup") } else if matches.is_present(OPT_BACKUP_2) { Err("-b") - } else if matches.is_present(OPT_COMPARE) { - Err("--compare, -C") } else if matches.is_present(OPT_CREATED) { Err("-D") } else if matches.is_present(OPT_STRIP) { @@ -338,6 +338,7 @@ fn behavior(matches: &ArgMatches) -> Result { group: matches.value_of(OPT_GROUP).unwrap_or("").to_string(), verbose: matches.is_present(OPT_VERBOSE), preserve_timestamps: matches.is_present(OPT_PRESERVE_TIMESTAMPS), + compare: matches.is_present(OPT_COMPARE), }) } @@ -500,7 +501,13 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { ); return Err(()); } - } else if let Err(err) = fs::copy(from, to) { + } + + if b.compare && !need_copy(from, to, b) { + return Ok(()); + } + + if let Err(err) = fs::copy(from, to) { show_error!( "cannot install '{}' to '{}': {}", from.display(), @@ -583,3 +590,81 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { Ok(()) } + +/// Return true if a file is necessary to copy. This is the case when: +/// - _from_ or _to_ is nonexistent; +/// - either file has a sticky bit or set[ug]id bit, or the user specified one; +/// - either file isn't a regular file; +/// - the sizes of _from_ and _to_ differ; +/// - _to_'s owner differs from intended; or +/// - the contents of _from_ and _to_ differ. +/// +/// # Parameters +/// +/// _from_ and _to_, if existent, must be non-directories. +/// +/// # Errors +/// +/// Crashes the program if a nonexistent owner or group is specified in _b_. +/// +fn need_copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> bool { + let from_meta = match fs::metadata(from) { + Ok(meta) => meta, + Err(_) => return true, + }; + let to_meta = match fs::metadata(to) { + Ok(meta) => meta, + Err(_) => return true, + }; + + // setuid || setgid || sticky + let extra_mode: u32 = 0o7000; + + if b.specified_mode.unwrap_or(0) & extra_mode != 0 + || from_meta.mode() & extra_mode != 0 + || to_meta.mode() & extra_mode != 0 + { + return true; + } + + if !from_meta.is_file() || !to_meta.is_file() { + return true; + } + + if from_meta.len() != to_meta.len() { + return true; + } + + // TODO: if -P (#1809) and from/to contexts mismatch, return true. + + if !b.owner.is_empty() { + let owner_id = match usr2uid(&b.owner) { + Ok(id) => id, + _ => crash!(1, "no such user: {}", b.owner), + }; + if owner_id != to_meta.uid() { + return true; + } + } else if !b.group.is_empty() { + let group_id = match grp2gid(&b.group) { + Ok(id) => id, + _ => crash!(1, "no such group: {}", b.group), + }; + if group_id != to_meta.gid() { + return true; + } + } else { + #[cfg(not(target_os = "windows"))] + unsafe { + if to_meta.uid() != geteuid() || to_meta.gid() != getegid() { + return true; + } + } + } + + if !diff(from.to_str().unwrap(), to.to_str().unwrap()) { + return true; + } + + false +} diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 89dfb0e56..dfd5c1c8d 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -1,4 +1,5 @@ use crate::common::util::*; +use filetime::FileTime; use rust_users::*; use std::os::unix::fs::PermissionsExt; @@ -407,3 +408,87 @@ fn test_install_failing_no_such_file() { assert!(r.code == Some(1)); assert!(r.stderr.contains("No such file or directory")); } + +#[test] +fn test_install_copy_then_compare_file() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let file1 = "test_install_copy_then_compare_file_a1"; + let file2 = "test_install_copy_then_compare_file_a2"; + + at.touch(file1); + scene + .ucmd() + .arg("-C") + .arg(file1) + .arg(file2) + .succeeds() + .no_stderr(); + + let mut file2_meta = at.metadata(file2); + let before = FileTime::from_last_modification_time(&file2_meta); + + scene + .ucmd() + .arg("-C") + .arg(file1) + .arg(file2) + .succeeds() + .no_stderr(); + + file2_meta = at.metadata(file2); + let after = FileTime::from_last_modification_time(&file2_meta); + + assert!(before == after); +} + +#[test] +#[cfg(target_os = "linux")] +fn test_install_copy_then_compare_file_with_extra_mode() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + // XXX: can't tests introspect on their own names? + let file1 = "test_install_copy_then_compare_file_with_extra_mode_a1"; + let file2 = "test_install_copy_then_compare_file_with_extra_mode_a2"; + + at.touch(file1); + scene + .ucmd() + .arg("-C") + .arg(file1) + .arg(file2) + .succeeds() + .no_stderr(); + + let mut file2_meta = at.metadata(file2); + let before = FileTime::from_last_modification_time(&file2_meta); + + scene + .ucmd() + .arg("-C") + .arg(file1) + .arg(file2) + .arg("-m") + .arg("1644") + .succeeds() + .no_stderr(); + + file2_meta = at.metadata(file2); + let after_install_sticky = FileTime::from_last_modification_time(&file2_meta); + + assert!(before != after_install_sticky); + + // dest file still 1644, so need_copy ought to return `true` + scene + .ucmd() + .arg("-C") + .arg(file1) + .arg(file2) + .succeeds() + .no_stderr(); + + file2_meta = at.metadata(file2); + let after_install_sticky_again = FileTime::from_last_modification_time(&file2_meta); + + assert!(after_install_sticky != after_install_sticky_again); +} From e1439dd199dba0b0f600dfaa45218a4a5daa9b98 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 27 Mar 2021 10:06:22 +0100 Subject: [PATCH 0180/1135] refresh cargo.lock with recent updates (#1924) Updating memoffset v0.6.1 -> v0.6.2 Updating syn v1.0.64 -> v1.0.65 --- Cargo.lock | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 12cfe7ed6..99fd7a3f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -335,7 +335,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -350,7 +350,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -442,7 +442,7 @@ dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -718,7 +718,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "memoffset" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -742,7 +742,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1127,7 +1127,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1183,7 +1183,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1268,7 +1268,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1370,6 +1370,7 @@ dependencies = [ name = "uu_cat" version = "0.0.4" dependencies = [ + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", @@ -1824,7 +1825,7 @@ name = "uu_nl" version = "0.0.4" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2332,7 +2333,7 @@ version = "0.0.5" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2379,7 +2380,7 @@ dependencies = [ "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2399,7 +2400,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2549,7 +2550,7 @@ dependencies = [ "checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" "checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" -"checksum memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" +"checksum memoffset 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cc14fc54a812b4472b4113facc3e44d099fbc0ea2ce0551fa5c703f8edfbfd38" "checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" "checksum nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" "checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" @@ -2608,7 +2609,7 @@ dependencies = [ "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" "checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f" +"checksum syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)" = "f3a1d708c221c5a612956ef9f75b37e454e88d1f7b899fbd3a18d4252012d663" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" "checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" From faef7e9214e865e369c780bd6182ca306560b1aa Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 27 Mar 2021 10:05:13 +0100 Subject: [PATCH 0181/1135] fix(install): Unbreak the CI by bringing the old behavior for install of /dev/null --- src/uu/install/src/install.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index db54ee22d..b4f98ec1a 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -488,6 +488,10 @@ fn copy_file_to_file(file: &PathBuf, target: &PathBuf, b: &Behavior) -> i32 { /// If the copy system call fails, we print a verbose error and return an empty error value. /// fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { + if b.compare && !need_copy(from, to, b) { + return Ok(()); + } + if from.to_string_lossy() == "/dev/null" { /* workaround a limitation of fs::copy * https://github.com/rust-lang/rust/issues/79390 @@ -501,13 +505,7 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { ); return Err(()); } - } - - if b.compare && !need_copy(from, to, b) { - return Ok(()); - } - - if let Err(err) = fs::copy(from, to) { + } else if let Err(err) = fs::copy(from, to) { show_error!( "cannot install '{}' to '{}': {}", from.display(), From 75700677ca440203be5a6cb348b508ff5b592369 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 27 Mar 2021 10:08:03 +0100 Subject: [PATCH 0182/1135] fix(install): improve the error output when the test is failing --- tests/by-util/test_install.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index dfd5c1c8d..3a8771f5d 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -352,11 +352,19 @@ fn test_install_copy_file() { #[test] #[cfg(target_os = "linux")] fn test_install_target_file_dev_null() { - let (at, mut ucmd) = at_and_ucmd!(); + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let file1 = "/dev/null"; let file2 = "target_file"; - ucmd.arg(file1).arg(file2).succeeds().no_stderr(); + let result = scene.ucmd().arg(file1).arg(file2).run(); + + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + + assert!(result.success); + assert!(at.file_exists(file2)); } From 4845b3f5dcf1c532ff7774424170efa59091ebae Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 27 Mar 2021 10:29:46 +0100 Subject: [PATCH 0183/1135] Enable the stale bot to close issues/PR without any activity (#1926) --- .github/stale.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 000000000..47076f60f --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,18 @@ +# Number of days of inactivity before an issue/PR becomes stale +daysUntilStale: 365 +# Number of days of inactivity before a stale issue/PR is closed +daysUntilClose: 14 +# Issues with these labels will never be considered stale +exemptLabels: + - pinned + - security + - "Good first bug" +# Label to use when marking an issue as stale +staleLabel: wontfix +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false From e9ffaf87ea9a84e81d72deb9f86323615324fbec Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 27 Mar 2021 10:47:26 +0100 Subject: [PATCH 0184/1135] ignore test_install_copy_then_compare_file_with_extra_mode see https://github.com/uutils/coreutils/issues/1927 --- tests/by-util/test_install.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 3a8771f5d..411de61f3 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -452,6 +452,7 @@ fn test_install_copy_then_compare_file() { #[test] #[cfg(target_os = "linux")] +#[ignore] fn test_install_copy_then_compare_file_with_extra_mode() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; From 16878c2daa7c6c525f151f709333f48774c7f08e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 27 Mar 2021 10:54:18 +0100 Subject: [PATCH 0185/1135] Create CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 128 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..6c50b811d --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +sylvestre@debian.org. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. From ac7edcc4fad4a046bb3a8ae8371cebc5e58256e9 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Sat, 27 Mar 2021 15:31:06 +0300 Subject: [PATCH 0186/1135] ptx: delete getopts dependency (#1942) * chore: delete getopts dependency * deps: update Cargo.lock --- Cargo.lock | 1 - src/uu/ptx/Cargo.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 99fd7a3f6..8a56ffbfd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1927,7 +1927,6 @@ version = "0.0.4" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index d1e0267b6..790b06305 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -17,7 +17,6 @@ path = "src/ptx.rs" [dependencies] clap = "2.33" aho-corasick = "0.7.3" -getopts = "0.2.18" libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" From 0bdd61af5e6572be3f77e09d42f0b3d5d9ee91d3 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Sat, 27 Mar 2021 15:31:29 +0300 Subject: [PATCH 0187/1135] cksum: use clap for argument management (#1943) --- src/uu/cksum/Cargo.toml | 1 + src/uu/cksum/src/cksum.rs | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index ef3ec8b46..b7ac630f0 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/cksum.rs" [dependencies] +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index e1c75fffc..bc71a2d97 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -10,6 +10,7 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs::File; use std::io::{self, stdin, BufReader, Read}; use std::path::Path; @@ -18,9 +19,10 @@ use std::path::Path; const CRC_TABLE_LEN: usize = 256; const CRC_TABLE: [u32; CRC_TABLE_LEN] = generate_crc_table(); +const VERSION: &str = env!("CARGO_PKG_VERSION"); +const NAME: &str = "cksum"; const SYNTAX: &str = "[OPTIONS] [FILE]..."; const SUMMARY: &str = "Print CRC and size for each file"; -const LONG_HELP: &str = ""; // this is basically a hack to get "loops" to work on Rust 1.33. Once we update to Rust 1.46 or // greater, we can just use while loops @@ -160,10 +162,25 @@ fn cksum(fname: &str) -> io::Result<(u32, usize)> { } } -pub fn uumain(args: impl uucore::Args) -> i32 { - let matches = app!(SYNTAX, SUMMARY, LONG_HELP).parse(args.collect_str()); +mod options { + pub static FILE: &str = "file"; +} - let files = matches.free; +pub fn uumain(args: impl uucore::Args) -> i32 { + let args = args.collect_str(); + + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .about(SUMMARY) + .usage(SYNTAX) + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) + .get_matches_from(args); + + let files: Vec = match matches.values_of(options::FILE) { + Some(v) => v.clone().map(|v| v.to_owned()).collect(), + None => vec![], + }; if files.is_empty() { match cksum("-") { From f66a188414886d28f9c5c583e6f048086766040d Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Sat, 27 Mar 2021 22:00:59 +0300 Subject: [PATCH 0188/1135] mkfifo: general refactor, move to clap, add tests (#1945) * mkfifo: general refactor, move to clap, add unimplemented flags * chore: update Cargo.lock * chore: delete unused variables, simplify multiple lines with crash * test: add tests * chore: revert the use of crash * test: use even more invalid mod mode --- Cargo.lock | 2 +- src/uu/mkfifo/Cargo.toml | 2 +- src/uu/mkfifo/src/mkfifo.rs | 94 ++++++++++++++++++------------------ tests/by-util/test_mkfifo.rs | 49 ++++++++++++++++++- 4 files changed, 97 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a56ffbfd..a5c551228 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1760,7 +1760,7 @@ dependencies = [ name = "uu_mkfifo" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index 627d4a721..aa347a86e 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/mkfifo.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/mkfifo/src/mkfifo.rs b/src/uu/mkfifo/src/mkfifo.rs index 41582b14a..14701af4d 100644 --- a/src/uu/mkfifo/src/mkfifo.rs +++ b/src/uu/mkfifo/src/mkfifo.rs @@ -8,56 +8,55 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use libc::mkfifo; use std::ffi::CString; -use std::io::Error; static NAME: &str = "mkfifo"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static USAGE: &str = "mkfifo [OPTION]... NAME..."; +static SUMMARY: &str = "Create a FIFO with the given name."; + +mod options { + pub static MODE: &str = "mode"; + pub static SE_LINUX_SECURITY_CONTEXT: &str = "Z"; + pub static CONTEXT: &str = "context"; + pub static FIFO: &str = "fifo"; +} pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(USAGE) + .about(SUMMARY) + .arg( + Arg::with_name(options::MODE) + .short("m") + .long(options::MODE) + .help("file permissions for the fifo") + .default_value("0666") + .value_name("0666"), + ) + .arg( + Arg::with_name(options::SE_LINUX_SECURITY_CONTEXT) + .short(options::SE_LINUX_SECURITY_CONTEXT) + .help("set the SELinux security context to default type") + ) + .arg(Arg::with_name(options::CONTEXT).long(options::CONTEXT).value_name("CTX").help("like -Z, or if CTX is specified then set the SELinux\nor SMACK security context to CTX")) + .arg(Arg::with_name(options::FIFO).hidden(true).multiple(true)) + .get_matches_from(args); - opts.optopt( - "m", - "mode", - "file permissions for the fifo", - "(default 0666)", - ); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(err) => panic!("{}", err), - }; - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; + if matches.is_present(options::CONTEXT) { + crash!(1, "--context is not implemented"); + } + if matches.is_present(options::SE_LINUX_SECURITY_CONTEXT) { + crash!(1, "-Z is not implemented"); } - if matches.opt_present("help") || matches.free.is_empty() { - let msg = format!( - "{0} {1} - -Usage: - {0} [OPTIONS] NAME... - -Create a FIFO with the given name.", - NAME, VERSION - ); - - print!("{}", opts.usage(&msg)); - if matches.free.is_empty() { - return 1; - } - return 0; - } - - let mode = match matches.opt_str("m") { + let mode = match matches.value_of(options::MODE) { Some(m) => match usize::from_str_radix(&m, 8) { Ok(m) => m, Err(e) => { @@ -68,21 +67,22 @@ Create a FIFO with the given name.", None => 0o666, }; - let mut exit_status = 0; - for f in &matches.free { + let fifos: Vec = match matches.values_of(options::FIFO) { + Some(v) => v.clone().map(|s| s.to_owned()).collect(), + None => crash!(1, "missing operand"), + }; + + let mut exit_code = 0; + for f in fifos { let err = unsafe { let name = CString::new(f.as_bytes()).unwrap(); mkfifo(name.as_ptr(), mode as libc::mode_t) }; if err == -1 { - show_error!( - "creating '{}': {}", - f, - Error::last_os_error().raw_os_error().unwrap() - ); - exit_status = 1; + show_error!("cannot create fifo '{}': File exists", f); + exit_code = 1; } } - exit_status + exit_code } diff --git a/tests/by-util/test_mkfifo.rs b/tests/by-util/test_mkfifo.rs index 651491045..f60c0a4b8 100644 --- a/tests/by-util/test_mkfifo.rs +++ b/tests/by-util/test_mkfifo.rs @@ -1 +1,48 @@ -// ToDO: add tests +use crate::common::util::*; + +#[test] +fn test_create_fifo_missing_operand() { + new_ucmd!() + .fails() + .stderr_is("mkfifo: error: missing operand"); +} + +#[test] +fn test_create_one_fifo() { + new_ucmd!().arg("abc").succeeds(); +} + +#[test] +fn test_create_one_fifo_with_invalid_mode() { + new_ucmd!() + .arg("abcd") + .arg("-m") + .arg("invalid") + .fails() + .stderr + .contains("invalid mode"); +} + +#[test] +fn test_create_multiple_fifos() { + new_ucmd!() + .arg("abcde") + .arg("def") + .arg("sed") + .arg("dum") + .succeeds(); +} + +#[test] +fn test_create_one_fifo_with_mode() { + new_ucmd!().arg("abcde").arg("-m600").succeeds(); +} + +#[test] +fn test_create_one_fifo_already_exists() { + new_ucmd!() + .arg("abcdef") + .arg("abcdef") + .fails() + .stderr_is("mkfifo: error: cannot create fifo 'abcdef': File exists"); +} From 500771c78d4b6b62bc7203d1624174cd28bd994b Mon Sep 17 00:00:00 2001 From: Ivan Date: Sat, 27 Mar 2021 22:02:49 +0300 Subject: [PATCH 0189/1135] tee: should match GNU's output if used with /dev/full (#1944) + aligned 'tee' output with GNU tee when one of the files is '/dev/full' + don't stop tee when one of the outputs fails; just continue and return error status from tee in the end Co-authored-by: Ivan Rymarchyk --- src/uu/tee/Cargo.toml | 1 + src/uu/tee/src/tee.rs | 93 +++++++++++++++++++++++++-------------- tests/by-util/test_tee.rs | 19 ++++---- 3 files changed, 73 insertions(+), 40 deletions(-) diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index 99a6ec23e..51bba2e45 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -17,6 +17,7 @@ path = "src/tee.rs" [dependencies] clap = "2.33.3" libc = "0.2.42" +retain_mut = "0.1.2" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["libc"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/tee/src/tee.rs b/src/uu/tee/src/tee.rs index c54fa0d16..4b0f19038 100644 --- a/src/uu/tee/src/tee.rs +++ b/src/uu/tee/src/tee.rs @@ -12,6 +12,7 @@ use clap::{App, Arg}; use std::fs::OpenOptions; use std::io::{copy, sink, stdin, stdout, Error, ErrorKind, Read, Result, Write}; use std::path::{Path, PathBuf}; +use retain_mut::RetainMut; #[cfg(unix)] use uucore::libc; @@ -93,18 +94,33 @@ fn tee(options: Options) -> Result<()> { if options.ignore_interrupts { ignore_interrupts()? } - let mut writers: Vec> = options + let mut writers: Vec = options .files .clone() .into_iter() - .map(|file| open(file, options.append)) + .map(|file| + NamedWriter { + name: file.clone(), + inner: open(file, options.append), + } + ) .collect(); - writers.push(Box::new(stdout())); - let output = &mut MultiWriter { writers }; + + + writers.insert(0, NamedWriter { + name: "'standard output'".to_owned(), + inner: Box::new(stdout()), + }); + + let mut output = MultiWriter::new(writers); let input = &mut NamedReader { inner: Box::new(stdin()) as Box, }; - if copy(input, output).is_err() || output.flush().is_err() { + + // TODO: replaced generic 'copy' call to be able to stop copying + // if all outputs are closed (due to errors) + if copy(input, &mut output).is_err() || output.flush().is_err() || + output.error_occured() { Err(Error::new(ErrorKind::Other, "")) } else { Ok(()) @@ -112,7 +128,7 @@ fn tee(options: Options) -> Result<()> { } fn open(name: String, append: bool) -> Box { - let path = PathBuf::from(name); + let path = PathBuf::from(name.clone()); let inner: Box = { let mut options = OpenOptions::new(); let mode = if append { @@ -125,55 +141,68 @@ fn open(name: String, append: bool) -> Box { Err(_) => Box::new(sink()), } }; - Box::new(NamedWriter { inner, path }) as Box + Box::new(NamedWriter { inner, name }) as Box } struct MultiWriter { - writers: Vec>, + writers: Vec, + initial_len: usize, +} + +impl MultiWriter { + fn new (writers: Vec) -> Self { + Self { + initial_len: writers.len(), + writers, + } + } + fn error_occured(&self) -> bool { + self.writers.len() != self.initial_len + } } impl Write for MultiWriter { fn write(&mut self, buf: &[u8]) -> Result { - for writer in &mut self.writers { - writer.write_all(buf)?; - } + self.writers.retain_mut(|writer| { + let result = writer.write_all(buf); + match result { + Err(f) => { + show_info!("{}: {}", writer.name, f.to_string()); + false + } + _ => true + } + }); Ok(buf.len()) } fn flush(&mut self) -> Result<()> { - for writer in &mut self.writers { - writer.flush()?; - } + self.writers.retain_mut(|writer| { + let result = writer.flush(); + match result { + Err(f) => { + show_info!("{}: {}", writer.name, f.to_string()); + false + } + _ => true + } + }); Ok(()) } } struct NamedWriter { inner: Box, - path: PathBuf, + pub name: String, } impl Write for NamedWriter { fn write(&mut self, buf: &[u8]) -> Result { - match self.inner.write(buf) { - Err(f) => { - self.inner = Box::new(sink()) as Box; - show_warning!("{}: {}", self.path.display(), f.to_string()); - Err(f) - } - okay => okay, - } + self.inner.write(buf) } fn flush(&mut self) -> Result<()> { - match self.inner.flush() { - Err(f) => { - self.inner = Box::new(sink()) as Box; - show_warning!("{}: {}", self.path.display(), f.to_string()); - Err(f) - } - okay => okay, - } + self.inner.flush() } } @@ -185,7 +214,7 @@ impl Read for NamedReader { fn read(&mut self, buf: &mut [u8]) -> Result { match self.inner.read(buf) { Err(f) => { - show_warning!("{}: {}", Path::new("stdin").display(), f.to_string()); + show_info!("{}: {}", Path::new("stdin").display(), f.to_string()); Err(f) } okay => okay, diff --git a/tests/by-util/test_tee.rs b/tests/by-util/test_tee.rs index 5819b3044..f01677ae7 100644 --- a/tests/by-util/test_tee.rs +++ b/tests/by-util/test_tee.rs @@ -60,28 +60,31 @@ fn test_tee_append() { #[test] #[cfg(target_os = "linux")] -fn test_tee_no_more_writeable_stdout() { - let (_at, mut ucmd) = at_and_ucmd!(); +fn test_tee_no_more_writeable_1() { + // equals to 'tee /dev/full out2 (); let file_out = "tee_file_out"; - let _result = ucmd + let result = ucmd .arg("/dev/full") .arg(file_out) .pipe_in(&content[..]) .fails(); - // TODO: comment in after https://github.com/uutils/coreutils/issues/1805 is fixed - // assert_eq!(at.read(file_out), content); - // assert!(result.stdout.contains(&content)); - // assert!(result.stderr.contains("No space left on device")); + assert_eq!(at.read(file_out), content); + assert!(result.stdout.contains(&content)); + assert!(result.stderr.contains("No space left on device")); } #[test] #[cfg(target_os = "linux")] -fn test_tee_no_more_writeable_stdin() { +fn test_tee_no_more_writeable_2() { + // should be equals to 'tee out1 out2 >/dev/full Date: Sat, 27 Mar 2021 20:03:47 +0100 Subject: [PATCH 0190/1135] refresh cargo.lock with recent updates --- Cargo.lock | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index a5c551228..9911ba928 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1062,6 +1062,11 @@ dependencies = [ "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "retain_mut" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "rust-ini" version = "0.13.0" @@ -1420,6 +1425,7 @@ dependencies = [ name = "uu_cksum" version = "0.0.4" dependencies = [ + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -2132,6 +2138,7 @@ version = "0.0.4" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "retain_mut 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", ] @@ -2592,6 +2599,7 @@ dependencies = [ "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" "checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +"checksum retain_mut 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1" "checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" From 4f6041e39d46cd8c8dcd58fc5e2e490b60bd78e4 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 27 Mar 2021 22:26:08 +0100 Subject: [PATCH 0191/1135] Only close if stale for one year --- .github/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/stale.yml b/.github/stale.yml index 47076f60f..e0988d0bd 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -1,7 +1,7 @@ # Number of days of inactivity before an issue/PR becomes stale daysUntilStale: 365 # Number of days of inactivity before a stale issue/PR is closed -daysUntilClose: 14 +daysUntilClose: 365 # Issues with these labels will never be considered stale exemptLabels: - pinned From bcb1828ad608e26072277d5d2738c8eb91d64966 Mon Sep 17 00:00:00 2001 From: k0ur0x Date: Sun, 28 Mar 2021 05:51:43 +0430 Subject: [PATCH 0192/1135] comm: move from getopts to clap --- src/uu/comm/Cargo.toml | 2 +- src/uu/comm/src/comm.rs | 86 ++++++++++++++++++++++++++++------------- 2 files changed, 61 insertions(+), 27 deletions(-) diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index ddfbb6a47..a0dc4e06f 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/comm.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/comm/src/comm.rs b/src/uu/comm/src/comm.rs index 3fb1ef395..34b4330c9 100644 --- a/src/uu/comm/src/comm.rs +++ b/src/uu/comm/src/comm.rs @@ -15,21 +15,34 @@ use std::fs::File; use std::io::{self, stdin, BufRead, BufReader, Stdin}; use std::path::Path; -static SYNTAX: &str = "[OPTIONS] FILE1 FILE2"; -static SUMMARY: &str = "Compare sorted files line by line"; +use clap::{App, Arg, ArgMatches}; + +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "compare two sorted files line by line"; static LONG_HELP: &str = ""; -fn mkdelim(col: usize, opts: &getopts::Matches) -> String { - let mut s = String::new(); - let delim = match opts.opt_str("output-delimiter") { - Some(d) => d, - None => "\t".to_owned(), - }; +mod options { + pub const COLUMN_1: &str = "1"; + pub const COLUMN_2: &str = "2"; + pub const COLUMN_3: &str = "3"; + pub const DELIMITER: &str = "output-delimiter"; + pub const DELIMITER_DEFAULT: &str = "\t"; + pub const FILE_1: &str = "FILE1"; + pub const FILE_2: &str = "FILE2"; +} - if col > 1 && !opts.opt_present("1") { +fn get_usage() -> String { + format!("{} [OPTION]... FILE1 FILE2", executable!()) +} + +fn mkdelim(col: usize, opts: &ArgMatches) -> String { + let mut s = String::new(); + let delim = opts.value_of(options::DELIMITER).unwrap(); + + if col > 1 && !opts.is_present(options::COLUMN_1) { s.push_str(delim.as_ref()); } - if col > 2 && !opts.opt_present("2") { + if col > 2 && !opts.is_present(options::COLUMN_2) { s.push_str(delim.as_ref()); } @@ -57,7 +70,7 @@ impl LineReader { } } -fn comm(a: &mut LineReader, b: &mut LineReader, opts: &getopts::Matches) { +fn comm(a: &mut LineReader, b: &mut LineReader, opts: &ArgMatches) { let delim: Vec = (0..4).map(|col| mkdelim(col, opts)).collect(); let ra = &mut String::new(); @@ -80,7 +93,7 @@ fn comm(a: &mut LineReader, b: &mut LineReader, opts: &getopts::Matches) { match ord { Ordering::Less => { - if !opts.opt_present("1") { + if !opts.is_present(options::COLUMN_1) { ensure_nl(ra); print!("{}{}", delim[1], ra); } @@ -88,7 +101,7 @@ fn comm(a: &mut LineReader, b: &mut LineReader, opts: &getopts::Matches) { na = a.read_line(ra); } Ordering::Greater => { - if !opts.opt_present("2") { + if !opts.is_present(options::COLUMN_2) { ensure_nl(rb); print!("{}{}", delim[2], rb); } @@ -96,7 +109,7 @@ fn comm(a: &mut LineReader, b: &mut LineReader, opts: &getopts::Matches) { nb = b.read_line(rb); } Ordering::Equal => { - if !opts.opt_present("3") { + if !opts.is_present(options::COLUMN_3) { ensure_nl(ra); print!("{}{}", delim[3], ra); } @@ -120,21 +133,42 @@ fn open_file(name: &str) -> io::Result { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optflag("1", "", "suppress column 1 (lines uniq to FILE1)") - .optflag("2", "", "suppress column 2 (lines uniq to FILE2)") - .optflag( - "3", - "", - "suppress column 3 (lines that appear in both files)", + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(LONG_HELP) + .arg( + Arg::with_name(options::COLUMN_1) + .short(options::COLUMN_1) + .help("suppress column 1 (lines unique to FILE1)"), ) - .optopt("", "output-delimiter", "separate columns with STR", "STR") - .parse(args); + .arg( + Arg::with_name(options::COLUMN_2) + .short(options::COLUMN_2) + .help("suppress column 2 (lines unique to FILE2)"), + ) + .arg( + Arg::with_name(options::COLUMN_3) + .short(options::COLUMN_3) + .help("suppress column 3 (lines that appear in both files)"), + ) + .arg( + Arg::with_name(options::DELIMITER) + .long(options::DELIMITER) + .help("separate columns with STR") + .value_name("STR") + .default_value(options::DELIMITER_DEFAULT) + .hide_default_value(true), + ) + .arg(Arg::with_name(options::FILE_1).required(true)) + .arg(Arg::with_name(options::FILE_2).required(true)) + .get_matches_from(args); - let mut f1 = open_file(matches.free[0].as_ref()).unwrap(); - let mut f2 = open_file(matches.free[1].as_ref()).unwrap(); + let mut f1 = open_file(matches.value_of(options::FILE_1).unwrap()).unwrap(); + let mut f2 = open_file(matches.value_of(options::FILE_2).unwrap()).unwrap(); comm(&mut f1, &mut f2, &matches); From 01eb913c05969182c4aadb51fd98f96355f61575 Mon Sep 17 00:00:00 2001 From: Antonio Gurgel Date: Sat, 27 Mar 2021 19:37:58 -0700 Subject: [PATCH 0193/1135] test_install: Add sleeps To ensure timestamps don't match. Fixes #1927. --- tests/by-util/test_install.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 411de61f3..957bb54d5 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -2,6 +2,7 @@ use crate::common::util::*; use filetime::FileTime; use rust_users::*; use std::os::unix::fs::PermissionsExt; +use std::thread::sleep; #[test] fn test_install_help() { @@ -471,6 +472,7 @@ fn test_install_copy_then_compare_file_with_extra_mode() { let mut file2_meta = at.metadata(file2); let before = FileTime::from_last_modification_time(&file2_meta); + sleep(std::time::Duration::from_millis(1000)); scene .ucmd() @@ -487,6 +489,8 @@ fn test_install_copy_then_compare_file_with_extra_mode() { assert!(before != after_install_sticky); + sleep(std::time::Duration::from_millis(1000)); + // dest file still 1644, so need_copy ought to return `true` scene .ucmd() From ebb4568d5270582edc6da5d91976be2b90604088 Mon Sep 17 00:00:00 2001 From: Antonio Gurgel Date: Sat, 27 Mar 2021 22:46:57 -0700 Subject: [PATCH 0194/1135] Forgot to unignore the test --- tests/by-util/test_install.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 957bb54d5..d12dc0b8d 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -453,7 +453,6 @@ fn test_install_copy_then_compare_file() { #[test] #[cfg(target_os = "linux")] -#[ignore] fn test_install_copy_then_compare_file_with_extra_mode() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; From a655117a5fe3bfe09ed02eae852a519714d603c9 Mon Sep 17 00:00:00 2001 From: Antonio Gurgel Date: Sun, 28 Mar 2021 00:42:25 -0700 Subject: [PATCH 0195/1135] `std::thread::sleep` needs target_os Co-authored-by: Sylvestre Ledru --- tests/by-util/test_install.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index d12dc0b8d..af48a0e66 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -2,6 +2,7 @@ use crate::common::util::*; use filetime::FileTime; use rust_users::*; use std::os::unix::fs::PermissionsExt; +#[cfg(target_os = "linux")] use std::thread::sleep; #[test] From 1bfea356a65bae95c4ac5b0cc42439195895e113 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 28 Mar 2021 10:36:44 +0200 Subject: [PATCH 0196/1135] refresh cargo.lock with recent updates --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 9911ba928..5b5869e02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1435,7 +1435,7 @@ dependencies = [ name = "uu_comm" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", From dd0addb9c12e23a43818a1bfe14559921da59a20 Mon Sep 17 00:00:00 2001 From: Sivachandran Paramasivam Date: Sun, 28 Mar 2021 16:30:49 +0530 Subject: [PATCH 0197/1135] pathchk: improve unit test code coverage with more tests --- tests/by-util/test_pathchk.rs | 147 +++++++++++++++++++++++++++++++++- 1 file changed, 144 insertions(+), 3 deletions(-) diff --git a/tests/by-util/test_pathchk.rs b/tests/by-util/test_pathchk.rs index e24a464e0..d01beccc2 100644 --- a/tests/by-util/test_pathchk.rs +++ b/tests/by-util/test_pathchk.rs @@ -5,11 +5,152 @@ fn test_default_mode() { // test the default mode // accept some reasonable default - new_ucmd!().args(&["abc/def"]).succeeds().no_stdout(); + new_ucmd!().args(&["dir/file"]).succeeds().no_stdout(); - // fail on long inputs + // accept non-portable chars + new_ucmd!().args(&["dir#/$file"]).succeeds().no_stdout(); + + // accept empty path + new_ucmd!().args(&[""]).succeeds().no_stdout(); + + // fail on long path new_ucmd!() - .args(&["test".repeat(20000)]) + .args(&["dir".repeat(libc::PATH_MAX as usize + 1)]) + .fails() + .no_stdout(); + + // fail on long filename + new_ucmd!() + .args(&[format!( + "dir/{}", + "file".repeat(libc::FILENAME_MAX as usize + 1) + )]) .fails() .no_stdout(); } + +#[test] +fn test_posix_mode() { + // test the posix mode + + // accept some reasonable default + new_ucmd!().args(&["-p", "dir/file"]).succeeds().no_stdout(); + + // fail on long path + new_ucmd!() + .args(&[ + "-p", + &"dir".repeat(libc::PATH_MAX as usize + 1).as_str(), + ]) + .fails() + .no_stdout(); + + // fail on long filename + new_ucmd!() + .args(&[ + "-p", + &format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(), + ]) + .fails() + .no_stdout(); + + // fail on non-portable chars + new_ucmd!().args(&["-p", "dir#/$file"]).fails().no_stdout(); +} + +#[test] +fn test_posix_special() { + // test the posix special mode + + // accept some reasonable default + new_ucmd!().args(&["-P", "dir/file"]).succeeds().no_stdout(); + + // accept non-portable chars + new_ucmd!() + .args(&["-P", "dir#/$file"]) + .succeeds() + .no_stdout(); + + // accept non-leading hyphen + new_ucmd!() + .args(&["-P", "dir/file-name"]) + .succeeds() + .no_stdout(); + + // fail on long path + new_ucmd!() + .args(&[ + "-P", + &"dir".repeat(libc::PATH_MAX as usize + 1).as_str(), + ]) + .fails() + .no_stdout(); + + // fail on long filename + new_ucmd!() + .args(&[ + "-P", + &format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(), + ]) + .fails() + .no_stdout(); + + // fail on leading hyphen char + new_ucmd!().args(&["-P", "dir/-file"]).fails().no_stdout(); + + // fail on empty path + new_ucmd!().args(&["-P", ""]).fails().no_stdout(); +} + +#[test] +fn test_posix_all() { + // test the posix special mode + + // accept some reasonable default + new_ucmd!().args(&["-p", "-P", "dir/file"]).succeeds().no_stdout(); + + // accept non-leading hyphen + new_ucmd!() + .args(&["-p", "-P", "dir/file-name"]) + .succeeds() + .no_stdout(); + + // fail on long path + new_ucmd!() + .args(&[ + "-p", + "-P", + &"dir".repeat(libc::PATH_MAX as usize + 1).as_str(), + ]) + .fails() + .no_stdout(); + + // fail on long filename + new_ucmd!() + .args(&[ + "-p", + "-P", + &format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(), + ]) + .fails() + .no_stdout(); + + // fail on non-portable chars + new_ucmd!().args(&["-p", "-P", "dir#/$file"]).fails().no_stdout(); + + // fail on leading hyphen char + new_ucmd!().args(&["-p", "-P", "dir/-file"]).fails().no_stdout(); + + // fail on empty path + new_ucmd!().args(&["-p", "-P", ""]).fails().no_stdout(); +} + +#[test] +fn test_args_parsing() { + // fail on no args + let empty_args: [String; 0] = []; + new_ucmd!() + .args(&empty_args) + .fails() + .no_stdout(); +} \ No newline at end of file From 43c6a52b63623d6c75d924ee85617c8556f86f5b Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 28 Mar 2021 13:11:39 +0200 Subject: [PATCH 0198/1135] chmod: move from getopts to clap --- src/uu/chmod/Cargo.toml | 1 + src/uu/chmod/src/chmod.rs | 235 ++++++++++++++++++++++++-------------- 2 files changed, 148 insertions(+), 88 deletions(-) diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index 41b73d8a6..d4917b525 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/chmod.rs" [dependencies] +clap = "2.33.3" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs", "mode"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index 61c56dd77..119447b14 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -10,6 +10,7 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs; use std::os::unix::fs::{MetadataExt, PermissionsExt}; use std::path::Path; @@ -18,115 +19,173 @@ use uucore::fs::display_permissions_unix; use uucore::mode; use walkdir::WalkDir; -const NAME: &str = "chmod"; -static SUMMARY: &str = "Change the mode of each FILE to MODE. +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Change the mode of each FILE to MODE. With --reference, change the mode of each FILE to that of RFILE."; -static LONG_HELP: &str = " - Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+'. -"; + +mod options { + pub const CHANGES: &str = "changes"; + pub const QUIET: &str = "quiet"; // visible_alias("silent") + pub const VERBOSE: &str = "verbose"; + pub const NO_PRESERVE_ROOT: &str = "no-preserve-root"; + pub const PRESERVE_ROOT: &str = "preserve-root"; + pub const REFERENCE: &str = "RFILE"; + pub const RECURSIVE: &str = "recursive"; + pub const MODE: &str = "MODE"; + pub const FILE: &str = "FILE"; +} + +fn get_usage() -> String { + format!( + "{0} [OPTION]... MODE[,MODE]... FILE... +or: {0} [OPTION]... OCTAL-MODE FILE... +or: {0} [OPTION]... --reference=RFILE FILE...", + executable!() + ) +} + +fn get_long_usage() -> String { + String::from("Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+'.") +} pub fn uumain(args: impl uucore::Args) -> i32 { let mut args = args.collect_str(); - let syntax = format!( - "[OPTION]... MODE[,MODE]... FILE... - {0} [OPTION]... OCTAL-MODE FILE... - {0} [OPTION]... --reference=RFILE FILE...", - NAME - ); - let mut opts = app!(&syntax, SUMMARY, LONG_HELP); - opts.optflag( - "c", - "changes", - "like verbose but report only when a change is made", - ) - // TODO: support --silent (can be done using clap) - .optflag("f", "quiet", "suppress most error messages") - .optflag( - "v", - "verbose", - "output a diagnostic for every file processed", - ) - .optflag( - "", - "no-preserve-root", - "do not treat '/' specially (the default)", - ) - .optflag("", "preserve-root", "fail to operate recursively on '/'") - .optopt( - "", - "reference", - "use RFILE's mode instead of MODE values", - "RFILE", - ) - .optflag("R", "recursive", "change files and directories recursively"); + // Before we can parse 'args' with clap (and previously getopts), + // a possible MODE prefix '-' needs to be removed (e.g. "chmod -x FILE"). + let mode_had_minus_prefix = strip_minus_from_mode(&mut args); - // sanitize input for - at beginning (e.g. chmod -x test_file). Remove - // the option and save it for later, after parsing is finished. - let negative_option = sanitize_input(&mut args); + let usage = get_usage(); + let after_help = get_long_usage(); - let mut matches = opts.parse(args); - if matches.free.is_empty() { - show_error!("missing an argument"); - show_error!("for help, try '{} --help'", NAME); - return 1; - } else { - let changes = matches.opt_present("changes"); - let quiet = matches.opt_present("quiet"); - let verbose = matches.opt_present("verbose"); - let preserve_root = matches.opt_present("preserve-root"); - let recursive = matches.opt_present("recursive"); - let fmode = matches - .opt_str("reference") + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(&after_help[..]) + .arg( + Arg::with_name(options::CHANGES) + .long(options::CHANGES) + .short("c") + .help("like verbose but report only when a change is made"), + ) + .arg( + Arg::with_name(options::QUIET) + .long(options::QUIET) + .visible_alias("silent") + .short("f") + .help("suppress most error messages"), + ) + .arg( + Arg::with_name(options::VERBOSE) + .long(options::VERBOSE) + .short("v") + .help("output a diagnostic for every file processed"), + ) + .arg( + Arg::with_name(options::NO_PRESERVE_ROOT) + .long(options::NO_PRESERVE_ROOT) + .help("do not treat '/' specially (the default)"), + ) + .arg( + Arg::with_name(options::PRESERVE_ROOT) + .long(options::PRESERVE_ROOT) + .help("fail to operate recursively on '/'"), + ) + .arg( + Arg::with_name(options::RECURSIVE) + .long(options::RECURSIVE) + .short("R") + .help("change files and directories recursively"), + ) + .arg( + Arg::with_name(options::REFERENCE) + .long("reference") + .takes_value(true) + .help("use RFILE's mode instead of MODE values"), + ) + .arg( + Arg::with_name(options::MODE) + .required_unless(options::REFERENCE) + .takes_value(true), + // It would be nice if clap could parse with delimeter, e.g. "g-x,u+x", + // however .multiple(true) cannot be used here because FILE already needs that. + // Only one positional argument with .multiple(true) set is allowed per command + ) + .arg( + Arg::with_name(options::FILE) + .required_unless(options::MODE) + .multiple(true), + ) + .get_matches_from(args); + + let changes = matches.is_present(options::CHANGES); + let quiet = matches.is_present(options::QUIET); + let verbose = matches.is_present(options::VERBOSE); + let preserve_root = matches.is_present(options::PRESERVE_ROOT); + let recursive = matches.is_present(options::RECURSIVE); + let fmode = + matches + .value_of(options::REFERENCE) .and_then(|ref fref| match fs::metadata(fref) { Ok(meta) => Some(meta.mode()), Err(err) => crash!(1, "cannot stat attributes of '{}': {}", fref, err), }); - let cmode = if fmode.is_none() { - // If there was a negative option, now it's a good time to - // use it. - if negative_option.is_some() { - negative_option - } else { - Some(matches.free.remove(0)) - } - } else { - None - }; - let chmoder = Chmoder { - changes, - quiet, - verbose, - preserve_root, - recursive, - fmode, - cmode, - }; - match chmoder.chmod(matches.free) { - Ok(()) => {} - Err(e) => return e, - } + let modes = matches.value_of(options::MODE).unwrap(); // should always be Some because required + let mut cmode = if mode_had_minus_prefix { + // clap parsing is finished, now put prefix back + Some(format!("-{}", modes)) + } else { + Some(modes.to_string()) + }; + let mut files: Vec = matches + .values_of(options::FILE) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + if fmode.is_some() { + // "--reference" and MODE are mutually exclusive + // if "--reference" was used MODE needs to be interpreted as another FILE + // it wasn't possible to implement this behavior directly with clap + files.push(cmode.unwrap()); + cmode = None; + } + + let chmoder = Chmoder { + changes, + quiet, + verbose, + preserve_root, + recursive, + fmode, + cmode, + }; + match chmoder.chmod(files) { + Ok(()) => {} + Err(e) => return e, } 0 } -fn sanitize_input(args: &mut Vec) -> Option { +// Iterate 'args' and delete the first occurrence +// of a prefix '-' if it's associated with MODE +// e.g. "chmod -v -xw -R FILE" -> "chmod -v xw -R FILE" +fn strip_minus_from_mode(args: &mut Vec) -> bool { for i in 0..args.len() { - let first = args[i].chars().next().unwrap(); - if first != '-' { - continue; - } - if let Some(second) = args[i].chars().nth(1) { - match second { - 'r' | 'w' | 'x' | 'X' | 's' | 't' | 'u' | 'g' | 'o' | '0'..='7' => { - return Some(args.remove(i)); + if args[i].starts_with("-") { + if let Some(second) = args[i].chars().nth(1) { + match second { + 'r' | 'w' | 'x' | 'X' | 's' | 't' | 'u' | 'g' | 'o' | '0'..='7' => { + // TODO: use strip_prefix() once minimum rust version reaches 1.45.0 + args[i] = args[i][1..args[i].len()].to_string(); + return true; + } + _ => {} } - _ => {} } } } - None + false } struct Chmoder { From 6d4f70ccb24294f7f6d1e4165809efae41919e13 Mon Sep 17 00:00:00 2001 From: Craig Pastro Date: Sun, 28 Mar 2021 22:08:37 +0900 Subject: [PATCH 0199/1135] shuf: move from getopts to clap (#1950) --- Cargo.lock | 1960 ++++++++++++++++++------------------ src/uu/shuf/Cargo.toml | 2 +- src/uu/shuf/src/shuf.rs | 279 ++--- tests/by-util/test_shuf.rs | 56 +- 4 files changed, 1186 insertions(+), 1111 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5b5869e02..343ad1e30 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,2651 +4,2649 @@ name = "advapi32-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8", + "winapi-build", ] [[package]] name = "aho-corasick" version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4", ] [[package]] name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "arrayvec" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" dependencies = [ - "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop", ] [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", + "winapi 0.3.9", ] [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "bit-set" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" dependencies = [ - "bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bit-vec", ] [[package]] name = "bit-vec" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "blake2-rfc" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ - "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec", + "constant_time_eq", ] [[package]] name = "block-buffer" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" dependencies = [ - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools", + "generic-array", ] [[package]] name = "bstr" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "memchr 2.3.4", + "regex-automata", + "serde", ] [[package]] name = "bumpalo" version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" [[package]] name = "byte-tools" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cast" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" dependencies = [ - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version", ] [[package]] name = "cc" version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" [[package]] name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" dependencies = [ - "num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer", + "num-traits", + "time", ] [[package]] name = "clap" version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", ] [[package]] name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", ] [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "conv" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" dependencies = [ - "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "custom_derive", ] [[package]] name = "coreutils" version = "0.0.4" dependencies = [ - "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_arch 0.0.4", - "uu_base32 0.0.4", - "uu_base64 0.0.4", - "uu_basename 0.0.4", - "uu_cat 0.0.4", - "uu_chgrp 0.0.4", - "uu_chmod 0.0.4", - "uu_chown 0.0.4", - "uu_chroot 0.0.4", - "uu_cksum 0.0.4", - "uu_comm 0.0.4", - "uu_cp 0.0.4", - "uu_csplit 0.0.4", - "uu_cut 0.0.4", - "uu_date 0.0.4", - "uu_df 0.0.4", - "uu_dircolors 0.0.4", - "uu_dirname 0.0.4", - "uu_du 0.0.4", - "uu_echo 0.0.4", - "uu_env 0.0.4", - "uu_expand 0.0.4", - "uu_expr 0.0.4", - "uu_factor 0.0.4", - "uu_false 0.0.4", - "uu_fmt 0.0.4", - "uu_fold 0.0.4", - "uu_groups 0.0.4", - "uu_hashsum 0.0.4", - "uu_head 0.0.4", - "uu_hostid 0.0.4", - "uu_hostname 0.0.4", - "uu_id 0.0.4", - "uu_install 0.0.4", - "uu_join 0.0.4", - "uu_kill 0.0.4", - "uu_link 0.0.4", - "uu_ln 0.0.4", - "uu_logname 0.0.4", - "uu_ls 0.0.4", - "uu_mkdir 0.0.4", - "uu_mkfifo 0.0.4", - "uu_mknod 0.0.4", - "uu_mktemp 0.0.4", - "uu_more 0.0.4", - "uu_mv 0.0.4", - "uu_nice 0.0.4", - "uu_nl 0.0.4", - "uu_nohup 0.0.4", - "uu_nproc 0.0.4", - "uu_numfmt 0.0.4", - "uu_od 0.0.4", - "uu_paste 0.0.4", - "uu_pathchk 0.0.4", - "uu_pinky 0.0.4", - "uu_printenv 0.0.4", - "uu_printf 0.0.4", - "uu_ptx 0.0.4", - "uu_pwd 0.0.4", - "uu_readlink 0.0.4", - "uu_realpath 0.0.4", - "uu_relpath 0.0.4", - "uu_rm 0.0.4", - "uu_rmdir 0.0.4", - "uu_seq 0.0.4", - "uu_shred 0.0.4", - "uu_shuf 0.0.4", - "uu_sleep 0.0.4", - "uu_sort 0.0.4", - "uu_split 0.0.4", - "uu_stat 0.0.4", - "uu_stdbuf 0.0.4", - "uu_sum 0.0.4", - "uu_sync 0.0.4", - "uu_tac 0.0.4", - "uu_tail 0.0.4", - "uu_tee 0.0.4", - "uu_test 0.0.4", - "uu_timeout 0.0.4", - "uu_touch 0.0.4", - "uu_tr 0.0.4", - "uu_true 0.0.4", - "uu_truncate 0.0.4", - "uu_tsort 0.0.4", - "uu_tty 0.0.4", - "uu_uname 0.0.4", - "uu_unexpand 0.0.4", - "uu_uniq 0.0.4", - "uu_unlink 0.0.4", - "uu_uptime 0.0.4", - "uu_users 0.0.4", - "uu_wc 0.0.4", - "uu_who 0.0.4", - "uu_whoami 0.0.4", - "uu_yes 0.0.4", - "uucore 0.0.7", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "conv", + "filetime", + "glob 0.3.0", + "lazy_static", + "libc", + "nix 0.20.0", + "rand 0.7.3", + "regex", + "sha1", + "tempfile", + "textwrap", + "time", + "unindent", + "unix_socket", + "users", + "uu_arch", + "uu_base32", + "uu_base64", + "uu_basename", + "uu_cat", + "uu_chgrp", + "uu_chmod", + "uu_chown", + "uu_chroot", + "uu_cksum", + "uu_comm", + "uu_cp", + "uu_csplit", + "uu_cut", + "uu_date", + "uu_df", + "uu_dircolors", + "uu_dirname", + "uu_du", + "uu_echo", + "uu_env", + "uu_expand", + "uu_expr", + "uu_factor", + "uu_false", + "uu_fmt", + "uu_fold", + "uu_groups", + "uu_hashsum", + "uu_head", + "uu_hostid", + "uu_hostname", + "uu_id", + "uu_install", + "uu_join", + "uu_kill", + "uu_link", + "uu_ln", + "uu_logname", + "uu_ls", + "uu_mkdir", + "uu_mkfifo", + "uu_mknod", + "uu_mktemp", + "uu_more", + "uu_mv", + "uu_nice", + "uu_nl", + "uu_nohup", + "uu_nproc", + "uu_numfmt", + "uu_od", + "uu_paste", + "uu_pathchk", + "uu_pinky", + "uu_printenv", + "uu_printf", + "uu_ptx", + "uu_pwd", + "uu_readlink", + "uu_realpath", + "uu_relpath", + "uu_rm", + "uu_rmdir", + "uu_seq", + "uu_shred", + "uu_shuf", + "uu_sleep", + "uu_sort", + "uu_split", + "uu_stat", + "uu_stdbuf", + "uu_sum", + "uu_sync", + "uu_tac", + "uu_tail", + "uu_tee", + "uu_test", + "uu_timeout", + "uu_touch", + "uu_tr", + "uu_true", + "uu_truncate", + "uu_tsort", + "uu_tty", + "uu_uname", + "uu_unexpand", + "uu_uniq", + "uu_unlink", + "uu_uptime", + "uu_users", + "uu_wc", + "uu_who", + "uu_whoami", + "uu_yes", + "uucore", + "walkdir", ] [[package]] name = "cpp" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" dependencies = [ - "cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_macros", ] [[package]] name = "cpp_build" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" dependencies = [ - "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "cpp_common 0.4.0", + "cpp_syn", + "cpp_synmap", + "cpp_synom", + "lazy_static", ] [[package]] name = "cpp_common" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" dependencies = [ - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn", + "cpp_synom", + "lazy_static", + "quote 0.3.15", ] [[package]] name = "cpp_common" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "proc-macro2", + "syn", ] [[package]] name = "cpp_macros" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "byteorder", + "cpp_common 0.5.6", + "if_rust_version", + "lazy_static", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "cpp_syn" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" dependencies = [ - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom", + "quote 0.3.15", + "unicode-xid 0.0.4", ] [[package]] name = "cpp_synmap" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" dependencies = [ - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn", + "cpp_synom", + "memchr 1.0.2", ] [[package]] name = "cpp_synom" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" dependencies = [ - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4", ] [[package]] name = "criterion" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", - "tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "cast", + "clap", + "criterion-plot", + "csv", + "itertools 0.10.0", + "lazy_static", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", ] [[package]] name = "criterion-plot" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" dependencies = [ - "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cast", + "itertools 0.9.0", ] [[package]] name = "crossbeam-channel" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-utils", ] [[package]] name = "crossbeam-deque" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-epoch", + "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-utils", + "lazy_static", + "memoffset", + "scopeguard", ] [[package]] name = "crossbeam-utils" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "cfg-if 1.0.0", + "lazy_static", ] [[package]] name = "csv" version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" dependencies = [ - "bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", - "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr", + "csv-core", + "itoa", + "ryu", + "serde", ] [[package]] name = "csv-core" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" dependencies = [ - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4", ] [[package]] name = "custom_derive" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" [[package]] name = "data-encoding" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" [[package]] name = "digest" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" dependencies = [ - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array", ] [[package]] name = "dunce" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "env_logger" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "regex", ] [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "file_diff" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31a7a908b8f32538a2143e59a6e4e2508988832d5d4d6f7c156b3cbc762643a5" [[package]] name = "filetime" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "libc", + "redox_syscall 0.2.5", + "winapi 0.3.9", ] [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fs_extra" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "generic-array" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" dependencies = [ - "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "typenum 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop", + "typenum", ] [[package]] name = "getopts" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" dependencies = [ - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "getrandom" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "libc", + "wasi", ] [[package]] name = "glob" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "half" version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" [[package]] name = "hermit-abi" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "hex" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" [[package]] name = "hostname" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "match_cfg", + "winapi 0.3.9", ] [[package]] name = "if_rust_version" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" [[package]] name = "ioctl-sys" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" [[package]] name = "itertools" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itertools" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itertools" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itoa" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "js-sys" version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821" dependencies = [ - "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen", ] [[package]] name = "kernel32-sys" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8", + "winapi-build", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" [[package]] name = "log" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", ] [[package]] name = "match_cfg" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" [[package]] name = "maybe-uninit" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "md5" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" [[package]] name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "memchr" version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memoffset" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "nix" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "cc", + "cfg-if 0.1.10", + "libc", + "void", ] [[package]] name = "nix" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "cc", + "cfg-if 1.0.0", + "libc", ] [[package]] name = "nodrop" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "num-integer" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "num-traits", ] [[package]] name = "num-traits" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "num_cpus" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", ] [[package]] name = "number_prefix" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "numtoa" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" [[package]] name = "onig" version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "lazy_static", + "libc", + "onig_sys", ] [[package]] name = "onig_sys" version = "69.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" dependencies = [ - "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "pkg-config", ] [[package]] name = "oorandom" version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "paste" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" dependencies = [ - "paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", + "paste-impl", + "proc-macro-hack", ] [[package]] name = "paste-impl" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" dependencies = [ - "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack", ] [[package]] name = "pkg-config" version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "platform-info" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "winapi 0.3.9", ] [[package]] name = "plotters" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" dependencies = [ - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", ] [[package]] name = "plotters-backend" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" [[package]] name = "plotters-svg" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" dependencies = [ - "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-backend", ] [[package]] name = "ppv-lite86" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "proc-macro-hack" version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1", ] [[package]] name = "quick-error" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quickcheck" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" dependencies = [ - "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger", + "log", + "rand 0.7.3", + "rand_core 0.5.1", ] [[package]] name = "quote" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "rand" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "winapi 0.3.9", ] [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom", + "libc", + "rand_chacha", + "rand_core 0.5.1", + "rand_hc", + "rand_pcg", ] [[package]] name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ - "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86", + "rand_core 0.5.1", ] [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" dependencies = [ - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2", ] [[package]] name = "rand_core" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" [[package]] name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom", ] [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1", ] [[package]] name = "rand_pcg" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1", ] [[package]] name = "rayon" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", ] [[package]] name = "rayon-core" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" dependencies = [ - "crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static", + "num_cpus", ] [[package]] name = "redox_syscall" version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", ] [[package]] name = "redox_termios" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" dependencies = [ - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5", ] [[package]] name = "regex" version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "memchr 2.3.4", + "regex-syntax", ] [[package]] name = "regex-automata" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" dependencies = [ - "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder", ] [[package]] name = "regex-syntax" version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" [[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "retain_mut" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1" [[package]] name = "rust-ini" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" [[package]] name = "rustc_version" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver", ] [[package]] name = "ryu" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "same-file" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ - "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util", ] [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver-parser", ] [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" [[package]] name = "serde_cbor" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" dependencies = [ - "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "half", + "serde", ] [[package]] name = "serde_derive" version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "serde_json" version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ - "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa", + "ryu", + "serde", ] [[package]] name = "sha1" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "sha2" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" dependencies = [ - "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer", + "byte-tools", + "digest", + "fake-simd", + "generic-array", ] [[package]] name = "sha3" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" dependencies = [ - "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer", + "byte-tools", + "digest", + "generic-array", ] [[package]] name = "smallvec" version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" dependencies = [ - "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit", ] [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1d708c221c5a612956ef9f75b37e454e88d1f7b899fbd3a18d4252012d663" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "unicode-xid 0.2.1", ] [[package]] name = "tempfile" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "libc", + "rand 0.7.3", + "redox_syscall 0.1.57", + "remove_dir_all", + "winapi 0.3.9", ] [[package]] name = "term_grid" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" dependencies = [ - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "term_size" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "winapi 0.3.9", ] [[package]] name = "termion" version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "numtoa", + "redox_syscall 0.2.5", + "redox_termios", ] [[package]] name = "termsize" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "kernel32-sys", + "libc", + "termion", + "winapi 0.2.8", ] [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "term_size", + "unicode-width", ] [[package]] name = "thiserror" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" dependencies = [ - "thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "redox_syscall 0.1.57", + "winapi 0.3.9", ] [[package]] name = "tinytemplate" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "serde", + "serde_json", ] [[package]] name = "typenum" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" [[package]] name = "unicode-width" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" [[package]] name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "unindent" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" [[package]] name = "unix_socket" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "libc", ] [[package]] name = "users" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "log", ] [[package]] name = "uu_arch" version = "0.0.4" dependencies = [ - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "platform-info", + "uucore", + "uucore_procs", ] [[package]] name = "uu_base32" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_base64" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_basename" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cat" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "quick-error", + "unix_socket", + "uucore", + "uucore_procs", ] [[package]] name = "uu_chgrp" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chmod" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chown" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "glob 0.3.0", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chroot" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cksum" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_comm" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cp" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "filetime", + "ioctl-sys", + "libc", + "quick-error", + "uucore", + "uucore_procs", + "walkdir", + "winapi 0.3.9", + "xattr", ] [[package]] name = "uu_csplit" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "glob 0.2.11", + "regex", + "thiserror", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cut" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_date" version = "0.0.4" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono", + "clap", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_df" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "number_prefix", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_dircolors" version = "0.0.4" dependencies = [ - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "glob 0.3.0", + "uucore", + "uucore_procs", ] [[package]] name = "uu_dirname" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_du" version = "0.0.4" dependencies = [ - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_echo" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_env" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "rust-ini", + "uucore", + "uucore_procs", ] [[package]] name = "uu_expand" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_expr" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "onig", + "uucore", + "uucore_procs", ] [[package]] name = "uu_factor" version = "0.0.4" dependencies = [ - "criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "criterion", + "num-traits", + "paste", + "quickcheck", + "rand 0.7.3", + "rand_chacha", + "smallvec", + "uucore", + "uucore_procs", ] [[package]] name = "uu_false" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_fmt" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_fold" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_groups" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hashsum" version = "0.0.4" dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "blake2-rfc", + "clap", + "digest", + "hex", + "libc", + "md5", + "regex", + "regex-syntax", + "sha1", + "sha2", + "sha3", + "uucore", + "uucore_procs", ] [[package]] name = "uu_head" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hostid" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hostname" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "hostname", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_id" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_install" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "file_diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "file_diff", + "filetime", + "libc", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_join" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_kill" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_link" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ln" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_logname" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ls" version = "0.0.4" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "atty", + "clap", + "lazy_static", + "number_prefix", + "term_grid", + "termsize", + "time", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mkdir" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mkfifo" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mknod" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mktemp" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "rand 0.5.6", + "tempfile", + "uucore", + "uucore_procs", ] [[package]] name = "uu_more" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "nix 0.13.1", + "redox_syscall 0.1.57", + "redox_termios", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mv" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "fs_extra", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nice" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "nix 0.13.1", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nl" version = "0.0.4" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "aho-corasick", + "clap", + "libc", + "memchr 2.3.4", + "regex", + "regex-syntax", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nohup" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nproc" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "num_cpus", + "uucore", + "uucore_procs", ] [[package]] name = "uu_numfmt" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_od" version = "0.0.4" dependencies = [ - "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "byteorder", + "clap", + "half", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_paste" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pathchk" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pinky" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_printenv" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_printf" version = "0.0.4" dependencies = [ - "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "itertools 0.8.2", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ptx" version = "0.0.4" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "aho-corasick", + "clap", + "libc", + "memchr 2.3.4", + "regex", + "regex-syntax", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pwd" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_readlink" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_realpath" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_relpath" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_rm" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "remove_dir_all", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_rmdir" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_seq" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_shred" version = "0.0.4" dependencies = [ - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "filetime", + "getopts", + "libc", + "rand 0.5.6", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_shuf" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "rand 0.5.6", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sleep" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sort" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "itertools 0.8.2", + "semver", + "uucore", + "uucore_procs", ] [[package]] name = "uu_split" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stat" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stdbuf" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_stdbuf_libstdbuf 0.0.4", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "tempfile", + "uu_stdbuf_libstdbuf", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stdbuf_libstdbuf" version = "0.0.4" dependencies = [ - "cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "cpp", + "cpp_build", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sum" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sync" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_tac" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tail" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "redox_syscall 0.1.57", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_tee" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "retain_mut 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "retain_mut", + "uucore", + "uucore_procs", ] [[package]] name = "uu_test" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "redox_syscall 0.1.57", + "uucore", + "uucore_procs", ] [[package]] name = "uu_timeout" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_touch" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "filetime", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tr" version = "0.0.4" dependencies = [ - "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "bit-set", + "fnv", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_true" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_truncate" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tsort" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tty" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uname" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "platform-info", + "uucore", + "uucore_procs", ] [[package]] name = "uu_unexpand" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uniq" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_unlink" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uptime" version = "0.0.4" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "chrono", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_users" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_wc" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_who" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_whoami" version = "0.0.4" dependencies = [ - "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "advapi32-sys", + "clap", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_yes" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uucore" version = "0.0.7" dependencies = [ - "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "data-encoding", + "dunce", + "getopts", + "lazy_static", + "libc", + "nix 0.13.1", + "platform-info", + "termion", + "thiserror", + "time", + "wild", ] [[package]] name = "uucore_procs" version = "0.0.5" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "walkdir" version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" dependencies = [ - "same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file", + "winapi 0.3.9", + "winapi-util", ] [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" dependencies = [ - "bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote 1.0.9", + "syn", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b" dependencies = [ - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9", + "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" [[package]] name = "web-sys" version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310" dependencies = [ - "js-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys", + "wasm-bindgen", ] [[package]] name = "wild" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" dependencies = [ - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0", ] [[package]] name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] - -[metadata] -"checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" -"checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" -"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -"checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -"checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" -"checksum bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" -"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" -"checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" -"checksum bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" -"checksum bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" -"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" -"checksum byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -"checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" -"checksum cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)" = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" -"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" -"checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" -"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" -"checksum cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" -"checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" -"checksum cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" -"checksum cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" -"checksum cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" -"checksum cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" -"checksum cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" -"checksum cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" -"checksum criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" -"checksum criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" -"checksum crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" -"checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" -"checksum crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" -"checksum crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" -"checksum csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" -"checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" -"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" -"checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" -"checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" -"checksum dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" -"checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -"checksum file_diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "31a7a908b8f32538a2143e59a6e4e2508988832d5d4d6f7c156b3cbc762643a5" -"checksum filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" -"checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -"checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" -"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -"checksum generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" -"checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" -"checksum getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -"checksum half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" -"checksum hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" -"checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" -"checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" -"checksum if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" -"checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" -"checksum itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" -"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" -"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -"checksum itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" -"checksum js-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)" = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" -"checksum log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" -"checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" -"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" -"checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" -"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" -"checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" -"checksum memoffset 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cc14fc54a812b4472b4113facc3e44d099fbc0ea2ce0551fa5c703f8edfbfd38" -"checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" -"checksum nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" -"checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" -"checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" -"checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -"checksum number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" -"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" -"checksum onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" -"checksum onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" -"checksum oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" -"checksum paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" -"checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" -"checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" -"checksum platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" -"checksum plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" -"checksum plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" -"checksum plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" -"checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" -"checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" -"checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" -"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -"checksum quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" -"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" -"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" -"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -"checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" -"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -"checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -"checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" -"checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" -"checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" -"checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" -"checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" -"checksum regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" -"checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -"checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" -"checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -"checksum retain_mut 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1" -"checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" -"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -"checksum same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)" = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" -"checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -"checksum serde_derive 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)" = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" -"checksum serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)" = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" -"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" -"checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" -"checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" -"checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)" = "f3a1d708c221c5a612956ef9f75b37e454e88d1f7b899fbd3a18d4252012d663" -"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" -"checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" -"checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" -"checksum termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" -"checksum termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" -"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -"checksum thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" -"checksum thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" -"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" -"checksum typenum 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" -"checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" -"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" -"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" -"checksum unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" -"checksum unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" -"checksum users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" -"checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" -"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -"checksum wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" -"checksum wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" -"checksum wasm-bindgen-macro 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b" -"checksum wasm-bindgen-macro-support 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d" -"checksum wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" -"checksum web-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310" -"checksum wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index b78d4fc04..5e7c6c71a 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/shuf.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" rand = "0.5" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/shuf/src/shuf.rs b/src/uu/shuf/src/shuf.rs index 278e872fb..f7af05214 100644 --- a/src/uu/shuf/src/shuf.rs +++ b/src/uu/shuf/src/shuf.rs @@ -10,132 +10,162 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use rand::Rng; use std::fs::File; use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write}; -use std::usize::MAX as MAX_USIZE; - -enum Mode { - Default, - Echo, - InputRange((usize, usize)), -} static NAME: &str = "shuf"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static USAGE: &str = r#"shuf [OPTION]... [FILE] + or: shuf -e [OPTION]... [ARG]... + or: shuf -i LO-HI [OPTION]... +Write a random permutation of the input lines to standard output. + +With no FILE, or when FILE is -, read standard input. +"#; +static TEMPLATE: &str = "Usage: {usage}\nMandatory arguments to long options are mandatory for short options too.\n{unified}"; + +struct Options { + head_count: usize, + output: Option, + random_source: Option, + repeat: bool, + sep: u8, +} + +enum Mode { + Default(String), + Echo(Vec), + InputRange((usize, usize)), +} + +mod options { + pub static ECHO: &str = "echo"; + pub static INPUT_RANGE: &str = "input-range"; + pub static HEAD_COUNT: &str = "head-count"; + pub static OUTPUT: &str = "output"; + pub static RANDOM_SOURCE: &str = "random-source"; + pub static REPEAT: &str = "repeat"; + pub static ZERO_TERMINATED: &str = "zero-terminated"; + pub static FILE: &str = "file"; +} pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .template(TEMPLATE) + .usage(USAGE) + .arg( + Arg::with_name(options::ECHO) + .short("e") + .long(options::ECHO) + .takes_value(true) + .value_name("ARG") + .help("treat each ARG as an input line") + .multiple(true) + .use_delimiter(false) + .min_values(0) + .conflicts_with(options::INPUT_RANGE), + ) + .arg( + Arg::with_name(options::INPUT_RANGE) + .short("i") + .long(options::INPUT_RANGE) + .takes_value(true) + .value_name("LO-HI") + .help("treat each number LO through HI as an input line") + .conflicts_with(options::FILE), + ) + .arg( + Arg::with_name(options::HEAD_COUNT) + .short("n") + .long(options::HEAD_COUNT) + .takes_value(true) + .value_name("COUNT") + .help("output at most COUNT lines"), + ) + .arg( + Arg::with_name(options::OUTPUT) + .short("o") + .long(options::OUTPUT) + .takes_value(true) + .value_name("FILE") + .help("write result to FILE instead of standard output"), + ) + .arg( + Arg::with_name(options::RANDOM_SOURCE) + .long(options::RANDOM_SOURCE) + .takes_value(true) + .value_name("FILE") + .help("get random bytes from FILE"), + ) + .arg( + Arg::with_name(options::REPEAT) + .short("r") + .long(options::REPEAT) + .help("output lines can be repeated"), + ) + .arg( + Arg::with_name(options::ZERO_TERMINATED) + .short("z") + .long(options::ZERO_TERMINATED) + .help("line delimiter is NUL, not newline"), + ) + .arg(Arg::with_name(options::FILE).takes_value(true)) + .get_matches_from(args); - let mut opts = getopts::Options::new(); - opts.optflag("e", "echo", "treat each ARG as an input line"); - opts.optopt( - "i", - "input-range", - "treat each number LO through HI as an input line", - "LO-HI", - ); - opts.optopt("n", "head-count", "output at most COUNT lines", "COUNT"); - opts.optopt( - "o", - "output", - "write result to FILE instead of standard output", - "FILE", - ); - opts.optopt("", "random-source", "get random bytes from FILE", "FILE"); - opts.optflag("r", "repeat", "output lines can be repeated"); - opts.optflag("z", "zero-terminated", "end lines with 0 byte, not newline"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - let mut matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f), - }; - if matches.opt_present("help") { - let msg = format!( - "{0} {1} - -Usage: - {0} [OPTION]... [FILE] - {0} -e [OPTION]... [ARG]... - {0} -i LO-HI [OPTION]... - -Write a random permutation of the input lines to standard output. -With no FILE, or when FILE is -, read standard input.", - NAME, VERSION - ); - print!("{}", opts.usage(&msg)); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); + let mode = if let Some(args) = matches.values_of(options::ECHO) { + Mode::Echo(args.map(String::from).collect()) + } else if let Some(range) = matches.value_of(options::INPUT_RANGE) { + match parse_range(range) { + Ok(m) => Mode::InputRange(m), + Err(msg) => { + crash!(1, "{}", msg); + } + } } else { - let echo = matches.opt_present("echo"); - let mode = match matches.opt_str("input-range") { - Some(range) => { - if echo { - show_error!("cannot specify more than one mode"); - return 1; - } - match parse_range(range) { - Ok(m) => Mode::InputRange(m), - Err(msg) => { - crash!(1, "{}", msg); - } - } - } - None => { - if echo { - Mode::Echo - } else { - if matches.free.is_empty() { - matches.free.push("-".to_owned()); - } else if matches.free.len() > 1 { - show_error!("extra operand '{}'", &matches.free[1][..]); - } - Mode::Default - } - } - }; - let repeat = matches.opt_present("repeat"); - let sep = if matches.opt_present("zero-terminated") { - 0x00_u8 - } else { - 0x0a_u8 - }; - let count = match matches.opt_str("head-count") { - Some(cnt) => match cnt.parse::() { + Mode::Default(matches.value_of(options::FILE).unwrap_or("-").to_string()) + }; + + let options = Options { + head_count: match matches.value_of(options::HEAD_COUNT) { + Some(count) => match count.parse::() { Ok(val) => val, - Err(e) => { - show_error!("'{}' is not a valid count: {}", cnt, e); + Err(_) => { + show_error!("invalid line count: '{}'", count); return 1; } }, - None => MAX_USIZE, - }; - let output = matches.opt_str("output"); - let random = matches.opt_str("random-source"); + None => std::usize::MAX, + }, + output: matches.value_of(options::OUTPUT).map(String::from), + random_source: matches.value_of(options::RANDOM_SOURCE).map(String::from), + repeat: matches.is_present(options::REPEAT), + sep: if matches.is_present(options::ZERO_TERMINATED) { + 0x00_u8 + } else { + 0x0a_u8 + }, + }; - match mode { - Mode::Echo => { - // XXX: this doesn't correctly handle non-UTF-8 cmdline args - let mut evec = matches - .free - .iter() - .map(String::as_bytes) - .collect::>(); - find_seps(&mut evec, sep); - shuf_bytes(&mut evec, repeat, count, sep, output, random); - } - Mode::InputRange((b, e)) => { - let rvec = (b..e).map(|x| format!("{}", x)).collect::>(); - let mut rvec = rvec.iter().map(String::as_bytes).collect::>(); - shuf_bytes(&mut rvec, repeat, count, sep, output, random); - } - Mode::Default => { - let fdata = read_input_file(&matches.free[0][..]); - let mut fdata = vec![&fdata[..]]; - find_seps(&mut fdata, sep); - shuf_bytes(&mut fdata, repeat, count, sep, output, random); - } + match mode { + Mode::Echo(args) => { + let mut evec = args.iter().map(String::as_bytes).collect::>(); + find_seps(&mut evec, options.sep); + shuf_bytes(&mut evec, options); + } + Mode::InputRange((b, e)) => { + let rvec = (b..e).map(|x| format!("{}", x)).collect::>(); + let mut rvec = rvec.iter().map(String::as_bytes).collect::>(); + shuf_bytes(&mut rvec, options); + } + Mode::Default(filename) => { + let fdata = read_input_file(&filename); + let mut fdata = vec![&fdata[..]]; + find_seps(&mut fdata, options.sep); + shuf_bytes(&mut fdata, options); } } @@ -193,15 +223,8 @@ fn find_seps(data: &mut Vec<&[u8]>, sep: u8) { } } -fn shuf_bytes( - input: &mut Vec<&[u8]>, - repeat: bool, - count: usize, - sep: u8, - output: Option, - random: Option, -) { - let mut output = BufWriter::new(match output { +fn shuf_bytes(input: &mut Vec<&[u8]>, opts: Options) { + let mut output = BufWriter::new(match opts.output { None => Box::new(stdout()) as Box, Some(s) => match File::create(&s[..]) { Ok(f) => Box::new(f) as Box, @@ -209,7 +232,7 @@ fn shuf_bytes( }, }); - let mut rng = match random { + let mut rng = match opts.random_source { Some(r) => WrappedRng::RngFile(rand::read::ReadRng::new(match File::open(&r[..]) { Ok(f) => f, Err(e) => crash!(1, "failed to open random source '{}': {}", &r[..], e), @@ -225,7 +248,7 @@ fn shuf_bytes( len_mod <<= 1; } - let mut count = count; + let mut count = opts.head_count; while count > 0 && !input.is_empty() { let mut r = input.len(); while r >= input.len() { @@ -237,11 +260,11 @@ fn shuf_bytes( .write_all(input[r]) .unwrap_or_else(|e| crash!(1, "write failed: {}", e)); output - .write_all(&[sep]) + .write_all(&[opts.sep]) .unwrap_or_else(|e| crash!(1, "write failed: {}", e)); // if we do not allow repeats, remove the chosen value from the input vector - if !repeat { + if !opts.repeat { // shrink the mask if we will drop below a power of 2 if input.len() % 2 == 0 && len_mod > 2 { len_mod >>= 1; @@ -253,18 +276,18 @@ fn shuf_bytes( } } -fn parse_range(input_range: String) -> Result<(usize, usize), String> { +fn parse_range(input_range: &str) -> Result<(usize, usize), String> { let split: Vec<&str> = input_range.split('-').collect(); if split.len() != 2 { - Err("invalid range format".to_owned()) + Err(format!("invalid input range: '{}'", input_range)) } else { let begin = match split[0].parse::() { Ok(m) => m, - Err(e) => return Err(format!("{} is not a valid number: {}", split[0], e)), + Err(_) => return Err(format!("invalid input range: '{}'", split[0])), }; let end = match split[1].parse::() { Ok(m) => m, - Err(e) => return Err(format!("{} is not a valid number: {}", split[1], e)), + Err(_) => return Err(format!("invalid input range: '{}'", split[1])), }; Ok((begin, end + 1)) } diff --git a/tests/by-util/test_shuf.rs b/tests/by-util/test_shuf.rs index 651491045..3913621ef 100644 --- a/tests/by-util/test_shuf.rs +++ b/tests/by-util/test_shuf.rs @@ -1 +1,55 @@ -// ToDO: add tests +// ToDO: add more tests + +use crate::common::util::*; + +#[test] +fn test_shuf_echo_and_input_range_not_allowed() { + let result = new_ucmd!().args(&["-e", "0", "-i", "0-2"]).run(); + + assert!(!result.success); + assert!(result + .stderr + .contains("The argument '--input-range ' cannot be used with '--echo ...'")); +} + +#[test] +fn test_shuf_input_range_and_file_not_allowed() { + let result = new_ucmd!().args(&["-i", "0-9", "file"]).run(); + + assert!(!result.success); + assert!(result + .stderr + .contains("The argument '' cannot be used with '--input-range '")); +} + +#[test] +fn test_shuf_invalid_input_range_one() { + let result = new_ucmd!().args(&["-i", "0"]).run(); + + assert!(!result.success); + assert!(result.stderr.contains("invalid input range")); +} + +#[test] +fn test_shuf_invalid_input_range_two() { + let result = new_ucmd!().args(&["-i", "a-9"]).run(); + + assert!(!result.success); + assert!(result.stderr.contains("invalid input range: 'a'")); +} + +#[test] +fn test_shuf_invalid_input_range_three() { + let result = new_ucmd!().args(&["-i", "0-b"]).run(); + + assert!(!result.success); + assert!(result.stderr.contains("invalid input range: 'b'")); +} + +#[test] +fn test_shuf_invalid_input_line_count() { + let result = new_ucmd!().args(&["-n", "a"]).run(); + + assert!(!result.success); + assert!(result.stderr.contains("invalid line count: 'a'")); +} From 88d0bb01c01f238a611f24687d089f272ad44f12 Mon Sep 17 00:00:00 2001 From: jaggededgedjustice Date: Sun, 28 Mar 2021 16:52:01 +0100 Subject: [PATCH 0200/1135] Add shuf tests (#1958) * Add tests for shuf * Fixup GNU tests for shuf --- .github/workflows/GNU.yml | 4 +- tests/by-util/test_shuf.rs | 165 ++++++++++++++++++++++++++++- tests/fixtures/shuf/file_input.txt | 10 ++ 3 files changed, 175 insertions(+), 4 deletions(-) create mode 100644 tests/fixtures/shuf/file_input.txt diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 9eb5da2b9..35efccbe5 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -84,8 +84,8 @@ jobs: sed -i 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh sed -i 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh tests/du/8gb.sh sed -i 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i 's|timeout \([[:digit:]]\)| /usr/bin/timeout \1|' tests/tail-2/inotify-rotate.sh tests/tail-2/inotify-dir-recreate.sh tests/tail-2/inotify-rotate-resources.sh tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh tests/tail-2/follow-name.sh # Don't break the function called 'grep_timeout' - sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh tests/tail-2/tail-n0f.sh tests/cp/fail-perm.sh tests/du/inaccessible-cwd.sh tests/mv/i-2.sh tests/chgrp/basic.sh + sed -i 's|timeout \([[:digit:]]\)| /usr/bin/timeout \1|' tests/tail-2/inotify-rotate.sh tests/tail-2/inotify-dir-recreate.sh tests/tail-2/inotify-rotate-resources.sh tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh tests/tail-2/follow-name.sh tests/misc/shuf.sh # Don't break the function called 'grep_timeout' + sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh tests/tail-2/tail-n0f.sh tests/cp/fail-perm.sh tests/du/inaccessible-cwd.sh tests/mv/i-2.sh tests/chgrp/basic.sh tests/misc/shuf.sh sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/misc/test-N.sh sed -i 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh sed -i 's|truncate |/usr/bin/truncate |' tests/split/fail.sh diff --git a/tests/by-util/test_shuf.rs b/tests/by-util/test_shuf.rs index 3913621ef..065cef804 100644 --- a/tests/by-util/test_shuf.rs +++ b/tests/by-util/test_shuf.rs @@ -1,7 +1,168 @@ -// ToDO: add more tests - use crate::common::util::*; +#[test] +fn test_output_is_random_permutation() { + let input_seq = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let input = input_seq + .iter() + .map(|x| x.to_string()) + .collect::>() + .join("\n"); + + let result = new_ucmd!() + .pipe_in(input.as_bytes()) + .succeeds() + .no_stderr() + .stdout + .clone(); + + let mut result_seq: Vec = result + .split("\n") + .filter(|x| !x.is_empty()) + .map(|x| x.parse().unwrap()) + .collect(); + result_seq.sort(); + assert_ne!(result, input, "Output is not randomised"); + assert_eq!(result_seq, input_seq, "Output is not a permutation"); +} + +#[test] +fn test_zero_termination() { + let input_seq = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let result = new_ucmd!() + .arg("-z") + .arg("-i1-10") + .succeeds() + .no_stderr() + .stdout + .clone(); + + let mut result_seq: Vec = result + .split("\0") + .filter(|x| !x.is_empty()) + .map(|x| x.parse().unwrap()) + .collect(); + result_seq.sort(); + assert_eq!(result_seq, input_seq, "Output is not a permutation"); +} + +#[test] +fn test_echo() { + let input_seq = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let result = new_ucmd!() + .arg("-e") + .args( + &input_seq + .iter() + .map(|x| x.to_string()) + .collect::>(), + ) + .succeeds() + .no_stderr() + .stdout + .clone(); + + let mut result_seq: Vec = result + .split("\n") + .filter(|x| !x.is_empty()) + .map(|x| x.parse().unwrap()) + .collect(); + result_seq.sort(); + assert_eq!(result_seq, input_seq, "Output is not a permutation"); +} + +#[test] +fn test_head_count() { + let repeat_limit = 5; + let input_seq = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let input = input_seq + .iter() + .map(|x| x.to_string()) + .collect::>() + .join("\n"); + + let result = new_ucmd!() + .args(&["-n", &repeat_limit.to_string()]) + .pipe_in(input.as_bytes()) + .succeeds() + .no_stderr() + .stdout + .clone(); + + let mut result_seq: Vec = result + .split("\n") + .filter(|x| !x.is_empty()) + .map(|x| x.parse().unwrap()) + .collect(); + result_seq.sort(); + assert_eq!(result_seq.len(), repeat_limit, "Output is not limited"); + assert!( + result_seq.iter().all(|x| input_seq.contains(x)), + format!("Output includes element not from input: {}", result) + ) +} + +#[test] +fn test_repeat() { + let repeat_limit = 15000; + let input_seq = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let input = input_seq + .iter() + .map(|x| x.to_string()) + .collect::>() + .join("\n"); + + let result = new_ucmd!() + .arg("-r") + .args(&["-n", &repeat_limit.to_string()]) + .pipe_in(input.as_bytes()) + .succeeds() + .no_stderr() + .stdout + .clone(); + + let result_seq: Vec = result + .split("\n") + .filter(|x| !x.is_empty()) + .map(|x| x.parse().unwrap()) + .collect(); + assert_eq!( + result_seq.len(), + repeat_limit, + "Output is not repeating forever" + ); + assert!( + result_seq.iter().all(|x| input_seq.contains(x)), + format!( + "Output includes element not from input: {:?}", + result_seq + .iter() + .filter(|x| !input_seq.contains(x)) + .collect::>() + ) + ) +} + +#[test] +fn test_file_input() { + let expected_seq = vec![11, 12, 13, 14, 15, 16, 17, 18, 19, 20]; + + let result = new_ucmd!() + .arg("file_input.txt") + .succeeds() + .no_stderr() + .stdout + .clone(); + + let mut result_seq: Vec = result + .split("\n") + .filter(|x| !x.is_empty()) + .map(|x| x.parse().unwrap()) + .collect(); + result_seq.sort(); + assert_eq!(result_seq, expected_seq, "Output is not a permutation"); +} + #[test] fn test_shuf_echo_and_input_range_not_allowed() { let result = new_ucmd!().args(&["-e", "0", "-i", "0-2"]).run(); diff --git a/tests/fixtures/shuf/file_input.txt b/tests/fixtures/shuf/file_input.txt new file mode 100644 index 000000000..fc316949e --- /dev/null +++ b/tests/fixtures/shuf/file_input.txt @@ -0,0 +1,10 @@ +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 From a9a3794d5a366f185d65e8c4908b4db180cdec20 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 28 Mar 2021 20:56:37 +0200 Subject: [PATCH 0201/1135] chmod: add tests --- src/uu/chmod/src/chmod.rs | 2 +- tests/by-util/test_chmod.rs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index 119447b14..819c674a0 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -170,7 +170,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // Iterate 'args' and delete the first occurrence // of a prefix '-' if it's associated with MODE // e.g. "chmod -v -xw -R FILE" -> "chmod -v xw -R FILE" -fn strip_minus_from_mode(args: &mut Vec) -> bool { +pub fn strip_minus_from_mode(args: &mut Vec) -> bool { for i in 0..args.len() { if args[i].starts_with("-") { if let Some(second) = args[i].chars().nth(1) { diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index e7bc72677..3a53202fc 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -4,6 +4,8 @@ use std::os::unix::fs::{OpenOptionsExt, PermissionsExt}; use std::sync::Mutex; extern crate libc; +use self::chmod::strip_minus_from_mode; +extern crate chmod; use self::libc::umask; static TEST_FILE: &'static str = "file"; @@ -374,3 +376,32 @@ fn test_chmod_symlink_non_existing_recursive() { .stderr .contains("neither symbolic link 'tmp/test-long.link' nor referent has been changed")); } + +#[test] +fn test_chmod_strip_minus_from_mode() { + let tests = vec![ + // ( before, after ) + ("chmod -v -xw -R FILE", "chmod -v xw -R FILE"), + ("chmod g=rwx FILE -c", "chmod g=rwx FILE -c"), + ( + "chmod -c -R -w,o+w FILE --preserve-root", + "chmod -c -R w,o+w FILE --preserve-root", + ), + ("chmod -c -R +w FILE ", "chmod -c -R +w FILE "), + ("chmod a=r,=xX FILE", "chmod a=r,=xX FILE"), + ( + "chmod -v --reference RFILE -R FILE", + "chmod -v --reference RFILE -R FILE", + ), + ("chmod -Rvc -w-x FILE", "chmod -Rvc w-x FILE"), + ("chmod 755 -v FILE", "chmod 755 -v FILE"), + ("chmod -v +0004 FILE -R", "chmod -v +0004 FILE -R"), + ("chmod -v -0007 FILE -R", "chmod -v 0007 FILE -R"), + ]; + + for test in tests { + let mut args: Vec = test.0.split(" ").map(|v| v.to_string()).collect(); + let _mode_had_minus_prefix = strip_minus_from_mode(&mut args); + assert_eq!(test.1, args.join(" ")); + } +} From 3714e2201b388b8d07e81ded15031433dab7a2db Mon Sep 17 00:00:00 2001 From: Dominik Bittner Date: Mon, 29 Mar 2021 13:00:47 +0200 Subject: [PATCH 0202/1135] tty: Move from getopts to clap (#1956) + tty: Add some tests --- src/uu/tty/Cargo.toml | 2 +- src/uu/tty/src/tty.rs | 90 ++++++++++++++++++--------------------- tests/by-util/test_tty.rs | 58 ++++++++++++++++++++++++- 3 files changed, 100 insertions(+), 50 deletions(-) diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index 9912a3b9a..7e4ffbd79 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/tty.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/tty/src/tty.rs b/src/uu/tty/src/tty.rs index 110f76d30..18d69db46 100644 --- a/src/uu/tty/src/tty.rs +++ b/src/uu/tty/src/tty.rs @@ -12,68 +12,62 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::ffi::CStr; use uucore::fs::is_stdin_interactive; -extern "C" { - fn ttyname(filedesc: libc::c_int) -> *const libc::c_char; +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Print the file name of the terminal connected to standard input."; + +mod options { + pub const SILENT: &str = "silent"; } -static NAME: &str = "tty"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); +fn get_usage() -> String { + format!("{0} [OPTION]...", executable!()) +} pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); + let usage = get_usage(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(options::SILENT) + .long(options::SILENT) + .visible_alias("quiet") + .short("s") + .help("print nothing, only return an exit status") + .required(false), + ) + .get_matches_from(args); - opts.optflag("s", "silent", "print nothing, only return an exit status"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); + let silent = matches.is_present(options::SILENT); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(2, "{}", f), + // Call libc function ttyname + let tty = unsafe { + let ptr = libc::ttyname(libc::STDIN_FILENO); + if !ptr.is_null() { + String::from_utf8_lossy(CStr::from_ptr(ptr).to_bytes()).to_string() + } else { + "".to_owned() + } }; - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(); - println!("Usage:"); - println!(" {} [OPTION]...", NAME); - println!(); - print!( - "{}", - opts.usage("Print the file name of the terminal connected to standard input.") - ); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else { - let silent = matches.opt_present("s"); - - let tty = unsafe { - let ptr = ttyname(libc::STDIN_FILENO); - if !ptr.is_null() { - String::from_utf8_lossy(CStr::from_ptr(ptr).to_bytes()).to_string() - } else { - "".to_owned() - } - }; - - if !silent { - if !tty.chars().all(|c| c.is_whitespace()) { - println!("{}", tty); - } else { - println!("not a tty"); - } - } - - return if is_stdin_interactive() { - libc::EXIT_SUCCESS + if !silent { + if !tty.chars().all(|c| c.is_whitespace()) { + println!("{}", tty); } else { - libc::EXIT_FAILURE - }; + println!("not a tty"); + } } - 0 + return if is_stdin_interactive() { + libc::EXIT_SUCCESS + } else { + libc::EXIT_FAILURE + }; } diff --git a/tests/by-util/test_tty.rs b/tests/by-util/test_tty.rs index 651491045..6bca54e03 100644 --- a/tests/by-util/test_tty.rs +++ b/tests/by-util/test_tty.rs @@ -1 +1,57 @@ -// ToDO: add tests +use crate::common::util::*; + +#[test] +#[cfg(not(windows))] +fn test_dev_null() { + new_ucmd!() + .pipe_in(" Date: Mon, 29 Mar 2021 21:33:24 +1030 Subject: [PATCH 0203/1135] tr: move from getopts to claps #1929 (#1954) --- Cargo.lock | 6 +-- src/uu/tr/Cargo.toml | 2 +- src/uu/tr/src/tr.rs | 101 +++++++++++++++++++++++++------------------ 3 files changed, 62 insertions(+), 47 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 343ad1e30..8d42c573e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1325,9 +1325,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.65" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3a1d708c221c5a612956ef9f75b37e454e88d1f7b899fbd3a18d4252012d663" +checksum = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" dependencies = [ "proc-macro2", "quote 1.0.9", @@ -2334,8 +2334,8 @@ name = "uu_tr" version = "0.0.4" dependencies = [ "bit-set", + "clap", "fnv", - "getopts", "uucore", "uucore_procs", ] diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index 918698e24..3683211f6 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -17,7 +17,7 @@ path = "src/tr.rs" [dependencies] bit-set = "0.5.0" fnv = "1.0.5" -getopts = "0.2.18" +clap = "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index d60d2559a..ff1bb49d5 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -16,16 +16,27 @@ extern crate uucore; mod expand; use bit_set::BitSet; +use clap::{App, Arg}; use fnv::FnvHashMap; -use getopts::Options; use std::io::{stdin, stdout, BufRead, BufWriter, Write}; use crate::expand::ExpandSet; static NAME: &str = "tr"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "translate or delete characters"; +static LONG_HELP: &str = "Translate, squeeze, and/or delete characters from standard input, +writing to standard output."; const BUFFER_LEN: usize = 1024; +mod options { + pub const COMPLEMENT: &str = "complement"; + pub const DELETE: &str = "delete"; + pub const SQUEEZE: &str = "squeeze-repeats"; + pub const TRUNCATE: &str = "truncate"; + pub const SETS: &str = "sets"; +} + trait SymbolTranslator { fn translate(&self, c: char, prev_c: char) -> Option; } @@ -170,56 +181,60 @@ fn translate_input( } } -fn usage(opts: &Options) { - println!("{} {}", NAME, VERSION); - println!(); - println!("Usage:"); - println!(" {} [OPTIONS] SET1 [SET2]", NAME); - println!(); - println!("{}", opts.usage("Translate or delete characters.")); +fn get_usage() -> String { + format!("{} [OPTION]... SET1 [SET2]", executable!()) } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let mut opts = Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(LONG_HELP) + .arg( + Arg::with_name(options::COMPLEMENT) + .short("C") + .short("c") + .long(options::COMPLEMENT) + .help("use the complement of SET1"), + ) + .arg( + Arg::with_name(options::DELETE) + .short("d") + .long(options::DELETE) + .help("delete characters in SET1, do not translate"), + ) + .arg( + Arg::with_name(options::SQUEEZE) + .long(options::SQUEEZE) + .short("s") + .help( + "replace each sequence of a repeated character that is + listed in the last specified SET, with a single occurrence + of that character", + ), + ) + .arg( + Arg::with_name(options::TRUNCATE) + .long(options::TRUNCATE) + .short("t") + .help("first truncate SET1 to length of SET2"), + ) + .arg(Arg::with_name(options::SETS).multiple(true)) + .get_matches_from(args); - opts.optflag("c", "complement", "use the complement of SET1"); - opts.optflag("C", "", "same as -c"); - opts.optflag("d", "delete", "delete characters in SET1"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("s", "squeeze", "replace each sequence of a repeated character that is listed in the last specified SET, with a single occurrence of that character"); - opts.optflag( - "t", - "truncate-set1", - "first truncate SET1 to length of SET2", - ); - opts.optflag("V", "version", "output version information and exit"); + let dflag = matches.is_present(options::DELETE); + let cflag = matches.is_present(options::COMPLEMENT); + let sflag = matches.is_present(options::SQUEEZE); + let tflag = matches.is_present(options::TRUNCATE); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(err) => { - show_error!("{}", err); - return 1; - } + let sets: Vec = match matches.values_of(options::SETS) { + Some(v) => v.map(|v| v.to_string()).collect(), + None => vec![], }; - if matches.opt_present("help") { - usage(&opts); - return 0; - } - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let dflag = matches.opt_present("d"); - let cflag = matches.opts_present(&["c".to_owned(), "C".to_owned()]); - let sflag = matches.opt_present("s"); - let tflag = matches.opt_present("t"); - let sets = matches.free; - if sets.is_empty() { show_error!( "missing operand\nTry `{} --help` for more information.", From 8cc7a90d7ceb580b695ac5c2de264467456bbd69 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Mon, 29 Mar 2021 14:03:56 +0300 Subject: [PATCH 0204/1135] sum: fix crash on invalid inputs, move to clap, add tests (#1952) --- Cargo.lock | 6 +-- src/uu/sum/Cargo.toml | 2 +- src/uu/sum/src/sum.rs | 93 ++++++++++++++++++++++----------------- tests/by-util/test_sum.rs | 20 +++++++++ 4 files changed, 77 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8d42c573e..c950fb58e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2250,9 +2250,9 @@ dependencies = [ name = "uu_sum" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index a880ba1f7..1e8590616 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/sum.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/sum/src/sum.rs b/src/uu/sum/src/sum.rs index 5c1652196..ed5655a3d 100644 --- a/src/uu/sum/src/sum.rs +++ b/src/uu/sum/src/sum.rs @@ -10,12 +10,16 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs::File; use std::io::{stdin, Read, Result}; use std::path::Path; static NAME: &str = "sum"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static USAGE: &str = + "[OPTION]... [FILE]...\nWith no FILE, or when FILE is -, read standard input."; +static SUMMARY: &str = "Checksum and count the blocks in a file."; fn bsd_sum(mut reader: Box) -> (usize, u16) { let mut buf = [0; 1024]; @@ -64,55 +68,59 @@ fn open(name: &str) -> Result> { match name { "-" => Ok(Box::new(stdin()) as Box), _ => { - let f = File::open(&Path::new(name))?; + let path = &Path::new(name); + if path.is_dir() { + return Err(std::io::Error::new( + std::io::ErrorKind::InvalidInput, + "Is a directory", + )); + }; + if !path.metadata().is_ok() { + return Err(std::io::Error::new( + std::io::ErrorKind::NotFound, + "No such file or directory", + )); + }; + let f = File::open(path)?; Ok(Box::new(f) as Box) } } } +mod options { + pub static FILE: &str = "file"; + pub static BSD_COMPATIBLE: &str = "r"; + pub static SYSTEM_V_COMPATIBLE: &str = "sysv"; +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(USAGE) + .about(SUMMARY) + .arg(Arg::with_name(options::FILE).multiple(true).hidden(true)) + .arg( + Arg::with_name(options::BSD_COMPATIBLE) + .short(options::BSD_COMPATIBLE) + .help("use the BSD compatible algorithm (default)"), + ) + .arg( + Arg::with_name(options::SYSTEM_V_COMPATIBLE) + .short("s") + .long(options::SYSTEM_V_COMPATIBLE) + .help("use the BSD compatible algorithm (default)"), + ) + .get_matches_from(args); - opts.optflag("r", "", "use the BSD compatible algorithm (default)"); - opts.optflag("s", "sysv", "use System V compatible algorithm"); - opts.optflag("h", "help", "show this help message"); - opts.optflag("v", "version", "print the version and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f), + let files: Vec = match matches.values_of(options::FILE) { + Some(v) => v.clone().map(|v| v.to_owned()).collect(), + None => vec!["-".to_owned()], }; - if matches.opt_present("help") { - let msg = format!( - "{0} {1} - -Usage: - {0} [OPTION]... [FILE]... - -Checksum and count the blocks in a file.", - NAME, VERSION - ); - println!( - "{}\nWith no FILE, or when FILE is -, read standard input.", - opts.usage(&msg) - ); - return 0; - } - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let sysv = matches.opt_present("sysv"); - - let files = if matches.free.is_empty() { - vec!["-".to_owned()] - } else { - matches.free - }; + let sysv = matches.is_present(options::SYSTEM_V_COMPATIBLE); let print_names = if sysv { files.len() > 1 || files[0] != "-" @@ -120,10 +128,15 @@ Checksum and count the blocks in a file.", files.len() > 1 }; + let mut exit_code = 0; for file in &files { let reader = match open(file) { Ok(f) => f, - _ => crash!(1, "unable to open file"), + Err(error) => { + show_error!("'{}' {}", file, error); + exit_code = 2; + continue; + } }; let (blocks, sum) = if sysv { sysv_sum(reader) @@ -138,5 +151,5 @@ Checksum and count the blocks in a file.", } } - 0 + exit_code } diff --git a/tests/by-util/test_sum.rs b/tests/by-util/test_sum.rs index 83cf689ac..d12455749 100644 --- a/tests/by-util/test_sum.rs +++ b/tests/by-util/test_sum.rs @@ -52,3 +52,23 @@ fn test_sysv_stdin() { .succeeds() .stdout_only_fixture("sysv_stdin.expected"); } + +#[test] +fn test_invalid_file() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.mkdir("a"); + + ucmd.arg("a") + .fails() + .stderr_is("sum: error: 'a' Is a directory"); +} + +#[test] +fn test_invalid_metadata() { + let (_, mut ucmd) = at_and_ucmd!(); + + ucmd.arg("b") + .fails() + .stderr_is("sum: error: 'b' No such file or directory"); +} From da5f2f3a6c774fd495ec003065321a4c31843db2 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Mon, 29 Mar 2021 06:05:52 -0500 Subject: [PATCH 0205/1135] sort: Add a GNU-style Random Sorter (#1922) --- Cargo.lock | 19 ++++ src/uu/sort/Cargo.toml | 2 + src/uu/sort/src/sort.rs | 222 +++++++++++++++++++++++++++++++------ tests/by-util/test_sort.rs | 62 +++++++++-- 4 files changed, 261 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c950fb58e..07a99069c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1317,6 +1317,12 @@ dependencies = [ "maybe-uninit", ] +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "strsim" version = "0.8.0" @@ -1443,6 +1449,17 @@ dependencies = [ "serde_json", ] +[[package]] +name = "twox-hash" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59" +dependencies = [ + "cfg-if 0.1.10", + "rand 0.7.3", + "static_assertions", +] + [[package]] name = "typenum" version = "1.13.0" @@ -2200,7 +2217,9 @@ version = "0.0.4" dependencies = [ "clap", "itertools 0.8.2", + "rand 0.7.3", "semver", + "twox-hash", "uucore", "uucore_procs", ] diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 5158f6e52..e50caf53b 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -15,7 +15,9 @@ edition = "2018" path = "src/sort.rs" [dependencies] +rand = "0.7" clap = "2.33" +twox-hash = "1.6.0" itertools = "0.8.0" semver = "0.9.0" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 8e79ff947..f8789835a 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1,6 +1,7 @@ // * This file is part of the uutils coreutils package. // * // * (c) Michael Yin +// * (c) Robert Swinford // * // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. @@ -12,13 +13,17 @@ extern crate uucore; use clap::{App, Arg}; use itertools::Itertools; +use rand::distributions::Alphanumeric; +use rand::{thread_rng, Rng}; use semver::Version; use std::cmp::Ordering; use std::collections::BinaryHeap; use std::fs::File; +use std::hash::{Hash, Hasher}; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Lines, Read, Write}; use std::mem::replace; use std::path::Path; +use twox_hash::XxHash64; use uucore::fs::is_stdin_interactive; // for Iterator::dedup() static NAME: &str = "sort"; @@ -34,16 +39,18 @@ static OPT_DICTIONARY_ORDER: &str = "dictionary-order"; static OPT_MERGE: &str = "merge"; static OPT_CHECK: &str = "check"; static OPT_IGNORE_CASE: &str = "ignore-case"; +static OPT_IGNORE_BLANKS: &str = "ignore-blanks"; static OPT_OUTPUT: &str = "output"; static OPT_REVERSE: &str = "reverse"; static OPT_STABLE: &str = "stable"; static OPT_UNIQUE: &str = "unique"; +static OPT_RANDOM: &str = "random-sort"; static ARG_FILES: &str = "files"; static DECIMAL_PT: char = '.'; static THOUSANDS_SEP: char = ','; - +#[derive(Eq, Ord, PartialEq, PartialOrd)] enum SortMode { Numeric, HumanNumeric, @@ -60,8 +67,10 @@ struct Settings { stable: bool, unique: bool, check: bool, + random: bool, compare_fns: Vec Ordering>, transform_fns: Vec String>, + salt: String, } impl Default for Settings { @@ -74,8 +83,10 @@ impl Default for Settings { stable: false, unique: false, check: false, + random: false, compare_fns: Vec::new(), transform_fns: Vec::new(), + salt: String::new(), } } } @@ -155,17 +166,14 @@ impl<'a> Iterator for FileMerger<'a> { } } } + fn get_usage() -> String { format!( "{0} {1} - Usage: {0} [OPTION]... [FILE]... - Write the sorted concatenation of all FILE(s) to standard output. - Mandatory arguments for long options are mandatory for short options too. - With no FILE, or when FILE is -, read standard input.", NAME, VERSION ) @@ -228,6 +236,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_IGNORE_CASE) .help("fold lower case to upper case characters"), ) + .arg( + Arg::with_name(OPT_IGNORE_BLANKS) + .short("b") + .long(OPT_IGNORE_BLANKS) + .help("ignore leading blanks when finding sort keys in each line"), + ) .arg( Arg::with_name(OPT_OUTPUT) .short("o") @@ -236,6 +250,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .value_name("FILENAME"), ) + .arg( + Arg::with_name(OPT_RANDOM) + .short("R") + .long(OPT_RANDOM) + .help("shuffle in random order"), + ) .arg( Arg::with_name(OPT_REVERSE) .short("r") @@ -285,11 +305,20 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.transform_fns.push(|s| s.to_uppercase()); } + if matches.is_present(OPT_IGNORE_BLANKS) { + settings.transform_fns.push(|s| s.trim_start().to_string()); + } + settings.outfile = matches.value_of(OPT_OUTPUT).map(String::from); settings.reverse = matches.is_present(OPT_REVERSE); settings.stable = matches.is_present(OPT_STABLE); settings.unique = matches.is_present(OPT_UNIQUE); + if matches.is_present(OPT_RANDOM) { + settings.random = matches.is_present(OPT_RANDOM); + settings.salt = get_rand_string(); + } + //let mut files = matches.free; if files.is_empty() { /* if no file, default to stdin */ @@ -313,10 +342,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } - exec(files, &settings) + exec(files, &mut settings) } -fn exec(files: Vec, settings: &Settings) -> i32 { +fn exec(files: Vec, settings: &mut Settings) -> i32 { let mut lines = Vec::new(); let mut file_merger = FileMerger::new(&settings); @@ -351,6 +380,13 @@ fn exec(files: Vec, settings: &Settings) -> i32 { } else { print_sorted(file_merger, &settings.outfile) } + } else if settings.unique && settings.mode == SortMode::Numeric { + print_sorted( + lines + .iter() + .dedup_by(|a, b| num_sort_dedup(a) == num_sort_dedup(b)), + &settings.outfile, + ) } else if settings.unique { print_sorted(lines.iter().dedup(), &settings.outfile) } else { @@ -419,7 +455,11 @@ fn compare_by(a: &str, b: &str, settings: &Settings) -> Ordering { }; for compare_fn in &settings.compare_fns { - let cmp = compare_fn(a, b); + let cmp: Ordering = if settings.random { + random_shuffle(a, b, settings.salt.clone()) + } else { + compare_fn(a, b) + }; if cmp != Ordering::Equal { if settings.reverse { return cmp.reverse(); @@ -431,36 +471,60 @@ fn compare_by(a: &str, b: &str, settings: &Settings) -> Ordering { Ordering::Equal } -/// Parse the beginning string into an f64, returning -inf instead of NaN on errors. -fn permissive_f64_parse(a: &str) -> f64 { - // Maybe should be split on non-digit, but then 10e100 won't parse properly. - // On the flip side, this will give NEG_INFINITY for "1,234", which might be OK - // because there's no way to handle both CSV and thousands separators without a new flag. - // GNU sort treats "1,234" as "1" in numeric, so maybe it's fine. - // GNU sort treats "NaN" as non-number in numeric, so it needs special care. - match a.split_whitespace().next() { - None => std::f64::NEG_INFINITY, - Some(sa) => match sa.parse::() { - Ok(a) if a.is_nan() => std::f64::NEG_INFINITY, - Ok(a) => a, - Err(_) => std::f64::NEG_INFINITY, - }, - } -} - fn default_compare(a: &str, b: &str) -> Ordering { a.cmp(b) } -/// Compares two floating point numbers, with errors being assumed to be -inf. -/// Stops coercing at the first whitespace char, so 1e2 will parse as 100 but -/// 1,000 will parse as -inf. +fn get_leading_number(a: &str) -> &str { + let mut s = ""; + for c in a.chars() { + if !c.is_numeric() && !c.eq(&'-') && !c.eq(&' ') && !c.eq(&'.') && !c.eq(&',') { + s = a.trim().split(c).next().unwrap(); + break; + } + s = a.trim(); + } + return s; +} + +// Matches GNU behavior, see: +// https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html +// Specifically *not* the same as sort -n | uniq +fn num_sort_dedup(a: &str) -> &str { + // Empty lines are dumped + if a.is_empty() { + return "0" + // And lines that don't begin numerically are dumped + } else if !a.trim().chars().nth(0).unwrap_or('\0').is_numeric() { + return "0" + } else { + // Prepare lines for comparison of only the numerical leading numbers + return get_leading_number(a) + }; +} + +/// Parse the beginning string into an f64, returning -inf instead of NaN on errors. +fn permissive_f64_parse(a: &str) -> f64 { + // GNU sort treats "NaN" as non-number in numeric, so it needs special care. + match a.parse::() { + Ok(a) if a.is_nan() => std::f64::NEG_INFINITY, + Ok(a) => a, + Err(_) => std::f64::NEG_INFINITY, + } +} + +/// Compares two floats, with errors and non-numerics assumed to be -inf. +/// Stops coercing at the first non-numeric char. fn numeric_compare(a: &str, b: &str) -> Ordering { #![allow(clippy::comparison_chain)] - let fa = permissive_f64_parse(a); - let fb = permissive_f64_parse(b); - // f64::cmp isn't implemented because NaN messes with it - // but we sidestep that with permissive_f64_parse so just fake it + + let sa = get_leading_number(a); + let sb = get_leading_number(b); + + let fa = permissive_f64_parse(sa); + let fb = permissive_f64_parse(sb); + + // f64::cmp isn't implemented (due to NaN issues); implement directly instead if fa > fb { Ordering::Greater } else if fa < fb { @@ -471,10 +535,10 @@ fn numeric_compare(a: &str, b: &str) -> Ordering { } fn human_numeric_convert(a: &str) -> f64 { - let int_str: String = a.chars().take_while(|c| c.is_numeric()).collect(); - let suffix = a.chars().find(|c| !c.is_numeric()); - let int_part = int_str.parse::().unwrap_or(-1f64) as f64; - let suffix: f64 = match suffix.unwrap_or('\0') { + let int_str = get_leading_number(a); + let (_, s) = a.split_at(int_str.len()); + let int_part = permissive_f64_parse(int_str); + let suffix: f64 = match s.parse().unwrap_or('\0') { 'K' => 1000f64, 'M' => 1E6, 'G' => 1E9, @@ -501,6 +565,30 @@ fn human_numeric_size_compare(a: &str, b: &str) -> Ordering { } } +fn random_shuffle(a: &str, b: &str, salt: String) -> Ordering { + #![allow(clippy::comparison_chain)] + let salt_slice = salt.as_str(); + + let da = hash(&[a, salt_slice].concat()); + let db = hash(&[b, salt_slice].concat()); + + da.cmp(&db) +} + +fn get_rand_string() -> String { + thread_rng() + .sample_iter(&Alphanumeric) + .take(16) + .map(char::from) + .collect::() +} + +fn hash(t: &T) -> u64 { + let mut s: XxHash64 = Default::default(); + t.hash(&mut s); + s.finish() +} + #[derive(Eq, Ord, PartialEq, PartialOrd)] enum Month { Unknown, @@ -606,3 +694,65 @@ fn open(path: &str) -> Option<(Box, bool)> { } } } + +#[cfg(test)] +mod tests { + + use super::*; + + #[test] + fn test_default_compare() { + let a = "your own"; + let b = "your place"; + + assert_eq!(Ordering::Less, default_compare(a, b)); + } + + #[test] + fn test_numeric_compare1() { + let a = "149:7"; + let b = "150:5"; + + assert_eq!(Ordering::Less, numeric_compare(a, b)); + } + + #[test] + fn test_numeric_compare2() { + let a = "-1.02"; + let b = "1"; + + assert_eq!(Ordering::Less, numeric_compare(a, b)); + } + + #[test] + fn test_human_numeric_compare() { + let a = "300K"; + let b = "1M"; + + assert_eq!(Ordering::Less, human_numeric_size_compare(a, b)); + } + + #[test] + fn test_month_compare() { + let a = "JaN"; + let b = "OCt"; + + assert_eq!(Ordering::Less, month_compare(a, b)); + } + #[test] + fn test_version_compare() { + let a = "1.2.3-alpha2"; + let b = "1.4.0"; + + assert_eq!(Ordering::Less, version_compare(a, b)); + } + + #[test] + fn test_random_compare() { + let a = "9"; + let b = "9"; + let c = get_rand_string(); + + assert_eq!(Ordering::Equal, random_shuffle(a, b, c)); + } +} diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 9ff1b3522..2bac71def 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -2,22 +2,43 @@ use crate::common::util::*; #[test] fn test_numeric_floats_and_ints() { - test_helper("numeric_floats_and_ints", "-n"); + for numeric_sort_param in vec!["-n", "--numeric-sort"] { + let input = "1.444\n8.013\n1\n-8\n1.04\n-1"; + new_ucmd!() + .arg(numeric_sort_param) + .pipe_in(input) + .succeeds() + .stdout_only("-8\n-1\n1\n1.04\n1.444\n8.013\n"); + } } #[test] fn test_numeric_floats() { - test_helper("numeric_floats", "-n"); + for numeric_sort_param in vec!["-n", "--numeric-sort"] { + let input = "1.444\n8.013\n1.58590\n-8.90880\n1.040000000\n-.05"; + new_ucmd!() + .arg(numeric_sort_param) + .pipe_in(input) + .succeeds() + .stdout_only("-8.90880\n-.05\n1.040000000\n1.444\n1.58590\n8.013\n"); + } } #[test] fn test_numeric_floats_with_nan() { - test_helper("numeric_floats_with_nan", "-n"); + for numeric_sort_param in vec!["-n", "--numeric-sort"] { + let input = "1.444\n1.0/0.0\n1.58590\n-8.90880\n1.040000000\n-.05"; + new_ucmd!() + .arg(numeric_sort_param) + .pipe_in(input) + .succeeds() + .stdout_only("-8.90880\n-.05\n1.0/0.0\n1.040000000\n1.444\n1.58590\n"); + } } #[test] fn test_numeric_unfixed_floats() { - test_helper("numeric_unfixed_floats", "-n"); + test_helper("numeric_fixed_floats", "-n"); } #[test] @@ -32,12 +53,26 @@ fn test_numeric_unsorted_ints() { #[test] fn test_human_block_sizes() { - test_helper("human_block_sizes", "-h"); + for human_numeric_sort_param in vec!["-h", "--human-numeric-sort"] { + let input = "8981K\n909991M\n-8T\n21G\n0.8M"; + new_ucmd!() + .arg(human_numeric_sort_param) + .pipe_in(input) + .succeeds() + .stdout_only("-8T\n0.8M\n8981K\n21G\n909991M\n"); + } } #[test] fn test_month_default() { - test_helper("month_default", "-M"); + for month_sort_param in vec!["-M", "--month-sort"] { + let input = "JAn\nMAY\n000may\nJun\nFeb"; + new_ucmd!() + .arg(month_sort_param) + .pipe_in(input) + .succeeds() + .stdout_only("000may\nJAn\nFeb\nMAY\nJun\n"); + } } #[test] @@ -47,12 +82,23 @@ fn test_month_stable() { #[test] fn test_default_unsorted_ints() { - test_helper("default_unsorted_ints", ""); + let input = "9\n1909888\n000\n1\n2"; + new_ucmd!() + .pipe_in(input) + .succeeds() + .stdout_only("000\n1\n1909888\n2\n9\n"); } #[test] fn test_numeric_unique_ints() { - test_helper("numeric_unsorted_ints_unique", "-nu"); + for numeric_unique_sort_param in vec!["-nu"] { + let input = "9\n9\n8\n1\n"; + new_ucmd!() + .arg(numeric_unique_sort_param) + .pipe_in(input) + .succeeds() + .stdout_only("1\n8\n9\n"); + } } #[test] From 8320b1ec5f58a94372edce2477480fb0116df262 Mon Sep 17 00:00:00 2001 From: Mikadore Date: Mon, 29 Mar 2021 13:08:48 +0200 Subject: [PATCH 0206/1135] Rewrote head (#1911) See https://github.com/uutils/coreutils/pull/1911 for the details --- src/uu/head/Cargo.toml | 2 +- src/uu/head/src/head.rs | 828 +++++++++++++----- src/uu/head/src/parse.rs | 282 ++++++ src/uu/head/src/split.rs | 60 ++ tests/by-util/test_head.rs | 105 ++- .../head/lorem_ipsum_backwards_file.expected | 24 + tests/fixtures/head/sequence | 100 +++ tests/fixtures/head/sequence.expected | 90 ++ 8 files changed, 1235 insertions(+), 256 deletions(-) create mode 100644 src/uu/head/src/parse.rs create mode 100644 src/uu/head/src/split.rs mode change 100644 => 100755 tests/by-util/test_head.rs create mode 100644 tests/fixtures/head/lorem_ipsum_backwards_file.expected create mode 100644 tests/fixtures/head/sequence create mode 100644 tests/fixtures/head/sequence.expected diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index adcce2726..1cd075113 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/head.rs" [dependencies] -libc = "0.2.42" +clap = "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 0036dbba9..a8f519f6b 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -1,240 +1,642 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Alan Andrade -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. -// * -// * Synced with: https://raw.github.com/avsm/src/master/usr.bin/head/head.c +use clap::{App, Arg}; +use std::convert::TryFrom; +use std::ffi::OsString; +use std::io::{ErrorKind, Read, Seek, SeekFrom, Write}; +use uucore::{crash, executable, show_error}; -#[macro_use] -extern crate uucore; +const EXIT_FAILURE: i32 = 1; +const EXIT_SUCCESS: i32 = 0; +const BUF_SIZE: usize = 65536; -use std::collections::VecDeque; -use std::fs::File; -use std::io::{stdin, BufRead, BufReader, Read}; -use std::path::Path; -use std::str::from_utf8; +const VERSION: &str = env!("CARGO_PKG_VERSION"); +const ABOUT: &str = "\ + Print the first 10 lines of each FILE to standard output.\n\ + With more than one FILE, precede each with a header giving the file name.\n\ + \n\ + With no FILE, or when FILE is -, read standard input.\n\ + \n\ + Mandatory arguments to long flags are mandatory for short flags too.\ + "; +const USAGE: &str = "head [FLAG]... [FILE]..."; -static SYNTAX: &str = ""; -static SUMMARY: &str = ""; -static LONG_HELP: &str = ""; +mod options { + pub const BYTES_NAME: &str = "BYTES"; + pub const LINES_NAME: &str = "LINES"; + pub const QUIET_NAME: &str = "QUIET"; + pub const VERBOSE_NAME: &str = "VERBOSE"; + pub const ZERO_NAME: &str = "ZERO"; + pub const FILES_NAME: &str = "FILE"; +} +mod parse; +mod split; -enum FilterMode { - Bytes(usize), +fn app<'a>() -> App<'a, 'a> { + App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(USAGE) + .arg( + Arg::with_name(options::BYTES_NAME) + .short("c") + .long("bytes") + .value_name("[-]NUM") + .takes_value(true) + .help( + "\ + print the first NUM bytes of each file;\n\ + with the leading '-', print all but the last\n\ + NUM bytes of each file\ + ", + ) + .overrides_with_all(&[options::BYTES_NAME, options::LINES_NAME]) + .allow_hyphen_values(true), + ) + .arg( + Arg::with_name(options::LINES_NAME) + .short("n") + .long("lines") + .value_name("[-]NUM") + .takes_value(true) + .help( + "\ + print the first NUM lines instead of the first 10;\n\ + with the leading '-', print all but the last\n\ + NUM lines of each file\ + ", + ) + .overrides_with_all(&[options::LINES_NAME, options::BYTES_NAME]) + .allow_hyphen_values(true), + ) + .arg( + Arg::with_name(options::QUIET_NAME) + .short("q") + .long("--quiet") + .visible_alias("silent") + .help("never print headers giving file names") + .overrides_with_all(&[options::VERBOSE_NAME, options::QUIET_NAME]), + ) + .arg( + Arg::with_name(options::VERBOSE_NAME) + .short("v") + .long("verbose") + .help("always print headers giving file names") + .overrides_with_all(&[options::QUIET_NAME, options::VERBOSE_NAME]), + ) + .arg( + Arg::with_name(options::ZERO_NAME) + .short("z") + .long("zero-terminated") + .help("line delimiter is NUL, not newline") + .overrides_with(options::ZERO_NAME), + ) + .arg(Arg::with_name(options::FILES_NAME).multiple(true)) +} +#[derive(PartialEq, Debug, Clone, Copy)] +enum Modes { Lines(usize), - NLines(usize), + Bytes(usize), } -struct Settings { - mode: FilterMode, - verbose: bool, - zero_terminated: bool, +fn parse_mode(src: &str, closure: F) -> Result<(Modes, bool), String> +where + F: FnOnce(usize) -> Modes, +{ + match parse::parse_num(src) { + Ok((n, last)) => Ok((closure(n), last)), + Err(reason) => match reason { + parse::ParseError::Syntax => Err(format!("'{}'", src)), + parse::ParseError::Overflow => { + Err(format!("'{}': Value too large for defined datatype", src)) + } + }, + } } -impl Default for Settings { - fn default() -> Settings { - Settings { - mode: FilterMode::Lines(10), - verbose: false, - zero_terminated: false, +fn arg_iterate<'a>( + mut args: impl uucore::Args + 'a, +) -> Result + 'a>, String> { + // argv[0] is always present + let first = args.next().unwrap(); + if let Some(second) = args.next() { + if let Some(s) = second.to_str() { + match parse::parse_obsolete(s) { + Some(Ok(iter)) => Ok(Box::new(vec![first].into_iter().chain(iter).chain(args))), + Some(Err(e)) => match e { + parse::ParseError::Syntax => Err(format!("bad argument format: '{}'", s)), + parse::ParseError::Overflow => Err(format!( + "invalid argument: '{}' Value too large for defined datatype", + s + )), + }, + None => Ok(Box::new(vec![first, second].into_iter().chain(args))), + } + } else { + Err("bad argument encoding".to_owned()) } + } else { + Ok(Box::new(vec![first].into_iter())) + } +} + +#[derive(Debug, PartialEq)] +struct HeadOptions { + pub quiet: bool, + pub verbose: bool, + pub zeroed: bool, + pub all_but_last: bool, + pub mode: Modes, + pub files: Vec, +} + +impl HeadOptions { + pub fn new() -> HeadOptions { + HeadOptions { + quiet: false, + verbose: false, + zeroed: false, + all_but_last: false, + mode: Modes::Lines(10), + files: Vec::new(), + } + } + + ///Construct options from matches + pub fn get_from(args: impl uucore::Args) -> Result { + let matches = app().get_matches_from(arg_iterate(args)?); + + let mut options = HeadOptions::new(); + + options.quiet = matches.is_present(options::QUIET_NAME); + options.verbose = matches.is_present(options::VERBOSE_NAME); + options.zeroed = matches.is_present(options::ZERO_NAME); + + let mode_and_from_end = if let Some(v) = matches.value_of(options::BYTES_NAME) { + match parse_mode(v, Modes::Bytes) { + Ok(v) => v, + Err(err) => { + return Err(format!("invalid number of bytes: {}", err)); + } + } + } else if let Some(v) = matches.value_of(options::LINES_NAME) { + match parse_mode(v, Modes::Lines) { + Ok(v) => v, + Err(err) => { + return Err(format!("invalid number of lines: {}", err)); + } + } + } else { + (Modes::Lines(10), false) + }; + + options.mode = mode_and_from_end.0; + options.all_but_last = mode_and_from_end.1; + + options.files = match matches.values_of(options::FILES_NAME) { + Some(v) => v.map(|s| s.to_owned()).collect(), + None => vec!["-".to_owned()], + }; + //println!("{:#?}", options); + Ok(options) + } +} +// to make clippy shut up +impl Default for HeadOptions { + fn default() -> Self { + Self::new() + } +} + +fn rbuf_n_bytes(input: &mut impl std::io::BufRead, n: usize) -> std::io::Result<()> { + if n == 0 { + return Ok(()); + } + let mut readbuf = [0u8; BUF_SIZE]; + let mut i = 0usize; + + let stdout = std::io::stdout(); + let mut stdout = stdout.lock(); + + loop { + let read = loop { + match input.read(&mut readbuf) { + Ok(n) => break n, + Err(e) => match e.kind() { + ErrorKind::Interrupted => {} + _ => return Err(e), + }, + } + }; + if read == 0 { + // might be unexpected if + // we haven't read `n` bytes + // but this mirrors GNU's behavior + return Ok(()); + } + stdout.write_all(&readbuf[..read.min(n - i)])?; + i += read.min(n - i); + if i == n { + return Ok(()); + } + } +} + +fn rbuf_n_lines(input: &mut impl std::io::BufRead, n: usize, zero: bool) -> std::io::Result<()> { + if n == 0 { + return Ok(()); + } + let stdout = std::io::stdout(); + let mut stdout = stdout.lock(); + let mut lines = 0usize; + split::walk_lines(input, zero, |e| match e { + split::Event::Data(dat) => { + stdout.write_all(dat)?; + Ok(true) + } + split::Event::Line => { + lines += 1; + if lines == n { + Ok(false) + } else { + Ok(true) + } + } + }) +} + +fn rbuf_but_last_n_bytes(input: &mut impl std::io::BufRead, n: usize) -> std::io::Result<()> { + if n == 0 { + //prints everything + return rbuf_n_bytes(input, std::usize::MAX); + } + let stdout = std::io::stdout(); + let mut stdout = stdout.lock(); + + let mut ringbuf = vec![0u8; n]; + + // first we fill the ring buffer + if let Err(e) = input.read_exact(&mut ringbuf) { + if e.kind() == ErrorKind::UnexpectedEof { + return Ok(()); + } else { + return Err(e); + } + } + let mut buffer = [0u8; BUF_SIZE]; + loop { + let read = loop { + match input.read(&mut buffer) { + Ok(n) => break n, + Err(e) => match e.kind() { + ErrorKind::Interrupted => {} + _ => return Err(e), + }, + } + }; + if read == 0 { + return Ok(()); + } else if read >= n { + stdout.write_all(&ringbuf)?; + stdout.write_all(&buffer[..read - n])?; + for i in 0..n { + ringbuf[i] = buffer[read - n + i]; + } + } else { + stdout.write_all(&ringbuf[..read])?; + for i in 0..n - read { + ringbuf[i] = ringbuf[read + i]; + } + ringbuf[n - read..].copy_from_slice(&buffer[..read]); + } + } +} + +fn rbuf_but_last_n_lines( + input: &mut impl std::io::BufRead, + n: usize, + zero: bool, +) -> std::io::Result<()> { + if n == 0 { + //prints everything + return rbuf_n_bytes(input, std::usize::MAX); + } + let mut ringbuf = vec![Vec::new(); n]; + let stdout = std::io::stdout(); + let mut stdout = stdout.lock(); + let mut line = Vec::new(); + let mut lines = 0usize; + split::walk_lines(input, zero, |e| match e { + split::Event::Data(dat) => { + line.extend_from_slice(dat); + Ok(true) + } + split::Event::Line => { + if lines < n { + ringbuf[lines] = std::mem::replace(&mut line, Vec::new()); + lines += 1; + } else { + stdout.write_all(&ringbuf[0])?; + ringbuf.rotate_left(1); + ringbuf[n - 1] = std::mem::replace(&mut line, Vec::new()); + } + Ok(true) + } + }) +} + +fn head_backwards_file(input: &mut std::fs::File, options: &HeadOptions) -> std::io::Result<()> { + assert!(options.all_but_last); + let size = input.seek(SeekFrom::End(0))?; + let size = usize::try_from(size).unwrap(); + match options.mode { + Modes::Bytes(n) => { + if n >= size { + return Ok(()); + } else { + input.seek(SeekFrom::Start(0))?; + rbuf_n_bytes( + &mut std::io::BufReader::with_capacity(BUF_SIZE, input), + size - n, + )?; + } + } + Modes::Lines(n) => { + let mut buffer = [0u8; BUF_SIZE]; + let buffer = &mut buffer[..BUF_SIZE.min(size)]; + let mut i = 0usize; + let mut lines = 0usize; + + let found = 'o: loop { + // the casts here are ok, `buffer.len()` should never be above a few k + input.seek(SeekFrom::Current( + -((buffer.len() as i64).min((size - i) as i64)), + ))?; + input.read_exact(buffer)?; + for byte in buffer.iter().rev() { + match byte { + b'\n' if !options.zeroed => { + lines += 1; + } + 0u8 if options.zeroed => { + lines += 1; + } + _ => {} + } + // if it were just `n`, + if lines == n + 1 { + break 'o i; + } + i += 1; + } + if size - i == 0 { + return Ok(()); + } + }; + input.seek(SeekFrom::Start(0))?; + rbuf_n_bytes( + &mut std::io::BufReader::with_capacity(BUF_SIZE, input), + size - found, + )?; + } + } + Ok(()) +} + +fn head_file(input: &mut std::fs::File, options: &HeadOptions) -> std::io::Result<()> { + if options.all_but_last { + head_backwards_file(input, options) + } else { + match options.mode { + Modes::Bytes(n) => { + rbuf_n_bytes(&mut std::io::BufReader::with_capacity(BUF_SIZE, input), n) + } + Modes::Lines(n) => rbuf_n_lines( + &mut std::io::BufReader::with_capacity(BUF_SIZE, input), + n, + options.zeroed, + ), + } + } +} + +fn uu_head(options: &HeadOptions) { + let mut first = true; + for fname in &options.files { + let res = match fname.as_str() { + "-" => { + if options.verbose { + if !first { + println!(); + } + println!("==> standard input <==") + } + let stdin = std::io::stdin(); + let mut stdin = stdin.lock(); + match options.mode { + Modes::Bytes(n) => { + if options.all_but_last { + rbuf_but_last_n_bytes(&mut stdin, n) + } else { + rbuf_n_bytes(&mut stdin, n) + } + } + Modes::Lines(n) => { + if options.all_but_last { + rbuf_but_last_n_lines(&mut stdin, n, options.zeroed) + } else { + rbuf_n_lines(&mut stdin, n, options.zeroed) + } + } + } + } + name => { + let mut file = match std::fs::File::open(name) { + Ok(f) => f, + Err(err) => match err.kind() { + ErrorKind::NotFound => { + crash!( + EXIT_FAILURE, + "head: cannot open '{}' for reading: No such file or directory", + name + ); + } + ErrorKind::PermissionDenied => { + crash!( + EXIT_FAILURE, + "head: cannot open '{}' for reading: Permission denied", + name + ); + } + _ => { + crash!( + EXIT_FAILURE, + "head: cannot open '{}' for reading: {}", + name, + err + ); + } + }, + }; + if (options.files.len() > 1 && !options.quiet) || options.verbose { + println!("==> {} <==", name) + } + head_file(&mut file, options) + } + }; + if res.is_err() { + if fname.as_str() == "-" { + crash!( + EXIT_FAILURE, + "head: error reading standard input: Input/output error" + ); + } else { + crash!( + EXIT_FAILURE, + "head: error reading {}: Input/output error", + fname + ); + } + } + first = false; } } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); - - let mut settings: Settings = Default::default(); - - // handle obsolete -number syntax - let new_args = match obsolete(&args[0..]) { - (args, Some(n)) => { - settings.mode = FilterMode::Lines(n); - args - } - (args, None) => args, - }; - - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optopt( - "c", - "bytes", - "Print the first K bytes. With the leading '-', print all but the last K bytes", - "[-]K", - ) - .optopt( - "n", - "lines", - "Print the first K lines. With the leading '-', print all but the last K lines", - "[-]K", - ) - .optflag("q", "quiet", "never print headers giving file names") - .optflag("v", "verbose", "always print headers giving file names") - .optflag("z", "zero-terminated", "line delimiter is NUL, not newline") - .optflag("h", "help", "display this help and exit") - .optflag("V", "version", "output version information and exit") - .parse(new_args); - - let use_bytes = matches.opt_present("c"); - // TODO: suffixes (e.g. b, kB, etc.) - match matches.opt_str("n") { - Some(n) => { - if use_bytes { - show_error!("cannot specify both --bytes and --lines."); - return 1; - } - - match n.parse::() { - Ok(m) => { - settings.mode = if m < 0 { - let m: usize = m.abs() as usize; - FilterMode::NLines(m) - } else { - let m: usize = m.abs() as usize; - FilterMode::Lines(m) - } - } - Err(e) => { - show_error!("invalid line count '{}': {}", n, e); - return 1; - } - } - } - None => { - if let Some(count) = matches.opt_str("c") { - match count.parse::() { - Ok(m) => settings.mode = FilterMode::Bytes(m), - Err(e) => { - show_error!("invalid byte count '{}': {}", count, e); - return 1; - } - } - } + let args = match HeadOptions::get_from(args) { + Ok(o) => o, + Err(s) => { + crash!(EXIT_FAILURE, "head: {}", s); } }; + uu_head(&args); - let quiet = matches.opt_present("q"); - let verbose = matches.opt_present("v"); - settings.zero_terminated = matches.opt_present("z"); - let files = matches.free; - - // GNU implementation allows multiple declarations of "-q" and "-v" with the - // last flag winning. This can't be simulated with the getopts cargo unless - // we manually parse the arguments. Given the declaration of both flags, - // verbose mode always wins. This is a potential future improvement. - if files.len() > 1 && !quiet && !verbose { - settings.verbose = true; - } - if quiet { - settings.verbose = false; - } - if verbose { - settings.verbose = true; - } - - if files.is_empty() { - let mut buffer = BufReader::new(stdin()); - head(&mut buffer, &settings); - } else { - let mut first_time = true; - - for file in &files { - if settings.verbose { - if !first_time { - println!(); - } - println!("==> {} <==", file); - } - first_time = false; - - let path = Path::new(file); - if path.is_dir() || !path.metadata().is_ok() { - eprintln!( - "cannot open '{}' for reading: No such file or directory", - &path.to_str().unwrap() - ); - continue; - } - let reader = File::open(&path).unwrap(); - let mut buffer = BufReader::new(reader); - if !head(&mut buffer, &settings) { - break; - } - } - } - - 0 + EXIT_SUCCESS } -// It searches for an option in the form of -123123 -// -// In case is found, the options vector will get rid of that object so that -// getopts works correctly. -fn obsolete(options: &[String]) -> (Vec, Option) { - let mut options: Vec = options.to_vec(); - let mut a = 1; - let b = options.len(); +#[cfg(test)] +mod tests { + use std::ffi::OsString; - while a < b { - let previous = options[a - 1].clone(); - let current = options[a].clone(); - let current = current.as_bytes(); - - if previous != "-n" && current.len() > 1 && current[0] == b'-' { - let len = current.len(); - for pos in 1..len { - // Ensure that the argument is only made out of digits - if !(current[pos] as char).is_numeric() { - break; - } - - // If this is the last number - if pos == len - 1 { - options.remove(a); - let number: Option = - from_utf8(¤t[1..len]).unwrap().parse::().ok(); - return (options, Some(number.unwrap())); - } - } - } - - a += 1; + use super::*; + fn options(args: &str) -> Result { + let combined = "head ".to_owned() + args; + let args = combined.split_whitespace(); + HeadOptions::get_from(args.map(|s| OsString::from(s))) } + #[test] + fn test_args_modes() { + let args = options("-n -10M -vz").unwrap(); + assert!(args.zeroed); + assert!(args.verbose); + assert!(args.all_but_last); + assert_eq!(args.mode, Modes::Lines(10 * 1024 * 1024)); + } + #[test] + fn test_gnu_compatibility() { + let args = options("-n 1 -c 1 -n 5 -c kiB -vqvqv").unwrap(); + assert!(args.mode == Modes::Bytes(1024)); + assert!(args.verbose); + assert_eq!(options("-5").unwrap().mode, Modes::Lines(5)); + assert_eq!(options("-2b").unwrap().mode, Modes::Bytes(1024)); + assert_eq!(options("-5 -c 1").unwrap().mode, Modes::Bytes(1)); + } + #[test] + fn all_args_test() { + assert!(options("--silent").unwrap().quiet); + assert!(options("--quiet").unwrap().quiet); + assert!(options("-q").unwrap().quiet); + assert!(options("--verbose").unwrap().verbose); + assert!(options("-v").unwrap().verbose); + assert!(options("--zero-terminated").unwrap().zeroed); + assert!(options("-z").unwrap().zeroed); + assert_eq!(options("--lines 15").unwrap().mode, Modes::Lines(15)); + assert_eq!(options("-n 15").unwrap().mode, Modes::Lines(15)); + assert_eq!(options("--bytes 15").unwrap().mode, Modes::Bytes(15)); + assert_eq!(options("-c 15").unwrap().mode, Modes::Bytes(15)); + } + #[test] + fn test_options_errors() { + assert!(options("-n IsThisTheRealLife?").is_err()); + assert!(options("-c IsThisJustFantasy").is_err()); + } + #[test] + fn test_options_correct_defaults() { + let opts = HeadOptions::new(); + let opts2: HeadOptions = Default::default(); - (options, None) -} + assert_eq!(opts, opts2); -// TODO: handle errors on read -fn head(reader: &mut BufReader, settings: &Settings) -> bool { - match settings.mode { - FilterMode::Bytes(count) => { - for byte in reader.bytes().take(count) { - print!("{}", byte.unwrap() as char); - } - } - FilterMode::Lines(count) => { - if settings.zero_terminated { - for line in reader.split(0).take(count) { - print!("{}\0", String::from_utf8(line.unwrap()).unwrap()) - } - } else { - for line in reader.lines().take(count) { - println!("{}", line.unwrap()); - } - } - } - FilterMode::NLines(count) => { - let mut vector: VecDeque = VecDeque::new(); - - for line in reader.lines() { - vector.push_back(line.unwrap()); - if vector.len() <= count { - continue; - } - println!("{}", vector.pop_front().unwrap()); + assert!(opts.verbose == false); + assert!(opts.quiet == false); + assert!(opts.zeroed == false); + assert!(opts.all_but_last == false); + assert_eq!(opts.mode, Modes::Lines(10)); + assert!(opts.files.is_empty()); + } + #[test] + fn test_parse_mode() { + assert_eq!( + parse_mode("123", Modes::Lines), + Ok((Modes::Lines(123), false)) + ); + assert_eq!( + parse_mode("-456", Modes::Bytes), + Ok((Modes::Bytes(456), true)) + ); + assert!(parse_mode("Nonsensical Nonsense", Modes::Bytes).is_err()); + #[cfg(target_pointer_width = "64")] + assert!(parse_mode("1Y", Modes::Lines).is_err()); + #[cfg(target_pointer_width = "32")] + assert!(parse_mode("1T", Modes::Bytes).is_err()); + } + fn arg_outputs(src: &str) -> Result { + let split = src.split_whitespace().map(|x| OsString::from(x)); + match arg_iterate(split) { + Ok(args) => { + let vec = args + .map(|s| s.to_str().unwrap().to_owned()) + .collect::>(); + Ok(vec.join(" ")) } + Err(e) => Err(e), } } - true + #[test] + fn test_arg_iterate() { + // test that normal args remain unchanged + assert_eq!( + arg_outputs("head -n -5 -zv"), + Ok("head -n -5 -zv".to_owned()) + ); + // tests that nonsensical args are unchanged + assert_eq!( + arg_outputs("head -to_be_or_not_to_be,..."), + Ok("head -to_be_or_not_to_be,...".to_owned()) + ); + //test that the obsolete syntax is unrolled + assert_eq!( + arg_outputs("head -123qvqvqzc"), + Ok("head -q -z -c 123".to_owned()) + ); + //test that bad obsoletes are an error + assert!(arg_outputs("head -123FooBar").is_err()); + //test overflow + assert!(arg_outputs("head -100000000000000000000000000000000000000000").is_err()); + //test that empty args remain unchanged + assert_eq!(arg_outputs("head"), Ok("head".to_owned())); + } + #[test] + #[cfg(linux)] + fn test_arg_iterate_bad_encoding() { + let invalid = unsafe { std::str::from_utf8_unchecked(b"\x80\x81") }; + // this arises from a conversion from OsString to &str + assert!( + arg_iterate(vec![OsString::from("head"), OsString::from(invalid)].into_iter()).is_err() + ); + } + #[test] + fn rbuf_early_exit() { + let mut empty = std::io::BufReader::new(std::io::Cursor::new(Vec::new())); + assert!(rbuf_n_bytes(&mut empty, 0).is_ok()); + assert!(rbuf_n_lines(&mut empty, 0, false).is_ok()); + } } diff --git a/src/uu/head/src/parse.rs b/src/uu/head/src/parse.rs new file mode 100644 index 000000000..470d821e0 --- /dev/null +++ b/src/uu/head/src/parse.rs @@ -0,0 +1,282 @@ +use std::convert::TryFrom; +use std::ffi::OsString; + +#[derive(PartialEq, Debug)] +pub enum ParseError { + Syntax, + Overflow, +} +/// Parses obsolete syntax +/// head -NUM[kmzv] +pub fn parse_obsolete(src: &str) -> Option, ParseError>> { + let mut chars = src.char_indices(); + if let Some((_, '-')) = chars.next() { + let mut num_end = 0usize; + let mut has_num = false; + let mut last_char = 0 as char; + while let Some((n, c)) = chars.next() { + if c.is_numeric() { + has_num = true; + num_end = n; + } else { + last_char = c; + break; + } + } + if has_num { + match src[1..=num_end].parse::() { + Ok(num) => { + let mut quiet = false; + let mut verbose = false; + let mut zero_terminated = false; + let mut multiplier = None; + let mut c = last_char; + loop { + // not that here, we only match lower case 'k', 'c', and 'm' + match c { + // we want to preserve order + // this also saves us 1 heap allocation + 'q' => { + quiet = true; + verbose = false + } + 'v' => { + verbose = true; + quiet = false + } + 'z' => zero_terminated = true, + 'c' => multiplier = Some(1), + 'b' => multiplier = Some(512), + 'k' => multiplier = Some(1024), + 'm' => multiplier = Some(1024 * 1024), + '\0' => {} + _ => return Some(Err(ParseError::Syntax)), + } + if let Some((_, next)) = chars.next() { + c = next + } else { + break; + } + } + let mut options = Vec::new(); + if quiet { + options.push(OsString::from("-q")) + } + if verbose { + options.push(OsString::from("-v")) + } + if zero_terminated { + options.push(OsString::from("-z")) + } + if let Some(n) = multiplier { + options.push(OsString::from("-c")); + let num = match num.checked_mul(n) { + Some(n) => n, + None => return Some(Err(ParseError::Overflow)), + }; + options.push(OsString::from(format!("{}", num))); + } else { + options.push(OsString::from("-n")); + options.push(OsString::from(format!("{}", num))); + } + Some(Ok(options.into_iter())) + } + Err(_) => Some(Err(ParseError::Overflow)), + } + } else { + None + } + } else { + None + } +} +/// Parses an -c or -n argument, +/// the bool specifies whether to read from the end +pub fn parse_num(src: &str) -> Result<(usize, bool), ParseError> { + let mut num_start = 0; + let mut chars = src.char_indices(); + let (mut chars, all_but_last) = match chars.next() { + Some((_, c)) => { + if c == '-' { + num_start += 1; + (chars, true) + } else { + (src.char_indices(), false) + } + } + None => return Err(ParseError::Syntax), + }; + let mut num_end = 0usize; + let mut last_char = 0 as char; + let mut num_count = 0usize; + while let Some((n, c)) = chars.next() { + if c.is_numeric() { + num_end = n; + num_count += 1; + } else { + last_char = c; + break; + } + } + + let num = if num_count > 0 { + match src[num_start..=num_end].parse::() { + Ok(n) => Some(n), + Err(_) => return Err(ParseError::Overflow), + } + } else { + None + }; + + if last_char == 0 as char { + if let Some(n) = num { + Ok((n, all_but_last)) + } else { + Err(ParseError::Syntax) + } + } else { + let base: u128 = match chars.next() { + Some((_, c)) => { + let b = match c { + 'B' if last_char != 'b' => 1000, + 'i' if last_char != 'b' => { + if let Some((_, 'B')) = chars.next() { + 1024 + } else { + return Err(ParseError::Syntax); + } + } + _ => return Err(ParseError::Syntax), + }; + if chars.next().is_some() { + return Err(ParseError::Syntax); + } else { + b + } + } + None => 1024, + }; + let mul = match last_char.to_lowercase().next().unwrap() { + 'b' => 512, + 'k' => base.pow(1), + 'm' => base.pow(2), + 'g' => base.pow(3), + 't' => base.pow(4), + 'p' => base.pow(5), + 'e' => base.pow(6), + 'z' => base.pow(7), + 'y' => base.pow(8), + _ => return Err(ParseError::Syntax), + }; + let mul = match usize::try_from(mul) { + Ok(n) => n, + Err(_) => return Err(ParseError::Overflow), + }; + match num.unwrap_or(1).checked_mul(mul) { + Some(n) => Ok((n, all_but_last)), + None => Err(ParseError::Overflow), + } + } +} +#[cfg(test)] +mod tests { + use super::*; + fn obsolete(src: &str) -> Option, ParseError>> { + let r = parse_obsolete(src); + match r { + Some(s) => match s { + Ok(v) => Some(Ok(v.map(|s| s.to_str().unwrap().to_owned()).collect())), + Err(e) => Some(Err(e)), + }, + None => None, + } + } + fn obsolete_result(src: &[&str]) -> Option, ParseError>> { + Some(Ok(src.iter().map(|s| s.to_string()).collect())) + } + #[test] + #[cfg(not(target_pointer_width = "128"))] + fn test_parse_overflow_x64() { + assert_eq!(parse_num("1Y"), Err(ParseError::Overflow)); + assert_eq!(parse_num("1Z"), Err(ParseError::Overflow)); + assert_eq!(parse_num("100E"), Err(ParseError::Overflow)); + assert_eq!(parse_num("100000P"), Err(ParseError::Overflow)); + assert_eq!(parse_num("1000000000T"), Err(ParseError::Overflow)); + assert_eq!( + parse_num("10000000000000000000000"), + Err(ParseError::Overflow) + ); + } + #[test] + #[cfg(target_pointer_width = "32")] + fn test_parse_overflow_x32() { + assert_eq!(parse_num("1T"), Err(ParseError::Overflow)); + assert_eq!(parse_num("1000G"), Err(ParseError::Overflow)); + } + #[test] + fn test_parse_bad_syntax() { + assert_eq!(parse_num("5MiB nonsense"), Err(ParseError::Syntax)); + assert_eq!(parse_num("Nonsense string"), Err(ParseError::Syntax)); + assert_eq!(parse_num("5mib"), Err(ParseError::Syntax)); + assert_eq!(parse_num("biB"), Err(ParseError::Syntax)); + assert_eq!(parse_num("-"), Err(ParseError::Syntax)); + assert_eq!(parse_num(""), Err(ParseError::Syntax)); + } + #[test] + fn test_parse_numbers() { + assert_eq!(parse_num("k"), Ok((1024, false))); + assert_eq!(parse_num("MiB"), Ok((1024 * 1024, false))); + assert_eq!(parse_num("-5"), Ok((5, true))); + assert_eq!(parse_num("b"), Ok((512, false))); + assert_eq!(parse_num("-2GiB"), Ok((2 * 1024 * 1024 * 1024, true))); + assert_eq!(parse_num("5M"), Ok((5 * 1024 * 1024, false))); + assert_eq!(parse_num("5MB"), Ok((5 * 1000 * 1000, false))); + } + #[test] + fn test_parse_numbers_obsolete() { + assert_eq!(obsolete("-5"), obsolete_result(&["-n", "5"])); + assert_eq!(obsolete("-100"), obsolete_result(&["-n", "100"])); + assert_eq!(obsolete("-5m"), obsolete_result(&["-c", "5242880"])); + assert_eq!(obsolete("-1k"), obsolete_result(&["-c", "1024"])); + assert_eq!(obsolete("-2b"), obsolete_result(&["-c", "1024"])); + assert_eq!(obsolete("-1mmk"), obsolete_result(&["-c", "1024"])); + assert_eq!(obsolete("-1vz"), obsolete_result(&["-v", "-z", "-n", "1"])); + assert_eq!( + obsolete("-1vzqvq"), + obsolete_result(&["-q", "-z", "-n", "1"]) + ); + assert_eq!(obsolete("-1vzc"), obsolete_result(&["-v", "-z", "-c", "1"])); + assert_eq!( + obsolete("-105kzm"), + obsolete_result(&["-z", "-c", "110100480"]) + ); + } + #[test] + fn test_parse_errors_obsolete() { + assert_eq!(obsolete("-5n"), Some(Err(ParseError::Syntax))); + assert_eq!(obsolete("-5c5"), Some(Err(ParseError::Syntax))); + } + #[test] + fn test_parse_obsolete_nomatch() { + assert_eq!(obsolete("-k"), None); + assert_eq!(obsolete("asd"), None); + } + #[test] + #[cfg(target_pointer_width = "64")] + fn test_parse_obsolete_overflow_x64() { + assert_eq!( + obsolete("-1000000000000000m"), + Some(Err(ParseError::Overflow)) + ); + assert_eq!( + obsolete("-10000000000000000000000"), + Some(Err(ParseError::Overflow)) + ); + } + #[test] + #[cfg(target_pointer_width = "32")] + fn test_parse_obsolete_overflow_x32() { + assert_eq!(obsolete("-42949672960"), Some(Err(ParseError::Overflow))); + assert_eq!(obsolete("-42949672k"), Some(Err(ParseError::Overflow))); + } +} diff --git a/src/uu/head/src/split.rs b/src/uu/head/src/split.rs new file mode 100644 index 000000000..9e9a0c685 --- /dev/null +++ b/src/uu/head/src/split.rs @@ -0,0 +1,60 @@ +#[derive(Debug)] +pub enum Event<'a> { + Data(&'a [u8]), + Line, +} +/// Loops over the lines read from a BufRead. +/// # Arguments +/// * `input` the ReadBuf to read from +/// * `zero` whether to use 0u8 as a line delimiter +/// * `on_event` a closure receiving some bytes read in a slice, or +/// event signalling a line was just read. +/// this is guaranteed to be signalled *directly* after the +/// slice containing the (CR on win)LF / 0 is passed +/// +/// Return whether to continue +pub fn walk_lines( + input: &mut impl std::io::BufRead, + zero: bool, + mut on_event: F, +) -> std::io::Result<()> +where + F: FnMut(Event) -> std::io::Result, +{ + let mut buffer = [0u8; super::BUF_SIZE]; + loop { + let read = loop { + match input.read(&mut buffer) { + Ok(n) => break n, + Err(e) => match e.kind() { + std::io::ErrorKind::Interrupted => {} + _ => return Err(e), + }, + } + }; + if read == 0 { + return Ok(()); + } + let mut base = 0usize; + for (i, byte) in buffer[..read].iter().enumerate() { + match byte { + b'\n' if !zero => { + on_event(Event::Data(&buffer[base..=i]))?; + base = i + 1; + if !on_event(Event::Line)? { + return Ok(()); + } + } + 0u8 if zero => { + on_event(Event::Data(&buffer[base..=i]))?; + base = i + 1; + if !on_event(Event::Line)? { + return Ok(()); + } + } + _ => {} + } + } + on_event(Event::Data(&buffer[base..read]))?; + } +} diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs old mode 100644 new mode 100755 index a1086c004..d91cc1289 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -86,88 +86,74 @@ fn test_verbose() { .stdout_is_fixture("lorem_ipsum_verbose.expected"); } -#[test] -fn test_zero_terminated() { - new_ucmd!() - .args(&["-z", "zero_terminated.txt"]) - .run() - .stdout_is_fixture("zero_terminated.expected"); -} - #[test] #[ignore] fn test_spams_newline() { + //this test is does not mirror what GNU does new_ucmd!().pipe_in("a").succeeds().stdout_is("a\n"); } #[test] -#[ignore] -fn test_unsupported_byte_syntax() { +fn test_byte_syntax() { new_ucmd!() .args(&["-1c"]) .pipe_in("abc") - .fails() - //GNU head returns "a" - .stdout_is("") - .stderr_is("head: error: Unrecognized option: \'1\'"); + .run() + .stdout_is("a"); } #[test] -#[ignore] -fn test_unsupported_line_syntax() { +fn test_line_syntax() { new_ucmd!() .args(&["-n", "2048m"]) .pipe_in("a\n") - .fails() - //.stdout_is("a\n"); What GNU head returns. - .stdout_is("") - .stderr_is("head: error: invalid line count \'2048m\': invalid digit found in string"); + .run() + .stdout_is("a\n"); } #[test] -#[ignore] -fn test_unsupported_zero_terminated_syntax() { +fn test_zero_terminated_syntax() { new_ucmd!() - .args(&["-z -n 1"]) + .args(&["-z", "-n", "1"]) .pipe_in("x\0y") - .fails() - //GNU Head returns "x\0" - .stderr_is("head: error: Unrecognized option: \'z\'"); + .run() + .stdout_is("x\0"); } #[test] -#[ignore] -fn test_unsupported_zero_terminated_syntax_2() { +fn test_zero_terminated_syntax_2() { new_ucmd!() - .args(&["-z -n 2"]) + .args(&["-z", "-n", "2"]) .pipe_in("x\0y") - .fails() - //GNU Head returns "x\0y" - .stderr_is("head: error: Unrecognized option: \'z\'"); + .run() + .stdout_is("x\0y"); } #[test] -#[ignore] -fn test_unsupported_negative_byte_syntax() { +fn test_negative_byte_syntax() { new_ucmd!() .args(&["--bytes=-2"]) .pipe_in("a\n") - .fails() - //GNU Head returns "" - .stderr_is("head: error: invalid byte count \'-2\': invalid digit found in string"); + .run() + .stdout_is(""); } #[test] -#[ignore] -fn test_bug_in_negative_zero_lines() { +fn test_negative_zero_lines() { new_ucmd!() .args(&["--lines=-0"]) .pipe_in("a\nb\n") .succeeds() - //GNU Head returns "a\nb\n" - .stdout_is(""); + .stdout_is("a\nb\n"); +} +#[test] +fn test_negative_zero_bytes() { + new_ucmd!() + .args(&["--bytes=-0"]) + .pipe_in("qwerty") + .succeeds() + .stdout_is("qwerty"); } - #[test] fn test_no_such_file_or_directory() { let result = new_ucmd!().arg("no_such_file.toml").run(); @@ -179,3 +165,38 @@ fn test_no_such_file_or_directory() { .contains("cannot open 'no_such_file.toml' for reading: No such file or directory") ) } + +// there was a bug not caught by previous tests +// where for negative n > 3, the total amount of lines +// was correct, but it would eat from the second line +#[test] +fn test_sequence_fixture() { + new_ucmd!() + .args(&["-n", "-10", "sequence"]) + .run() + .stdout_is_fixture("sequence.expected"); +} +#[test] +fn test_file_backwards() { + new_ucmd!() + .args(&["-c", "-10", "lorem_ipsum.txt"]) + .run() + .stdout_is_fixture("lorem_ipsum_backwards_file.expected"); +} + +#[test] +fn test_zero_terminated() { + new_ucmd!() + .args(&["-z", "zero_terminated.txt"]) + .run() + .stdout_is_fixture("zero_terminated.expected"); +} + +#[test] +fn test_obsolete_extras() { + new_ucmd!() + .args(&["-5zv"]) + .pipe_in("1\02\03\04\05\06") + .succeeds() + .stdout_is("==> standard input <==\n1\02\03\04\05\0"); +} diff --git a/tests/fixtures/head/lorem_ipsum_backwards_file.expected b/tests/fixtures/head/lorem_ipsum_backwards_file.expected new file mode 100644 index 000000000..fcf432187 --- /dev/null +++ b/tests/fixtures/head/lorem_ipsum_backwards_file.expected @@ -0,0 +1,24 @@ +Lorem ipsum dolor sit amet, +consectetur adipiscing elit. +Nunc interdum suscipit sem vel ornare. +Proin euismod, +justo sed mollis dictum, +eros urna ultricies augue, +eu pharetra mi ex id ante. +Duis convallis porttitor aliquam. +Nunc vitae tincidunt ex. +Suspendisse iaculis ligula ac diam consectetur lacinia. +Donec vel velit dui. +Etiam fringilla, +dolor quis tempor vehicula, +lacus turpis bibendum velit, +et pellentesque elit odio a magna. +Cras vulputate tortor non libero vehicula euismod. +Aliquam tincidunt nisl eget enim cursus, +viverra sagittis magna commodo. +Cras rhoncus egestas leo nec blandit. +Suspendisse potenti. +Etiam ullamcorper leo vel lacus vestibulum, +cursus semper eros efficitur. +In hac habitasse platea dictumst. +Phasellus scelerisque vehicula f \ No newline at end of file diff --git a/tests/fixtures/head/sequence b/tests/fixtures/head/sequence new file mode 100644 index 000000000..190423f88 --- /dev/null +++ b/tests/fixtures/head/sequence @@ -0,0 +1,100 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 diff --git a/tests/fixtures/head/sequence.expected b/tests/fixtures/head/sequence.expected new file mode 100644 index 000000000..17d2a1390 --- /dev/null +++ b/tests/fixtures/head/sequence.expected @@ -0,0 +1,90 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 From 5f17719a59344066ae0b4adff51a7096d97a9b43 Mon Sep 17 00:00:00 2001 From: Ricardo Iglesias Date: Mon, 29 Mar 2021 04:10:13 -0700 Subject: [PATCH 0207/1135] Implemented --indicator-style flag on ls. (#1907) * Implemented --indicator-style flag on ls. * Rust fmt * Grouped indicator_style args. * Added tests for sockets and pipes. Needed to modify util.rs to add support for pipes (aka FIFOs). * Updated util.rs to remove FIFO operations on Windows * Fixed slight error in specifying (not(windows)) * Fixed style violations and added indicator_style test for non-unix systems --- Cargo.toml | 2 + src/uu/ls/src/ls.rs | 182 ++++++++++++++++++++++++++++++++------- tests/by-util/test_ls.rs | 114 ++++++++++++++++++++++++ tests/common/util.rs | 26 +++++- 4 files changed, 290 insertions(+), 34 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 08e9a3bb2..9136b5d64 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -345,11 +345,13 @@ time = "0.1" unindent = "0.1" uucore = { version=">=0.0.7", package="uucore", path="src/uucore", features=["entries"] } walkdir = "2.2" +tempdir = "0.3" [target.'cfg(unix)'.dev-dependencies] rust-users = { version="0.10", package="users" } unix_socket = "0.5.0" + [[bin]] name = "coreutils" path = "src/bin/coreutils.rs" diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 201ddc7a6..80a7bf328 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -104,6 +104,14 @@ pub mod options { pub static HUMAN_READABLE: &str = "human-readable"; pub static SI: &str = "si"; } + + pub mod indicator_style { + pub static NONE: &str = "none"; + pub static SLASH: &str = "slash"; + pub static FILE_TYPE: &str = "file-type"; + pub static CLASSIFY: &str = "classify"; + } + pub static WIDTH: &str = "width"; pub static AUTHOR: &str = "author"; pub static NO_GROUP: &str = "no-group"; @@ -113,12 +121,15 @@ pub mod options { pub static IGNORE_BACKUPS: &str = "ignore-backups"; pub static DIRECTORY: &str = "directory"; pub static CLASSIFY: &str = "classify"; + pub static FILE_TYPE: &str = "file-type"; + pub static SLASH: &str = "p"; pub static INODE: &str = "inode"; pub static DEREFERENCE: &str = "dereference"; pub static REVERSE: &str = "reverse"; pub static RECURSIVE: &str = "recursive"; pub static COLOR: &str = "color"; pub static PATHS: &str = "paths"; + pub static INDICATOR_STYLE: &str = "indicator-style"; } #[derive(PartialEq, Eq)] @@ -157,6 +168,14 @@ enum Time { Change, } +#[derive(PartialEq, Eq)] +enum IndicatorStyle { + None, + Slash, + FileType, + Classify, +} + struct Config { format: Format, files: Files, @@ -164,7 +183,6 @@ struct Config { recursive: bool, reverse: bool, dereference: bool, - classify: bool, ignore_backups: bool, size_format: SizeFormat, directory: bool, @@ -175,6 +193,7 @@ struct Config { color: bool, long: LongFormat, width: Option, + indicator_style: IndicatorStyle, } // Fields that can be removed or added to the long format @@ -227,12 +246,19 @@ impl Config { // options, but manually whether they have an index that's greater than // the other format options. If so, we set the appropriate format. if format != Format::Long { - let idx = options.indices_of(opt).map(|x| x.max().unwrap()).unwrap_or(0); - if [options::format::LONG_NO_OWNER, options::format::LONG_NO_GROUP, options::format::LONG_NUMERIC_UID_GID] - .iter() - .flat_map(|opt| options.indices_of(opt)) - .flatten() - .any(|i| i >= idx) + let idx = options + .indices_of(opt) + .map(|x| x.max().unwrap()) + .unwrap_or(0); + if [ + options::format::LONG_NO_OWNER, + options::format::LONG_NO_GROUP, + options::format::LONG_NUMERIC_UID_GID, + ] + .iter() + .flat_map(|opt| options.indices_of(opt)) + .flatten() + .any(|i| i >= idx) { format = Format::Long; } else { @@ -243,7 +269,6 @@ impl Config { } } } - let files = if options.is_present(options::files::ALL) { Files::All @@ -334,6 +359,32 @@ impl Config { }) .or_else(|| termsize::get().map(|s| s.cols)); + let indicator_style = if let Some(field) = options.value_of(options::INDICATOR_STYLE) { + match field { + "none" => IndicatorStyle::None, + "file-type" => IndicatorStyle::FileType, + "classify" => IndicatorStyle::Classify, + "slash" => IndicatorStyle::Slash, + &_ => IndicatorStyle::None, + } + } else if options.is_present(options::indicator_style::NONE) { + IndicatorStyle::None + } else if options.is_present(options::indicator_style::CLASSIFY) + || options.is_present(options::CLASSIFY) + { + IndicatorStyle::Classify + } else if options.is_present(options::indicator_style::SLASH) + || options.is_present(options::SLASH) + { + IndicatorStyle::Slash + } else if options.is_present(options::indicator_style::FILE_TYPE) + || options.is_present(options::FILE_TYPE) + { + IndicatorStyle::FileType + } else { + IndicatorStyle::None + }; + Config { format, files, @@ -341,7 +392,6 @@ impl Config { recursive: options.is_present(options::RECURSIVE), reverse: options.is_present(options::REVERSE), dereference: options.is_present(options::DEREFERENCE), - classify: options.is_present(options::CLASSIFY), ignore_backups: options.is_present(options::IGNORE_BACKUPS), size_format, directory: options.is_present(options::DIRECTORY), @@ -352,6 +402,7 @@ impl Config { inode: options.is_present(options::INODE), long, width, + indicator_style, } } } @@ -623,15 +674,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { specified.", ), ) - .arg( - Arg::with_name(options::CLASSIFY) - .short("F") - .long(options::CLASSIFY) - .help("Append a character to each file name indicating the file type. Also, for \ - regular files that are executable, append '*'. The file type indicators are \ - '/' for directories, '@' for symbolic links, '|' for FIFOs, '=' for sockets, \ - '>' for doors, and nothing for regular files.", - )) .arg( Arg::with_name(options::size::HUMAN_READABLE) .short("h") @@ -659,7 +701,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { file the link references rather than the link itself.", ), ) - .arg( Arg::with_name(options::REVERSE) .short("r") @@ -689,8 +730,57 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .require_equals(true) .min_values(0), ) + .arg( + Arg::with_name(options::INDICATOR_STYLE) + .long(options::INDICATOR_STYLE) + .help(" append indicator with style WORD to entry names: none (default), slash\ + (-p), file-type (--file-type), classify (-F)") + .takes_value(true) + .possible_values(&["none", "slash", "file-type", "classify"]) + .overrides_with_all(&[ + options::FILE_TYPE, + options::SLASH, + options::CLASSIFY, + options::INDICATOR_STYLE, + ])) + .arg( + Arg::with_name(options::CLASSIFY) + .short("F") + .long(options::CLASSIFY) + .help("Append a character to each file name indicating the file type. Also, for \ + regular files that are executable, append '*'. The file type indicators are \ + '/' for directories, '@' for symbolic links, '|' for FIFOs, '=' for sockets, \ + '>' for doors, and nothing for regular files.") + .overrides_with_all(&[ + options::FILE_TYPE, + options::SLASH, + options::CLASSIFY, + options::INDICATOR_STYLE, + ]) + ) + .arg( + Arg::with_name(options::FILE_TYPE) + .long(options::FILE_TYPE) + .help("Same as --classify, but do not append '*'") + .overrides_with_all(&[ + options::FILE_TYPE, + options::SLASH, + options::CLASSIFY, + options::INDICATOR_STYLE, + ])) + .arg( + Arg::with_name(options::SLASH) + .short(options::SLASH) + .help("Append / indicator to directories." + ) + .overrides_with_all(&[ + options::FILE_TYPE, + options::SLASH, + options::CLASSIFY, + options::INDICATOR_STYLE, + ])) - // Positional arguments + // Positional arguments .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)); let matches = app.get_matches_from(args); @@ -1117,15 +1207,24 @@ fn display_file_name( config: &Config, ) -> Cell { let mut name = get_file_name(path, strip); + let file_type = metadata.file_type(); - if config.classify { - let file_type = metadata.file_type(); - if file_type.is_dir() { - name.push('/'); - } else if file_type.is_symlink() { - name.push('@'); + match config.indicator_style { + IndicatorStyle::Classify | IndicatorStyle::FileType => { + if file_type.is_dir() { + name.push('/'); + } + if file_type.is_symlink() { + name.push('@'); + } } - } + IndicatorStyle::Slash => { + if file_type.is_dir() { + name.push('/'); + } + } + _ => (), + }; if config.format == Format::Long && metadata.file_type().is_symlink() { if let Ok(target) = path.read_link() { @@ -1181,8 +1280,7 @@ fn display_file_name( let mut width = UnicodeWidthStr::width(&*name); let ext; - - if config.color || config.classify { + if config.color || config.indicator_style != IndicatorStyle::None { let file_type = metadata.file_type(); let (code, sym) = if file_type.is_dir() { @@ -1235,11 +1333,29 @@ fn display_file_name( if config.color { name = color_name(name, code); } - if config.classify { - if let Some(s) = sym { - name.push(s); - width += 1; + + let char_opt = match config.indicator_style { + IndicatorStyle::Classify => sym, + IndicatorStyle::FileType => { + // Don't append an asterisk. + match sym { + Some('*') => None, + _ => sym, + } } + IndicatorStyle::Slash => { + // Append only a slash. + match sym { + Some('/') => Some('/'), + _ => None, + } + } + IndicatorStyle::None => None, + }; + + if let Some(c) = char_opt { + name.push(c); + width += 1; } } diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 7d5a3da7b..638102cc7 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1,3 +1,5 @@ +#[cfg(unix)] +extern crate unix_socket; use crate::common::util::*; extern crate regex; @@ -11,7 +13,13 @@ extern crate libc; #[cfg(not(windows))] use self::libc::umask; #[cfg(not(windows))] +use std::path::PathBuf; +#[cfg(not(windows))] use std::sync::Mutex; +#[cfg(not(windows))] +extern crate tempdir; +#[cfg(not(windows))] +use self::tempdir::TempDir; #[cfg(not(windows))] lazy_static! { @@ -813,6 +821,112 @@ fn test_ls_inode() { assert_eq!(inode_short, inode_long) } +#[test] +#[cfg(not(windows))] +fn test_ls_indicator_style() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + // Setup: Directory, Symlink, and Pipes. + at.mkdir("directory"); + assert!(at.dir_exists("directory")); + + at.touch(&at.plus_as_string("link-src")); + at.symlink_file("link-src", "link-dest.link"); + assert!(at.is_symlink("link-dest.link")); + + at.mkfifo("named-pipe.fifo"); + assert!(at.is_fifo("named-pipe.fifo")); + + // Classify, File-Type, and Slash all contain indicators for directories. + let options = vec!["classify", "file-type", "slash"]; + for opt in options { + // Verify that classify and file-type both contain indicators for symlinks. + let result = scene.ucmd().arg(format!("--indicator-style={}", opt)).run(); + println!("stdout = {:?}", result.stdout); + assert!(result.stdout.contains("/")); + } + + // Same test as above, but with the alternate flags. + let options = vec!["--classify", "--file-type", "-p"]; + for opt in options { + let result = scene.ucmd().arg(format!("{}", opt)).run(); + println!("stdout = {:?}", result.stdout); + assert!(result.stdout.contains("/")); + } + + // Classify and File-Type all contain indicators for pipes and links. + let options = vec!["classify", "file-type"]; + for opt in options { + // Verify that classify and file-type both contain indicators for symlinks. + let result = scene.ucmd().arg(format!("--indicator-style={}", opt)).run(); + println!("stdout = {}", result.stdout); + assert!(result.stdout.contains("@")); + assert!(result.stdout.contains("|")); + } + + // Test sockets. Because the canonical way of making sockets to test is with + // TempDir, we need a separate test. + { + use self::unix_socket::UnixListener; + + let dir = TempDir::new("unix_socket").expect("failed to create dir"); + let socket_path = dir.path().join("sock"); + let _listener = UnixListener::bind(&socket_path).expect("failed to create socket"); + + new_ucmd!() + .args(&[ + PathBuf::from(dir.path().to_str().unwrap()), + PathBuf::from("--indicator-style=classify"), + ]) + .succeeds() + .stdout_only("sock=\n"); + } +} + +// Essentially the same test as above, but only test symlinks and directories, +// not pipes or sockets. +#[test] +#[cfg(not(unix))] +fn test_ls_indicator_style() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + // Setup: Directory, Symlink. + at.mkdir("directory"); + assert!(at.dir_exists("directory")); + + at.touch(&at.plus_as_string("link-src")); + at.symlink_file("link-src", "link-dest.link"); + assert!(at.is_symlink("link-dest.link")); + + // Classify, File-Type, and Slash all contain indicators for directories. + let options = vec!["classify", "file-type", "slash"]; + for opt in options { + // Verify that classify and file-type both contain indicators for symlinks. + let result = scene.ucmd().arg(format!("--indicator-style={}", opt)).run(); + println!("stdout = {:?}", result.stdout); + assert!(result.stdout.contains("/")); + } + + // Same test as above, but with the alternate flags. + let options = vec!["--classify", "--file-type", "-p"]; + for opt in options { + let result = scene.ucmd().arg(format!("{}", opt)).run(); + println!("stdout = {:?}", result.stdout); + assert!(result.stdout.contains("/")); + } + + // Classify and File-Type all contain indicators for pipes and links. + let options = vec!["classify", "file-type"]; + for opt in options { + // Verify that classify and file-type both contain indicators for symlinks. + let result = scene.ucmd().arg(format!("--indicator-style={}", opt)).run(); + println!("stdout = {}", result.stdout); + assert!(result.stdout.contains("@")); + } +} + #[cfg(not(any(target_vendor = "apple", target_os = "windows")))] // Truncate not available on mac or win #[test] fn test_ls_human_si() { diff --git a/tests/common/util.rs b/tests/common/util.rs index a2fab66c6..d33b1943d 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -1,7 +1,8 @@ #![allow(dead_code)] +use libc; use std::env; -use std::ffi::OsStr; +use std::ffi::{CString, OsStr}; use std::fs::{self, File, OpenOptions}; use std::io::{Read, Result, Write}; #[cfg(unix)] @@ -290,6 +291,29 @@ impl AtPath { File::create(&self.plus(file)).unwrap(); } + #[cfg(not(windows))] + pub fn mkfifo(&self, fifo: &str) { + let full_path = self.plus_as_string(fifo); + log_info("mkfifo", &full_path); + unsafe { + let fifo_name: CString = CString::new(full_path).expect("CString creation failed."); + libc::mkfifo(fifo_name.as_ptr(), libc::S_IWUSR | libc::S_IRUSR); + } + } + + #[cfg(not(windows))] + pub fn is_fifo(&self, fifo: &str) -> bool { + unsafe { + let name = CString::new(self.plus_as_string(fifo)).unwrap(); + let mut stat: libc::stat = std::mem::zeroed(); + if libc::stat(name.as_ptr(), &mut stat) >= 0 { + libc::S_IFIFO & stat.st_mode != 0 + } else { + false + } + } + } + pub fn symlink_file(&self, src: &str, dst: &str) { log_info( "symlink", From 32ddef9b9e8110f0032c437b615d22b6148bcbf2 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 29 Mar 2021 14:35:12 +0200 Subject: [PATCH 0208/1135] refresh cargo.lock with recent updates (#1964) --- Cargo.lock | 2000 ++++++++++++++++++++++++++-------------------------- 1 file changed, 1018 insertions(+), 982 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 07a99069c..b8293f666 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,2265 +4,2139 @@ name = "advapi32-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "aho-corasick" version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ - "memchr 2.3.4", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.9", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "arrayvec" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" dependencies = [ - "nodrop", + "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", - "libc", - "winapi 0.3.9", + "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "bit-set" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" dependencies = [ - "bit-vec", + "bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bit-vec" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "blake2-rfc" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ - "arrayvec", - "constant_time_eq", + "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "block-buffer" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" dependencies = [ - "byte-tools", - "generic-array", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bstr" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" dependencies = [ - "lazy_static", - "memchr 2.3.4", - "regex-automata", - "serde", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bumpalo" version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" [[package]] name = "byte-tools" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cast" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" dependencies = [ - "rustc_version", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cc" version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" [[package]] name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" dependencies = [ - "num-integer", - "num-traits", - "time", + "num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clap" version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim", - "textwrap", - "unicode-width", - "vec_map", + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "conv" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" dependencies = [ - "custom_derive", + "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "coreutils" version = "0.0.4" dependencies = [ - "conv", - "filetime", - "glob 0.3.0", - "lazy_static", - "libc", - "nix 0.20.0", - "rand 0.7.3", - "regex", - "sha1", - "tempfile", - "textwrap", - "time", - "unindent", - "unix_socket", - "users", - "uu_arch", - "uu_base32", - "uu_base64", - "uu_basename", - "uu_cat", - "uu_chgrp", - "uu_chmod", - "uu_chown", - "uu_chroot", - "uu_cksum", - "uu_comm", - "uu_cp", - "uu_csplit", - "uu_cut", - "uu_date", - "uu_df", - "uu_dircolors", - "uu_dirname", - "uu_du", - "uu_echo", - "uu_env", - "uu_expand", - "uu_expr", - "uu_factor", - "uu_false", - "uu_fmt", - "uu_fold", - "uu_groups", - "uu_hashsum", - "uu_head", - "uu_hostid", - "uu_hostname", - "uu_id", - "uu_install", - "uu_join", - "uu_kill", - "uu_link", - "uu_ln", - "uu_logname", - "uu_ls", - "uu_mkdir", - "uu_mkfifo", - "uu_mknod", - "uu_mktemp", - "uu_more", - "uu_mv", - "uu_nice", - "uu_nl", - "uu_nohup", - "uu_nproc", - "uu_numfmt", - "uu_od", - "uu_paste", - "uu_pathchk", - "uu_pinky", - "uu_printenv", - "uu_printf", - "uu_ptx", - "uu_pwd", - "uu_readlink", - "uu_realpath", - "uu_relpath", - "uu_rm", - "uu_rmdir", - "uu_seq", - "uu_shred", - "uu_shuf", - "uu_sleep", - "uu_sort", - "uu_split", - "uu_stat", - "uu_stdbuf", - "uu_sum", - "uu_sync", - "uu_tac", - "uu_tail", - "uu_tee", - "uu_test", - "uu_timeout", - "uu_touch", - "uu_tr", - "uu_true", - "uu_truncate", - "uu_tsort", - "uu_tty", - "uu_uname", - "uu_unexpand", - "uu_uniq", - "uu_unlink", - "uu_uptime", - "uu_users", - "uu_wc", - "uu_who", - "uu_whoami", - "uu_yes", - "uucore", - "walkdir", + "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uu_arch 0.0.4", + "uu_base32 0.0.4", + "uu_base64 0.0.4", + "uu_basename 0.0.4", + "uu_cat 0.0.4", + "uu_chgrp 0.0.4", + "uu_chmod 0.0.4", + "uu_chown 0.0.4", + "uu_chroot 0.0.4", + "uu_cksum 0.0.4", + "uu_comm 0.0.4", + "uu_cp 0.0.4", + "uu_csplit 0.0.4", + "uu_cut 0.0.4", + "uu_date 0.0.4", + "uu_df 0.0.4", + "uu_dircolors 0.0.4", + "uu_dirname 0.0.4", + "uu_du 0.0.4", + "uu_echo 0.0.4", + "uu_env 0.0.4", + "uu_expand 0.0.4", + "uu_expr 0.0.4", + "uu_factor 0.0.4", + "uu_false 0.0.4", + "uu_fmt 0.0.4", + "uu_fold 0.0.4", + "uu_groups 0.0.4", + "uu_hashsum 0.0.4", + "uu_head 0.0.4", + "uu_hostid 0.0.4", + "uu_hostname 0.0.4", + "uu_id 0.0.4", + "uu_install 0.0.4", + "uu_join 0.0.4", + "uu_kill 0.0.4", + "uu_link 0.0.4", + "uu_ln 0.0.4", + "uu_logname 0.0.4", + "uu_ls 0.0.4", + "uu_mkdir 0.0.4", + "uu_mkfifo 0.0.4", + "uu_mknod 0.0.4", + "uu_mktemp 0.0.4", + "uu_more 0.0.4", + "uu_mv 0.0.4", + "uu_nice 0.0.4", + "uu_nl 0.0.4", + "uu_nohup 0.0.4", + "uu_nproc 0.0.4", + "uu_numfmt 0.0.4", + "uu_od 0.0.4", + "uu_paste 0.0.4", + "uu_pathchk 0.0.4", + "uu_pinky 0.0.4", + "uu_printenv 0.0.4", + "uu_printf 0.0.4", + "uu_ptx 0.0.4", + "uu_pwd 0.0.4", + "uu_readlink 0.0.4", + "uu_realpath 0.0.4", + "uu_relpath 0.0.4", + "uu_rm 0.0.4", + "uu_rmdir 0.0.4", + "uu_seq 0.0.4", + "uu_shred 0.0.4", + "uu_shuf 0.0.4", + "uu_sleep 0.0.4", + "uu_sort 0.0.4", + "uu_split 0.0.4", + "uu_stat 0.0.4", + "uu_stdbuf 0.0.4", + "uu_sum 0.0.4", + "uu_sync 0.0.4", + "uu_tac 0.0.4", + "uu_tail 0.0.4", + "uu_tee 0.0.4", + "uu_test 0.0.4", + "uu_timeout 0.0.4", + "uu_touch 0.0.4", + "uu_tr 0.0.4", + "uu_true 0.0.4", + "uu_truncate 0.0.4", + "uu_tsort 0.0.4", + "uu_tty 0.0.4", + "uu_uname 0.0.4", + "uu_unexpand 0.0.4", + "uu_uniq 0.0.4", + "uu_unlink 0.0.4", + "uu_uptime 0.0.4", + "uu_users 0.0.4", + "uu_wc 0.0.4", + "uu_who 0.0.4", + "uu_whoami 0.0.4", + "uu_yes 0.0.4", + "uucore 0.0.7", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" dependencies = [ - "cpp_macros", + "cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_build" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" dependencies = [ - "cc", - "cpp_common 0.4.0", - "cpp_syn", - "cpp_synmap", - "cpp_synom", - "lazy_static", + "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_common" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" dependencies = [ - "cpp_syn", - "cpp_synom", - "lazy_static", - "quote 0.3.15", + "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_common" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" dependencies = [ - "lazy_static", - "proc-macro2", - "syn", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_macros" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" dependencies = [ - "aho-corasick", - "byteorder", - "cpp_common 0.5.6", - "if_rust_version", - "lazy_static", - "proc-macro2", - "quote 1.0.9", - "syn", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_syn" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" dependencies = [ - "cpp_synom", - "quote 0.3.15", - "unicode-xid 0.0.4", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_synmap" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" dependencies = [ - "cpp_syn", - "cpp_synom", - "memchr 1.0.2", + "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_synom" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" dependencies = [ - "unicode-xid 0.0.4", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "criterion" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" dependencies = [ - "atty", - "cast", - "clap", - "criterion-plot", - "csv", - "itertools 0.10.0", - "lazy_static", - "num-traits", - "oorandom", - "plotters", - "rayon", - "regex", - "serde", - "serde_cbor", - "serde_derive", - "serde_json", - "tinytemplate", - "walkdir", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "criterion-plot" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" dependencies = [ - "cast", - "itertools 0.9.0", + "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-channel" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-deque" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", - "lazy_static", - "memoffset", - "scopeguard", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-utils" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "lazy_static", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "csv" version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" dependencies = [ - "bstr", - "csv-core", - "itoa", - "ryu", - "serde", + "bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", + "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "csv-core" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" dependencies = [ - "memchr 2.3.4", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "custom_derive" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" [[package]] name = "data-encoding" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" [[package]] name = "digest" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" dependencies = [ - "generic-array", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "dunce" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "env_logger" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ - "log", - "regex", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "file_diff" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31a7a908b8f32538a2143e59a6e4e2508988832d5d4d6f7c156b3cbc762643a5" [[package]] name = "filetime" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall 0.2.5", - "winapi 0.3.9", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fs_extra" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "generic-array" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" dependencies = [ - "nodrop", - "typenum", + "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "typenum 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "getopts" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" dependencies = [ - "unicode-width", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "getrandom" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glob" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "half" version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" [[package]] name = "hermit-abi" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ - "libc", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hex" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" [[package]] name = "hostname" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ - "libc", - "match_cfg", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "if_rust_version" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" [[package]] name = "ioctl-sys" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" [[package]] name = "itertools" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" dependencies = [ - "either", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itertools" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" dependencies = [ - "either", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itertools" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" dependencies = [ - "either", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itoa" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "js-sys" version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821" dependencies = [ - "wasm-bindgen", + "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "kernel32-sys" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" [[package]] name = "log" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "match_cfg" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" [[package]] name = "maybe-uninit" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "md5" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" [[package]] name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" dependencies = [ - "libc", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "memchr" version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memoffset" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d" dependencies = [ - "autocfg", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nix" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" dependencies = [ - "bitflags", - "cc", - "cfg-if 0.1.10", - "libc", - "void", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[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", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nodrop" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "num-integer" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg", - "num-traits", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num_cpus" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "hermit-abi", - "libc", + "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "number_prefix" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "numtoa" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" [[package]] name = "onig" version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" dependencies = [ - "bitflags", - "lazy_static", - "libc", - "onig_sys", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "onig_sys" version = "69.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" dependencies = [ - "cc", - "pkg-config", + "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "oorandom" version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "paste" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" dependencies = [ - "paste-impl", - "proc-macro-hack", + "paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "paste-impl" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" dependencies = [ - "proc-macro-hack", + "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pkg-config" version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "platform-info" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" dependencies = [ - "libc", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "plotters" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" dependencies = [ - "num-traits", - "plotters-backend", - "plotters-svg", - "wasm-bindgen", - "web-sys", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "plotters-backend" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" [[package]] name = "plotters-svg" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" dependencies = [ - "plotters-backend", + "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ppv-lite86" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "proc-macro-hack" version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "unicode-xid 0.2.1", + "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "quick-error" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quickcheck" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" dependencies = [ - "env_logger", - "log", - "rand 0.7.3", - "rand_core 0.5.1", + "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "quote" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ - "proc-macro2", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" dependencies = [ - "cloudabi", - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "winapi 0.3.9", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", - "libc", - "rand_chacha", - "rand_core 0.5.1", - "rand_hc", - "rand_pcg", + "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" dependencies = [ - "rand_core 0.4.2", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" [[package]] name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", + "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_pcg" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core 0.5.1", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rayon" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rayon-core" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "lazy_static", - "num_cpus", + "crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_syscall" version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" dependencies = [ - "bitflags", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_termios" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" dependencies = [ - "redox_syscall 0.2.5", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" dependencies = [ - "aho-corasick", - "memchr 2.3.4", - "regex-syntax", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-automata" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" dependencies = [ - "byteorder", + "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" [[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "retain_mut" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1" [[package]] name = "rust-ini" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" [[package]] name = "rustc_version" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ryu" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "same-file" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ - "winapi-util", + "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser", + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" [[package]] name = "serde_cbor" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" dependencies = [ - "half", - "serde", + "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ - "itoa", - "ryu", - "serde", + "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sha1" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "sha2" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" dependencies = [ - "block-buffer", - "byte-tools", - "digest", - "fake-simd", - "generic-array", + "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sha3" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" dependencies = [ - "block-buffer", - "byte-tools", - "digest", - "generic-array", + "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "smallvec" version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" dependencies = [ - "maybe-uninit", + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "unicode-xid 0.2.1", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tempdir" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tempfile" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if 0.1.10", - "libc", - "rand 0.7.3", - "redox_syscall 0.1.57", - "remove_dir_all", - "winapi 0.3.9", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "term_grid" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" dependencies = [ - "unicode-width", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "term_size" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" dependencies = [ - "libc", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "termion" version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ - "libc", - "numtoa", - "redox_syscall 0.2.5", - "redox_termios", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "termsize" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" dependencies = [ - "atty", - "kernel32-sys", - "libc", - "termion", - "winapi 0.2.8", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "term_size", - "unicode-width", + "term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thiserror" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thiserror-impl" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" dependencies = [ - "libc", - "redox_syscall 0.1.57", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tinytemplate" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ - "serde", - "serde_json", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "twox-hash" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59" dependencies = [ - "cfg-if 0.1.10", - "rand 0.7.3", - "static_assertions", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "typenum" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" [[package]] name = "unicode-width" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" [[package]] name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "unindent" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" [[package]] name = "unix_socket" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" dependencies = [ - "cfg-if 0.1.10", - "libc", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "users" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" dependencies = [ - "libc", - "log", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_arch" version = "0.0.4" dependencies = [ - "platform-info", - "uucore", - "uucore_procs", + "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_base32" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_base64" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_basename" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cat" version = "0.0.4" dependencies = [ - "clap", - "quick-error", - "unix_socket", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_chgrp" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", - "walkdir", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_chmod" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", - "walkdir", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_chown" version = "0.0.4" dependencies = [ - "clap", - "glob 0.3.0", - "uucore", - "uucore_procs", - "walkdir", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_chroot" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cksum" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_comm" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cp" version = "0.0.4" dependencies = [ - "clap", - "filetime", - "ioctl-sys", - "libc", - "quick-error", - "uucore", - "uucore_procs", - "walkdir", - "winapi 0.3.9", - "xattr", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_csplit" version = "0.0.4" dependencies = [ - "getopts", - "glob 0.2.11", - "regex", - "thiserror", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cut" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_date" version = "0.0.4" dependencies = [ - "chrono", - "clap", - "libc", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_df" version = "0.0.4" dependencies = [ - "clap", - "libc", - "number_prefix", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_dircolors" version = "0.0.4" dependencies = [ - "glob 0.3.0", - "uucore", - "uucore_procs", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_dirname" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_du" version = "0.0.4" dependencies = [ - "time", - "uucore", - "uucore_procs", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_echo" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_env" version = "0.0.4" dependencies = [ - "clap", - "libc", - "rust-ini", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_expand" version = "0.0.4" dependencies = [ - "clap", - "unicode-width", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_expr" version = "0.0.4" dependencies = [ - "libc", - "onig", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_factor" version = "0.0.4" dependencies = [ - "criterion", - "num-traits", - "paste", - "quickcheck", - "rand 0.7.3", - "rand_chacha", - "smallvec", - "uucore", - "uucore_procs", + "criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_false" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_fmt" version = "0.0.4" dependencies = [ - "clap", - "libc", - "unicode-width", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_fold" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_groups" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_hashsum" version = "0.0.4" dependencies = [ - "blake2-rfc", - "clap", - "digest", - "hex", - "libc", - "md5", - "regex", - "regex-syntax", - "sha1", - "sha2", - "sha3", - "uucore", - "uucore_procs", + "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_head" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_hostid" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_hostname" version = "0.0.4" dependencies = [ - "clap", - "hostname", - "libc", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_id" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_install" version = "0.0.4" dependencies = [ - "clap", - "file_diff", - "filetime", - "libc", - "time", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "file_diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_join" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_kill" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_link" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_ln" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_logname" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_ls" version = "0.0.4" dependencies = [ - "atty", - "clap", - "lazy_static", - "number_prefix", - "term_grid", - "termsize", - "time", - "unicode-width", - "uucore", - "uucore_procs", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mkdir" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mkfifo" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mknod" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mktemp" version = "0.0.4" dependencies = [ - "clap", - "rand 0.5.6", - "tempfile", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_more" version = "0.0.4" dependencies = [ - "getopts", - "nix 0.13.1", - "redox_syscall 0.1.57", - "redox_termios", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mv" version = "0.0.4" dependencies = [ - "clap", - "fs_extra", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nice" version = "0.0.4" dependencies = [ - "clap", - "libc", - "nix 0.13.1", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nl" version = "0.0.4" dependencies = [ - "aho-corasick", - "clap", - "libc", - "memchr 2.3.4", - "regex", - "regex-syntax", - "uucore", - "uucore_procs", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nohup" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nproc" version = "0.0.4" dependencies = [ - "clap", - "libc", - "num_cpus", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_numfmt" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_od" version = "0.0.4" dependencies = [ - "byteorder", - "clap", - "half", - "libc", - "uucore", - "uucore_procs", + "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_paste" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_pathchk" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_pinky" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_printenv" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_printf" version = "0.0.4" dependencies = [ - "itertools 0.8.2", - "uucore", - "uucore_procs", + "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_ptx" version = "0.0.4" dependencies = [ - "aho-corasick", - "clap", - "libc", - "memchr 2.3.4", - "regex", - "regex-syntax", - "uucore", - "uucore_procs", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_pwd" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_readlink" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_realpath" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_relpath" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_rm" version = "0.0.4" dependencies = [ - "clap", - "remove_dir_all", - "uucore", - "uucore_procs", - "walkdir", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_rmdir" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_seq" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_shred" version = "0.0.4" dependencies = [ - "filetime", - "getopts", - "libc", - "rand 0.5.6", - "time", - "uucore", - "uucore_procs", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_shuf" version = "0.0.4" dependencies = [ - "clap", - "rand 0.5.6", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_sleep" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_sort" version = "0.0.4" dependencies = [ - "clap", - "itertools 0.8.2", - "rand 0.7.3", - "semver", - "twox-hash", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "twox-hash 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_split" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_stat" version = "0.0.4" dependencies = [ - "clap", - "time", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_stdbuf" version = "0.0.4" dependencies = [ - "getopts", - "tempfile", - "uu_stdbuf_libstdbuf", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uu_stdbuf_libstdbuf 0.0.4", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_stdbuf_libstdbuf" version = "0.0.4" dependencies = [ - "cpp", - "cpp_build", - "libc", - "uucore", - "uucore_procs", + "cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] @@ -2278,394 +2152,556 @@ dependencies = [ name = "uu_sync" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_tac" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tail" version = "0.0.4" dependencies = [ - "clap", - "libc", - "redox_syscall 0.1.57", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_tee" version = "0.0.4" dependencies = [ - "clap", - "libc", - "retain_mut", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "retain_mut 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_test" version = "0.0.4" dependencies = [ - "libc", - "redox_syscall 0.1.57", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_timeout" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_touch" version = "0.0.4" dependencies = [ - "clap", - "filetime", - "time", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tr" version = "0.0.4" dependencies = [ - "bit-set", - "clap", - "fnv", - "uucore", - "uucore_procs", + "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_true" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_truncate" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tsort" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tty" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_uname" version = "0.0.4" dependencies = [ - "clap", - "platform-info", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_unexpand" version = "0.0.4" dependencies = [ - "clap", - "unicode-width", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_uniq" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_unlink" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_uptime" version = "0.0.4" dependencies = [ - "chrono", - "clap", - "uucore", - "uucore_procs", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_users" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_wc" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_who" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_whoami" version = "0.0.4" dependencies = [ - "advapi32-sys", - "clap", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_yes" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uucore" version = "0.0.7" dependencies = [ - "data-encoding", - "dunce", - "getopts", - "lazy_static", - "libc", - "nix 0.13.1", - "platform-info", - "termion", - "thiserror", - "time", - "wild", + "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uucore_procs" version = "0.0.5" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "walkdir" version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" dependencies = [ - "same-file", - "winapi 0.3.9", - "winapi-util", + "same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" dependencies = [ - "cfg-if 1.0.0", - "wasm-bindgen-macro", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote 1.0.9", - "syn", - "wasm-bindgen-shared", + "bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b" dependencies = [ - "quote 1.0.9", - "wasm-bindgen-macro-support", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" [[package]] name = "web-sys" version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310" dependencies = [ - "js-sys", - "wasm-bindgen", + "js-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wild" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" dependencies = [ - "glob 0.3.0", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" dependencies = [ - "libc", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] + +[metadata] +"checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" +"checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" +"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +"checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +"checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" +"checksum bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +"checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" +"checksum bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" +"checksum bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" +"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" +"checksum byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +"checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" +"checksum cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)" = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" +"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +"checksum cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" +"checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" +"checksum cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" +"checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" +"checksum cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" +"checksum cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" +"checksum cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" +"checksum cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" +"checksum cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" +"checksum cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" +"checksum criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" +"checksum criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" +"checksum crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" +"checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" +"checksum crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" +"checksum crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" +"checksum csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" +"checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" +"checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" +"checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" +"checksum dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" +"checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +"checksum file_diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "31a7a908b8f32538a2143e59a6e4e2508988832d5d4d6f7c156b3cbc762643a5" +"checksum filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" +"checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +"checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +"checksum generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" +"checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +"checksum getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" +"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +"checksum half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" +"checksum hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +"checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" +"checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +"checksum if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" +"checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" +"checksum itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" +"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" +"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +"checksum itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +"checksum js-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +"checksum libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)" = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" +"checksum log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +"checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" +"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" +"checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" +"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" +"checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +"checksum memoffset 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d" +"checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" +"checksum nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" +"checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +"checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +"checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +"checksum number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" +"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" +"checksum onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" +"checksum onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" +"checksum oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +"checksum paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" +"checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" +"checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" +"checksum platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" +"checksum plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" +"checksum plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" +"checksum plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" +"checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +"checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" +"checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +"checksum quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" +"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" +"checksum quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" +"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" +"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +"checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +"checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +"checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" +"checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" +"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +"checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +"checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" +"checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" +"checksum regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" +"checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" +"checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" +"checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +"checksum retain_mut 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1" +"checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +"checksum same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)" = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" +"checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" +"checksum serde_derive 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)" = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" +"checksum serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)" = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" +"checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" +"checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" +"checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" +"checksum static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +"checksum syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)" = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" +"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" +"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +"checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" +"checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" +"checksum termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" +"checksum termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" +"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +"checksum thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" +"checksum thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +"checksum twox-hash 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59" +"checksum typenum 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +"checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" +"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +"checksum unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" +"checksum unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" +"checksum users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" +"checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +"checksum wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" +"checksum wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" +"checksum wasm-bindgen-macro 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b" +"checksum wasm-bindgen-macro-support 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d" +"checksum wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" +"checksum web-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310" +"checksum wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" From d88de3c6a6f1b3113802d4eec120969566b64849 Mon Sep 17 00:00:00 2001 From: Raymond Wang <61680028+RazB924@users.noreply.github.com> Date: Tue, 30 Mar 2021 01:46:48 +1030 Subject: [PATCH 0209/1135] tr: more explicit flag names (#1966) --- src/uu/tr/src/tr.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index ff1bb49d5..b94b11b9d 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -225,10 +225,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg(Arg::with_name(options::SETS).multiple(true)) .get_matches_from(args); - let dflag = matches.is_present(options::DELETE); - let cflag = matches.is_present(options::COMPLEMENT); - let sflag = matches.is_present(options::SQUEEZE); - let tflag = matches.is_present(options::TRUNCATE); + let delete_flag = matches.is_present(options::DELETE); + let complement_flag = matches.is_present(options::COMPLEMENT); + let squeeze_flag = matches.is_present(options::SQUEEZE); + let truncate_flag = matches.is_present(options::TRUNCATE); let sets: Vec = match matches.values_of(options::SETS) { Some(v) => v.map(|v| v.to_string()).collect(), @@ -243,7 +243,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return 1; } - if !(dflag || sflag) && sets.len() < 2 { + if !(delete_flag || squeeze_flag) && sets.len() < 2 { show_error!( "missing operand after ‘{}’\nTry `{} --help` for more information.", sets[0], @@ -252,7 +252,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return 1; } - if cflag && !dflag && !sflag { + if complement_flag && !delete_flag && !squeeze_flag { show_error!("-c is only supported with -d or -s"); return 1; } @@ -264,21 +264,21 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let mut buffered_stdout = BufWriter::new(locked_stdout); let set1 = ExpandSet::new(sets[0].as_ref()); - if dflag { - if sflag { + if delete_flag { + if squeeze_flag { let set2 = ExpandSet::new(sets[1].as_ref()); - let op = DeleteAndSqueezeOperation::new(set1, set2, cflag); + let op = DeleteAndSqueezeOperation::new(set1, set2, complement_flag); translate_input(&mut locked_stdin, &mut buffered_stdout, op); } else { - let op = DeleteOperation::new(set1, cflag); + let op = DeleteOperation::new(set1, complement_flag); translate_input(&mut locked_stdin, &mut buffered_stdout, op); } - } else if sflag { - let op = SqueezeOperation::new(set1, cflag); + } else if squeeze_flag { + let op = SqueezeOperation::new(set1, complement_flag); translate_input(&mut locked_stdin, &mut buffered_stdout, op); } else { let mut set2 = ExpandSet::new(sets[1].as_ref()); - let op = TranslateOperation::new(set1, &mut set2, tflag); + let op = TranslateOperation::new(set1, &mut set2, truncate_flag); translate_input(&mut locked_stdin, &mut buffered_stdout, op) } From 25df51a52580ad417d24fcb1862c17cc7b1853d7 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Mon, 29 Mar 2021 19:44:42 +0300 Subject: [PATCH 0210/1135] fix(cksum): check metadata of the path (#1951) * fix: check metadata of the path * chore: use existing path --- src/uu/cksum/src/cksum.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index bc71a2d97..b7659ea62 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -140,7 +140,20 @@ fn cksum(fname: &str) -> io::Result<(u32, usize)> { let mut rd: Box = match fname { "-" => Box::new(stdin()), _ => { - file = File::open(&Path::new(fname))?; + let path = &Path::new(fname); + if path.is_dir() { + return Err(std::io::Error::new( + io::ErrorKind::InvalidInput, + "Is a directory", + )); + }; + if !path.metadata().is_ok() { + return Err(std::io::Error::new( + io::ErrorKind::NotFound, + "No such file or directory", + )); + }; + file = File::open(&path)?; Box::new(BufReader::new(file)) } }; From 2647a72e9ec77270070b169863e21714e988f4f8 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 29 Mar 2021 22:07:09 +0200 Subject: [PATCH 0211/1135] chmod: fixed behavior for dangling symlinks (#1775) --- src/uu/chmod/src/chmod.rs | 38 +++++++----- tests/by-util/test_chmod.rs | 120 ++++++++++++++++++++++++++++++------ 2 files changed, 123 insertions(+), 35 deletions(-) diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index 819c674a0..d9d8c8cf2 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -206,7 +206,17 @@ impl Chmoder { let filename = &filename[..]; let file = Path::new(filename); if !file.exists() { - show_error!("no such file or directory '{}'", filename); + if is_symlink(file) { + println!( + "failed to change mode of '{}' from 0000 (---------) to 0000 (---------)", + filename + ); + if !self.quiet { + show_error!("cannot operate on dangling symlink '{}'", filename); + } + } else { + show_error!("cannot access '{}': No such file or directory", filename); + } return Err(1); } if self.recursive && self.preserve_root && filename == "/" { @@ -240,18 +250,16 @@ impl Chmoder { let mut fperm = match fs::metadata(file) { Ok(meta) => meta.mode() & 0o7777, Err(err) => { - if !self.quiet { - if is_symlink(file) { - if self.verbose { - show_info!( - "neither symbolic link '{}' nor referent has been changed", - file.display() - ); - } - return Ok(()); - } else { - show_error!("{}: '{}'", err, file.display()); + if is_symlink(file) { + if self.verbose { + println!( + "neither symbolic link '{}' nor referent has been changed", + file.display() + ); } + return Ok(()); + } else { + show_error!("{}: '{}'", err, file.display()); } return Err(1); } @@ -291,11 +299,11 @@ impl Chmoder { fn change_file(&self, fperm: u32, mode: u32, file: &Path) -> Result<(), i32> { if fperm == mode { if self.verbose && !self.changes { - show_info!( - "mode of '{}' retained as {:o} ({})", + println!( + "mode of '{}' retained as {:04o} ({})", file.display(), fperm, - display_permissions_unix(fperm) + display_permissions_unix(fperm), ); } Ok(()) diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index 3a53202fc..78fee462d 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -329,10 +329,9 @@ fn test_chmod_non_existing_file() { .arg("-r,a+w") .arg("dont-exist") .fails(); - assert_eq!( - result.stderr, - "chmod: error: no such file or directory 'dont-exist'\n" - ); + assert!(result + .stderr + .contains("cannot access 'dont-exist': No such file or directory")); } #[test] @@ -351,30 +350,111 @@ fn test_chmod_preserve_root() { #[test] fn test_chmod_symlink_non_existing_file() { - let (at, mut ucmd) = at_and_ucmd!(); - at.symlink_file("/non-existing", "test-long.link"); + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; - let _result = ucmd - .arg("-R") + let non_existing = "test_chmod_symlink_non_existing_file"; + let test_symlink = "test_chmod_symlink_non_existing_file_symlink"; + let expected_stdout = &format!( + "failed to change mode of '{}' from 0000 (---------) to 0000 (---------)", + test_symlink + ); + let expected_stderr = &format!("cannot operate on dangling symlink '{}'", test_symlink); + + at.symlink_file(non_existing, test_symlink); + let mut result; + + // this cannot succeed since the symbolic link dangles + result = scene.ucmd().arg("755").arg("-v").arg(test_symlink).fails(); + + println!("stdout = {:?}", result.stdout); + println!("stderr = {:?}", result.stderr); + + assert!(result.stdout.contains(expected_stdout)); + assert!(result.stderr.contains(expected_stderr)); + assert_eq!(result.code, Some(1)); + + // this should be the same than with just '-v' but without stderr + result = scene + .ucmd() .arg("755") .arg("-v") - .arg("test-long.link") + .arg("-f") + .arg(test_symlink) .fails(); + + println!("stdout = {:?}", result.stdout); + println!("stderr = {:?}", result.stderr); + + assert!(result.stdout.contains(expected_stdout)); + assert!(result.stderr.is_empty()); + assert_eq!(result.code, Some(1)); } #[test] -fn test_chmod_symlink_non_existing_recursive() { - let (at, mut ucmd) = at_and_ucmd!(); - at.mkdir("tmp"); - at.symlink_file("/non-existing", "tmp/test-long.link"); +fn test_chmod_symlink_non_existing_file_recursive() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; - let result = ucmd.arg("-R").arg("755").arg("-v").arg("tmp").succeeds(); - // it should be a success - println!("stderr {}", result.stderr); - println!("stdout {}", result.stdout); - assert!(result - .stderr - .contains("neither symbolic link 'tmp/test-long.link' nor referent has been changed")); + let non_existing = "test_chmod_symlink_non_existing_file_recursive"; + let test_symlink = "test_chmod_symlink_non_existing_file_recursive_symlink"; + let test_directory = "test_chmod_symlink_non_existing_file_directory"; + + at.mkdir(test_directory); + at.symlink_file( + non_existing, + &format!("{}/{}", test_directory, test_symlink), + ); + let mut result; + + // this should succeed + result = scene + .ucmd() + .arg("-R") + .arg("755") + .arg(test_directory) + .succeeds(); + assert_eq!(result.code, Some(0)); + assert!(result.stdout.is_empty()); + assert!(result.stderr.is_empty()); + + let expected_stdout = &format!( + "mode of '{}' retained as 0755 (rwxr-xr-x)\nneither symbolic link '{}/{}' nor referent has been changed", + test_directory, test_directory, test_symlink + ); + + // '-v': this should succeed without stderr + result = scene + .ucmd() + .arg("-R") + .arg("-v") + .arg("755") + .arg(test_directory) + .succeeds(); + + println!("stdout = {:?}", result.stdout); + println!("stderr = {:?}", result.stderr); + + assert!(result.stdout.contains(expected_stdout)); + assert!(result.stderr.is_empty()); + assert_eq!(result.code, Some(0)); + + // '-vf': this should be the same than with just '-v' + result = scene + .ucmd() + .arg("-R") + .arg("-v") + .arg("-f") + .arg("755") + .arg(test_directory) + .succeeds(); + + println!("stdout = {:?}", result.stdout); + println!("stderr = {:?}", result.stderr); + + assert!(result.stdout.contains(expected_stdout)); + assert!(result.stderr.is_empty()); + assert_eq!(result.code, Some(0)); } #[test] From 902476980820ed936d7028fba6eaced970f1697f Mon Sep 17 00:00:00 2001 From: Sivachandran Date: Tue, 30 Mar 2021 12:03:24 +0530 Subject: [PATCH 0212/1135] Add instructions for code coverage report generation (#1963) --- DEVELOPER_INSTRUCTIONS.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 DEVELOPER_INSTRUCTIONS.md diff --git a/DEVELOPER_INSTRUCTIONS.md b/DEVELOPER_INSTRUCTIONS.md new file mode 100644 index 000000000..be6373409 --- /dev/null +++ b/DEVELOPER_INSTRUCTIONS.md @@ -0,0 +1,26 @@ +Code Coverage Report Generation +--------------------------------- + +Code coverage report can be generated using [grcov](https://github.com/mozilla/grcov). + +### Using Nightly Rust + +To generate [gcov-based](https://github.com/mozilla/grcov#example-how-to-generate-gcda-files-for-cc) coverage report + +```bash +$ export CARGO_INCREMENTAL=0 +$ export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" +$ export RUSTDOCFLAGS="-Cpanic=abort" +$ cargo build # e.g., --features feat_os_unix +$ cargo test # e.g., --features feat_os_unix test_pathchk +$ grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing --ignore build.rs --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?\#\[derive\()" -o ./target/debug/coverage/ +$ # open target/debug/coverage/index.html in browser +``` + +if changes are not reflected in the report then run `cargo clean` and run the above commands. + +### Using Stable Rust + +If you are using stable version of Rust that doesn't enable code coverage instrumentation by default +then add `-Z-Zinstrument-coverage` flag to `RUSTFLAGS` env variable specified above. + From 775682508a479512dfb7269c97e82258170d3717 Mon Sep 17 00:00:00 2001 From: Kourosh Date: Tue, 30 Mar 2021 23:09:58 +0430 Subject: [PATCH 0213/1135] more: move from getopts to clap (#1962) --- src/uu/more/Cargo.toml | 2 +- src/uu/more/src/more.rs | 85 +++++++++++++++-------------------------- 2 files changed, 31 insertions(+), 56 deletions(-) diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index acd9378b2..243462232 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/more.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version = ">=0.0.7", package = "uucore", path = "../../uucore" } uucore_procs = { version = ">=0.0.5", package = "uucore_procs", path = "../../uucore_procs" } diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 524b0fbc4..981b5f502 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -10,9 +10,8 @@ #[macro_use] extern crate uucore; -use getopts::Options; use std::fs::File; -use std::io::{stdout, Read, Write}; +use std::io::{stdin, stdout, BufRead, BufReader, Read, Write}; #[cfg(all(unix, not(target_os = "fuchsia")))] extern crate nix; @@ -24,70 +23,44 @@ extern crate redox_termios; #[cfg(target_os = "redox")] extern crate syscall; -#[derive(Clone, Eq, PartialEq)] -pub enum Mode { - More, - Help, - Version, +use clap::{App, Arg, ArgMatches}; + +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "A file perusal filter for CRT viewing."; + +mod options { + pub const FILE: &str = "file"; } -static NAME: &str = "more"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); +fn get_usage() -> String { + format!("{} [options] ...", executable!()) +} pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let mut opts = Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .usage(&usage[..]) + .about(ABOUT) + .arg( + Arg::with_name(options::FILE) + .number_of_values(1) + .multiple(true), + ) + .get_matches_from(args); // FixME: fail without panic for now; but `more` should work with no arguments (ie, for piped input) - if args.len() < 2 { - println!("{}: incorrect usage", args[0]); + if let None | Some("-") = matches.value_of(options::FILE) { + println!("{}: incorrect usage", executable!()); return 1; } - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("v", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(e) => { - show_error!("{}", e); - panic!() - } - }; - let usage = opts.usage("more TARGET."); - let mode = if matches.opt_present("version") { - Mode::Version - } else if matches.opt_present("help") { - Mode::Help - } else { - Mode::More - }; - - match mode { - Mode::More => more(matches), - Mode::Help => help(&usage), - Mode::Version => version(), - } + more(matches); 0 } -fn version() { - println!("{} {}", NAME, VERSION); -} - -fn help(usage: &str) { - let msg = format!( - "{0} {1}\n\n\ - Usage: {0} TARGET\n \ - \n\ - {2}", - NAME, VERSION, usage - ); - println!("{}", msg); -} - #[cfg(all(unix, not(target_os = "fuchsia")))] fn setup_term() -> termios::Termios { let mut term = termios::tcgetattr(0).unwrap(); @@ -138,9 +111,11 @@ fn reset_term(term: &mut redox_termios::Termios) { let _ = syscall::close(fd); } -fn more(matches: getopts::Matches) { - let files = matches.free; - let mut f = File::open(files.first().unwrap()).unwrap(); +fn more(matches: ArgMatches) { + let mut f: Box = match matches.value_of(options::FILE) { + None | Some("-") => Box::new(BufReader::new(stdin())), + Some(filename) => Box::new(BufReader::new(File::open(filename).unwrap())), + }; let mut buffer = [0; 1024]; let mut term = setup_term(); From 3e06882acce7a952e080b79f5c919d2222c9073d Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Tue, 30 Mar 2021 21:51:11 +0300 Subject: [PATCH 0214/1135] loosely document supported architectures (#1899) - add script to generate a table of bins that compile - add section in README --- README.md | 28 +++++ docs/compiles_table.csv | 21 ++++ docs/compiles_table.py | 234 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 283 insertions(+) create mode 100644 docs/compiles_table.csv create mode 100644 docs/compiles_table.py diff --git a/README.md b/README.md index 7433f49e6..b6d265278 100644 --- a/README.md +++ b/README.md @@ -372,6 +372,34 @@ Utilities | whoami | | | | yes | | | +Targets that compile +------- + +This is an auto-generated table showing which binaries compile for each target-triple. Note that this **does not** indicate that they are fully implemented, or that the tests pass. + +|######OS######|###ARCH####|arch|base32|base64|basename|cat|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|df|dircolors|dirname|du|echo|env|expand|expr|factor|false|fmt|fold|groups|hashsum|head|hostid|hostname|id|install|join|kill|link|ln|logname|ls|mkdir|mkfifo|mknod|mktemp|more|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|printenv|printf|ptx|pwd|readlink|realpath|relpath|rm|rmdir|seq|shred|shuf|sleep|sort|split|stat|stdbuf|sum|sync|tac|tail|tee|test|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|uptime|users|wc|who|whoami|yes| +|--------------|-----------|----|------|------|--------|---|-----|-----|-----|------|-----|----|--|------|---|----|--|---------|-------|--|----|---|------|----|------|-----|---|----|------|-------|----|------|--------|--|-------|----|----|----|--|-------|--|-----|------|-----|------|----|--|----|--|-----|-----|------|--|-----|-------|-----|--------|------|---|---|--------|--------|-------|--|-----|---|-----|----|-----|----|-----|----|------|---|----|---|----|---|----|-------|-----|--|----|--------|-----|---|-----|--------|----|------|------|-----|--|---|------|---| +|linux-gnu|aarch64|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| +|linux-gnu|i686|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| +|linux-gnu|powerpc64|y|y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| +|linux-gnu|riscv64gc| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +|linux-gnu|x86_64|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| +|windows-msvc|aarch64|y|y|y|y|y| | | | |y|y|y|y|y|y|y|y|y| |y|y|y| |y|y|y|y| |y|y|y|y| | |y| |y|y|y| |y| | |y|y|y| |y| |y|y|y|y| | |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| | |y|y|y|y|y|y| |y|y|y|y|y| |y|y|y| |y| |y| | |y| +|windows-gnu|i686|y|y|y|y|y| | | | |y|y|y|y|y|y|y|y|y| |y|y|y| |y|y|y|y| |y|y|y|y| | |y| |y|y|y|y|y| | |y|y|y| |y| |y|y|y|y| | |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| | |y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y| |y| |y| |y|y| +|windows-msvc|i686|y|y|y|y|y| | | | |y|y|y|y|y|y|y|y|y| |y|y|y| |y|y|y|y| |y|y|y|y| | |y| |y|y|y|y|y| | |y|y|y| |y| |y|y|y|y| | |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| | |y|y|y|y|y|y| |y|y|y|y|y| |y|y|y| |y| |y| |y|y| +|windows-gnu|x86_64|y|y|y|y|y| | | | |y|y|y|y|y|y|y|y|y| |y|y|y| |y|y|y|y| |y|y|y|y| | |y| |y|y|y|y|y| | |y|y|y| |y| |y|y|y|y| | |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| | |y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y| |y| |y| |y|y| +|windows-msvc|x86_64|y|y|y|y|y| | | | |y|y|y|y|y|y|y|y|y| |y|y|y| |y|y|y|y| |y|y|y|y| | |y| |y|y|y|y|y| | |y|y|y| |y| |y|y|y|y| | |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| | |y|y|y|y|y|y| |y|y|y|y|y| |y|y|y| |y| |y| |y|y| +|apple MacOS|x86_64|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| +|freebsd|x86_64|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| +|netbsd|x86_64|y|y|y|y|y|y|y|y| |y|y|y|y|y|y| |y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y| |y|y| |y|y|y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y| |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y|y| |y|y|y| | |y| |y|y| +|android|aarch64|y|y|y|y|y|y|y|y| |y|y|y|y|y|y| |y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y| |y|y| |y|y|y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y| |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| |y|y| |y|y|y|y| |y|y|y|y|y|y| |y|y|y| | |y| |y|y| +|android|x86_64|y|y|y|y|y|y|y|y| |y|y|y|y|y|y| |y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y| |y|y| |y|y|y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y| |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| |y|y| |y|y|y|y| |y|y|y|y|y|y| |y|y|y| | |y| |y|y| +|solaris|x86_64| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +|wasi|wasm32| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +|redox|x86_64| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +|fuchsia|aarch64| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +|fuchsia|x86_64| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + License ------- diff --git a/docs/compiles_table.csv b/docs/compiles_table.csv new file mode 100644 index 000000000..6da110132 --- /dev/null +++ b/docs/compiles_table.csv @@ -0,0 +1,21 @@ +target,arch,base32,base64,basename,cat,chgrp,chmod,chown,chroot,cksum,comm,cp,csplit,cut,date,df,dircolors,dirname,du,echo,env,expand,expr,factor,false,fmt,fold,groups,hashsum,head,hostid,hostname,id,install,join,kill,link,ln,logname,ls,mkdir,mkfifo,mknod,mktemp,more,mv,nice,nl,nohup,nproc,numfmt,od,paste,pathchk,pinky,printenv,printf,ptx,pwd,readlink,realpath,relpath,rm,rmdir,seq,shred,shuf,sleep,sort,split,stat,stdbuf,sum,sync,tac,tail,tee,test,timeout,touch,tr,true,truncate,tsort,tty,uname,unexpand,uniq,unlink,uptime,users,wc,who,whoami,yes +aarch64-unknown-linux-gnu,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +i686-unknown-linux-gnu,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +powerpc64-unknown-linux-gnu,0,0,0,0,0,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +riscv64gc-unknown-linux-gnu,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101 +x86_64-unknown-linux-gnu,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +aarch64-pc-windows-msvc,0,0,0,0,0,101,101,101,101,0,0,0,0,0,0,0,0,0,101,0,0,0,101,0,0,0,0,101,0,0,0,0,101,101,0,101,0,0,0,101,0,101,101,0,0,0,101,0,101,0,0,0,0,101,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,101,0,0,0,0,0,0,101,0,0,0,0,0,101,0,0,0,101,0,101,0,101,101,0 +i686-pc-windows-gnu,0,0,0,0,0,101,101,101,101,0,0,0,0,0,0,0,0,0,101,0,0,0,101,0,0,0,0,101,0,0,0,0,101,101,0,101,0,0,0,0,0,101,101,0,0,0,101,0,101,0,0,0,0,101,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,101,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,101,0,101,0,101,0,0 +i686-pc-windows-msvc,0,0,0,0,0,101,101,101,101,0,0,0,0,0,0,0,0,0,101,0,0,0,101,0,0,0,0,101,0,0,0,0,101,101,0,101,0,0,0,0,0,101,101,0,0,0,101,0,101,0,0,0,0,101,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,101,0,0,0,0,0,0,101,0,0,0,0,0,101,0,0,0,101,0,101,0,101,0,0 +x86_64-pc-windows-gnu,0,0,0,0,0,101,101,101,101,0,0,0,0,0,0,0,0,0,101,0,0,0,101,0,0,0,0,101,0,0,0,0,101,101,0,101,0,0,0,0,0,101,101,0,0,0,101,0,101,0,0,0,0,101,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,101,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,101,0,101,0,101,0,0 +x86_64-pc-windows-msvc,0,0,0,0,0,101,101,101,101,0,0,0,0,0,0,0,0,0,101,0,0,0,101,0,0,0,0,101,0,0,0,0,101,101,0,101,0,0,0,0,0,101,101,0,0,0,101,0,101,0,0,0,0,101,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,101,0,0,0,0,0,0,101,0,0,0,0,0,101,0,0,0,101,0,101,0,101,0,0 +x86_64-apple-darwin,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +x86_64-unknown-freebsd,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +x86_64-unknown-netbsd,0,0,0,0,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,101,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,101,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,101,101,0,101,0,0 +aarch64-linux-android,0,0,0,0,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,101,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,101,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,0,0,101,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,101,101,0,101,0,0 +x86_64-linux-android,0,0,0,0,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,101,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,101,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,0,0,101,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,101,101,0,101,0,0 +x86_64-sun-solaris,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101 +wasm32-wasi,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101 +x86_64-unknown-redox,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101 +aarch64-fuchsia,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101 +x86_64-fuchsia,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101 diff --git a/docs/compiles_table.py b/docs/compiles_table.py new file mode 100644 index 000000000..0cbfdf0e9 --- /dev/null +++ b/docs/compiles_table.py @@ -0,0 +1,234 @@ +#!/usr/bin/env python3 +import multiprocessing +import subprocess +import argparse +import csv +import sys +from collections import defaultdict +from pathlib import Path + +# third party dependencies +from tqdm import tqdm + +BINS_PATH=Path("../src/uu") +CACHE_PATH=Path("compiles_table.csv") +TARGETS = [ + # Linux - GNU + "aarch64-unknown-linux-gnu", + "i686-unknown-linux-gnu", + "powerpc64-unknown-linux-gnu", + "riscv64gc-unknown-linux-gnu", + "x86_64-unknown-linux-gnu", + # Windows + "aarch64-pc-windows-msvc", + "i686-pc-windows-gnu", + "i686-pc-windows-msvc", + "x86_64-pc-windows-gnu", + "x86_64-pc-windows-msvc", + # Apple + "x86_64-apple-darwin", + "aarch64-apple-ios", + "x86_64-apple-ios", + # BSDs + "x86_64-unknown-freebsd", + "x86_64-unknown-netbsd", + # Android + "aarch64-linux-android", + "x86_64-linux-android", + # Solaris + "x86_64-sun-solaris", + # WASM + "wasm32-wasi", + # Redox + "x86_64-unknown-redox", + # Fuchsia + "aarch64-fuchsia", + "x86_64-fuchsia", +] + +class Target(str): + def __new__(cls, content): + obj = super().__new__(cls, content) + obj.arch, obj.platfrom, obj.os = Target.parse(content) + return obj + + @staticmethod + def parse(s): + elem = s.split("-") + if len(elem) == 2: + arch, platform, os = elem[0], "n/a", elem[1] + else: + arch, platform, os = elem[0], elem[1], "-".join(elem[2:]) + if os == "ios": + os = "apple IOS" + if os == "darwin": + os = "apple MacOS" + return (arch, platform, os) + + @staticmethod + def get_heading(): + return ["OS", "ARCH"] + + def get_row_heading(self): + return [self.os, self.arch] + + def requires_nightly(self): + return "redox" in self + + # Perform the 'it-compiles' check + def check(self, binary): + if self.requires_nightly(): + args = [ "cargo", "+nightly", "check", + "-p", f"uu_{binary}", "--bin", binary, + f"--target={self}"] + else: + args = ["cargo", "check", + "-p", f"uu_{binary}", "--bin", binary, + f"--target={self}"] + + res = subprocess.run(args, capture_output=True) + return res.returncode + + # Validate that the dependencies for running this target are met + def is_installed(self): + # check IOS sdk is installed, raise exception otherwise + if "ios" in self: + res = subprocess.run(["which", "xcrun"], capture_output=True) + if len(res.stdout) == 0: + raise Exception("Error: IOS sdk does not seem to be installed. Please do that manually") + if not self.requires_nightly(): + # check std toolchains are installed + toolchains = subprocess.run(["rustup", "target", "list"], capture_output=True) + toolchains = toolchains.stdout.decode('utf-8').split("\n") + if "installed" not in next(filter(lambda x: self in x, toolchains)): + raise Exception(f"Error: the {t} target is not installed. Please do that manually") + else: + # check nightly toolchains are installed + toolchains = subprocess.run(["rustup", "+nightly", "target", "list"], capture_output=True) + toolchains = toolchains.stdout.decode('utf-8').split("\n") + if "installed" not in next(filter(lambda x: self in x, toolchains)): + raise Exception(f"Error: the {t} nightly target is not installed. Please do that manually") + return True + +def install_targets(): + cmd = ["rustup", "target", "add"] + TARGETS + print(" ".join(cmd)) + ret = subprocess.run(cmd) + assert(ret.returncode == 0) + +def get_all_bins(): + bins = map(lambda x: x.name, BINS_PATH.iterdir()) + return sorted(list(bins)) + +def get_targets(selection): + if "all" in selection: + return list(map(Target, TARGETS)) + else: + # preserve the same order as in TARGETS + return list(map(Target, filter(lambda x: x in selection, TARGETS))) + +def test_helper(tup): + bin, target = tup + retcode = target.check(bin) + return (target, bin, retcode) + +def test_all_targets(targets, bins): + pool = multiprocessing.Pool() + inputs = [(b, t) for b in bins for t in targets] + + outputs = list(tqdm(pool.imap(test_helper, inputs), total=len(inputs))) + + table = defaultdict(dict) + for (t, b, r) in outputs: + table[t][b] = r + return table + +def save_csv(file, table): + targets = get_targets(table.keys()) # preserve order in CSV + bins = list(list(table.values())[0].keys()) + with open(file, "w") as csvfile: + header = ["target"] + bins + writer = csv.DictWriter(csvfile, fieldnames=header) + writer.writeheader() + for t in targets: + d = {"target" : t} + d.update(table[t]) + writer.writerow(d) + +def load_csv(file): + table = {} + cols = [] + rows = [] + with open(file, "r") as csvfile: + reader = csv.DictReader(csvfile) + cols = list(filter(lambda x: x!="target", reader.fieldnames)) + for row in reader: + t = Target(row["target"]) + rows += [t] + del row["target"] + table[t] = dict([k, int(v)] for k, v in row.items()) + return (table, rows, cols) + +def merge_tables(old, new): + from copy import deepcopy + tmp = deepcopy(old) + tmp.update(deepcopy(new)) + return tmp + +def render_md(fd, table, headings: str, row_headings: Target): + def print_row(lst, lens=[]): + lens = lens + [0] * (len(lst) - len(lens)) + for e, l in zip(lst, lens): + fmt = '|{}' if l == 0 else '|{:>%s}' % len(header[0]) + fd.write(fmt.format(e)) + fd.write("|\n") + def cell_render(target, bin): + return "y" if table[target][bin] == 0 else " " + + # add some 'hard' padding to specific columns + lens = [ + max(map(lambda x: len(x.os), row_headings)) + 2, + max(map(lambda x: len(x.arch), row_headings)) + 2 + ] + header = Target.get_heading() + header[0] = ("{:#^%d}" % lens[0]).format(header[0]) + header[1] = ("{:#^%d}" % lens[1]).format(header[1]) + + header += headings + print_row(header) + lines = list(map(lambda x: '-'*len(x), header)) + print_row(lines) + + for t in row_headings: + row = list(map(lambda b: cell_render(t, b), headings)) + row = t.get_row_heading() + row + print_row(row) + +if __name__ == "__main__": + # create the top-level parser + parser = argparse.ArgumentParser(prog='compiles_table.py') + subparsers = parser.add_subparsers(help='sub-command to execute', required=True, dest="cmd") + # create the parser for the "check" command + parser_a = subparsers.add_parser('check', help='run cargo check on specified targets and update csv cache') + parser_a.add_argument("targets", metavar="TARGET", type=str, nargs='+', choices=["all"]+TARGETS, + help="target-triple to check, as shown by 'rustup target list'") + # create the parser for the "render" command + parser_b = subparsers.add_parser('render', help='print a markdown table to stdout') + parser_b.add_argument("--equidistant", action="store_true", + help="NOT IMPLEMENTED: render each column with an equal width (in plaintext)") + args = parser.parse_args() + + if args.cmd == "render": + table, targets, bins = load_csv(CACHE_PATH) + render_md(sys.stdout, table, bins, targets) + + if args.cmd == "check": + targets = get_targets(args.targets) + bins = get_all_bins() + + assert(all(map(Target.is_installed, targets))) + table = test_all_targets(targets, bins) + + prev_table, _, _ = load_csv(CACHE_PATH) + new_table = merge_tables(prev_table, table) + save_csv(CACHE_PATH, new_table) \ No newline at end of file From 698dab12a6528e471d08d1b723c083b0e3989699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81rni=20Dagur?= Date: Tue, 30 Mar 2021 18:53:02 +0000 Subject: [PATCH 0215/1135] wc: Don't read() if we only need to count number of bytes (Version 2) (#1851) * wc: Don't read() if we only need to count number of bytes * Resolve a few code review comments * Use write macros instead of print * Fix wc tests in case only one thing is printed * wc: Fix style * wc: Use return value of first splice rather than second * wc: Make main loop more readable * wc: Don't unwrap on failed write to stdout * wc: Increment error count when stats fail to print * Re-add Cargo.lock --- Cargo.lock | 2017 +++++++++++++++++----------------- src/uu/wc/Cargo.toml | 5 + src/uu/wc/src/count_bytes.rs | 95 ++ src/uu/wc/src/wc.rs | 411 ++++--- tests/by-util/test_wc.rs | 6 +- 5 files changed, 1382 insertions(+), 1152 deletions(-) create mode 100644 src/uu/wc/src/count_bytes.rs diff --git a/Cargo.lock b/Cargo.lock index b8293f666..6b79e018b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,2707 +1,2710 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "advapi32-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8", + "winapi-build", ] [[package]] name = "aho-corasick" version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4", ] [[package]] name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "arrayvec" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" dependencies = [ - "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop", ] [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", + "winapi 0.3.9", ] [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "bit-set" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" dependencies = [ - "bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bit-vec", ] [[package]] name = "bit-vec" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "blake2-rfc" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ - "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec", + "constant_time_eq", ] [[package]] name = "block-buffer" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" dependencies = [ - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools", + "generic-array", ] [[package]] name = "bstr" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "memchr 2.3.4", + "regex-automata", + "serde", ] [[package]] name = "bumpalo" version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" [[package]] name = "byte-tools" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cast" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" dependencies = [ - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version", ] [[package]] name = "cc" version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" [[package]] name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" dependencies = [ - "num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer", + "num-traits", + "time", ] [[package]] name = "clap" version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", ] [[package]] name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", ] [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "conv" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" dependencies = [ - "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "custom_derive", ] [[package]] name = "coreutils" version = "0.0.4" dependencies = [ - "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_arch 0.0.4", - "uu_base32 0.0.4", - "uu_base64 0.0.4", - "uu_basename 0.0.4", - "uu_cat 0.0.4", - "uu_chgrp 0.0.4", - "uu_chmod 0.0.4", - "uu_chown 0.0.4", - "uu_chroot 0.0.4", - "uu_cksum 0.0.4", - "uu_comm 0.0.4", - "uu_cp 0.0.4", - "uu_csplit 0.0.4", - "uu_cut 0.0.4", - "uu_date 0.0.4", - "uu_df 0.0.4", - "uu_dircolors 0.0.4", - "uu_dirname 0.0.4", - "uu_du 0.0.4", - "uu_echo 0.0.4", - "uu_env 0.0.4", - "uu_expand 0.0.4", - "uu_expr 0.0.4", - "uu_factor 0.0.4", - "uu_false 0.0.4", - "uu_fmt 0.0.4", - "uu_fold 0.0.4", - "uu_groups 0.0.4", - "uu_hashsum 0.0.4", - "uu_head 0.0.4", - "uu_hostid 0.0.4", - "uu_hostname 0.0.4", - "uu_id 0.0.4", - "uu_install 0.0.4", - "uu_join 0.0.4", - "uu_kill 0.0.4", - "uu_link 0.0.4", - "uu_ln 0.0.4", - "uu_logname 0.0.4", - "uu_ls 0.0.4", - "uu_mkdir 0.0.4", - "uu_mkfifo 0.0.4", - "uu_mknod 0.0.4", - "uu_mktemp 0.0.4", - "uu_more 0.0.4", - "uu_mv 0.0.4", - "uu_nice 0.0.4", - "uu_nl 0.0.4", - "uu_nohup 0.0.4", - "uu_nproc 0.0.4", - "uu_numfmt 0.0.4", - "uu_od 0.0.4", - "uu_paste 0.0.4", - "uu_pathchk 0.0.4", - "uu_pinky 0.0.4", - "uu_printenv 0.0.4", - "uu_printf 0.0.4", - "uu_ptx 0.0.4", - "uu_pwd 0.0.4", - "uu_readlink 0.0.4", - "uu_realpath 0.0.4", - "uu_relpath 0.0.4", - "uu_rm 0.0.4", - "uu_rmdir 0.0.4", - "uu_seq 0.0.4", - "uu_shred 0.0.4", - "uu_shuf 0.0.4", - "uu_sleep 0.0.4", - "uu_sort 0.0.4", - "uu_split 0.0.4", - "uu_stat 0.0.4", - "uu_stdbuf 0.0.4", - "uu_sum 0.0.4", - "uu_sync 0.0.4", - "uu_tac 0.0.4", - "uu_tail 0.0.4", - "uu_tee 0.0.4", - "uu_test 0.0.4", - "uu_timeout 0.0.4", - "uu_touch 0.0.4", - "uu_tr 0.0.4", - "uu_true 0.0.4", - "uu_truncate 0.0.4", - "uu_tsort 0.0.4", - "uu_tty 0.0.4", - "uu_uname 0.0.4", - "uu_unexpand 0.0.4", - "uu_uniq 0.0.4", - "uu_unlink 0.0.4", - "uu_uptime 0.0.4", - "uu_users 0.0.4", - "uu_wc 0.0.4", - "uu_who 0.0.4", - "uu_whoami 0.0.4", - "uu_yes 0.0.4", - "uucore 0.0.7", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "conv", + "filetime", + "glob 0.3.0", + "lazy_static", + "libc", + "nix 0.20.0", + "rand 0.7.3", + "regex", + "sha1", + "tempdir", + "tempfile", + "textwrap", + "time", + "unindent", + "unix_socket", + "users", + "uu_arch", + "uu_base32", + "uu_base64", + "uu_basename", + "uu_cat", + "uu_chgrp", + "uu_chmod", + "uu_chown", + "uu_chroot", + "uu_cksum", + "uu_comm", + "uu_cp", + "uu_csplit", + "uu_cut", + "uu_date", + "uu_df", + "uu_dircolors", + "uu_dirname", + "uu_du", + "uu_echo", + "uu_env", + "uu_expand", + "uu_expr", + "uu_factor", + "uu_false", + "uu_fmt", + "uu_fold", + "uu_groups", + "uu_hashsum", + "uu_head", + "uu_hostid", + "uu_hostname", + "uu_id", + "uu_install", + "uu_join", + "uu_kill", + "uu_link", + "uu_ln", + "uu_logname", + "uu_ls", + "uu_mkdir", + "uu_mkfifo", + "uu_mknod", + "uu_mktemp", + "uu_more", + "uu_mv", + "uu_nice", + "uu_nl", + "uu_nohup", + "uu_nproc", + "uu_numfmt", + "uu_od", + "uu_paste", + "uu_pathchk", + "uu_pinky", + "uu_printenv", + "uu_printf", + "uu_ptx", + "uu_pwd", + "uu_readlink", + "uu_realpath", + "uu_relpath", + "uu_rm", + "uu_rmdir", + "uu_seq", + "uu_shred", + "uu_shuf", + "uu_sleep", + "uu_sort", + "uu_split", + "uu_stat", + "uu_stdbuf", + "uu_sum", + "uu_sync", + "uu_tac", + "uu_tail", + "uu_tee", + "uu_test", + "uu_timeout", + "uu_touch", + "uu_tr", + "uu_true", + "uu_truncate", + "uu_tsort", + "uu_tty", + "uu_uname", + "uu_unexpand", + "uu_uniq", + "uu_unlink", + "uu_uptime", + "uu_users", + "uu_wc", + "uu_who", + "uu_whoami", + "uu_yes", + "uucore", + "walkdir", ] [[package]] name = "cpp" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" dependencies = [ - "cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_macros", ] [[package]] name = "cpp_build" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" dependencies = [ - "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "cpp_common 0.4.0", + "cpp_syn", + "cpp_synmap", + "cpp_synom", + "lazy_static", ] [[package]] name = "cpp_common" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" dependencies = [ - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn", + "cpp_synom", + "lazy_static", + "quote 0.3.15", ] [[package]] name = "cpp_common" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "proc-macro2", + "syn", ] [[package]] name = "cpp_macros" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "byteorder", + "cpp_common 0.5.6", + "if_rust_version", + "lazy_static", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "cpp_syn" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" dependencies = [ - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom", + "quote 0.3.15", + "unicode-xid 0.0.4", ] [[package]] name = "cpp_synmap" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" dependencies = [ - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn", + "cpp_synom", + "memchr 1.0.2", ] [[package]] name = "cpp_synom" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" dependencies = [ - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4", ] [[package]] name = "criterion" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", - "tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "cast", + "clap", + "criterion-plot", + "csv", + "itertools 0.10.0", + "lazy_static", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", ] [[package]] name = "criterion-plot" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" dependencies = [ - "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cast", + "itertools 0.9.0", ] [[package]] name = "crossbeam-channel" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-utils", ] [[package]] name = "crossbeam-deque" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-epoch", + "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-utils", + "lazy_static", + "memoffset", + "scopeguard", ] [[package]] name = "crossbeam-utils" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "cfg-if 1.0.0", + "lazy_static", ] [[package]] name = "csv" version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" dependencies = [ - "bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", - "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr", + "csv-core", + "itoa", + "ryu", + "serde", ] [[package]] name = "csv-core" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" dependencies = [ - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4", ] [[package]] name = "custom_derive" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" [[package]] name = "data-encoding" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" [[package]] name = "digest" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" dependencies = [ - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array", ] [[package]] name = "dunce" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "env_logger" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "regex", ] [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "file_diff" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31a7a908b8f32538a2143e59a6e4e2508988832d5d4d6f7c156b3cbc762643a5" [[package]] name = "filetime" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "libc", + "redox_syscall 0.2.5", + "winapi 0.3.9", ] [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fs_extra" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "generic-array" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" dependencies = [ - "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "typenum 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop", + "typenum", ] [[package]] name = "getopts" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" dependencies = [ - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "getrandom" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "libc", + "wasi", ] [[package]] name = "glob" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "half" version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" [[package]] name = "hermit-abi" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "hex" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" [[package]] name = "hostname" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "match_cfg", + "winapi 0.3.9", ] [[package]] name = "if_rust_version" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" [[package]] name = "ioctl-sys" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" [[package]] name = "itertools" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itertools" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itertools" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itoa" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "js-sys" -version = "0.3.49" +version = "0.3.50" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d99f9e3e84b8f67f846ef5b4cbbc3b1c29f6c759fcbce6f01aa0e73d932a24c" dependencies = [ - "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen", ] [[package]] name = "kernel32-sys" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8", + "winapi-build", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" [[package]] name = "log" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", ] [[package]] name = "match_cfg" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" [[package]] name = "maybe-uninit" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "md5" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" [[package]] name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "memchr" version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memoffset" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "nix" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "cc", + "cfg-if 0.1.10", + "libc", + "void", ] [[package]] name = "nix" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "cc", + "cfg-if 1.0.0", + "libc", ] [[package]] name = "nodrop" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "num-integer" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "num-traits", ] [[package]] name = "num-traits" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "num_cpus" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", ] [[package]] name = "number_prefix" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "numtoa" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" [[package]] name = "onig" version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "lazy_static", + "libc", + "onig_sys", ] [[package]] name = "onig_sys" version = "69.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" dependencies = [ - "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "pkg-config", ] [[package]] name = "oorandom" version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "paste" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" dependencies = [ - "paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", + "paste-impl", + "proc-macro-hack", ] [[package]] name = "paste-impl" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" dependencies = [ - "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack", ] [[package]] name = "pkg-config" version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "platform-info" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "winapi 0.3.9", ] [[package]] name = "plotters" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" dependencies = [ - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", ] [[package]] name = "plotters-backend" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" [[package]] name = "plotters-svg" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" dependencies = [ - "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-backend", ] [[package]] name = "ppv-lite86" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "proc-macro-hack" version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1", ] [[package]] name = "quick-error" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quickcheck" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" dependencies = [ - "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger", + "log", + "rand 0.7.3", + "rand_core 0.5.1", ] [[package]] name = "quote" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "rand" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" dependencies = [ - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "rdrand", + "winapi 0.3.9", ] [[package]] name = "rand" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "winapi 0.3.9", ] [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom", + "libc", + "rand_chacha", + "rand_core 0.5.1", + "rand_hc", + "rand_pcg", ] [[package]] name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ - "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86", + "rand_core 0.5.1", ] [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" dependencies = [ - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2", ] [[package]] name = "rand_core" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" [[package]] name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom", ] [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1", ] [[package]] name = "rand_pcg" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1", ] [[package]] name = "rayon" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", ] [[package]] name = "rayon-core" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" dependencies = [ - "crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static", + "num_cpus", ] [[package]] name = "rdrand" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1", ] [[package]] name = "redox_syscall" version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", ] [[package]] name = "redox_termios" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" dependencies = [ - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5", ] [[package]] name = "regex" version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "memchr 2.3.4", + "regex-syntax", ] [[package]] name = "regex-automata" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" dependencies = [ - "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder", ] [[package]] name = "regex-syntax" version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" [[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "retain_mut" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1" [[package]] name = "rust-ini" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" [[package]] name = "rustc_version" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver", ] [[package]] name = "ryu" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "same-file" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ - "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util", ] [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver-parser", ] [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" [[package]] name = "serde_cbor" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" dependencies = [ - "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "half", + "serde", ] [[package]] name = "serde_derive" version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "serde_json" version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ - "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa", + "ryu", + "serde", ] [[package]] name = "sha1" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "sha2" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" dependencies = [ - "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer", + "byte-tools", + "digest", + "fake-simd", + "generic-array", ] [[package]] name = "sha3" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" dependencies = [ - "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer", + "byte-tools", + "digest", + "generic-array", ] [[package]] name = "smallvec" version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" dependencies = [ - "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit", ] [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "unicode-xid 0.2.1", ] [[package]] name = "tempdir" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" dependencies = [ - "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.6", + "remove_dir_all", ] [[package]] name = "tempfile" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "libc", + "rand 0.7.3", + "redox_syscall 0.1.57", + "remove_dir_all", + "winapi 0.3.9", ] [[package]] name = "term_grid" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" dependencies = [ - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "term_size" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "winapi 0.3.9", ] [[package]] name = "termion" version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "numtoa", + "redox_syscall 0.2.5", + "redox_termios", ] [[package]] name = "termsize" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "kernel32-sys", + "libc", + "termion", + "winapi 0.2.8", ] [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "term_size", + "unicode-width", ] [[package]] name = "thiserror" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" dependencies = [ - "thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "redox_syscall 0.1.57", + "winapi 0.3.9", ] [[package]] name = "tinytemplate" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "serde", + "serde_json", ] [[package]] name = "twox-hash" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "rand 0.7.3", + "static_assertions", ] [[package]] name = "typenum" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" [[package]] name = "unicode-width" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" [[package]] name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "unindent" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" [[package]] name = "unix_socket" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "libc", ] [[package]] name = "users" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "log", ] [[package]] name = "uu_arch" version = "0.0.4" dependencies = [ - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "platform-info", + "uucore", + "uucore_procs", ] [[package]] name = "uu_base32" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_base64" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_basename" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cat" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "quick-error", + "unix_socket", + "uucore", + "uucore_procs", ] [[package]] name = "uu_chgrp" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chmod" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chown" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "glob 0.3.0", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chroot" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cksum" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_comm" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cp" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "filetime", + "ioctl-sys", + "libc", + "quick-error", + "uucore", + "uucore_procs", + "walkdir", + "winapi 0.3.9", + "xattr", ] [[package]] name = "uu_csplit" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "glob 0.2.11", + "regex", + "thiserror", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cut" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_date" version = "0.0.4" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono", + "clap", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_df" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "number_prefix", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_dircolors" version = "0.0.4" dependencies = [ - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "glob 0.3.0", + "uucore", + "uucore_procs", ] [[package]] name = "uu_dirname" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_du" version = "0.0.4" dependencies = [ - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_echo" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_env" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "rust-ini", + "uucore", + "uucore_procs", ] [[package]] name = "uu_expand" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_expr" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "onig", + "uucore", + "uucore_procs", ] [[package]] name = "uu_factor" version = "0.0.4" dependencies = [ - "criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "criterion", + "num-traits", + "paste", + "quickcheck", + "rand 0.7.3", + "rand_chacha", + "smallvec", + "uucore", + "uucore_procs", ] [[package]] name = "uu_false" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_fmt" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_fold" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_groups" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hashsum" version = "0.0.4" dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "blake2-rfc", + "clap", + "digest", + "hex", + "libc", + "md5", + "regex", + "regex-syntax", + "sha1", + "sha2", + "sha3", + "uucore", + "uucore_procs", ] [[package]] name = "uu_head" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hostid" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hostname" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "hostname", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_id" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_install" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "file_diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "file_diff", + "filetime", + "libc", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_join" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_kill" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_link" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ln" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_logname" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ls" version = "0.0.4" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "atty", + "clap", + "lazy_static", + "number_prefix", + "term_grid", + "termsize", + "time", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mkdir" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mkfifo" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mknod" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mktemp" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "rand 0.5.6", + "tempfile", + "uucore", + "uucore_procs", ] [[package]] name = "uu_more" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "nix 0.13.1", + "redox_syscall 0.1.57", + "redox_termios", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mv" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "fs_extra", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nice" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "nix 0.13.1", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nl" version = "0.0.4" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "aho-corasick", + "clap", + "libc", + "memchr 2.3.4", + "regex", + "regex-syntax", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nohup" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nproc" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "num_cpus", + "uucore", + "uucore_procs", ] [[package]] name = "uu_numfmt" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_od" version = "0.0.4" dependencies = [ - "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "byteorder", + "clap", + "half", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_paste" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pathchk" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pinky" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_printenv" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_printf" version = "0.0.4" dependencies = [ - "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "itertools 0.8.2", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ptx" version = "0.0.4" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "aho-corasick", + "clap", + "libc", + "memchr 2.3.4", + "regex", + "regex-syntax", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pwd" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_readlink" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_realpath" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_relpath" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_rm" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "remove_dir_all", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_rmdir" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_seq" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_shred" version = "0.0.4" dependencies = [ - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "filetime", + "getopts", + "libc", + "rand 0.5.6", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_shuf" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "rand 0.5.6", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sleep" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sort" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "twox-hash 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "itertools 0.8.2", + "rand 0.7.3", + "semver", + "twox-hash", + "uucore", + "uucore_procs", ] [[package]] name = "uu_split" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stat" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stdbuf" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_stdbuf_libstdbuf 0.0.4", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "tempfile", + "uu_stdbuf_libstdbuf", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stdbuf_libstdbuf" version = "0.0.4" dependencies = [ - "cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "cpp", + "cpp_build", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sum" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sync" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_tac" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tail" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "redox_syscall 0.1.57", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_tee" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "retain_mut 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "retain_mut", + "uucore", + "uucore_procs", ] [[package]] name = "uu_test" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "redox_syscall 0.1.57", + "uucore", + "uucore_procs", ] [[package]] name = "uu_timeout" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_touch" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "filetime", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tr" version = "0.0.4" dependencies = [ - "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "bit-set", + "clap", + "fnv", + "uucore", + "uucore_procs", ] [[package]] name = "uu_true" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_truncate" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tsort" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tty" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uname" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "platform-info", + "uucore", + "uucore_procs", ] [[package]] name = "uu_unexpand" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uniq" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_unlink" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uptime" version = "0.0.4" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "chrono", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_users" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_wc" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "nix 0.20.0", + "thiserror", + "uucore", + "uucore_procs", ] [[package]] name = "uu_who" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_whoami" version = "0.0.4" dependencies = [ - "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "advapi32-sys", + "clap", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_yes" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uucore" version = "0.0.7" dependencies = [ - "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "data-encoding", + "dunce", + "getopts", + "lazy_static", + "libc", + "nix 0.13.1", + "platform-info", + "termion", + "thiserror", + "time", + "wild", ] [[package]] name = "uucore_procs" version = "0.0.5" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "walkdir" version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" dependencies = [ - "same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file", + "winapi 0.3.9", + "winapi-util", ] [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" -version = "0.2.72" +version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83240549659d187488f91f33c0f8547cbfef0b2088bc470c116d1d260ef623d9" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.72" +version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae70622411ca953215ca6d06d3ebeb1e915f0f6613e3b495122878d7ebec7dae" dependencies = [ - "bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote 1.0.9", + "syn", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.72" +version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e734d91443f177bfdb41969de821e15c516931c3c3db3d318fa1b68975d0f6f" dependencies = [ - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9", + "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.72" +version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53739ff08c8a68b0fdbcd54c372b8ab800b1449ab3c9d706503bc7dd1621b2c" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.72" +version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9a543ae66aa233d14bb765ed9af4a33e81b8b58d1584cf1b47ff8cd0b9e4489" [[package]] name = "web-sys" -version = "0.3.49" +version = "0.3.50" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a905d57e488fec8861446d3393670fb50d27a262344013181c2cdf9fff5481be" dependencies = [ - "js-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys", + "wasm-bindgen", ] [[package]] name = "wild" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" dependencies = [ - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0", ] [[package]] name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] - -[metadata] -"checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" -"checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" -"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -"checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -"checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" -"checksum bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" -"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" -"checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" -"checksum bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" -"checksum bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" -"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" -"checksum byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -"checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" -"checksum cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)" = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" -"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" -"checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" -"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" -"checksum cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" -"checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" -"checksum cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" -"checksum cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" -"checksum cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" -"checksum cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" -"checksum cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" -"checksum cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" -"checksum criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" -"checksum criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" -"checksum crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" -"checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" -"checksum crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" -"checksum crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" -"checksum csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" -"checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" -"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" -"checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" -"checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" -"checksum dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" -"checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -"checksum file_diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "31a7a908b8f32538a2143e59a6e4e2508988832d5d4d6f7c156b3cbc762643a5" -"checksum filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" -"checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -"checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" -"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -"checksum generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" -"checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" -"checksum getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -"checksum half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" -"checksum hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" -"checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" -"checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" -"checksum if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" -"checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" -"checksum itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" -"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" -"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -"checksum itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" -"checksum js-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)" = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" -"checksum log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" -"checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" -"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" -"checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" -"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" -"checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" -"checksum memoffset 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d" -"checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" -"checksum nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" -"checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" -"checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" -"checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -"checksum number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" -"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" -"checksum onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" -"checksum onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" -"checksum oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" -"checksum paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" -"checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" -"checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" -"checksum platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" -"checksum plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" -"checksum plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" -"checksum plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" -"checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" -"checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" -"checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" -"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -"checksum quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" -"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" -"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" -"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -"checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" -"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -"checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -"checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" -"checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" -"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" -"checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" -"checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" -"checksum regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" -"checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -"checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" -"checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -"checksum retain_mut 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1" -"checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" -"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -"checksum same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)" = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" -"checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -"checksum serde_derive 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)" = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" -"checksum serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)" = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" -"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" -"checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" -"checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" -"checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -"checksum static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)" = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" -"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" -"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" -"checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" -"checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" -"checksum termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" -"checksum termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" -"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -"checksum thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" -"checksum thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" -"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" -"checksum twox-hash 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59" -"checksum typenum 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" -"checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" -"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" -"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" -"checksum unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" -"checksum unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" -"checksum users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" -"checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" -"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -"checksum wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" -"checksum wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" -"checksum wasm-bindgen-macro 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b" -"checksum wasm-bindgen-macro-support 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d" -"checksum wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" -"checksum web-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310" -"checksum wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index 894ac44dd..4e6cef101 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -18,6 +18,11 @@ path = "src/wc.rs" clap = "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +thiserror = "1.0" + +[target.'cfg(unix)'.dependencies] +nix = "0.20" +libc = "0.2" [[bin]] name = "wc" diff --git a/src/uu/wc/src/count_bytes.rs b/src/uu/wc/src/count_bytes.rs new file mode 100644 index 000000000..dc90f67cc --- /dev/null +++ b/src/uu/wc/src/count_bytes.rs @@ -0,0 +1,95 @@ +use super::{WcResult, WordCountable}; + +#[cfg(any(target_os = "linux", target_os = "android"))] +use std::fs::OpenOptions; +use std::io::ErrorKind; + +#[cfg(unix)] +use libc::S_IFREG; +#[cfg(unix)] +use nix::sys::stat::fstat; +#[cfg(any(target_os = "linux", target_os = "android"))] +use std::os::unix::io::{AsRawFd, RawFd}; + +#[cfg(any(target_os = "linux", target_os = "android"))] +use libc::S_IFIFO; +#[cfg(any(target_os = "linux", target_os = "android"))] +use nix::fcntl::{splice, SpliceFFlags}; +#[cfg(any(target_os = "linux", target_os = "android"))] +use nix::unistd::pipe; + +const BUF_SIZE: usize = 16384; + +/// This is a Linux-specific function to count the number of bytes using the +/// `splice` system call, which is faster than using `read`. +#[inline] +#[cfg(any(target_os = "linux", target_os = "android"))] +fn count_bytes_using_splice(fd: RawFd) -> nix::Result { + let null_file = OpenOptions::new() + .write(true) + .open("/dev/null") + .map_err(|_| nix::Error::last())?; + let null = null_file.as_raw_fd(); + let (pipe_rd, pipe_wr) = pipe()?; + + let mut byte_count = 0; + loop { + let res = splice(fd, None, pipe_wr, None, BUF_SIZE, SpliceFFlags::empty())?; + if res == 0 { + break; + } + byte_count += res; + splice(pipe_rd, None, null, None, res, SpliceFFlags::empty())?; + } + + Ok(byte_count) +} + +/// In the special case where we only need to count the number of bytes. There +/// are several optimizations we can do: +/// 1. On Unix, we can simply `stat` the file if it is regular. +/// 2. On Linux -- if the above did not work -- we can use splice to count +/// the number of bytes if the file is a FIFO. +/// 3. Otherwise, we just read normally, but without the overhead of counting +/// other things such as lines and words. +#[inline] +pub(crate) fn count_bytes_fast(handle: &mut T) -> WcResult { + #[cfg(unix)] + { + let fd = handle.as_raw_fd(); + match fstat(fd) { + Ok(stat) => { + // If the file is regular, then the `st_size` should hold + // the file's size in bytes. + if (stat.st_mode & S_IFREG) != 0 { + return Ok(stat.st_size as usize); + } + #[cfg(any(target_os = "linux", target_os = "android"))] + { + // Else, if we're on Linux and our file is a FIFO pipe + // (or stdin), we use splice to count the number of bytes. + if (stat.st_mode & S_IFIFO) != 0 { + if let Ok(n) = count_bytes_using_splice(fd) { + return Ok(n); + } + } + } + } + _ => {} + } + } + + // Fall back on `read`, but without the overhead of counting words and lines. + let mut buf = [0 as u8; BUF_SIZE]; + let mut byte_count = 0; + loop { + match handle.read(&mut buf) { + Ok(0) => return Ok(byte_count), + Ok(n) => { + byte_count += n; + } + Err(ref e) if e.kind() == ErrorKind::Interrupted => continue, + Err(e) => return Err(e.into()), + } + } +} diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 972802f81..22463caa4 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -10,14 +10,31 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg, ArgMatches}; +mod count_bytes; +use count_bytes::count_bytes_fast; +use clap::{App, Arg, ArgMatches}; +use thiserror::Error; + +use std::cmp::max; use std::fs::File; -use std::io::{stdin, BufRead, BufReader, Read}; +use std::io::{self, BufRead, BufReader, Read, StdinLock, Write}; +use std::ops::{Add, AddAssign}; +#[cfg(unix)] +use std::os::unix::io::AsRawFd; use std::path::Path; -use std::result::Result as StdResult; use std::str::from_utf8; +#[derive(Error, Debug)] +pub enum WcError { + #[error("{0}")] + Io(#[from] io::Error), + #[error("Expected a file, found directory {0}")] + IsDirectory(String), +} + +type WcResult = Result; + struct Settings { show_bytes: bool, show_chars: bool, @@ -53,10 +70,46 @@ impl Settings { show_max_line_length: false, } } + + fn number_enabled(&self) -> u32 { + let mut result = 0; + result += self.show_bytes as u32; + result += self.show_chars as u32; + result += self.show_lines as u32; + result += self.show_max_line_length as u32; + result += self.show_words as u32; + result + } } -struct Result { - title: String, +#[cfg(unix)] +trait WordCountable: AsRawFd + Read { + type Buffered: BufRead; + fn get_buffered(self) -> Self::Buffered; +} +#[cfg(not(unix))] +trait WordCountable: Read { + type Buffered: BufRead; + fn get_buffered(self) -> Self::Buffered; +} + +impl WordCountable for StdinLock<'_> { + type Buffered = Self; + + fn get_buffered(self) -> Self::Buffered { + self + } +} +impl WordCountable for File { + type Buffered = BufReader; + + fn get_buffered(self) -> Self::Buffered { + BufReader::new(self) + } +} + +#[derive(Debug, Default, Copy, Clone)] +struct WordCount { bytes: usize, chars: usize, lines: usize, @@ -64,6 +117,45 @@ struct Result { max_line_length: usize, } +impl Add for WordCount { + type Output = Self; + + fn add(self, other: Self) -> Self { + Self { + bytes: self.bytes + other.bytes, + chars: self.chars + other.chars, + lines: self.lines + other.lines, + words: self.words + other.words, + max_line_length: max(self.max_line_length, other.max_line_length), + } + } +} + +impl AddAssign for WordCount { + fn add_assign(&mut self, other: Self) { + *self = *self + other + } +} + +impl WordCount { + fn with_title<'a>(self, title: &'a str) -> TitledWordCount<'a> { + return TitledWordCount { + title: title, + count: self, + }; + } +} + +/// This struct supplements the actual word count with a title that is displayed +/// to the user at the end of the program. +/// The reason we don't simply include title in the `WordCount` struct is that +/// it would result in unneccesary copying of `String`. +#[derive(Debug, Default, Clone)] +struct TitledWordCount<'a> { + title: &'a str, + count: WordCount, +} + static ABOUT: &str = "Display newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified."; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -137,12 +229,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let settings = Settings::new(&matches); - match wc(files, &settings) { - Ok(()) => ( /* pass */ ), - Err(e) => return e, + if wc(files, &settings).is_ok() { + 0 + } else { + 1 } - - 0 } const CR: u8 = b'\r'; @@ -157,151 +248,187 @@ fn is_word_separator(byte: u8) -> bool { byte == SPACE || byte == TAB || byte == CR || byte == SYN || byte == FF } -fn wc(files: Vec, settings: &Settings) -> StdResult<(), i32> { - let mut total_line_count: usize = 0; - let mut total_word_count: usize = 0; - let mut total_char_count: usize = 0; - let mut total_byte_count: usize = 0; - let mut total_longest_line_length: usize = 0; - - let mut results = vec![]; - let mut max_width: usize = 0; +fn word_count_from_reader( + mut reader: T, + settings: &Settings, + path: &String, +) -> WcResult { + let only_count_bytes = settings.show_bytes + && (!(settings.show_chars + || settings.show_lines + || settings.show_max_line_length + || settings.show_words)); + if only_count_bytes { + return Ok(WordCount { + bytes: count_bytes_fast(&mut reader)?, + ..WordCount::default() + }); + } // we do not need to decode the byte stream if we're only counting bytes/newlines let decode_chars = settings.show_chars || settings.show_words || settings.show_max_line_length; + let mut line_count: usize = 0; + let mut word_count: usize = 0; + let mut byte_count: usize = 0; + let mut char_count: usize = 0; + let mut longest_line_length: usize = 0; + let mut raw_line = Vec::new(); + let mut ends_lf: bool; + + // reading from a TTY seems to raise a condition on, rather than return Some(0) like a file. + // hence the option wrapped in a result here + let mut buffered_reader = reader.get_buffered(); + loop { + match buffered_reader.read_until(LF, &mut raw_line) { + Ok(n) => { + if n == 0 { + break; + } + } + Err(ref e) => { + if !raw_line.is_empty() { + show_warning!("Error while reading {}: {}", path, e); + } else { + break; + } + } + }; + + // GNU 'wc' only counts lines that end in LF as lines + ends_lf = *raw_line.last().unwrap() == LF; + line_count += ends_lf as usize; + + byte_count += raw_line.len(); + + if decode_chars { + // try and convert the bytes to UTF-8 first + let current_char_count; + match from_utf8(&raw_line[..]) { + Ok(line) => { + word_count += line.split_whitespace().count(); + current_char_count = line.chars().count(); + } + Err(..) => { + word_count += raw_line.split(|&x| is_word_separator(x)).count(); + current_char_count = raw_line.iter().filter(|c| c.is_ascii()).count() + } + } + char_count += current_char_count; + if current_char_count > longest_line_length { + // -L is a GNU 'wc' extension so same behavior on LF + longest_line_length = current_char_count - (ends_lf as usize); + } + } + + raw_line.truncate(0); + } + + Ok(WordCount { + bytes: byte_count, + chars: char_count, + lines: line_count, + words: word_count, + max_line_length: longest_line_length, + }) +} + +fn word_count_from_path(path: &String, settings: &Settings) -> WcResult { + if path == "-" { + let stdin = io::stdin(); + let stdin_lock = stdin.lock(); + return Ok(word_count_from_reader(stdin_lock, settings, path)?); + } else { + let path_obj = Path::new(path); + if path_obj.is_dir() { + return Err(WcError::IsDirectory(path.clone())); + } else { + let file = File::open(path)?; + return Ok(word_count_from_reader(file, settings, path)?); + } + } +} + +fn wc(files: Vec, settings: &Settings) -> Result<(), u32> { + let mut total_word_count = WordCount::default(); + let mut results = vec![]; + let mut max_width: usize = 0; + let mut error_count = 0; + + let num_files = files.len(); + for path in &files { - let mut reader = open(&path[..])?; - - let mut line_count: usize = 0; - let mut word_count: usize = 0; - let mut byte_count: usize = 0; - let mut char_count: usize = 0; - let mut longest_line_length: usize = 0; - let mut raw_line = Vec::new(); - let mut ends_lf: bool; - // reading from a TTY seems to raise a condition on, rather than return Some(0) like a file. - // hence the option wrapped in a result here - while match reader.read_until(LF, &mut raw_line) { - Ok(n) if n > 0 => true, - Err(ref e) if !raw_line.is_empty() => { - show_warning!("Error while reading {}: {}", path, e); - !raw_line.is_empty() - } - _ => false, - } { - // GNU 'wc' only counts lines that end in LF as lines - ends_lf = *raw_line.last().unwrap() == LF; - line_count += ends_lf as usize; - - byte_count += raw_line.len(); - - if decode_chars { - // try and convert the bytes to UTF-8 first - let current_char_count; - match from_utf8(&raw_line[..]) { - Ok(line) => { - word_count += line.split_whitespace().count(); - current_char_count = line.chars().count(); - } - Err(..) => { - word_count += raw_line.split(|&x| is_word_separator(x)).count(); - current_char_count = raw_line.iter().filter(|c| c.is_ascii()).count() - } - } - char_count += current_char_count; - if current_char_count > longest_line_length { - // -L is a GNU 'wc' extension so same behavior on LF - longest_line_length = current_char_count - (ends_lf as usize); - } - } - - raw_line.truncate(0); - } - - results.push(Result { - title: path.clone(), - bytes: byte_count, - chars: char_count, - lines: line_count, - words: word_count, - max_line_length: longest_line_length, + let word_count = word_count_from_path(&path, settings).unwrap_or_else(|err| { + show_error!("{}", err); + error_count += 1; + WordCount::default() }); - - total_line_count += line_count; + max_width = max(max_width, word_count.bytes.to_string().len() + 1); total_word_count += word_count; - total_char_count += char_count; - total_byte_count += byte_count; - - if longest_line_length > total_longest_line_length { - total_longest_line_length = longest_line_length; - } - - // used for formatting - max_width = total_byte_count.to_string().len() + 1; + results.push(word_count.with_title(path)); } for result in &results { - print_stats(settings, &result, max_width); + if let Err(err) = print_stats(settings, &result, max_width) { + show_warning!("failed to print result for {}: {}", result.title, err); + error_count += 1; + } } - if files.len() > 1 { - let result = Result { - title: "total".to_owned(), - bytes: total_byte_count, - chars: total_char_count, - lines: total_line_count, - words: total_word_count, - max_line_length: total_longest_line_length, - }; - print_stats(settings, &result, max_width); + if num_files > 1 { + let total_result = total_word_count.with_title("total"); + if let Err(err) = print_stats(settings, &total_result, max_width) { + show_warning!("failed to print total: {}", err); + error_count += 1; + } + } + + if error_count == 0 { + Ok(()) + } else { + Err(error_count) + } +} + +fn print_stats( + settings: &Settings, + result: &TitledWordCount, + mut min_width: usize, +) -> WcResult<()> { + let stdout = io::stdout(); + let mut stdout_lock = stdout.lock(); + + if settings.number_enabled() <= 1 { + // Prevent a leading space in case we only need to display a single + // number. + min_width = 0; + } + + if settings.show_lines { + write!(stdout_lock, "{:1$}", result.count.lines, min_width)?; + } + if settings.show_words { + write!(stdout_lock, "{:1$}", result.count.words, min_width)?; + } + if settings.show_bytes { + write!(stdout_lock, "{:1$}", result.count.bytes, min_width)?; + } + if settings.show_chars { + write!(stdout_lock, "{:1$}", result.count.chars, min_width)?; + } + if settings.show_max_line_length { + write!( + stdout_lock, + "{:1$}", + result.count.max_line_length, min_width + )?; + } + + if result.title == "-" { + writeln!(stdout_lock, "")?; + } else { + writeln!(stdout_lock, " {}", result.title)?; } Ok(()) } - -fn print_stats(settings: &Settings, result: &Result, max_width: usize) { - if settings.show_lines { - print!("{:1$}", result.lines, max_width); - } - if settings.show_words { - print!("{:1$}", result.words, max_width); - } - if settings.show_bytes { - print!("{:1$}", result.bytes, max_width); - } - if settings.show_chars { - print!("{:1$}", result.chars, max_width); - } - if settings.show_max_line_length { - print!("{:1$}", result.max_line_length, max_width); - } - - if result.title != "-" { - println!(" {}", result.title); - } else { - println!(); - } -} - -fn open(path: &str) -> StdResult>, i32> { - if "-" == path { - let reader = Box::new(stdin()) as Box; - return Ok(BufReader::new(reader)); - } - - let fpath = Path::new(path); - if fpath.is_dir() { - show_info!("{}: is a directory", path); - } - match File::open(&fpath) { - Ok(fd) => { - let reader = Box::new(fd) as Box; - Ok(BufReader::new(reader)) - } - Err(e) => { - show_error!("wc: {}: {}", path, e); - Err(1) - } - } -} diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index b064d7e0e..fd1143f05 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -25,7 +25,7 @@ fn test_stdin_line_len_regression() { .args(&["-L"]) .pipe_in("\n123456") .run() - .stdout_is(" 6\n"); + .stdout_is("6\n"); } #[test] @@ -34,7 +34,7 @@ fn test_stdin_only_bytes() { .args(&["-c"]) .pipe_in_fixture("lorem_ipsum.txt") .run() - .stdout_is(" 772\n"); + .stdout_is("772\n"); } #[test] @@ -59,7 +59,7 @@ fn test_single_only_lines() { new_ucmd!() .args(&["-l", "moby_dick.txt"]) .run() - .stdout_is(" 18 moby_dick.txt\n"); + .stdout_is("18 moby_dick.txt\n"); } #[test] From da18ffa496a71d6409710789088864b1f15cd355 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 30 Mar 2021 20:54:25 +0200 Subject: [PATCH 0216/1135] refresh cargo.lock with recent updates --- Cargo.lock | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6b79e018b..ab8e59352 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,7 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 - [[package]] name = "advapi32-sys" version = "0.2.0" @@ -2005,7 +2003,7 @@ dependencies = [ name = "uu_more" version = "0.0.4" dependencies = [ - "getopts", + "clap", "nix 0.13.1", "redox_syscall 0.1.57", "redox_termios", From be03c948ed3b077f0d492353e5126b26016861bc Mon Sep 17 00:00:00 2001 From: desbma Date: Tue, 30 Mar 2021 21:24:01 +0200 Subject: [PATCH 0217/1135] Add pre-commit hook + run fmt (#1959) --- .pre-commit-config.yaml | 8 ++++++++ src/uu/tee/src/tee.rs | 33 ++++++++++++++++----------------- tests/by-util/test_pathchk.rs | 32 ++++++++++++++++---------------- tests/by-util/test_rm.rs | 2 +- 4 files changed, 41 insertions(+), 34 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..66d2a5f5a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +# https://pre-commit.com +repos: + - repo: https://github.com/doublify/pre-commit-rust + rev: v1.0 + hooks: + - id: cargo-check + - id: clippy + - id: fmt diff --git a/src/uu/tee/src/tee.rs b/src/uu/tee/src/tee.rs index 4b0f19038..7c6a86b4c 100644 --- a/src/uu/tee/src/tee.rs +++ b/src/uu/tee/src/tee.rs @@ -9,10 +9,10 @@ extern crate uucore; use clap::{App, Arg}; +use retain_mut::RetainMut; use std::fs::OpenOptions; use std::io::{copy, sink, stdin, stdout, Error, ErrorKind, Read, Result, Write}; use std::path::{Path, PathBuf}; -use retain_mut::RetainMut; #[cfg(unix)] use uucore::libc; @@ -98,19 +98,19 @@ fn tee(options: Options) -> Result<()> { .files .clone() .into_iter() - .map(|file| - NamedWriter { - name: file.clone(), - inner: open(file, options.append), - } - ) + .map(|file| NamedWriter { + name: file.clone(), + inner: open(file, options.append), + }) .collect(); - - writers.insert(0, NamedWriter { - name: "'standard output'".to_owned(), - inner: Box::new(stdout()), - }); + writers.insert( + 0, + NamedWriter { + name: "'standard output'".to_owned(), + inner: Box::new(stdout()), + }, + ); let mut output = MultiWriter::new(writers); let input = &mut NamedReader { @@ -119,8 +119,7 @@ fn tee(options: Options) -> Result<()> { // TODO: replaced generic 'copy' call to be able to stop copying // if all outputs are closed (due to errors) - if copy(input, &mut output).is_err() || output.flush().is_err() || - output.error_occured() { + if copy(input, &mut output).is_err() || output.flush().is_err() || output.error_occured() { Err(Error::new(ErrorKind::Other, "")) } else { Ok(()) @@ -150,7 +149,7 @@ struct MultiWriter { } impl MultiWriter { - fn new (writers: Vec) -> Self { + fn new(writers: Vec) -> Self { Self { initial_len: writers.len(), writers, @@ -170,7 +169,7 @@ impl Write for MultiWriter { show_info!("{}: {}", writer.name, f.to_string()); false } - _ => true + _ => true, } }); Ok(buf.len()) @@ -184,7 +183,7 @@ impl Write for MultiWriter { show_info!("{}: {}", writer.name, f.to_string()); false } - _ => true + _ => true, } }); Ok(()) diff --git a/tests/by-util/test_pathchk.rs b/tests/by-util/test_pathchk.rs index d01beccc2..3bc12f0b6 100644 --- a/tests/by-util/test_pathchk.rs +++ b/tests/by-util/test_pathchk.rs @@ -38,10 +38,7 @@ fn test_posix_mode() { // fail on long path new_ucmd!() - .args(&[ - "-p", - &"dir".repeat(libc::PATH_MAX as usize + 1).as_str(), - ]) + .args(&["-p", &"dir".repeat(libc::PATH_MAX as usize + 1).as_str()]) .fails() .no_stdout(); @@ -79,10 +76,7 @@ fn test_posix_special() { // fail on long path new_ucmd!() - .args(&[ - "-P", - &"dir".repeat(libc::PATH_MAX as usize + 1).as_str(), - ]) + .args(&["-P", &"dir".repeat(libc::PATH_MAX as usize + 1).as_str()]) .fails() .no_stdout(); @@ -107,7 +101,10 @@ fn test_posix_all() { // test the posix special mode // accept some reasonable default - new_ucmd!().args(&["-p", "-P", "dir/file"]).succeeds().no_stdout(); + new_ucmd!() + .args(&["-p", "-P", "dir/file"]) + .succeeds() + .no_stdout(); // accept non-leading hyphen new_ucmd!() @@ -136,10 +133,16 @@ fn test_posix_all() { .no_stdout(); // fail on non-portable chars - new_ucmd!().args(&["-p", "-P", "dir#/$file"]).fails().no_stdout(); + new_ucmd!() + .args(&["-p", "-P", "dir#/$file"]) + .fails() + .no_stdout(); // fail on leading hyphen char - new_ucmd!().args(&["-p", "-P", "dir/-file"]).fails().no_stdout(); + new_ucmd!() + .args(&["-p", "-P", "dir/-file"]) + .fails() + .no_stdout(); // fail on empty path new_ucmd!().args(&["-p", "-P", ""]).fails().no_stdout(); @@ -149,8 +152,5 @@ fn test_posix_all() { fn test_args_parsing() { // fail on no args let empty_args: [String; 0] = []; - new_ucmd!() - .args(&empty_args) - .fails() - .no_stdout(); -} \ No newline at end of file + new_ucmd!().args(&empty_args).fails().no_stdout(); +} diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 40cc6839a..149d509c5 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -177,7 +177,7 @@ fn test_rm_directory_without_flag() { let dir = "test_rm_directory_without_flag_dir"; at.mkdir(dir); - + let result = ucmd.arg(dir).fails(); println!("{}", result.stderr); assert!(result From ba315de6aa90a4e62401d6d5fd10b8b5d6d89c02 Mon Sep 17 00:00:00 2001 From: desbma Date: Tue, 30 Mar 2021 21:39:24 +0200 Subject: [PATCH 0218/1135] Add pre-commit instructions --- DEVELOPER_INSTRUCTIONS.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/DEVELOPER_INSTRUCTIONS.md b/DEVELOPER_INSTRUCTIONS.md index be6373409..c3b20dd46 100644 --- a/DEVELOPER_INSTRUCTIONS.md +++ b/DEVELOPER_INSTRUCTIONS.md @@ -24,3 +24,15 @@ if changes are not reflected in the report then run `cargo clean` and run the a If you are using stable version of Rust that doesn't enable code coverage instrumentation by default then add `-Z-Zinstrument-coverage` flag to `RUSTFLAGS` env variable specified above. + +pre-commit hooks +---------------- + +A configuration for `pre-commit` is provided in the repository. It allows automatically checking every git commit you make to ensure it compiles, and passes `clippy` and `rustfmt` without warnings. + +To use the provided hook: + +1. [Install `pre-commit`](https://pre-commit.com/#install) +2. Run `pre-commit install` while in the repository directory + +Your git commits will then automatically be checked. If a check fails, an error message will explain why, and your commit will be canceled. You can then make the suggested changes, and run `git commit ...` again. From a57f17ac5b7d66f7b2800adbda58f3bdfae6e24b Mon Sep 17 00:00:00 2001 From: Mikadore Date: Wed, 31 Mar 2021 11:25:23 +0200 Subject: [PATCH 0219/1135] Expand `CmdResult`'s API (#1977) --- tests/by-util/test_wc.rs | 2 +- tests/common/util.rs | 208 ++++++++++++++++++++++++++++++++------- 2 files changed, 171 insertions(+), 39 deletions(-) diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index fd1143f05..fc1665efc 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -14,7 +14,7 @@ fn test_utf8() { .args(&["-lwmcL"]) .pipe_in_fixture("UTF_8_test.txt") .run() - .stdout_is(" 0 0 0 0 0\n"); + .stdout_is(" 300 4969 22781 22213 79\n"); // GNU returns " 300 2086 22219 22781 79" // TODO: we should fix that to match GNU's behavior } diff --git a/tests/common/util.rs b/tests/common/util.rs index d33b1943d..2cee36267 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -53,9 +53,10 @@ pub fn is_wsl() -> bool { false } -fn read_scenario_fixture>(tmpd: &Option>, file_rel_path: S) -> String { +/// Read a test scenario fixture, returning its bytes +fn read_scenario_fixture>(tmpd: &Option>, file_rel_path: S) -> Vec { let tmpdir_path = tmpd.as_ref().unwrap().as_ref().path(); - AtPath::new(tmpdir_path).read(file_rel_path.as_ref().to_str().unwrap()) + AtPath::new(tmpdir_path).read_bytes(file_rel_path.as_ref().to_str().unwrap()) } /// A command result is the outputs of a command (streams and status code) @@ -69,29 +70,95 @@ pub struct CmdResult { /// zero-exit from running the Command? /// see [`success`] pub success: bool, - /// captured utf-8 standard output after running the Command + /// captured standard output after running the Command pub stdout: String, - /// captured utf-8 standard error after running the Command + /// captured standard error after running the Command pub stderr: String, } impl CmdResult { + /// Returns a reference to the program's standard output as a slice of bytes + pub fn stdout(&self) -> &[u8] { + &self.stdout.as_bytes() + } + + /// Returns the program's standard output as a string slice + pub fn stdout_str(&self) -> &str { + &self.stdout + } + + /// Returns the program's standard output as a string + /// consumes self + pub fn stdout_move_str(self) -> String { + self.stdout + } + + /// Returns the program's standard output as a vec of bytes + /// consumes self + pub fn stdout_move_bytes(self) -> Vec { + Vec::from(self.stdout) + } + + /// Returns a reference to the program's standard error as a slice of bytes + pub fn stderr(&self) -> &[u8] { + &self.stderr.as_bytes() + } + + /// Returns the program's standard error as a string slice + pub fn stderr_str(&self) -> &str { + &self.stderr + } + + /// Returns the program's standard error as a string + /// consumes self + pub fn stderr_move_str(self) -> String { + self.stderr + } + + /// Returns the program's standard error as a vec of bytes + /// consumes self + pub fn stderr_move_bytes(self) -> Vec { + Vec::from(self.stderr) + } + + /// Returns the program's exit code + /// Panics if not run + pub fn code(&self) -> i32 { + self.code.expect("Program must be run first") + } + + /// Returns the program's TempDir + /// Panics if not present + pub fn tmpd(&self) -> Rc { + match &self.tmpd { + Some(ptr) => ptr.clone(), + None => { + panic!("Command not associated with a TempDir") + } + } + } + + /// Returns whether the program succeeded + pub fn succeeded(&self) -> bool { + self.success + } + /// asserts that the command resulted in a success (zero) status code - pub fn success(&self) -> Box<&CmdResult> { + pub fn success(&self) -> &CmdResult { assert!(self.success); - Box::new(self) + self } /// asserts that the command resulted in a failure (non-zero) status code - pub fn failure(&self) -> Box<&CmdResult> { + pub fn failure(&self) -> &CmdResult { assert!(!self.success); - Box::new(self) + self } /// asserts that the command's exit code is the same as the given one - pub fn status_code(&self, code: i32) -> Box<&CmdResult> { + pub fn status_code(&self, code: i32) -> &CmdResult { assert!(self.code == Some(code)); - Box::new(self) + self } /// asserts that the command resulted in empty (zero-length) stderr stream output @@ -99,9 +166,9 @@ impl CmdResult { /// but you might find yourself using this function if /// 1. you can not know exactly what stdout will be /// or 2. you know that stdout will also be empty - pub fn no_stderr(&self) -> Box<&CmdResult> { - assert_eq!(self.stderr, ""); - Box::new(self) + pub fn no_stderr(&self) -> &CmdResult { + assert!(self.stderr.is_empty()); + self } /// asserts that the command resulted in empty (zero-length) stderr stream output @@ -110,62 +177,102 @@ impl CmdResult { /// but you might find yourself using this function if /// 1. you can not know exactly what stderr will be /// or 2. you know that stderr will also be empty - pub fn no_stdout(&self) -> Box<&CmdResult> { - assert_eq!(self.stdout, ""); - Box::new(self) + pub fn no_stdout(&self) -> &CmdResult { + assert!(self.stdout.is_empty()); + self } /// asserts that the command resulted in stdout stream output that equals the /// passed in value, trailing whitespace are kept to force strict comparison (#1235) /// stdout_only is a better choice unless stderr may or will be non-empty - pub fn stdout_is>(&self, msg: T) -> Box<&CmdResult> { + pub fn stdout_is>(&self, msg: T) -> &CmdResult { assert_eq!(self.stdout, String::from(msg.as_ref())); - Box::new(self) + self + } + + /// asserts that the command resulted in stdout stream output, + /// whose bytes equal those of the passed in slice + pub fn stdout_is_bytes>(&self, msg: T) -> &CmdResult { + assert_eq!(self.stdout.as_bytes(), msg.as_ref()); + self } /// like stdout_is(...), but expects the contents of the file at the provided relative path - pub fn stdout_is_fixture>(&self, file_rel_path: T) -> Box<&CmdResult> { + pub fn stdout_is_fixture>(&self, file_rel_path: T) -> &CmdResult { let contents = read_scenario_fixture(&self.tmpd, file_rel_path); - self.stdout_is(contents) + self.stdout_is_bytes(contents) } /// asserts that the command resulted in stderr stream output that equals the /// passed in value, when both are trimmed of trailing whitespace /// stderr_only is a better choice unless stdout may or will be non-empty - pub fn stderr_is>(&self, msg: T) -> Box<&CmdResult> { + pub fn stderr_is>(&self, msg: T) -> &CmdResult { assert_eq!( self.stderr.trim_end(), String::from(msg.as_ref()).trim_end() ); - Box::new(self) + self + } + + /// asserts that the command resulted in stderr stream output, + /// whose bytes equal those of the passed in slice + pub fn stderr_is_bytes>(&self, msg: T) -> &CmdResult { + assert_eq!(self.stderr.as_bytes(), msg.as_ref()); + self } /// asserts that /// 1. the command resulted in stdout stream output that equals the /// passed in value, when both are trimmed of trailing whitespace /// and 2. the command resulted in empty (zero-length) stderr stream output - pub fn stdout_only>(&self, msg: T) -> Box<&CmdResult> { + pub fn stdout_only>(&self, msg: T) -> &CmdResult { self.no_stderr().stdout_is(msg) } + /// asserts that + /// 1. the command resulted in a stdout stream whose bytes + /// equal those of the passed in value + /// 2. the command resulted in an empty stderr stream + pub fn stdout_only_bytes>(&self, msg: T) -> &CmdResult { + self.no_stderr().stdout_is_bytes(msg) + } + /// like stdout_only(...), but expects the contents of the file at the provided relative path - pub fn stdout_only_fixture>(&self, file_rel_path: T) -> Box<&CmdResult> { + pub fn stdout_only_fixture>(&self, file_rel_path: T) -> &CmdResult { let contents = read_scenario_fixture(&self.tmpd, file_rel_path); - self.stdout_only(contents) + self.stdout_only_bytes(contents) } /// asserts that /// 1. the command resulted in stderr stream output that equals the /// passed in value, when both are trimmed of trailing whitespace /// and 2. the command resulted in empty (zero-length) stdout stream output - pub fn stderr_only>(&self, msg: T) -> Box<&CmdResult> { + pub fn stderr_only>(&self, msg: T) -> &CmdResult { self.no_stdout().stderr_is(msg) } - pub fn fails_silently(&self) -> Box<&CmdResult> { + /// asserts that + /// 1. the command resulted in a stderr stream whose bytes equal the ones + /// of the passed value + /// 2. the command resulted in an empty stdout stream + pub fn stderr_only_bytes>(&self, msg: T) -> &CmdResult { + self.no_stderr().stderr_is_bytes(msg) + } + + pub fn fails_silently(&self) -> &CmdResult { assert!(!self.success); - assert_eq!(self.stderr, ""); - Box::new(self) + assert!(self.stderr.is_empty()); + self + } + + pub fn stdout_contains>(&self, cmp: T) -> &CmdResult { + assert!(self.stdout_str().contains(cmp.as_ref())); + self + } + + pub fn stderr_contains>(&self, cmp: &T) -> &CmdResult { + assert!(self.stderr_str().contains(cmp.as_ref())); + self } } @@ -255,11 +362,25 @@ impl AtPath { contents } + pub fn read_bytes(&self, name: &str) -> Vec { + let mut f = self.open(name); + let mut contents = Vec::new(); + f.read_to_end(&mut contents) + .unwrap_or_else(|e| panic!("Couldn't read {}: {}", name, e)); + contents + } + pub fn write(&self, name: &str, contents: &str) { log_info("open(write)", self.plus_as_string(name)); let _ = std::fs::write(self.plus(name), contents); } + pub fn write_bytes(&self, name: &str, contents: &[u8]) { + log_info("open(write)", self.plus_as_string(name)); + std::fs::write(self.plus(name), contents) + .unwrap_or_else(|e| panic!("Couldn't write {}: {}", name, e)); + } + pub fn append(&self, name: &str, contents: &str) { log_info("open(append)", self.plus_as_string(name)); let mut f = OpenOptions::new() @@ -270,6 +391,17 @@ impl AtPath { let _ = f.write(contents.as_bytes()); } + pub fn append_bytes(&self, name: &str, contents: &[u8]) { + log_info("open(append)", self.plus_as_string(name)); + let mut f = OpenOptions::new() + .write(true) + .append(true) + .open(self.plus(name)) + .unwrap(); + f.write_all(contents) + .unwrap_or_else(|e| panic!("Couldn't append to {}: {}", name, e)); + } + pub fn mkdir(&self, dir: &str) { log_info("mkdir", self.plus_as_string(dir)); fs::create_dir(&self.plus(dir)).unwrap(); @@ -521,19 +653,19 @@ impl UCommand { /// Add a parameter to the invocation. Path arguments are treated relative /// to the test environment directory. - pub fn arg>(&mut self, arg: S) -> Box<&mut UCommand> { + pub fn arg>(&mut self, arg: S) -> &mut UCommand { if self.has_run { panic!(ALREADY_RUN); } self.comm_string.push_str(" "); self.comm_string.push_str(arg.as_ref().to_str().unwrap()); self.raw.arg(arg.as_ref()); - Box::new(self) + self } /// Add multiple parameters to the invocation. Path arguments are treated relative /// to the test environment directory. - pub fn args>(&mut self, args: &[S]) -> Box<&mut UCommand> { + pub fn args>(&mut self, args: &[S]) -> &mut UCommand { if self.has_run { panic!(MULTIPLE_STDIN_MEANINGLESS); } @@ -543,25 +675,25 @@ impl UCommand { } self.raw.args(args.as_ref()); - Box::new(self) + self } /// provides stdinput to feed in to the command when spawned - pub fn pipe_in>>(&mut self, input: T) -> Box<&mut UCommand> { + pub fn pipe_in>>(&mut self, input: T) -> &mut UCommand { if self.stdin.is_some() { panic!(MULTIPLE_STDIN_MEANINGLESS); } self.stdin = Some(input.into()); - Box::new(self) + self } /// like pipe_in(...), but uses the contents of the file at the provided relative path as the piped in data - pub fn pipe_in_fixture>(&mut self, file_rel_path: S) -> Box<&mut UCommand> { + pub fn pipe_in_fixture>(&mut self, file_rel_path: S) -> &mut UCommand { let contents = read_scenario_fixture(&self.tmpd, file_rel_path); self.pipe_in(contents) } - pub fn env(&mut self, key: K, val: V) -> Box<&mut UCommand> + pub fn env(&mut self, key: K, val: V) -> &mut UCommand where K: AsRef, V: AsRef, @@ -570,7 +702,7 @@ impl UCommand { panic!(ALREADY_RUN); } self.raw.env(key, val); - Box::new(self) + self } /// Spawns the command, feeds the stdin if any, and returns the From 96643d6f918529891c1b8d43e000ea24a1bcd3ed Mon Sep 17 00:00:00 2001 From: Mikadore Date: Wed, 31 Mar 2021 12:54:16 +0200 Subject: [PATCH 0220/1135] fix #1970 (#1980) --- tests/common/util.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/common/util.rs b/tests/common/util.rs index 2cee36267..e13bdd3e6 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -358,7 +358,8 @@ impl AtPath { pub fn read(&self, name: &str) -> String { let mut f = self.open(name); let mut contents = String::new(); - let _ = f.read_to_string(&mut contents); + f.read_to_string(&mut contents) + .unwrap_or_else(|e| panic!("Couldn't read {}: {}", name, e)); contents } @@ -372,7 +373,8 @@ impl AtPath { pub fn write(&self, name: &str, contents: &str) { log_info("open(write)", self.plus_as_string(name)); - let _ = std::fs::write(self.plus(name), contents); + std::fs::write(self.plus(name), contents) + .unwrap_or_else(|e| panic!("Couldn't write {}: {}", name, e)); } pub fn write_bytes(&self, name: &str, contents: &[u8]) { @@ -388,7 +390,8 @@ impl AtPath { .append(true) .open(self.plus(name)) .unwrap(); - let _ = f.write(contents.as_bytes()); + f.write(contents.as_bytes()) + .unwrap_or_else(|e| panic!("Couldn't write {}: {}", name, e)); } pub fn append_bytes(&self, name: &str, contents: &[u8]) { @@ -781,7 +784,7 @@ pub fn read_size(child: &mut Child, size: usize) -> String { .stdout .as_mut() .unwrap() - .read(output.as_mut_slice()) + .read_exact(output.as_mut_slice()) .unwrap(); String::from_utf8(output).unwrap() } From b8079098f2824036bd683645a99354c3a7ec5e5f Mon Sep 17 00:00:00 2001 From: Mikadore Date: Wed, 31 Mar 2021 13:30:06 +0200 Subject: [PATCH 0221/1135] fixed panic! formatting --- tests/by-util/test_chmod.rs | 10 +++++----- tests/by-util/test_cp.rs | 4 ++-- tests/by-util/test_shuf.rs | 15 +++++++-------- tests/common/macros.rs | 6 +++--- tests/common/util.rs | 10 +++++----- 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index 78fee462d..b85567166 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -37,10 +37,10 @@ fn run_single_test(test: &TestCase, at: AtPath, mut ucmd: UCommand) { mkfile(&at.plus_as_string(TEST_FILE), test.before); let perms = at.metadata(TEST_FILE).permissions().mode(); if perms != test.before { - panic!(format!( + panic!( "{}: expected: {:o} got: {:o}", "setting permissions on test files before actual test run failed", test.after, perms - )); + ); } for arg in &test.args { @@ -49,15 +49,15 @@ fn run_single_test(test: &TestCase, at: AtPath, mut ucmd: UCommand) { let r = ucmd.run(); if !r.success { println!("{}", r.stderr); - panic!(format!("{:?}: failed", ucmd.raw)); + panic!("{:?}: failed", ucmd.raw); } let perms = at.metadata(TEST_FILE).permissions().mode(); if perms != test.after { - panic!(format!( + panic!( "{:?}: expected: {:o} got: {:o}", ucmd.raw, test.after, perms - )); + ); } } diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index a00ed2fd2..1fa8212ca 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1038,7 +1038,7 @@ fn test_cp_one_file_system() { .arg("tmpfs") .arg(mountpoint_path) .run(); - assert!(_r.code == Some(0), _r.stderr); + assert!(_r.code == Some(0), "{}", _r.stderr); at_src.touch(TEST_MOUNT_OTHER_FILESYSTEM_FILE); @@ -1052,7 +1052,7 @@ fn test_cp_one_file_system() { // Ditch the mount before the asserts let _r = scene.cmd("umount").arg(mountpoint_path).run(); - assert!(_r.code == Some(0), _r.stderr); + assert!(_r.code == Some(0), "{}", _r.stderr); assert!(result.success); assert!(!at_dst.file_exists(TEST_MOUNT_OTHER_FILESYSTEM_FILE)); diff --git a/tests/by-util/test_shuf.rs b/tests/by-util/test_shuf.rs index 065cef804..717971bd4 100644 --- a/tests/by-util/test_shuf.rs +++ b/tests/by-util/test_shuf.rs @@ -98,7 +98,8 @@ fn test_head_count() { assert_eq!(result_seq.len(), repeat_limit, "Output is not limited"); assert!( result_seq.iter().all(|x| input_seq.contains(x)), - format!("Output includes element not from input: {}", result) + "Output includes element not from input: {}", + result ) } @@ -133,13 +134,11 @@ fn test_repeat() { ); assert!( result_seq.iter().all(|x| input_seq.contains(x)), - format!( - "Output includes element not from input: {:?}", - result_seq - .iter() - .filter(|x| !input_seq.contains(x)) - .collect::>() - ) + "Output includes element not from input: {:?}", + result_seq + .iter() + .filter(|x| !input_seq.contains(x)) + .collect::>() ) } diff --git a/tests/common/macros.rs b/tests/common/macros.rs index 32ff7cbe8..e8b9c9d5d 100644 --- a/tests/common/macros.rs +++ b/tests/common/macros.rs @@ -5,7 +5,7 @@ macro_rules! assert_empty_stderr( ($cond:expr) => ( if $cond.stderr.len() > 0 { - panic!(format!("stderr: {}", $cond.stderr)) + panic!("stderr: {}", $cond.stderr_str()) } ); ); @@ -17,7 +17,7 @@ macro_rules! assert_empty_stderr( macro_rules! assert_empty_stdout( ($cond:expr) => ( if $cond.stdout.len() > 0 { - panic!(format!("stdout: {}", $cond.stdout)) + panic!("stdout: {}", $cond.stdout_str()) } ); ); @@ -30,7 +30,7 @@ macro_rules! assert_no_error( ($cond:expr) => ( assert!($cond.success); if $cond.stderr.len() > 0 { - panic!(format!("stderr: {}", $cond.stderr)) + panic!("stderr: {}", $cond.stderr_str()) } ); ); diff --git a/tests/common/util.rs b/tests/common/util.rs index e13bdd3e6..e4b452289 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -658,7 +658,7 @@ impl UCommand { /// to the test environment directory. pub fn arg>(&mut self, arg: S) -> &mut UCommand { if self.has_run { - panic!(ALREADY_RUN); + panic!("{}", ALREADY_RUN); } self.comm_string.push_str(" "); self.comm_string.push_str(arg.as_ref().to_str().unwrap()); @@ -670,7 +670,7 @@ impl UCommand { /// to the test environment directory. pub fn args>(&mut self, args: &[S]) -> &mut UCommand { if self.has_run { - panic!(MULTIPLE_STDIN_MEANINGLESS); + panic!("{}", MULTIPLE_STDIN_MEANINGLESS); } for s in args { self.comm_string.push_str(" "); @@ -684,7 +684,7 @@ impl UCommand { /// provides stdinput to feed in to the command when spawned pub fn pipe_in>>(&mut self, input: T) -> &mut UCommand { if self.stdin.is_some() { - panic!(MULTIPLE_STDIN_MEANINGLESS); + panic!("{}", MULTIPLE_STDIN_MEANINGLESS); } self.stdin = Some(input.into()); self @@ -702,7 +702,7 @@ impl UCommand { V: AsRef, { if self.has_run { - panic!(ALREADY_RUN); + panic!("{}", ALREADY_RUN); } self.raw.env(key, val); self @@ -712,7 +712,7 @@ impl UCommand { /// child process immediately. pub fn run_no_wait(&mut self) -> Child { if self.has_run { - panic!(ALREADY_RUN); + panic!("{}", ALREADY_RUN); } self.has_run = true; log_info("run", &self.comm_string); From 751ae6a8f857c6fd00eed5b571f6e3e36bbb360d Mon Sep 17 00:00:00 2001 From: Aleksandar Janicijevic Date: Wed, 31 Mar 2021 15:19:04 -0400 Subject: [PATCH 0222/1135] shred: use clap for argument management (#1961) --- Cargo.lock | 2 +- src/uu/shred/Cargo.toml | 2 +- src/uu/shred/src/shred.rs | 275 +++++++++++++++++++++----------------- 3 files changed, 158 insertions(+), 121 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ab8e59352..1caa4750d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2217,8 +2217,8 @@ dependencies = [ name = "uu_shred" version = "0.0.4" dependencies = [ + "clap", "filetime", - "getopts", "libc", "rand 0.5.6", "time", diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index 72e6119a8..6ff6e23ec 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/shred.rs" [dependencies] +clap = "2.33" filetime = "0.2.1" -getopts = "0.2.18" libc = "0.2.42" rand = "0.5" time = "0.1.40" diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 4946ed35d..b54d3db45 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -8,6 +8,7 @@ // spell-checker:ignore (ToDO) NAMESET FILESIZE fstab coeff journaling writeback REiser journaled +use clap::{App, Arg}; use rand::{Rng, ThreadRng}; use std::cell::{Cell, RefCell}; use std::fs; @@ -212,138 +213,174 @@ impl<'a> BytesGenerator<'a> { } } +static ABOUT: &str = "Overwrite the specified FILE(s) repeatedly, in order to make it harder\n\ +for even very expensive hardware probing to recover the data. +"; + +fn get_usage() -> String { + format!("{} [OPTION]... FILE...", executable!()) +} + +static AFTER_HELP: &str = + "Delete FILE(s) if --remove (-u) is specified. The default is not to remove\n\ +the files because it is common to operate on device files like /dev/hda,\n\ +and those files usually should not be removed.\n\ +\n\ +CAUTION: Note that shred relies on a very important assumption:\n\ +that the file system overwrites data in place. This is the traditional\n\ +way to do things, but many modern file system designs do not satisfy this\n\ +assumption. The following are examples of file systems on which shred is\n\ +not effective, or is not guaranteed to be effective in all file system modes:\n\ +\n\ +* log-structured or journaled file systems, such as those supplied with\n\ +AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)\n\ +\n\ +* file systems that write redundant data and carry on even if some writes\n\ +fail, such as RAID-based file systems\n\ +\n\ +* file systems that make snapshots, such as Network Appliance's NFS server\n\ +\n\ +* file systems that cache in temporary locations, such as NFS\n\ +version 3 clients\n\ +\n\ +* compressed file systems\n\ +\n\ +In the case of ext3 file systems, the above disclaimer applies\n\ +and shred is thus of limited effectiveness) only in data=journal mode,\n\ +which journals file data in addition to just metadata. In both the\n\ +data=ordered (default) and data=writeback modes, shred works as usual.\n\ +Ext3 journaling modes can be changed by adding the data=something option\n\ +to the mount options for a particular file system in the /etc/fstab file,\n\ +as documented in the mount man page (man mount).\n\ +\n\ +In addition, file system backups and remote mirrors may contain copies\n\ +of the file that cannot be removed, and that will allow a shredded file\n\ +to be recovered later.\n\ +"; + +pub mod options { + pub const FILE: &str = "file"; + pub const ITERATIONS: &str = "iterations"; + pub const SIZE: &str = "size"; + pub const REMOVE: &str = "remove"; + pub const VERBOSE: &str = "verbose"; + pub const EXACT: &str = "exact"; + pub const ZERO: &str = "zero"; +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = getopts::Options::new(); + let usage = get_usage(); - // TODO: Add force option - opts.optopt( - "n", - "iterations", - "overwrite N times instead of the default (3)", - "N", - ); - opts.optopt( - "s", - "size", - "shred this many bytes (suffixes like K, M, G accepted)", - "FILESIZE", - ); - opts.optflag( - "u", - "remove", - "truncate and remove the file after overwriting; See below", - ); - opts.optflag("v", "verbose", "show progress"); - opts.optflag( - "x", - "exact", - "do not round file sizes up to the next full block; \ - this is the default for non-regular files", - ); - opts.optflag( - "z", - "zero", - "add a final overwrite with zeros to hide shredding", - ); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); + let app = App::new(executable!()) + .version(VERSION_STR) + .about(ABOUT) + .after_help(AFTER_HELP) + .usage(&usage[..]) + .arg( + Arg::with_name(options::ITERATIONS) + .long(options::ITERATIONS) + .short("n") + .help("overwrite N times instead of the default (3)") + .value_name("NUMBER") + .default_value("3"), + ) + .arg( + Arg::with_name(options::SIZE) + .long(options::SIZE) + .short("s") + .takes_value(true) + .value_name("N") + .help("shred this many bytes (suffixes like K, M, G accepted)"), + ) + .arg( + Arg::with_name(options::REMOVE) + .short("u") + .long(options::REMOVE) + .help("truncate and remove file after overwriting; See below"), + ) + .arg( + Arg::with_name(options::VERBOSE) + .long(options::VERBOSE) + .short("v") + .help("show progress"), + ) + .arg( + Arg::with_name(options::EXACT) + .long(options::EXACT) + .short("x") + .help( + "do not round file sizes up to the next full block;\n\ +this is the default for non-regular files", + ), + ) + .arg( + Arg::with_name(options::ZERO) + .long(options::ZERO) + .short("z") + .help("add a final overwrite with zeros to hide shredding"), + ) + // Positional arguments + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(e) => panic!("Invalid options\n{}", e), + let matches = app.get_matches_from(args); + + let mut errs: Vec = vec![]; + + if !matches.is_present(options::FILE) { + eprintln!("{}: Missing an argument", NAME); + eprintln!("For help, try '{} --help'", NAME); + return 0; + } + + let iterations = match matches.value_of(options::ITERATIONS) { + Some(s) => match s.parse::() { + Ok(u) => u, + Err(_) => { + errs.push(String::from(format!("invalid number of passes: '{}'", s))); + 0 + } + }, + None => unreachable!(), }; - if matches.opt_present("help") { - show_help(&opts); - return 0; - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION_STR); - return 0; - } else if matches.free.is_empty() { - println!("{}: Missing an argument", NAME); - println!("For help, try '{} --help'", NAME); - return 0; - } else { - let iterations = match matches.opt_str("iterations") { - Some(s) => match s.parse::() { - Ok(u) => u, - Err(_) => { - println!("{}: Invalid number of passes", NAME); - return 1; - } - }, - None => 3, - }; - let remove = matches.opt_present("remove"); - let size = get_size(matches.opt_str("size")); - let exact = matches.opt_present("exact") && size.is_none(); // if -s is given, ignore -x - let zero = matches.opt_present("zero"); - let verbose = matches.opt_present("verbose"); - for path_str in matches.free.into_iter() { - wipe_file(&path_str, iterations, remove, size, exact, zero, verbose); + // TODO: implement --remove HOW + // The optional HOW parameter indicates how to remove a directory entry: + // - 'unlink' => use a standard unlink call. + // - 'wipe' => also first obfuscate bytes in the name. + // - 'wipesync' => also sync each obfuscated byte to disk. + // The default mode is 'wipesync', but note it can be expensive. + + // TODO: implement --random-source + + // TODO: implement --force + + let remove = matches.is_present(options::REMOVE); + let size_arg = match matches.value_of(options::SIZE) { + Some(s) => Some(s.to_string()), + None => None, + }; + let size = get_size(size_arg); + let exact = matches.is_present(options::EXACT) && size.is_none(); // if -s is given, ignore -x + let zero = matches.is_present(options::ZERO); + let verbose = matches.is_present(options::VERBOSE); + + if !errs.is_empty() { + eprintln!("Invalid arguments supplied."); + for message in errs { + eprintln!("{}", message); } + return 1; + } + + for path_str in matches.values_of(options::FILE).unwrap() { + wipe_file(&path_str, iterations, remove, size, exact, zero, verbose); } 0 } -fn show_help(opts: &getopts::Options) { - println!("Usage: {} [OPTION]... FILE...", NAME); - println!( - "Overwrite the specified FILE(s) repeatedly, in order to make it harder \ - for even very expensive hardware probing to recover the data." - ); - println!("{}", opts.usage("")); - println!("Delete FILE(s) if --remove (-u) is specified. The default is not to remove"); - println!("the files because it is common to operate on device files like /dev/hda,"); - println!("and those files usually should not be removed."); - println!(); - println!( - "CAUTION: Note that {} relies on a very important assumption:", - NAME - ); - println!("that the file system overwrites data in place. This is the traditional"); - println!("way to do things, but many modern file system designs do not satisfy this"); - println!( - "assumption. The following are examples of file systems on which {} is", - NAME - ); - println!("not effective, or is not guaranteed to be effective in all file system modes:"); - println!(); - println!("* log-structured or journaled file systems, such as those supplied with"); - println!("AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)"); - println!(); - println!("* file systems that write redundant data and carry on even if some writes"); - println!("fail, such as RAID-based file systems"); - println!(); - println!("* file systems that make snapshots, such as Network Appliance's NFS server"); - println!(); - println!("* file systems that cache in temporary locations, such as NFS"); - println!("version 3 clients"); - println!(); - println!("* compressed file systems"); - println!(); - println!("In the case of ext3 file systems, the above disclaimer applies"); - println!( - "(and {} is thus of limited effectiveness) only in data=journal mode,", - NAME - ); - println!("which journals file data in addition to just metadata. In both the"); - println!( - "data=ordered (default) and data=writeback modes, {} works as usual.", - NAME - ); - println!("Ext3 journaling modes can be changed by adding the data=something option"); - println!("to the mount options for a particular file system in the /etc/fstab file,"); - println!("as documented in the mount man page (man mount)."); - println!(); - println!("In addition, file system backups and remote mirrors may contain copies"); - println!("of the file that cannot be removed, and that will allow a shredded file"); - println!("to be recovered later."); -} - // TODO: Add support for all postfixes here up to and including EiB // http://www.gnu.org/software/coreutils/manual/coreutils.html#Block-size fn get_size(size_str_opt: Option) -> Option { From e958864bd9aaf2f90f8d78f09f8281b47519150a Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Wed, 31 Mar 2021 22:21:10 +0300 Subject: [PATCH 0223/1135] tac: exit with proper code, move from getopts to clap, add test for invalid inputs (#1957) --- Cargo.lock | 6 +- src/uu/tac/Cargo.toml | 2 +- src/uu/tac/src/tac.rs | 136 ++++++++++++++++++++------------------ tests/by-util/test_tac.rs | 18 +++++ 4 files changed, 95 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1caa4750d..08a7bad43 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2323,9 +2323,9 @@ dependencies = [ name = "uu_tac" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index 15e743006..2e54c129e 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/tac.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/tac/src/tac.rs b/src/uu/tac/src/tac.rs index 843babac9..68dae94e2 100644 --- a/src/uu/tac/src/tac.rs +++ b/src/uu/tac/src/tac.rs @@ -10,79 +10,77 @@ #[macro_use] extern crate uucore; -use std::fs::File; +use clap::{App, Arg}; use std::io::{stdin, stdout, BufReader, Read, Stdout, Write}; +use std::{fs::File, path::Path}; static NAME: &str = "tac"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static USAGE: &str = "[OPTION]... [FILE]..."; +static SUMMARY: &str = "Write each file to standard output, last line first."; + +mod options { + pub static BEFORE: &str = "before"; + pub static REGEX: &str = "regex"; + pub static SEPARATOR: &str = "separator"; + pub static FILE: &str = "file"; +} pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(USAGE) + .about(SUMMARY) + .arg( + Arg::with_name(options::BEFORE) + .short("b") + .long(options::BEFORE) + .help("attach the separator before instead of after") + .takes_value(false), + ) + .arg( + Arg::with_name(options::REGEX) + .short("r") + .long(options::REGEX) + .help("interpret the sequence as a regular expression (NOT IMPLEMENTED)") + .takes_value(false), + ) + .arg( + Arg::with_name(options::SEPARATOR) + .short("s") + .long(options::SEPARATOR) + .help("use STRING as the separator instead of newline") + .takes_value(true), + ) + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) + .get_matches_from(args); - opts.optflag( - "b", - "before", - "attach the separator before instead of after", - ); - opts.optflag( - "r", - "regex", - "interpret the sequence as a regular expression (NOT IMPLEMENTED)", - ); - opts.optopt( - "s", - "separator", - "use STRING as the separator instead of newline", - "STRING", - ); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f), - }; - if matches.opt_present("help") { - let msg = format!( - "{0} {1} - -Usage: - {0} [OPTION]... [FILE]... - -Write each file to standard output, last line first.", - NAME, VERSION - ); - - print!("{}", opts.usage(&msg)); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else { - let before = matches.opt_present("b"); - let regex = matches.opt_present("r"); - let separator = match matches.opt_str("s") { - Some(m) => { - if m.is_empty() { - crash!(1, "separator cannot be empty") - } else { - m - } + let before = matches.is_present(options::BEFORE); + let regex = matches.is_present(options::REGEX); + let separator = match matches.value_of(options::SEPARATOR) { + Some(m) => { + if m.is_empty() { + crash!(1, "separator cannot be empty") + } else { + m.to_owned() } - None => "\n".to_owned(), - }; - let files = if matches.free.is_empty() { - vec!["-".to_owned()] - } else { - matches.free - }; - tac(files, before, regex, &separator[..]); - } + } + None => "\n".to_owned(), + }; - 0 + let files: Vec = match matches.values_of(options::FILE) { + Some(v) => v.map(|v| v.to_owned()).collect(), + None => vec!["-".to_owned()], + }; + + tac(files, before, regex, &separator[..]) } -fn tac(filenames: Vec, before: bool, _: bool, separator: &str) { +fn tac(filenames: Vec, before: bool, _: bool, separator: &str) -> i32 { + let mut exit_code = 0; let mut out = stdout(); let sbytes = separator.as_bytes(); let slen = sbytes.len(); @@ -91,10 +89,19 @@ fn tac(filenames: Vec, before: bool, _: bool, separator: &str) { let mut file = BufReader::new(if filename == "-" { Box::new(stdin()) as Box } else { - match File::open(filename) { + let path = Path::new(filename); + if path.is_dir() || !path.metadata().is_ok() { + show_error!( + "failed to open '{}' for reading: No such file or directory", + filename + ); + continue; + } + match File::open(path) { Ok(f) => Box::new(f) as Box, Err(e) => { - show_warning!("failed to open '{}' for reading: {}", filename, e); + show_error!("failed to open '{}' for reading: {}", filename, e); + exit_code = 1; continue; } } @@ -102,7 +109,8 @@ fn tac(filenames: Vec, before: bool, _: bool, separator: &str) { let mut data = Vec::new(); if let Err(e) = file.read_to_end(&mut data) { - show_warning!("failed to read '{}': {}", filename, e); + show_error!("failed to read '{}': {}", filename, e); + exit_code = 1; continue; }; @@ -141,6 +149,8 @@ fn tac(filenames: Vec, before: bool, _: bool, separator: &str) { } show_line(&mut out, sbytes, &data[0..prev], before); } + + exit_code } fn show_line(out: &mut Stdout, sep: &[u8], dat: &[u8], before: bool) { diff --git a/tests/by-util/test_tac.rs b/tests/by-util/test_tac.rs index d46f9aec6..3733adbec 100644 --- a/tests/by-util/test_tac.rs +++ b/tests/by-util/test_tac.rs @@ -49,3 +49,21 @@ fn test_single_non_newline_separator_before() { .run() .stdout_is_fixture("delimited_primes_before.expected"); } + +#[test] +fn test_invalid_input() { + let (_, mut ucmd) = at_and_ucmd!(); + + ucmd.arg("b") + .run() + .stderr + .contains("tac: error: failed to open 'b' for reading"); + + let (at, mut ucmd) = at_and_ucmd!(); + + at.mkdir("a"); + ucmd.arg("a") + .run() + .stderr + .contains("tac: error: failed to read 'a'"); +} From 7669a4387af52d0a4f979618ef7ce7eb98af5113 Mon Sep 17 00:00:00 2001 From: Alessandro Stoltenberg Date: Wed, 31 Mar 2021 22:27:24 +0200 Subject: [PATCH 0224/1135] echo: Some minor changes to options (#1960) --- src/uu/echo/src/echo.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index c991f5d3f..1e0c04d1d 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -14,10 +14,10 @@ use std::io::{self, Write}; use std::iter::Peekable; use std::str::Chars; -static NAME: &str = "echo"; -static USAGE: &str = "[OPTIONS]... [STRING]..."; -static SUMMARY: &str = "display a line of text"; -static AFTER_HELP: &str = r#" +const NAME: &str = "echo"; +const SUMMARY: &str = "display a line of text"; +const USAGE: &str = "[OPTIONS]... [STRING]..."; +const AFTER_HELP: &str = r#" Echo the STRING(s) to standard output. If -e is in effect, the following sequences are recognized: @@ -36,11 +36,12 @@ static AFTER_HELP: &str = r#" \\xHH byte with hexadecimal value HH (1 to 2 digits) "#; + mod options { - pub static STRING: &str = "STRING"; - pub static NO_NEWLINE: &str = "no_newline"; - pub static ENABLE_BACKSLASH_ESCAPE: &str = "enable_backslash_escape"; - pub static DISABLE_BACKSLASH_ESCAPE: &str = "disable_backslash_escape"; + pub const STRING: &str = "STRING"; + pub const NO_NEWLINE: &str = "no_newline"; + pub const ENABLE_BACKSLASH_ESCAPE: &str = "enable_backslash_escape"; + pub const DISABLE_BACKSLASH_ESCAPE: &str = "disable_backslash_escape"; } fn parse_code( @@ -113,8 +114,6 @@ fn print_escaped(input: &str, mut output: impl Write) -> io::Result { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); - let matches = App::new(executable!()) .name(NAME) // TrailingVarArg specifies the final positional argument is a VarArg @@ -123,9 +122,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .setting(clap::AppSettings::TrailingVarArg) .setting(clap::AppSettings::AllowLeadingHyphen) .version(crate_version!()) - .usage(USAGE) .about(SUMMARY) .after_help(AFTER_HELP) + .usage(USAGE) .arg( Arg::with_name(options::NO_NEWLINE) .short("n") @@ -149,7 +148,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) .arg( Arg::with_name(options::STRING) - .hidden(true) .multiple(true) .allow_hyphen_values(true), ) From bb3e93372f82b85f9fcc26e485892dab32b96ec5 Mon Sep 17 00:00:00 2001 From: Mikadore Date: Thu, 1 Apr 2021 02:16:15 +0200 Subject: [PATCH 0225/1135] od: refactor tests for #1982 --- tests/by-util/test_od.rs | 484 +++++++++++++++++---------------------- 1 file changed, 209 insertions(+), 275 deletions(-) diff --git a/tests/by-util/test_od.rs b/tests/by-util/test_od.rs index f3b766c26..b49e6f0ca 100644 --- a/tests/by-util/test_od.rs +++ b/tests/by-util/test_od.rs @@ -21,6 +21,7 @@ static ALPHA_OUT: &'static str = " // Test that od can read one file and dump with default format #[test] fn test_file() { + // TODO: Can this be replaced by AtPath? use std::env; let temp = env::temp_dir(); let tmpdir = Path::new(&temp); @@ -33,15 +34,12 @@ fn test_file() { } } - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg(file.as_os_str()) - .run(); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, unindent(ALPHA_OUT)); - + .succeeds() + .no_stderr() + .stdout_is(unindent(ALPHA_OUT)); let _ = remove_file(file); } @@ -64,16 +62,14 @@ fn test_2files() { } } - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg(file1.as_os_str()) .arg(file2.as_os_str()) - .run(); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, unindent(ALPHA_OUT)); - + .succeeds() + .no_stderr() + .stdout_is(unindent(ALPHA_OUT)); + // TODO: Handle errors? let _ = remove_file(file1); let _ = remove_file(file2); } @@ -85,22 +81,19 @@ fn test_no_file() { let tmpdir = Path::new(&temp); let file = tmpdir.join("}surely'none'would'thus'a'file'name"); - let result = new_ucmd!().arg(file.as_os_str()).run(); - - assert!(!result.success); + new_ucmd!().arg(file.as_os_str()).fails(); } // Test that od reads from stdin instead of a file #[test] fn test_from_stdin() { let input = "abcdefghijklmnopqrstuvwxyz\n"; - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, unindent(ALPHA_OUT)); + .run_piped_stdin(input.as_bytes()) + .success() + .no_stderr() + .stdout_is(unindent(ALPHA_OUT)); } // Test that od reads from stdin and also from files @@ -119,40 +112,35 @@ fn test_from_mixed() { } } - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg(file1.as_os_str()) .arg("-") .arg(file3.as_os_str()) - .run_piped_stdin(data2.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, unindent(ALPHA_OUT)); + .run_piped_stdin(data2.as_bytes()) + .success() + .no_stderr() + .stdout_is(unindent(ALPHA_OUT)); } #[test] fn test_multiple_formats() { let input = "abcdefghijklmnopqrstuvwxyz\n"; - let result = new_ucmd!() + new_ucmd!() .arg("-c") .arg("-b") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .run_piped_stdin(input.as_bytes()) + .success() + .no_stderr() + .stdout_is(unindent( " 0000000 a b c d e f g h i j k l m n o p 141 142 143 144 145 146 147 150 151 152 153 154 155 156 157 160 0000020 q r s t u v w x y z \\n 161 162 163 164 165 166 167 170 171 172 012 0000033 - " - ) - ); + ", + )); } #[test] @@ -166,14 +154,13 @@ fn test_dec() { 0000016 ", ); - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("-s") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .success() + .no_stderr() + .stdout_is(expected_output); } #[test] @@ -185,14 +172,13 @@ fn test_hex16() { 0000011 ", ); - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("-x") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .success() + .no_stderr() + .stdout_is(expected_output); } #[test] @@ -204,14 +190,13 @@ fn test_hex32() { 0000011 ", ); - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("-X") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .success() + .no_stderr() + .stdout_is(expected_output); } #[test] @@ -232,15 +217,14 @@ fn test_f16() { 0000016 ", ); - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("-tf2") .arg("-w8") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .success() + .no_stderr() + .stdout_is(expected_output); } #[test] @@ -261,14 +245,13 @@ fn test_f32() { 0000034 ", ); - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("-f") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .success() + .no_stderr() + .stdout_is(expected_output); } #[test] @@ -291,36 +274,31 @@ fn test_f64() { 0000050 ", ); - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("-F") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .success() + .no_stderr() + .stdout_is(expected_output); } #[test] fn test_multibyte() { - let result = new_ucmd!() + new_ucmd!() .arg("-c") .arg("-w12") - .run_piped_stdin("Universität Tübingen \u{1B000}".as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .run_piped_stdin("Universität Tübingen \u{1B000}".as_bytes()) + .success() + .no_stderr() + .stdout_is(unindent( " 0000000 U n i v e r s i t ä ** t 0000014 T ü ** b i n g e n \u{1B000} 0000030 ** ** ** 0000033 - " - ) - ); + ", + )); } #[test] @@ -334,11 +312,13 @@ fn test_width() { ", ); - let result = new_ucmd!().arg("-w4").arg("-v").run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + new_ucmd!() + .arg("-w4") + .arg("-v") + .run_piped_stdin(&input[..]) + .success() + .no_stderr() + .stdout_is(expected_output); } #[test] @@ -352,14 +332,13 @@ fn test_invalid_width() { ", ); - let result = new_ucmd!().arg("-w5").arg("-v").run_piped_stdin(&input[..]); - - assert_eq!( - result.stderr, - "od: warning: invalid width 5; using 2 instead\n" - ); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + new_ucmd!() + .arg("-w5") + .arg("-v") + .run_piped_stdin(&input[..]) + .success() + .stderr_is_bytes("od: warning: invalid width 5; using 2 instead\n".as_bytes()) + .stdout_is(expected_output); } #[test] @@ -373,14 +352,13 @@ fn test_zero_width() { ", ); - let result = new_ucmd!().arg("-w0").arg("-v").run_piped_stdin(&input[..]); - - assert_eq!( - result.stderr, - "od: warning: invalid width 0; using 2 instead\n" - ); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + new_ucmd!() + .arg("-w0") + .arg("-v") + .run_piped_stdin(&input[..]) + .success() + .stderr_is_bytes("od: warning: invalid width 0; using 2 instead\n".as_bytes()) + .stdout_is(expected_output); } #[test] @@ -392,11 +370,12 @@ fn test_width_without_value() { 0000050 "); - let result = new_ucmd!().arg("-w").run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + new_ucmd!() + .arg("-w") + .run_piped_stdin(&input[..]) + .success() + .no_stderr() + .stdout_is(expected_output); } #[test] @@ -421,15 +400,14 @@ fn test_suppress_duplicates() { ", ); - let result = new_ucmd!() + new_ucmd!() .arg("-w4") .arg("-O") .arg("-x") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(expected_output); } #[test] @@ -446,17 +424,16 @@ fn test_big_endian() { ", ); - let result = new_ucmd!() + new_ucmd!() .arg("--endian=big") .arg("-F") .arg("-f") .arg("-X") .arg("-x") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(expected_output); } #[test] @@ -474,16 +451,15 @@ fn test_alignment_Xxa() { ); // in this case the width of the -a (8-bit) determines the alignment for the other fields - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("-X") .arg("-x") .arg("-a") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(expected_output); } #[test] @@ -500,15 +476,14 @@ fn test_alignment_Fx() { ); // in this case the width of the -F (64-bit) determines the alignment for the other field - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("-F") .arg("-x") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(expected_output); } #[test] @@ -528,16 +503,15 @@ fn test_maxuint() { ", ); - let result = new_ucmd!() + new_ucmd!() .arg("--format=o8") .arg("-Oobtu8") .arg("-Dd") .arg("--format=u1") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(expected_output); } #[test] @@ -553,15 +527,14 @@ fn test_hex_offset() { ", ); - let result = new_ucmd!() + new_ucmd!() .arg("-Ax") .arg("-X") .arg("-X") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(expected_output); } #[test] @@ -577,15 +550,14 @@ fn test_dec_offset() { ", ); - let result = new_ucmd!() + new_ucmd!() .arg("-Ad") .arg("-X") .arg("-X") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(expected_output); } #[test] @@ -594,66 +566,57 @@ fn test_no_offset() { const LINE: &'static str = " 00000000 00000000 00000000 00000000\n"; let expected_output = [LINE, LINE, LINE, LINE].join(""); - let result = new_ucmd!() + new_ucmd!() .arg("-An") .arg("-X") .arg("-X") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(expected_output); } #[test] fn test_invalid_offset() { - let result = new_ucmd!().arg("-Ab").run(); - - assert!(!result.success); + new_ucmd!().arg("-Ab").fails(); } #[test] fn test_skip_bytes() { let input = "abcdefghijklmnopq"; - let result = new_ucmd!() + new_ucmd!() .arg("-c") .arg("--skip-bytes=5") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .run_piped_stdin(input.as_bytes()) + .no_stderr() + .success() + .stdout_is(unindent( " 0000005 f g h i j k l m n o p q 0000021 - " - ) - ); + ", + )); } #[test] fn test_skip_bytes_error() { let input = "12345"; - let result = new_ucmd!() + new_ucmd!() .arg("--skip-bytes=10") - .run_piped_stdin(input.as_bytes()); - - assert!(!result.success); + .run_piped_stdin(input.as_bytes()) + .failure(); } #[test] fn test_read_bytes() { let input = "abcdefghijklmnopqrstuvwxyz\n12345678"; - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("--read-bytes=27") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, unindent(ALPHA_OUT)); + .run_piped_stdin(input.as_bytes()) + .no_stderr() + .success() + .stdout_is(unindent(ALPHA_OUT)); } #[test] @@ -662,13 +625,12 @@ fn test_ascii_dump() { 0x00, 0x01, 0x0a, 0x0d, 0x10, 0x1f, 0x20, 0x61, 0x62, 0x63, 0x7d, 0x7e, 0x7f, 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0xff, ]; - let result = new_ucmd!().arg("-tx1zacz").run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + new_ucmd!() + .arg("-tx1zacz") + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(unindent( r" 0000000 00 01 0a 0d 10 1f 20 61 62 63 7d 7e 7f 80 90 a0 >...... abc}~....< nul soh nl cr dle us sp a b c } ~ del nul dle sp @@ -677,9 +639,8 @@ fn test_ascii_dump() { 0 @ P ` p del ** 300 320 340 360 377 >......< 0000026 - " - ) - ); + ", + )); } #[test] @@ -687,159 +648,136 @@ fn test_filename_parsing() { // files "a" and "x" both exists, but are no filenames in the commandline below // "-f" must be treated as a filename, it contains the text: minus lowercase f // so "-f" should not be interpreted as a formatting option. - let result = new_ucmd!() + new_ucmd!() .arg("--format") .arg("a") .arg("-A") .arg("x") .arg("--") .arg("-f") - .run(); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .succeeds() + .no_stderr() + .stdout_is(unindent( " 000000 m i n u s sp l o w e r c a s e sp 000010 f nl 000012 - " - ) - ); + ", + )); } #[test] fn test_stdin_offset() { let input = "abcdefghijklmnopq"; - let result = new_ucmd!() + new_ucmd!() .arg("-c") .arg("+5") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .run_piped_stdin(input.as_bytes()) + .no_stderr() + .success() + .stdout_is(unindent( " 0000005 f g h i j k l m n o p q 0000021 - " - ) - ); + ", + )); } #[test] fn test_file_offset() { - let result = new_ucmd!().arg("-c").arg("--").arg("-f").arg("10").run(); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + new_ucmd!() + .arg("-c") + .arg("--") + .arg("-f") + .arg("10") + .succeeds() + .no_stderr() + .stdout_is(unindent( r" 0000010 w e r c a s e f \n 0000022 - " - ) - ); + ", + )); } #[test] fn test_traditional() { // note gnu od does not align both lines let input = "abcdefghijklmnopq"; - let result = new_ucmd!() + new_ucmd!() .arg("--traditional") .arg("-a") .arg("-c") .arg("-") .arg("10") .arg("0") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .run_piped_stdin(input.as_bytes()) + .no_stderr() + .success() + .stdout_is(unindent( r" 0000010 (0000000) i j k l m n o p q i j k l m n o p q 0000021 (0000011) - " - ) - ); + ", + )); } #[test] fn test_traditional_with_skip_bytes_override() { // --skip-bytes is ignored in this case let input = "abcdefghijklmnop"; - let result = new_ucmd!() + new_ucmd!() .arg("--traditional") .arg("--skip-bytes=10") .arg("-c") .arg("0") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .run_piped_stdin(input.as_bytes()) + .no_stderr() + .success() + .stdout_is(unindent( r" 0000000 a b c d e f g h i j k l m n o p 0000020 - " - ) - ); + ", + )); } #[test] fn test_traditional_with_skip_bytes_non_override() { // no offset specified in the traditional way, so --skip-bytes is used let input = "abcdefghijklmnop"; - let result = new_ucmd!() + new_ucmd!() .arg("--traditional") .arg("--skip-bytes=10") .arg("-c") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .run_piped_stdin(input.as_bytes()) + .no_stderr() + .success() + .stdout_is(unindent( r" 0000012 k l m n o p 0000020 - " - ) - ); + ", + )); } #[test] fn test_traditional_error() { // file "0" exists - don't fail on that, but --traditional only accepts a single input - let result = new_ucmd!() + new_ucmd!() .arg("--traditional") .arg("0") .arg("0") .arg("0") .arg("0") - .run(); - - assert!(!result.success); + .fails(); } #[test] fn test_traditional_only_label() { let input = "abcdefghijklmnopqrstuvwxyz"; - let result = new_ucmd!() + new_ucmd!() .arg("-An") .arg("--traditional") .arg("-a") @@ -847,20 +785,16 @@ fn test_traditional_only_label() { .arg("-") .arg("10") .arg("0x10") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .run_piped_stdin(input.as_bytes()) + .no_stderr() + .success() + .stdout_is(unindent( r" (0000020) i j k l m n o p q r s t u v w x i j k l m n o p q r s t u v w x (0000040) y z y z (0000042) - " - ) - ); + ", + )); } From cf4970f083d13887c49625acbece22eb761c0181 Mon Sep 17 00:00:00 2001 From: Aleksandar Janicijevic Date: Thu, 1 Apr 2021 02:53:48 -0400 Subject: [PATCH 0226/1135] shred: Replaced eprintln with show_error (#1992) --- Cargo.lock | 6 +++--- src/uu/shred/src/shred.rs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 08a7bad43..e273f776c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2323,9 +2323,9 @@ dependencies = [ name = "uu_tac" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index b54d3db45..f9d8b9c73 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -329,8 +329,8 @@ this is the default for non-regular files", let mut errs: Vec = vec![]; if !matches.is_present(options::FILE) { - eprintln!("{}: Missing an argument", NAME); - eprintln!("For help, try '{} --help'", NAME); + show_error!("Missing an argument"); + show_error!("For help, try '{} --help'", NAME); return 0; } @@ -367,9 +367,9 @@ this is the default for non-regular files", let verbose = matches.is_present(options::VERBOSE); if !errs.is_empty() { - eprintln!("Invalid arguments supplied."); + show_error!("Invalid arguments supplied."); for message in errs { - eprintln!("{}", message); + show_error!("{}", message); } return 1; } From 2941dfd698d19095da56f73f7052a9790d39bd82 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 1 Apr 2021 22:50:13 +0200 Subject: [PATCH 0227/1135] ls: quoting style (#1989) --- src/uu/ls/src/ls.rs | 110 ++++++- src/uu/ls/src/quoting_style.rs | 542 +++++++++++++++++++++++++++++++++ tests/by-util/test_ls.rs | 87 ++++++ 3 files changed, 737 insertions(+), 2 deletions(-) create mode 100644 src/uu/ls/src/quoting_style.rs diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 80a7bf328..9633acf43 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -13,10 +13,12 @@ extern crate lazy_static; #[macro_use] extern crate uucore; +mod quoting_style; mod version_cmp; use clap::{App, Arg}; use number_prefix::NumberPrefix; +use quoting_style::{escape_name, QuotingStyle}; #[cfg(unix)] use std::collections::HashMap; use std::fs; @@ -104,6 +106,12 @@ pub mod options { pub static HUMAN_READABLE: &str = "human-readable"; pub static SI: &str = "si"; } + pub mod quoting { + pub static ESCAPE: &str = "escape"; + pub static LITERAL: &str = "literal"; + pub static C: &str = "quote-name"; + } + pub static QUOTING_STYLE: &str = "quoting-style"; pub mod indicator_style { pub static NONE: &str = "none"; @@ -193,6 +201,7 @@ struct Config { color: bool, long: LongFormat, width: Option, + quoting_style: QuotingStyle, indicator_style: IndicatorStyle, } @@ -359,6 +368,51 @@ impl Config { }) .or_else(|| termsize::get().map(|s| s.cols)); + let quoting_style = if let Some(style) = options.value_of(options::QUOTING_STYLE) { + match style { + "literal" => QuotingStyle::Literal, + "shell" => QuotingStyle::Shell { + escape: false, + always_quote: false, + }, + "shell-always" => QuotingStyle::Shell { + escape: false, + always_quote: true, + }, + "shell-escape" => QuotingStyle::Shell { + escape: true, + always_quote: false, + }, + "shell-escape-always" => QuotingStyle::Shell { + escape: true, + always_quote: true, + }, + "c" => QuotingStyle::C { + quotes: quoting_style::Quotes::Double, + }, + "escape" => QuotingStyle::C { + quotes: quoting_style::Quotes::None, + }, + _ => unreachable!("Should have been caught by Clap"), + } + } else if options.is_present(options::quoting::LITERAL) { + QuotingStyle::Literal + } else if options.is_present(options::quoting::ESCAPE) { + QuotingStyle::C { + quotes: quoting_style::Quotes::None, + } + } else if options.is_present(options::quoting::C) { + QuotingStyle::C { + quotes: quoting_style::Quotes::Double, + } + } else { + // TODO: use environment variable if available + QuotingStyle::Shell { + escape: true, + always_quote: false, + } + }; + let indicator_style = if let Some(field) = options.value_of(options::INDICATOR_STYLE) { match field { "none" => IndicatorStyle::None, @@ -402,6 +456,7 @@ impl Config { inode: options.is_present(options::INODE), long, width, + quoting_style, indicator_style, } } @@ -515,6 +570,57 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .multiple(true) ) + // Quoting style + .arg( + Arg::with_name(options::QUOTING_STYLE) + .long(options::QUOTING_STYLE) + .takes_value(true) + .help("Set quoting style.") + .possible_values(&["literal", "shell", "shell-always", "shell-escape", "shell-escape-always", "c", "escape"]) + .overrides_with_all(&[ + options::QUOTING_STYLE, + options::quoting::LITERAL, + options::quoting::ESCAPE, + options::quoting::C, + ]) + ) + .arg( + Arg::with_name(options::quoting::LITERAL) + .short("N") + .long(options::quoting::LITERAL) + .help("Use literal quoting style. Equivalent to `--quoting-style=literal`") + .overrides_with_all(&[ + options::QUOTING_STYLE, + options::quoting::LITERAL, + options::quoting::ESCAPE, + options::quoting::C, + ]) + ) + .arg( + Arg::with_name(options::quoting::ESCAPE) + .short("b") + .long(options::quoting::ESCAPE) + .help("Use escape quoting style. Equivalent to `--quoting-style=escape`") + .overrides_with_all(&[ + options::QUOTING_STYLE, + options::quoting::LITERAL, + options::quoting::ESCAPE, + options::quoting::C, + ]) + ) + .arg( + Arg::with_name(options::quoting::C) + .short("Q") + .long(options::quoting::C) + .help("Use C quoting style. Equivalent to `--quoting-style=c`") + .overrides_with_all(&[ + options::QUOTING_STYLE, + options::quoting::LITERAL, + options::quoting::ESCAPE, + options::quoting::C, + ]) + ) + // Time arguments .arg( Arg::with_name(options::TIME) @@ -1206,7 +1312,7 @@ fn display_file_name( metadata: &Metadata, config: &Config, ) -> Cell { - let mut name = get_file_name(path, strip); + let mut name = escape_name(get_file_name(path, strip), &config.quoting_style); let file_type = metadata.file_type(); match config.indicator_style { @@ -1273,7 +1379,7 @@ fn display_file_name( metadata: &Metadata, config: &Config, ) -> Cell { - let mut name = get_file_name(path, strip); + let mut name = escape_name(get_file_name(path, strip), &config.quoting_style); if config.format != Format::Long && config.inode { name = get_inode(metadata) + " " + &name; } diff --git a/src/uu/ls/src/quoting_style.rs b/src/uu/ls/src/quoting_style.rs new file mode 100644 index 000000000..74108094a --- /dev/null +++ b/src/uu/ls/src/quoting_style.rs @@ -0,0 +1,542 @@ +use std::char::from_digit; + +const SPECIAL_SHELL_CHARS: &str = "~`#$&*()\\|[]{};'\"<>?! "; + +pub(crate) enum QuotingStyle { + Shell { escape: bool, always_quote: bool }, + C { quotes: Quotes }, + Literal, +} + +#[derive(Clone, Copy)] +pub(crate) enum Quotes { + None, + Single, + Double, + // TODO: Locale +} + +// This implementation is heavily inspired by the std::char::EscapeDefault implementation +// in the Rust standard library. This custom implementation is needed because the +// characters \a, \b, \e, \f & \v are not recognized by Rust. +#[derive(Clone, Debug)] +struct EscapedChar { + state: EscapeState, +} + +#[derive(Clone, Debug)] +enum EscapeState { + Done, + Char(char), + Backslash(char), + ForceQuote(char), + Octal(EscapeOctal), +} + +#[derive(Clone, Debug)] +struct EscapeOctal { + c: char, + state: EscapeOctalState, + idx: usize, +} + +#[derive(Clone, Debug)] +enum EscapeOctalState { + Done, + Backslash, + Value, +} + +impl Iterator for EscapeOctal { + type Item = char; + + fn next(&mut self) -> Option { + match self.state { + EscapeOctalState::Done => None, + EscapeOctalState::Backslash => { + self.state = EscapeOctalState::Value; + Some('\\') + } + EscapeOctalState::Value => { + let octal_digit = ((self.c as u32) >> (self.idx * 3)) & 0o7; + if self.idx == 0 { + self.state = EscapeOctalState::Done; + } else { + self.idx -= 1; + } + Some(from_digit(octal_digit, 8).unwrap()) + } + } + } +} + +impl EscapeOctal { + fn from(c: char) -> EscapeOctal { + EscapeOctal { + c, + idx: 2, + state: EscapeOctalState::Backslash, + } + } +} + +impl EscapedChar { + fn new_c(c: char, quotes: Quotes) -> Self { + use EscapeState::*; + let init_state = match c { + '\x07' => Backslash('a'), + '\x08' => Backslash('b'), + '\t' => Backslash('t'), + '\n' => Backslash('n'), + '\x0B' => Backslash('v'), + '\x0C' => Backslash('f'), + '\r' => Backslash('r'), + '\\' => Backslash('\\'), + '\'' => match quotes { + Quotes::Single => Backslash('\''), + _ => Char('\''), + }, + '"' => match quotes { + Quotes::Double => Backslash('"'), + _ => Char('"'), + }, + ' ' => match quotes { + Quotes::None => Backslash(' '), + _ => Char(' '), + }, + _ if c.is_ascii_control() => Octal(EscapeOctal::from(c)), + _ => Char(c), + }; + Self { state: init_state } + } + + // fn new_shell(c: char, quotes: Quotes) -> Self { + // use EscapeState::*; + // let init_state = match c { + // // If the string is single quoted, the single quote should be escaped + // '\'' => match quotes { + // Quotes::Single => Backslash('\''), + // _ => Char('\''), + // }, + // // All control characters should be rendered as ?: + // _ if c.is_ascii_control() => Char('?'), + // // Special shell characters must be escaped: + // _ if SPECIAL_SHELL_CHARS.contains(c) => ForceQuote(c), + // _ => Char(c), + // }; + // Self { state: init_state } + // } + + fn new_shell(c: char, escape: bool, quotes: Quotes) -> Self { + use EscapeState::*; + let init_state = match c { + _ if !escape && c.is_control() => Char('?'), + '\x07' => Backslash('a'), + '\x08' => Backslash('b'), + '\t' => Backslash('t'), + '\n' => Backslash('n'), + '\x0B' => Backslash('v'), + '\x0C' => Backslash('f'), + '\r' => Backslash('r'), + '\\' => Backslash('\\'), + '\x00'..='\x1F' | '\x7F' => Octal(EscapeOctal::from(c)), + '\'' => match quotes { + Quotes::Single => Backslash('\''), + _ => Char('\''), + }, + _ if SPECIAL_SHELL_CHARS.contains(c) => ForceQuote(c), + _ => Char(c), + }; + Self { state: init_state } + } +} + +impl Iterator for EscapedChar { + type Item = char; + + fn next(&mut self) -> Option { + match self.state { + EscapeState::Backslash(c) => { + self.state = EscapeState::Char(c); + Some('\\') + } + EscapeState::Char(c) | EscapeState::ForceQuote(c) => { + self.state = EscapeState::Done; + Some(c) + } + EscapeState::Done => None, + EscapeState::Octal(ref mut iter) => iter.next(), + } + } +} + +fn shell_without_escape(name: String, quotes: Quotes) -> (String, bool) { + let mut must_quote = false; + let mut escaped_str = String::with_capacity(name.len()); + + for c in name.chars() { + let escaped = EscapedChar::new_shell(c, false, quotes); + match escaped.state { + EscapeState::Backslash('\'') => escaped_str.push_str("'\\''"), + EscapeState::ForceQuote(x) => { + must_quote = true; + escaped_str.push(x); + } + _ => { + for char in escaped { + escaped_str.push(char); + } + } + } + } + (escaped_str, must_quote) +} + +fn shell_with_escape(name: String, quotes: Quotes) -> (String, bool) { + // We need to keep track of whether we are in a dollar expression + // because e.g. \b\n is escaped as $'\b\n' and not like $'b'$'n' + let mut in_dollar = false; + let mut must_quote = false; + let mut escaped_str = String::with_capacity(name.len()); + + for c in name.chars() { + let escaped = EscapedChar::new_shell(c, true, quotes); + match escaped.state { + EscapeState::Char(x) => { + if in_dollar { + escaped_str.push_str("''"); + in_dollar = false; + } + escaped_str.push(x); + } + EscapeState::ForceQuote(x) => { + if in_dollar { + escaped_str.push_str("''"); + in_dollar = false; + } + must_quote = true; + escaped_str.push(x); + } + // Single quotes are not put in dollar expressions, but are escaped + // if the string also contains double quotes. In that case, they must + // be handled separately. + EscapeState::Backslash('\'') => { + must_quote = true; + in_dollar = false; + escaped_str.push_str("'\\''"); + } + _ => { + if !in_dollar { + escaped_str.push_str("'$'"); + in_dollar = true; + } + must_quote = true; + for char in escaped { + escaped_str.push(char); + } + } + } + } + (escaped_str, must_quote) +} + +pub(super) fn escape_name(name: String, style: &QuotingStyle) -> String { + match style { + QuotingStyle::Literal => name, + QuotingStyle::C { quotes } => { + let escaped_str: String = name + .chars() + .flat_map(|c| EscapedChar::new_c(c, *quotes)) + .collect(); + + match quotes { + Quotes::Single => format!("'{}'", escaped_str), + Quotes::Double => format!("\"{}\"", escaped_str), + _ => escaped_str, + } + } + QuotingStyle::Shell { + escape, + always_quote, + } => { + let (quotes, must_quote) = if name.contains('"') { + (Quotes::Single, true) + } else if name.contains('\'') { + (Quotes::Double, true) + } else if *always_quote { + (Quotes::Single, true) + } else { + (Quotes::Single, false) + }; + + let (escaped_str, contains_quote_chars) = if *escape { + shell_with_escape(name, quotes) + } else { + shell_without_escape(name, quotes) + }; + + match (must_quote | contains_quote_chars, quotes) { + (true, Quotes::Single) => format!("'{}'", escaped_str), + (true, Quotes::Double) => format!("\"{}\"", escaped_str), + _ => escaped_str, + } + } + } +} + +#[cfg(test)] +mod tests { + use crate::quoting_style::{escape_name, Quotes, QuotingStyle}; + fn get_style(s: &str) -> QuotingStyle { + match s { + "literal" => QuotingStyle::Literal, + "escape" => QuotingStyle::C { + quotes: Quotes::None, + }, + "c" => QuotingStyle::C { + quotes: Quotes::Double, + }, + "shell" => QuotingStyle::Shell { + escape: false, + always_quote: false, + }, + "shell-always" => QuotingStyle::Shell { + escape: false, + always_quote: true, + }, + "shell-escape" => QuotingStyle::Shell { + escape: true, + always_quote: false, + }, + "shell-escape-always" => QuotingStyle::Shell { + escape: true, + always_quote: true, + }, + _ => panic!("Invalid name!"), + } + } + + fn check_names(name: &str, map: Vec<(&str, &str)>) { + assert_eq!( + map.iter() + .map(|(_, style)| escape_name(name.to_string(), &get_style(style))) + .collect::>(), + map.iter() + .map(|(correct, _)| correct.to_string()) + .collect::>() + ); + } + + #[test] + fn test_simple_names() { + check_names( + "one_two", + vec![ + ("one_two", "literal"), + ("one_two", "escape"), + ("\"one_two\"", "c"), + ("one_two", "shell"), + ("\'one_two\'", "shell-always"), + ("one_two", "shell-escape"), + ("\'one_two\'", "shell-escape-always"), + ], + ); + } + + #[test] + fn test_spaces() { + check_names( + "one two", + vec![ + ("one two", "literal"), + ("one\\ two", "escape"), + ("\"one two\"", "c"), + ("\'one two\'", "shell"), + ("\'one two\'", "shell-always"), + ("\'one two\'", "shell-escape"), + ("\'one two\'", "shell-escape-always"), + ], + ); + + check_names( + " one", + vec![ + (" one", "literal"), + ("\\ one", "escape"), + ("\" one\"", "c"), + ("' one'", "shell"), + ("' one'", "shell-always"), + ("' one'", "shell-escape"), + ("' one'", "shell-escape-always"), + ], + ); + } + + #[test] + fn test_quotes() { + // One double quote + check_names( + "one\"two", + vec![ + ("one\"two", "literal"), + ("one\"two", "escape"), + ("\"one\\\"two\"", "c"), + ("'one\"two'", "shell"), + ("'one\"two'", "shell-always"), + ("'one\"two'", "shell-escape"), + ("'one\"two'", "shell-escape-always"), + ], + ); + + // One single quote + check_names( + "one\'two", + vec![ + ("one'two", "literal"), + ("one'two", "escape"), + ("\"one'two\"", "c"), + ("\"one'two\"", "shell"), + ("\"one'two\"", "shell-always"), + ("\"one'two\"", "shell-escape"), + ("\"one'two\"", "shell-escape-always"), + ], + ); + + // One single quote and one double quote + check_names( + "one'two\"three", + vec![ + ("one'two\"three", "literal"), + ("one'two\"three", "escape"), + ("\"one'two\\\"three\"", "c"), + ("'one'\\''two\"three'", "shell"), + ("'one'\\''two\"three'", "shell-always"), + ("'one'\\''two\"three'", "shell-escape"), + ("'one'\\''two\"three'", "shell-escape-always"), + ], + ); + + // Consecutive quotes + check_names( + "one''two\"\"three", + vec![ + ("one''two\"\"three", "literal"), + ("one''two\"\"three", "escape"), + ("\"one''two\\\"\\\"three\"", "c"), + ("'one'\\'''\\''two\"\"three'", "shell"), + ("'one'\\'''\\''two\"\"three'", "shell-always"), + ("'one'\\'''\\''two\"\"three'", "shell-escape"), + ("'one'\\'''\\''two\"\"three'", "shell-escape-always"), + ], + ); + } + + #[test] + fn test_control_chars() { + // A simple newline + check_names( + "one\ntwo", + vec![ + ("one\ntwo", "literal"), + ("one\\ntwo", "escape"), + ("\"one\\ntwo\"", "c"), + ("one?two", "shell"), + ("'one?two'", "shell-always"), + ("'one'$'\\n''two'", "shell-escape"), + ("'one'$'\\n''two'", "shell-escape-always"), + ], + ); + + // The first 16 control characters. NUL is also included, even though it is of + // no importance for file names. + check_names( + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F", + vec![ + ( + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F", + "literal", + ), + ( + "\\000\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017", + "escape", + ), + ( + "\"\\000\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017\"", + "c", + ), + ("????????????????", "shell"), + ("'????????????????'", "shell-always"), + ( + "''$'\\000\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017'", + "shell-escape", + ), + ( + "''$'\\000\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017'", + "shell-escape-always", + ), + ], + ); + + // The last 16 control characters. + check_names( + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", + vec![ + ( + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", + "literal", + ), + ( + "\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\033\\034\\035\\036\\037", + "escape", + ), + ( + "\"\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\033\\034\\035\\036\\037\"", + "c", + ), + ("????????????????", "shell"), + ("'????????????????'", "shell-always"), + ( + "''$'\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\033\\034\\035\\036\\037'", + "shell-escape", + ), + ( + "''$'\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\033\\034\\035\\036\\037'", + "shell-escape-always", + ), + ], + ); + + // DEL + check_names( + "\x7F", + vec![ + ("\x7F", "literal"), + ("\\177", "escape"), + ("\"\\177\"", "c"), + ("?", "shell"), + ("'?'", "shell-always"), + ("''$'\\177'", "shell-escape"), + ("''$'\\177'", "shell-escape-always"), + ], + ); + } + + #[test] + fn test_question_mark() { + // A question mark must force quotes in shell and shell-always, unless + // it is in place of a control character (that case is already covered + // in other tests) + check_names( + "one?two", + vec![ + ("one?two", "literal"), + ("one?two", "escape"), + ("\"one?two\"", "c"), + ("'one?two'", "shell"), + ("'one?two'", "shell-always"), + ("'one?two'", "shell-escape"), + ("'one?two'", "shell-escape-always"), + ], + ); + } +} diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 638102cc7..d403e5577 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -765,6 +765,8 @@ fn test_ls_ls_color() { .arg("--color=always") .arg("a/nested_file") .succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); assert!(result.stdout.contains("a/nested_file\n")); // No output @@ -1122,3 +1124,88 @@ fn test_ls_version_sort() { expected.insert(0, "."); assert_eq!(result.stdout.split('\n').collect::>(), expected,) } + +#[test] +fn test_ls_quoting_style() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.touch("one two"); + at.touch("one"); + + // It seems that windows doesn't allow \n in filenames. + #[cfg(unix)] + { + at.touch("one\ntwo"); + // Default is shell-escape + let result = scene.ucmd().arg("one\ntwo").succeeds(); + assert_eq!(result.stdout, "'one'$'\\n''two'\n"); + + for (arg, correct) in &[ + ("--quoting-style=literal", "one\ntwo"), + ("-N", "one\ntwo"), + ("--literal", "one\ntwo"), + ("--quoting-style=c", "\"one\\ntwo\""), + ("-Q", "\"one\\ntwo\""), + ("--quote-name", "\"one\\ntwo\""), + ("--quoting-style=escape", "one\\ntwo"), + ("-b", "one\\ntwo"), + ("--escape", "one\\ntwo"), + ("--quoting-style=shell-escape", "'one'$'\\n''two'"), + ("--quoting-style=shell-escape-always", "'one'$'\\n''two'"), + ("--quoting-style=shell", "one?two"), + ("--quoting-style=shell-always", "'one?two'"), + ] { + let result = scene.ucmd().arg(arg).arg("one\ntwo").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!(result.stdout, format!("{}\n", correct)); + } + } + + let result = scene.ucmd().arg("one two").succeeds(); + assert_eq!(result.stdout, "'one two'\n"); + + for (arg, correct) in &[ + ("--quoting-style=literal", "one two"), + ("-N", "one two"), + ("--literal", "one two"), + ("--quoting-style=c", "\"one two\""), + ("-Q", "\"one two\""), + ("--quote-name", "\"one two\""), + ("--quoting-style=escape", "one\\ two"), + ("-b", "one\\ two"), + ("--escape", "one\\ two"), + ("--quoting-style=shell-escape", "'one two'"), + ("--quoting-style=shell-escape-always", "'one two'"), + ("--quoting-style=shell", "'one two'"), + ("--quoting-style=shell-always", "'one two'"), + ] { + let result = scene.ucmd().arg(arg).arg("one two").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!(result.stdout, format!("{}\n", correct)); + } + + let result = scene.ucmd().arg("one").succeeds(); + assert_eq!(result.stdout, "one\n"); + + for (arg, correct) in &[ + ("--quoting-style=literal", "one"), + ("-N", "one"), + ("--quoting-style=c", "\"one\""), + ("-Q", "\"one\""), + ("--quote-name", "\"one\""), + ("--quoting-style=escape", "one"), + ("-b", "one"), + ("--quoting-style=shell-escape", "one"), + ("--quoting-style=shell-escape-always", "'one'"), + ("--quoting-style=shell", "one"), + ("--quoting-style=shell-always", "'one'"), + ] { + let result = scene.ucmd().arg(arg).arg("one").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!(result.stdout, format!("{}\n", correct)); + } +} From 7a947cfe46b694f61a5a7d840d622ce292da457c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81rni=20Dagur?= Date: Thu, 1 Apr 2021 21:08:48 +0000 Subject: [PATCH 0228/1135] cat: Improve performance on Linux (#1978) * cat: Improve performance, especially on Linux * cat: Don't use io::copy for splice fallback On my MacBook Pro 2020, it is around 25% faster to not use io::copy. * cat: Only fall back to generic copy if first splice fails * cat: Don't double buffer stdout * cat: Don't use experimental or-pattern syntax * cat: Remove nix symbol use from non-Linux --- Cargo.lock | 5 +- src/uu/cat/Cargo.toml | 5 +- src/uu/cat/src/cat.rs | 420 +++++++++++++++++++++++++----------------- 3 files changed, 255 insertions(+), 175 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e273f776c..f7e1187b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "advapi32-sys" version = "0.2.0" @@ -1581,7 +1583,8 @@ name = "uu_cat" version = "0.0.4" dependencies = [ "clap", - "quick-error", + "nix 0.20.0", + "thiserror", "unix_socket", "uucore", "uucore_procs", diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index b6254cf6b..3878aee96 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -16,13 +16,16 @@ path = "src/cat.rs" [dependencies] clap = "2.33" -quick-error = "1.2.3" +thiserror = "1.0" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] unix_socket = "0.5.0" +[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies] +nix = "0.20" + [[bin]] name = "cat" path = "src/main.rs" diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index cf5a384a4..f39708fd8 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -3,14 +3,13 @@ // (c) Jordi Boggiano // (c) Evgeniy Klyuchikov // (c) Joshua S. Miller +// (c) Árni Dagur // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. // spell-checker:ignore (ToDO) nonprint nonblank nonprinting -#[macro_use] -extern crate quick_error; #[cfg(unix)] extern crate unix_socket; #[macro_use] @@ -18,9 +17,9 @@ extern crate uucore; // last synced with: cat (GNU coreutils) 8.13 use clap::{App, Arg}; -use quick_error::ResultExt; use std::fs::{metadata, File}; -use std::io::{self, stderr, stdin, stdout, BufWriter, Read, Write}; +use std::io::{self, Read, Write}; +use thiserror::Error; use uucore::fs::is_stdin_interactive; /// Unix domain socket support @@ -31,12 +30,44 @@ use std::os::unix::fs::FileTypeExt; #[cfg(unix)] use unix_socket::UnixStream; +#[cfg(any(target_os = "linux", target_os = "android"))] +use nix::errno::Errno; +/// Linux splice support +#[cfg(any(target_os = "linux", target_os = "android"))] +use nix::fcntl::{splice, SpliceFFlags}; +#[cfg(any(target_os = "linux", target_os = "android"))] +use nix::unistd::pipe; +#[cfg(any(target_os = "linux", target_os = "android"))] +use std::os::unix::io::{AsRawFd, RawFd}; + static NAME: &str = "cat"; static VERSION: &str = env!("CARGO_PKG_VERSION"); static SYNTAX: &str = "[OPTION]... [FILE]..."; static SUMMARY: &str = "Concatenate FILE(s), or standard input, to standard output With no FILE, or when FILE is -, read standard input."; +#[derive(Error, Debug)] +enum CatError { + /// Wrapper around `io::Error` + #[error("{0}")] + Io(#[from] io::Error), + /// Wrapper around `nix::Error` + #[cfg(any(target_os = "linux", target_os = "android"))] + #[error("{0}")] + Nix(#[from] nix::Error), + /// Unknown file type; it's not a regular file, socket, etc. + #[error("{}: unknown filetype: {}", path, ft_debug)] + UnknownFiletype { + path: String, + /// A debug print of the file type + ft_debug: String, + }, + #[error("{0}: Expected a file, found directory")] + IsDirectory(String), +} + +type CatResult = Result; + #[derive(PartialEq)] enum NumberingMode { None, @@ -44,39 +75,6 @@ enum NumberingMode { All, } -quick_error! { - #[derive(Debug)] - enum CatError { - /// Wrapper for io::Error with path context - Input(err: io::Error, path: String) { - display("cat: {0}: {1}", path, err) - context(path: &'a str, err: io::Error) -> (err, path.to_owned()) - cause(err) - } - - /// Wrapper for io::Error with no context - Output(err: io::Error) { - display("cat: {0}", err) from() - cause(err) - } - - /// Unknown Filetype classification - UnknownFiletype(path: String) { - display("cat: {0}: unknown filetype", path) - } - - /// At least one error was encountered in reading or writing - EncounteredErrors(count: usize) { - display("cat: encountered {0} errors", count) - } - - /// Denotes an error caused by trying to `cat` a directory - IsDirectory(path: String) { - display("cat: {0}: Is a directory", path) - } - } -} - struct OutputOptions { /// Line numbering mode number: NumberingMode, @@ -87,21 +85,56 @@ struct OutputOptions { /// display TAB characters as `tab` show_tabs: bool, - /// If `show_tabs == true`, this string will be printed in the - /// place of tabs - tab: String, - - /// Can be set to show characters other than '\n' a the end of - /// each line, e.g. $ - end_of_line: String, + /// Show end of lines + show_ends: bool, /// use ^ and M- notation, except for LF (\\n) and TAB (\\t) show_nonprint: bool, } +impl OutputOptions { + fn tab(&self) -> &'static str { + if self.show_tabs { + "^I" + } else { + "\t" + } + } + + fn end_of_line(&self) -> &'static str { + if self.show_ends { + "$\n" + } else { + "\n" + } + } + + /// We can write fast if we can simply copy the contents of the file to + /// stdout, without augmenting the output with e.g. line numbers. + fn can_write_fast(&self) -> bool { + !(self.show_tabs + || self.show_nonprint + || self.show_ends + || self.squeeze_blank + || self.number != NumberingMode::None) + } +} + +/// State that persists between output of each file. This struct is only used +/// when we can't write fast. +struct OutputState { + /// The current line number + line_number: usize, + + /// Whether the output cursor is at the beginning of a new line + at_line_start: bool, +} + /// Represents an open file handle, stream, or other device -struct InputHandle { - reader: Box, +struct InputHandle { + #[cfg(any(target_os = "linux", target_os = "android"))] + file_descriptor: RawFd, + reader: R, is_interactive: bool, } @@ -124,8 +157,6 @@ enum InputType { Socket, } -type CatResult = Result; - mod options { pub static FILE: &str = "file"; pub static SHOW_ALL: &str = "show-all"; @@ -243,30 +274,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { None => vec!["-".to_owned()], }; - let can_write_fast = !(show_tabs - || show_nonprint - || show_ends - || squeeze_blank - || number_mode != NumberingMode::None); - - let success = if can_write_fast { - write_fast(files).is_ok() - } else { - let tab = if show_tabs { "^I" } else { "\t" }.to_owned(); - - let end_of_line = if show_ends { "$\n" } else { "\n" }.to_owned(); - - let options = OutputOptions { - end_of_line, - number: number_mode, - show_nonprint, - show_tabs, - squeeze_blank, - tab, - }; - - write_lines(files, &options).is_ok() + let options = OutputOptions { + show_ends, + number: number_mode, + show_nonprint, + show_tabs, + squeeze_blank, }; + let success = cat_files(files, &options).is_ok(); if success { 0 @@ -275,6 +290,76 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } +fn cat_handle( + handle: &mut InputHandle, + options: &OutputOptions, + state: &mut OutputState, +) -> CatResult<()> { + if options.can_write_fast() { + write_fast(handle) + } else { + write_lines(handle, &options, state) + } +} + +fn cat_path(path: &str, options: &OutputOptions, state: &mut OutputState) -> CatResult<()> { + if path == "-" { + let stdin = io::stdin(); + let mut handle = InputHandle { + #[cfg(any(target_os = "linux", target_os = "android"))] + file_descriptor: stdin.as_raw_fd(), + reader: stdin, + is_interactive: is_stdin_interactive(), + }; + return cat_handle(&mut handle, &options, state); + } + match get_input_type(path)? { + InputType::Directory => Err(CatError::IsDirectory(path.to_owned())), + #[cfg(unix)] + InputType::Socket => { + let socket = UnixStream::connect(path)?; + socket.shutdown(Shutdown::Write)?; + let mut handle = InputHandle { + #[cfg(any(target_os = "linux", target_os = "android"))] + file_descriptor: socket.as_raw_fd(), + reader: socket, + is_interactive: false, + }; + cat_handle(&mut handle, &options, state) + } + _ => { + let file = File::open(path)?; + let mut handle = InputHandle { + #[cfg(any(target_os = "linux", target_os = "android"))] + file_descriptor: file.as_raw_fd(), + reader: file, + is_interactive: false, + }; + cat_handle(&mut handle, &options, state) + } + } +} + +fn cat_files(files: Vec, options: &OutputOptions) -> Result<(), u32> { + let mut error_count = 0; + let mut state = OutputState { + line_number: 1, + at_line_start: true, + }; + + for path in &files { + if let Err(err) = cat_path(path, &options, &mut state) { + show_error!("{}", err); + error_count += 1; + } + } + if error_count == 0 { + Ok(()) + } else { + Err(error_count) + } +} + /// Classifies the `InputType` of file at `path` if possible /// /// # Arguments @@ -285,7 +370,8 @@ fn get_input_type(path: &str) -> CatResult { return Ok(InputType::StdIn); } - match metadata(path).context(path)?.file_type() { + let ft = metadata(path)?.file_type(); + match ft { #[cfg(unix)] ft if ft.is_block_device() => Ok(InputType::BlockDevice), #[cfg(unix)] @@ -297,125 +383,113 @@ fn get_input_type(path: &str) -> CatResult { ft if ft.is_dir() => Ok(InputType::Directory), ft if ft.is_file() => Ok(InputType::File), ft if ft.is_symlink() => Ok(InputType::SymLink), - _ => Err(CatError::UnknownFiletype(path.to_owned())), + _ => Err(CatError::UnknownFiletype { + path: path.to_owned(), + ft_debug: format!("{:?}", ft), + }), } } -/// Returns an InputHandle from which a Reader can be accessed or an -/// error -/// -/// # Arguments -/// -/// * `path` - `InputHandler` will wrap a reader from this file path -fn open(path: &str) -> CatResult { - if path == "-" { - let stdin = stdin(); - return Ok(InputHandle { - reader: Box::new(stdin) as Box, - is_interactive: is_stdin_interactive(), - }); - } - - match get_input_type(path)? { - InputType::Directory => Err(CatError::IsDirectory(path.to_owned())), - #[cfg(unix)] - InputType::Socket => { - let socket = UnixStream::connect(path).context(path)?; - socket.shutdown(Shutdown::Write).context(path)?; - Ok(InputHandle { - reader: Box::new(socket) as Box, - is_interactive: false, - }) - } - _ => { - let file = File::open(path).context(path)?; - Ok(InputHandle { - reader: Box::new(file) as Box, - is_interactive: false, - }) +/// Writes handle to stdout with no configuration. This allows a +/// simple memory copy. +fn write_fast(handle: &mut InputHandle) -> CatResult<()> { + let stdout = io::stdout(); + let mut stdout_lock = stdout.lock(); + #[cfg(any(target_os = "linux", target_os = "android"))] + { + // If we're on Linux or Android, try to use the splice() system call + // for faster writing. If it works, we're done. + if !write_fast_using_splice(handle, stdout.as_raw_fd())? { + return Ok(()); } } + // If we're not on Linux or Android, or the splice() call failed, + // fall back on slower writing. + let mut buf = [0; 1024 * 64]; + while let Ok(n) = handle.reader.read(&mut buf) { + if n == 0 { + break; + } + stdout_lock.write_all(&buf[..n])?; + } + Ok(()) } -/// Writes files to stdout with no configuration. This allows a -/// simple memory copy. Returns `Ok(())` if no errors were -/// encountered, or an error with the number of errors encountered. +/// This function is called from `write_fast()` on Linux and Android. The +/// function `splice()` is used to move data between two file descriptors +/// without copying between kernel- and userspace. This results in a large +/// speedup. /// -/// # Arguments -/// -/// * `files` - There is no short circuit when encountering an error -/// reading a file in this vector -fn write_fast(files: Vec) -> CatResult<()> { - let mut writer = stdout(); - let mut in_buf = [0; 1024 * 64]; - let mut error_count = 0; +/// The `bool` in the result value indicates if we need to fall back to normal +/// copying or not. False means we don't have to. +#[cfg(any(target_os = "linux", target_os = "android"))] +#[inline] +fn write_fast_using_splice(handle: &mut InputHandle, writer: RawFd) -> CatResult { + const BUF_SIZE: usize = 1024 * 16; - for file in files { - match open(&file[..]) { - Ok(mut handle) => { - while let Ok(n) = handle.reader.read(&mut in_buf) { - if n == 0 { - break; - } - writer.write_all(&in_buf[..n]).context(&file[..])?; + let (pipe_rd, pipe_wr) = pipe()?; + + // We only fall back if splice fails on the first call. + match splice( + handle.file_descriptor, + None, + pipe_wr, + None, + BUF_SIZE, + SpliceFFlags::empty(), + ) { + Ok(n) => { + if n == 0 { + return Ok(false); + } + } + Err(err) => { + match err.as_errno() { + Some(Errno::EPERM) | Some(Errno::ENOSYS) | Some(Errno::EINVAL) => { + // EPERM indicates the call was blocked by seccomp. + // ENOSYS indicates we're running on an ancient Kernel. + // EINVAL indicates some other failure. + return Ok(true); + } + _ => { + // Other errors include running out of memory, etc. We + // don't attempt to fall back from these. + return Err(err)?; } } - Err(error) => { - writeln!(&mut stderr(), "{}", error)?; - error_count += 1; - } } } - match error_count { - 0 => Ok(()), - _ => Err(CatError::EncounteredErrors(error_count)), - } -} - -/// State that persists between output of each file -struct OutputState { - /// The current line number - line_number: usize, - - /// Whether the output cursor is at the beginning of a new line - at_line_start: bool, -} - -/// Writes files to stdout with `options` as configuration. Returns -/// `Ok(())` if no errors were encountered, or an error with the -/// number of errors encountered. -/// -/// # Arguments -/// -/// * `files` - There is no short circuit when encountering an error -/// reading a file in this vector -fn write_lines(files: Vec, options: &OutputOptions) -> CatResult<()> { - let mut error_count = 0; - let mut state = OutputState { - line_number: 1, - at_line_start: true, - }; - - for file in files { - if let Err(error) = write_file_lines(&file, options, &mut state) { - writeln!(&mut stderr(), "{}", error).context(&file[..])?; - error_count += 1; + loop { + let n = splice( + handle.file_descriptor, + None, + pipe_wr, + None, + BUF_SIZE, + SpliceFFlags::empty(), + )?; + if n == 0 { + // We read 0 bytes from the input, + // which means we're done copying. + break; } + splice(pipe_rd, None, writer, None, BUF_SIZE, SpliceFFlags::empty())?; } - match error_count { - 0 => Ok(()), - _ => Err(CatError::EncounteredErrors(error_count)), - } + Ok(false) } /// Outputs file contents to stdout in a line-by-line fashion, /// propagating any errors that might occur. -fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState) -> CatResult<()> { - let mut handle = open(file)?; +fn write_lines( + handle: &mut InputHandle, + options: &OutputOptions, + state: &mut OutputState, +) -> CatResult<()> { let mut in_buf = [0; 1024 * 31]; - let mut writer = BufWriter::with_capacity(1024 * 64, stdout()); + let stdout = io::stdout(); + let mut writer = stdout.lock(); let mut one_blank_kept = false; while let Ok(n) = handle.reader.read(&mut in_buf) { @@ -433,9 +507,9 @@ fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState write!(&mut writer, "{0:6}\t", state.line_number)?; state.line_number += 1; } - writer.write_all(options.end_of_line.as_bytes())?; + writer.write_all(options.end_of_line().as_bytes())?; if handle.is_interactive { - writer.flush().context(file)?; + writer.flush()?; } } state.at_line_start = true; @@ -450,7 +524,7 @@ fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState // print to end of line or end of buffer let offset = if options.show_nonprint { - write_nonprint_to_end(&in_buf[pos..], &mut writer, options.tab.as_bytes()) + write_nonprint_to_end(&in_buf[pos..], &mut writer, options.tab().as_bytes()) } else if options.show_tabs { write_tab_to_end(&in_buf[pos..], &mut writer) } else { @@ -462,7 +536,7 @@ fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState break; } // print suitable end of line - writer.write_all(options.end_of_line.as_bytes())?; + writer.write_all(options.end_of_line().as_bytes())?; if handle.is_interactive { writer.flush()?; } From 090d29496a016c81d437ecb61fa8e401c51d7856 Mon Sep 17 00:00:00 2001 From: paulotten Date: Thu, 1 Apr 2021 17:16:47 -0400 Subject: [PATCH 0229/1135] Issue #1622 port `du` to windows (#1788) * Issue #1622 port `du` to windows * Attempt to support Rust 1.32 Old version was getting "attributes are not yet allowed on `if` expressions" on Rust 1.32 * Less #[cfg] * Less duplicate code. I need the return and the semicolon after if otherwise the second #[cfg] leads to unexpected token complilation error * More accurate size on disk calculations for windows * Expect the same output on windows as with WSL * Better matches output from du on WSL * In the absence of feedback I'm disabling these tests on Windows. They require `ln`. Windows does not ship with this utility. * Use the coreutils version of `ln` to test `du` `fn ccmd` is courtesy of @Artoria2e5 * Look up inodes (file ids) on Windows * One more #[cfg(windows)] to prevent unreachable statement warning on linux --- Cargo.lock | 1 + Cargo.toml | 2 +- src/uu/du/Cargo.toml | 1 + src/uu/du/src/du.rs | 121 ++++++++++++++++++++++++++++++++++++--- tests/by-util/test_du.rs | 28 +++++++-- tests/common/util.rs | 8 +++ 6 files changed, 146 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f7e1187b4..95635159c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1735,6 +1735,7 @@ dependencies = [ "time", "uucore", "uucore_procs", + "winapi 0.3.9", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 9136b5d64..1562fcfb0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,6 +43,7 @@ feat_common_core = [ "df", "dircolors", "dirname", + "du", "echo", "env", "expand", @@ -149,7 +150,6 @@ feat_require_unix = [ "chmod", "chown", "chroot", - "du", "groups", "hostid", "id", diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index 912eef17e..bb46c299c 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -18,6 +18,7 @@ path = "src/du.rs" time = "0.1.40" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +winapi = { version="0.3", features=[] } [[bin]] name = "du" diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 4ed80f18b..2eb7bd658 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -15,9 +15,24 @@ use std::env; use std::fs; use std::io::{stderr, Result, Write}; use std::iter; +#[cfg(not(windows))] use std::os::unix::fs::MetadataExt; +#[cfg(windows)] +use std::os::windows::fs::MetadataExt; +#[cfg(windows)] +use std::os::windows::io::AsRawHandle; use std::path::PathBuf; use time::Timespec; +#[cfg(windows)] +use winapi::shared::minwindef::{DWORD, LPVOID}; +#[cfg(windows)] +use winapi::um::fileapi::{FILE_STANDARD_INFO, FILE_ID_INFO}; +#[cfg(windows)] +use winapi::um::minwinbase::{FileStandardInfo, FileIdInfo}; +#[cfg(windows)] +use winapi::um::winbase::GetFileInformationByHandleEx; +#[cfg(windows)] +use winapi::um::winnt::FILE_ID_128; const NAME: &str = "du"; const SUMMARY: &str = "estimate file space usage"; @@ -48,7 +63,7 @@ struct Stat { is_dir: bool, size: u64, blocks: u64, - inode: u64, + inode: Option, created: u64, accessed: u64, modified: u64, @@ -57,19 +72,106 @@ struct Stat { impl Stat { fn new(path: PathBuf) -> Result { let metadata = fs::symlink_metadata(&path)?; - Ok(Stat { + + #[cfg(not(windows))] + return Ok(Stat { path, is_dir: metadata.is_dir(), size: metadata.len(), blocks: metadata.blocks() as u64, - inode: metadata.ino() as u64, + inode: Some(metadata.ino() as u128), created: metadata.mtime() as u64, accessed: metadata.atime() as u64, modified: metadata.mtime() as u64, + }); + + #[cfg(windows)] + let size_on_disk = get_size_on_disk(&path); + #[cfg(windows)] + let inode = get_inode(&path); + #[cfg(windows)] + Ok(Stat { + path, + is_dir: metadata.is_dir(), + size: metadata.len(), + blocks: size_on_disk / 1024 * 2, + inode: inode, + created: windows_time_to_unix_time(metadata.creation_time()), + accessed: windows_time_to_unix_time(metadata.last_access_time()), + modified: windows_time_to_unix_time(metadata.last_write_time()), }) } } +#[cfg(windows)] +// https://doc.rust-lang.org/std/os/windows/fs/trait.MetadataExt.html#tymethod.creation_time +// "The returned 64-bit value [...] which represents the number of 100-nanosecond intervals since January 1, 1601 (UTC)." +fn windows_time_to_unix_time(win_time: u64) -> u64 { + win_time / 10_000 - 11_644_473_600_000 +} + +#[cfg(windows)] +fn get_size_on_disk(path: &PathBuf) -> u64 { + let mut size_on_disk = 0; + + // bind file so it stays in scope until end of function + // if it goes out of scope the handle below becomes invalid + let file = match fs::File::open(path) { + Ok(file) => file, + Err(_) => return size_on_disk, // opening directories will fail + }; + + let handle = file.as_raw_handle(); + + unsafe { + let mut file_info: FILE_STANDARD_INFO = core::mem::zeroed(); + let file_info_ptr: *mut FILE_STANDARD_INFO = &mut file_info; + + let success = GetFileInformationByHandleEx( + handle, + FileStandardInfo, + file_info_ptr as LPVOID, + std::mem::size_of::() as DWORD, + ); + + if success != 0 { + size_on_disk = *file_info.AllocationSize.QuadPart() as u64; + } + } + + size_on_disk +} + +#[cfg(windows)] +fn get_inode(path: &PathBuf) -> Option { + let mut inode = None; + + let file = match fs::File::open(path) { + Ok(file) => file, + Err(_) => return inode, + }; + + let handle = file.as_raw_handle(); + + unsafe { + let mut file_info: FILE_ID_INFO = core::mem::zeroed(); + let file_info_ptr: *mut FILE_ID_INFO = &mut file_info; + + let success = GetFileInformationByHandleEx( + handle, + FileIdInfo, + file_info_ptr as LPVOID, + std::mem::size_of::() as DWORD, + ); + + if success != 0 { + inode = Some(std::mem::transmute::(file_info.FileId)); + } + } + + inode +} + fn unit_string_to_number(s: &str) -> Option { let mut offset = 0; let mut s_chars = s.chars().rev(); @@ -137,7 +239,7 @@ fn du( mut my_stat: Stat, options: &Options, depth: usize, - inodes: &mut HashSet, + inodes: &mut HashSet, ) -> Box> { let mut stats = vec![]; let mut futures = vec![]; @@ -164,10 +266,13 @@ fn du( if this_stat.is_dir { futures.push(du(this_stat, options, depth + 1, inodes)); } else { - if inodes.contains(&this_stat.inode) { - continue; + if this_stat.inode.is_some() { + let inode = this_stat.inode.unwrap(); + if inodes.contains(&inode) { + continue; + } + inodes.insert(inode); } - inodes.insert(this_stat.inode); my_stat.size += this_stat.size; my_stat.blocks += this_stat.blocks; if options.all { @@ -418,7 +523,7 @@ Try '{} --help' for more information.", let path = PathBuf::from(&path_str); match Stat::new(path) { Ok(stat) => { - let mut inodes: HashSet = HashSet::new(); + let mut inodes: HashSet = HashSet::new(); let iter = du(stat, &options, 0, &mut inodes); let (_, len) = iter.size_hint(); diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index a79f820fb..c810bd395 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -45,7 +45,11 @@ fn test_du_basics_subdir() { fn _du_basics_subdir(s: String) { assert_eq!(s, "4\tsubdir/deeper\n"); } -#[cfg(not(target_vendor = "apple"))] +#[cfg(target_os = "windows")] +fn _du_basics_subdir(s: String) { + assert_eq!(s, "0\tsubdir/deeper\n"); +} +#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] fn _du_basics_subdir(s: String) { // MS-WSL linux has altered expected output if !is_wsl() { @@ -71,7 +75,7 @@ fn test_du_basics_bad_name() { fn test_du_soft_link() { let ts = TestScenario::new("du"); - let link = ts.cmd("ln").arg("-s").arg(SUB_FILE).arg(SUB_LINK).run(); + let link = ts.ccmd("ln").arg("-s").arg(SUB_FILE).arg(SUB_LINK).run(); assert!(link.success); let result = ts.ucmd().arg(SUB_DIR_LINKS).run(); @@ -85,7 +89,11 @@ fn _du_soft_link(s: String) { // 'macos' host variants may have `du` output variation for soft links assert!((s == "12\tsubdir/links\n") || (s == "16\tsubdir/links\n")); } -#[cfg(not(target_vendor = "apple"))] +#[cfg(target_os = "windows")] +fn _du_soft_link(s: String) { + assert_eq!(s, "8\tsubdir/links\n"); +} +#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] fn _du_soft_link(s: String) { // MS-WSL linux has altered expected output if !is_wsl() { @@ -99,7 +107,7 @@ fn _du_soft_link(s: String) { fn test_du_hard_link() { let ts = TestScenario::new("du"); - let link = ts.cmd("ln").arg(SUB_FILE).arg(SUB_LINK).run(); + let link = ts.ccmd("ln").arg(SUB_FILE).arg(SUB_LINK).run(); assert!(link.success); let result = ts.ucmd().arg(SUB_DIR_LINKS).run(); @@ -113,7 +121,11 @@ fn test_du_hard_link() { fn _du_hard_link(s: String) { assert_eq!(s, "12\tsubdir/links\n") } -#[cfg(not(target_vendor = "apple"))] +#[cfg(target_os = "windows")] +fn _du_hard_link(s: String) { + assert_eq!(s, "8\tsubdir/links\n") +} +#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] fn _du_hard_link(s: String) { // MS-WSL linux has altered expected output if !is_wsl() { @@ -137,7 +149,11 @@ fn test_du_d_flag() { fn _du_d_flag(s: String) { assert_eq!(s, "16\t./subdir\n20\t./\n"); } -#[cfg(not(target_vendor = "apple"))] +#[cfg(target_os = "windows")] +fn _du_d_flag(s: String) { + assert_eq!(s, "8\t./subdir\n8\t./\n"); +} +#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] fn _du_d_flag(s: String) { // MS-WSL linux has altered expected output if !is_wsl() { diff --git a/tests/common/util.rs b/tests/common/util.rs index e4b452289..7aea8dc26 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -589,6 +589,14 @@ impl TestScenario { UCommand::new_from_tmp(bin, self.tmpd.clone(), true) } + /// Returns builder for invoking any uutils command. Paths given are treated + /// relative to the environment's unique temporary test directory. + pub fn ccmd>(&self, bin: S) -> UCommand { + let mut cmd = self.cmd(&self.bin_path); + cmd.arg(bin); + cmd + } + // different names are used rather than an argument // because the need to keep the environment is exceedingly rare. pub fn ucmd_keepenv(&self) -> UCommand { From 9c2cd81b111b028c07b6791568445acb18f30db0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 1 Apr 2021 23:18:57 +0200 Subject: [PATCH 0230/1135] refresh cargo.lock with recent updates --- Cargo.lock | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 95635159c..f40d512ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,7 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 - [[package]] name = "advapi32-sys" version = "0.2.0" @@ -982,9 +980,9 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" dependencies = [ "unicode-xid 0.2.1", ] @@ -1356,9 +1354,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.67" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" +checksum = "3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87" dependencies = [ "proc-macro2", "quote 1.0.9", From 6734ce785d5e17d8fb58dba29a94e3dfd06fb015 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 1 Apr 2021 23:25:37 +0200 Subject: [PATCH 0231/1135] rustfmt the recent changes --- src/uu/du/src/du.rs | 4 ++-- src/uu/echo/src/echo.rs | 1 - src/uu/sort/src/sort.rs | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 2eb7bd658..a4852b21c 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -26,9 +26,9 @@ use time::Timespec; #[cfg(windows)] use winapi::shared::minwindef::{DWORD, LPVOID}; #[cfg(windows)] -use winapi::um::fileapi::{FILE_STANDARD_INFO, FILE_ID_INFO}; +use winapi::um::fileapi::{FILE_ID_INFO, FILE_STANDARD_INFO}; #[cfg(windows)] -use winapi::um::minwinbase::{FileStandardInfo, FileIdInfo}; +use winapi::um::minwinbase::{FileIdInfo, FileStandardInfo}; #[cfg(windows)] use winapi::um::winbase::GetFileInformationByHandleEx; #[cfg(windows)] diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index 1e0c04d1d..4d38d7748 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -36,7 +36,6 @@ const AFTER_HELP: &str = r#" \\xHH byte with hexadecimal value HH (1 to 2 digits) "#; - mod options { pub const STRING: &str = "STRING"; pub const NO_NEWLINE: &str = "no_newline"; diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index f8789835a..6c29ad98d 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -493,13 +493,13 @@ fn get_leading_number(a: &str) -> &str { fn num_sort_dedup(a: &str) -> &str { // Empty lines are dumped if a.is_empty() { - return "0" + return "0"; // And lines that don't begin numerically are dumped } else if !a.trim().chars().nth(0).unwrap_or('\0').is_numeric() { - return "0" + return "0"; } else { - // Prepare lines for comparison of only the numerical leading numbers - return get_leading_number(a) + // Prepare lines for comparison of only the numerical leading numbers + return get_leading_number(a); }; } From dcbcf016658cebb24325197ba484c66d88e7a213 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 1 Apr 2021 23:37:22 +0200 Subject: [PATCH 0232/1135] Fix some clippy warnings --- src/uu/cksum/src/cksum.rs | 2 +- src/uu/fmt/src/linebreak.rs | 2 +- src/uu/ln/src/ln.rs | 2 +- src/uu/ls/src/ls.rs | 8 +++----- src/uu/nl/src/helper.rs | 2 +- .../num_format/formatters/cninetyninehexfloatf.rs | 2 +- .../src/tokenize/num_format/formatters/float_common.rs | 2 +- src/uu/shred/src/shred.rs | 2 +- tests/common/util.rs | 5 ++++- 9 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index b7659ea62..b6436de87 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -147,7 +147,7 @@ fn cksum(fname: &str) -> io::Result<(u32, usize)> { "Is a directory", )); }; - if !path.metadata().is_ok() { + if path.metadata().is_err() { return Err(std::io::Error::new( io::ErrorKind::NotFound, "No such file or directory", diff --git a/src/uu/fmt/src/linebreak.rs b/src/uu/fmt/src/linebreak.rs index c41fd41bd..50cb6f77f 100644 --- a/src/uu/fmt/src/linebreak.rs +++ b/src/uu/fmt/src/linebreak.rs @@ -81,7 +81,7 @@ pub fn break_lines(para: &Paragraph, opts: &FmtOptions, ostream: &mut BufWriter< let mut break_args = BreakArgs { opts, init_len: p_init_len, - indent_str: &p_indent[..], + indent_str: p_indent, indent_len: p_indent_len, uniform, ostream, diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index ab07a2b08..394cf13af 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -223,7 +223,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } else if matches.is_present(OPT_BACKUP) { match matches.value_of(OPT_BACKUP) { None => BackupMode::ExistingBackup, - Some(mode) => match &mode[..] { + Some(mode) => match mode { "simple" | "never" => BackupMode::SimpleBackup, "numbered" | "t" => BackupMode::NumberedBackup, "existing" | "nil" => BackupMode::ExistingBackup, diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 9633acf43..ece497bdb 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -270,11 +270,9 @@ impl Config { .any(|i| i >= idx) { format = Format::Long; - } else { - if let Some(mut indices) = options.indices_of(options::format::ONELINE) { - if indices.any(|i| i > idx) { - format = Format::OneLine; - } + } else if let Some(mut indices) = options.indices_of(options::format::ONELINE) { + if indices.any(|i| i > idx) { + format = Format::OneLine; } } } diff --git a/src/uu/nl/src/helper.rs b/src/uu/nl/src/helper.rs index 94ff835d7..e31477c62 100644 --- a/src/uu/nl/src/helper.rs +++ b/src/uu/nl/src/helper.rs @@ -37,7 +37,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> } match opts.value_of(options::NUMBER_FORMAT) { None => {} - Some(val) => match val.as_ref() { + Some(val) => match val { "ln" => { settings.number_format = crate::NumberFormat::Left; } diff --git a/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs b/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs index bf21bf8f9..10e58cc32 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs @@ -59,7 +59,7 @@ fn get_primitive_hex( // assign 0 let (mut first_segment_raw, second_segment_raw) = match analysis.decimal_pos { Some(pos) => (&str_in[..pos], &str_in[pos + 1..]), - None => (&str_in[..], "0"), + None => (str_in, "0"), }; if first_segment_raw.is_empty() { first_segment_raw = "0"; diff --git a/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs b/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs index 65fe5b6ea..a107078ae 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs @@ -218,7 +218,7 @@ pub fn get_primitive_dec( // assign 0 let (mut first_segment_raw, second_segment_raw) = match analysis.decimal_pos { Some(pos) => (&str_in[..pos], &str_in[pos + 1..]), - None => (&str_in[..], "0"), + None => (str_in, "0"), }; if first_segment_raw.is_empty() { first_segment_raw = "0"; diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index f9d8b9c73..c5f4d6e57 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -338,7 +338,7 @@ this is the default for non-regular files", Some(s) => match s.parse::() { Ok(u) => u, Err(_) => { - errs.push(String::from(format!("invalid number of passes: '{}'", s))); + errs.push(format!("invalid number of passes: '{}'", s)); 0 } }, diff --git a/tests/common/util.rs b/tests/common/util.rs index 7aea8dc26..922525ed2 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -1,8 +1,11 @@ #![allow(dead_code)] +#[cfg(not(windows))] use libc; use std::env; -use std::ffi::{CString, OsStr}; +#[cfg(not(windows))] +use std::ffi::CString; +use std::ffi::OsStr; use std::fs::{self, File, OpenOptions}; use std::io::{Read, Result, Write}; #[cfg(unix)] From 7112182dbcbd55925df7d33d11d8090cd043d16f Mon Sep 17 00:00:00 2001 From: Paul Otten Date: Thu, 1 Apr 2021 18:37:20 -0400 Subject: [PATCH 0233/1135] Consider device id when comparing files --- src/uu/du/src/du.rs | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 2eb7bd658..c311f982e 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -32,7 +32,7 @@ use winapi::um::minwinbase::{FileStandardInfo, FileIdInfo}; #[cfg(windows)] use winapi::um::winbase::GetFileInformationByHandleEx; #[cfg(windows)] -use winapi::um::winnt::FILE_ID_128; +use winapi::um::winnt::{FILE_ID_128, ULONGLONG}; const NAME: &str = "du"; const SUMMARY: &str = "estimate file space usage"; @@ -58,12 +58,18 @@ struct Options { separate_dirs: bool, } +#[derive(PartialEq, Eq, Hash, Clone, Copy)] +struct FileInfo { + file_id: u128, + dev_id: u64, +} + struct Stat { path: PathBuf, is_dir: bool, size: u64, blocks: u64, - inode: Option, + inode: Option, created: u64, accessed: u64, modified: u64, @@ -73,13 +79,18 @@ impl Stat { fn new(path: PathBuf) -> Result { let metadata = fs::symlink_metadata(&path)?; + #[cfg(not(windows))] + let file_info = FileInfo { + file_id: metadata.ino() as u128, + dev_id: metadata.dev(), + }; #[cfg(not(windows))] return Ok(Stat { path, is_dir: metadata.is_dir(), size: metadata.len(), blocks: metadata.blocks() as u64, - inode: Some(metadata.ino() as u128), + inode: Some(file_info), created: metadata.mtime() as u64, accessed: metadata.atime() as u64, modified: metadata.mtime() as u64, @@ -88,14 +99,14 @@ impl Stat { #[cfg(windows)] let size_on_disk = get_size_on_disk(&path); #[cfg(windows)] - let inode = get_inode(&path); + let file_info = get_file_info(&path); #[cfg(windows)] Ok(Stat { path, is_dir: metadata.is_dir(), size: metadata.len(), blocks: size_on_disk / 1024 * 2, - inode: inode, + inode: file_info, created: windows_time_to_unix_time(metadata.creation_time()), accessed: windows_time_to_unix_time(metadata.last_access_time()), modified: windows_time_to_unix_time(metadata.last_write_time()), @@ -143,12 +154,12 @@ fn get_size_on_disk(path: &PathBuf) -> u64 { } #[cfg(windows)] -fn get_inode(path: &PathBuf) -> Option { - let mut inode = None; +fn get_file_info(path: &PathBuf) -> Option { + let mut result = None; let file = match fs::File::open(path) { Ok(file) => file, - Err(_) => return inode, + Err(_) => return result, }; let handle = file.as_raw_handle(); @@ -165,11 +176,14 @@ fn get_inode(path: &PathBuf) -> Option { ); if success != 0 { - inode = Some(std::mem::transmute::(file_info.FileId)); + result = Some(FileInfo { + file_id: std::mem::transmute::(file_info.FileId), + dev_id: std::mem::transmute::(file_info.VolumeSerialNumber), + }); } } - inode + result } fn unit_string_to_number(s: &str) -> Option { @@ -239,7 +253,7 @@ fn du( mut my_stat: Stat, options: &Options, depth: usize, - inodes: &mut HashSet, + inodes: &mut HashSet, ) -> Box> { let mut stats = vec![]; let mut futures = vec![]; @@ -523,7 +537,7 @@ Try '{} --help' for more information.", let path = PathBuf::from(&path_str); match Stat::new(path) { Ok(stat) => { - let mut inodes: HashSet = HashSet::new(); + let mut inodes: HashSet = HashSet::new(); let iter = du(stat, &options, 0, &mut inodes); let (_, len) = iter.size_hint(); From 7859bf885fa0c3ad666b2837174c592a84f62978 Mon Sep 17 00:00:00 2001 From: Paul Otten Date: Thu, 1 Apr 2021 19:42:43 -0400 Subject: [PATCH 0234/1135] Consistency with GNU version of `du` when doing `du -h` on an empty file --- src/uu/du/src/du.rs | 3 +++ tests/by-util/test_du.rs | 10 ++++++++++ tests/fixtures/du/empty.txt | 0 3 files changed, 13 insertions(+) create mode 100644 tests/fixtures/du/empty.txt diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 2eb7bd658..5ce193842 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -305,6 +305,9 @@ fn convert_size_human(size: u64, multiplier: u64, _block_size: u64) -> String { return format!("{:.1}{}", (size as f64) / (limit as f64), unit); } } + if size == 0 { + return format!("0"); + } format!("{}B", size) } diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index c810bd395..b3b1b3465 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -162,3 +162,13 @@ fn _du_d_flag(s: String) { assert_eq!(s, "8\t./subdir\n8\t./\n"); } } + +#[test] +fn test_du_h_flag_empty_file() { + let ts = TestScenario::new("du"); + + let result = ts.ucmd().arg("-h").arg("empty.txt").run(); + assert!(result.success); + assert_eq!(result.stderr, ""); + assert_eq!(result.stdout, "0\tempty.txt\n"); +} diff --git a/tests/fixtures/du/empty.txt b/tests/fixtures/du/empty.txt new file mode 100644 index 000000000..e69de29bb From 4a6176855a1911df37250557880a52ea1bf6542b Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 2 Apr 2021 09:55:57 +0200 Subject: [PATCH 0235/1135] relpath: move from getops to clap (#1939) (#1990) * relpath: add tests * relpath: move from getopts to clap --- src/uu/relpath/Cargo.toml | 2 +- src/uu/relpath/src/relpath.rs | 103 ++++++++------------- tests/by-util/test_relpath.rs | 166 +++++++++++++++++++++++++++++++++- 3 files changed, 206 insertions(+), 65 deletions(-) diff --git a/src/uu/relpath/Cargo.toml b/src/uu/relpath/Cargo.toml index 1dc296ec6..c923b42ac 100644 --- a/src/uu/relpath/Cargo.toml +++ b/src/uu/relpath/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/relpath.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33.3" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/relpath/src/relpath.rs b/src/uu/relpath/src/relpath.rs index 4e165df1f..82779107a 100644 --- a/src/uu/relpath/src/relpath.rs +++ b/src/uu/relpath/src/relpath.rs @@ -10,62 +10,60 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::env; use std::path::{Path, PathBuf}; use uucore::fs::{canonicalize, CanonicalizeMode}; -static NAME: &str = "relpath"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Convert TO destination to the relative path from the FROM dir. +If FROM path is omitted, current working dir will be used."; + +mod options { + pub const DIR: &str = "DIR"; + pub const TO: &str = "TO"; + pub const FROM: &str = "FROM"; +} + +fn get_usage() -> String { + format!("{} [-d DIR] TO [FROM]", executable!()) +} pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); + let usage = get_usage(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(options::DIR) + .short("d") + .takes_value(true) + .help("If any of FROM and TO is not subpath of DIR, output absolute path instead of relative"), + ) + .arg( + Arg::with_name(options::TO) + .required(true) + .takes_value(true), + ) + .arg( + Arg::with_name(options::FROM) + .takes_value(true), + ) + .get_matches_from(args); - opts.optflag("h", "help", "Show help and exit"); - opts.optflag("V", "version", "Show version and exit"); - opts.optopt( - "d", - "", - "If any of FROM and TO is not subpath of DIR, output absolute path instead of relative", - "DIR", - ); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("{}", f); - show_usage(&opts); - return 1; - } - }; - - if matches.opt_present("V") { - version(); - return 0; - } - if matches.opt_present("h") { - show_usage(&opts); - return 0; - } - - if matches.free.is_empty() { - show_error!("Missing operand: TO"); - println!("Try `{} --help` for more information.", NAME); - return 1; - } - - let to = Path::new(&matches.free[0]); - let from = if matches.free.len() > 1 { - Path::new(&matches.free[1]).to_path_buf() - } else { - env::current_dir().unwrap() + let to = Path::new(matches.value_of(options::TO).unwrap()).to_path_buf(); // required + let from = match matches.value_of(options::FROM) { + Some(p) => Path::new(p).to_path_buf(), + None => env::current_dir().unwrap(), }; let absto = canonicalize(to, CanonicalizeMode::Normal).unwrap(); let absfrom = canonicalize(from, CanonicalizeMode::Normal).unwrap(); - if matches.opt_present("d") { - let base = Path::new(&matches.opt_str("d").unwrap()).to_path_buf(); + if matches.is_present(options::DIR) { + let base = Path::new(&matches.value_of(options::DIR).unwrap()).to_path_buf(); let absbase = canonicalize(base, CanonicalizeMode::Normal).unwrap(); if !absto.as_path().starts_with(absbase.as_path()) || !absfrom.as_path().starts_with(absbase.as_path()) @@ -99,24 +97,3 @@ pub fn uumain(args: impl uucore::Args) -> i32 { println!("{}", result.display()); 0 } - -fn version() { - println!("{} {}", NAME, VERSION) -} - -fn show_usage(opts: &getopts::Options) { - version(); - println!(); - println!("Usage:"); - println!(" {} [-d DIR] TO [FROM]", NAME); - println!(" {} -V|--version", NAME); - println!(" {} -h|--help", NAME); - println!(); - print!( - "{}", - opts.usage( - "Convert TO destination to the relative path from the FROM dir.\n\ - If FROM path is omitted, current working dir will be used." - ) - ); -} diff --git a/tests/by-util/test_relpath.rs b/tests/by-util/test_relpath.rs index 651491045..690531896 100644 --- a/tests/by-util/test_relpath.rs +++ b/tests/by-util/test_relpath.rs @@ -1 +1,165 @@ -// ToDO: add tests +use crate::common::util::*; +use std::borrow::Cow; +use std::path::Path; + +struct TestCase<'a> { + from: &'a str, + to: &'a str, + expected: &'a str, +} + +const TESTS: [TestCase; 10] = [ + TestCase { + from: "A/B/C", + to: "A", + expected: "../..", + }, + TestCase { + from: "A/B/C", + to: "A/B", + expected: "..", + }, + TestCase { + from: "A/B/C", + to: "A/B/C", + expected: "", + }, + TestCase { + from: "A/B/C", + to: "A/B/C/D", + expected: "D", + }, + TestCase { + from: "A/B/C", + to: "A/B/C/D/E", + expected: "D/E", + }, + TestCase { + from: "A/B/C", + to: "A/B/D", + expected: "../D", + }, + TestCase { + from: "A/B/C", + to: "A/B/D/E", + expected: "../D/E", + }, + TestCase { + from: "A/B/C", + to: "A/D", + expected: "../../D", + }, + TestCase { + from: "A/B/C", + to: "D/E/F", + expected: "../../../D/E/F", + }, + TestCase { + from: "A/B/C", + to: "A/D/E", + expected: "../../D/E", + }, +]; + +fn convert_path<'a>(path: &'a str) -> Cow<'a, str> { + #[cfg(windows)] + return path.replace("/", "\\").into(); + #[cfg(not(windows))] + return path.into(); +} + +#[test] +fn test_relpath_with_from_no_d() { + for test in TESTS.iter() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let from: &str = &convert_path(test.from); + let to: &str = &convert_path(test.to); + let expected: &str = &convert_path(test.expected); + + at.mkdir_all(to); + at.mkdir_all(from); + + scene + .ucmd() + .arg(to) + .arg(from) + .succeeds() + .stdout_only(&format!("{}\n", expected)); + } +} + +#[test] +fn test_relpath_with_from_with_d() { + for test in TESTS.iter() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let from: &str = &convert_path(test.from); + let to: &str = &convert_path(test.to); + let pwd = at.as_string(); + at.mkdir_all(to); + at.mkdir_all(from); + + // d is part of subpath -> expect relative path + let mut result = scene + .ucmd() + .arg(to) + .arg(from) + .arg(&format!("-d{}", pwd)) + .run(); + assert!(result.success); + // relax rules for windows test environment + #[cfg(not(windows))] + assert!(Path::new(&result.stdout).is_relative()); + + // d is not part of subpath -> expect absolut path + result = scene.ucmd().arg(to).arg(from).arg("-dnon_existing").run(); + assert!(result.success); + assert!(Path::new(&result.stdout).is_absolute()); + } +} + +#[test] +fn test_relpath_no_from_no_d() { + for test in TESTS.iter() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let to: &str = &convert_path(test.to); + at.mkdir_all(to); + + let result = scene.ucmd().arg(to).run(); + assert!(result.success); + #[cfg(not(windows))] + assert_eq!(result.stdout, format!("{}\n", to)); + // relax rules for windows test environment + #[cfg(windows)] + assert!(result.stdout.ends_with(&format!("{}\n", to))); + } +} + +#[test] +fn test_relpath_no_from_with_d() { + for test in TESTS.iter() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let to: &str = &convert_path(test.to); + let pwd = at.as_string(); + at.mkdir_all(to); + + // d is part of subpath -> expect relative path + let mut result = scene.ucmd().arg(to).arg(&format!("-d{}", pwd)).run(); + assert!(result.success); + // relax rules for windows test environment + #[cfg(not(windows))] + assert!(Path::new(&result.stdout).is_relative()); + + // d is not part of subpath -> expect absolut path + result = scene.ucmd().arg(to).arg("-dnon_existing").run(); + assert!(result.success); + assert!(Path::new(&result.stdout).is_absolute()); + } +} From 2eb32d845ec023ce4f1878e1b7a27d1206cee7fc Mon Sep 17 00:00:00 2001 From: ReggaeMuffin <644950+reggaemuffin@users.noreply.github.com> Date: Fri, 2 Apr 2021 10:56:49 +0100 Subject: [PATCH 0236/1135] chores: run `cargo +1.40.0 fmt` Apparently fmt from 1.40.0 is a bit more strict in some places Let me know if this is worthwhile merging :) --- Cargo.lock | 2 +- build.rs | 38 +++++++++--------- src/uu/chroot/src/chroot.rs | 4 +- src/uu/head/src/head.rs | 30 +++++++------- src/uu/hostname/src/hostname.rs | 2 +- src/uu/ln/src/ln.rs | 4 +- src/uu/mktemp/src/mktemp.rs | 10 ++--- src/uu/numfmt/src/numfmt.rs | 8 ++-- src/uu/readlink/src/readlink.rs | 6 +-- src/uu/shred/src/shred.rs | 70 ++++++++++++++++----------------- src/uu/stdbuf/src/stdbuf.rs | 3 +- src/uu/uptime/src/uptime.rs | 4 +- tests/common/util.rs | 8 ++-- 13 files changed, 94 insertions(+), 95 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f40d512ce..88984362b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2181,7 +2181,7 @@ dependencies = [ name = "uu_relpath" version = "0.0.4" dependencies = [ - "getopts", + "clap", "uucore", "uucore_procs", ] diff --git a/build.rs b/build.rs index 625a3ccc8..ae38177b0 100644 --- a/build.rs +++ b/build.rs @@ -44,10 +44,10 @@ pub fn main() { mf.write_all( "type UtilityMap = HashMap<&'static str, fn(T) -> i32>;\n\ - \n\ - fn util_map() -> UtilityMap {\n\ - \tlet mut map = UtilityMap::new();\n\ - " + \n\ + fn util_map() -> UtilityMap {\n\ + \tlet mut map = UtilityMap::new();\n\ + " .as_bytes(), ) .unwrap(); @@ -97,21 +97,21 @@ pub fn main() { mf.write_all( format!( "\ - \tmap.insert(\"{krate}\", {krate}::uumain);\n\ - \t\tmap.insert(\"md5sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha1sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha224sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha256sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha384sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha512sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha3sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha3-224sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha3-256sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha3-384sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha3-512sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"shake128sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"shake256sum\", {krate}::uumain);\n\ - ", + \tmap.insert(\"{krate}\", {krate}::uumain);\n\ + \t\tmap.insert(\"md5sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha1sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha224sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha256sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha384sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha512sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha3sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha3-224sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha3-256sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha3-384sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha3-512sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"shake128sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"shake256sum\", {krate}::uumain);\n\ + ", krate = krate ) .as_bytes(), diff --git a/src/uu/chroot/src/chroot.rs b/src/uu/chroot/src/chroot.rs index 2c3bcbca4..44c5dfa02 100644 --- a/src/uu/chroot/src/chroot.rs +++ b/src/uu/chroot/src/chroot.rs @@ -65,8 +65,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::USERSPEC) .help( "Colon-separated user and group to switch to. \ - Same as -u USER -g GROUP. \ - Userspec has higher preference than -u and/or -g", + Same as -u USER -g GROUP. \ + Userspec has higher preference than -u and/or -g", ) .value_name("USER:GROUP"), ) diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index a8f519f6b..3500af544 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -10,13 +10,13 @@ const BUF_SIZE: usize = 65536; const VERSION: &str = env!("CARGO_PKG_VERSION"); const ABOUT: &str = "\ - Print the first 10 lines of each FILE to standard output.\n\ - With more than one FILE, precede each with a header giving the file name.\n\ - \n\ - With no FILE, or when FILE is -, read standard input.\n\ - \n\ - Mandatory arguments to long flags are mandatory for short flags too.\ - "; + Print the first 10 lines of each FILE to standard output.\n\ + With more than one FILE, precede each with a header giving the file name.\n\ + \n\ + With no FILE, or when FILE is -, read standard input.\n\ + \n\ + Mandatory arguments to long flags are mandatory for short flags too.\ + "; const USAGE: &str = "head [FLAG]... [FILE]..."; mod options { @@ -43,10 +43,10 @@ fn app<'a>() -> App<'a, 'a> { .takes_value(true) .help( "\ - print the first NUM bytes of each file;\n\ - with the leading '-', print all but the last\n\ - NUM bytes of each file\ - ", + print the first NUM bytes of each file;\n\ + with the leading '-', print all but the last\n\ + NUM bytes of each file\ + ", ) .overrides_with_all(&[options::BYTES_NAME, options::LINES_NAME]) .allow_hyphen_values(true), @@ -59,10 +59,10 @@ fn app<'a>() -> App<'a, 'a> { .takes_value(true) .help( "\ - print the first NUM lines instead of the first 10;\n\ - with the leading '-', print all but the last\n\ - NUM lines of each file\ - ", + print the first NUM lines instead of the first 10;\n\ + with the leading '-', print all but the last\n\ + NUM lines of each file\ + ", ) .overrides_with_all(&[options::LINES_NAME, options::BYTES_NAME]) .allow_hyphen_values(true), diff --git a/src/uu/hostname/src/hostname.rs b/src/uu/hostname/src/hostname.rs index f37b6a74d..d6f70be16 100644 --- a/src/uu/hostname/src/hostname.rs +++ b/src/uu/hostname/src/hostname.rs @@ -78,7 +78,7 @@ fn execute(args: impl uucore::Args) -> i32 { ) .arg(Arg::with_name(OPT_SHORT).short("s").long("short").help( "Display the short hostname (the portion before the first dot) if \ - possible", + possible", )) .arg(Arg::with_name(OPT_HOST)) .get_matches_from(args); diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index 394cf13af..96a0df813 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -111,7 +111,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_BACKUP) .help( "make a backup of each file that would otherwise be overwritten \ - or removed", + or removed", ) .takes_value(true) .possible_value("simple") @@ -145,7 +145,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_NO_DEREFERENCE) .help( "treat LINK_executable!() as a normal file if it is a \ - symbolic link to a directory", + symbolic link to a directory", ), ) // TODO: opts.arg( diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index 194b6625f..ed767ffe0 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -71,7 +71,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_SUFFIX) .help( "append SUFF to TEMPLATE; SUFF must not contain a path separator. \ - This option is implied if TEMPLATE does not end with X.", + This option is implied if TEMPLATE does not end with X.", ) .value_name("SUFF"), ) @@ -81,15 +81,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_TMPDIR) .help( "interpret TEMPLATE relative to DIR; if DIR is not specified, use \ - $TMPDIR if set, else /tmp. With this option, TEMPLATE must not \ - be an absolute name; unlike with -t, TEMPLATE may contain \ - slashes, but mktemp creates only the final component", + $TMPDIR if set, else /tmp. With this option, TEMPLATE must not \ + be an absolute name; unlike with -t, TEMPLATE may contain \ + slashes, but mktemp creates only the final component", ) .value_name("DIR"), ) .arg(Arg::with_name(OPT_T).short(OPT_T).help( "Generate a template (using the supplied prefix and TMPDIR if set) \ - to create a filename template [deprecated]", + to create a filename template [deprecated]", )) .arg( Arg::with_name(ARG_TEMPLATE) diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index 29c422a89..e9a476956 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -187,9 +187,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::PADDING) .help( "pad the output to N characters; positive N will \ - right-align; negative N will left-align; padding is \ - ignored if the output is wider than N; the default is \ - to automatically pad if a whitespace is found", + right-align; negative N will left-align; padding is \ + ignored if the output is wider than N; the default is \ + to automatically pad if a whitespace is found", ) .value_name("N"), ) @@ -198,7 +198,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::HEADER) .help( "print (without converting) the first N header lines; \ - N defaults to 1 if not specified", + N defaults to 1 if not specified", ) .value_name("N") .default_value(options::HEADER_DEFAULT) diff --git a/src/uu/readlink/src/readlink.rs b/src/uu/readlink/src/readlink.rs index 8bc9a2aeb..727c2cce5 100644 --- a/src/uu/readlink/src/readlink.rs +++ b/src/uu/readlink/src/readlink.rs @@ -46,7 +46,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_CANONICALIZE) .help( "canonicalize by following every symlink in every component of the \ - given name recursively; all but the last component must exist", + given name recursively; all but the last component must exist", ), ) .arg( @@ -55,7 +55,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long("canonicalize-existing") .help( "canonicalize by following every symlink in every component of the \ - given name recursively, all components must exist", + given name recursively, all components must exist", ), ) .arg( @@ -64,7 +64,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_CANONICALIZE_MISSING) .help( "canonicalize by following every symlink in every component of the \ - given name recursively, without requirements on components existence", + given name recursively, without requirements on components existence", ), ) .arg( diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index c5f4d6e57..d5f910297 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -223,40 +223,40 @@ fn get_usage() -> String { static AFTER_HELP: &str = "Delete FILE(s) if --remove (-u) is specified. The default is not to remove\n\ -the files because it is common to operate on device files like /dev/hda,\n\ -and those files usually should not be removed.\n\ -\n\ -CAUTION: Note that shred relies on a very important assumption:\n\ -that the file system overwrites data in place. This is the traditional\n\ -way to do things, but many modern file system designs do not satisfy this\n\ -assumption. The following are examples of file systems on which shred is\n\ -not effective, or is not guaranteed to be effective in all file system modes:\n\ -\n\ -* log-structured or journaled file systems, such as those supplied with\n\ -AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)\n\ -\n\ -* file systems that write redundant data and carry on even if some writes\n\ -fail, such as RAID-based file systems\n\ -\n\ -* file systems that make snapshots, such as Network Appliance's NFS server\n\ -\n\ -* file systems that cache in temporary locations, such as NFS\n\ -version 3 clients\n\ -\n\ -* compressed file systems\n\ -\n\ -In the case of ext3 file systems, the above disclaimer applies\n\ -and shred is thus of limited effectiveness) only in data=journal mode,\n\ -which journals file data in addition to just metadata. In both the\n\ -data=ordered (default) and data=writeback modes, shred works as usual.\n\ -Ext3 journaling modes can be changed by adding the data=something option\n\ -to the mount options for a particular file system in the /etc/fstab file,\n\ -as documented in the mount man page (man mount).\n\ -\n\ -In addition, file system backups and remote mirrors may contain copies\n\ -of the file that cannot be removed, and that will allow a shredded file\n\ -to be recovered later.\n\ -"; + the files because it is common to operate on device files like /dev/hda,\n\ + and those files usually should not be removed.\n\ + \n\ + CAUTION: Note that shred relies on a very important assumption:\n\ + that the file system overwrites data in place. This is the traditional\n\ + way to do things, but many modern file system designs do not satisfy this\n\ + assumption. The following are examples of file systems on which shred is\n\ + not effective, or is not guaranteed to be effective in all file system modes:\n\ + \n\ + * log-structured or journaled file systems, such as those supplied with\n\ + AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)\n\ + \n\ + * file systems that write redundant data and carry on even if some writes\n\ + fail, such as RAID-based file systems\n\ + \n\ + * file systems that make snapshots, such as Network Appliance's NFS server\n\ + \n\ + * file systems that cache in temporary locations, such as NFS\n\ + version 3 clients\n\ + \n\ + * compressed file systems\n\ + \n\ + In the case of ext3 file systems, the above disclaimer applies\n\ + and shred is thus of limited effectiveness) only in data=journal mode,\n\ + which journals file data in addition to just metadata. In both the\n\ + data=ordered (default) and data=writeback modes, shred works as usual.\n\ + Ext3 journaling modes can be changed by adding the data=something option\n\ + to the mount options for a particular file system in the /etc/fstab file,\n\ + as documented in the mount man page (man mount).\n\ + \n\ + In addition, file system backups and remote mirrors may contain copies\n\ + of the file that cannot be removed, and that will allow a shredded file\n\ + to be recovered later.\n\ + "; pub mod options { pub const FILE: &str = "file"; @@ -312,7 +312,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .short("x") .help( "do not round file sizes up to the next full block;\n\ -this is the default for non-regular files", + this is the default for non-regular files", ), ) .arg( diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 67ed9a838..a61ba967b 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -80,7 +80,8 @@ fn print_version() { fn print_usage(opts: &Options) { let brief = "Run COMMAND, with modified buffering operations for its standard streams\n \ Mandatory arguments to long options are mandatory for short options too."; - let explanation = "If MODE is 'L' the corresponding stream will be line buffered.\n \ + let explanation = + "If MODE is 'L' the corresponding stream will be line buffered.\n \ This option is invalid with standard input.\n\n \ If MODE is '0' the corresponding stream will be unbuffered.\n\n \ Otherwise MODE is a number which may be followed by one of the following:\n\n \ diff --git a/src/uu/uptime/src/uptime.rs b/src/uu/uptime/src/uptime.rs index 670d7845b..418b8317f 100644 --- a/src/uu/uptime/src/uptime.rs +++ b/src/uu/uptime/src/uptime.rs @@ -19,8 +19,8 @@ use uucore::libc::time_t; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Display the current time, the length of time the system has been up,\n\ -the number of users on the system, and the average number of jobs\n\ -in the run queue over the last 1, 5 and 15 minutes."; + the number of users on the system, and the average number of jobs\n\ + in the run queue over the last 1, 5 and 15 minutes."; pub mod options { pub static SINCE: &str = "since"; } diff --git a/tests/common/util.rs b/tests/common/util.rs index 922525ed2..708b8dbba 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -29,8 +29,8 @@ static TESTS_DIR: &str = "tests"; static FIXTURES_DIR: &str = "fixtures"; static ALREADY_RUN: &str = " you have already run this UCommand, if you want to run \ - another command in the same test, use TestScenario::new instead of \ - testing();"; + another command in the same test, use TestScenario::new instead of \ + testing();"; static MULTIPLE_STDIN_MEANINGLESS: &str = "Ucommand is designed around a typical use case of: provide args and input stream -> spawn process -> block until completion -> return output streams. For verifying that a particular section of the input stream is what causes a particular behavior, use the Command type directly."; /// Test if the program is running under CI @@ -135,9 +135,7 @@ impl CmdResult { pub fn tmpd(&self) -> Rc { match &self.tmpd { Some(ptr) => ptr.clone(), - None => { - panic!("Command not associated with a TempDir") - } + None => panic!("Command not associated with a TempDir"), } } From d12f96d9ca5c72f573782b252e64aa43f9b82a4d Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Fri, 2 Apr 2021 09:13:25 -0400 Subject: [PATCH 0237/1135] fold: preserve blank lines --- src/uu/fold/src/fold.rs | 5 ++++- tests/by-util/test_fold.rs | 28 +++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index 05f0725ef..27ab319d0 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -100,7 +100,10 @@ fn fold(filenames: Vec, bytes: bool, spaces: bool, width: usize) { fn fold_file(file: BufReader, bytes: bool, spaces: bool, width: usize) { for line_result in file.lines() { let mut line = safe_unwrap!(line_result); - if bytes { + + if line.is_empty() { + println!(); + } else if bytes { let len = line.len(); let mut i = 0; while i < len { diff --git a/tests/by-util/test_fold.rs b/tests/by-util/test_fold.rs index c17f300d2..64d77cd2b 100644 --- a/tests/by-util/test_fold.rs +++ b/tests/by-util/test_fold.rs @@ -25,9 +25,35 @@ fn test_40_column_word_boundary() { } #[test] -fn test_default_warp_with_newlines() { +fn test_default_wrap_with_newlines() { new_ucmd!() .arg("lorem_ipsum_new_line.txt") .run() .stdout_is_fixture("lorem_ipsum_new_line_80_column.expected"); } + +#[test] +fn test_should_preserve_empty_lines() { + new_ucmd!().pipe_in("\n").succeeds().stdout_is("\n"); + + new_ucmd!() + .arg("-w1") + .pipe_in("0\n1\n\n2\n\n\n") + .succeeds() + .stdout_is("0\n1\n\n2\n\n\n"); +} + +#[test] +fn test_word_boundary_split_should_preserve_empty_lines() { + new_ucmd!() + .arg("-s") + .pipe_in("\n") + .succeeds() + .stdout_is("\n"); + + new_ucmd!() + .args(&["-w1", "-s"]) + .pipe_in("0\n1\n\n2\n\n\n") + .succeeds() + .stdout_is("0\n1\n\n2\n\n\n"); +} From 349c4f7af66d5c4baa9ee806e7a327e35114fa94 Mon Sep 17 00:00:00 2001 From: Juliana Rodrigueiro Date: Fri, 2 Apr 2021 19:04:14 +0100 Subject: [PATCH 0238/1135] install: Make log message identical to GNU install $ install -v -d dir1 install: creating directory 'dir1' --- src/uu/install/src/install.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index b4f98ec1a..35097da09 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -372,7 +372,7 @@ fn directory(paths: Vec, b: Behavior) -> i32 { } if b.verbose { - show_info!("created directory '{}'", path.display()); + show_info!("creating directory '{}'", path.display()); } } if all_successful { From 2a02f01fc2ac3b5e86f56543cd6daf396ea70c07 Mon Sep 17 00:00:00 2001 From: Juliana Rodrigueiro Date: Fri, 2 Apr 2021 19:13:56 +0100 Subject: [PATCH 0239/1135] install: Don't display success message when the dir was not created Also don't run chmod when we just failed to create the directory. Behaviour before this patch: $ ./target/release/install -v -d dir1/dir2 install: dir1/dir2: Permission denied (os error 13) install: dir1/dir2: chmod failed with error No such file or directory (os error 2) install: created directory 'dir1/dir2' --- src/uu/install/src/install.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 35097da09..6267ed94f 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -364,15 +364,17 @@ fn directory(paths: Vec, b: Behavior) -> i32 { if let Err(e) = fs::create_dir(directory) { show_info!("{}: {}", path.display(), e.to_string()); all_successful = false; + continue; + } + + if b.verbose { + show_info!("creating directory '{}'", path.display()); } } if mode::chmod(&path, b.mode()).is_err() { all_successful = false; - } - - if b.verbose { - show_info!("creating directory '{}'", path.display()); + continue; } } if all_successful { From 97da14fcb20a13912ae177b5a781c2cde9d1c3f7 Mon Sep 17 00:00:00 2001 From: Juliana Rodrigueiro Date: Fri, 2 Apr 2021 20:04:25 +0100 Subject: [PATCH 0240/1135] install: Fix behaviour of the -d flag The '-d' flag should create all ancestors (or components) of a directory regardless of the presence of the "-D" flag. From the man page: -d, --directory treat all arguments as directory names; create all components of the specified directories With GNU: $ install -v -d dir1/di2 install: creating directory 'dir1' install: creating directory 'dir1/di2' With this version: $ ./target/release/install -v -d dir3/di4 install: dir3/di4: No such file or directory (os error 2) install: dir3/di4: chmod failed with error No such file or directory (os error 2) install: created directory 'dir3/di4' Also, one of the unit tests misinterprets what a "component" is, and hence was fixed. --- src/uu/install/src/install.rs | 14 ++++--- tests/by-util/test_install.rs | 77 +++++++++++++++++++++++++++++++---- 2 files changed, 78 insertions(+), 13 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 6267ed94f..a4f1ca6e6 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -356,13 +356,17 @@ fn directory(paths: Vec, b: Behavior) -> i32 { } else { let mut all_successful = true; - for directory in paths.iter() { - let path = Path::new(directory); - + for path in paths.iter().map(Path::new) { // if the path already exist, don't try to create it again if !path.exists() { - if let Err(e) = fs::create_dir(directory) { - show_info!("{}: {}", path.display(), e.to_string()); + // Differently than the primary functionality (MainFunction::Standard), the directory + // functionality should create all ancestors (or components) of a directory regardless + // of the presence of the "-D" flag. + // NOTE: the GNU "install" sets the expected mode only for the target directory. All + // created ancestor directories will have the default mode. Hence it is safe to use + // fs::create_dir_all and then only modify the target's dir mode. + if let Err(e) = fs::create_dir_all(path) { + show_info!("{}: {}", path.display(), e); all_successful = false; continue; } diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index af48a0e66..8ac6396fd 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -87,20 +87,81 @@ fn test_install_unimplemented_arg() { } #[test] -fn test_install_component_directories() { +fn test_install_ancestors_directories() { let (at, mut ucmd) = at_and_ucmd!(); - let component1 = "component1"; - let component2 = "component2"; - let component3 = "component3"; + let ancestor1 = "ancestor1"; + let ancestor2 = "ancestor1/ancestor2"; + let target_dir = "ancestor1/ancestor2/target_dir"; let directories_arg = "-d"; - ucmd.args(&[directories_arg, component1, component2, component3]) + ucmd.args(&[directories_arg, target_dir]) .succeeds() .no_stderr(); - assert!(at.dir_exists(component1)); - assert!(at.dir_exists(component2)); - assert!(at.dir_exists(component3)); + assert!(at.dir_exists(ancestor1)); + assert!(at.dir_exists(ancestor2)); + assert!(at.dir_exists(target_dir)); +} + +#[test] +fn test_install_ancestors_mode_directories() { + let (at, mut ucmd) = at_and_ucmd!(); + let ancestor1 = "ancestor1"; + let ancestor2 = "ancestor1/ancestor2"; + let target_dir = "ancestor1/ancestor2/target_dir"; + let directories_arg = "-d"; + let mode_arg = "--mode=700"; + + ucmd.args(&[mode_arg, directories_arg, target_dir]) + .succeeds() + .no_stderr(); + + assert!(at.dir_exists(ancestor1)); + assert!(at.dir_exists(ancestor2)); + assert!(at.dir_exists(target_dir)); + + assert_ne!(0o40700 as u32, at.metadata(ancestor1).permissions().mode()); + assert_ne!(0o40700 as u32, at.metadata(ancestor2).permissions().mode()); + + // Expected mode only on the target_dir. + assert_eq!(0o40700 as u32, at.metadata(target_dir).permissions().mode()); +} + +#[test] +fn test_install_parent_directories() { + let (at, mut ucmd) = at_and_ucmd!(); + let ancestor1 = "ancestor1"; + let ancestor2 = "ancestor1/ancestor2"; + let target_dir = "ancestor1/ancestor2/target_dir"; + let directories_arg = "-d"; + + // Here one of the ancestors already exist and only the target_dir and + // its parent must be created. + at.mkdir(ancestor1); + + ucmd.args(&[directories_arg, target_dir]) + .succeeds() + .no_stderr(); + + assert!(at.dir_exists(ancestor2)); + assert!(at.dir_exists(target_dir)); +} + +#[test] +fn test_install_several_directories() { + let (at, mut ucmd) = at_and_ucmd!(); + let dir1 = "dir1"; + let dir2 = "dir2"; + let dir3 = "dir3"; + let directories_arg = "-d"; + + ucmd.args(&[directories_arg, dir1, dir2, dir3]) + .succeeds() + .no_stderr(); + + assert!(at.dir_exists(dir1)); + assert!(at.dir_exists(dir2)); + assert!(at.dir_exists(dir3)); } #[test] From 9151410d08bdf332a7edca93518810278aad5568 Mon Sep 17 00:00:00 2001 From: Sivachandran Date: Sat, 3 Apr 2021 01:44:56 +0530 Subject: [PATCH 0241/1135] csplit: move from getopts to clap (#1995) --- src/uu/csplit/Cargo.toml | 2 +- src/uu/csplit/src/csplit.rs | 139 +++++++++++++++++++++++------------- 2 files changed, 91 insertions(+), 50 deletions(-) diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index 68c6e2322..7cec4564b 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/csplit.rs" [dependencies] -getopts = "0.2.17" +clap = "2.33" thiserror = "1.0" regex = "1.0.0" glob = "0.2.11" diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index 7eb287522..ce11ba49a 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -2,7 +2,7 @@ #[macro_use] extern crate uucore; -use getopts::Matches; +use clap::{App, Arg, ArgMatches}; use regex::Regex; use std::cmp::Ordering; use std::io::{self, BufReader}; @@ -18,17 +18,25 @@ mod splitname; use crate::csplit_error::CsplitError; use crate::splitname::SplitName; -static SYNTAX: &str = "[OPTION]... FILE PATTERN..."; +static VERSION: &str = env!("CARGO_PKG_VERSION"); static SUMMARY: &str = "split a file into sections determined by context lines"; static LONG_HELP: &str = "Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output."; -static SUFFIX_FORMAT_OPT: &str = "suffix-format"; -static SUPPRESS_MATCHED_OPT: &str = "suppress-matched"; -static DIGITS_OPT: &str = "digits"; -static PREFIX_OPT: &str = "prefix"; -static KEEP_FILES_OPT: &str = "keep-files"; -static QUIET_OPT: &str = "quiet"; -static ELIDE_EMPTY_FILES_OPT: &str = "elide-empty-files"; +mod options { + pub const SUFFIX_FORMAT: &str = "suffix-format"; + pub const SUPPRESS_MATCHED: &str = "suppress-matched"; + pub const DIGITS: &str = "digits"; + pub const PREFIX: &str = "prefix"; + pub const KEEP_FILES: &str = "keep-files"; + pub const QUIET: &str = "quiet"; + pub const ELIDE_EMPTY_FILES: &str = "elide-empty-files"; + pub const FILE: &str = "file"; + pub const PATTERN: &str = "pattern"; +} + +fn get_usage() -> String { + format!("{0} [OPTION]... FILE PATTERN...", executable!()) +} /// Command line options for csplit. pub struct CsplitOptions { @@ -40,19 +48,19 @@ pub struct CsplitOptions { } impl CsplitOptions { - fn new(matches: &Matches) -> CsplitOptions { - let keep_files = matches.opt_present(KEEP_FILES_OPT); - let quiet = matches.opt_present(QUIET_OPT); - let elide_empty_files = matches.opt_present(ELIDE_EMPTY_FILES_OPT); - let suppress_matched = matches.opt_present(SUPPRESS_MATCHED_OPT); + fn new(matches: &ArgMatches) -> CsplitOptions { + let keep_files = matches.is_present(options::KEEP_FILES); + let quiet = matches.is_present(options::QUIET); + let elide_empty_files = matches.is_present(options::ELIDE_EMPTY_FILES); + let suppress_matched = matches.is_present(options::SUPPRESS_MATCHED); CsplitOptions { split_name: crash_if_err!( 1, SplitName::new( - matches.opt_str(PREFIX_OPT), - matches.opt_str(SUFFIX_FORMAT_OPT), - matches.opt_str(DIGITS_OPT) + matches.value_of(options::PREFIX).map(str::to_string), + matches.value_of(options::SUFFIX_FORMAT).map(str::to_string), + matches.value_of(options::DIGITS).map(str::to_string) ) ), keep_files, @@ -702,45 +710,78 @@ mod tests { } pub fn uumain(args: impl uucore::Args) -> i32 { + let usage = get_usage(); let args = args.collect_str(); - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optopt( - "b", - SUFFIX_FORMAT_OPT, - "use sprintf FORMAT instead of %02d", - "FORMAT", + let matches = App::new(executable!()) + .version(VERSION) + .about(SUMMARY) + .usage(&usage[..]) + .arg( + Arg::with_name(options::SUFFIX_FORMAT) + .short("b") + .long(options::SUFFIX_FORMAT) + .value_name("FORMAT") + .help("use sprintf FORMAT instead of %02d"), ) - .optopt("f", PREFIX_OPT, "use PREFIX instead of 'xx'", "PREFIX") - .optflag("k", KEEP_FILES_OPT, "do not remove output files on errors") - .optflag( - "", - SUPPRESS_MATCHED_OPT, - "suppress the lines matching PATTERN", + .arg( + Arg::with_name(options::PREFIX) + .short("f") + .long(options::PREFIX) + .value_name("PREFIX") + .help("use PREFIX instead of 'xx'"), ) - .optopt( - "n", - DIGITS_OPT, - "use specified number of digits instead of 2", - "DIGITS", + .arg( + Arg::with_name(options::KEEP_FILES) + .short("k") + .long(options::KEEP_FILES) + .help("do not remove output files on errors"), ) - .optflag("s", QUIET_OPT, "do not print counts of output file sizes") - .optflag("z", ELIDE_EMPTY_FILES_OPT, "remove empty output files") - .parse(args); + .arg( + Arg::with_name(options::SUPPRESS_MATCHED) + .long(options::SUPPRESS_MATCHED) + .help("suppress the lines matching PATTERN"), + ) + .arg( + Arg::with_name(options::DIGITS) + .short("n") + .long(options::DIGITS) + .value_name("DIGITS") + .help("use specified number of digits instead of 2"), + ) + .arg( + Arg::with_name(options::QUIET) + .short("s") + .long(options::QUIET) + .visible_alias("silent") + .help("do not print counts of output file sizes"), + ) + .arg( + Arg::with_name(options::ELIDE_EMPTY_FILES) + .short("z") + .long(options::ELIDE_EMPTY_FILES) + .help("remove empty output files"), + ) + .arg(Arg::with_name(options::FILE).hidden(true).required(true)) + .arg( + Arg::with_name(options::PATTERN) + .hidden(true) + .multiple(true) + .required(true), + ) + .after_help(LONG_HELP) + .get_matches_from(args); - // check for mandatory arguments - if matches.free.is_empty() { - show_error!("missing operand"); - exit!(1); - } - if matches.free.len() == 1 { - show_error!("missing operand after '{}'", matches.free[0]); - exit!(1); - } - // get the patterns to split on - let patterns = return_if_err!(1, patterns::get_patterns(&matches.free[1..])); // get the file to split - let file_name: &str = &matches.free[0]; + let file_name = matches.value_of(options::FILE).unwrap(); + + // get the patterns to split on + let patterns: Vec = matches + .values_of(options::PATTERN) + .unwrap() + .map(str::to_string) + .collect(); + let patterns = return_if_err!(1, patterns::get_patterns(&patterns[..])); let options = CsplitOptions::new(&matches); if file_name == "-" { let stdin = io::stdin(); From 9fbed0b07ae171f2bdddc7cd0837ec2329ae0e3c Mon Sep 17 00:00:00 2001 From: Sandro Date: Fri, 2 Apr 2021 22:18:31 +0200 Subject: [PATCH 0242/1135] makefile: replace all uutils with coreutils (#1815) Co-authored-by: Sylvestre Ledru --- GNUmakefile | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index c4c9cbe8b..409a527cd 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -30,7 +30,7 @@ ifneq ($(.SHELLSTATUS),0) override INSTALLDIR_MAN=$(DESTDIR)$(PREFIX)$(MANDIR) endif -#prefix to apply to uutils binary and all tool binaries +#prefix to apply to coreutils binary and all tool binaries PROG_PREFIX ?= # This won't support any directory with spaces in its name, but you can just @@ -237,7 +237,7 @@ EXES := \ INSTALLEES := ${EXES} ifeq (${MULTICALL}, y) -INSTALLEES := ${INSTALLEES} uutils +INSTALLEES := ${INSTALLEES} coreutils endif all: build @@ -250,13 +250,13 @@ ifneq (${MULTICALL}, y) ${CARGO} build ${CARGOFLAGS} ${PROFILE_CMD} $(foreach pkg,$(EXES),-p uu_$(pkg)) endif -build-uutils: +build-coreutils: ${CARGO} build ${CARGOFLAGS} --features "${EXES}" ${PROFILE_CMD} --no-default-features build-manpages: cd $(DOCSDIR) && $(MAKE) man -build: build-uutils build-pkgs build-manpages +build: build-coreutils build-pkgs build-manpages $(foreach test,$(filter-out $(SKIP_UTILS),$(PROGS)),$(eval $(call TEST_BUSYBOX,$(test)))) @@ -275,7 +275,7 @@ $(BUILDDIR)/.config: $(BASEDIR)/.busybox-config cp $< $@ # Test under the busybox testsuite -$(BUILDDIR)/busybox: busybox-src build-uutils $(BUILDDIR)/.config +$(BUILDDIR)/busybox: busybox-src build-coreutils $(BUILDDIR)/.config cp $(BUILDDIR)/coreutils $(BUILDDIR)/busybox; \ chmod +x $@; @@ -298,10 +298,10 @@ install: build mkdir -p $(INSTALLDIR_BIN) mkdir -p $(INSTALLDIR_MAN) ifeq (${MULTICALL}, y) - $(INSTALL) $(BUILDDIR)/uutils $(INSTALLDIR_BIN)/$(PROG_PREFIX)uutils - cd $(INSTALLDIR_BIN) && $(foreach prog, $(filter-out uutils, $(INSTALLEES)), \ - ln -fs $(PROG_PREFIX)uutils $(PROG_PREFIX)$(prog) &&) : - cat $(DOCSDIR)/_build/man/uutils.1 | gzip > $(INSTALLDIR_MAN)/$(PROG_PREFIX)uutils.1.gz + $(INSTALL) $(BUILDDIR)/coreutils $(INSTALLDIR_BIN)/$(PROG_PREFIX)coreutils + cd $(INSTALLDIR_BIN) && $(foreach prog, $(filter-out coreutils, $(INSTALLEES)), \ + ln -fs $(PROG_PREFIX)coreutils $(PROG_PREFIX)$(prog) &&) : + cat $(DOCSDIR)/_build/man/coreutils.1 | gzip > $(INSTALLDIR_MAN)/$(PROG_PREFIX)coreutils.1.gz else $(foreach prog, $(INSTALLEES), \ $(INSTALL) $(BUILDDIR)/$(prog) $(INSTALLDIR_BIN)/$(PROG_PREFIX)$(prog);) @@ -311,10 +311,10 @@ endif uninstall: ifeq (${MULTICALL}, y) - rm -f $(addprefix $(INSTALLDIR_BIN)/,$(PROG_PREFIX)uutils) + rm -f $(addprefix $(INSTALLDIR_BIN)/,$(PROG_PREFIX)coreutils) endif - rm -f $(addprefix $(INSTALLDIR_MAN)/,$(PROG_PREFIX)uutils.1.gz) + rm -f $(addprefix $(INSTALLDIR_MAN)/,$(PROG_PREFIX)coreutils.1.gz) rm -f $(addprefix $(INSTALLDIR_BIN)/$(PROG_PREFIX),$(PROGS)) rm -f $(addprefix $(INSTALLDIR_MAN)/$(PROG_PREFIX),$(addsuffix .1.gz,$(PROGS))) -.PHONY: all build build-uutils build-pkgs build-docs test distclean clean busytest install uninstall +.PHONY: all build build-coreutils build-pkgs build-docs test distclean clean busytest install uninstall From 31f566672768d941a74169a90476400a8d1cd212 Mon Sep 17 00:00:00 2001 From: Jamie Quigley Date: Fri, 2 Apr 2021 21:34:02 +0100 Subject: [PATCH 0243/1135] more: add error message if the argument is a directory (#1983) --- src/uu/more/src/more.rs | 12 ++++++++++-- tests/by-util/test_more.rs | 11 +++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 981b5f502..59e7d0faa 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -41,7 +41,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .version(VERSION) - .usage(&usage[..]) + .usage(usage.as_str()) .about(ABOUT) .arg( Arg::with_name(options::FILE) @@ -52,10 +52,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // FixME: fail without panic for now; but `more` should work with no arguments (ie, for piped input) if let None | Some("-") = matches.value_of(options::FILE) { - println!("{}: incorrect usage", executable!()); + show_usage_error!("Reading from stdin isn't supported yet."); return 1; } + if let Some(x) = matches.value_of(options::FILE) { + let path = std::path::Path::new(x); + if path.is_dir() { + show_usage_error!("'{}' is a directory.", x); + return 1; + } + } + more(matches); 0 diff --git a/tests/by-util/test_more.rs b/tests/by-util/test_more.rs index 3b7cfa9a8..736fb6956 100644 --- a/tests/by-util/test_more.rs +++ b/tests/by-util/test_more.rs @@ -6,3 +6,14 @@ fn test_more_no_arg() { let result = ucmd.run(); assert!(!result.success); } + +#[test] +fn test_more_dir_arg() { + let (_, mut ucmd) = at_and_ucmd!(); + ucmd.arg("."); + let result = ucmd.run(); + assert!(!result.success); + const EXPECTED_ERROR_MESSAGE: &str = + "more: '.' is a directory.\nTry 'more --help' for more information."; + assert_eq!(result.stderr.trim(), EXPECTED_ERROR_MESSAGE); +} From 14a49edd1cb9a841b390d796557e08d2b37d0039 Mon Sep 17 00:00:00 2001 From: est31 Date: Fri, 2 Apr 2021 23:30:07 +0200 Subject: [PATCH 0244/1135] Use Iterator::copied() in sieve.rs (#1774) --- src/uu/factor/sieve.rs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/uu/factor/sieve.rs b/src/uu/factor/sieve.rs index c10321a7f..083efb3ef 100644 --- a/src/uu/factor/sieve.rs +++ b/src/uu/factor/sieve.rs @@ -7,7 +7,7 @@ // spell-checker:ignore (ToDO) filts, minidx, minkey paridx -use std::iter::{Chain, Cycle, Map}; +use std::iter::{Chain, Cycle, Copied}; use std::slice::Iter; /// A lazy Sieve of Eratosthenes. @@ -68,27 +68,17 @@ impl Sieve { #[allow(dead_code)] #[inline] pub fn primes() -> PrimeSieve { - #[allow(clippy::trivially_copy_pass_by_ref)] - fn deref(x: &u64) -> u64 { - *x - } - let deref = deref as fn(&u64) -> u64; - INIT_PRIMES.iter().map(deref).chain(Sieve::new()) + INIT_PRIMES.iter().copied().chain(Sieve::new()) } #[allow(dead_code)] #[inline] pub fn odd_primes() -> PrimeSieve { - #[allow(clippy::trivially_copy_pass_by_ref)] - fn deref(x: &u64) -> u64 { - *x - } - let deref = deref as fn(&u64) -> u64; - (&INIT_PRIMES[1..]).iter().map(deref).chain(Sieve::new()) + (&INIT_PRIMES[1..]).iter().copied().chain(Sieve::new()) } } -pub type PrimeSieve = Chain, fn(&u64) -> u64>, Sieve>; +pub type PrimeSieve = Chain>, Sieve>; /// An iterator that generates an infinite list of numbers that are /// not divisible by any of 2, 3, 5, or 7. From 2ef1b25d856774c553624d5ed909a2f300445054 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 2 Apr 2021 22:22:50 +0200 Subject: [PATCH 0245/1135] Create a new job to test make build --- .github/workflows/CICD.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index f1ddf9be1..a1683ab83 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -181,6 +181,28 @@ jobs: cd tmp/busybox-*/testsuite S=$(bindir=$bindir ./runtest) && printf "%s\n" "$S" || { printf "%s\n" "$S" | grep "FAIL:" | sed -e "s/FAIL: /::warning ::Test failure:/g" ; } + makefile_build: + name: Test the build target of the Makefile + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + - { os: ubuntu-latest } + steps: + - uses: actions/checkout@v1 + - name: Install `rust` toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + profile: minimal # minimal component installation (ie, no documentation) + - name: "Run make build" + shell: bash + run: | + sudo apt-get -y update ; sudo apt-get -y install python3-sphinx; + make build + build: name: Build runs-on: ${{ matrix.job.os }} From f10de40ab8fe7159392a358d2c67b8ac7dc49b63 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 2 Apr 2021 22:27:11 +0200 Subject: [PATCH 0246/1135] refresh cargo.lock with recent updates --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 88984362b..8806588ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1668,7 +1668,7 @@ dependencies = [ name = "uu_csplit" version = "0.0.4" dependencies = [ - "getopts", + "clap", "glob 0.2.11", "regex", "thiserror", From 4d7ad7743323dc5197866f2ae1f142cc6687fa98 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 2 Apr 2021 23:31:22 +0200 Subject: [PATCH 0247/1135] rustfmt the recent change --- src/uu/factor/sieve.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/factor/sieve.rs b/src/uu/factor/sieve.rs index 083efb3ef..41893699b 100644 --- a/src/uu/factor/sieve.rs +++ b/src/uu/factor/sieve.rs @@ -7,7 +7,7 @@ // spell-checker:ignore (ToDO) filts, minidx, minkey paridx -use std::iter::{Chain, Cycle, Copied}; +use std::iter::{Chain, Copied, Cycle}; use std::slice::Iter; /// A lazy Sieve of Eratosthenes. From ac031dffa45fc3c3ca26538109965b3389986191 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 3 Apr 2021 10:28:12 +0200 Subject: [PATCH 0248/1135] new release 0.0.5 --- Cargo.lock | 196 ++++++++++++------------- Cargo.toml | 196 ++++++++++++------------- src/uu/arch/Cargo.toml | 4 +- src/uu/base32/Cargo.toml | 4 +- src/uu/base64/Cargo.toml | 4 +- src/uu/basename/Cargo.toml | 4 +- src/uu/cat/Cargo.toml | 4 +- src/uu/chgrp/Cargo.toml | 4 +- src/uu/chmod/Cargo.toml | 4 +- src/uu/chown/Cargo.toml | 4 +- src/uu/chroot/Cargo.toml | 4 +- src/uu/cksum/Cargo.toml | 4 +- src/uu/comm/Cargo.toml | 4 +- src/uu/cp/Cargo.toml | 4 +- src/uu/csplit/Cargo.toml | 4 +- src/uu/cut/Cargo.toml | 4 +- src/uu/date/Cargo.toml | 4 +- src/uu/df/Cargo.toml | 4 +- src/uu/dircolors/Cargo.toml | 4 +- src/uu/dirname/Cargo.toml | 4 +- src/uu/du/Cargo.toml | 4 +- src/uu/echo/Cargo.toml | 4 +- src/uu/env/Cargo.toml | 4 +- src/uu/expand/Cargo.toml | 4 +- src/uu/expr/Cargo.toml | 4 +- src/uu/factor/Cargo.toml | 4 +- src/uu/false/Cargo.toml | 4 +- src/uu/fmt/Cargo.toml | 4 +- src/uu/fold/Cargo.toml | 4 +- src/uu/groups/Cargo.toml | 4 +- src/uu/hashsum/Cargo.toml | 4 +- src/uu/head/Cargo.toml | 4 +- src/uu/hostid/Cargo.toml | 4 +- src/uu/hostname/Cargo.toml | 4 +- src/uu/id/Cargo.toml | 4 +- src/uu/install/Cargo.toml | 4 +- src/uu/join/Cargo.toml | 4 +- src/uu/kill/Cargo.toml | 4 +- src/uu/link/Cargo.toml | 4 +- src/uu/ln/Cargo.toml | 4 +- src/uu/logname/Cargo.toml | 4 +- src/uu/ls/Cargo.toml | 4 +- src/uu/mkdir/Cargo.toml | 4 +- src/uu/mkfifo/Cargo.toml | 4 +- src/uu/mknod/Cargo.toml | 4 +- src/uu/mktemp/Cargo.toml | 4 +- src/uu/more/Cargo.toml | 2 +- src/uu/mv/Cargo.toml | 4 +- src/uu/nice/Cargo.toml | 4 +- src/uu/nl/Cargo.toml | 4 +- src/uu/nohup/Cargo.toml | 4 +- src/uu/nproc/Cargo.toml | 4 +- src/uu/numfmt/Cargo.toml | 4 +- src/uu/od/Cargo.toml | 4 +- src/uu/paste/Cargo.toml | 4 +- src/uu/pathchk/Cargo.toml | 4 +- src/uu/pinky/Cargo.toml | 4 +- src/uu/printenv/Cargo.toml | 4 +- src/uu/printf/Cargo.toml | 4 +- src/uu/ptx/Cargo.toml | 4 +- src/uu/pwd/Cargo.toml | 4 +- src/uu/readlink/Cargo.toml | 4 +- src/uu/realpath/Cargo.toml | 4 +- src/uu/relpath/Cargo.toml | 4 +- src/uu/rm/Cargo.toml | 4 +- src/uu/rmdir/Cargo.toml | 4 +- src/uu/seq/Cargo.toml | 4 +- src/uu/shred/Cargo.toml | 4 +- src/uu/shuf/Cargo.toml | 4 +- src/uu/sleep/Cargo.toml | 4 +- src/uu/sort/Cargo.toml | 4 +- src/uu/split/Cargo.toml | 4 +- src/uu/stat/Cargo.toml | 4 +- src/uu/stdbuf/Cargo.toml | 6 +- src/uu/stdbuf/src/libstdbuf/Cargo.toml | 4 +- src/uu/sum/Cargo.toml | 4 +- src/uu/sync/Cargo.toml | 4 +- src/uu/tac/Cargo.toml | 4 +- src/uu/tail/Cargo.toml | 4 +- src/uu/tee/Cargo.toml | 4 +- src/uu/test/Cargo.toml | 4 +- src/uu/timeout/Cargo.toml | 4 +- src/uu/touch/Cargo.toml | 4 +- src/uu/tr/Cargo.toml | 4 +- src/uu/true/Cargo.toml | 4 +- src/uu/truncate/Cargo.toml | 4 +- src/uu/tsort/Cargo.toml | 4 +- src/uu/tty/Cargo.toml | 4 +- src/uu/uname/Cargo.toml | 4 +- src/uu/unexpand/Cargo.toml | 4 +- src/uu/uniq/Cargo.toml | 4 +- src/uu/unlink/Cargo.toml | 4 +- src/uu/uptime/Cargo.toml | 4 +- src/uu/users/Cargo.toml | 4 +- src/uu/wc/Cargo.toml | 4 +- src/uu/who/Cargo.toml | 4 +- src/uu/whoami/Cargo.toml | 4 +- src/uu/yes/Cargo.toml | 4 +- src/uucore/Cargo.toml | 2 +- util/update-version.sh | 8 +- 100 files changed, 393 insertions(+), 393 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8806588ac..e5eb65a92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -204,7 +204,7 @@ dependencies = [ [[package]] name = "coreutils" -version = "0.0.4" +version = "0.0.5" dependencies = [ "conv", "filetime", @@ -1545,7 +1545,7 @@ dependencies = [ [[package]] name = "uu_arch" -version = "0.0.4" +version = "0.0.5" dependencies = [ "platform-info", "uucore", @@ -1554,7 +1554,7 @@ dependencies = [ [[package]] name = "uu_base32" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -1562,7 +1562,7 @@ dependencies = [ [[package]] name = "uu_base64" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -1570,7 +1570,7 @@ dependencies = [ [[package]] name = "uu_basename" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -1578,7 +1578,7 @@ dependencies = [ [[package]] name = "uu_cat" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "nix 0.20.0", @@ -1590,7 +1590,7 @@ dependencies = [ [[package]] name = "uu_chgrp" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -1599,7 +1599,7 @@ dependencies = [ [[package]] name = "uu_chmod" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1610,7 +1610,7 @@ dependencies = [ [[package]] name = "uu_chown" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "glob 0.3.0", @@ -1621,7 +1621,7 @@ dependencies = [ [[package]] name = "uu_chroot" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -1630,7 +1630,7 @@ dependencies = [ [[package]] name = "uu_cksum" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1640,7 +1640,7 @@ dependencies = [ [[package]] name = "uu_comm" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1650,7 +1650,7 @@ dependencies = [ [[package]] name = "uu_cp" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "filetime", @@ -1666,7 +1666,7 @@ dependencies = [ [[package]] name = "uu_csplit" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "glob 0.2.11", @@ -1678,7 +1678,7 @@ dependencies = [ [[package]] name = "uu_cut" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -1686,7 +1686,7 @@ dependencies = [ [[package]] name = "uu_date" -version = "0.0.4" +version = "0.0.5" dependencies = [ "chrono", "clap", @@ -1698,7 +1698,7 @@ dependencies = [ [[package]] name = "uu_df" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1710,7 +1710,7 @@ dependencies = [ [[package]] name = "uu_dircolors" -version = "0.0.4" +version = "0.0.5" dependencies = [ "glob 0.3.0", "uucore", @@ -1719,7 +1719,7 @@ dependencies = [ [[package]] name = "uu_dirname" -version = "0.0.4" +version = "0.0.5" dependencies = [ "libc", "uucore", @@ -1728,7 +1728,7 @@ dependencies = [ [[package]] name = "uu_du" -version = "0.0.4" +version = "0.0.5" dependencies = [ "time", "uucore", @@ -1738,7 +1738,7 @@ dependencies = [ [[package]] name = "uu_echo" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -1747,7 +1747,7 @@ dependencies = [ [[package]] name = "uu_env" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1758,7 +1758,7 @@ dependencies = [ [[package]] name = "uu_expand" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "unicode-width", @@ -1768,7 +1768,7 @@ dependencies = [ [[package]] name = "uu_expr" -version = "0.0.4" +version = "0.0.5" dependencies = [ "libc", "onig", @@ -1778,7 +1778,7 @@ dependencies = [ [[package]] name = "uu_factor" -version = "0.0.4" +version = "0.0.5" dependencies = [ "criterion", "num-traits", @@ -1793,7 +1793,7 @@ dependencies = [ [[package]] name = "uu_false" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -1801,7 +1801,7 @@ dependencies = [ [[package]] name = "uu_fmt" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1812,7 +1812,7 @@ dependencies = [ [[package]] name = "uu_fold" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -1820,7 +1820,7 @@ dependencies = [ [[package]] name = "uu_groups" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -1829,7 +1829,7 @@ dependencies = [ [[package]] name = "uu_hashsum" -version = "0.0.4" +version = "0.0.5" dependencies = [ "blake2-rfc", "clap", @@ -1848,7 +1848,7 @@ dependencies = [ [[package]] name = "uu_head" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -1857,7 +1857,7 @@ dependencies = [ [[package]] name = "uu_hostid" -version = "0.0.4" +version = "0.0.5" dependencies = [ "libc", "uucore", @@ -1866,7 +1866,7 @@ dependencies = [ [[package]] name = "uu_hostname" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "hostname", @@ -1878,7 +1878,7 @@ dependencies = [ [[package]] name = "uu_id" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -1887,7 +1887,7 @@ dependencies = [ [[package]] name = "uu_install" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "file_diff", @@ -1900,7 +1900,7 @@ dependencies = [ [[package]] name = "uu_join" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -1909,7 +1909,7 @@ dependencies = [ [[package]] name = "uu_kill" -version = "0.0.4" +version = "0.0.5" dependencies = [ "libc", "uucore", @@ -1918,7 +1918,7 @@ dependencies = [ [[package]] name = "uu_link" -version = "0.0.4" +version = "0.0.5" dependencies = [ "libc", "uucore", @@ -1927,7 +1927,7 @@ dependencies = [ [[package]] name = "uu_ln" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1937,7 +1937,7 @@ dependencies = [ [[package]] name = "uu_logname" -version = "0.0.4" +version = "0.0.5" dependencies = [ "libc", "uucore", @@ -1946,7 +1946,7 @@ dependencies = [ [[package]] name = "uu_ls" -version = "0.0.4" +version = "0.0.5" dependencies = [ "atty", "clap", @@ -1962,7 +1962,7 @@ dependencies = [ [[package]] name = "uu_mkdir" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1972,7 +1972,7 @@ dependencies = [ [[package]] name = "uu_mkfifo" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1982,7 +1982,7 @@ dependencies = [ [[package]] name = "uu_mknod" -version = "0.0.4" +version = "0.0.5" dependencies = [ "getopts", "libc", @@ -1992,7 +1992,7 @@ dependencies = [ [[package]] name = "uu_mktemp" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "rand 0.5.6", @@ -2003,7 +2003,7 @@ dependencies = [ [[package]] name = "uu_more" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "nix 0.13.1", @@ -2015,7 +2015,7 @@ dependencies = [ [[package]] name = "uu_mv" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "fs_extra", @@ -2025,7 +2025,7 @@ dependencies = [ [[package]] name = "uu_nice" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2036,7 +2036,7 @@ dependencies = [ [[package]] name = "uu_nl" -version = "0.0.4" +version = "0.0.5" dependencies = [ "aho-corasick", "clap", @@ -2050,7 +2050,7 @@ dependencies = [ [[package]] name = "uu_nohup" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2060,7 +2060,7 @@ dependencies = [ [[package]] name = "uu_nproc" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2071,7 +2071,7 @@ dependencies = [ [[package]] name = "uu_numfmt" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2080,7 +2080,7 @@ dependencies = [ [[package]] name = "uu_od" -version = "0.0.4" +version = "0.0.5" dependencies = [ "byteorder", "clap", @@ -2092,7 +2092,7 @@ dependencies = [ [[package]] name = "uu_paste" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2101,7 +2101,7 @@ dependencies = [ [[package]] name = "uu_pathchk" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2111,7 +2111,7 @@ dependencies = [ [[package]] name = "uu_pinky" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -2119,7 +2119,7 @@ dependencies = [ [[package]] name = "uu_printenv" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2128,7 +2128,7 @@ dependencies = [ [[package]] name = "uu_printf" -version = "0.0.4" +version = "0.0.5" dependencies = [ "itertools 0.8.2", "uucore", @@ -2137,7 +2137,7 @@ dependencies = [ [[package]] name = "uu_ptx" -version = "0.0.4" +version = "0.0.5" dependencies = [ "aho-corasick", "clap", @@ -2151,7 +2151,7 @@ dependencies = [ [[package]] name = "uu_pwd" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2160,7 +2160,7 @@ dependencies = [ [[package]] name = "uu_readlink" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2170,7 +2170,7 @@ dependencies = [ [[package]] name = "uu_realpath" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2179,7 +2179,7 @@ dependencies = [ [[package]] name = "uu_relpath" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2188,7 +2188,7 @@ dependencies = [ [[package]] name = "uu_rm" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "remove_dir_all", @@ -2199,7 +2199,7 @@ dependencies = [ [[package]] name = "uu_rmdir" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2208,7 +2208,7 @@ dependencies = [ [[package]] name = "uu_seq" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2217,7 +2217,7 @@ dependencies = [ [[package]] name = "uu_shred" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "filetime", @@ -2230,7 +2230,7 @@ dependencies = [ [[package]] name = "uu_shuf" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "rand 0.5.6", @@ -2240,7 +2240,7 @@ dependencies = [ [[package]] name = "uu_sleep" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2249,7 +2249,7 @@ dependencies = [ [[package]] name = "uu_sort" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "itertools 0.8.2", @@ -2262,7 +2262,7 @@ dependencies = [ [[package]] name = "uu_split" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2271,7 +2271,7 @@ dependencies = [ [[package]] name = "uu_stat" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "time", @@ -2281,7 +2281,7 @@ dependencies = [ [[package]] name = "uu_stdbuf" -version = "0.0.4" +version = "0.0.5" dependencies = [ "getopts", "tempfile", @@ -2292,7 +2292,7 @@ dependencies = [ [[package]] name = "uu_stdbuf_libstdbuf" -version = "0.0.4" +version = "0.0.5" dependencies = [ "cpp", "cpp_build", @@ -2303,7 +2303,7 @@ dependencies = [ [[package]] name = "uu_sum" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2312,7 +2312,7 @@ dependencies = [ [[package]] name = "uu_sync" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2323,7 +2323,7 @@ dependencies = [ [[package]] name = "uu_tac" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2332,7 +2332,7 @@ dependencies = [ [[package]] name = "uu_tail" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2344,7 +2344,7 @@ dependencies = [ [[package]] name = "uu_tee" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2355,7 +2355,7 @@ dependencies = [ [[package]] name = "uu_test" -version = "0.0.4" +version = "0.0.5" dependencies = [ "libc", "redox_syscall 0.1.57", @@ -2365,7 +2365,7 @@ dependencies = [ [[package]] name = "uu_timeout" -version = "0.0.4" +version = "0.0.5" dependencies = [ "getopts", "libc", @@ -2375,7 +2375,7 @@ dependencies = [ [[package]] name = "uu_touch" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "filetime", @@ -2386,7 +2386,7 @@ dependencies = [ [[package]] name = "uu_tr" -version = "0.0.4" +version = "0.0.5" dependencies = [ "bit-set", "clap", @@ -2397,7 +2397,7 @@ dependencies = [ [[package]] name = "uu_true" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -2405,7 +2405,7 @@ dependencies = [ [[package]] name = "uu_truncate" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2414,7 +2414,7 @@ dependencies = [ [[package]] name = "uu_tsort" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2423,7 +2423,7 @@ dependencies = [ [[package]] name = "uu_tty" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2433,7 +2433,7 @@ dependencies = [ [[package]] name = "uu_uname" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "platform-info", @@ -2443,7 +2443,7 @@ dependencies = [ [[package]] name = "uu_unexpand" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "unicode-width", @@ -2453,7 +2453,7 @@ dependencies = [ [[package]] name = "uu_uniq" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2462,7 +2462,7 @@ dependencies = [ [[package]] name = "uu_unlink" -version = "0.0.4" +version = "0.0.5" dependencies = [ "getopts", "libc", @@ -2472,7 +2472,7 @@ dependencies = [ [[package]] name = "uu_uptime" -version = "0.0.4" +version = "0.0.5" dependencies = [ "chrono", "clap", @@ -2482,7 +2482,7 @@ dependencies = [ [[package]] name = "uu_users" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2491,7 +2491,7 @@ dependencies = [ [[package]] name = "uu_wc" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2503,7 +2503,7 @@ dependencies = [ [[package]] name = "uu_who" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -2511,7 +2511,7 @@ dependencies = [ [[package]] name = "uu_whoami" -version = "0.0.4" +version = "0.0.5" dependencies = [ "advapi32-sys", "clap", @@ -2522,7 +2522,7 @@ dependencies = [ [[package]] name = "uu_yes" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2531,7 +2531,7 @@ dependencies = [ [[package]] name = "uucore" -version = "0.0.7" +version = "0.0.8" dependencies = [ "data-encoding", "dunce", diff --git a/Cargo.toml b/Cargo.toml index 1562fcfb0..398791ca9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "coreutils" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "coreutils ~ GNU coreutils (updated); implemented as universal (cross-platform) utils, written in Rust" @@ -226,104 +226,104 @@ test = [ "uu_test" ] [dependencies] 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.7", package="uucore", path="src/uucore" } +uucore = { version=">=0.0.8", package="uucore", path="src/uucore" } # * uutils -uu_test = { optional=true, version="0.0.4", package="uu_test", path="src/uu/test" } +uu_test = { optional=true, version="0.0.5", package="uu_test", path="src/uu/test" } # -arch = { optional=true, version="0.0.4", package="uu_arch", path="src/uu/arch" } -base32 = { optional=true, version="0.0.4", package="uu_base32", path="src/uu/base32" } -base64 = { optional=true, version="0.0.4", package="uu_base64", path="src/uu/base64" } -basename = { optional=true, version="0.0.4", package="uu_basename", path="src/uu/basename" } -cat = { optional=true, version="0.0.4", package="uu_cat", path="src/uu/cat" } -chgrp = { optional=true, version="0.0.4", package="uu_chgrp", path="src/uu/chgrp" } -chmod = { optional=true, version="0.0.4", package="uu_chmod", path="src/uu/chmod" } -chown = { optional=true, version="0.0.4", package="uu_chown", path="src/uu/chown" } -chroot = { optional=true, version="0.0.4", package="uu_chroot", path="src/uu/chroot" } -cksum = { optional=true, version="0.0.4", package="uu_cksum", path="src/uu/cksum" } -comm = { optional=true, version="0.0.4", package="uu_comm", path="src/uu/comm" } -cp = { optional=true, version="0.0.4", package="uu_cp", path="src/uu/cp" } -csplit = { optional=true, version="0.0.4", package="uu_csplit", path="src/uu/csplit" } -cut = { optional=true, version="0.0.4", package="uu_cut", path="src/uu/cut" } -date = { optional=true, version="0.0.4", package="uu_date", path="src/uu/date" } -df = { optional=true, version="0.0.4", package="uu_df", path="src/uu/df" } -dircolors= { optional=true, version="0.0.4", package="uu_dircolors", path="src/uu/dircolors" } -dirname = { optional=true, version="0.0.4", package="uu_dirname", path="src/uu/dirname" } -du = { optional=true, version="0.0.4", package="uu_du", path="src/uu/du" } -echo = { optional=true, version="0.0.4", package="uu_echo", path="src/uu/echo" } -env = { optional=true, version="0.0.4", package="uu_env", path="src/uu/env" } -expand = { optional=true, version="0.0.4", package="uu_expand", path="src/uu/expand" } -expr = { optional=true, version="0.0.4", package="uu_expr", path="src/uu/expr" } -factor = { optional=true, version="0.0.4", package="uu_factor", path="src/uu/factor" } -false = { optional=true, version="0.0.4", package="uu_false", path="src/uu/false" } -fmt = { optional=true, version="0.0.4", package="uu_fmt", path="src/uu/fmt" } -fold = { optional=true, version="0.0.4", package="uu_fold", path="src/uu/fold" } -groups = { optional=true, version="0.0.4", package="uu_groups", path="src/uu/groups" } -hashsum = { optional=true, version="0.0.4", package="uu_hashsum", path="src/uu/hashsum" } -head = { optional=true, version="0.0.4", package="uu_head", path="src/uu/head" } -hostid = { optional=true, version="0.0.4", package="uu_hostid", path="src/uu/hostid" } -hostname = { optional=true, version="0.0.4", package="uu_hostname", path="src/uu/hostname" } -id = { optional=true, version="0.0.4", package="uu_id", path="src/uu/id" } -install = { optional=true, version="0.0.4", package="uu_install", path="src/uu/install" } -join = { optional=true, version="0.0.4", package="uu_join", path="src/uu/join" } -kill = { optional=true, version="0.0.4", package="uu_kill", path="src/uu/kill" } -link = { optional=true, version="0.0.4", package="uu_link", path="src/uu/link" } -ln = { optional=true, version="0.0.4", package="uu_ln", path="src/uu/ln" } -ls = { optional=true, version="0.0.4", package="uu_ls", path="src/uu/ls" } -logname = { optional=true, version="0.0.4", package="uu_logname", path="src/uu/logname" } -mkdir = { optional=true, version="0.0.4", package="uu_mkdir", path="src/uu/mkdir" } -mkfifo = { optional=true, version="0.0.4", package="uu_mkfifo", path="src/uu/mkfifo" } -mknod = { optional=true, version="0.0.4", package="uu_mknod", path="src/uu/mknod" } -mktemp = { optional=true, version="0.0.4", package="uu_mktemp", path="src/uu/mktemp" } -more = { optional=true, version="0.0.4", package="uu_more", path="src/uu/more" } -mv = { optional=true, version="0.0.4", package="uu_mv", path="src/uu/mv" } -nice = { optional=true, version="0.0.4", package="uu_nice", path="src/uu/nice" } -nl = { optional=true, version="0.0.4", package="uu_nl", path="src/uu/nl" } -nohup = { optional=true, version="0.0.4", package="uu_nohup", path="src/uu/nohup" } -nproc = { optional=true, version="0.0.4", package="uu_nproc", path="src/uu/nproc" } -numfmt = { optional=true, version="0.0.4", package="uu_numfmt", path="src/uu/numfmt" } -od = { optional=true, version="0.0.4", package="uu_od", path="src/uu/od" } -paste = { optional=true, version="0.0.4", package="uu_paste", path="src/uu/paste" } -pathchk = { optional=true, version="0.0.4", package="uu_pathchk", path="src/uu/pathchk" } -pinky = { optional=true, version="0.0.4", package="uu_pinky", path="src/uu/pinky" } -printenv = { optional=true, version="0.0.4", package="uu_printenv", path="src/uu/printenv" } -printf = { optional=true, version="0.0.4", package="uu_printf", path="src/uu/printf" } -ptx = { optional=true, version="0.0.4", package="uu_ptx", path="src/uu/ptx" } -pwd = { optional=true, version="0.0.4", package="uu_pwd", path="src/uu/pwd" } -readlink = { optional=true, version="0.0.4", package="uu_readlink", path="src/uu/readlink" } -realpath = { optional=true, version="0.0.4", package="uu_realpath", path="src/uu/realpath" } -relpath = { optional=true, version="0.0.4", package="uu_relpath", path="src/uu/relpath" } -rm = { optional=true, version="0.0.4", package="uu_rm", path="src/uu/rm" } -rmdir = { optional=true, version="0.0.4", package="uu_rmdir", path="src/uu/rmdir" } -seq = { optional=true, version="0.0.4", package="uu_seq", path="src/uu/seq" } -shred = { optional=true, version="0.0.4", package="uu_shred", path="src/uu/shred" } -shuf = { optional=true, version="0.0.4", package="uu_shuf", path="src/uu/shuf" } -sleep = { optional=true, version="0.0.4", package="uu_sleep", path="src/uu/sleep" } -sort = { optional=true, version="0.0.4", package="uu_sort", path="src/uu/sort" } -split = { optional=true, version="0.0.4", package="uu_split", path="src/uu/split" } -stat = { optional=true, version="0.0.4", package="uu_stat", path="src/uu/stat" } -stdbuf = { optional=true, version="0.0.4", package="uu_stdbuf", path="src/uu/stdbuf" } -sum = { optional=true, version="0.0.4", package="uu_sum", path="src/uu/sum" } -sync = { optional=true, version="0.0.4", package="uu_sync", path="src/uu/sync" } -tac = { optional=true, version="0.0.4", package="uu_tac", path="src/uu/tac" } -tail = { optional=true, version="0.0.4", package="uu_tail", path="src/uu/tail" } -tee = { optional=true, version="0.0.4", package="uu_tee", path="src/uu/tee" } -timeout = { optional=true, version="0.0.4", package="uu_timeout", path="src/uu/timeout" } -touch = { optional=true, version="0.0.4", package="uu_touch", path="src/uu/touch" } -tr = { optional=true, version="0.0.4", package="uu_tr", path="src/uu/tr" } -true = { optional=true, version="0.0.4", package="uu_true", path="src/uu/true" } -truncate = { optional=true, version="0.0.4", package="uu_truncate", path="src/uu/truncate" } -tsort = { optional=true, version="0.0.4", package="uu_tsort", path="src/uu/tsort" } -tty = { optional=true, version="0.0.4", package="uu_tty", path="src/uu/tty" } -uname = { optional=true, version="0.0.4", package="uu_uname", path="src/uu/uname" } -unexpand = { optional=true, version="0.0.4", package="uu_unexpand", path="src/uu/unexpand" } -uniq = { optional=true, version="0.0.4", package="uu_uniq", path="src/uu/uniq" } -unlink = { optional=true, version="0.0.4", package="uu_unlink", path="src/uu/unlink" } -uptime = { optional=true, version="0.0.4", package="uu_uptime", path="src/uu/uptime" } -users = { optional=true, version="0.0.4", package="uu_users", path="src/uu/users" } -wc = { optional=true, version="0.0.4", package="uu_wc", path="src/uu/wc" } -who = { optional=true, version="0.0.4", package="uu_who", path="src/uu/who" } -whoami = { optional=true, version="0.0.4", package="uu_whoami", path="src/uu/whoami" } -yes = { optional=true, version="0.0.4", package="uu_yes", path="src/uu/yes" } +arch = { optional=true, version="0.0.5", package="uu_arch", path="src/uu/arch" } +base32 = { optional=true, version="0.0.5", package="uu_base32", path="src/uu/base32" } +base64 = { optional=true, version="0.0.5", package="uu_base64", path="src/uu/base64" } +basename = { optional=true, version="0.0.5", package="uu_basename", path="src/uu/basename" } +cat = { optional=true, version="0.0.5", package="uu_cat", path="src/uu/cat" } +chgrp = { optional=true, version="0.0.5", package="uu_chgrp", path="src/uu/chgrp" } +chmod = { optional=true, version="0.0.5", package="uu_chmod", path="src/uu/chmod" } +chown = { optional=true, version="0.0.5", package="uu_chown", path="src/uu/chown" } +chroot = { optional=true, version="0.0.5", package="uu_chroot", path="src/uu/chroot" } +cksum = { optional=true, version="0.0.5", package="uu_cksum", path="src/uu/cksum" } +comm = { optional=true, version="0.0.5", package="uu_comm", path="src/uu/comm" } +cp = { optional=true, version="0.0.5", package="uu_cp", path="src/uu/cp" } +csplit = { optional=true, version="0.0.5", package="uu_csplit", path="src/uu/csplit" } +cut = { optional=true, version="0.0.5", package="uu_cut", path="src/uu/cut" } +date = { optional=true, version="0.0.5", package="uu_date", path="src/uu/date" } +df = { optional=true, version="0.0.5", package="uu_df", path="src/uu/df" } +dircolors= { optional=true, version="0.0.5", package="uu_dircolors", path="src/uu/dircolors" } +dirname = { optional=true, version="0.0.5", package="uu_dirname", path="src/uu/dirname" } +du = { optional=true, version="0.0.5", package="uu_du", path="src/uu/du" } +echo = { optional=true, version="0.0.5", package="uu_echo", path="src/uu/echo" } +env = { optional=true, version="0.0.5", package="uu_env", path="src/uu/env" } +expand = { optional=true, version="0.0.5", package="uu_expand", path="src/uu/expand" } +expr = { optional=true, version="0.0.5", package="uu_expr", path="src/uu/expr" } +factor = { optional=true, version="0.0.5", package="uu_factor", path="src/uu/factor" } +false = { optional=true, version="0.0.5", package="uu_false", path="src/uu/false" } +fmt = { optional=true, version="0.0.5", package="uu_fmt", path="src/uu/fmt" } +fold = { optional=true, version="0.0.5", package="uu_fold", path="src/uu/fold" } +groups = { optional=true, version="0.0.5", package="uu_groups", path="src/uu/groups" } +hashsum = { optional=true, version="0.0.5", package="uu_hashsum", path="src/uu/hashsum" } +head = { optional=true, version="0.0.5", package="uu_head", path="src/uu/head" } +hostid = { optional=true, version="0.0.5", package="uu_hostid", path="src/uu/hostid" } +hostname = { optional=true, version="0.0.5", package="uu_hostname", path="src/uu/hostname" } +id = { optional=true, version="0.0.5", package="uu_id", path="src/uu/id" } +install = { optional=true, version="0.0.5", package="uu_install", path="src/uu/install" } +join = { optional=true, version="0.0.5", package="uu_join", path="src/uu/join" } +kill = { optional=true, version="0.0.5", package="uu_kill", path="src/uu/kill" } +link = { optional=true, version="0.0.5", package="uu_link", path="src/uu/link" } +ln = { optional=true, version="0.0.5", package="uu_ln", path="src/uu/ln" } +ls = { optional=true, version="0.0.5", package="uu_ls", path="src/uu/ls" } +logname = { optional=true, version="0.0.5", package="uu_logname", path="src/uu/logname" } +mkdir = { optional=true, version="0.0.5", package="uu_mkdir", path="src/uu/mkdir" } +mkfifo = { optional=true, version="0.0.5", package="uu_mkfifo", path="src/uu/mkfifo" } +mknod = { optional=true, version="0.0.5", package="uu_mknod", path="src/uu/mknod" } +mktemp = { optional=true, version="0.0.5", package="uu_mktemp", path="src/uu/mktemp" } +more = { optional=true, version="0.0.5", package="uu_more", path="src/uu/more" } +mv = { optional=true, version="0.0.5", package="uu_mv", path="src/uu/mv" } +nice = { optional=true, version="0.0.5", package="uu_nice", path="src/uu/nice" } +nl = { optional=true, version="0.0.5", package="uu_nl", path="src/uu/nl" } +nohup = { optional=true, version="0.0.5", package="uu_nohup", path="src/uu/nohup" } +nproc = { optional=true, version="0.0.5", package="uu_nproc", path="src/uu/nproc" } +numfmt = { optional=true, version="0.0.5", package="uu_numfmt", path="src/uu/numfmt" } +od = { optional=true, version="0.0.5", package="uu_od", path="src/uu/od" } +paste = { optional=true, version="0.0.5", package="uu_paste", path="src/uu/paste" } +pathchk = { optional=true, version="0.0.5", package="uu_pathchk", path="src/uu/pathchk" } +pinky = { optional=true, version="0.0.5", package="uu_pinky", path="src/uu/pinky" } +printenv = { optional=true, version="0.0.5", package="uu_printenv", path="src/uu/printenv" } +printf = { optional=true, version="0.0.5", package="uu_printf", path="src/uu/printf" } +ptx = { optional=true, version="0.0.5", package="uu_ptx", path="src/uu/ptx" } +pwd = { optional=true, version="0.0.5", package="uu_pwd", path="src/uu/pwd" } +readlink = { optional=true, version="0.0.5", package="uu_readlink", path="src/uu/readlink" } +realpath = { optional=true, version="0.0.5", package="uu_realpath", path="src/uu/realpath" } +relpath = { optional=true, version="0.0.5", package="uu_relpath", path="src/uu/relpath" } +rm = { optional=true, version="0.0.5", package="uu_rm", path="src/uu/rm" } +rmdir = { optional=true, version="0.0.5", package="uu_rmdir", path="src/uu/rmdir" } +seq = { optional=true, version="0.0.5", package="uu_seq", path="src/uu/seq" } +shred = { optional=true, version="0.0.5", package="uu_shred", path="src/uu/shred" } +shuf = { optional=true, version="0.0.5", package="uu_shuf", path="src/uu/shuf" } +sleep = { optional=true, version="0.0.5", package="uu_sleep", path="src/uu/sleep" } +sort = { optional=true, version="0.0.5", package="uu_sort", path="src/uu/sort" } +split = { optional=true, version="0.0.5", package="uu_split", path="src/uu/split" } +stat = { optional=true, version="0.0.5", package="uu_stat", path="src/uu/stat" } +stdbuf = { optional=true, version="0.0.5", package="uu_stdbuf", path="src/uu/stdbuf" } +sum = { optional=true, version="0.0.5", package="uu_sum", path="src/uu/sum" } +sync = { optional=true, version="0.0.5", package="uu_sync", path="src/uu/sync" } +tac = { optional=true, version="0.0.5", package="uu_tac", path="src/uu/tac" } +tail = { optional=true, version="0.0.5", package="uu_tail", path="src/uu/tail" } +tee = { optional=true, version="0.0.5", package="uu_tee", path="src/uu/tee" } +timeout = { optional=true, version="0.0.5", package="uu_timeout", path="src/uu/timeout" } +touch = { optional=true, version="0.0.5", package="uu_touch", path="src/uu/touch" } +tr = { optional=true, version="0.0.5", package="uu_tr", path="src/uu/tr" } +true = { optional=true, version="0.0.5", package="uu_true", path="src/uu/true" } +truncate = { optional=true, version="0.0.5", package="uu_truncate", path="src/uu/truncate" } +tsort = { optional=true, version="0.0.5", package="uu_tsort", path="src/uu/tsort" } +tty = { optional=true, version="0.0.5", package="uu_tty", path="src/uu/tty" } +uname = { optional=true, version="0.0.5", package="uu_uname", path="src/uu/uname" } +unexpand = { optional=true, version="0.0.5", package="uu_unexpand", path="src/uu/unexpand" } +uniq = { optional=true, version="0.0.5", package="uu_uniq", path="src/uu/uniq" } +unlink = { optional=true, version="0.0.5", package="uu_unlink", path="src/uu/unlink" } +uptime = { optional=true, version="0.0.5", package="uu_uptime", path="src/uu/uptime" } +users = { optional=true, version="0.0.5", package="uu_users", path="src/uu/users" } +wc = { optional=true, version="0.0.5", package="uu_wc", path="src/uu/wc" } +who = { optional=true, version="0.0.5", package="uu_who", path="src/uu/who" } +whoami = { optional=true, version="0.0.5", package="uu_whoami", path="src/uu/whoami" } +yes = { optional=true, version="0.0.5", package="uu_yes", path="src/uu/yes" } # # * pinned transitive dependencies # Not needed for now. Keep as examples: @@ -343,7 +343,7 @@ sha1 = { version="0.6", features=["std"] } tempfile = "= 3.1.0" time = "0.1" unindent = "0.1" -uucore = { version=">=0.0.7", package="uucore", path="src/uucore", features=["entries"] } +uucore = { version=">=0.0.8", package="uucore", path="src/uucore", features=["entries"] } walkdir = "2.2" tempdir = "0.3" diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index 4ca0fbda7..e23067788 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_arch" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "arch ~ (uutils) display machine architecture" @@ -16,7 +16,7 @@ path = "src/arch.rs" [dependencies] platform-info = "0.1" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index 0abb718c8..d4415dd8c 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base32" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "base32 ~ (uutils) decode/encode input (base32-encoding)" @@ -15,7 +15,7 @@ edition = "2018" path = "src/base32.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features = ["encoding"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features = ["encoding"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index eef9b1ec3..e893caf3a 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base64" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "base64 ~ (uutils) decode/encode input (base64-encoding)" @@ -15,7 +15,7 @@ edition = "2018" path = "src/base64.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features = ["encoding"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features = ["encoding"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/basename/Cargo.toml b/src/uu/basename/Cargo.toml index 218d9eb08..681ccf1c4 100644 --- a/src/uu/basename/Cargo.toml +++ b/src/uu/basename/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_basename" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "basename ~ (uutils) display PATHNAME with leading directory components removed" @@ -15,7 +15,7 @@ edition = "2018" path = "src/basename.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 3878aee96..25119dcfc 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cat" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "cat ~ (uutils) concatenate and display input" @@ -17,7 +17,7 @@ path = "src/cat.rs" [dependencies] clap = "2.33" thiserror = "1.0" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index 60f9d6370..2cefca4d8 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chgrp" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "chgrp ~ (uutils) change the group ownership of FILE" @@ -15,7 +15,7 @@ edition = "2018" path = "src/chgrp.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index d4917b525..71ded6d90 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chmod" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "chmod ~ (uutils) change mode of FILE" @@ -17,7 +17,7 @@ path = "src/chmod.rs" [dependencies] clap = "2.33.3" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs", "mode"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs", "mode"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index f2d21ef88..27a30da17 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chown" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "chown ~ (uutils) change the ownership of FILE" @@ -17,7 +17,7 @@ path = "src/chown.rs" [dependencies] clap = "2.33" glob = "0.3.0" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index e967d4137..51fb9541d 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chroot" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "chroot ~ (uutils) run COMMAND under a new root directory" @@ -16,7 +16,7 @@ path = "src/chroot.rs" [dependencies] clap= "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index b7ac630f0..2f589e877 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cksum" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "cksum ~ (uutils) display CRC and size of input" @@ -17,7 +17,7 @@ path = "src/cksum.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index a0dc4e06f..9babe82ea 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_comm" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "comm ~ (uutils) compare sorted inputs" @@ -17,7 +17,7 @@ path = "src/comm.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index a0253433f..53d27137f 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cp" -version = "0.0.4" +version = "0.0.5" authors = [ "Jordy Dickinson ", "Joshua S. Miller ", @@ -23,7 +23,7 @@ clap = "2.33" filetime = "0.2" libc = "0.2.85" quick-error = "1.2.3" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index 7cec4564b..a5eac1a02 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_csplit" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "csplit ~ (uutils) Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output" @@ -19,7 +19,7 @@ clap = "2.33" thiserror = "1.0" regex = "1.0.0" glob = "0.2.11" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index 71f7c3f6a..10a282ecf 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cut" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "cut ~ (uutils) display byte/field columns of input lines" @@ -15,7 +15,7 @@ edition = "2018" path = "src/cut.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index c62cfe2b3..cacf29ff0 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_date" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "date ~ (uutils) display or set the current time" @@ -17,7 +17,7 @@ path = "src/date.rs" [dependencies] chrono = "0.4.4" clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index 24fce763b..049422ce5 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_df" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "df ~ (uutils) display file system information" @@ -18,7 +18,7 @@ path = "src/df.rs" clap = "2.33" libc = "0.2" number_prefix = "0.4" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "windows")'.dependencies] diff --git a/src/uu/dircolors/Cargo.toml b/src/uu/dircolors/Cargo.toml index 667fc3b70..9ed55d20d 100644 --- a/src/uu/dircolors/Cargo.toml +++ b/src/uu/dircolors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dircolors" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "dircolors ~ (uutils) display commands to set LS_COLORS" @@ -16,7 +16,7 @@ path = "src/dircolors.rs" [dependencies] glob = "0.3.0" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index 9c565a3e6..575aefd51 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dirname" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "dirname ~ (uutils) display parent directory of PATHNAME" @@ -16,7 +16,7 @@ path = "src/dirname.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index bb46c299c..01045f887 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_du" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "du ~ (uutils) display disk usage" @@ -16,7 +16,7 @@ path = "src/du.rs" [dependencies] time = "0.1.40" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=[] } diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index 7b831fcb8..2ac09cd39 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_echo" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "echo ~ (uutils) display TEXT" @@ -16,7 +16,7 @@ path = "src/echo.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/env/Cargo.toml b/src/uu/env/Cargo.toml index 864ecd1b2..fc5317184 100644 --- a/src/uu/env/Cargo.toml +++ b/src/uu/env/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_env" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "env ~ (uutils) set each NAME to VALUE in the environment and run COMMAND" @@ -18,7 +18,7 @@ path = "src/env.rs" clap = "2.33" libc = "0.2.42" rust-ini = "0.13.0" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index b5c0343e7..09575254a 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expand" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "expand ~ (uutils) convert input tabs to spaces" @@ -17,7 +17,7 @@ path = "src/expand.rs" [dependencies] clap = "2.33" unicode-width = "0.1.5" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index 1246ff873..7e38103aa 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expr" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "expr ~ (uutils) display the value of EXPRESSION" @@ -17,7 +17,7 @@ path = "src/expr.rs" [dependencies] libc = "0.2.42" onig = "~4.3.2" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index d1160c493..1d415a951 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_factor" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "factor ~ (uutils) display the prime factors of each NUMBER" @@ -19,7 +19,7 @@ num-traits = "0.2.13" # used in src/numerics.rs, which is included by build.rs num-traits = "0.2.13" # Needs at least version 0.2.13 for "OverflowingAdd" rand = { version="0.7", features=["small_rng"] } smallvec = { version="0.6.14, < 1.0" } -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [dev-dependencies] diff --git a/src/uu/false/Cargo.toml b/src/uu/false/Cargo.toml index 413cbc990..5651888d7 100644 --- a/src/uu/false/Cargo.toml +++ b/src/uu/false/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_false" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "false ~ (uutils) do nothing and fail" @@ -15,7 +15,7 @@ edition = "2018" path = "src/false.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/fmt/Cargo.toml b/src/uu/fmt/Cargo.toml index e150b2962..688967a5a 100644 --- a/src/uu/fmt/Cargo.toml +++ b/src/uu/fmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fmt" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "fmt ~ (uutils) reformat each paragraph of input" @@ -18,7 +18,7 @@ path = "src/fmt.rs" clap = "2.33" libc = "0.2.42" unicode-width = "0.1.5" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index 23dadc8eb..de1aa2dd5 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fold" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "fold ~ (uutils) wrap each line of input" @@ -15,7 +15,7 @@ edition = "2018" path = "src/fold.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index 455e2d224..d005599de 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_groups" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "groups ~ (uutils) display group memberships for USERNAME" @@ -15,7 +15,7 @@ edition = "2018" path = "src/groups.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } clap = "2.33" diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index c9bb4da9f..b08b853ef 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hashsum" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "hashsum ~ (uutils) display or check input digests" @@ -26,7 +26,7 @@ sha1 = "0.6.0" sha2 = "0.6.0" sha3 = "0.6.0" blake2-rfc = "0.2.18" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index 1cd075113..2f5d97d62 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_head" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "head ~ (uutils) display the first lines of input" @@ -16,7 +16,7 @@ path = "src/head.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/hostid/Cargo.toml b/src/uu/hostid/Cargo.toml index b3870652e..e872aff06 100644 --- a/src/uu/hostid/Cargo.toml +++ b/src/uu/hostid/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostid" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "hostid ~ (uutils) display the numeric identifier of the current host" @@ -16,7 +16,7 @@ path = "src/hostid.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/hostname/Cargo.toml b/src/uu/hostname/Cargo.toml index 75b9b5f9a..bc4b10951 100644 --- a/src/uu/hostname/Cargo.toml +++ b/src/uu/hostname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostname" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "hostname ~ (uutils) display or set the host name of the current host" @@ -18,7 +18,7 @@ path = "src/hostname.rs" clap = "2.33" libc = "0.2.42" hostname = { version = "0.3", features = ["set"] } -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["wide"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["wide"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=["sysinfoapi", "winsock2"] } diff --git a/src/uu/id/Cargo.toml b/src/uu/id/Cargo.toml index 46e5cb578..6edb1d606 100644 --- a/src/uu/id/Cargo.toml +++ b/src/uu/id/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_id" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "id ~ (uutils) display user and group information for USER" @@ -16,7 +16,7 @@ path = "src/id.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "process"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "process"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 5aec0b07c..16f78bb7b 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_install" -version = "0.0.4" +version = "0.0.5" authors = [ "Ben Eills ", "uutils developers", @@ -22,7 +22,7 @@ clap = "2.33" filetime = "0.2" file_diff = "1.0.0" libc = ">= 0.2" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["mode", "perms", "entries"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["mode", "perms", "entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [dev-dependencies] diff --git a/src/uu/join/Cargo.toml b/src/uu/join/Cargo.toml index d02703a62..5b18603ab 100644 --- a/src/uu/join/Cargo.toml +++ b/src/uu/join/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_join" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "join ~ (uutils) merge lines from inputs with matching join fields" @@ -16,7 +16,7 @@ path = "src/join.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index dd69cd35d..16a34de69 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_kill" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "kill ~ (uutils) send a signal to a process" @@ -16,7 +16,7 @@ path = "src/kill.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["signals"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["signals"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index aaa183981..9c15d8682 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_link" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "link ~ (uutils) create a hard (file system) link to FILE" @@ -16,7 +16,7 @@ path = "src/link.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index 2b97f025a..2d7f39005 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ln" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "ln ~ (uutils) create a (file system) link to TARGET" @@ -17,7 +17,7 @@ path = "src/ln.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/logname/Cargo.toml b/src/uu/logname/Cargo.toml index d58576c77..896fd5eb7 100644 --- a/src/uu/logname/Cargo.toml +++ b/src/uu/logname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_logname" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "logname ~ (uutils) display the login name of the current user" @@ -16,7 +16,7 @@ path = "src/logname.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index 59901f807..b1d44e485 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ls" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "ls ~ (uutils) display directory contents" @@ -22,7 +22,7 @@ term_grid = "0.1.5" termsize = "0.1.6" time = "0.1.40" unicode-width = "0.1.5" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index 9cedb5c03..44a7eb18b 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkdir" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "mkdir ~ (uutils) create DIRECTORY" @@ -17,7 +17,7 @@ path = "src/mkdir.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs", "mode"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs", "mode"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index aa347a86e..8ff6694d6 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkfifo" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "mkfifo ~ (uutils) create FIFOs (named pipes)" @@ -17,7 +17,7 @@ path = "src/mkfifo.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/mknod/Cargo.toml b/src/uu/mknod/Cargo.toml index 426534e75..9badb5f13 100644 --- a/src/uu/mknod/Cargo.toml +++ b/src/uu/mknod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mknod" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "mknod ~ (uutils) create special file NAME of TYPE" @@ -18,7 +18,7 @@ path = "src/mknod.rs" [dependencies] getopts = "0.2.18" libc = "^0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["mode"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["mode"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index c48306a40..13685a586 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mktemp" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "mktemp ~ (uutils) create and display a temporary file or directory from TEMPLATE" @@ -18,7 +18,7 @@ path = "src/mktemp.rs" clap = "2.33" rand = "0.5" tempfile = "3.1" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index 243462232..c910d08b0 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_more" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "more ~ (uutils) input perusal filter" diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index 1a4f90801..f84a68c3c 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mv" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "mv ~ (uutils) move (rename) SOURCE to DESTINATION" @@ -17,7 +17,7 @@ path = "src/mv.rs" [dependencies] clap = "2.33" fs_extra = "1.1.0" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index c851daa5a..2106b2d24 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nice" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "nice ~ (uutils) run PROGRAM with modified scheduling priority" @@ -18,7 +18,7 @@ path = "src/nice.rs" clap = "2.33" libc = "0.2.42" nix = { version="<=0.13" } -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index 41f7c60ab..f64182475 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nl" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "nl ~ (uutils) display input with added line numbers" @@ -21,7 +21,7 @@ libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" regex-syntax = "0.6.7" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index e9b6f8bd4..604e1e9da 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nohup" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "nohup ~ (uutils) run COMMAND, ignoring hangup signals" @@ -17,7 +17,7 @@ path = "src/nohup.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/nproc/Cargo.toml b/src/uu/nproc/Cargo.toml index 98f9a4afa..2541c5a3e 100644 --- a/src/uu/nproc/Cargo.toml +++ b/src/uu/nproc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nproc" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "nproc ~ (uutils) display the number of processing units available" @@ -18,7 +18,7 @@ path = "src/nproc.rs" libc = "0.2.42" num_cpus = "1.10" clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index b8e54656c..bde97cacb 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_numfmt" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "numfmt ~ (uutils) reformat NUMBER" @@ -16,7 +16,7 @@ path = "src/numfmt.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index e4db9faf0..a939c6ee4 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_od" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "od ~ (uutils) display formatted representation of input" @@ -19,7 +19,7 @@ byteorder = "1.3.2" clap = "2.33" half = "1.6" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/paste/Cargo.toml b/src/uu/paste/Cargo.toml index 3787ed270..2ac2074ed 100644 --- a/src/uu/paste/Cargo.toml +++ b/src/uu/paste/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_paste" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "paste ~ (uutils) merge lines from inputs" @@ -16,7 +16,7 @@ path = "src/paste.rs" [dependencies] clap = "2.33.3" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index c1d0d0dfa..63d00daac 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pathchk" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "pathchk ~ (uutils) diagnose invalid or non-portable PATHNAME" @@ -17,7 +17,7 @@ path = "src/pathchk.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/pinky/Cargo.toml b/src/uu/pinky/Cargo.toml index 1618eab57..96fb32e74 100644 --- a/src/uu/pinky/Cargo.toml +++ b/src/uu/pinky/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pinky" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "pinky ~ (uutils) display user information" @@ -15,7 +15,7 @@ edition = "2018" path = "src/pinky.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["utmpx", "entries"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["utmpx", "entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/printenv/Cargo.toml b/src/uu/printenv/Cargo.toml index 5266c1e03..f81240d77 100644 --- a/src/uu/printenv/Cargo.toml +++ b/src/uu/printenv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printenv" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "printenv ~ (uutils) display value of environment VAR" @@ -16,7 +16,7 @@ path = "src/printenv.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index c6737d178..7f54decb5 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printf" -version = "0.0.4" +version = "0.0.5" authors = [ "Nathan Ross", "uutils developers", @@ -19,7 +19,7 @@ path = "src/printf.rs" [dependencies] itertools = "0.8.0" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index 790b06305..889b4fafa 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ptx" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "ptx ~ (uutils) display a permuted index of input" @@ -21,7 +21,7 @@ libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" regex-syntax = "0.6.7" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/pwd/Cargo.toml b/src/uu/pwd/Cargo.toml index e074dc618..43ddeac2e 100644 --- a/src/uu/pwd/Cargo.toml +++ b/src/uu/pwd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pwd" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "pwd ~ (uutils) display current working directory" @@ -16,7 +16,7 @@ path = "src/pwd.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/readlink/Cargo.toml b/src/uu/readlink/Cargo.toml index 8e31f66f1..5d69125ce 100644 --- a/src/uu/readlink/Cargo.toml +++ b/src/uu/readlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_readlink" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "readlink ~ (uutils) display resolved path of PATHNAME" @@ -17,7 +17,7 @@ path = "src/readlink.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/realpath/Cargo.toml b/src/uu/realpath/Cargo.toml index 6f03086ba..bd25d9980 100644 --- a/src/uu/realpath/Cargo.toml +++ b/src/uu/realpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_realpath" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "realpath ~ (uutils) display resolved absolute path of PATHNAME" @@ -16,7 +16,7 @@ path = "src/realpath.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/relpath/Cargo.toml b/src/uu/relpath/Cargo.toml index c923b42ac..34d3dd067 100644 --- a/src/uu/relpath/Cargo.toml +++ b/src/uu/relpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_relpath" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "relpath ~ (uutils) display relative path of PATHNAME_TO from PATHNAME_FROM" @@ -16,7 +16,7 @@ path = "src/relpath.rs" [dependencies] clap = "2.33.3" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index b916412d8..bd3415faf 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rm" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "rm ~ (uutils) remove PATHNAME" @@ -18,7 +18,7 @@ path = "src/rm.rs" clap = "2.33" walkdir = "2.2" remove_dir_all = "0.5.1" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/rmdir/Cargo.toml b/src/uu/rmdir/Cargo.toml index 9d6bb03cc..cfd8dd6b0 100644 --- a/src/uu/rmdir/Cargo.toml +++ b/src/uu/rmdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rmdir" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "rmdir ~ (uutils) remove empty DIRECTORY" @@ -16,7 +16,7 @@ path = "src/rmdir.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index d7ee72b68..2e98a0bb8 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_seq" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "seq ~ (uutils) display a sequence of numbers" @@ -16,7 +16,7 @@ path = "src/seq.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index 6ff6e23ec..6157f3780 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shred" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "shred ~ (uutils) hide former FILE contents with repeated overwrites" @@ -20,7 +20,7 @@ filetime = "0.2.1" libc = "0.2.42" rand = "0.5" time = "0.1.40" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index 5e7c6c71a..7f911c156 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shuf" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "shuf ~ (uutils) display random permutations of input lines" @@ -17,7 +17,7 @@ path = "src/shuf.rs" [dependencies] clap = "2.33" rand = "0.5" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index 0ac5d6519..8ff8505e1 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sleep" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "sleep ~ (uutils) pause for DURATION" @@ -16,7 +16,7 @@ path = "src/sleep.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["parse_time"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["parse_time"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index e50caf53b..e805d4fa2 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sort" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "sort ~ (uutils) sort input lines" @@ -20,7 +20,7 @@ clap = "2.33" twox-hash = "1.6.0" itertools = "0.8.0" semver = "0.9.0" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/split/Cargo.toml b/src/uu/split/Cargo.toml index 7c3f1a56e..6032c6351 100644 --- a/src/uu/split/Cargo.toml +++ b/src/uu/split/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_split" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "split ~ (uutils) split input into output files" @@ -16,7 +16,7 @@ path = "src/split.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index 52ea88110..bf19f95b7 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stat" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "stat ~ (uutils) display FILE status" @@ -17,7 +17,7 @@ path = "src/stat.rs" [dependencies] clap = "2.33" time = "0.1.40" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "libc"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "libc"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/stdbuf/Cargo.toml b/src/uu/stdbuf/Cargo.toml index 7a80e99ae..3fde13f72 100644 --- a/src/uu/stdbuf/Cargo.toml +++ b/src/uu/stdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "stdbuf ~ (uutils) run COMMAND with modified standard stream buffering" @@ -17,11 +17,11 @@ path = "src/stdbuf.rs" [dependencies] getopts = "0.2.18" tempfile = "3.1" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [build-dependencies] -libstdbuf = { version="0.0.4", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } +libstdbuf = { version="0.0.5", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } [[bin]] name = "stdbuf" diff --git a/src/uu/stdbuf/src/libstdbuf/Cargo.toml b/src/uu/stdbuf/src/libstdbuf/Cargo.toml index ac9c7230f..ba6e5ff42 100644 --- a/src/uu/stdbuf/src/libstdbuf/Cargo.toml +++ b/src/uu/stdbuf/src/libstdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf_libstdbuf" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "stdbuf/libstdbuf ~ (uutils); dynamic library required for stdbuf" @@ -19,7 +19,7 @@ crate-type = ["cdylib", "rlib"] # XXX: note: the rlib is just to prevent Cargo f [dependencies] cpp = "0.5" libc = "0.2" -uucore = { version=">=0.0.7", package="uucore", path="../../../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../../../uucore_procs" } [build-dependencies] diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index 1e8590616..b5a6d5d91 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sum" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "sum ~ (uutils) display checksum and block counts for input" @@ -16,7 +16,7 @@ path = "src/sum.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index 4cbf69a41..39c49736a 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sync" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "sync ~ (uutils) synchronize cache writes to storage" @@ -17,7 +17,7 @@ path = "src/sync.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["wide"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["wide"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version = "0.3", features = ["errhandlingapi", "fileapi", "handleapi", "std", "winbase", "winerror"] } diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index 2e54c129e..18e9fa430 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tac" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "tac ~ (uutils) concatenate and display input lines in reverse order" @@ -16,7 +16,7 @@ path = "src/tac.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index 6e51e3e35..715a214e2 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tail" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "tail ~ (uutils) display the last lines of input" @@ -17,7 +17,7 @@ path = "src/tail.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=["fileapi", "handleapi", "processthreadsapi", "synchapi", "winbase"] } diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index 51bba2e45..c1841ce0f 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tee" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "tee ~ (uutils) display input and copy to FILE" @@ -18,7 +18,7 @@ path = "src/tee.rs" clap = "2.33.3" libc = "0.2.42" retain_mut = "0.1.2" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["libc"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["libc"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/test/Cargo.toml b/src/uu/test/Cargo.toml index 6471c9e62..c03b84ab4 100644 --- a/src/uu/test/Cargo.toml +++ b/src/uu/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_test" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "test ~ (uutils) evaluate comparison and file type expressions" @@ -16,7 +16,7 @@ path = "src/test.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "redox")'.dependencies] diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index c13a98d19..c32547559 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_timeout" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "timeout ~ (uutils) run COMMAND with a DURATION time limit" @@ -17,7 +17,7 @@ path = "src/timeout.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index fc021c096..6fa84cbdd 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_touch" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "touch ~ (uutils) change FILE timestamps" @@ -18,7 +18,7 @@ path = "src/touch.rs" filetime = "0.2.1" clap = "2.33" time = "0.1.40" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["libc"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["libc"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index 3683211f6..04c013659 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tr" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "tr ~ (uutils) translate characters within input and display" @@ -18,7 +18,7 @@ path = "src/tr.rs" bit-set = "0.5.0" fnv = "1.0.5" clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/true/Cargo.toml b/src/uu/true/Cargo.toml index a73bfddd5..780288155 100644 --- a/src/uu/true/Cargo.toml +++ b/src/uu/true/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_true" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "true ~ (uutils) do nothing and succeed" @@ -15,7 +15,7 @@ edition = "2018" path = "src/true.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/truncate/Cargo.toml b/src/uu/truncate/Cargo.toml index 4f770e666..19f0d2736 100644 --- a/src/uu/truncate/Cargo.toml +++ b/src/uu/truncate/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_truncate" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "truncate ~ (uutils) truncate (or extend) FILE to SIZE" @@ -16,7 +16,7 @@ path = "src/truncate.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index d870e0155..3f3d20170 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tsort" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "tsort ~ (uutils) topologically sort input (partially ordered) pairs" @@ -16,7 +16,7 @@ path = "src/tsort.rs" [dependencies] clap= "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index 7e4ffbd79..d2c5110b5 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tty" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "tty ~ (uutils) display the name of the terminal connected to standard input" @@ -17,7 +17,7 @@ path = "src/tty.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index 87754f45a..a0461e33f 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uname" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "uname ~ (uutils) display system information" @@ -17,7 +17,7 @@ path = "src/uname.rs" [dependencies] clap = "2.33" platform-info = "0.1" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index d66d335bf..6d1cad613 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unexpand" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "unexpand ~ (uutils) convert input spaces to tabs" @@ -17,7 +17,7 @@ path = "src/unexpand.rs" [dependencies] clap = "2.33" unicode-width = "0.1.5" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index d3cf4309d..53c2281c4 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uniq" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "uniq ~ (uutils) filter identical adjacent lines from input" @@ -16,7 +16,7 @@ path = "src/uniq.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/unlink/Cargo.toml b/src/uu/unlink/Cargo.toml index 68edec54d..ea18e2cbb 100644 --- a/src/uu/unlink/Cargo.toml +++ b/src/uu/unlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unlink" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "unlink ~ (uutils) remove a (file system) link to FILE" @@ -17,7 +17,7 @@ path = "src/unlink.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index d66acc77f..823879954 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uptime" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "uptime ~ (uutils) display dynamic system information" @@ -17,7 +17,7 @@ path = "src/uptime.rs" [dependencies] chrono = "0.4" clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["libc", "utmpx"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["libc", "utmpx"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/users/Cargo.toml b/src/uu/users/Cargo.toml index ed6f110b6..087272a59 100644 --- a/src/uu/users/Cargo.toml +++ b/src/uu/users/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_users" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "users ~ (uutils) display names of currently logged-in users" @@ -16,7 +16,7 @@ path = "src/users.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["utmpx"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["utmpx"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index 4e6cef101..3f44c1273 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_wc" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "wc ~ (uutils) display newline, word, and byte counts for input" @@ -16,7 +16,7 @@ path = "src/wc.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } thiserror = "1.0" diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index fce0178aa..928136b10 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_who" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "who ~ (uutils) display information about currently logged-in users" @@ -15,7 +15,7 @@ edition = "2018" path = "src/who.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["utmpx"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["utmpx"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index a3158f62a..e843b2167 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_whoami" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "whoami ~ (uutils) display user name of current effective user ID" @@ -16,7 +16,7 @@ path = "src/whoami.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "wide"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "wide"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "windows")'.dependencies] diff --git a/src/uu/yes/Cargo.toml b/src/uu/yes/Cargo.toml index 729ce693a..ab8a6faff 100644 --- a/src/uu/yes/Cargo.toml +++ b/src/uu/yes/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_yes" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "yes ~ (uutils) repeatedly display a line with STRING (or 'y')" @@ -16,7 +16,7 @@ path = "src/yes.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["zero-copy"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["zero-copy"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [features] diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index a5fbe4c79..855e64b36 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uucore" -version = "0.0.7" +version = "0.0.8" authors = ["uutils developers"] license = "MIT" description = "uutils ~ 'core' uutils code library (cross-platform)" diff --git a/util/update-version.sh b/util/update-version.sh index 584d13608..f5b66fb8c 100644 --- a/util/update-version.sh +++ b/util/update-version.sh @@ -3,11 +3,11 @@ # So, it should be triple-checked -FROM="0.0.3" -TO="0.0.4" +FROM="0.0.4" +TO="0.0.5" -UUCORE_FROM="0.0.6" -UUCORE_TO="0.0.7" +UUCORE_FROM="0.0.7" +UUCORE_TO="0.0.8" PROGS=$(ls -1d src/uu/*/Cargo.toml src/uu/stdbuf/src/libstdbuf/Cargo.toml Cargo.toml) From 06bdc144d70329d68c0268943175c7b798afbb47 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 3 Apr 2021 12:43:37 +0200 Subject: [PATCH 0249/1135] ls: show/hide control chars --- src/uu/ls/src/ls.rs | 41 ++++++++- src/uu/ls/src/quoting_style.rs | 152 ++++++++++++++++++++++++++------- 2 files changed, 158 insertions(+), 35 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index ece497bdb..9bb8b7e63 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -119,7 +119,8 @@ pub mod options { pub static FILE_TYPE: &str = "file-type"; pub static CLASSIFY: &str = "classify"; } - + pub static HIDE_CONTROL_CHARS: &str = "hide-control-chars"; + pub static SHOW_CONTROL_CHARS: &str = "show-control-chars"; pub static WIDTH: &str = "width"; pub static AUTHOR: &str = "author"; pub static NO_GROUP: &str = "no-group"; @@ -366,24 +367,36 @@ impl Config { }) .or_else(|| termsize::get().map(|s| s.cols)); + let show_control = if options.is_present(options::HIDE_CONTROL_CHARS) { + false + } else if options.is_present(options::SHOW_CONTROL_CHARS) { + true + } else { + false // TODO: only if output is a terminal and the program is `ls` + }; + let quoting_style = if let Some(style) = options.value_of(options::QUOTING_STYLE) { match style { - "literal" => QuotingStyle::Literal, + "literal" => QuotingStyle::Literal { show_control }, "shell" => QuotingStyle::Shell { escape: false, always_quote: false, + show_control, }, "shell-always" => QuotingStyle::Shell { escape: false, always_quote: true, + show_control, }, "shell-escape" => QuotingStyle::Shell { escape: true, always_quote: false, + show_control, }, "shell-escape-always" => QuotingStyle::Shell { escape: true, always_quote: true, + show_control, }, "c" => QuotingStyle::C { quotes: quoting_style::Quotes::Double, @@ -394,7 +407,7 @@ impl Config { _ => unreachable!("Should have been caught by Clap"), } } else if options.is_present(options::quoting::LITERAL) { - QuotingStyle::Literal + QuotingStyle::Literal { show_control } } else if options.is_present(options::quoting::ESCAPE) { QuotingStyle::C { quotes: quoting_style::Quotes::None, @@ -408,6 +421,7 @@ impl Config { QuotingStyle::Shell { escape: true, always_quote: false, + show_control, } }; @@ -619,6 +633,27 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ]) ) + // Control characters + .arg( + Arg::with_name(options::HIDE_CONTROL_CHARS) + .short("q") + .long(options::HIDE_CONTROL_CHARS) + .help("Replace control characters with '?' if they are not escaped.") + .overrides_with_all(&[ + options::HIDE_CONTROL_CHARS, + options::SHOW_CONTROL_CHARS, + ]) + ) + .arg( + Arg::with_name(options::SHOW_CONTROL_CHARS) + .long(options::SHOW_CONTROL_CHARS) + .help("Show control characters 'as is' if they are not escaped.") + .overrides_with_all(&[ + options::HIDE_CONTROL_CHARS, + options::SHOW_CONTROL_CHARS, + ]) + ) + // Time arguments .arg( Arg::with_name(options::TIME) diff --git a/src/uu/ls/src/quoting_style.rs b/src/uu/ls/src/quoting_style.rs index 74108094a..ceb54466c 100644 --- a/src/uu/ls/src/quoting_style.rs +++ b/src/uu/ls/src/quoting_style.rs @@ -2,14 +2,22 @@ use std::char::from_digit; const SPECIAL_SHELL_CHARS: &str = "~`#$&*()\\|[]{};'\"<>?! "; -pub(crate) enum QuotingStyle { - Shell { escape: bool, always_quote: bool }, - C { quotes: Quotes }, - Literal, +pub(super) enum QuotingStyle { + Shell { + escape: bool, + always_quote: bool, + show_control: bool, + }, + C { + quotes: Quotes, + }, + Literal { + show_control: bool, + }, } #[derive(Clone, Copy)] -pub(crate) enum Quotes { +pub(super) enum Quotes { None, Single, Double, @@ -81,6 +89,12 @@ impl EscapeOctal { } impl EscapedChar { + fn new_literal(c: char) -> Self { + Self { + state: EscapeState::Char(c), + } + } + fn new_c(c: char, quotes: Quotes) -> Self { use EscapeState::*; let init_state = match c { @@ -110,27 +124,10 @@ impl EscapedChar { Self { state: init_state } } - // fn new_shell(c: char, quotes: Quotes) -> Self { - // use EscapeState::*; - // let init_state = match c { - // // If the string is single quoted, the single quote should be escaped - // '\'' => match quotes { - // Quotes::Single => Backslash('\''), - // _ => Char('\''), - // }, - // // All control characters should be rendered as ?: - // _ if c.is_ascii_control() => Char('?'), - // // Special shell characters must be escaped: - // _ if SPECIAL_SHELL_CHARS.contains(c) => ForceQuote(c), - // _ => Char(c), - // }; - // Self { state: init_state } - // } - fn new_shell(c: char, escape: bool, quotes: Quotes) -> Self { use EscapeState::*; let init_state = match c { - _ if !escape && c.is_control() => Char('?'), + _ if !escape && c.is_control() => Char(c), '\x07' => Backslash('a'), '\x08' => Backslash('b'), '\t' => Backslash('t'), @@ -149,6 +146,15 @@ impl EscapedChar { }; Self { state: init_state } } + + fn hide_control(self) -> Self { + match self.state { + EscapeState::Char(c) if c.is_control() => Self { + state: EscapeState::Char('?'), + }, + _ => self, + } + } } impl Iterator for EscapedChar { @@ -170,12 +176,20 @@ impl Iterator for EscapedChar { } } -fn shell_without_escape(name: String, quotes: Quotes) -> (String, bool) { +fn shell_without_escape(name: String, quotes: Quotes, show_control_chars: bool) -> (String, bool) { let mut must_quote = false; let mut escaped_str = String::with_capacity(name.len()); for c in name.chars() { - let escaped = EscapedChar::new_shell(c, false, quotes); + let escaped = { + let ec = EscapedChar::new_shell(c, false, quotes); + if show_control_chars { + ec + } else { + ec.hide_control() + } + }; + match escaped.state { EscapeState::Backslash('\'') => escaped_str.push_str("'\\''"), EscapeState::ForceQuote(x) => { @@ -242,7 +256,15 @@ fn shell_with_escape(name: String, quotes: Quotes) -> (String, bool) { pub(super) fn escape_name(name: String, style: &QuotingStyle) -> String { match style { - QuotingStyle::Literal => name, + QuotingStyle::Literal { show_control } => { + if !show_control { + name.chars() + .flat_map(|c| EscapedChar::new_literal(c).hide_control()) + .collect() + } else { + name + } + } QuotingStyle::C { quotes } => { let escaped_str: String = name .chars() @@ -258,6 +280,7 @@ pub(super) fn escape_name(name: String, style: &QuotingStyle) -> String { QuotingStyle::Shell { escape, always_quote, + show_control, } => { let (quotes, must_quote) = if name.contains('"') { (Quotes::Single, true) @@ -272,7 +295,7 @@ pub(super) fn escape_name(name: String, style: &QuotingStyle) -> String { let (escaped_str, contains_quote_chars) = if *escape { shell_with_escape(name, quotes) } else { - shell_without_escape(name, quotes) + shell_without_escape(name, quotes, *show_control) }; match (must_quote | contains_quote_chars, quotes) { @@ -289,7 +312,10 @@ mod tests { use crate::quoting_style::{escape_name, Quotes, QuotingStyle}; fn get_style(s: &str) -> QuotingStyle { match s { - "literal" => QuotingStyle::Literal, + "literal" => QuotingStyle::Literal { + show_control: false, + }, + "literal-show" => QuotingStyle::Literal { show_control: true }, "escape" => QuotingStyle::C { quotes: Quotes::None, }, @@ -299,18 +325,32 @@ mod tests { "shell" => QuotingStyle::Shell { escape: false, always_quote: false, + show_control: false, + }, + "shell-show" => QuotingStyle::Shell { + escape: false, + always_quote: false, + show_control: true, }, "shell-always" => QuotingStyle::Shell { escape: false, always_quote: true, + show_control: false, + }, + "shell-always-show" => QuotingStyle::Shell { + escape: false, + always_quote: true, + show_control: true, }, "shell-escape" => QuotingStyle::Shell { escape: true, always_quote: false, + show_control: false, }, "shell-escape-always" => QuotingStyle::Shell { escape: true, always_quote: true, + show_control: false, }, _ => panic!("Invalid name!"), } @@ -333,10 +373,13 @@ mod tests { "one_two", vec![ ("one_two", "literal"), + ("one_two", "literal-show"), ("one_two", "escape"), ("\"one_two\"", "c"), ("one_two", "shell"), + ("one_two", "shell-show"), ("\'one_two\'", "shell-always"), + ("\'one_two\'", "shell-always-show"), ("one_two", "shell-escape"), ("\'one_two\'", "shell-escape-always"), ], @@ -349,10 +392,13 @@ mod tests { "one two", vec![ ("one two", "literal"), + ("one two", "literal-show"), ("one\\ two", "escape"), ("\"one two\"", "c"), ("\'one two\'", "shell"), + ("\'one two\'", "shell-show"), ("\'one two\'", "shell-always"), + ("\'one two\'", "shell-always-show"), ("\'one two\'", "shell-escape"), ("\'one two\'", "shell-escape-always"), ], @@ -362,10 +408,13 @@ mod tests { " one", vec![ (" one", "literal"), + (" one", "literal-show"), ("\\ one", "escape"), ("\" one\"", "c"), ("' one'", "shell"), + ("' one'", "shell-show"), ("' one'", "shell-always"), + ("' one'", "shell-always-show"), ("' one'", "shell-escape"), ("' one'", "shell-escape-always"), ], @@ -379,10 +428,13 @@ mod tests { "one\"two", vec![ ("one\"two", "literal"), + ("one\"two", "literal-show"), ("one\"two", "escape"), ("\"one\\\"two\"", "c"), ("'one\"two'", "shell"), + ("'one\"two'", "shell-show"), ("'one\"two'", "shell-always"), + ("'one\"two'", "shell-always-show"), ("'one\"two'", "shell-escape"), ("'one\"two'", "shell-escape-always"), ], @@ -393,10 +445,13 @@ mod tests { "one\'two", vec![ ("one'two", "literal"), + ("one'two", "literal-show"), ("one'two", "escape"), ("\"one'two\"", "c"), ("\"one'two\"", "shell"), + ("\"one'two\"", "shell-show"), ("\"one'two\"", "shell-always"), + ("\"one'two\"", "shell-always-show"), ("\"one'two\"", "shell-escape"), ("\"one'two\"", "shell-escape-always"), ], @@ -407,10 +462,13 @@ mod tests { "one'two\"three", vec![ ("one'two\"three", "literal"), + ("one'two\"three", "literal-show"), ("one'two\"three", "escape"), ("\"one'two\\\"three\"", "c"), ("'one'\\''two\"three'", "shell"), + ("'one'\\''two\"three'", "shell-show"), ("'one'\\''two\"three'", "shell-always"), + ("'one'\\''two\"three'", "shell-always-show"), ("'one'\\''two\"three'", "shell-escape"), ("'one'\\''two\"three'", "shell-escape-always"), ], @@ -421,10 +479,13 @@ mod tests { "one''two\"\"three", vec![ ("one''two\"\"three", "literal"), + ("one''two\"\"three", "literal-show"), ("one''two\"\"three", "escape"), ("\"one''two\\\"\\\"three\"", "c"), ("'one'\\'''\\''two\"\"three'", "shell"), + ("'one'\\'''\\''two\"\"three'", "shell-show"), ("'one'\\'''\\''two\"\"three'", "shell-always"), + ("'one'\\'''\\''two\"\"three'", "shell-always-show"), ("'one'\\'''\\''two\"\"three'", "shell-escape"), ("'one'\\'''\\''two\"\"three'", "shell-escape-always"), ], @@ -437,11 +498,14 @@ mod tests { check_names( "one\ntwo", vec![ - ("one\ntwo", "literal"), + ("one?two", "literal"), + ("one\ntwo", "literal-show"), ("one\\ntwo", "escape"), ("\"one\\ntwo\"", "c"), ("one?two", "shell"), + ("one\ntwo", "shell-show"), ("'one?two'", "shell-always"), + ("'one\ntwo'", "shell-always-show"), ("'one'$'\\n''two'", "shell-escape"), ("'one'$'\\n''two'", "shell-escape-always"), ], @@ -452,9 +516,10 @@ mod tests { check_names( "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F", vec![ + ("????????????????", "literal"), ( "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F", - "literal", + "literal-show", ), ( "\\000\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017", @@ -465,7 +530,15 @@ mod tests { "c", ), ("????????????????", "shell"), + ( + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F", + "shell-show", + ), ("'????????????????'", "shell-always"), + ( + "'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F'", + "shell-always-show", + ), ( "''$'\\000\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017'", "shell-escape", @@ -481,9 +554,10 @@ mod tests { check_names( "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", vec![ + ("????????????????", "literal"), ( "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", - "literal", + "literal-show", ), ( "\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\033\\034\\035\\036\\037", @@ -494,7 +568,15 @@ mod tests { "c", ), ("????????????????", "shell"), + ( + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", + "shell-show", + ), ("'????????????????'", "shell-always"), + ( + "'\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F'", + "shell-always-show", + ), ( "''$'\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\033\\034\\035\\036\\037'", "shell-escape", @@ -510,11 +592,14 @@ mod tests { check_names( "\x7F", vec![ - ("\x7F", "literal"), + ("?", "literal"), + ("\x7F", "literal-show"), ("\\177", "escape"), ("\"\\177\"", "c"), ("?", "shell"), + ("\x7F", "shell-show"), ("'?'", "shell-always"), + ("'\x7F'", "shell-always-show"), ("''$'\\177'", "shell-escape"), ("''$'\\177'", "shell-escape-always"), ], @@ -530,10 +615,13 @@ mod tests { "one?two", vec![ ("one?two", "literal"), + ("one?two", "literal-show"), ("one?two", "escape"), ("\"one?two\"", "c"), ("'one?two'", "shell"), + ("'one?two'", "shell-show"), ("'one?two'", "shell-always"), + ("'one?two'", "shell-always-show"), ("'one?two'", "shell-escape"), ("'one?two'", "shell-escape-always"), ], From 9cb0fc2945afc7d7d5e7c96a4763039652c4c46c Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 3 Apr 2021 13:15:19 +0200 Subject: [PATCH 0250/1135] ls: forgot to push updated tests --- tests/by-util/test_ls.rs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index d403e5577..b49620eb1 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1142,9 +1142,9 @@ fn test_ls_quoting_style() { assert_eq!(result.stdout, "'one'$'\\n''two'\n"); for (arg, correct) in &[ - ("--quoting-style=literal", "one\ntwo"), - ("-N", "one\ntwo"), - ("--literal", "one\ntwo"), + ("--quoting-style=literal", "one?two"), + ("-N", "one?two"), + ("--literal", "one?two"), ("--quoting-style=c", "\"one\\ntwo\""), ("-Q", "\"one\\ntwo\""), ("--quote-name", "\"one\\ntwo\""), @@ -1161,6 +1161,24 @@ fn test_ls_quoting_style() { println!("stdout = {:?}", result.stdout); assert_eq!(result.stdout, format!("{}\n", correct)); } + + for (arg, correct) in &[ + ("--quoting-style=literal", "one\ntwo"), + ("-N", "one\ntwo"), + ("--literal", "one\ntwo"), + ("--quoting-style=shell", "one\ntwo"), + ("--quoting-style=shell-always", "'one\ntwo'"), + ] { + let result = scene + .ucmd() + .arg(arg) + .arg("--show-control-chars") + .arg("one\ntwo") + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!(result.stdout, format!("{}\n", correct)); + } } let result = scene.ucmd().arg("one two").succeeds(); From a85257474554e354d5018c9407c0d782b4ea8529 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 3 Apr 2021 15:49:13 +0200 Subject: [PATCH 0251/1135] Fix bug #2017 - cat isn't working Revert "cat: Improve performance on Linux (#1978)" This reverts commit 7a947cfe46b694f61a5a7d840d622ce292da457c. --- Cargo.lock | 3 +- src/uu/cat/Cargo.toml | 5 +- src/uu/cat/src/cat.rs | 426 +++++++++++++++++------------------------- 3 files changed, 178 insertions(+), 256 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e5eb65a92..6c7c165e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1581,8 +1581,7 @@ name = "uu_cat" version = "0.0.5" dependencies = [ "clap", - "nix 0.20.0", - "thiserror", + "quick-error", "unix_socket", "uucore", "uucore_procs", diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 25119dcfc..2176a5e0b 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -16,16 +16,13 @@ path = "src/cat.rs" [dependencies] clap = "2.33" -thiserror = "1.0" +quick-error = "1.2.3" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] unix_socket = "0.5.0" -[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies] -nix = "0.20" - [[bin]] name = "cat" path = "src/main.rs" diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index f39708fd8..cf5a384a4 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -3,13 +3,14 @@ // (c) Jordi Boggiano // (c) Evgeniy Klyuchikov // (c) Joshua S. Miller -// (c) Árni Dagur // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. // spell-checker:ignore (ToDO) nonprint nonblank nonprinting +#[macro_use] +extern crate quick_error; #[cfg(unix)] extern crate unix_socket; #[macro_use] @@ -17,9 +18,9 @@ extern crate uucore; // last synced with: cat (GNU coreutils) 8.13 use clap::{App, Arg}; +use quick_error::ResultExt; use std::fs::{metadata, File}; -use std::io::{self, Read, Write}; -use thiserror::Error; +use std::io::{self, stderr, stdin, stdout, BufWriter, Read, Write}; use uucore::fs::is_stdin_interactive; /// Unix domain socket support @@ -30,44 +31,12 @@ use std::os::unix::fs::FileTypeExt; #[cfg(unix)] use unix_socket::UnixStream; -#[cfg(any(target_os = "linux", target_os = "android"))] -use nix::errno::Errno; -/// Linux splice support -#[cfg(any(target_os = "linux", target_os = "android"))] -use nix::fcntl::{splice, SpliceFFlags}; -#[cfg(any(target_os = "linux", target_os = "android"))] -use nix::unistd::pipe; -#[cfg(any(target_os = "linux", target_os = "android"))] -use std::os::unix::io::{AsRawFd, RawFd}; - static NAME: &str = "cat"; static VERSION: &str = env!("CARGO_PKG_VERSION"); static SYNTAX: &str = "[OPTION]... [FILE]..."; static SUMMARY: &str = "Concatenate FILE(s), or standard input, to standard output With no FILE, or when FILE is -, read standard input."; -#[derive(Error, Debug)] -enum CatError { - /// Wrapper around `io::Error` - #[error("{0}")] - Io(#[from] io::Error), - /// Wrapper around `nix::Error` - #[cfg(any(target_os = "linux", target_os = "android"))] - #[error("{0}")] - Nix(#[from] nix::Error), - /// Unknown file type; it's not a regular file, socket, etc. - #[error("{}: unknown filetype: {}", path, ft_debug)] - UnknownFiletype { - path: String, - /// A debug print of the file type - ft_debug: String, - }, - #[error("{0}: Expected a file, found directory")] - IsDirectory(String), -} - -type CatResult = Result; - #[derive(PartialEq)] enum NumberingMode { None, @@ -75,6 +44,39 @@ enum NumberingMode { All, } +quick_error! { + #[derive(Debug)] + enum CatError { + /// Wrapper for io::Error with path context + Input(err: io::Error, path: String) { + display("cat: {0}: {1}", path, err) + context(path: &'a str, err: io::Error) -> (err, path.to_owned()) + cause(err) + } + + /// Wrapper for io::Error with no context + Output(err: io::Error) { + display("cat: {0}", err) from() + cause(err) + } + + /// Unknown Filetype classification + UnknownFiletype(path: String) { + display("cat: {0}: unknown filetype", path) + } + + /// At least one error was encountered in reading or writing + EncounteredErrors(count: usize) { + display("cat: encountered {0} errors", count) + } + + /// Denotes an error caused by trying to `cat` a directory + IsDirectory(path: String) { + display("cat: {0}: Is a directory", path) + } + } +} + struct OutputOptions { /// Line numbering mode number: NumberingMode, @@ -85,56 +87,21 @@ struct OutputOptions { /// display TAB characters as `tab` show_tabs: bool, - /// Show end of lines - show_ends: bool, + /// If `show_tabs == true`, this string will be printed in the + /// place of tabs + tab: String, + + /// Can be set to show characters other than '\n' a the end of + /// each line, e.g. $ + end_of_line: String, /// use ^ and M- notation, except for LF (\\n) and TAB (\\t) show_nonprint: bool, } -impl OutputOptions { - fn tab(&self) -> &'static str { - if self.show_tabs { - "^I" - } else { - "\t" - } - } - - fn end_of_line(&self) -> &'static str { - if self.show_ends { - "$\n" - } else { - "\n" - } - } - - /// We can write fast if we can simply copy the contents of the file to - /// stdout, without augmenting the output with e.g. line numbers. - fn can_write_fast(&self) -> bool { - !(self.show_tabs - || self.show_nonprint - || self.show_ends - || self.squeeze_blank - || self.number != NumberingMode::None) - } -} - -/// State that persists between output of each file. This struct is only used -/// when we can't write fast. -struct OutputState { - /// The current line number - line_number: usize, - - /// Whether the output cursor is at the beginning of a new line - at_line_start: bool, -} - /// Represents an open file handle, stream, or other device -struct InputHandle { - #[cfg(any(target_os = "linux", target_os = "android"))] - file_descriptor: RawFd, - reader: R, +struct InputHandle { + reader: Box, is_interactive: bool, } @@ -157,6 +124,8 @@ enum InputType { Socket, } +type CatResult = Result; + mod options { pub static FILE: &str = "file"; pub static SHOW_ALL: &str = "show-all"; @@ -274,14 +243,30 @@ pub fn uumain(args: impl uucore::Args) -> i32 { None => vec!["-".to_owned()], }; - let options = OutputOptions { - show_ends, - number: number_mode, - show_nonprint, - show_tabs, - squeeze_blank, + let can_write_fast = !(show_tabs + || show_nonprint + || show_ends + || squeeze_blank + || number_mode != NumberingMode::None); + + let success = if can_write_fast { + write_fast(files).is_ok() + } else { + let tab = if show_tabs { "^I" } else { "\t" }.to_owned(); + + let end_of_line = if show_ends { "$\n" } else { "\n" }.to_owned(); + + let options = OutputOptions { + end_of_line, + number: number_mode, + show_nonprint, + show_tabs, + squeeze_blank, + tab, + }; + + write_lines(files, &options).is_ok() }; - let success = cat_files(files, &options).is_ok(); if success { 0 @@ -290,76 +275,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } -fn cat_handle( - handle: &mut InputHandle, - options: &OutputOptions, - state: &mut OutputState, -) -> CatResult<()> { - if options.can_write_fast() { - write_fast(handle) - } else { - write_lines(handle, &options, state) - } -} - -fn cat_path(path: &str, options: &OutputOptions, state: &mut OutputState) -> CatResult<()> { - if path == "-" { - let stdin = io::stdin(); - let mut handle = InputHandle { - #[cfg(any(target_os = "linux", target_os = "android"))] - file_descriptor: stdin.as_raw_fd(), - reader: stdin, - is_interactive: is_stdin_interactive(), - }; - return cat_handle(&mut handle, &options, state); - } - match get_input_type(path)? { - InputType::Directory => Err(CatError::IsDirectory(path.to_owned())), - #[cfg(unix)] - InputType::Socket => { - let socket = UnixStream::connect(path)?; - socket.shutdown(Shutdown::Write)?; - let mut handle = InputHandle { - #[cfg(any(target_os = "linux", target_os = "android"))] - file_descriptor: socket.as_raw_fd(), - reader: socket, - is_interactive: false, - }; - cat_handle(&mut handle, &options, state) - } - _ => { - let file = File::open(path)?; - let mut handle = InputHandle { - #[cfg(any(target_os = "linux", target_os = "android"))] - file_descriptor: file.as_raw_fd(), - reader: file, - is_interactive: false, - }; - cat_handle(&mut handle, &options, state) - } - } -} - -fn cat_files(files: Vec, options: &OutputOptions) -> Result<(), u32> { - let mut error_count = 0; - let mut state = OutputState { - line_number: 1, - at_line_start: true, - }; - - for path in &files { - if let Err(err) = cat_path(path, &options, &mut state) { - show_error!("{}", err); - error_count += 1; - } - } - if error_count == 0 { - Ok(()) - } else { - Err(error_count) - } -} - /// Classifies the `InputType` of file at `path` if possible /// /// # Arguments @@ -370,8 +285,7 @@ fn get_input_type(path: &str) -> CatResult { return Ok(InputType::StdIn); } - let ft = metadata(path)?.file_type(); - match ft { + match metadata(path).context(path)?.file_type() { #[cfg(unix)] ft if ft.is_block_device() => Ok(InputType::BlockDevice), #[cfg(unix)] @@ -383,113 +297,125 @@ fn get_input_type(path: &str) -> CatResult { ft if ft.is_dir() => Ok(InputType::Directory), ft if ft.is_file() => Ok(InputType::File), ft if ft.is_symlink() => Ok(InputType::SymLink), - _ => Err(CatError::UnknownFiletype { - path: path.to_owned(), - ft_debug: format!("{:?}", ft), - }), + _ => Err(CatError::UnknownFiletype(path.to_owned())), } } -/// Writes handle to stdout with no configuration. This allows a -/// simple memory copy. -fn write_fast(handle: &mut InputHandle) -> CatResult<()> { - let stdout = io::stdout(); - let mut stdout_lock = stdout.lock(); - #[cfg(any(target_os = "linux", target_os = "android"))] - { - // If we're on Linux or Android, try to use the splice() system call - // for faster writing. If it works, we're done. - if !write_fast_using_splice(handle, stdout.as_raw_fd())? { - return Ok(()); - } - } - // If we're not on Linux or Android, or the splice() call failed, - // fall back on slower writing. - let mut buf = [0; 1024 * 64]; - while let Ok(n) = handle.reader.read(&mut buf) { - if n == 0 { - break; - } - stdout_lock.write_all(&buf[..n])?; - } - Ok(()) -} - -/// This function is called from `write_fast()` on Linux and Android. The -/// function `splice()` is used to move data between two file descriptors -/// without copying between kernel- and userspace. This results in a large -/// speedup. +/// Returns an InputHandle from which a Reader can be accessed or an +/// error /// -/// The `bool` in the result value indicates if we need to fall back to normal -/// copying or not. False means we don't have to. -#[cfg(any(target_os = "linux", target_os = "android"))] -#[inline] -fn write_fast_using_splice(handle: &mut InputHandle, writer: RawFd) -> CatResult { - const BUF_SIZE: usize = 1024 * 16; +/// # Arguments +/// +/// * `path` - `InputHandler` will wrap a reader from this file path +fn open(path: &str) -> CatResult { + if path == "-" { + let stdin = stdin(); + return Ok(InputHandle { + reader: Box::new(stdin) as Box, + is_interactive: is_stdin_interactive(), + }); + } - let (pipe_rd, pipe_wr) = pipe()?; - - // We only fall back if splice fails on the first call. - match splice( - handle.file_descriptor, - None, - pipe_wr, - None, - BUF_SIZE, - SpliceFFlags::empty(), - ) { - Ok(n) => { - if n == 0 { - return Ok(false); - } + match get_input_type(path)? { + InputType::Directory => Err(CatError::IsDirectory(path.to_owned())), + #[cfg(unix)] + InputType::Socket => { + let socket = UnixStream::connect(path).context(path)?; + socket.shutdown(Shutdown::Write).context(path)?; + Ok(InputHandle { + reader: Box::new(socket) as Box, + is_interactive: false, + }) } - Err(err) => { - match err.as_errno() { - Some(Errno::EPERM) | Some(Errno::ENOSYS) | Some(Errno::EINVAL) => { - // EPERM indicates the call was blocked by seccomp. - // ENOSYS indicates we're running on an ancient Kernel. - // EINVAL indicates some other failure. - return Ok(true); - } - _ => { - // Other errors include running out of memory, etc. We - // don't attempt to fall back from these. - return Err(err)?; + _ => { + let file = File::open(path).context(path)?; + Ok(InputHandle { + reader: Box::new(file) as Box, + is_interactive: false, + }) + } + } +} + +/// Writes files to stdout with no configuration. This allows a +/// simple memory copy. Returns `Ok(())` if no errors were +/// encountered, or an error with the number of errors encountered. +/// +/// # Arguments +/// +/// * `files` - There is no short circuit when encountering an error +/// reading a file in this vector +fn write_fast(files: Vec) -> CatResult<()> { + let mut writer = stdout(); + let mut in_buf = [0; 1024 * 64]; + let mut error_count = 0; + + for file in files { + match open(&file[..]) { + Ok(mut handle) => { + while let Ok(n) = handle.reader.read(&mut in_buf) { + if n == 0 { + break; + } + writer.write_all(&in_buf[..n]).context(&file[..])?; } } + Err(error) => { + writeln!(&mut stderr(), "{}", error)?; + error_count += 1; + } } } - loop { - let n = splice( - handle.file_descriptor, - None, - pipe_wr, - None, - BUF_SIZE, - SpliceFFlags::empty(), - )?; - if n == 0 { - // We read 0 bytes from the input, - // which means we're done copying. - break; + match error_count { + 0 => Ok(()), + _ => Err(CatError::EncounteredErrors(error_count)), + } +} + +/// State that persists between output of each file +struct OutputState { + /// The current line number + line_number: usize, + + /// Whether the output cursor is at the beginning of a new line + at_line_start: bool, +} + +/// Writes files to stdout with `options` as configuration. Returns +/// `Ok(())` if no errors were encountered, or an error with the +/// number of errors encountered. +/// +/// # Arguments +/// +/// * `files` - There is no short circuit when encountering an error +/// reading a file in this vector +fn write_lines(files: Vec, options: &OutputOptions) -> CatResult<()> { + let mut error_count = 0; + let mut state = OutputState { + line_number: 1, + at_line_start: true, + }; + + for file in files { + if let Err(error) = write_file_lines(&file, options, &mut state) { + writeln!(&mut stderr(), "{}", error).context(&file[..])?; + error_count += 1; } - splice(pipe_rd, None, writer, None, BUF_SIZE, SpliceFFlags::empty())?; } - Ok(false) + match error_count { + 0 => Ok(()), + _ => Err(CatError::EncounteredErrors(error_count)), + } } /// Outputs file contents to stdout in a line-by-line fashion, /// propagating any errors that might occur. -fn write_lines( - handle: &mut InputHandle, - options: &OutputOptions, - state: &mut OutputState, -) -> CatResult<()> { +fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState) -> CatResult<()> { + let mut handle = open(file)?; let mut in_buf = [0; 1024 * 31]; - let stdout = io::stdout(); - let mut writer = stdout.lock(); + let mut writer = BufWriter::with_capacity(1024 * 64, stdout()); let mut one_blank_kept = false; while let Ok(n) = handle.reader.read(&mut in_buf) { @@ -507,9 +433,9 @@ fn write_lines( write!(&mut writer, "{0:6}\t", state.line_number)?; state.line_number += 1; } - writer.write_all(options.end_of_line().as_bytes())?; + writer.write_all(options.end_of_line.as_bytes())?; if handle.is_interactive { - writer.flush()?; + writer.flush().context(file)?; } } state.at_line_start = true; @@ -524,7 +450,7 @@ fn write_lines( // print to end of line or end of buffer let offset = if options.show_nonprint { - write_nonprint_to_end(&in_buf[pos..], &mut writer, options.tab().as_bytes()) + write_nonprint_to_end(&in_buf[pos..], &mut writer, options.tab.as_bytes()) } else if options.show_tabs { write_tab_to_end(&in_buf[pos..], &mut writer) } else { @@ -536,7 +462,7 @@ fn write_lines( break; } // print suitable end of line - writer.write_all(options.end_of_line().as_bytes())?; + writer.write_all(options.end_of_line.as_bytes())?; if handle.is_interactive { writer.flush()?; } From 7750db4f8ecc84ac352d59946799ffbbc96a4f50 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 3 Apr 2021 16:06:29 +0200 Subject: [PATCH 0252/1135] cat: add a trivial test --- tests/by-util/test_cat.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index b194eb9b0..481b1683d 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -3,6 +3,14 @@ extern crate unix_socket; use crate::common::util::*; +#[test] +fn test_output_simple() { + new_ucmd!() + .args(&["alpha.txt"]) + .succeeds() + .stdout_only("abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); +} + #[test] fn test_output_multi_files_print_all_chars() { new_ucmd!() From f37284129e7f00a2d77fa768b7b87c529994ad1f Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 3 Apr 2021 15:55:02 +0200 Subject: [PATCH 0253/1135] new release 0.0.6 to address the cat issue --- Cargo.lock | 194 ++++++++++++------------- Cargo.toml | 192 ++++++++++++------------ src/uu/arch/Cargo.toml | 2 +- src/uu/base32/Cargo.toml | 2 +- src/uu/base64/Cargo.toml | 2 +- src/uu/basename/Cargo.toml | 2 +- src/uu/cat/Cargo.toml | 2 +- src/uu/chgrp/Cargo.toml | 2 +- src/uu/chmod/Cargo.toml | 2 +- src/uu/chown/Cargo.toml | 2 +- src/uu/chroot/Cargo.toml | 2 +- src/uu/cksum/Cargo.toml | 2 +- src/uu/comm/Cargo.toml | 2 +- src/uu/cp/Cargo.toml | 2 +- src/uu/csplit/Cargo.toml | 2 +- src/uu/cut/Cargo.toml | 2 +- src/uu/date/Cargo.toml | 2 +- src/uu/df/Cargo.toml | 2 +- src/uu/dircolors/Cargo.toml | 2 +- src/uu/dirname/Cargo.toml | 2 +- src/uu/du/Cargo.toml | 2 +- src/uu/echo/Cargo.toml | 2 +- src/uu/env/Cargo.toml | 2 +- src/uu/expand/Cargo.toml | 2 +- src/uu/expr/Cargo.toml | 2 +- src/uu/factor/Cargo.toml | 2 +- src/uu/false/Cargo.toml | 2 +- src/uu/fmt/Cargo.toml | 2 +- src/uu/fold/Cargo.toml | 2 +- src/uu/groups/Cargo.toml | 2 +- src/uu/hashsum/Cargo.toml | 2 +- src/uu/head/Cargo.toml | 2 +- src/uu/hostid/Cargo.toml | 2 +- src/uu/hostname/Cargo.toml | 2 +- src/uu/id/Cargo.toml | 2 +- src/uu/install/Cargo.toml | 2 +- src/uu/join/Cargo.toml | 2 +- src/uu/kill/Cargo.toml | 2 +- src/uu/link/Cargo.toml | 2 +- src/uu/ln/Cargo.toml | 2 +- src/uu/logname/Cargo.toml | 2 +- src/uu/ls/Cargo.toml | 2 +- src/uu/mkdir/Cargo.toml | 2 +- src/uu/mkfifo/Cargo.toml | 2 +- src/uu/mknod/Cargo.toml | 2 +- src/uu/mktemp/Cargo.toml | 2 +- src/uu/more/Cargo.toml | 2 +- src/uu/mv/Cargo.toml | 2 +- src/uu/nice/Cargo.toml | 2 +- src/uu/nl/Cargo.toml | 2 +- src/uu/nohup/Cargo.toml | 2 +- src/uu/nproc/Cargo.toml | 2 +- src/uu/numfmt/Cargo.toml | 2 +- src/uu/od/Cargo.toml | 2 +- src/uu/paste/Cargo.toml | 2 +- src/uu/pathchk/Cargo.toml | 2 +- src/uu/pinky/Cargo.toml | 2 +- src/uu/printenv/Cargo.toml | 2 +- src/uu/printf/Cargo.toml | 2 +- src/uu/ptx/Cargo.toml | 2 +- src/uu/pwd/Cargo.toml | 2 +- src/uu/readlink/Cargo.toml | 2 +- src/uu/realpath/Cargo.toml | 2 +- src/uu/relpath/Cargo.toml | 2 +- src/uu/rm/Cargo.toml | 2 +- src/uu/rmdir/Cargo.toml | 2 +- src/uu/seq/Cargo.toml | 2 +- src/uu/shred/Cargo.toml | 2 +- src/uu/shuf/Cargo.toml | 2 +- src/uu/sleep/Cargo.toml | 2 +- src/uu/sort/Cargo.toml | 2 +- src/uu/split/Cargo.toml | 2 +- src/uu/stat/Cargo.toml | 2 +- src/uu/stdbuf/Cargo.toml | 4 +- src/uu/stdbuf/src/libstdbuf/Cargo.toml | 2 +- src/uu/sum/Cargo.toml | 2 +- src/uu/sync/Cargo.toml | 2 +- src/uu/tac/Cargo.toml | 2 +- src/uu/tail/Cargo.toml | 2 +- src/uu/tee/Cargo.toml | 2 +- src/uu/test/Cargo.toml | 2 +- src/uu/timeout/Cargo.toml | 2 +- src/uu/touch/Cargo.toml | 2 +- src/uu/tr/Cargo.toml | 2 +- src/uu/true/Cargo.toml | 2 +- src/uu/truncate/Cargo.toml | 2 +- src/uu/tsort/Cargo.toml | 2 +- src/uu/tty/Cargo.toml | 2 +- src/uu/uname/Cargo.toml | 2 +- src/uu/unexpand/Cargo.toml | 2 +- src/uu/uniq/Cargo.toml | 2 +- src/uu/unlink/Cargo.toml | 2 +- src/uu/uptime/Cargo.toml | 2 +- src/uu/users/Cargo.toml | 2 +- src/uu/wc/Cargo.toml | 2 +- src/uu/who/Cargo.toml | 2 +- src/uu/whoami/Cargo.toml | 2 +- src/uu/yes/Cargo.toml | 2 +- util/update-version.sh | 8 +- 99 files changed, 294 insertions(+), 294 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6c7c165e6..ea1ee53ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -204,7 +204,7 @@ dependencies = [ [[package]] name = "coreutils" -version = "0.0.5" +version = "0.0.6" dependencies = [ "conv", "filetime", @@ -1545,7 +1545,7 @@ dependencies = [ [[package]] name = "uu_arch" -version = "0.0.5" +version = "0.0.6" dependencies = [ "platform-info", "uucore", @@ -1554,7 +1554,7 @@ dependencies = [ [[package]] name = "uu_base32" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -1562,7 +1562,7 @@ dependencies = [ [[package]] name = "uu_base64" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -1570,7 +1570,7 @@ dependencies = [ [[package]] name = "uu_basename" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -1578,7 +1578,7 @@ dependencies = [ [[package]] name = "uu_cat" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "quick-error", @@ -1589,7 +1589,7 @@ dependencies = [ [[package]] name = "uu_chgrp" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -1598,7 +1598,7 @@ dependencies = [ [[package]] name = "uu_chmod" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1609,7 +1609,7 @@ dependencies = [ [[package]] name = "uu_chown" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "glob 0.3.0", @@ -1620,7 +1620,7 @@ dependencies = [ [[package]] name = "uu_chroot" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -1629,7 +1629,7 @@ dependencies = [ [[package]] name = "uu_cksum" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1639,7 +1639,7 @@ dependencies = [ [[package]] name = "uu_comm" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1649,7 +1649,7 @@ dependencies = [ [[package]] name = "uu_cp" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "filetime", @@ -1665,7 +1665,7 @@ dependencies = [ [[package]] name = "uu_csplit" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "glob 0.2.11", @@ -1677,7 +1677,7 @@ dependencies = [ [[package]] name = "uu_cut" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -1685,7 +1685,7 @@ dependencies = [ [[package]] name = "uu_date" -version = "0.0.5" +version = "0.0.6" dependencies = [ "chrono", "clap", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "uu_df" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1709,7 +1709,7 @@ dependencies = [ [[package]] name = "uu_dircolors" -version = "0.0.5" +version = "0.0.6" dependencies = [ "glob 0.3.0", "uucore", @@ -1718,7 +1718,7 @@ dependencies = [ [[package]] name = "uu_dirname" -version = "0.0.5" +version = "0.0.6" dependencies = [ "libc", "uucore", @@ -1727,7 +1727,7 @@ dependencies = [ [[package]] name = "uu_du" -version = "0.0.5" +version = "0.0.6" dependencies = [ "time", "uucore", @@ -1737,7 +1737,7 @@ dependencies = [ [[package]] name = "uu_echo" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -1746,7 +1746,7 @@ dependencies = [ [[package]] name = "uu_env" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1757,7 +1757,7 @@ dependencies = [ [[package]] name = "uu_expand" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "unicode-width", @@ -1767,7 +1767,7 @@ dependencies = [ [[package]] name = "uu_expr" -version = "0.0.5" +version = "0.0.6" dependencies = [ "libc", "onig", @@ -1777,7 +1777,7 @@ dependencies = [ [[package]] name = "uu_factor" -version = "0.0.5" +version = "0.0.6" dependencies = [ "criterion", "num-traits", @@ -1792,7 +1792,7 @@ dependencies = [ [[package]] name = "uu_false" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -1800,7 +1800,7 @@ dependencies = [ [[package]] name = "uu_fmt" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1811,7 +1811,7 @@ dependencies = [ [[package]] name = "uu_fold" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -1819,7 +1819,7 @@ dependencies = [ [[package]] name = "uu_groups" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -1828,7 +1828,7 @@ dependencies = [ [[package]] name = "uu_hashsum" -version = "0.0.5" +version = "0.0.6" dependencies = [ "blake2-rfc", "clap", @@ -1847,7 +1847,7 @@ dependencies = [ [[package]] name = "uu_head" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -1856,7 +1856,7 @@ dependencies = [ [[package]] name = "uu_hostid" -version = "0.0.5" +version = "0.0.6" dependencies = [ "libc", "uucore", @@ -1865,7 +1865,7 @@ dependencies = [ [[package]] name = "uu_hostname" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "hostname", @@ -1877,7 +1877,7 @@ dependencies = [ [[package]] name = "uu_id" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -1886,7 +1886,7 @@ dependencies = [ [[package]] name = "uu_install" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "file_diff", @@ -1899,7 +1899,7 @@ dependencies = [ [[package]] name = "uu_join" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -1908,7 +1908,7 @@ dependencies = [ [[package]] name = "uu_kill" -version = "0.0.5" +version = "0.0.6" dependencies = [ "libc", "uucore", @@ -1917,7 +1917,7 @@ dependencies = [ [[package]] name = "uu_link" -version = "0.0.5" +version = "0.0.6" dependencies = [ "libc", "uucore", @@ -1926,7 +1926,7 @@ dependencies = [ [[package]] name = "uu_ln" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1936,7 +1936,7 @@ dependencies = [ [[package]] name = "uu_logname" -version = "0.0.5" +version = "0.0.6" dependencies = [ "libc", "uucore", @@ -1945,7 +1945,7 @@ dependencies = [ [[package]] name = "uu_ls" -version = "0.0.5" +version = "0.0.6" dependencies = [ "atty", "clap", @@ -1961,7 +1961,7 @@ dependencies = [ [[package]] name = "uu_mkdir" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1971,7 +1971,7 @@ dependencies = [ [[package]] name = "uu_mkfifo" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1981,7 +1981,7 @@ dependencies = [ [[package]] name = "uu_mknod" -version = "0.0.5" +version = "0.0.6" dependencies = [ "getopts", "libc", @@ -1991,7 +1991,7 @@ dependencies = [ [[package]] name = "uu_mktemp" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "rand 0.5.6", @@ -2002,7 +2002,7 @@ dependencies = [ [[package]] name = "uu_more" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "nix 0.13.1", @@ -2014,7 +2014,7 @@ dependencies = [ [[package]] name = "uu_mv" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "fs_extra", @@ -2024,7 +2024,7 @@ dependencies = [ [[package]] name = "uu_nice" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2035,7 +2035,7 @@ dependencies = [ [[package]] name = "uu_nl" -version = "0.0.5" +version = "0.0.6" dependencies = [ "aho-corasick", "clap", @@ -2049,7 +2049,7 @@ dependencies = [ [[package]] name = "uu_nohup" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2059,7 +2059,7 @@ dependencies = [ [[package]] name = "uu_nproc" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2070,7 +2070,7 @@ dependencies = [ [[package]] name = "uu_numfmt" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2079,7 +2079,7 @@ dependencies = [ [[package]] name = "uu_od" -version = "0.0.5" +version = "0.0.6" dependencies = [ "byteorder", "clap", @@ -2091,7 +2091,7 @@ dependencies = [ [[package]] name = "uu_paste" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2100,7 +2100,7 @@ dependencies = [ [[package]] name = "uu_pathchk" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2110,7 +2110,7 @@ dependencies = [ [[package]] name = "uu_pinky" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -2118,7 +2118,7 @@ dependencies = [ [[package]] name = "uu_printenv" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2127,7 +2127,7 @@ dependencies = [ [[package]] name = "uu_printf" -version = "0.0.5" +version = "0.0.6" dependencies = [ "itertools 0.8.2", "uucore", @@ -2136,7 +2136,7 @@ dependencies = [ [[package]] name = "uu_ptx" -version = "0.0.5" +version = "0.0.6" dependencies = [ "aho-corasick", "clap", @@ -2150,7 +2150,7 @@ dependencies = [ [[package]] name = "uu_pwd" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2159,7 +2159,7 @@ dependencies = [ [[package]] name = "uu_readlink" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2169,7 +2169,7 @@ dependencies = [ [[package]] name = "uu_realpath" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2178,7 +2178,7 @@ dependencies = [ [[package]] name = "uu_relpath" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2187,7 +2187,7 @@ dependencies = [ [[package]] name = "uu_rm" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "remove_dir_all", @@ -2198,7 +2198,7 @@ dependencies = [ [[package]] name = "uu_rmdir" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2207,7 +2207,7 @@ dependencies = [ [[package]] name = "uu_seq" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2216,7 +2216,7 @@ dependencies = [ [[package]] name = "uu_shred" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "filetime", @@ -2229,7 +2229,7 @@ dependencies = [ [[package]] name = "uu_shuf" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "rand 0.5.6", @@ -2239,7 +2239,7 @@ dependencies = [ [[package]] name = "uu_sleep" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2248,7 +2248,7 @@ dependencies = [ [[package]] name = "uu_sort" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "itertools 0.8.2", @@ -2261,7 +2261,7 @@ dependencies = [ [[package]] name = "uu_split" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2270,7 +2270,7 @@ dependencies = [ [[package]] name = "uu_stat" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "time", @@ -2280,7 +2280,7 @@ dependencies = [ [[package]] name = "uu_stdbuf" -version = "0.0.5" +version = "0.0.6" dependencies = [ "getopts", "tempfile", @@ -2291,7 +2291,7 @@ dependencies = [ [[package]] name = "uu_stdbuf_libstdbuf" -version = "0.0.5" +version = "0.0.6" dependencies = [ "cpp", "cpp_build", @@ -2302,7 +2302,7 @@ dependencies = [ [[package]] name = "uu_sum" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2311,7 +2311,7 @@ dependencies = [ [[package]] name = "uu_sync" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2322,7 +2322,7 @@ dependencies = [ [[package]] name = "uu_tac" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2331,7 +2331,7 @@ dependencies = [ [[package]] name = "uu_tail" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2343,7 +2343,7 @@ dependencies = [ [[package]] name = "uu_tee" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2354,7 +2354,7 @@ dependencies = [ [[package]] name = "uu_test" -version = "0.0.5" +version = "0.0.6" dependencies = [ "libc", "redox_syscall 0.1.57", @@ -2364,7 +2364,7 @@ dependencies = [ [[package]] name = "uu_timeout" -version = "0.0.5" +version = "0.0.6" dependencies = [ "getopts", "libc", @@ -2374,7 +2374,7 @@ dependencies = [ [[package]] name = "uu_touch" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "filetime", @@ -2385,7 +2385,7 @@ dependencies = [ [[package]] name = "uu_tr" -version = "0.0.5" +version = "0.0.6" dependencies = [ "bit-set", "clap", @@ -2396,7 +2396,7 @@ dependencies = [ [[package]] name = "uu_true" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -2404,7 +2404,7 @@ dependencies = [ [[package]] name = "uu_truncate" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2413,7 +2413,7 @@ dependencies = [ [[package]] name = "uu_tsort" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2422,7 +2422,7 @@ dependencies = [ [[package]] name = "uu_tty" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2432,7 +2432,7 @@ dependencies = [ [[package]] name = "uu_uname" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "platform-info", @@ -2442,7 +2442,7 @@ dependencies = [ [[package]] name = "uu_unexpand" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "unicode-width", @@ -2452,7 +2452,7 @@ dependencies = [ [[package]] name = "uu_uniq" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2461,7 +2461,7 @@ dependencies = [ [[package]] name = "uu_unlink" -version = "0.0.5" +version = "0.0.6" dependencies = [ "getopts", "libc", @@ -2471,7 +2471,7 @@ dependencies = [ [[package]] name = "uu_uptime" -version = "0.0.5" +version = "0.0.6" dependencies = [ "chrono", "clap", @@ -2481,7 +2481,7 @@ dependencies = [ [[package]] name = "uu_users" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2490,7 +2490,7 @@ dependencies = [ [[package]] name = "uu_wc" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2502,7 +2502,7 @@ dependencies = [ [[package]] name = "uu_who" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -2510,7 +2510,7 @@ dependencies = [ [[package]] name = "uu_whoami" -version = "0.0.5" +version = "0.0.6" dependencies = [ "advapi32-sys", "clap", @@ -2521,7 +2521,7 @@ dependencies = [ [[package]] name = "uu_yes" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", diff --git a/Cargo.toml b/Cargo.toml index 398791ca9..7e3fb9139 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "coreutils" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "coreutils ~ GNU coreutils (updated); implemented as universal (cross-platform) utils, written in Rust" @@ -228,102 +228,102 @@ 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.8", package="uucore", path="src/uucore" } # * uutils -uu_test = { optional=true, version="0.0.5", package="uu_test", path="src/uu/test" } +uu_test = { optional=true, version="0.0.6", package="uu_test", path="src/uu/test" } # -arch = { optional=true, version="0.0.5", package="uu_arch", path="src/uu/arch" } -base32 = { optional=true, version="0.0.5", package="uu_base32", path="src/uu/base32" } -base64 = { optional=true, version="0.0.5", package="uu_base64", path="src/uu/base64" } -basename = { optional=true, version="0.0.5", package="uu_basename", path="src/uu/basename" } -cat = { optional=true, version="0.0.5", package="uu_cat", path="src/uu/cat" } -chgrp = { optional=true, version="0.0.5", package="uu_chgrp", path="src/uu/chgrp" } -chmod = { optional=true, version="0.0.5", package="uu_chmod", path="src/uu/chmod" } -chown = { optional=true, version="0.0.5", package="uu_chown", path="src/uu/chown" } -chroot = { optional=true, version="0.0.5", package="uu_chroot", path="src/uu/chroot" } -cksum = { optional=true, version="0.0.5", package="uu_cksum", path="src/uu/cksum" } -comm = { optional=true, version="0.0.5", package="uu_comm", path="src/uu/comm" } -cp = { optional=true, version="0.0.5", package="uu_cp", path="src/uu/cp" } -csplit = { optional=true, version="0.0.5", package="uu_csplit", path="src/uu/csplit" } -cut = { optional=true, version="0.0.5", package="uu_cut", path="src/uu/cut" } -date = { optional=true, version="0.0.5", package="uu_date", path="src/uu/date" } -df = { optional=true, version="0.0.5", package="uu_df", path="src/uu/df" } -dircolors= { optional=true, version="0.0.5", package="uu_dircolors", path="src/uu/dircolors" } -dirname = { optional=true, version="0.0.5", package="uu_dirname", path="src/uu/dirname" } -du = { optional=true, version="0.0.5", package="uu_du", path="src/uu/du" } -echo = { optional=true, version="0.0.5", package="uu_echo", path="src/uu/echo" } -env = { optional=true, version="0.0.5", package="uu_env", path="src/uu/env" } -expand = { optional=true, version="0.0.5", package="uu_expand", path="src/uu/expand" } -expr = { optional=true, version="0.0.5", package="uu_expr", path="src/uu/expr" } -factor = { optional=true, version="0.0.5", package="uu_factor", path="src/uu/factor" } -false = { optional=true, version="0.0.5", package="uu_false", path="src/uu/false" } -fmt = { optional=true, version="0.0.5", package="uu_fmt", path="src/uu/fmt" } -fold = { optional=true, version="0.0.5", package="uu_fold", path="src/uu/fold" } -groups = { optional=true, version="0.0.5", package="uu_groups", path="src/uu/groups" } -hashsum = { optional=true, version="0.0.5", package="uu_hashsum", path="src/uu/hashsum" } -head = { optional=true, version="0.0.5", package="uu_head", path="src/uu/head" } -hostid = { optional=true, version="0.0.5", package="uu_hostid", path="src/uu/hostid" } -hostname = { optional=true, version="0.0.5", package="uu_hostname", path="src/uu/hostname" } -id = { optional=true, version="0.0.5", package="uu_id", path="src/uu/id" } -install = { optional=true, version="0.0.5", package="uu_install", path="src/uu/install" } -join = { optional=true, version="0.0.5", package="uu_join", path="src/uu/join" } -kill = { optional=true, version="0.0.5", package="uu_kill", path="src/uu/kill" } -link = { optional=true, version="0.0.5", package="uu_link", path="src/uu/link" } -ln = { optional=true, version="0.0.5", package="uu_ln", path="src/uu/ln" } -ls = { optional=true, version="0.0.5", package="uu_ls", path="src/uu/ls" } -logname = { optional=true, version="0.0.5", package="uu_logname", path="src/uu/logname" } -mkdir = { optional=true, version="0.0.5", package="uu_mkdir", path="src/uu/mkdir" } -mkfifo = { optional=true, version="0.0.5", package="uu_mkfifo", path="src/uu/mkfifo" } -mknod = { optional=true, version="0.0.5", package="uu_mknod", path="src/uu/mknod" } -mktemp = { optional=true, version="0.0.5", package="uu_mktemp", path="src/uu/mktemp" } -more = { optional=true, version="0.0.5", package="uu_more", path="src/uu/more" } -mv = { optional=true, version="0.0.5", package="uu_mv", path="src/uu/mv" } -nice = { optional=true, version="0.0.5", package="uu_nice", path="src/uu/nice" } -nl = { optional=true, version="0.0.5", package="uu_nl", path="src/uu/nl" } -nohup = { optional=true, version="0.0.5", package="uu_nohup", path="src/uu/nohup" } -nproc = { optional=true, version="0.0.5", package="uu_nproc", path="src/uu/nproc" } -numfmt = { optional=true, version="0.0.5", package="uu_numfmt", path="src/uu/numfmt" } -od = { optional=true, version="0.0.5", package="uu_od", path="src/uu/od" } -paste = { optional=true, version="0.0.5", package="uu_paste", path="src/uu/paste" } -pathchk = { optional=true, version="0.0.5", package="uu_pathchk", path="src/uu/pathchk" } -pinky = { optional=true, version="0.0.5", package="uu_pinky", path="src/uu/pinky" } -printenv = { optional=true, version="0.0.5", package="uu_printenv", path="src/uu/printenv" } -printf = { optional=true, version="0.0.5", package="uu_printf", path="src/uu/printf" } -ptx = { optional=true, version="0.0.5", package="uu_ptx", path="src/uu/ptx" } -pwd = { optional=true, version="0.0.5", package="uu_pwd", path="src/uu/pwd" } -readlink = { optional=true, version="0.0.5", package="uu_readlink", path="src/uu/readlink" } -realpath = { optional=true, version="0.0.5", package="uu_realpath", path="src/uu/realpath" } -relpath = { optional=true, version="0.0.5", package="uu_relpath", path="src/uu/relpath" } -rm = { optional=true, version="0.0.5", package="uu_rm", path="src/uu/rm" } -rmdir = { optional=true, version="0.0.5", package="uu_rmdir", path="src/uu/rmdir" } -seq = { optional=true, version="0.0.5", package="uu_seq", path="src/uu/seq" } -shred = { optional=true, version="0.0.5", package="uu_shred", path="src/uu/shred" } -shuf = { optional=true, version="0.0.5", package="uu_shuf", path="src/uu/shuf" } -sleep = { optional=true, version="0.0.5", package="uu_sleep", path="src/uu/sleep" } -sort = { optional=true, version="0.0.5", package="uu_sort", path="src/uu/sort" } -split = { optional=true, version="0.0.5", package="uu_split", path="src/uu/split" } -stat = { optional=true, version="0.0.5", package="uu_stat", path="src/uu/stat" } -stdbuf = { optional=true, version="0.0.5", package="uu_stdbuf", path="src/uu/stdbuf" } -sum = { optional=true, version="0.0.5", package="uu_sum", path="src/uu/sum" } -sync = { optional=true, version="0.0.5", package="uu_sync", path="src/uu/sync" } -tac = { optional=true, version="0.0.5", package="uu_tac", path="src/uu/tac" } -tail = { optional=true, version="0.0.5", package="uu_tail", path="src/uu/tail" } -tee = { optional=true, version="0.0.5", package="uu_tee", path="src/uu/tee" } -timeout = { optional=true, version="0.0.5", package="uu_timeout", path="src/uu/timeout" } -touch = { optional=true, version="0.0.5", package="uu_touch", path="src/uu/touch" } -tr = { optional=true, version="0.0.5", package="uu_tr", path="src/uu/tr" } -true = { optional=true, version="0.0.5", package="uu_true", path="src/uu/true" } -truncate = { optional=true, version="0.0.5", package="uu_truncate", path="src/uu/truncate" } -tsort = { optional=true, version="0.0.5", package="uu_tsort", path="src/uu/tsort" } -tty = { optional=true, version="0.0.5", package="uu_tty", path="src/uu/tty" } -uname = { optional=true, version="0.0.5", package="uu_uname", path="src/uu/uname" } -unexpand = { optional=true, version="0.0.5", package="uu_unexpand", path="src/uu/unexpand" } -uniq = { optional=true, version="0.0.5", package="uu_uniq", path="src/uu/uniq" } -unlink = { optional=true, version="0.0.5", package="uu_unlink", path="src/uu/unlink" } -uptime = { optional=true, version="0.0.5", package="uu_uptime", path="src/uu/uptime" } -users = { optional=true, version="0.0.5", package="uu_users", path="src/uu/users" } -wc = { optional=true, version="0.0.5", package="uu_wc", path="src/uu/wc" } -who = { optional=true, version="0.0.5", package="uu_who", path="src/uu/who" } -whoami = { optional=true, version="0.0.5", package="uu_whoami", path="src/uu/whoami" } -yes = { optional=true, version="0.0.5", package="uu_yes", path="src/uu/yes" } +arch = { optional=true, version="0.0.6", package="uu_arch", path="src/uu/arch" } +base32 = { optional=true, version="0.0.6", package="uu_base32", path="src/uu/base32" } +base64 = { optional=true, version="0.0.6", package="uu_base64", path="src/uu/base64" } +basename = { optional=true, version="0.0.6", package="uu_basename", path="src/uu/basename" } +cat = { optional=true, version="0.0.6", package="uu_cat", path="src/uu/cat" } +chgrp = { optional=true, version="0.0.6", package="uu_chgrp", path="src/uu/chgrp" } +chmod = { optional=true, version="0.0.6", package="uu_chmod", path="src/uu/chmod" } +chown = { optional=true, version="0.0.6", package="uu_chown", path="src/uu/chown" } +chroot = { optional=true, version="0.0.6", package="uu_chroot", path="src/uu/chroot" } +cksum = { optional=true, version="0.0.6", package="uu_cksum", path="src/uu/cksum" } +comm = { optional=true, version="0.0.6", package="uu_comm", path="src/uu/comm" } +cp = { optional=true, version="0.0.6", package="uu_cp", path="src/uu/cp" } +csplit = { optional=true, version="0.0.6", package="uu_csplit", path="src/uu/csplit" } +cut = { optional=true, version="0.0.6", package="uu_cut", path="src/uu/cut" } +date = { optional=true, version="0.0.6", package="uu_date", path="src/uu/date" } +df = { optional=true, version="0.0.6", package="uu_df", path="src/uu/df" } +dircolors= { optional=true, version="0.0.6", package="uu_dircolors", path="src/uu/dircolors" } +dirname = { optional=true, version="0.0.6", package="uu_dirname", path="src/uu/dirname" } +du = { optional=true, version="0.0.6", package="uu_du", path="src/uu/du" } +echo = { optional=true, version="0.0.6", package="uu_echo", path="src/uu/echo" } +env = { optional=true, version="0.0.6", package="uu_env", path="src/uu/env" } +expand = { optional=true, version="0.0.6", package="uu_expand", path="src/uu/expand" } +expr = { optional=true, version="0.0.6", package="uu_expr", path="src/uu/expr" } +factor = { optional=true, version="0.0.6", package="uu_factor", path="src/uu/factor" } +false = { optional=true, version="0.0.6", package="uu_false", path="src/uu/false" } +fmt = { optional=true, version="0.0.6", package="uu_fmt", path="src/uu/fmt" } +fold = { optional=true, version="0.0.6", package="uu_fold", path="src/uu/fold" } +groups = { optional=true, version="0.0.6", package="uu_groups", path="src/uu/groups" } +hashsum = { optional=true, version="0.0.6", package="uu_hashsum", path="src/uu/hashsum" } +head = { optional=true, version="0.0.6", package="uu_head", path="src/uu/head" } +hostid = { optional=true, version="0.0.6", package="uu_hostid", path="src/uu/hostid" } +hostname = { optional=true, version="0.0.6", package="uu_hostname", path="src/uu/hostname" } +id = { optional=true, version="0.0.6", package="uu_id", path="src/uu/id" } +install = { optional=true, version="0.0.6", package="uu_install", path="src/uu/install" } +join = { optional=true, version="0.0.6", package="uu_join", path="src/uu/join" } +kill = { optional=true, version="0.0.6", package="uu_kill", path="src/uu/kill" } +link = { optional=true, version="0.0.6", package="uu_link", path="src/uu/link" } +ln = { optional=true, version="0.0.6", package="uu_ln", path="src/uu/ln" } +ls = { optional=true, version="0.0.6", package="uu_ls", path="src/uu/ls" } +logname = { optional=true, version="0.0.6", package="uu_logname", path="src/uu/logname" } +mkdir = { optional=true, version="0.0.6", package="uu_mkdir", path="src/uu/mkdir" } +mkfifo = { optional=true, version="0.0.6", package="uu_mkfifo", path="src/uu/mkfifo" } +mknod = { optional=true, version="0.0.6", package="uu_mknod", path="src/uu/mknod" } +mktemp = { optional=true, version="0.0.6", package="uu_mktemp", path="src/uu/mktemp" } +more = { optional=true, version="0.0.6", package="uu_more", path="src/uu/more" } +mv = { optional=true, version="0.0.6", package="uu_mv", path="src/uu/mv" } +nice = { optional=true, version="0.0.6", package="uu_nice", path="src/uu/nice" } +nl = { optional=true, version="0.0.6", package="uu_nl", path="src/uu/nl" } +nohup = { optional=true, version="0.0.6", package="uu_nohup", path="src/uu/nohup" } +nproc = { optional=true, version="0.0.6", package="uu_nproc", path="src/uu/nproc" } +numfmt = { optional=true, version="0.0.6", package="uu_numfmt", path="src/uu/numfmt" } +od = { optional=true, version="0.0.6", package="uu_od", path="src/uu/od" } +paste = { optional=true, version="0.0.6", package="uu_paste", path="src/uu/paste" } +pathchk = { optional=true, version="0.0.6", package="uu_pathchk", path="src/uu/pathchk" } +pinky = { optional=true, version="0.0.6", package="uu_pinky", path="src/uu/pinky" } +printenv = { optional=true, version="0.0.6", package="uu_printenv", path="src/uu/printenv" } +printf = { optional=true, version="0.0.6", package="uu_printf", path="src/uu/printf" } +ptx = { optional=true, version="0.0.6", package="uu_ptx", path="src/uu/ptx" } +pwd = { optional=true, version="0.0.6", package="uu_pwd", path="src/uu/pwd" } +readlink = { optional=true, version="0.0.6", package="uu_readlink", path="src/uu/readlink" } +realpath = { optional=true, version="0.0.6", package="uu_realpath", path="src/uu/realpath" } +relpath = { optional=true, version="0.0.6", package="uu_relpath", path="src/uu/relpath" } +rm = { optional=true, version="0.0.6", package="uu_rm", path="src/uu/rm" } +rmdir = { optional=true, version="0.0.6", package="uu_rmdir", path="src/uu/rmdir" } +seq = { optional=true, version="0.0.6", package="uu_seq", path="src/uu/seq" } +shred = { optional=true, version="0.0.6", package="uu_shred", path="src/uu/shred" } +shuf = { optional=true, version="0.0.6", package="uu_shuf", path="src/uu/shuf" } +sleep = { optional=true, version="0.0.6", package="uu_sleep", path="src/uu/sleep" } +sort = { optional=true, version="0.0.6", package="uu_sort", path="src/uu/sort" } +split = { optional=true, version="0.0.6", package="uu_split", path="src/uu/split" } +stat = { optional=true, version="0.0.6", package="uu_stat", path="src/uu/stat" } +stdbuf = { optional=true, version="0.0.6", package="uu_stdbuf", path="src/uu/stdbuf" } +sum = { optional=true, version="0.0.6", package="uu_sum", path="src/uu/sum" } +sync = { optional=true, version="0.0.6", package="uu_sync", path="src/uu/sync" } +tac = { optional=true, version="0.0.6", package="uu_tac", path="src/uu/tac" } +tail = { optional=true, version="0.0.6", package="uu_tail", path="src/uu/tail" } +tee = { optional=true, version="0.0.6", package="uu_tee", path="src/uu/tee" } +timeout = { optional=true, version="0.0.6", package="uu_timeout", path="src/uu/timeout" } +touch = { optional=true, version="0.0.6", package="uu_touch", path="src/uu/touch" } +tr = { optional=true, version="0.0.6", package="uu_tr", path="src/uu/tr" } +true = { optional=true, version="0.0.6", package="uu_true", path="src/uu/true" } +truncate = { optional=true, version="0.0.6", package="uu_truncate", path="src/uu/truncate" } +tsort = { optional=true, version="0.0.6", package="uu_tsort", path="src/uu/tsort" } +tty = { optional=true, version="0.0.6", package="uu_tty", path="src/uu/tty" } +uname = { optional=true, version="0.0.6", package="uu_uname", path="src/uu/uname" } +unexpand = { optional=true, version="0.0.6", package="uu_unexpand", path="src/uu/unexpand" } +uniq = { optional=true, version="0.0.6", package="uu_uniq", path="src/uu/uniq" } +unlink = { optional=true, version="0.0.6", package="uu_unlink", path="src/uu/unlink" } +uptime = { optional=true, version="0.0.6", package="uu_uptime", path="src/uu/uptime" } +users = { optional=true, version="0.0.6", package="uu_users", path="src/uu/users" } +wc = { optional=true, version="0.0.6", package="uu_wc", path="src/uu/wc" } +who = { optional=true, version="0.0.6", package="uu_who", path="src/uu/who" } +whoami = { optional=true, version="0.0.6", package="uu_whoami", path="src/uu/whoami" } +yes = { optional=true, version="0.0.6", package="uu_yes", path="src/uu/yes" } # # * pinned transitive dependencies # Not needed for now. Keep as examples: diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index e23067788..0b4359620 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_arch" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "arch ~ (uutils) display machine architecture" diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index d4415dd8c..a1d7ba17e 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base32" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "base32 ~ (uutils) decode/encode input (base32-encoding)" diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index e893caf3a..841ab140c 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base64" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "base64 ~ (uutils) decode/encode input (base64-encoding)" diff --git a/src/uu/basename/Cargo.toml b/src/uu/basename/Cargo.toml index 681ccf1c4..92d0ca4cd 100644 --- a/src/uu/basename/Cargo.toml +++ b/src/uu/basename/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_basename" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "basename ~ (uutils) display PATHNAME with leading directory components removed" diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 2176a5e0b..e44a874c1 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cat" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "cat ~ (uutils) concatenate and display input" diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index 2cefca4d8..9424ad35e 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chgrp" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "chgrp ~ (uutils) change the group ownership of FILE" diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index 71ded6d90..ac7030b62 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chmod" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "chmod ~ (uutils) change mode of FILE" diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index 27a30da17..74533af04 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chown" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "chown ~ (uutils) change the ownership of FILE" diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index 51fb9541d..bf1e0ef59 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chroot" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "chroot ~ (uutils) run COMMAND under a new root directory" diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index 2f589e877..0332efbf8 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cksum" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "cksum ~ (uutils) display CRC and size of input" diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index 9babe82ea..f02217790 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_comm" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "comm ~ (uutils) compare sorted inputs" diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index 53d27137f..9d582adae 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cp" -version = "0.0.5" +version = "0.0.6" authors = [ "Jordy Dickinson ", "Joshua S. Miller ", diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index a5eac1a02..7687991b0 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_csplit" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "csplit ~ (uutils) Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output" diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index 10a282ecf..9cc852d2e 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cut" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "cut ~ (uutils) display byte/field columns of input lines" diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index cacf29ff0..db6c077bd 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_date" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "date ~ (uutils) display or set the current time" diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index 049422ce5..4770cb557 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_df" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "df ~ (uutils) display file system information" diff --git a/src/uu/dircolors/Cargo.toml b/src/uu/dircolors/Cargo.toml index 9ed55d20d..5e822820e 100644 --- a/src/uu/dircolors/Cargo.toml +++ b/src/uu/dircolors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dircolors" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "dircolors ~ (uutils) display commands to set LS_COLORS" diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index 575aefd51..d3cd185e7 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dirname" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "dirname ~ (uutils) display parent directory of PATHNAME" diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index 01045f887..eb7b23f8b 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_du" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "du ~ (uutils) display disk usage" diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index 2ac09cd39..15f189030 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_echo" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "echo ~ (uutils) display TEXT" diff --git a/src/uu/env/Cargo.toml b/src/uu/env/Cargo.toml index fc5317184..ef0017e02 100644 --- a/src/uu/env/Cargo.toml +++ b/src/uu/env/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_env" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "env ~ (uutils) set each NAME to VALUE in the environment and run COMMAND" diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index 09575254a..4931cf53c 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expand" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "expand ~ (uutils) convert input tabs to spaces" diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index 7e38103aa..c535df7ce 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expr" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "expr ~ (uutils) display the value of EXPRESSION" diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index 1d415a951..489c713be 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_factor" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "factor ~ (uutils) display the prime factors of each NUMBER" diff --git a/src/uu/false/Cargo.toml b/src/uu/false/Cargo.toml index 5651888d7..d7cbcd13a 100644 --- a/src/uu/false/Cargo.toml +++ b/src/uu/false/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_false" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "false ~ (uutils) do nothing and fail" diff --git a/src/uu/fmt/Cargo.toml b/src/uu/fmt/Cargo.toml index 688967a5a..24ee13b35 100644 --- a/src/uu/fmt/Cargo.toml +++ b/src/uu/fmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fmt" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "fmt ~ (uutils) reformat each paragraph of input" diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index de1aa2dd5..f99abc691 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fold" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "fold ~ (uutils) wrap each line of input" diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index d005599de..1a56bc2ab 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_groups" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "groups ~ (uutils) display group memberships for USERNAME" diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index b08b853ef..04a22cac7 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hashsum" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "hashsum ~ (uutils) display or check input digests" diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index 2f5d97d62..3c383cb6f 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_head" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "head ~ (uutils) display the first lines of input" diff --git a/src/uu/hostid/Cargo.toml b/src/uu/hostid/Cargo.toml index e872aff06..ab6954104 100644 --- a/src/uu/hostid/Cargo.toml +++ b/src/uu/hostid/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostid" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "hostid ~ (uutils) display the numeric identifier of the current host" diff --git a/src/uu/hostname/Cargo.toml b/src/uu/hostname/Cargo.toml index bc4b10951..fb1d00682 100644 --- a/src/uu/hostname/Cargo.toml +++ b/src/uu/hostname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostname" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "hostname ~ (uutils) display or set the host name of the current host" diff --git a/src/uu/id/Cargo.toml b/src/uu/id/Cargo.toml index 6edb1d606..308d6089d 100644 --- a/src/uu/id/Cargo.toml +++ b/src/uu/id/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_id" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "id ~ (uutils) display user and group information for USER" diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 16f78bb7b..91463199a 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_install" -version = "0.0.5" +version = "0.0.6" authors = [ "Ben Eills ", "uutils developers", diff --git a/src/uu/join/Cargo.toml b/src/uu/join/Cargo.toml index 5b18603ab..9371b7601 100644 --- a/src/uu/join/Cargo.toml +++ b/src/uu/join/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_join" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "join ~ (uutils) merge lines from inputs with matching join fields" diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index 16a34de69..6b66806bc 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_kill" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "kill ~ (uutils) send a signal to a process" diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index 9c15d8682..13c3453cf 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_link" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "link ~ (uutils) create a hard (file system) link to FILE" diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index 2d7f39005..c19d8fb52 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ln" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "ln ~ (uutils) create a (file system) link to TARGET" diff --git a/src/uu/logname/Cargo.toml b/src/uu/logname/Cargo.toml index 896fd5eb7..416f817d7 100644 --- a/src/uu/logname/Cargo.toml +++ b/src/uu/logname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_logname" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "logname ~ (uutils) display the login name of the current user" diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index b1d44e485..e1d9b7990 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ls" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "ls ~ (uutils) display directory contents" diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index 44a7eb18b..a8d374bf9 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkdir" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "mkdir ~ (uutils) create DIRECTORY" diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index 8ff6694d6..d66003b10 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkfifo" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "mkfifo ~ (uutils) create FIFOs (named pipes)" diff --git a/src/uu/mknod/Cargo.toml b/src/uu/mknod/Cargo.toml index 9badb5f13..2c3ac8fb9 100644 --- a/src/uu/mknod/Cargo.toml +++ b/src/uu/mknod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mknod" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "mknod ~ (uutils) create special file NAME of TYPE" diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index 13685a586..c669f0acc 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mktemp" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "mktemp ~ (uutils) create and display a temporary file or directory from TEMPLATE" diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index c910d08b0..1f4bfed68 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_more" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "more ~ (uutils) input perusal filter" diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index f84a68c3c..8f1e7b9ee 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mv" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "mv ~ (uutils) move (rename) SOURCE to DESTINATION" diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index 2106b2d24..279e79ae3 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nice" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "nice ~ (uutils) run PROGRAM with modified scheduling priority" diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index f64182475..a51a2555e 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nl" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "nl ~ (uutils) display input with added line numbers" diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index 604e1e9da..5bbbd9dff 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nohup" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "nohup ~ (uutils) run COMMAND, ignoring hangup signals" diff --git a/src/uu/nproc/Cargo.toml b/src/uu/nproc/Cargo.toml index 2541c5a3e..be9d8f2e3 100644 --- a/src/uu/nproc/Cargo.toml +++ b/src/uu/nproc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nproc" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "nproc ~ (uutils) display the number of processing units available" diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index bde97cacb..ac5266d68 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_numfmt" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "numfmt ~ (uutils) reformat NUMBER" diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index a939c6ee4..6f9a75318 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_od" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "od ~ (uutils) display formatted representation of input" diff --git a/src/uu/paste/Cargo.toml b/src/uu/paste/Cargo.toml index 2ac2074ed..4e9971368 100644 --- a/src/uu/paste/Cargo.toml +++ b/src/uu/paste/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_paste" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "paste ~ (uutils) merge lines from inputs" diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index 63d00daac..8c4e61d2b 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pathchk" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "pathchk ~ (uutils) diagnose invalid or non-portable PATHNAME" diff --git a/src/uu/pinky/Cargo.toml b/src/uu/pinky/Cargo.toml index 96fb32e74..3f4a75241 100644 --- a/src/uu/pinky/Cargo.toml +++ b/src/uu/pinky/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pinky" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "pinky ~ (uutils) display user information" diff --git a/src/uu/printenv/Cargo.toml b/src/uu/printenv/Cargo.toml index f81240d77..be95b8157 100644 --- a/src/uu/printenv/Cargo.toml +++ b/src/uu/printenv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printenv" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "printenv ~ (uutils) display value of environment VAR" diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index 7f54decb5..bc77d31be 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printf" -version = "0.0.5" +version = "0.0.6" authors = [ "Nathan Ross", "uutils developers", diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index 889b4fafa..eb4413cbd 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ptx" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "ptx ~ (uutils) display a permuted index of input" diff --git a/src/uu/pwd/Cargo.toml b/src/uu/pwd/Cargo.toml index 43ddeac2e..f4350d54c 100644 --- a/src/uu/pwd/Cargo.toml +++ b/src/uu/pwd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pwd" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "pwd ~ (uutils) display current working directory" diff --git a/src/uu/readlink/Cargo.toml b/src/uu/readlink/Cargo.toml index 5d69125ce..6e4be4dd8 100644 --- a/src/uu/readlink/Cargo.toml +++ b/src/uu/readlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_readlink" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "readlink ~ (uutils) display resolved path of PATHNAME" diff --git a/src/uu/realpath/Cargo.toml b/src/uu/realpath/Cargo.toml index bd25d9980..327a875f8 100644 --- a/src/uu/realpath/Cargo.toml +++ b/src/uu/realpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_realpath" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "realpath ~ (uutils) display resolved absolute path of PATHNAME" diff --git a/src/uu/relpath/Cargo.toml b/src/uu/relpath/Cargo.toml index 34d3dd067..7a316c29c 100644 --- a/src/uu/relpath/Cargo.toml +++ b/src/uu/relpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_relpath" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "relpath ~ (uutils) display relative path of PATHNAME_TO from PATHNAME_FROM" diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index bd3415faf..961a8036c 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rm" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "rm ~ (uutils) remove PATHNAME" diff --git a/src/uu/rmdir/Cargo.toml b/src/uu/rmdir/Cargo.toml index cfd8dd6b0..b6e04f71c 100644 --- a/src/uu/rmdir/Cargo.toml +++ b/src/uu/rmdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rmdir" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "rmdir ~ (uutils) remove empty DIRECTORY" diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index 2e98a0bb8..96c629c68 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_seq" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "seq ~ (uutils) display a sequence of numbers" diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index 6157f3780..dda68b45b 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shred" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "shred ~ (uutils) hide former FILE contents with repeated overwrites" diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index 7f911c156..dbf559454 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shuf" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "shuf ~ (uutils) display random permutations of input lines" diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index 8ff8505e1..fe7ee2941 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sleep" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "sleep ~ (uutils) pause for DURATION" diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index e805d4fa2..7a6f95c41 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sort" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "sort ~ (uutils) sort input lines" diff --git a/src/uu/split/Cargo.toml b/src/uu/split/Cargo.toml index 6032c6351..056fbe034 100644 --- a/src/uu/split/Cargo.toml +++ b/src/uu/split/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_split" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "split ~ (uutils) split input into output files" diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index bf19f95b7..96bf63ffe 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stat" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "stat ~ (uutils) display FILE status" diff --git a/src/uu/stdbuf/Cargo.toml b/src/uu/stdbuf/Cargo.toml index 3fde13f72..22ce4de6a 100644 --- a/src/uu/stdbuf/Cargo.toml +++ b/src/uu/stdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "stdbuf ~ (uutils) run COMMAND with modified standard stream buffering" @@ -21,7 +21,7 @@ uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [build-dependencies] -libstdbuf = { version="0.0.5", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } +libstdbuf = { version="0.0.6", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } [[bin]] name = "stdbuf" diff --git a/src/uu/stdbuf/src/libstdbuf/Cargo.toml b/src/uu/stdbuf/src/libstdbuf/Cargo.toml index ba6e5ff42..86eb09d46 100644 --- a/src/uu/stdbuf/src/libstdbuf/Cargo.toml +++ b/src/uu/stdbuf/src/libstdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf_libstdbuf" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "stdbuf/libstdbuf ~ (uutils); dynamic library required for stdbuf" diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index b5a6d5d91..64b6d3de9 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sum" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "sum ~ (uutils) display checksum and block counts for input" diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index 39c49736a..fcff6002e 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sync" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "sync ~ (uutils) synchronize cache writes to storage" diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index 18e9fa430..3a530d0ce 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tac" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "tac ~ (uutils) concatenate and display input lines in reverse order" diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index 715a214e2..d3f60e09b 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tail" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "tail ~ (uutils) display the last lines of input" diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index c1841ce0f..7ac81adc4 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tee" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "tee ~ (uutils) display input and copy to FILE" diff --git a/src/uu/test/Cargo.toml b/src/uu/test/Cargo.toml index c03b84ab4..e1f6e62e7 100644 --- a/src/uu/test/Cargo.toml +++ b/src/uu/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_test" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "test ~ (uutils) evaluate comparison and file type expressions" diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index c32547559..51ac0bc0e 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_timeout" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "timeout ~ (uutils) run COMMAND with a DURATION time limit" diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index 6fa84cbdd..0608a7b7c 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_touch" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "touch ~ (uutils) change FILE timestamps" diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index 04c013659..a3d066bfb 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tr" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "tr ~ (uutils) translate characters within input and display" diff --git a/src/uu/true/Cargo.toml b/src/uu/true/Cargo.toml index 780288155..9f13318fd 100644 --- a/src/uu/true/Cargo.toml +++ b/src/uu/true/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_true" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "true ~ (uutils) do nothing and succeed" diff --git a/src/uu/truncate/Cargo.toml b/src/uu/truncate/Cargo.toml index 19f0d2736..e2c0afadc 100644 --- a/src/uu/truncate/Cargo.toml +++ b/src/uu/truncate/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_truncate" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "truncate ~ (uutils) truncate (or extend) FILE to SIZE" diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index 3f3d20170..37f543012 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tsort" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "tsort ~ (uutils) topologically sort input (partially ordered) pairs" diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index d2c5110b5..7be27a900 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tty" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "tty ~ (uutils) display the name of the terminal connected to standard input" diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index a0461e33f..9707d8444 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uname" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "uname ~ (uutils) display system information" diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index 6d1cad613..e39dd87ca 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unexpand" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "unexpand ~ (uutils) convert input spaces to tabs" diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index 53c2281c4..8c63455ec 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uniq" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "uniq ~ (uutils) filter identical adjacent lines from input" diff --git a/src/uu/unlink/Cargo.toml b/src/uu/unlink/Cargo.toml index ea18e2cbb..b193bd1b5 100644 --- a/src/uu/unlink/Cargo.toml +++ b/src/uu/unlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unlink" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "unlink ~ (uutils) remove a (file system) link to FILE" diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index 823879954..1136e6420 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uptime" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "uptime ~ (uutils) display dynamic system information" diff --git a/src/uu/users/Cargo.toml b/src/uu/users/Cargo.toml index 087272a59..84da13020 100644 --- a/src/uu/users/Cargo.toml +++ b/src/uu/users/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_users" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "users ~ (uutils) display names of currently logged-in users" diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index 3f44c1273..8ae79dc08 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_wc" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "wc ~ (uutils) display newline, word, and byte counts for input" diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index 928136b10..c0cd63795 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_who" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "who ~ (uutils) display information about currently logged-in users" diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index e843b2167..f8dc01440 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_whoami" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "whoami ~ (uutils) display user name of current effective user ID" diff --git a/src/uu/yes/Cargo.toml b/src/uu/yes/Cargo.toml index ab8a6faff..4a843ddd8 100644 --- a/src/uu/yes/Cargo.toml +++ b/src/uu/yes/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_yes" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "yes ~ (uutils) repeatedly display a line with STRING (or 'y')" diff --git a/util/update-version.sh b/util/update-version.sh index f5b66fb8c..042d43b71 100644 --- a/util/update-version.sh +++ b/util/update-version.sh @@ -3,8 +3,8 @@ # So, it should be triple-checked -FROM="0.0.4" -TO="0.0.5" +FROM="0.0.5" +TO="0.0.6" UUCORE_FROM="0.0.7" UUCORE_TO="0.0.8" @@ -19,8 +19,8 @@ sed -i -e "s|libstdbuf = { version=\"$FROM\"|libstdbuf = { version=\"$TO\"|" src sed -i -e "s|= { optional=true, version=\"$FROM\", package=\"uu_|= { optional=true, version=\"$TO\", package=\"uu_|g" Cargo.toml # Update uucore itself -sed -i -e "s|version = \"$UUCORE_FROM\"|version = \"$UUCORE_TO\"|" src/uucore/Cargo.toml +#sed -i -e "s|version = \"$UUCORE_FROM\"|version = \"$UUCORE_TO\"|" src/uucore/Cargo.toml # Update crates using uucore -sed -i -e "s|uucore = { version=\">=$UUCORE_FROM\",|uucore = { version=\">=$UUCORE_TO\",|" $PROGS +#sed -i -e "s|uucore = { version=\">=$UUCORE_FROM\",|uucore = { version=\">=$UUCORE_TO\",|" $PROGS From 54e9cb09dac17cdabd9d254c1dfade833d628f1c Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 3 Apr 2021 16:42:29 +0200 Subject: [PATCH 0254/1135] ls: add tests for --hide-control-chars --- tests/by-util/test_ls.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index b49620eb1..835a40a5e 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1162,6 +1162,24 @@ fn test_ls_quoting_style() { assert_eq!(result.stdout, format!("{}\n", correct)); } + for (arg, correct) in &[ + ("--quoting-style=literal", "one?two"), + ("-N", "one?two"), + ("--literal", "one?two"), + ("--quoting-style=shell", "one?two"), + ("--quoting-style=shell-always", "'one?two'"), + ] { + let result = scene + .ucmd() + .arg(arg) + .arg("--hide-control-chars") + .arg("one\ntwo") + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!(result.stdout, format!("{}\n", correct)); + } + for (arg, correct) in &[ ("--quoting-style=literal", "one\ntwo"), ("-N", "one\ntwo"), From b940b2d79c606baf027570d5d4b316ecfb9686f3 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci Date: Sat, 3 Apr 2021 18:24:29 +0300 Subject: [PATCH 0255/1135] dirname: move to clap, simplify code --- Cargo.lock | 1 + src/uu/dirname/Cargo.toml | 1 + src/uu/dirname/src/dirname.rs | 40 ++++++++++++++++++++++++++++------- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ea1ee53ae..47fa76428 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1720,6 +1720,7 @@ dependencies = [ name = "uu_dirname" version = "0.0.6" dependencies = [ + "clap", "libc", "uucore", "uucore_procs", diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index d3cd185e7..0975f33bb 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/dirname.rs" [dependencies] +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/dirname/src/dirname.rs b/src/uu/dirname/src/dirname.rs index 59f47ff01..1cf35d0c4 100644 --- a/src/uu/dirname/src/dirname.rs +++ b/src/uu/dirname/src/dirname.rs @@ -8,32 +8,57 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::path::Path; static NAME: &str = "dirname"; static SYNTAX: &str = "[OPTION] NAME..."; static SUMMARY: &str = "strip last component from file name"; +static VERSION: &str = env!("CARGO_PKG_VERSION"); static LONG_HELP: &str = " Output each NAME with its last non-slash component and trailing slashes removed; if NAME contains no /'s, output '.' (meaning the current directory). "; +mod options { + pub const ZERO: &str = "zero"; + pub const DIR: &str = "dir"; +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optflag("z", "zero", "separate output with NUL rather than newline") - .parse(args); + let matches = App::new(executable!()) + .name(NAME) + .usage(SYNTAX) + .about(SUMMARY) + .after_help(LONG_HELP) + .version(VERSION) + .arg( + Arg::with_name(options::ZERO) + .short(options::ZERO) + .short("z") + .takes_value(false) + .help("separate output with NUL rather than newline"), + ) + .arg(Arg::with_name(options::DIR).hidden(true).multiple(true)) + .get_matches_from(args); - let separator = if matches.opt_present("zero") { + let separator = if matches.is_present(options::ZERO) { "\0" } else { "\n" }; - if !matches.free.is_empty() { - for path in &matches.free { + let dirnames: Vec = matches + .values_of(options::DIR) + .unwrap_or_default() + .map(str::to_owned) + .collect(); + + if !dirnames.is_empty() { + for path in dirnames.iter() { let p = Path::new(path); match p.parent() { Some(d) => { @@ -54,8 +79,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { print!("{}", separator); } } else { - println!("{0}: missing operand", NAME); - println!("Try '{0} --help' for more information.", NAME); + show_usage_error!("missing operand"); return 1; } From cfc3d52be40958d7042c0f56368212a41c0e8dcf Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci Date: Sat, 3 Apr 2021 20:19:30 +0300 Subject: [PATCH 0256/1135] cut: move to clap --- Cargo.lock | 1 + src/uu/cut/Cargo.toml | 1 + src/uu/cut/src/cut.rs | 150 ++++++++++++++++++++++++++++++++++-------- 3 files changed, 124 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ea1ee53ae..15f1a606d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1679,6 +1679,7 @@ dependencies = [ name = "uu_cut" version = "0.0.6" dependencies = [ + "clap", "uucore", "uucore_procs", ] diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index 9cc852d2e..d892ddeb5 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/cut.rs" [dependencies] +clap = "2.33" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index 95411e3fb..2b65a3347 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -10,6 +10,7 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, Read, Stdout, Write}; use std::path::Path; @@ -20,6 +21,8 @@ use uucore::ranges::Range; mod buffer; mod searcher; +static NAME: &str = "cut"; +static VERSION: &str = env!("CARGO_PKG_VERSION"); static SYNTAX: &str = "[-d] [-s] [-z] [--output-delimiter] ((-f|-b|-c) {{sequence}}) {{sourcefile}}+"; static SUMMARY: &str = @@ -422,34 +425,119 @@ fn cut_files(mut filenames: Vec, mode: Mode) -> i32 { exit_code } +mod options { + pub const BYTES: &str = "bytes"; + pub const CHARACTERS: &str = "characters"; + pub const DELIMITER: &str = "delimiter"; + pub const FIELDS: &str = "fields"; + pub const LEGACY_OPTION: &str = "legacy-option"; + pub const ZERO_TERMINATED: &str = "zero-terminated"; + pub const ONLY_DELIMITED: &str = "only-delimited"; + pub const OUTPUT_DELIMITER: &str = "output-delimiter"; + pub const COMPLEMENT: &str = "complement"; + pub const FILE: &str = "file"; +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optopt("b", "bytes", "filter byte columns from the input source", "sequence") - .optopt("c", "characters", "alias for character mode", "sequence") - .optopt("d", "delimiter", "specify the delimiter character that separates fields in the input source. Defaults to Tab.", "delimiter") - .optopt("f", "fields", "filter field columns from the input source", "sequence") - .optflag("n", "", "legacy option - has no effect.") - .optflag("", "complement", "invert the filter - instead of displaying only the filtered columns, display all but those columns") - .optflag("s", "only-delimited", "in field mode, only print lines which contain the delimiter") - .optflag("z", "zero-terminated", "instead of filtering columns based on line, filter columns based on \\0 (NULL character)") - .optopt("", "output-delimiter", "in field mode, replace the delimiter in output lines with this option's argument", "new delimiter") - .parse(args); - let complement = matches.opt_present("complement"); + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(SYNTAX) + .about(SUMMARY) + .after_help(LONG_HELP) + .arg( + Arg::with_name(options::BYTES) + .short("b") + .long(options::BYTES) + .takes_value(true) + .help("filter byte columns from the input source") + .allow_hyphen_values(true) + .value_name("LIST"), + ) + .arg( + Arg::with_name(options::CHARACTERS) + .short("c") + .long(options::CHARACTERS) + .help("alias for character mode") + .takes_value(true) + .allow_hyphen_values(true) + .value_name("LIST"), + ) + .arg( + Arg::with_name(options::DELIMITER) + .short("d") + .long(options::DELIMITER) + .help("specify the delimiter character that separates fields in the input source. Defaults to Tab.") + .takes_value(true) + .value_name("DELIM"), + ) + .arg( + Arg::with_name(options::FIELDS) + .short("f") + .long(options::FIELDS) + .help("filter field columns from the input source") + .takes_value(true) + .allow_hyphen_values(true) + .value_name("LIST"), + ) + .arg( + Arg::with_name(options::LEGACY_OPTION) + .short("n") + .long(options::LEGACY_OPTION) + .help("legacy option - has no effect.") + .takes_value(false) + ) + .arg( + Arg::with_name(options::COMPLEMENT) + .long(options::COMPLEMENT) + .help("invert the filter - instead of displaying only the filtered columns, display all but those columns") + .takes_value(false) + + ) + .arg( + Arg::with_name(options::ONLY_DELIMITED) + .short("s") + .long(options::ONLY_DELIMITED) + .help("in field mode, only print lines which contain the delimiter") + .takes_value(false) + ) + .arg( + Arg::with_name(options::ZERO_TERMINATED) + .short("z") + .long(options::ZERO_TERMINATED) + .help("instead of filtering columns based on line, filter columns based on \\0 (NULL character)") + .takes_value(false) + ) + .arg( + Arg::with_name(options::OUTPUT_DELIMITER) + .long(options::OUTPUT_DELIMITER) + .help("in field mode, replace the delimiter in output lines with this option's argument") + .takes_value(true) + .value_name("NEW_DELIM") + ) + .arg( + Arg::with_name(options::FILE) + .hidden(true) + .multiple(true) + ) + .get_matches_from(args); + + let complement = matches.is_present("complement"); let mode_parse = match ( - matches.opt_str("bytes"), - matches.opt_str("characters"), - matches.opt_str("fields"), + matches.value_of(options::BYTES), + matches.value_of(options::CHARACTERS), + matches.value_of(options::FIELDS), ) { (Some(byte_ranges), None, None) => { list_to_ranges(&byte_ranges[..], complement).map(|ranges| { Mode::Bytes( ranges, Options { - out_delim: matches.opt_str("output-delimiter"), - zero_terminated: matches.opt_present("zero-terminated"), + out_delim: Some(matches.value_of(options::OUTPUT_DELIMITER).unwrap_or_default().to_owned()), + zero_terminated: matches.is_present(options::ZERO_TERMINATED), }, ) }) @@ -459,29 +547,29 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Mode::Characters( ranges, Options { - out_delim: matches.opt_str("output-delimiter"), - zero_terminated: matches.opt_present("zero-terminated"), + out_delim: Some(matches.value_of(options::OUTPUT_DELIMITER).unwrap_or_default().to_owned()), + zero_terminated: matches.is_present(options::ZERO_TERMINATED), }, ) }) } (None, None, Some(field_ranges)) => { list_to_ranges(&field_ranges[..], complement).and_then(|ranges| { - let out_delim = match matches.opt_str("output-delimiter") { + let out_delim = match matches.value_of(options::OUTPUT_DELIMITER) { Some(s) => { if s.is_empty() { Some("\0".to_owned()) } else { - Some(s) + Some(s.to_owned()) } } None => None, }; - let only_delimited = matches.opt_present("only-delimited"); - let zero_terminated = matches.opt_present("zero-terminated"); + let only_delimited = matches.is_present(options::ONLY_DELIMITED); + let zero_terminated = matches.is_present(options::ZERO_TERMINATED); - match matches.opt_str("delimiter") { + match matches.value_of(options::DELIMITER) { Some(delim) => { if delim.chars().count() > 1 { Err(msg_opt_invalid_should_be!( @@ -494,7 +582,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let delim = if delim.is_empty() { "\0".to_owned() } else { - delim + delim.to_owned() }; Ok(Mode::Fields( @@ -533,10 +621,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let mode_parse = match mode_parse { Err(_) => mode_parse, Ok(mode) => match mode { - Mode::Bytes(_, _) | Mode::Characters(_, _) if matches.opt_present("delimiter") => Err( + Mode::Bytes(_, _) | Mode::Characters(_, _) if matches.is_present("delimiter") => Err( msg_opt_only_usable_if!("printing a sequence of fields", "--delimiter", "-d"), ), - Mode::Bytes(_, _) | Mode::Characters(_, _) if matches.opt_present("only-delimited") => { + Mode::Bytes(_, _) | Mode::Characters(_, _) if matches.is_present("only-delimited") => { Err(msg_opt_only_usable_if!( "printing a sequence of fields", "--only-delimited", @@ -547,8 +635,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }, }; + let files: Vec = matches + .values_of(options::FILE) + .unwrap_or_default() + .map(str::to_owned) + .collect(); + match mode_parse { - Ok(mode) => cut_files(matches.free, mode), + Ok(mode) => cut_files(files, mode), Err(err_msg) => { show_error!("{}", err_msg); 1 From 7e677b3e6c2b03203efe9039d05163434ac0cbcd Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci Date: Sat, 3 Apr 2021 20:21:57 +0300 Subject: [PATCH 0257/1135] cut: fix formatting, use constant values --- src/uu/cut/src/cut.rs | 33 +++++++++++++++++++++++++-------- src/uu/stdbuf/src/stdbuf.rs | 3 +-- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index 2b65a3347..3781f0c9f 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -494,7 +494,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::COMPLEMENT) .help("invert the filter - instead of displaying only the filtered columns, display all but those columns") .takes_value(false) - ) .arg( Arg::with_name(options::ONLY_DELIMITED) @@ -524,7 +523,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) .get_matches_from(args); - let complement = matches.is_present("complement"); + let complement = matches.is_present(options::COMPLEMENT); let mode_parse = match ( matches.value_of(options::BYTES), @@ -536,7 +535,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Mode::Bytes( ranges, Options { - out_delim: Some(matches.value_of(options::OUTPUT_DELIMITER).unwrap_or_default().to_owned()), + out_delim: Some( + matches + .value_of(options::OUTPUT_DELIMITER) + .unwrap_or_default() + .to_owned(), + ), zero_terminated: matches.is_present(options::ZERO_TERMINATED), }, ) @@ -547,7 +551,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Mode::Characters( ranges, Options { - out_delim: Some(matches.value_of(options::OUTPUT_DELIMITER).unwrap_or_default().to_owned()), + out_delim: Some( + matches + .value_of(options::OUTPUT_DELIMITER) + .unwrap_or_default() + .to_owned(), + ), zero_terminated: matches.is_present(options::ZERO_TERMINATED), }, ) @@ -621,10 +630,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let mode_parse = match mode_parse { Err(_) => mode_parse, Ok(mode) => match mode { - Mode::Bytes(_, _) | Mode::Characters(_, _) if matches.is_present("delimiter") => Err( - msg_opt_only_usable_if!("printing a sequence of fields", "--delimiter", "-d"), - ), - Mode::Bytes(_, _) | Mode::Characters(_, _) if matches.is_present("only-delimited") => { + Mode::Bytes(_, _) | Mode::Characters(_, _) + if matches.is_present(options::DELIMITER) => + { + Err(msg_opt_only_usable_if!( + "printing a sequence of fields", + "--delimiter", + "-d" + )) + } + Mode::Bytes(_, _) | Mode::Characters(_, _) + if matches.is_present(options::ONLY_DELIMITED) => + { Err(msg_opt_only_usable_if!( "printing a sequence of fields", "--only-delimited", diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index a61ba967b..67ed9a838 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -80,8 +80,7 @@ fn print_version() { fn print_usage(opts: &Options) { let brief = "Run COMMAND, with modified buffering operations for its standard streams\n \ Mandatory arguments to long options are mandatory for short options too."; - let explanation = - "If MODE is 'L' the corresponding stream will be line buffered.\n \ + let explanation = "If MODE is 'L' the corresponding stream will be line buffered.\n \ This option is invalid with standard input.\n\n \ If MODE is '0' the corresponding stream will be unbuffered.\n\n \ Otherwise MODE is a number which may be followed by one of the following:\n\n \ From e84b60b7d5464db90a727b432150d90324f2b000 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci Date: Sat, 3 Apr 2021 20:30:28 +0300 Subject: [PATCH 0258/1135] cut: add display order --- src/uu/cut/src/cut.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index 3781f0c9f..ddedc4727 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -430,7 +430,6 @@ mod options { pub const CHARACTERS: &str = "characters"; pub const DELIMITER: &str = "delimiter"; pub const FIELDS: &str = "fields"; - pub const LEGACY_OPTION: &str = "legacy-option"; pub const ZERO_TERMINATED: &str = "zero-terminated"; pub const ONLY_DELIMITED: &str = "only-delimited"; pub const OUTPUT_DELIMITER: &str = "output-delimiter"; @@ -454,7 +453,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .help("filter byte columns from the input source") .allow_hyphen_values(true) - .value_name("LIST"), + .value_name("LIST") + .display_order(1), ) .arg( Arg::with_name(options::CHARACTERS) @@ -463,7 +463,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("alias for character mode") .takes_value(true) .allow_hyphen_values(true) - .value_name("LIST"), + .value_name("LIST") + .display_order(2), ) .arg( Arg::with_name(options::DELIMITER) @@ -471,7 +472,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::DELIMITER) .help("specify the delimiter character that separates fields in the input source. Defaults to Tab.") .takes_value(true) - .value_name("DELIM"), + .value_name("DELIM") + .display_order(3), ) .arg( Arg::with_name(options::FIELDS) @@ -480,20 +482,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("filter field columns from the input source") .takes_value(true) .allow_hyphen_values(true) - .value_name("LIST"), - ) - .arg( - Arg::with_name(options::LEGACY_OPTION) - .short("n") - .long(options::LEGACY_OPTION) - .help("legacy option - has no effect.") - .takes_value(false) + .value_name("LIST") + .display_order(4), ) .arg( Arg::with_name(options::COMPLEMENT) .long(options::COMPLEMENT) .help("invert the filter - instead of displaying only the filtered columns, display all but those columns") .takes_value(false) + .display_order(5), ) .arg( Arg::with_name(options::ONLY_DELIMITED) @@ -501,6 +498,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::ONLY_DELIMITED) .help("in field mode, only print lines which contain the delimiter") .takes_value(false) + .display_order(6), ) .arg( Arg::with_name(options::ZERO_TERMINATED) @@ -508,6 +506,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::ZERO_TERMINATED) .help("instead of filtering columns based on line, filter columns based on \\0 (NULL character)") .takes_value(false) + .display_order(8), ) .arg( Arg::with_name(options::OUTPUT_DELIMITER) @@ -515,6 +514,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("in field mode, replace the delimiter in output lines with this option's argument") .takes_value(true) .value_name("NEW_DELIM") + .display_order(7), ) .arg( Arg::with_name(options::FILE) From f47345ec9bb452068eaa8bf2af51a1bae3a5148b Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci Date: Sat, 3 Apr 2021 20:55:10 +0300 Subject: [PATCH 0259/1135] cut: add gnu compatability to error messages --- src/uu/cut/src/cut.rs | 9 +++++++-- tests/by-util/test_cut.rs | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index ddedc4727..6b09b91d9 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -401,8 +401,13 @@ fn cut_files(mut filenames: Vec, mode: Mode) -> i32 { } else { let path = Path::new(&filename[..]); - if !path.exists() { - show_error!("{}", msg_args_nonexistent_file!(filename)); + if path.is_dir() { + show_error!("{}: Is a directory", filename); + continue; + } + + if !path.metadata().is_ok() { + show_error!("{}: No such file or directory", filename); continue; } diff --git a/tests/by-util/test_cut.rs b/tests/by-util/test_cut.rs index fc0f1b1f9..875317721 100644 --- a/tests/by-util/test_cut.rs +++ b/tests/by-util/test_cut.rs @@ -139,3 +139,21 @@ fn test_zero_terminated_only_delimited() { .succeeds() .stdout_only("82\n7\0"); } + +#[test] +fn test_directory_and_no_such_file() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.mkdir("some"); + + ucmd.arg("-b1") + .arg("some") + .run() + .stderr_is("cut: error: some: Is a directory\n"); + + new_ucmd!() + .arg("-b1") + .arg("some") + .run() + .stderr_is("cut: error: some: No such file or directory\n"); +} From bad1df9c1b9b31d26fc3e9f8de59094137b813fe Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Fri, 2 Apr 2021 08:47:04 -0400 Subject: [PATCH 0260/1135] fold: improve newline handling and test coverage - refactor implementation for readability - correct handling of files with no trailing newline and/or blank lines --- src/uu/fold/src/fold.rs | 263 +++++++++++++++++++++-------------- tests/by-util/test_fold.rs | 277 +++++++++++++++++++++++++++++++++++++ 2 files changed, 433 insertions(+), 107 deletions(-) diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index 27ab319d0..8cf95b82a 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -79,7 +79,6 @@ fn handle_obsolete(args: &[String]) -> (Vec, Option) { (args.to_vec(), None) } -#[inline] fn fold(filenames: Vec, bytes: bool, spaces: bool, width: usize) { for filename in &filenames { let filename: &str = &filename; @@ -92,123 +91,173 @@ fn fold(filenames: Vec, bytes: bool, spaces: bool, width: usize) { file_buf = safe_unwrap!(File::open(Path::new(filename))); &mut file_buf as &mut dyn Read }); - fold_file(buffer, bytes, spaces, width); + + if bytes { + fold_file_bytewise(buffer, spaces, width); + } else { + fold_file(buffer, spaces, width); + } } } -#[inline] -fn fold_file(file: BufReader, bytes: bool, spaces: bool, width: usize) { - for line_result in file.lines() { - let mut line = safe_unwrap!(line_result); +/// Fold `file` to fit `width` (number of columns), counting all characters as +/// one column. +/// +/// This function handles folding for the `-b`/`--bytes` option, counting +/// tab, backspace, and carriage return as occupying one column, identically +/// to all other characters in the stream. +/// +/// If `spaces` is `true`, attempt to break lines at whitespace boundaries. +fn fold_file_bytewise(mut file: BufReader, spaces: bool, width: usize) { + let mut line = String::new(); - if line.is_empty() { + loop { + if let Ok(0) = file.read_line(&mut line) { + break; + } + + if line == "\n" { println!(); - } else if bytes { - let len = line.len(); - let mut i = 0; - while i < len { - let width = if len - i >= width { width } else { len - i }; - let slice = { - let slice = &line[i..i + width]; - if spaces && i + width < len { - match slice.rfind(char::is_whitespace) { - Some(m) => &slice[..=m], - None => slice, - } - } else { - slice + line.truncate(0); + continue; + } + + let len = line.len(); + let mut i = 0; + + while i < len { + let width = if len - i >= width { width } else { len - i }; + let slice = { + let slice = &line[i..i + width]; + if spaces && i + width < len { + match slice.rfind(char::is_whitespace) { + Some(m) => &slice[..=m], + None => slice, } - }; - print!("{}", slice); - i += slice.len(); + } else { + slice + } + }; + + // Don't duplicate trailing newlines: if the slice is "\n", the + // previous iteration folded just before the end of the line and + // has already printed this newline. + if slice == "\n" { + break; } - } else { - let mut len = line.chars().count(); - let newline = line.ends_with('\n'); - if newline { - if len == 1 { - println!(); + + i += slice.len(); + + let at_eol = i >= len; + + if at_eol { + print!("{}", slice); + } else { + println!("{}", slice); + } + } + + line.truncate(0); + } +} + +/// Fold `file` to fit `width` (number of columns). +/// +/// By default `fold` treats tab, backspace, and carriage return specially: +/// tab characters count as 8 columns, backspace decreases the +/// column count, and carriage return resets the column count to 0. +/// +/// If `spaces` is `true`, attempt to break lines at whitespace boundaries. +#[allow(unused_assignments)] +fn fold_file(mut file: BufReader, spaces: bool, width: usize) { + let mut line = String::new(); + let mut output = String::new(); + let mut col_count = 0; + let mut char_count = 0; + let mut last_space = None; + + /// Print the output line, resetting the column and character counts. + /// + /// If `spaces` is `true`, print the output line up to the last + /// encountered whitespace character (inclusive) and set the remaining + /// characters as the start of the next line. + macro_rules! emit_output { + () => { + let consume = match last_space { + Some(i) => i + 1, + None => output.len(), + }; + + println!("{}", &output[..consume]); + output.replace_range(..consume, ""); + char_count = output.len(); + + // we know there are no tabs left in output, so each char counts + // as 1 column + col_count = char_count; + + last_space = None; + }; + } + + loop { + if let Ok(0) = file.read_line(&mut line) { + break; + } + + for ch in line.chars() { + if ch == '\n' { + // make sure to _not_ split output at whitespace, since we + // know the entire output will fit + last_space = None; + emit_output!(); + break; + } + + if col_count >= width { + emit_output!(); + } + + match ch { + '\t' => { + if col_count + 8 > width && !output.is_empty() { + emit_output!(); + } + col_count += 8; + last_space = Some(char_count); + } + '\x08' => { + // FIXME: does not match GNU's handling of backspace + if col_count > 0 { + col_count -= 1; + char_count -= 1; + output.truncate(char_count); + } continue; } - len -= 1; - line.truncate(len); - } - let mut output = String::new(); - let mut count = 0; - for (i, ch) in line.chars().enumerate() { - if count >= width { - let (val, ncount) = { - let slice = &output[..]; - let (out, val, ncount) = if spaces && i + 1 < len { - match rfind_whitespace(slice) { - Some(m) => { - let routput = &slice[m + 1..slice.chars().count()]; - let ncount = routput.chars().fold(0, |out, ch: char| { - out + match ch { - '\t' => 8, - '\x08' => { - if out > 0 { - !0 - } else { - 0 - } - } - '\r' => return 0, - _ => 1, - } - }); - (&slice[0..=m], routput, ncount) - } - None => (slice, "", 0), - } - } else { - (slice, "", 0) - }; - println!("{}", out); - (val.to_owned(), ncount) - }; - output = val; - count = ncount; + '\r' => { + // FIXME: does not match GNU's handling of carriage return + output.truncate(0); + col_count = 0; + char_count = 0; + continue; } - match ch { - '\t' => { - count += 8; - if count > width { - println!("{}", output); - output.truncate(0); - count = 8; - } - } - '\x08' => { - if count > 0 { - count -= 1; - let len = output.len() - 1; - output.truncate(len); - } - continue; - } - '\r' => { - output.truncate(0); - count = 0; - continue; - } - _ => count += 1, - }; - output.push(ch); - } - if count > 0 { - println!("{}", output); - } - } - } -} + _ if spaces && ch.is_whitespace() => { + last_space = Some(char_count); + col_count += 1 + } + _ => col_count += 1, + }; -#[inline] -fn rfind_whitespace(slice: &str) -> Option { - for (i, ch) in slice.chars().rev().enumerate() { - if ch.is_whitespace() { - return Some(slice.chars().count() - (i + 1)); + output.push(ch); + char_count += 1; } + + if col_count > 0 { + print!("{}", output); + output.truncate(0); + } + + line.truncate(0); } - None } diff --git a/tests/by-util/test_fold.rs b/tests/by-util/test_fold.rs index 64d77cd2b..52e630e5b 100644 --- a/tests/by-util/test_fold.rs +++ b/tests/by-util/test_fold.rs @@ -32,6 +32,24 @@ fn test_default_wrap_with_newlines() { .stdout_is_fixture("lorem_ipsum_new_line_80_column.expected"); } +#[test] +fn test_should_preserve_empty_line_without_final_newline() { + new_ucmd!() + .arg("-w2") + .pipe_in("12\n\n34") + .succeeds() + .stdout_is("12\n\n34"); +} + +#[test] +fn test_should_preserve_empty_line_and_final_newline() { + new_ucmd!() + .arg("-w2") + .pipe_in("12\n\n34\n") + .succeeds() + .stdout_is("12\n\n34\n"); +} + #[test] fn test_should_preserve_empty_lines() { new_ucmd!().pipe_in("\n").succeeds().stdout_is("\n"); @@ -57,3 +75,262 @@ fn test_word_boundary_split_should_preserve_empty_lines() { .succeeds() .stdout_is("0\n1\n\n2\n\n\n"); } + +#[test] +fn test_should_not_add_newline_when_line_less_than_fold() { + new_ucmd!().pipe_in("1234").succeeds().stdout_is("1234"); +} + +#[test] +fn test_should_not_add_newline_when_line_longer_than_fold() { + new_ucmd!() + .arg("-w2") + .pipe_in("1234") + .succeeds() + .stdout_is("12\n34"); +} + +#[test] +fn test_should_not_add_newline_when_line_equal_to_fold() { + new_ucmd!() + .arg("-w1") + .pipe_in(" ") + .succeeds() + .stdout_is(" "); +} + +#[test] +fn test_should_preserve_final_newline_when_line_less_than_fold() { + new_ucmd!().pipe_in("1234\n").succeeds().stdout_is("1234\n"); +} + +#[test] +fn test_should_preserve_final_newline_when_line_longer_than_fold() { + new_ucmd!() + .arg("-w2") + .pipe_in("1234\n") + .succeeds() + .stdout_is("12\n34\n"); +} + +#[test] +fn test_should_preserve_final_newline_when_line_equal_to_fold() { + new_ucmd!() + .arg("-w2") + .pipe_in("1\n") + .succeeds() + .stdout_is("1\n"); +} + +#[test] +fn test_single_tab_should_not_add_extra_newline() { + new_ucmd!() + .arg("-w1") + .pipe_in("\t") + .succeeds() + .stdout_is("\t"); +} + +#[test] +fn test_tab_counts_as_8_columns() { + new_ucmd!() + .arg("-w8") + .pipe_in("\t1") + .succeeds() + .stdout_is("\t\n1"); +} + +#[test] +fn test_fold_at_word_boundary() { + new_ucmd!() + .args(&["-w4", "-s"]) + .pipe_in("one two") + .succeeds() + .stdout_is("one \ntwo"); +} + +#[test] +fn test_fold_at_leading_word_boundary() { + new_ucmd!() + .args(&["-w3", "-s"]) + .pipe_in(" aaa") + .succeeds() + .stdout_is(" \naaa"); +} + +#[test] +fn test_fold_at_word_boundary_preserve_final_newline() { + new_ucmd!() + .args(&["-w4", "-s"]) + .pipe_in("one two\n") + .succeeds() + .stdout_is("one \ntwo\n"); +} + +#[test] +fn test_fold_at_tab_as_word_boundary() { + new_ucmd!() + .args(&["-w10", "-s"]) + .pipe_in("a\tbbb\n") + .succeeds() + .stdout_is("a\t\nbbb\n"); +} + +#[test] +fn test_fold_at_word_boundary_only_whitespace() { + new_ucmd!() + .args(&["-w2", "-s"]) + .pipe_in(" ") + .succeeds() + .stdout_is(" \n "); +} + +#[test] +fn test_fold_at_word_boundary_only_whitespace_preserve_final_newline() { + new_ucmd!() + .args(&["-w2", "-s"]) + .pipe_in(" \n") + .succeeds() + .stdout_is(" \n \n"); +} + +// +// bytewise tests + +#[test] +fn test_bytewise_should_preserve_empty_line_without_final_newline() { + new_ucmd!() + .args(&["-w2", "-b"]) + .pipe_in("123\n\n45") + .succeeds() + .stdout_is("12\n3\n\n45"); +} + +#[test] +fn test_bytewise_should_preserve_empty_line_and_final_newline() { + new_ucmd!() + .args(&["-w2", "-b"]) + .pipe_in("12\n\n34\n") + .succeeds() + .stdout_is("12\n\n34\n"); +} + +#[test] +fn test_bytewise_should_preserve_empty_lines() { + new_ucmd!() + .arg("-b") + .pipe_in("\n") + .succeeds() + .stdout_is("\n"); + + new_ucmd!() + .args(&["-w1", "-b"]) + .pipe_in("0\n1\n\n2\n\n\n") + .succeeds() + .stdout_is("0\n1\n\n2\n\n\n"); +} + +#[test] +fn test_bytewise_word_boundary_split_should_preserve_empty_lines() { + new_ucmd!() + .args(&["-s", "-b"]) + .pipe_in("\n") + .succeeds() + .stdout_is("\n"); + + new_ucmd!() + .args(&["-w1", "-s", "-b"]) + .pipe_in("0\n1\n\n2\n\n\n") + .succeeds() + .stdout_is("0\n1\n\n2\n\n\n"); +} + +#[test] +fn test_bytewise_should_not_add_newline_when_line_less_than_fold() { + new_ucmd!() + .arg("-b") + .pipe_in("1234") + .succeeds() + .stdout_is("1234"); +} + +#[test] +fn test_bytewise_should_not_add_newline_when_line_longer_than_fold() { + new_ucmd!() + .args(&["-w2", "-b"]) + .pipe_in("1234") + .succeeds() + .stdout_is("12\n34"); +} + +#[test] +fn test_bytewise_should_not_add_newline_when_line_equal_to_fold() { + new_ucmd!() + .args(&["-w1", "-b"]) + .pipe_in(" ") + .succeeds() + .stdout_is(" "); +} + +#[test] +fn test_bytewise_should_preserve_final_newline_when_line_less_than_fold() { + new_ucmd!() + .arg("-b") + .pipe_in("1234\n") + .succeeds() + .stdout_is("1234\n"); +} + +#[test] +fn test_bytewise_should_preserve_final_newline_when_line_longer_than_fold() { + new_ucmd!() + .args(&["-w2", "-b"]) + .pipe_in("1234\n") + .succeeds() + .stdout_is("12\n34\n"); +} + +#[test] +fn test_bytewise_should_preserve_final_newline_when_line_equal_to_fold() { + new_ucmd!() + .args(&["-w2", "-b"]) + .pipe_in("1\n") + .succeeds() + .stdout_is("1\n"); +} + +#[test] +fn test_bytewise_single_tab_should_not_add_extra_newline() { + new_ucmd!() + .args(&["-w1", "-b"]) + .pipe_in("\t") + .succeeds() + .stdout_is("\t"); +} + +#[test] +fn test_tab_counts_as_one_byte() { + new_ucmd!() + .args(&["-w2", "-b"]) + .pipe_in("1\t2\n") + .succeeds() + .stdout_is("1\t\n2\n"); +} + +#[test] +fn test_bytewise_fold_at_word_boundary_only_whitespace() { + new_ucmd!() + .args(&["-w2", "-s", "-b"]) + .pipe_in(" ") + .succeeds() + .stdout_is(" \n "); +} + +#[test] +fn test_bytewise_fold_at_word_boundary_only_whitespace_preserve_final_newline() { + new_ucmd!() + .args(&["-w2", "-s", "-b"]) + .pipe_in(" \n") + .succeeds() + .stdout_is(" \n \n"); +} From 19c6a42de550ca6dd0f4ffd0d8a546b3e4146cc9 Mon Sep 17 00:00:00 2001 From: Chirag Jadwani Date: Sun, 4 Apr 2021 15:07:29 +0530 Subject: [PATCH 0261/1135] uniq: implement group option --- Cargo.lock | 35 +++++++++ src/uu/uniq/Cargo.toml | 2 + src/uu/uniq/src/uniq.rs | 83 ++++++++++++++++------ tests/by-util/test_uniq.rs | 45 ++++++++++++ tests/fixtures/uniq/group-append.expected | 26 +++++++ tests/fixtures/uniq/group-both.expected | 27 +++++++ tests/fixtures/uniq/group-prepend.expected | 26 +++++++ tests/fixtures/uniq/group.expected | 25 +++++++ 8 files changed, 249 insertions(+), 20 deletions(-) create mode 100644 tests/fixtures/uniq/group-append.expected create mode 100644 tests/fixtures/uniq/group-both.expected create mode 100644 tests/fixtures/uniq/group-prepend.expected create mode 100644 tests/fixtures/uniq/group.expected diff --git a/Cargo.lock b/Cargo.lock index ea1ee53ae..97398b7a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -650,6 +650,15 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" +[[package]] +name = "heck" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "hermit-abi" version = "0.1.18" @@ -1352,6 +1361,24 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +[[package]] +name = "strum" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7318c509b5ba57f18533982607f24070a55d353e90d4cae30c467cdb2ad5ac5c" + +[[package]] +name = "strum_macros" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8bc6b87a5112aeeab1f4a9f7ab634fe6cbefc4850006df31267f4cfb9e3149" +dependencies = [ + "heck", + "proc-macro2", + "quote 1.0.9", + "syn", +] + [[package]] name = "syn" version = "1.0.68" @@ -1499,6 +1526,12 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +[[package]] +name = "unicode-segmentation" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" + [[package]] name = "unicode-width" version = "0.1.8" @@ -2455,6 +2488,8 @@ name = "uu_uniq" version = "0.0.6" dependencies = [ "clap", + "strum", + "strum_macros", "uucore", "uucore_procs", ] diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index 8c63455ec..3fe89b450 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -16,6 +16,8 @@ path = "src/uniq.rs" [dependencies] clap = "2.33" +strum = "0.20" +strum_macros = "0.20" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/uniq/src/uniq.rs b/src/uu/uniq/src/uniq.rs index a1809f0f0..a61a78a61 100644 --- a/src/uu/uniq/src/uniq.rs +++ b/src/uu/uniq/src/uniq.rs @@ -13,6 +13,7 @@ use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Result, Write}; use std::path::Path; use std::str::FromStr; +use strum_macros::{AsRefStr, EnumString}; static ABOUT: &str = "Report or omit repeated lines."; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -26,14 +27,18 @@ pub mod options { pub static SKIP_CHARS: &str = "skip-chars"; pub static UNIQUE: &str = "unique"; pub static ZERO_TERMINATED: &str = "zero-terminated"; + pub static GROUP: &str = "group"; } static ARG_FILES: &str = "files"; -#[derive(PartialEq)] +#[derive(PartialEq, Clone, Copy, AsRefStr, EnumString)] +#[strum(serialize_all = "snake_case")] enum Delimiters { + Append, Prepend, Separate, + Both, None, } @@ -58,22 +63,33 @@ impl Uniq { ) { let mut lines: Vec = vec![]; let mut first_line_printed = false; - let delimiters = &self.delimiters; + let delimiters = self.delimiters; let line_terminator = self.get_line_terminator(); + // Don't print any delimiting lines before, after or between groups if delimiting method is 'none' + let no_delimiters = delimiters == Delimiters::None; + // The 'prepend' and 'both' delimit methods will cause output to start with delimiter line + let prepend_delimiter = delimiters == Delimiters::Prepend || delimiters == Delimiters::Both; + // The 'append' and 'both' delimit methods will cause output to end with delimiter line + let append_delimiter = delimiters == Delimiters::Append || delimiters == Delimiters::Both; for line in reader.split(line_terminator).map(get_line_string) { if !lines.is_empty() && self.cmp_keys(&lines[0], &line) { - let print_delimiter = delimiters == &Delimiters::Prepend - || (delimiters == &Delimiters::Separate && first_line_printed); + // Print delimiter if delimit method is not 'none' and any line has been output + // before or if we need to start output with delimiter + let print_delimiter = !no_delimiters && (prepend_delimiter || first_line_printed); first_line_printed |= self.print_lines(writer, &lines, print_delimiter); lines.truncate(0); } lines.push(line); } if !lines.is_empty() { - let print_delimiter = delimiters == &Delimiters::Prepend - || (delimiters == &Delimiters::Separate && first_line_printed); - self.print_lines(writer, &lines, print_delimiter); + // Print delimiter if delimit method is not 'none' and any line has been output + // before or if we need to start output with delimiter + let print_delimiter = !no_delimiters && (prepend_delimiter || first_line_printed); + first_line_printed |= self.print_lines(writer, &lines, print_delimiter); + } + if append_delimiter && first_line_printed { + crash_if_err!(1, writer.write_all(&[line_terminator])); } } @@ -233,10 +249,30 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(options::ALL_REPEATED) .short("D") .long(options::ALL_REPEATED) - .possible_values(&["none", "prepend", "separate"]) - .help("print all duplicate lines. Delimiting is done with blank lines") + .possible_values(&[ + Delimiters::None.as_ref(), Delimiters::Prepend.as_ref(), Delimiters::Separate.as_ref() + ]) + .help("print all duplicate lines. Delimiting is done with blank lines. [default: none]") .value_name("delimit-method") - .default_value("none"), + .min_values(0) + .max_values(1), + ) + .arg( + Arg::with_name(options::GROUP) + .long(options::GROUP) + .possible_values(&[ + Delimiters::Separate.as_ref(), Delimiters::Prepend.as_ref(), + Delimiters::Append.as_ref(), Delimiters::Both.as_ref() + ]) + .help("show all items, separating groups with an empty line. [default: separate]") + .value_name("group-method") + .min_values(0) + .max_values(1) + .conflicts_with_all(&[ + options::REPEATED, + options::ALL_REPEATED, + options::UNIQUE, + ]), ) .arg( Arg::with_name(options::CHECK_CHARS) @@ -314,17 +350,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let uniq = Uniq { repeats_only: matches.is_present(options::REPEATED) - || matches.occurrences_of(options::ALL_REPEATED) > 0, + || matches.is_present(options::ALL_REPEATED), uniques_only: matches.is_present(options::UNIQUE), - all_repeated: matches.occurrences_of(options::ALL_REPEATED) > 0, - delimiters: match matches.value_of(options::ALL_REPEATED).map(String::from) { - Some(ref opt_arg) if opt_arg != "none" => match &(*opt_arg.as_str()) { - "prepend" => Delimiters::Prepend, - "separate" => Delimiters::Separate, - _ => crash!(1, "Incorrect argument for all-repeated: {}", opt_arg), - }, - _ => Delimiters::None, - }, + all_repeated: matches.is_present(options::ALL_REPEATED) + || matches.is_present(options::GROUP), + delimiters: get_delimiter(&matches), show_counts: matches.is_present(options::COUNT), skip_fields: opt_parsed(options::SKIP_FIELDS, &matches), slice_start: opt_parsed(options::SKIP_CHARS, &matches), @@ -340,6 +370,19 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } +fn get_delimiter(matches: &ArgMatches) -> Delimiters { + let value = matches + .value_of(options::ALL_REPEATED) + .or_else(|| matches.value_of(options::GROUP)); + if let Some(delimiter_arg) = value { + crash_if_err!(1, Delimiters::from_str(delimiter_arg)) + } else if matches.is_present(options::GROUP) { + Delimiters::Separate + } else { + Delimiters::None + } +} + fn open_input_file(in_file_name: String) -> BufReader> { let in_file = if in_file_name == "-" { Box::new(stdin()) as Box diff --git a/tests/by-util/test_uniq.rs b/tests/by-util/test_uniq.rs index 22e67540e..c1e53faf3 100644 --- a/tests/by-util/test_uniq.rs +++ b/tests/by-util/test_uniq.rs @@ -147,3 +147,48 @@ fn test_invalid_utf8() { .failure() .stderr_only("uniq: error: invalid utf-8 sequence of 1 bytes from index 0"); } + +#[test] +fn test_group() { + new_ucmd!() + .args(&["--group"]) + .pipe_in_fixture(INPUT) + .run() + .stdout_is_fixture("group.expected"); +} + +#[test] +fn test_group_prepend() { + new_ucmd!() + .args(&["--group=prepend"]) + .pipe_in_fixture(INPUT) + .run() + .stdout_is_fixture("group-prepend.expected"); +} + +#[test] +fn test_group_append() { + new_ucmd!() + .args(&["--group=append"]) + .pipe_in_fixture(INPUT) + .run() + .stdout_is_fixture("group-append.expected"); +} + +#[test] +fn test_group_both() { + new_ucmd!() + .args(&["--group=both"]) + .pipe_in_fixture(INPUT) + .run() + .stdout_is_fixture("group-both.expected"); +} + +#[test] +fn test_group_separate() { + new_ucmd!() + .args(&["--group=separate"]) + .pipe_in_fixture(INPUT) + .run() + .stdout_is_fixture("group.expected"); +} diff --git a/tests/fixtures/uniq/group-append.expected b/tests/fixtures/uniq/group-append.expected new file mode 100644 index 000000000..62f53e69f --- /dev/null +++ b/tests/fixtures/uniq/group-append.expected @@ -0,0 +1,26 @@ + aaaaa ⅰ + + bbbbb ⅱ + bbbbb ⅱ + + ccccc ⅲ + ccccc ⅲ + ccccc ⅲ + + ddddd ⅲ + ddddd ⅲ + ddddd ⅲ + ddddd ⅲ + + eeeee ⅲ + + fffff ⅲ + fffff ⅲ + + ggggg ⅲ + ggggg ⅲ + ggggg ⅲ + + GGGGG ⅲ + GGGGG ⅲ + diff --git a/tests/fixtures/uniq/group-both.expected b/tests/fixtures/uniq/group-both.expected new file mode 100644 index 000000000..8a0f06bf2 --- /dev/null +++ b/tests/fixtures/uniq/group-both.expected @@ -0,0 +1,27 @@ + + aaaaa ⅰ + + bbbbb ⅱ + bbbbb ⅱ + + ccccc ⅲ + ccccc ⅲ + ccccc ⅲ + + ddddd ⅲ + ddddd ⅲ + ddddd ⅲ + ddddd ⅲ + + eeeee ⅲ + + fffff ⅲ + fffff ⅲ + + ggggg ⅲ + ggggg ⅲ + ggggg ⅲ + + GGGGG ⅲ + GGGGG ⅲ + diff --git a/tests/fixtures/uniq/group-prepend.expected b/tests/fixtures/uniq/group-prepend.expected new file mode 100644 index 000000000..5209f7fbe --- /dev/null +++ b/tests/fixtures/uniq/group-prepend.expected @@ -0,0 +1,26 @@ + + aaaaa ⅰ + + bbbbb ⅱ + bbbbb ⅱ + + ccccc ⅲ + ccccc ⅲ + ccccc ⅲ + + ddddd ⅲ + ddddd ⅲ + ddddd ⅲ + ddddd ⅲ + + eeeee ⅲ + + fffff ⅲ + fffff ⅲ + + ggggg ⅲ + ggggg ⅲ + ggggg ⅲ + + GGGGG ⅲ + GGGGG ⅲ diff --git a/tests/fixtures/uniq/group.expected b/tests/fixtures/uniq/group.expected new file mode 100644 index 000000000..145a78011 --- /dev/null +++ b/tests/fixtures/uniq/group.expected @@ -0,0 +1,25 @@ + aaaaa ⅰ + + bbbbb ⅱ + bbbbb ⅱ + + ccccc ⅲ + ccccc ⅲ + ccccc ⅲ + + ddddd ⅲ + ddddd ⅲ + ddddd ⅲ + ddddd ⅲ + + eeeee ⅲ + + fffff ⅲ + fffff ⅲ + + ggggg ⅲ + ggggg ⅲ + ggggg ⅲ + + GGGGG ⅲ + GGGGG ⅲ From fa4272a19be7c3d98c034a83ddf56b44732c61b7 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 4 Apr 2021 19:19:56 +0200 Subject: [PATCH 0262/1135] ls: --hide and --ignore --- src/uu/ls/Cargo.toml | 1 + src/uu/ls/src/ls.rs | 59 ++++++++++++++++++++++++----- tests/by-util/test_ls.rs | 80 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 131 insertions(+), 9 deletions(-) diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index e1d9b7990..bf3860bf3 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -22,6 +22,7 @@ term_grid = "0.1.5" termsize = "0.1.6" time = "0.1.40" unicode-width = "0.1.5" +glob = "0.3.0" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index ece497bdb..e011b9e52 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -17,6 +17,7 @@ mod quoting_style; mod version_cmp; use clap::{App, Arg}; +use glob; use number_prefix::NumberPrefix; use quoting_style::{escape_name, QuotingStyle}; #[cfg(unix)] @@ -138,6 +139,8 @@ pub mod options { pub static COLOR: &str = "color"; pub static PATHS: &str = "paths"; pub static INDICATOR_STYLE: &str = "indicator-style"; + pub static HIDE: &str = "hide"; + pub static IGNORE: &str = "ignore"; } #[derive(PartialEq, Eq)] @@ -191,7 +194,7 @@ struct Config { recursive: bool, reverse: bool, dereference: bool, - ignore_backups: bool, + ignore_patterns: Vec, size_format: SizeFormat, directory: bool, time: Time, @@ -437,6 +440,28 @@ impl Config { IndicatorStyle::None }; + let mut ignore_patterns = Vec::new(); + if options.is_present(options::IGNORE_BACKUPS) { + ignore_patterns.push(glob::Pattern::new("*~").unwrap()); + ignore_patterns.push(glob::Pattern::new(".*~").unwrap()); + } + + for pattern in options.values_of(options::IGNORE).into_iter().flatten() { + match glob::Pattern::new(pattern) { + Ok(p) => ignore_patterns.push(p), + Err(e) => show_error!("{}", e), + } + } + + if files == Files::Normal { + for pattern in options.values_of(options::HIDE).into_iter().flatten() { + match glob::Pattern::new(pattern) { + Ok(p) => ignore_patterns.push(p), + Err(e) => show_error!("{}", e), + } + } + } + Config { format, files, @@ -444,7 +469,7 @@ impl Config { recursive: options.is_present(options::RECURSIVE), reverse: options.is_present(options::REVERSE), dereference: options.is_present(options::DEREFERENCE), - ignore_backups: options.is_present(options::IGNORE_BACKUPS), + ignore_patterns, size_format, directory: options.is_present(options::DIRECTORY), time, @@ -664,6 +689,26 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ]) ) + // Hide and ignore + .arg( + Arg::with_name(options::HIDE) + .long(options::HIDE) + .takes_value(true) + .multiple(true) + ) + .arg( + Arg::with_name(options::IGNORE) + .long(options::IGNORE) + .takes_value(true) + .multiple(true) + ) + .arg( + Arg::with_name(options::IGNORE_BACKUPS) + .short("B") + .long(options::IGNORE_BACKUPS) + .help("Ignore entries which end with ~."), + ) + // Sort arguments .arg( Arg::with_name(options::SORT) @@ -761,12 +806,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { '.' and '..'.", ), ) - .arg( - Arg::with_name(options::IGNORE_BACKUPS) - .short("B") - .long(options::IGNORE_BACKUPS) - .help("Ignore entries which end with ~."), - ) .arg( Arg::with_name(options::DIRECTORY) .short("d") @@ -985,10 +1024,12 @@ fn is_hidden(file_path: &DirEntry) -> bool { fn should_display(entry: &DirEntry, config: &Config) -> bool { let ffi_name = entry.file_name(); let name = ffi_name.to_string_lossy(); + if config.files == Files::Normal && is_hidden(entry) { return false; } - if config.ignore_backups && name.ends_with('~') { + + if config.ignore_patterns.iter().any(|p| p.matches(&name)) { return false; } true diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index d403e5577..7d678acea 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1209,3 +1209,83 @@ fn test_ls_quoting_style() { assert_eq!(result.stdout, format!("{}\n", correct)); } } + +#[test] +fn test_ls_ignore_hide() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.touch("README.md"); + at.touch("CONTRIBUTING.md"); + at.touch("some_other_file"); + at.touch("READMECAREFULLY.md"); + + scene.ucmd().arg("--hide").arg("*").succeeds().stdout_is(""); + + scene + .ucmd() + .arg("--ignore") + .arg("*") + .succeeds() + .stdout_is(""); + + scene + .ucmd() + .arg("--ignore") + .arg("irrelevant pattern") + .succeeds() + .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); + + scene + .ucmd() + .arg("--ignore") + .arg("README*.md") + .succeeds() + .stdout_is("CONTRIBUTING.md\nsome_other_file\n"); + + scene + .ucmd() + .arg("--hide") + .arg("README*.md") + .succeeds() + .stdout_is("CONTRIBUTING.md\nsome_other_file\n"); + + scene + .ucmd() + .arg("--ignore") + .arg("*.md") + .succeeds() + .stdout_is("some_other_file\n"); + + scene + .ucmd() + .arg("-a") + .arg("--ignore") + .arg("*.md") + .succeeds() + .stdout_is(".\n..\nsome_other_file\n"); + + scene + .ucmd() + .arg("-a") + .arg("--hide") + .arg("*.md") + .succeeds() + .stdout_is(".\n..\nCONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); + + scene + .ucmd() + .arg("-A") + .arg("--ignore") + .arg("*.md") + .succeeds() + .stdout_is("some_other_file\n"); + + scene + .ucmd() + .arg("-A") + .arg("--hide") + .arg("*.md") + .succeeds() + .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); +} From 76308dbec9f0538a17c443a01a241cf120c6177e Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 4 Apr 2021 22:35:22 +0200 Subject: [PATCH 0263/1135] ls: tests for invalid patterns for hide and ignore --- src/uu/ls/src/ls.rs | 4 ++-- tests/by-util/test_ls.rs | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index e011b9e52..1e6e300ff 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -449,7 +449,7 @@ impl Config { for pattern in options.values_of(options::IGNORE).into_iter().flatten() { match glob::Pattern::new(pattern) { Ok(p) => ignore_patterns.push(p), - Err(e) => show_error!("{}", e), + Err(_) => show_error!("Invalid pattern for ignore: '{}'", pattern), } } @@ -457,7 +457,7 @@ impl Config { for pattern in options.values_of(options::HIDE).into_iter().flatten() { match glob::Pattern::new(pattern) { Ok(p) => ignore_patterns.push(p), - Err(e) => show_error!("{}", e), + Err(_) => show_error!("Invalid pattern for hide: '{}'", pattern), } } } diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 7d678acea..377e12f74 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1288,4 +1288,29 @@ fn test_ls_ignore_hide() { .arg("*.md") .succeeds() .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); + + // Stacking multiple patterns + scene + .ucmd() + .arg("--ignore") + .arg("README*") + .arg("--ignore") + .arg("CONTRIBUTING*") + .succeeds() + .stdout_is("some_other_file\n"); + + // Invalid patterns + scene + .ucmd() + .arg("--ignore") + .arg("READ[ME") + .succeeds() + .stderr_contains(&"Invalid pattern"); + + scene + .ucmd() + .arg("--ignore") + .arg("READ[ME") + .succeeds() + .stderr_contains(&"Invalid pattern"); } From 51770e6bee24431d104f6345e38648ecc3a34730 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 4 Apr 2021 22:40:36 +0200 Subject: [PATCH 0264/1135] ls: invalid pattern move from error to warning --- src/uu/ls/src/ls.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 1e6e300ff..4a0c52955 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -449,7 +449,7 @@ impl Config { for pattern in options.values_of(options::IGNORE).into_iter().flatten() { match glob::Pattern::new(pattern) { Ok(p) => ignore_patterns.push(p), - Err(_) => show_error!("Invalid pattern for ignore: '{}'", pattern), + Err(_) => show_warning!("Invalid pattern for ignore: '{}'", pattern), } } @@ -457,7 +457,7 @@ impl Config { for pattern in options.values_of(options::HIDE).into_iter().flatten() { match glob::Pattern::new(pattern) { Ok(p) => ignore_patterns.push(p), - Err(_) => show_error!("Invalid pattern for hide: '{}'", pattern), + Err(_) => show_warning!("Invalid pattern for hide: '{}'", pattern), } } } From bbb27800c91770a79efc28f29ab42c91d586c1bf Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 4 Apr 2021 23:14:55 +0200 Subject: [PATCH 0265/1135] ls: fix windows tests and commit lock --- Cargo.lock | 1 + tests/by-util/test_ls.rs | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index ea1ee53ae..034cb4304 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1949,6 +1949,7 @@ version = "0.0.6" dependencies = [ "atty", "clap", + "glob 0.3.0", "lazy_static", "number_prefix", "term_grid", diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 377e12f74..cde5a8b8a 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1220,12 +1220,19 @@ fn test_ls_ignore_hide() { at.touch("some_other_file"); at.touch("READMECAREFULLY.md"); - scene.ucmd().arg("--hide").arg("*").succeeds().stdout_is(""); + scene + .ucmd() + .arg("--hide") + .arg("*") + .arg("-1") + .succeeds() + .stdout_is(""); scene .ucmd() .arg("--ignore") .arg("*") + .arg("-1") .succeeds() .stdout_is(""); @@ -1233,6 +1240,7 @@ fn test_ls_ignore_hide() { .ucmd() .arg("--ignore") .arg("irrelevant pattern") + .arg("-1") .succeeds() .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); @@ -1240,6 +1248,7 @@ fn test_ls_ignore_hide() { .ucmd() .arg("--ignore") .arg("README*.md") + .arg("-1") .succeeds() .stdout_is("CONTRIBUTING.md\nsome_other_file\n"); @@ -1247,6 +1256,7 @@ fn test_ls_ignore_hide() { .ucmd() .arg("--hide") .arg("README*.md") + .arg("-1") .succeeds() .stdout_is("CONTRIBUTING.md\nsome_other_file\n"); @@ -1254,6 +1264,7 @@ fn test_ls_ignore_hide() { .ucmd() .arg("--ignore") .arg("*.md") + .arg("-1") .succeeds() .stdout_is("some_other_file\n"); @@ -1262,6 +1273,7 @@ fn test_ls_ignore_hide() { .arg("-a") .arg("--ignore") .arg("*.md") + .arg("-1") .succeeds() .stdout_is(".\n..\nsome_other_file\n"); @@ -1270,6 +1282,7 @@ fn test_ls_ignore_hide() { .arg("-a") .arg("--hide") .arg("*.md") + .arg("-1") .succeeds() .stdout_is(".\n..\nCONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); @@ -1278,6 +1291,7 @@ fn test_ls_ignore_hide() { .arg("-A") .arg("--ignore") .arg("*.md") + .arg("-1") .succeeds() .stdout_is("some_other_file\n"); @@ -1286,6 +1300,7 @@ fn test_ls_ignore_hide() { .arg("-A") .arg("--hide") .arg("*.md") + .arg("-1") .succeeds() .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); @@ -1296,6 +1311,7 @@ fn test_ls_ignore_hide() { .arg("README*") .arg("--ignore") .arg("CONTRIBUTING*") + .arg("-1") .succeeds() .stdout_is("some_other_file\n"); @@ -1304,6 +1320,7 @@ fn test_ls_ignore_hide() { .ucmd() .arg("--ignore") .arg("READ[ME") + .arg("-1") .succeeds() .stderr_contains(&"Invalid pattern"); @@ -1311,6 +1328,7 @@ fn test_ls_ignore_hide() { .ucmd() .arg("--ignore") .arg("READ[ME") + .arg("-1") .succeeds() .stderr_contains(&"Invalid pattern"); } From 5134348a117481bb257961d71ba4c206de973410 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 4 Apr 2021 23:39:11 +0200 Subject: [PATCH 0266/1135] ls: use globset instead of glob --- src/uu/ls/Cargo.toml | 2 +- src/uu/ls/src/ls.rs | 27 ++++++++++++++++----------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index bf3860bf3..dacdc7cd9 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -22,7 +22,7 @@ term_grid = "0.1.5" termsize = "0.1.6" time = "0.1.40" unicode-width = "0.1.5" -glob = "0.3.0" +globset = "0.4.6" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 4a0c52955..c4f9ae047 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -17,7 +17,7 @@ mod quoting_style; mod version_cmp; use clap::{App, Arg}; -use glob; +use globset::{self, Glob, GlobSet, GlobSetBuilder}; use number_prefix::NumberPrefix; use quoting_style::{escape_name, QuotingStyle}; #[cfg(unix)] @@ -194,7 +194,7 @@ struct Config { recursive: bool, reverse: bool, dereference: bool, - ignore_patterns: Vec, + ignore_patterns: GlobSet, size_format: SizeFormat, directory: bool, time: Time, @@ -440,28 +440,34 @@ impl Config { IndicatorStyle::None }; - let mut ignore_patterns = Vec::new(); + let mut ignore_patterns = GlobSetBuilder::new(); if options.is_present(options::IGNORE_BACKUPS) { - ignore_patterns.push(glob::Pattern::new("*~").unwrap()); - ignore_patterns.push(glob::Pattern::new(".*~").unwrap()); + ignore_patterns.add(Glob::new("*~").unwrap()); + ignore_patterns.add(Glob::new(".*~").unwrap()); } for pattern in options.values_of(options::IGNORE).into_iter().flatten() { - match glob::Pattern::new(pattern) { - Ok(p) => ignore_patterns.push(p), + match Glob::new(pattern) { + Ok(p) => { + ignore_patterns.add(p); + } Err(_) => show_warning!("Invalid pattern for ignore: '{}'", pattern), } } if files == Files::Normal { for pattern in options.values_of(options::HIDE).into_iter().flatten() { - match glob::Pattern::new(pattern) { - Ok(p) => ignore_patterns.push(p), + match Glob::new(pattern) { + Ok(p) => { + ignore_patterns.add(p); + } Err(_) => show_warning!("Invalid pattern for hide: '{}'", pattern), } } } + let ignore_patterns = ignore_patterns.build().unwrap(); + Config { format, files, @@ -1023,13 +1029,12 @@ fn is_hidden(file_path: &DirEntry) -> bool { fn should_display(entry: &DirEntry, config: &Config) -> bool { let ffi_name = entry.file_name(); - let name = ffi_name.to_string_lossy(); if config.files == Files::Normal && is_hidden(entry) { return false; } - if config.ignore_patterns.iter().any(|p| p.matches(&name)) { + if config.ignore_patterns.is_match(&ffi_name) { return false; } true From d68959d69683dbe3ad41f1205fa214ad5ccfe30d Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 5 Apr 2021 10:12:23 +0200 Subject: [PATCH 0267/1135] ls: update cargo.lock with globset --- Cargo.lock | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 034cb4304..f6dfc3246 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -644,6 +644,19 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +[[package]] +name = "globset" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c152169ef1e421390738366d2f796655fec62621dabbd0fd476f905934061e4a" +dependencies = [ + "aho-corasick", + "bstr", + "fnv", + "log", + "regex", +] + [[package]] name = "half" version = "1.7.1" @@ -1949,7 +1962,7 @@ version = "0.0.6" dependencies = [ "atty", "clap", - "glob 0.3.0", + "globset", "lazy_static", "number_prefix", "term_grid", From a50eae76a499699c0e2e47b4217db331c4a75b4d Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 5 Apr 2021 12:17:42 +0200 Subject: [PATCH 0268/1135] ls: some more tests for ignore & hide --- tests/by-util/test_ls.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index cde5a8b8a..0547560cc 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1315,6 +1315,26 @@ fn test_ls_ignore_hide() { .succeeds() .stdout_is("some_other_file\n"); + scene + .ucmd() + .arg("--hide") + .arg("README*") + .arg("--ignore") + .arg("CONTRIBUTING*") + .arg("-1") + .succeeds() + .stdout_is("some_other_file\n"); + + scene + .ucmd() + .arg("--hide") + .arg("README*") + .arg("--hide") + .arg("CONTRIBUTING*") + .arg("-1") + .succeeds() + .stdout_is("some_other_file\n"); + // Invalid patterns scene .ucmd() @@ -1326,7 +1346,7 @@ fn test_ls_ignore_hide() { scene .ucmd() - .arg("--ignore") + .arg("--hide") .arg("READ[ME") .arg("-1") .succeeds() From e5c61a28beb89d4c62b798663cbbbefc20d0e68e Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Mon, 5 Apr 2021 00:16:21 -0400 Subject: [PATCH 0269/1135] fold: variable width tabs, guard treating tab as whitespace Treat tab chars as advancing to the next tab stop rather than having a fixed 8-column width. Also treat tab as a whitespace split target only when splitting on word boundaries. --- src/uu/fold/src/fold.rs | 11 +++- tests/by-util/test_fold.rs | 65 +++++++++++++++++++++- tests/fixtures/fold/tab_stops.input | 11 ++++ tests/fixtures/fold/tab_stops_w16.expected | 13 +++++ tests/fixtures/fold/tab_stops_w8.expected | 18 ++++++ 5 files changed, 114 insertions(+), 4 deletions(-) create mode 100644 tests/fixtures/fold/tab_stops.input create mode 100644 tests/fixtures/fold/tab_stops_w16.expected create mode 100644 tests/fixtures/fold/tab_stops_w8.expected diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index 8cf95b82a..fac0ff28e 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -14,6 +14,8 @@ use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; use std::path::Path; +const TAB_WIDTH: usize = 8; + static SYNTAX: &str = "[OPTION]... [FILE]..."; static SUMMARY: &str = "Writes each file (or standard input if no files are given) to standard output whilst breaking long lines"; @@ -220,11 +222,14 @@ fn fold_file(mut file: BufReader, spaces: bool, width: usize) { match ch { '\t' => { - if col_count + 8 > width && !output.is_empty() { + let next_tab_stop = col_count + TAB_WIDTH - col_count % TAB_WIDTH; + + if next_tab_stop > width && !output.is_empty() { emit_output!(); } - col_count += 8; - last_space = Some(char_count); + + col_count = next_tab_stop; + last_space = if spaces { Some(char_count) } else { None }; } '\x08' => { // FIXME: does not match GNU's handling of backspace diff --git a/tests/by-util/test_fold.rs b/tests/by-util/test_fold.rs index 52e630e5b..cc92c8ff3 100644 --- a/tests/by-util/test_fold.rs +++ b/tests/by-util/test_fold.rs @@ -132,7 +132,7 @@ fn test_single_tab_should_not_add_extra_newline() { } #[test] -fn test_tab_counts_as_8_columns() { +fn test_initial_tab_counts_as_8_columns() { new_ucmd!() .arg("-w8") .pipe_in("\t1") @@ -140,6 +140,33 @@ fn test_tab_counts_as_8_columns() { .stdout_is("\t\n1"); } +#[test] +fn test_tab_should_advance_to_next_tab_stop() { + // tab advances the column count to the next tab stop, i.e. the width + // of the tab varies based on the leading text + new_ucmd!() + .args(&["-w8", "tab_stops.input"]) + .succeeds() + .stdout_is_fixture("tab_stops_w8.expected"); +} + +#[test] +fn test_all_tabs_should_advance_to_next_tab_stops() { + new_ucmd!() + .args(&["-w16", "tab_stops.input"]) + .succeeds() + .stdout_is_fixture("tab_stops_w16.expected"); +} + +#[test] +fn test_fold_before_tab_with_narrow_width() { + new_ucmd!() + .arg("-w7") + .pipe_in("a\t1") + .succeeds() + .stdout_is("a\n\t\n1"); +} + #[test] fn test_fold_at_word_boundary() { new_ucmd!() @@ -167,8 +194,35 @@ fn test_fold_at_word_boundary_preserve_final_newline() { .stdout_is("one \ntwo\n"); } +#[test] +fn test_fold_at_tab() { + new_ucmd!() + .arg("-w8") + .pipe_in("a\tbbb\n") + .succeeds() + .stdout_is("a\t\nbbb\n"); +} + +#[test] +fn test_fold_after_tab() { + new_ucmd!() + .arg("-w10") + .pipe_in("a\tbbb\n") + .succeeds() + .stdout_is("a\tbb\nb\n"); +} + #[test] fn test_fold_at_tab_as_word_boundary() { + new_ucmd!() + .args(&["-w8", "-s"]) + .pipe_in("a\tbbb\n") + .succeeds() + .stdout_is("a\t\nbbb\n"); +} + +#[test] +fn test_fold_after_tab_as_word_boundary() { new_ucmd!() .args(&["-w10", "-s"]) .pipe_in("a\tbbb\n") @@ -317,6 +371,15 @@ fn test_tab_counts_as_one_byte() { .stdout_is("1\t\n2\n"); } +#[test] +fn test_bytewise_fold_before_tab_with_narrow_width() { + new_ucmd!() + .args(&["-w7", "-b"]) + .pipe_in("a\t1") + .succeeds() + .stdout_is("a\t1"); +} + #[test] fn test_bytewise_fold_at_word_boundary_only_whitespace() { new_ucmd!() diff --git a/tests/fixtures/fold/tab_stops.input b/tests/fixtures/fold/tab_stops.input new file mode 100644 index 000000000..a96a378ea --- /dev/null +++ b/tests/fixtures/fold/tab_stops.input @@ -0,0 +1,11 @@ +1 +12 +123 +1234 +12345 +123456 +1234567 +12345678 +123456781 +12345678 2 +12345678 2 4 diff --git a/tests/fixtures/fold/tab_stops_w16.expected b/tests/fixtures/fold/tab_stops_w16.expected new file mode 100644 index 000000000..8122ac16d --- /dev/null +++ b/tests/fixtures/fold/tab_stops_w16.expected @@ -0,0 +1,13 @@ +1 +12 +123 +1234 +12345 +123456 +1234567 +12345678 +123456781 +12345678 +2 +12345678 +2 4 diff --git a/tests/fixtures/fold/tab_stops_w8.expected b/tests/fixtures/fold/tab_stops_w8.expected new file mode 100644 index 000000000..3173a4a22 --- /dev/null +++ b/tests/fixtures/fold/tab_stops_w8.expected @@ -0,0 +1,18 @@ +1 +12 +123 +1234 +12345 +123456 +1234567 +12345678 + +12345678 +1 +12345678 + +2 +12345678 + +2 +4 From 3bfb1afe5c84099c4ae22f12ec91d6f59944b8a7 Mon Sep 17 00:00:00 2001 From: ReggaeMuffin <644950+reggaemuffin@users.noreply.github.com> Date: Mon, 5 Apr 2021 16:16:00 +0100 Subject: [PATCH 0270/1135] uucore: Start testing uucore Before this change we never ran tests on uucore itself meaning that is was not possible to test functions of the shared core, only their usage in the different binaries This change adds running uucore to our ci, which will increase coverage for the few doctests that exist and is extracted from #1988 where first tests for uucore will be introduced --- .github/workflows/CICD.yml | 13 ++++++++++++- README.md | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index a1683ab83..cc0972bf9 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -150,7 +150,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: test - args: --features "feat_os_unix" + args: --features "feat_os_unix" -p uucore -p coreutils env: RUSTFLAGS: '-Awarnings' @@ -536,6 +536,17 @@ jobs: CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo "-puu_${u}"; done;)" echo set-output name=UTILITY_LIST::${UTILITY_LIST} echo ::set-output name=CARGO_UTILITY_LIST_OPTIONS::${CARGO_UTILITY_LIST_OPTIONS} + - name: Test uucore + uses: actions-rs/cargo@v1 + with: + 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' + # RUSTUP_TOOLCHAIN: ${{ steps.vars.outputs.TOOLCHAIN }} - name: Test uses: actions-rs/cargo@v1 with: diff --git a/README.md b/README.md index b6d265278..b2257b3fd 100644 --- a/README.md +++ b/README.md @@ -226,6 +226,11 @@ If you would prefer to test a select few utilities: $ cargo test --features "chmod mv tail" --no-default-features ``` +If you also want to test the core utilities: +```bash +$ cargo test -p uucore -p coreutils +``` + To debug: ```bash $ gdb --args target/debug/coreutils ls From 196bfebc8ba6817a13e35628842315474d14eebf Mon Sep 17 00:00:00 2001 From: ReggaeMuffin <644950+reggaemuffin@users.noreply.github.com> Date: Mon, 5 Apr 2021 16:27:26 +0100 Subject: [PATCH 0271/1135] uucore: add uucore testing to travis and cirrus --- .cirrus.yml | 2 +- .travis.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 3a34a933a..5d16dce92 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -11,4 +11,4 @@ task: - cargo build test_script: - . $HOME/.cargo/env - - cargo test + - cargo test -p uucore -p coreutils diff --git a/.travis.yml b/.travis.yml index 27525b5f2..389ba44b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,7 +56,7 @@ install: script: - cargo build $CARGO_ARGS --features "$FEATURES" - - if [ ! $REDOX ]; then cargo test $CARGO_ARGS --features "$FEATURES" --no-fail-fast; fi + - if [ ! $REDOX ]; then cargo test $CARGO_ARGS -p uucore -p coreutils --features "$FEATURES" --no-fail-fast; fi - if [ -n "$TEST_INSTALL" ]; then mkdir installdir_test; DESTDIR=installdir_test make install; [ `ls installdir_test/usr/local/bin | wc -l` -gt 0 ]; fi addons: From 4dfbbecc26bdd6be326d81cae85a97c20bcb3fd3 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 5 Apr 2021 21:48:39 +0200 Subject: [PATCH 0272/1135] relpath: refactor tests for #1982 --- tests/by-util/test_relpath.rs | 70 ++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 29 deletions(-) diff --git a/tests/by-util/test_relpath.rs b/tests/by-util/test_relpath.rs index 690531896..cc17b45c3 100644 --- a/tests/by-util/test_relpath.rs +++ b/tests/by-util/test_relpath.rs @@ -70,10 +70,10 @@ fn convert_path<'a>(path: &'a str) -> Cow<'a, str> { #[test] fn test_relpath_with_from_no_d() { - for test in TESTS.iter() { - let scene = TestScenario::new(util_name!()); - let at = &scene.fixtures; + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + for test in TESTS.iter() { let from: &str = &convert_path(test.from); let to: &str = &convert_path(test.to); let expected: &str = &convert_path(test.expected); @@ -92,10 +92,10 @@ fn test_relpath_with_from_no_d() { #[test] fn test_relpath_with_from_with_d() { - for test in TESTS.iter() { - let scene = TestScenario::new(util_name!()); - let at = &scene.fixtures; + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + for test in TESTS.iter() { let from: &str = &convert_path(test.from); let to: &str = &convert_path(test.to); let pwd = at.as_string(); @@ -103,63 +103,75 @@ fn test_relpath_with_from_with_d() { at.mkdir_all(from); // d is part of subpath -> expect relative path - let mut result = scene + let mut result_stdout = scene .ucmd() .arg(to) .arg(from) .arg(&format!("-d{}", pwd)) - .run(); - assert!(result.success); + .succeeds() + .stdout_move_str(); // relax rules for windows test environment #[cfg(not(windows))] - assert!(Path::new(&result.stdout).is_relative()); + assert!(Path::new(&result_stdout).is_relative()); // d is not part of subpath -> expect absolut path - result = scene.ucmd().arg(to).arg(from).arg("-dnon_existing").run(); - assert!(result.success); - assert!(Path::new(&result.stdout).is_absolute()); + result_stdout = scene + .ucmd() + .arg(to) + .arg(from) + .arg("-dnon_existing") + .succeeds() + .stdout_move_str(); + assert!(Path::new(&result_stdout).is_absolute()); } } #[test] fn test_relpath_no_from_no_d() { - for test in TESTS.iter() { - let scene = TestScenario::new(util_name!()); - let at = &scene.fixtures; + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + for test in TESTS.iter() { let to: &str = &convert_path(test.to); at.mkdir_all(to); - let result = scene.ucmd().arg(to).run(); - assert!(result.success); + let result_stdout = scene.ucmd().arg(to).succeeds().stdout_move_str(); #[cfg(not(windows))] - assert_eq!(result.stdout, format!("{}\n", to)); + assert_eq!(result_stdout, format!("{}\n", to)); // relax rules for windows test environment #[cfg(windows)] - assert!(result.stdout.ends_with(&format!("{}\n", to))); + assert!(result_stdout.ends_with(&format!("{}\n", to))); } } #[test] fn test_relpath_no_from_with_d() { - for test in TESTS.iter() { - let scene = TestScenario::new(util_name!()); - let at = &scene.fixtures; + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + for test in TESTS.iter() { let to: &str = &convert_path(test.to); let pwd = at.as_string(); at.mkdir_all(to); // d is part of subpath -> expect relative path - let mut result = scene.ucmd().arg(to).arg(&format!("-d{}", pwd)).run(); - assert!(result.success); + let mut result_stdout = scene + .ucmd() + .arg(to) + .arg(&format!("-d{}", pwd)) + .succeeds() + .stdout_move_str(); // relax rules for windows test environment #[cfg(not(windows))] - assert!(Path::new(&result.stdout).is_relative()); + assert!(Path::new(&result_stdout).is_relative()); // d is not part of subpath -> expect absolut path - result = scene.ucmd().arg(to).arg("-dnon_existing").run(); - assert!(result.success); - assert!(Path::new(&result.stdout).is_absolute()); + result_stdout = scene + .ucmd() + .arg(to) + .arg("-dnon_existing") + .succeeds() + .stdout_move_str(); + assert!(Path::new(&result_stdout).is_absolute()); } } From 9581fcf688c175673ebd4f51341469aead8bf949 Mon Sep 17 00:00:00 2001 From: Marvin Hofmann <644950+reggaemuffin@users.noreply.github.com> Date: Mon, 5 Apr 2021 21:18:47 +0100 Subject: [PATCH 0273/1135] rm: add verbose output and trim multiple slashes (#1988) * rm: add verbose output and trim multiple slashes Uses the normalize_path used in cargo to strip duplicate slashes With a link to a std rfc https://github.com/rust-lang/rfcs/issues/2208 This fixes https://github.com/uutils/coreutils/issues/1829 This also touches https://github.com/uutils/coreutils/issues/1768 but does not attempt to fully solve it --- src/uu/rm/Cargo.toml | 3 +- src/uu/rm/src/rm.rs | 16 ++++-- src/uucore/src/lib/features/fs.rs | 90 +++++++++++++++++++++++++++++++ tests/by-util/test_rm.rs | 29 ++++++++++ 4 files changed, 133 insertions(+), 5 deletions(-) diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index 961a8036c..9974111aa 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -18,7 +18,8 @@ path = "src/rm.rs" clap = "2.33" walkdir = "2.2" remove_dir_all = "0.5.1" -uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } + +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 033a1a4aa..09671768b 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -16,7 +16,7 @@ use std::collections::VecDeque; use std::fs; use std::io::{stderr, stdin, BufRead, Write}; use std::ops::BitOr; -use std::path::Path; +use std::path::{Path, PathBuf}; use walkdir::{DirEntry, WalkDir}; #[derive(Eq, PartialEq, Clone, Copy)] @@ -251,7 +251,7 @@ fn handle_dir(path: &Path, options: &Options) -> bool { let is_root = path.has_root() && path.parent().is_none(); if options.recursive && (!is_root || !options.preserve_root) { - if options.interactive != InteractiveMode::Always { + if options.interactive != InteractiveMode::Always && !options.verbose { // we need the extra crate because apparently fs::remove_dir_all() does not function // correctly on Windows if let Err(e) = remove_dir_all(path) { @@ -311,7 +311,7 @@ fn remove_dir(path: &Path, options: &Options) -> bool { match fs::remove_dir(path) { Ok(_) => { if options.verbose { - println!("removed directory '{}'", path.display()); + println!("removed directory '{}'", normalize(path).display()); } } Err(e) => { @@ -349,7 +349,7 @@ fn remove_file(path: &Path, options: &Options) -> bool { match fs::remove_file(path) { Ok(_) => { if options.verbose { - println!("removed '{}'", path.display()); + println!("removed '{}'", normalize(path).display()); } } Err(e) => { @@ -370,6 +370,14 @@ fn prompt_file(path: &Path, is_dir: bool) -> bool { } } +fn normalize(path: &Path) -> PathBuf { + // copied from https://github.com/rust-lang/cargo/blob/2e4cfc2b7d43328b207879228a2ca7d427d188bb/src/cargo/util/paths.rs#L65-L90 + // both projects are MIT https://github.com/rust-lang/cargo/blob/master/LICENSE-MIT + // for std impl progress see rfc https://github.com/rust-lang/rfcs/issues/2208 + // TODO: replace this once that lands + uucore::fs::normalize_path(path) +} + fn prompt(msg: &str) -> bool { let _ = stderr().write_all(msg.as_bytes()); let _ = stderr().flush(); diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index adf4f6f82..a72d6ea82 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -60,6 +60,37 @@ pub enum CanonicalizeMode { Missing, } +// copied from https://github.com/rust-lang/cargo/blob/2e4cfc2b7d43328b207879228a2ca7d427d188bb/src/cargo/util/paths.rs#L65-L90 +// both projects are MIT https://github.com/rust-lang/cargo/blob/master/LICENSE-MIT +// for std impl progress see rfc https://github.com/rust-lang/rfcs/issues/2208 +// replace this once that lands +pub fn normalize_path(path: &Path) -> PathBuf { + let mut components = path.components().peekable(); + let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek().cloned() { + components.next(); + PathBuf::from(c.as_os_str()) + } else { + PathBuf::new() + }; + + for component in components { + match component { + Component::Prefix(..) => unreachable!(), + Component::RootDir => { + ret.push(component.as_os_str()); + } + Component::CurDir => {} + Component::ParentDir => { + ret.pop(); + } + Component::Normal(c) => { + ret.push(c); + } + } + } + ret +} + fn resolve>(original: P) -> IOResult { const MAX_LINKS_FOLLOWED: u32 = 255; let mut followed = 0; @@ -266,3 +297,62 @@ pub fn display_permissions_unix(mode: u32) -> String { result } + +#[cfg(test)] +mod tests { + // Note this useful idiom: importing names from outer (for mod tests) scope. + use super::*; + + struct NormalizePathTestCase<'a> { + path: &'a str, + test: &'a str, + } + + const NORMALIZE_PATH_TESTS: [NormalizePathTestCase; 8] = [ + NormalizePathTestCase { + path: "./foo/bar.txt", + test: "foo/bar.txt", + }, + NormalizePathTestCase { + path: "bar/../foo/bar.txt", + test: "foo/bar.txt", + }, + NormalizePathTestCase { + path: "foo///bar.txt", + test: "foo/bar.txt", + }, + NormalizePathTestCase { + path: "foo///bar", + test: "foo/bar", + }, + NormalizePathTestCase { + path: "foo//./bar", + test: "foo/bar", + }, + NormalizePathTestCase { + path: "/foo//./bar", + test: "/foo/bar", + }, + NormalizePathTestCase { + path: r"C:/you/later/", + test: "C:/you/later", + }, + NormalizePathTestCase { + path: "\\networkshare/a//foo//./bar", + test: "\\networkshare/a/foo/bar", + }, + ]; + + #[test] + fn test_normalize_path() { + for test in NORMALIZE_PATH_TESTS.iter() { + let path = Path::new(test.path); + let normalized = normalize_path(path); + assert_eq!( + test.test + .replace("/", std::path::MAIN_SEPARATOR.to_string().as_str()), + normalized.to_str().expect("Path is not valid utf-8!") + ); + } + } +} diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 149d509c5..0d77d9b01 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -263,3 +263,32 @@ fn test_rm_no_operand() { ucmd.fails() .stderr_is("rm: error: missing an argument\nrm: error: for help, try 'rm --help'\n"); } + +#[test] +fn test_rm_verbose_slash() { + let (at, mut ucmd) = at_and_ucmd!(); + let dir = "test_rm_verbose_slash_directory"; + let file_a = &format!("{}/test_rm_verbose_slash_file_a", dir); + + at.mkdir(dir); + at.touch(file_a); + + let file_a_normalized = &format!( + "{}{}test_rm_verbose_slash_file_a", + dir, + std::path::MAIN_SEPARATOR + ); + + ucmd.arg("-r") + .arg("-f") + .arg("-v") + .arg(&format!("{}///", dir)) + .succeeds() + .stdout_only(format!( + "removed '{}'\nremoved directory '{}'\n", + file_a_normalized, dir + )); + + assert!(!at.dir_exists(dir)); + assert!(!at.file_exists(file_a)); +} From cbe07c93c65c53437b17c6c7146c9044301b2c0d Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Mon, 5 Apr 2021 23:21:21 +0300 Subject: [PATCH 0274/1135] cksum: add tests and fixtures (#1923) --- tests/by-util/test_cksum.rs | 76 +++++++++++++++++++ tests/fixtures/cksum/chars.txt | 1 + .../fixtures/cksum/larger_than_2056_bytes.txt | 1 + 3 files changed, 78 insertions(+) create mode 100644 tests/fixtures/cksum/chars.txt create mode 100644 tests/fixtures/cksum/larger_than_2056_bytes.txt diff --git a/tests/by-util/test_cksum.rs b/tests/by-util/test_cksum.rs index d0bf5ffc8..8c8a551a0 100644 --- a/tests/by-util/test_cksum.rs +++ b/tests/by-util/test_cksum.rs @@ -24,3 +24,79 @@ fn test_stdin() { .succeeds() .stdout_is_fixture("stdin.expected"); } + +#[test] +fn test_empty() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.touch("a"); + + ucmd.arg("a").succeeds().stdout.ends_with("0 a"); +} + +#[test] +fn test_arg_overrides_stdin() { + let (at, mut ucmd) = at_and_ucmd!(); + let input = "foobarfoobar"; + + at.touch("a"); + + let result = ucmd.arg("a").pipe_in(input.as_bytes()).run(); + + println!("{}, {}", result.stdout, result.stderr); + + assert!(result.stdout.ends_with("0 a\n")) +} + +#[test] +fn test_invalid_file() { + let (_, mut ucmd) = at_and_ucmd!(); + + let ls = TestScenario::new("ls"); + let files = ls.cmd("ls").arg("-l").run(); + println!("{:?}", files.stdout); + println!("{:?}", files.stderr); + + let folder_name = "asdf".to_string(); + + let result = ucmd.arg(&folder_name).run(); + + println!("stdout: {:?}", result.stdout); + println!("stderr: {:?}", result.stderr); + assert!(result.stderr.contains("cksum: error: 'asdf'")); + assert!(!result.success); +} + +// Make sure crc is correct for files larger than 32 bytes +// but <128 bytes (1 fold pclmul) +#[test] +fn test_crc_for_bigger_than_32_bytes() { + let (_, mut ucmd) = at_and_ucmd!(); + + let result = ucmd.arg("chars.txt").run(); + + let mut stdout_splitted = result.stdout.split(" "); + + let cksum: i64 = stdout_splitted.next().unwrap().parse().unwrap(); + let bytes_cnt: i64 = stdout_splitted.next().unwrap().parse().unwrap(); + + assert!(result.success); + assert_eq!(cksum, 586047089); + assert_eq!(bytes_cnt, 16); +} + +#[test] +fn test_stdin_larger_than_128_bytes() { + let (_, mut ucmd) = at_and_ucmd!(); + + let result = ucmd.arg("larger_than_2056_bytes.txt").run(); + + let mut stdout_splitted = result.stdout.split(" "); + + let cksum: i64 = stdout_splitted.next().unwrap().parse().unwrap(); + let bytes_cnt: i64 = stdout_splitted.next().unwrap().parse().unwrap(); + + assert!(result.success); + assert_eq!(cksum, 945881979); + assert_eq!(bytes_cnt, 2058); +} diff --git a/tests/fixtures/cksum/chars.txt b/tests/fixtures/cksum/chars.txt new file mode 100644 index 000000000..26eec03fe --- /dev/null +++ b/tests/fixtures/cksum/chars.txt @@ -0,0 +1 @@ +123456789:;<=>?@ \ No newline at end of file diff --git a/tests/fixtures/cksum/larger_than_2056_bytes.txt b/tests/fixtures/cksum/larger_than_2056_bytes.txt new file mode 100644 index 000000000..668de449a --- /dev/null +++ b/tests/fixtures/cksum/larger_than_2056_bytes.txt @@ -0,0 +1 @@ +\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\400\401\402\403\404\405\406\407\410\411\412\413\414\415\416\417\420\421\422\423\424\425\426\427\430\431\432\433\434\435\436\437\440\441\442\443\444\445\446\447\450\451\452\453\454\455\456\457\460\461\462\463\464\465\466\467\470\471\472\473\474\475\476\477\500\501\502\503\504\505\506\507\510\511\512\513\514\515\516\517\520\521\522\523\524\525\526\527\530\531\532\533\534\535\536\537\540\541\542\543\544\545\546\547\550\551\552\553\554\555\556\557\560\561\562\563\564\565\566\567\570\571\572\573\574\575\576\577\600\601\602\603\604\605\606\607\610\611\612\613\614\615\616\617\620\621\622\623\624\625\626\627\630\631\632\633\634\635\636\637\640\641\642\643\644\645\646\647\650\651\652\653\654\655\656\657\660\661\662\663\664\665\666\667\670\671\672\673\674\675\676\677\700\701\702\703\704\705\706\707\710\711\712\713\714\715\716\717\720\721\722\723\724\725\726\727\730\731\732\733\734\735\736\737\740\741\742\743\744\745\746\747\750\751\752\753\754\755\756\757\760\761\762\763\764\765\766\767\770\771\772\773\774\775\776\777\1000\1001 \ No newline at end of file From de757cb0251d52826b7e87bfbc4f56025efad17f Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 5 Apr 2021 23:05:07 +0200 Subject: [PATCH 0275/1135] tee: refactor tests for #1982 --- tests/by-util/test_tee.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/by-util/test_tee.rs b/tests/by-util/test_tee.rs index f01677ae7..f2587a11f 100644 --- a/tests/by-util/test_tee.rs +++ b/tests/by-util/test_tee.rs @@ -68,15 +68,14 @@ fn test_tee_no_more_writeable_1() { .collect::(); let file_out = "tee_file_out"; - let result = ucmd - .arg("/dev/full") + ucmd.arg("/dev/full") .arg(file_out) .pipe_in(&content[..]) - .fails(); + .fails() + .stdout_contains(&content) + .stderr_contains(&"No space left on device"); assert_eq!(at.read(file_out), content); - assert!(result.stdout.contains(&content)); - assert!(result.stderr.contains("No space left on device")); } #[test] From cbc5132981a099854e0c9fd1464214c9620db58f Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 5 Apr 2021 23:06:56 +0200 Subject: [PATCH 0276/1135] ls: add short option for ignore --- src/uu/ls/src/ls.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index c4f9ae047..09fb3a7ea 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -704,6 +704,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) .arg( Arg::with_name(options::IGNORE) + .short("I") .long(options::IGNORE) .takes_value(true) .multiple(true) From cc30aead2241414d026b079e690afe1338fd3d74 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 5 Apr 2021 23:55:02 +0200 Subject: [PATCH 0277/1135] realpath: refactor tests for #1982 --- tests/by-util/test_realpath.rs | 98 +++++++++++++++++----------------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/tests/by-util/test_realpath.rs b/tests/by-util/test_realpath.rs index 750a8db01..e1384ac74 100644 --- a/tests/by-util/test_realpath.rs +++ b/tests/by-util/test_realpath.rs @@ -1,106 +1,108 @@ use crate::common::util::*; #[test] -fn test_current_directory() { +fn test_realpath_current_directory() { let (at, mut ucmd) = at_and_ucmd!(); - let actual = ucmd.arg(".").run().stdout; let expect = at.root_dir_resolved() + "\n"; - println!("actual: {:?}", actual); - println!("expect: {:?}", expect); - assert_eq!(actual, expect); + ucmd.arg(".").succeeds().stdout_is(expect); } #[test] -fn test_long_redirection_to_current_dir() { +fn test_realpath_long_redirection_to_current_dir() { let (at, mut ucmd) = at_and_ucmd!(); // Create a 256-character path to current directory let dir = path_concat!(".", ..128); - let actual = ucmd.arg(dir).run().stdout; let expect = at.root_dir_resolved() + "\n"; - println!("actual: {:?}", actual); - println!("expect: {:?}", expect); - assert_eq!(actual, expect); + ucmd.arg(dir).succeeds().stdout_is(expect); } #[test] -fn test_long_redirection_to_root() { +fn test_realpath_long_redirection_to_root() { // Create a 255-character path to root let dir = path_concat!("..", ..85); - let actual = new_ucmd!().arg(dir).run().stdout; let expect = get_root_path().to_owned() + "\n"; - println!("actual: {:?}", actual); - println!("expect: {:?}", expect); - assert_eq!(actual, expect); + new_ucmd!().arg(dir).succeeds().stdout_is(expect); } #[test] -fn test_file_and_links() { +fn test_realpath_file_and_links() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.touch("foo"); at.symlink_file("foo", "bar"); - let actual = scene.ucmd().arg("foo").run().stdout; - println!("actual: {:?}", actual); - assert!(actual.contains("foo\n")); - - let actual = scene.ucmd().arg("bar").run().stdout; - println!("actual: {:?}", actual); - assert!(actual.contains("foo\n")); + scene.ucmd().arg("foo").succeeds().stdout_contains("foo\n"); + scene.ucmd().arg("bar").succeeds().stdout_contains("foo\n"); } #[test] -fn test_file_and_links_zero() { +fn test_realpath_file_and_links_zero() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.touch("foo"); at.symlink_file("foo", "bar"); - let actual = scene.ucmd().arg("foo").arg("-z").run().stdout; - println!("actual: {:?}", actual); - assert!(actual.contains("foo")); - assert!(!actual.contains("\n")); + scene + .ucmd() + .arg("foo") + .arg("-z") + .succeeds() + .stdout_contains("foo\u{0}"); - let actual = scene.ucmd().arg("bar").arg("-z").run().stdout; - println!("actual: {:?}", actual); - assert!(actual.contains("foo")); - assert!(!actual.contains("\n")); + scene + .ucmd() + .arg("bar") + .arg("-z") + .succeeds() + .stdout_contains("foo\u{0}"); } #[test] -fn test_file_and_links_strip() { +fn test_realpath_file_and_links_strip() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.touch("foo"); at.symlink_file("foo", "bar"); - let actual = scene.ucmd().arg("foo").arg("-s").run().stdout; - println!("actual: {:?}", actual); - assert!(actual.contains("foo\n")); + scene + .ucmd() + .arg("foo") + .arg("-s") + .succeeds() + .stdout_contains("foo\n"); - let actual = scene.ucmd().arg("bar").arg("-s").run().stdout; - println!("actual: {:?}", actual); - assert!(actual.contains("bar\n")); + scene + .ucmd() + .arg("bar") + .arg("-s") + .succeeds() + .stdout_contains("bar\n"); } #[test] -fn test_file_and_links_strip_zero() { +fn test_realpath_file_and_links_strip_zero() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.touch("foo"); at.symlink_file("foo", "bar"); - let actual = scene.ucmd().arg("foo").arg("-s").arg("-z").run().stdout; - println!("actual: {:?}", actual); - assert!(actual.contains("foo")); - assert!(!actual.contains("\n")); + scene + .ucmd() + .arg("foo") + .arg("-s") + .arg("-z") + .succeeds() + .stdout_contains("foo\u{0}"); - let actual = scene.ucmd().arg("bar").arg("-s").arg("-z").run().stdout; - println!("actual: {:?}", actual); - assert!(actual.contains("bar")); - assert!(!actual.contains("\n")); + scene + .ucmd() + .arg("bar") + .arg("-s") + .arg("-z") + .succeeds() + .stdout_contains("bar\u{0}"); } From 057ceebdb032f049dd2905d87c78df8aea59ebc0 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Tue, 6 Apr 2021 00:04:49 +0200 Subject: [PATCH 0278/1135] rm: refactor tests for #1982 --- tests/by-util/test_rm.rs | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 0d77d9b01..9a068887c 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -15,14 +15,12 @@ fn test_rm_one_file() { #[test] fn test_rm_failed() { let (_at, mut ucmd) = at_and_ucmd!(); - let file = "test_rm_one_file"; + let file = "test_rm_one_file"; // Doesn't exist - let result = ucmd.arg(file).fails(); // Doesn't exist - - assert!(result.stderr.contains(&format!( + ucmd.arg(file).fails().stderr_contains(&format!( "cannot remove '{}': No such file or directory", file - ))); + )); } #[test] @@ -145,10 +143,10 @@ fn test_rm_non_empty_directory() { at.mkdir(dir); at.touch(file_a); - let result = ucmd.arg("-d").arg(dir).fails(); - assert!(result - .stderr - .contains(&format!("cannot remove '{}': Directory not empty", dir))); + ucmd.arg("-d") + .arg(dir) + .fails() + .stderr_contains(&format!("cannot remove '{}': Directory not empty", dir)); assert!(at.file_exists(file_a)); assert!(at.dir_exists(dir)); } @@ -178,11 +176,9 @@ fn test_rm_directory_without_flag() { at.mkdir(dir); - let result = ucmd.arg(dir).fails(); - println!("{}", result.stderr); - assert!(result - .stderr - .contains(&format!("cannot remove '{}': Is a directory", dir))); + ucmd.arg(dir) + .fails() + .stderr_contains(&format!("cannot remove '{}': Is a directory", dir)); } #[test] @@ -229,10 +225,11 @@ fn test_rm_symlink_dir() { at.mkdir(dir); at.symlink_dir(dir, link); - let result = scene.ucmd().arg(link).fails(); - assert!(result - .stderr - .contains(&format!("cannot remove '{}': Is a directory", link))); + scene + .ucmd() + .arg(link) + .fails() + .stderr_contains(&format!("cannot remove '{}': Is a directory", link)); assert!(at.dir_exists(link)); From b1fcb621a88e85830c074a9ac5c52def1ef73244 Mon Sep 17 00:00:00 2001 From: ReggaeMuffin <644950+reggaemuffin@users.noreply.github.com> Date: Tue, 6 Apr 2021 09:44:57 +0100 Subject: [PATCH 0279/1135] wsl2: wsl no longer differs in output refactor `is_wsl` to `is_wsl_1` and `is_wsl_2` On my tests with wsl2 ubuntu2004 all tests pass without special cases I moved wsl detection into uucore so that it can be shared instead of duplicated I moved `parse_mode` into uucode as it seemed to fit there better and anyway requires libc feature --- src/uu/mknod/src/mknod.rs | 4 +- src/uu/mknod/src/parsemode.rs | 58 ----------------------------- src/uucore/src/lib/features/mode.rs | 40 ++++++++++++++++++++ src/uucore/src/lib/lib.rs | 1 + src/uucore/src/lib/mods.rs | 1 + src/uucore/src/lib/mods/os.rs | 30 +++++++++++++++ tests/by-util/test_chgrp.rs | 3 +- tests/by-util/test_date.rs | 3 +- tests/by-util/test_du.rs | 9 +++-- tests/by-util/test_logname.rs | 3 +- tests/common/util.rs | 16 -------- 11 files changed, 84 insertions(+), 84 deletions(-) delete mode 100644 src/uu/mknod/src/parsemode.rs create mode 100644 src/uucore/src/lib/mods/os.rs diff --git a/src/uu/mknod/src/mknod.rs b/src/uu/mknod/src/mknod.rs index 1343501bb..98404f89f 100644 --- a/src/uu/mknod/src/mknod.rs +++ b/src/uu/mknod/src/mknod.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) parsemode makedev sysmacros makenod newmode perror IFBLK IFCHR IFIFO -mod parsemode; - #[macro_use] extern crate uucore; @@ -98,7 +96,7 @@ for details about the options it supports.", let mut last_umask: mode_t = 0; let mut newmode: mode_t = MODE_RW_UGO; if matches.opt_present("mode") { - match parsemode::parse_mode(matches.opt_str("mode")) { + match uucore::mode::parse_mode(matches.opt_str("mode")) { Ok(parsed) => { if parsed > 0o777 { show_info!("mode must specify only file permission bits"); diff --git a/src/uu/mknod/src/parsemode.rs b/src/uu/mknod/src/parsemode.rs deleted file mode 100644 index 8f8f9af61..000000000 --- a/src/uu/mknod/src/parsemode.rs +++ /dev/null @@ -1,58 +0,0 @@ -// spell-checker:ignore (ToDO) fperm - -use libc::{mode_t, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR}; - -use uucore::mode; - -pub fn parse_mode(mode: Option) -> Result { - let fperm = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; - if let Some(mode) = mode { - let arr: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; - let result = if mode.contains(arr) { - mode::parse_numeric(fperm as u32, mode.as_str()) - } else { - mode::parse_symbolic(fperm as u32, mode.as_str(), true) - }; - result.map(|mode| mode as mode_t) - } else { - Ok(fperm) - } -} - -#[cfg(test)] -mod test { - /// Test if the program is running under WSL - // ref: @@ - // ToDO: test on WSL2 which likely doesn't need special handling; plan change to `is_wsl_1()` if WSL2 is less needy - pub fn is_wsl() -> bool { - #[cfg(target_os = "linux")] - { - if let Ok(b) = std::fs::read("/proc/sys/kernel/osrelease") { - if let Ok(s) = std::str::from_utf8(&b) { - let a = s.to_ascii_lowercase(); - return a.contains("microsoft") || a.contains("wsl"); - } - } - } - false - } - - #[test] - fn symbolic_modes() { - assert_eq!(super::parse_mode(Some("u+x".to_owned())).unwrap(), 0o766); - assert_eq!( - super::parse_mode(Some("+x".to_owned())).unwrap(), - if !is_wsl() { 0o777 } else { 0o776 } - ); - assert_eq!(super::parse_mode(Some("a-w".to_owned())).unwrap(), 0o444); - assert_eq!(super::parse_mode(Some("g-r".to_owned())).unwrap(), 0o626); - } - - #[test] - fn numeric_modes() { - assert_eq!(super::parse_mode(Some("644".to_owned())).unwrap(), 0o644); - assert_eq!(super::parse_mode(Some("+100".to_owned())).unwrap(), 0o766); - assert_eq!(super::parse_mode(Some("-4".to_owned())).unwrap(), 0o662); - assert_eq!(super::parse_mode(None).unwrap(), 0o666); - } -} diff --git a/src/uucore/src/lib/features/mode.rs b/src/uucore/src/lib/features/mode.rs index 8b5e71799..1bb79ac03 100644 --- a/src/uucore/src/lib/features/mode.rs +++ b/src/uucore/src/lib/features/mode.rs @@ -7,6 +7,8 @@ // spell-checker:ignore (vars) fperm srwx +use libc::{mode_t, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR}; + pub fn parse_numeric(fperm: u32, mut mode: &str) -> Result { let (op, pos) = parse_op(mode, Some('='))?; mode = mode[pos..].trim().trim_start_matches('0'); @@ -129,3 +131,41 @@ fn parse_change(mode: &str, fperm: u32, considering_dir: bool) -> (u32, usize) { } (srwx, pos) } + +pub fn parse_mode(mode: Option) -> Result { + let fperm = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; + if let Some(mode) = mode { + let arr: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; + let result = if mode.contains(arr) { + parse_numeric(fperm as u32, mode.as_str()) + } else { + parse_symbolic(fperm as u32, mode.as_str(), true) + }; + result.map(|mode| mode as mode_t) + } else { + Ok(fperm) + } +} + +#[cfg(test)] +mod test { + + #[test] + fn symbolic_modes() { + assert_eq!(super::parse_mode(Some("u+x".to_owned())).unwrap(), 0o766); + assert_eq!( + super::parse_mode(Some("+x".to_owned())).unwrap(), + if !crate::os::is_wsl_1() { 0o777 } else { 0o776 } + ); + assert_eq!(super::parse_mode(Some("a-w".to_owned())).unwrap(), 0o444); + assert_eq!(super::parse_mode(Some("g-r".to_owned())).unwrap(), 0o626); + } + + #[test] + fn numeric_modes() { + assert_eq!(super::parse_mode(Some("644".to_owned())).unwrap(), 0o644); + assert_eq!(super::parse_mode(Some("+100".to_owned())).unwrap(), 0o766); + assert_eq!(super::parse_mode(Some("-4".to_owned())).unwrap(), 0o662); + assert_eq!(super::parse_mode(None).unwrap(), 0o666); + } +} diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 324095b6a..208e9536c 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -26,6 +26,7 @@ mod mods; // core cross-platform modules // * cross-platform modules pub use crate::mods::coreopts; +pub use crate::mods::os; pub use crate::mods::panic; pub use crate::mods::ranges; diff --git a/src/uucore/src/lib/mods.rs b/src/uucore/src/lib/mods.rs index c73909dcc..74725e141 100644 --- a/src/uucore/src/lib/mods.rs +++ b/src/uucore/src/lib/mods.rs @@ -1,5 +1,6 @@ // mods ~ cross-platforms modules (core/bundler file) pub mod coreopts; +pub mod os; pub mod panic; pub mod ranges; diff --git a/src/uucore/src/lib/mods/os.rs b/src/uucore/src/lib/mods/os.rs new file mode 100644 index 000000000..da2002161 --- /dev/null +++ b/src/uucore/src/lib/mods/os.rs @@ -0,0 +1,30 @@ +/// Test if the program is running under WSL +// ref: @@ +pub fn is_wsl_1() -> bool { + #[cfg(target_os = "linux")] + { + if is_wsl_2() { + return false; + } + if let Ok(b) = std::fs::read("/proc/sys/kernel/osrelease") { + if let Ok(s) = std::str::from_utf8(&b) { + let a = s.to_ascii_lowercase(); + return a.contains("microsoft") || a.contains("wsl"); + } + } + } + false +} + +pub fn is_wsl_2() -> bool { + #[cfg(target_os = "linux")] + { + if let Ok(b) = std::fs::read("/proc/sys/kernel/osrelease") { + if let Ok(s) = std::str::from_utf8(&b) { + let a = s.to_ascii_lowercase(); + return a.contains("wsl2"); + } + } + } + false +} diff --git a/tests/by-util/test_chgrp.rs b/tests/by-util/test_chgrp.rs index 613f52fd2..ffb078137 100644 --- a/tests/by-util/test_chgrp.rs +++ b/tests/by-util/test_chgrp.rs @@ -1,5 +1,6 @@ use crate::common::util::*; use rust_users::*; +use uucore; #[test] fn test_invalid_option() { @@ -104,7 +105,7 @@ fn test_reference() { // skip for root or MS-WSL // * MS-WSL is bugged (as of 2019-12-25), allowing non-root accounts su-level privileges for `chgrp` // * for MS-WSL, succeeds and stdout == 'group of /etc retained as root' - if !(get_effective_gid() == 0 || is_wsl()) { + if !(get_effective_gid() == 0 || uucore::os::is_wsl_1()) { new_ucmd!() .arg("-v") .arg("--reference=/etc/passwd") diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 5619aed94..b4e49e775 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -4,6 +4,7 @@ use self::regex::Regex; use crate::common::util::*; #[cfg(all(unix, not(target_os = "macos")))] use rust_users::*; +use uucore; #[test] fn test_date_email() { @@ -159,7 +160,7 @@ fn test_date_set_invalid() { #[test] #[cfg(all(unix, not(target_os = "macos")))] fn test_date_set_permissions_error() { - if !(get_effective_uid() == 0 || is_wsl()) { + if !(get_effective_uid() == 0 || uucore::os::is_wsl_1()) { let (_, mut ucmd) = at_and_ucmd!(); let result = ucmd.arg("--set").arg("2020-03-11 21:45:00+08:00").fails(); let result = result.no_stdout(); diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index b3b1b3465..a0d698de0 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -1,4 +1,5 @@ use crate::common::util::*; +use uucore; const SUB_DIR: &str = "subdir/deeper"; const SUB_DIR_LINKS: &str = "subdir/links"; @@ -52,7 +53,7 @@ fn _du_basics_subdir(s: String) { #[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] fn _du_basics_subdir(s: String) { // MS-WSL linux has altered expected output - if !is_wsl() { + if !uucore::os::is_wsl_1() { assert_eq!(s, "8\tsubdir/deeper\n"); } else { assert_eq!(s, "0\tsubdir/deeper\n"); @@ -96,7 +97,7 @@ fn _du_soft_link(s: String) { #[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] fn _du_soft_link(s: String) { // MS-WSL linux has altered expected output - if !is_wsl() { + if !uucore::os::is_wsl_1() { assert_eq!(s, "16\tsubdir/links\n"); } else { assert_eq!(s, "8\tsubdir/links\n"); @@ -128,7 +129,7 @@ fn _du_hard_link(s: String) { #[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] fn _du_hard_link(s: String) { // MS-WSL linux has altered expected output - if !is_wsl() { + if !uucore::os::is_wsl_1() { assert_eq!(s, "16\tsubdir/links\n"); } else { assert_eq!(s, "8\tsubdir/links\n"); @@ -156,7 +157,7 @@ fn _du_d_flag(s: String) { #[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] fn _du_d_flag(s: String) { // MS-WSL linux has altered expected output - if !is_wsl() { + if !uucore::os::is_wsl_1() { assert_eq!(s, "28\t./subdir\n36\t./\n"); } else { assert_eq!(s, "8\t./subdir\n8\t./\n"); diff --git a/tests/by-util/test_logname.rs b/tests/by-util/test_logname.rs index b15941c06..baaad63cc 100644 --- a/tests/by-util/test_logname.rs +++ b/tests/by-util/test_logname.rs @@ -1,5 +1,6 @@ use crate::common::util::*; use std::env; +use uucore; #[test] fn test_normal() { @@ -13,7 +14,7 @@ fn test_normal() { for (key, value) in env::vars() { println!("{}: {}", key, value); } - if (is_ci() || is_wsl()) && result.stderr.contains("error: no login name") { + if (is_ci() || uucore::os::is_wsl_1()) && result.stderr.contains("error: no login name") { // ToDO: investigate WSL failure // In the CI, some server are failing to return logname. // As seems to be a configuration issue, ignoring it diff --git a/tests/common/util.rs b/tests/common/util.rs index 708b8dbba..38f5a90cc 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -40,22 +40,6 @@ pub fn is_ci() -> bool { .eq_ignore_ascii_case("true") } -/// Test if the program is running under WSL -// ref: @@ -// ToDO: test on WSL2 which likely doesn't need special handling; plan change to `is_wsl_1()` if WSL2 is less needy -pub fn is_wsl() -> bool { - #[cfg(target_os = "linux")] - { - if let Ok(b) = std::fs::read("/proc/sys/kernel/osrelease") { - if let Ok(s) = std::str::from_utf8(&b) { - let a = s.to_ascii_lowercase(); - return a.contains("microsoft") || a.contains("wsl"); - } - } - } - false -} - /// Read a test scenario fixture, returning its bytes fn read_scenario_fixture>(tmpd: &Option>, file_rel_path: S) -> Vec { let tmpdir_path = tmpd.as_ref().unwrap().as_ref().path(); From 0b731dfd1a2cb6fd15ef341d6e03150b5fdaffbe Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Mon, 5 Apr 2021 20:39:43 -0400 Subject: [PATCH 0280/1135] fold: preserve backspace and overwritten chars in output --- src/uu/fold/src/fold.rs | 6 +--- tests/by-util/test_fold.rs | 73 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 5 deletions(-) diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index fac0ff28e..3bcb55e51 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -232,13 +232,9 @@ fn fold_file(mut file: BufReader, spaces: bool, width: usize) { last_space = if spaces { Some(char_count) } else { None }; } '\x08' => { - // FIXME: does not match GNU's handling of backspace if col_count > 0 { col_count -= 1; - char_count -= 1; - output.truncate(char_count); } - continue; } '\r' => { // FIXME: does not match GNU's handling of carriage return @@ -258,7 +254,7 @@ fn fold_file(mut file: BufReader, spaces: bool, width: usize) { char_count += 1; } - if col_count > 0 { + if char_count > 0 { print!("{}", output); output.truncate(0); } diff --git a/tests/by-util/test_fold.rs b/tests/by-util/test_fold.rs index cc92c8ff3..287b05157 100644 --- a/tests/by-util/test_fold.rs +++ b/tests/by-util/test_fold.rs @@ -248,6 +248,43 @@ fn test_fold_at_word_boundary_only_whitespace_preserve_final_newline() { .stdout_is(" \n \n"); } +#[test] +fn test_backspace_should_be_preserved() { + new_ucmd!().pipe_in("\x08").succeeds().stdout_is("\x08"); +} + +#[test] +fn test_backspaced_char_should_be_preserved() { + new_ucmd!().pipe_in("x\x08").succeeds().stdout_is("x\x08"); +} + +#[test] +fn test_backspace_should_decrease_column_count() { + new_ucmd!() + .arg("-w2") + .pipe_in("1\x08345") + .succeeds() + .stdout_is("1\x0834\n5"); +} + +#[test] +fn test_backspace_should_not_decrease_column_count_past_zero() { + new_ucmd!() + .arg("-w2") + .pipe_in("1\x08\x083456") + .succeeds() + .stdout_is("1\x08\x0834\n56"); +} + +#[test] +fn test_backspace_is_not_word_boundary() { + new_ucmd!() + .args(&["-w10", "-s"]) + .pipe_in("foobar\x086789abcdef") + .succeeds() + .stdout_is("foobar\x086789a\nbcdef"); +} + // // bytewise tests @@ -397,3 +434,39 @@ fn test_bytewise_fold_at_word_boundary_only_whitespace_preserve_final_newline() .succeeds() .stdout_is(" \n \n"); } + +#[test] +fn test_bytewise_backspace_should_be_preserved() { + new_ucmd!() + .arg("-b") + .pipe_in("\x08") + .succeeds() + .stdout_is("\x08"); +} + +#[test] +fn test_bytewise_backspaced_char_should_be_preserved() { + new_ucmd!() + .arg("-b") + .pipe_in("x\x08") + .succeeds() + .stdout_is("x\x08"); +} + +#[test] +fn test_bytewise_backspace_should_not_decrease_column_count() { + new_ucmd!() + .args(&["-w2", "-b"]) + .pipe_in("1\x08345") + .succeeds() + .stdout_is("1\x08\n34\n5"); +} + +#[test] +fn test_bytewise_backspace_is_not_word_boundary() { + new_ucmd!() + .args(&["-w10", "-s", "-b"]) + .pipe_in("foobar\x0889abcdef") + .succeeds() + .stdout_is("foobar\x0889a\nbcdef"); +} From 56bc7a44ebaaceb1f7338895dce489090044f8c8 Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Mon, 5 Apr 2021 21:41:25 -0400 Subject: [PATCH 0281/1135] fold: preserve carriage return and overwritten chars in output --- src/uu/fold/src/fold.rs | 23 +++++--------- tests/by-util/test_fold.rs | 64 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 16 deletions(-) diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index 3bcb55e51..54cb41e27 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -132,7 +132,7 @@ fn fold_file_bytewise(mut file: BufReader, spaces: bool, width: usiz let slice = { let slice = &line[i..i + width]; if spaces && i + width < len { - match slice.rfind(char::is_whitespace) { + match slice.rfind(|c: char| c.is_whitespace() && c != '\r') { Some(m) => &slice[..=m], None => slice, } @@ -175,7 +175,6 @@ fn fold_file(mut file: BufReader, spaces: bool, width: usize) { let mut line = String::new(); let mut output = String::new(); let mut col_count = 0; - let mut char_count = 0; let mut last_space = None; /// Print the output line, resetting the column and character counts. @@ -192,11 +191,10 @@ fn fold_file(mut file: BufReader, spaces: bool, width: usize) { println!("{}", &output[..consume]); output.replace_range(..consume, ""); - char_count = output.len(); // we know there are no tabs left in output, so each char counts // as 1 column - col_count = char_count; + col_count = output.len(); last_space = None; }; @@ -221,6 +219,7 @@ fn fold_file(mut file: BufReader, spaces: bool, width: usize) { } match ch { + '\r' => col_count = 0, '\t' => { let next_tab_stop = col_count + TAB_WIDTH - col_count % TAB_WIDTH; @@ -229,32 +228,24 @@ fn fold_file(mut file: BufReader, spaces: bool, width: usize) { } col_count = next_tab_stop; - last_space = if spaces { Some(char_count) } else { None }; + last_space = if spaces { Some(output.len()) } else { None }; } '\x08' => { if col_count > 0 { col_count -= 1; } } - '\r' => { - // FIXME: does not match GNU's handling of carriage return - output.truncate(0); - col_count = 0; - char_count = 0; - continue; - } _ if spaces && ch.is_whitespace() => { - last_space = Some(char_count); - col_count += 1 + last_space = Some(output.len()); + col_count += 1; } _ => col_count += 1, }; output.push(ch); - char_count += 1; } - if char_count > 0 { + if !output.is_empty() { print!("{}", output); output.truncate(0); } diff --git a/tests/by-util/test_fold.rs b/tests/by-util/test_fold.rs index 287b05157..61c057782 100644 --- a/tests/by-util/test_fold.rs +++ b/tests/by-util/test_fold.rs @@ -285,6 +285,34 @@ fn test_backspace_is_not_word_boundary() { .stdout_is("foobar\x086789a\nbcdef"); } +#[test] +fn test_carriage_return_should_be_preserved() { + new_ucmd!().pipe_in("\r").succeeds().stdout_is("\r"); +} + +#[test] +fn test_carriage_return_overwrriten_char_should_be_preserved() { + new_ucmd!().pipe_in("x\ry").succeeds().stdout_is("x\ry"); +} + +#[test] +fn test_carriage_return_should_reset_column_count() { + new_ucmd!() + .arg("-w6") + .pipe_in("12345\r123456789abcdef") + .succeeds() + .stdout_is("12345\r123456\n789abc\ndef"); +} + +#[test] +fn test_carriage_return_is_not_word_boundary() { + new_ucmd!() + .args(&["-w6", "-s"]) + .pipe_in("fizz\rbuzz\rfizzbuzz") + .succeeds() + .stdout_is("fizz\rbuzz\rfizzbu\nzz"); +} + // // bytewise tests @@ -470,3 +498,39 @@ fn test_bytewise_backspace_is_not_word_boundary() { .succeeds() .stdout_is("foobar\x0889a\nbcdef"); } + +#[test] +fn test_bytewise_carriage_return_should_be_preserved() { + new_ucmd!() + .arg("-b") + .pipe_in("\r") + .succeeds() + .stdout_is("\r"); +} + +#[test] +fn test_bytewise_carriage_return_overwrriten_char_should_be_preserved() { + new_ucmd!() + .arg("-b") + .pipe_in("x\ry") + .succeeds() + .stdout_is("x\ry"); +} + +#[test] +fn test_bytewise_carriage_return_should_not_reset_column_count() { + new_ucmd!() + .args(&["-w6", "-b"]) + .pipe_in("12345\r123456789abcdef") + .succeeds() + .stdout_is("12345\r\n123456\n789abc\ndef"); +} + +#[test] +fn test_bytewise_carriage_return_is_not_word_boundary() { + new_ucmd!() + .args(&["-w6", "-s", "-b"]) + .pipe_in("fizz\rbuzz\rfizzbuzz") + .succeeds() + .stdout_is("fizz\rb\nuzz\rfi\nzzbuzz"); +} From bc426fb3af7bc68c4ef575775a6196f8d21d1ff3 Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Tue, 6 Apr 2021 01:59:25 +0300 Subject: [PATCH 0282/1135] Fixed panic!/assert! used with improper format strings --- src/uu/od/src/inputdecoder.rs | 51 +++++++++++++++-------------------- src/uucore/src/lib/macros.rs | 4 +-- 2 files changed, 23 insertions(+), 32 deletions(-) diff --git a/src/uu/od/src/inputdecoder.rs b/src/uu/od/src/inputdecoder.rs index 3b36c28fb..f6ba59885 100644 --- a/src/uu/od/src/inputdecoder.rs +++ b/src/uu/od/src/inputdecoder.rs @@ -166,39 +166,30 @@ mod tests { let mut input = PeekReader::new(Cursor::new(&data)); let mut sut = InputDecoder::new(&mut input, 8, 2, ByteOrder::Little); - match sut.peek_read() { - Ok(mut mem) => { - assert_eq!(8, mem.length()); + // Peek normal length + let mut mem = sut.peek_read().unwrap(); - assert_eq!(-2.0, mem.read_float(0, 8)); - assert_eq!(-2.0, mem.read_float(4, 4)); - assert_eq!(0xc000000000000000, mem.read_uint(0, 8)); - assert_eq!(0xc0000000, mem.read_uint(4, 4)); - assert_eq!(0xc000, mem.read_uint(6, 2)); - assert_eq!(0xc0, mem.read_uint(7, 1)); - assert_eq!(&[0, 0xc0], mem.get_buffer(6)); - assert_eq!(&[0, 0xc0, 0xff, 0xff], mem.get_full_buffer(6)); + assert_eq!(8, mem.length()); - let mut copy: Vec = Vec::new(); - mem.clone_buffer(&mut copy); - assert_eq!(vec![0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0], copy); + assert_eq!(-2.0, mem.read_float(0, 8)); + assert_eq!(-2.0, mem.read_float(4, 4)); + assert_eq!(0xc000000000000000, mem.read_uint(0, 8)); + assert_eq!(0xc0000000, mem.read_uint(4, 4)); + assert_eq!(0xc000, mem.read_uint(6, 2)); + assert_eq!(0xc0, mem.read_uint(7, 1)); + assert_eq!(&[0, 0xc0], mem.get_buffer(6)); + assert_eq!(&[0, 0xc0, 0xff, 0xff], mem.get_full_buffer(6)); - mem.zero_out_buffer(7, 8); - assert_eq!(&[0, 0, 0xff, 0xff], mem.get_full_buffer(6)); - } - Err(e) => { - assert!(false, e); - } - } + let mut copy: Vec = Vec::new(); + mem.clone_buffer(&mut copy); + assert_eq!(vec![0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0], copy); - match sut.peek_read() { - Ok(mem) => { - assert_eq!(2, mem.length()); - assert_eq!(0xffff, mem.read_uint(0, 2)); - } - Err(e) => { - assert!(false, e); - } - } + mem.zero_out_buffer(7, 8); + assert_eq!(&[0, 0, 0xff, 0xff], mem.get_full_buffer(6)); + + // Peek tail + let mem = sut.peek_read().unwrap(); + assert_eq!(2, mem.length()); + assert_eq!(0xffff, mem.read_uint(0, 2)); } } diff --git a/src/uucore/src/lib/macros.rs b/src/uucore/src/lib/macros.rs index 6836f81aa..24b392ebd 100644 --- a/src/uucore/src/lib/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -108,7 +108,7 @@ macro_rules! safe_write( ($fd:expr, $($args:tt)+) => ( match write!($fd, $($args)+) { Ok(_) => {} - Err(f) => panic!(f.to_string()) + Err(f) => panic!("{}", f) } ) ); @@ -118,7 +118,7 @@ macro_rules! safe_writeln( ($fd:expr, $($args:tt)+) => ( match writeln!($fd, $($args)+) { Ok(_) => {} - Err(f) => panic!(f.to_string()) + Err(f) => panic!("{}", f) } ) ); From f9fc3b5a1d3259c12d3175c514cdb397c0ae6cae Mon Sep 17 00:00:00 2001 From: Wisha Wa Date: Tue, 6 Apr 2021 13:19:27 +0000 Subject: [PATCH 0283/1135] ptx: add explaination comments, replace mut with shadowing, and rename variables for clarity. --- src/uu/ptx/src/ptx.rs | 91 +++++++++++++++++++++++++++++++------------ 1 file changed, 67 insertions(+), 24 deletions(-) diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index 6b3dae27f..65e310576 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -224,6 +224,9 @@ fn read_input(input_files: &[String], config: &Config) -> FileMap { Box::new(file) }); let lines: Vec = reader.lines().map(|x| crash_if_err!(1, x)).collect(); + + // Indexing UTF-8 string requires walking from the beginning, which can hurts performance badly when the line is long. + // Since we will be jumping around the line a lot, we dump the content into a Vec, which can be indexed in constant time. let chars_lines: Vec> = lines.iter().map(|x| x.chars().collect()).collect(); let size = lines.len(); file_map.insert( @@ -239,6 +242,7 @@ fn read_input(input_files: &[String], config: &Config) -> FileMap { file_map } +/// Go through every lines in the input files and record each match occurance as a `WordRef`. fn create_word_set(config: &Config, filter: &WordFilter, file_map: &FileMap) -> BTreeSet { let reg = Regex::new(&filter.word_regex).unwrap(); let ref_reg = Regex::new(&config.context_regex).unwrap(); @@ -345,6 +349,8 @@ fn get_output_chunks( all_after: &[char], config: &Config, ) -> (String, String, String, String) { + // Chunk size logics are mostly copied from the GNU ptx source. + // https://github.com/MaiZure/coreutils-8.3/blob/master/src/ptx.c#L1234 let half_line_size = (config.line_width / 2) as usize; let max_before_size = cmp::max(half_line_size as isize - config.gap_size as isize, 0) as usize; let max_after_size = cmp::max( @@ -355,56 +361,92 @@ fn get_output_chunks( 0, ) as usize; + // Allocate plenty space for all the chunks. let mut head = String::with_capacity(half_line_size); let mut before = String::with_capacity(half_line_size); let mut after = String::with_capacity(half_line_size); let mut tail = String::with_capacity(half_line_size); - // get before - let (_, be) = trim_idx(all_before, 0, all_before.len()); - let mut bb_tmp = cmp::max(be as isize - max_before_size as isize, 0) as usize; - bb_tmp = trim_broken_word_left(all_before, bb_tmp, be); - let (before_beg, before_end) = trim_idx(all_before, bb_tmp, be); + // the before chunk + + // trim whitespace away from all_before to get the index where the before chunk should end. + let (_, before_end) = trim_idx(all_before, 0, all_before.len()); + + // the minimum possible begin index of the before_chunk is the end index minus the length. + let before_beg = cmp::max(before_end as isize - max_before_size as isize, 0) as usize; + // in case that falls in the middle of a word, trim away the word. + let before_beg = trim_broken_word_left(all_before, before_beg, before_end); + + // trim away white space. + let (before_beg, before_end) = trim_idx(all_before, before_beg, before_end); + + // and get the string. let before_str: String = all_before[before_beg..before_end].iter().collect(); before.push_str(&before_str); assert!(max_before_size >= before.len()); - // get after - let mut ae_tmp = cmp::min(max_after_size, all_after.len()); - ae_tmp = trim_broken_word_right(all_after, 0, ae_tmp); - let (_, after_end) = trim_idx(all_after, 0, ae_tmp); + // the after chunk + + // must be no longer than the minimum between the max size and the total available string. + let after_end = cmp::min(max_after_size, all_after.len()); + // in case that falls in the middle of a word, trim away the word. + let after_end = trim_broken_word_right(all_after, 0, after_end); + + // trim away white space. + let (_, after_end) = trim_idx(all_after, 0, after_end); + + // and get the string let after_str: String = all_after[0..after_end].iter().collect(); after.push_str(&after_str); assert!(max_after_size >= after.len()); - // get tail + // the tail chunk + + // max size of the tail chunk = max size of left half - space taken by before chunk - gap size. let max_tail_size = cmp::max( max_before_size as isize - before.len() as isize - config.gap_size as isize, 0, ) as usize; - let (tb, _) = trim_idx(all_after, after_end, all_after.len()); - let mut te_tmp = cmp::min(all_after.len(), tb + max_tail_size) as usize; - te_tmp = trim_broken_word_right( + + // the tail chunk takes text starting from where the after chunk ends (with whitespaces trimmed). + let (tail_beg, _) = trim_idx(all_after, after_end, all_after.len()); + + // end = begin + max length + let tail_end = cmp::min(all_after.len(), tail_beg + max_tail_size) as usize; + // in case that falls in the middle of a word, trim away the word. + let tail_end = trim_broken_word_right( all_after, - tb, - cmp::max(te_tmp as isize - 1, tb as isize) as usize, + tail_beg, + cmp::max(tail_end as isize - 1, tail_beg as isize) as usize, ); - let (tail_beg, tail_end) = trim_idx(all_after, tb, te_tmp); + + // trim away whitespace again. + let (tail_beg, tail_end) = trim_idx(all_after, tail_beg, tail_end); + + // and get the string let tail_str: String = all_after[tail_beg..tail_end].iter().collect(); tail.push_str(&tail_str); - // get head + // the head chunk + + // max size of the head chunk = max size of right half - space taken by after chunk - gap size. let max_head_size = cmp::max( max_after_size as isize - after.len() as isize - config.gap_size as isize, 0, ) as usize; - let (_, he) = trim_idx(all_before, 0, before_beg); - let hb_tmp = trim_broken_word_left( - all_before, - cmp::max(he as isize - max_head_size as isize, 0) as usize, - he, - ); - let (head_beg, head_end) = trim_idx(all_before, hb_tmp, he); + + // the head chunk takes text from before the before chunk + let (_, head_end) = trim_idx(all_before, 0, before_beg); + + // begin = end - max length + let head_beg = cmp::max(head_end as isize - max_head_size as isize, 0) as usize; + // in case that falls in the middle of a word, trim away the word. + let head_beg = trim_broken_word_left(all_before, head_beg, head_end); + + // trim away white space again. + let (head_beg, head_end) = trim_idx(all_before, head_beg, head_end); + + // and get the string. let head_str: String = all_before[head_beg..head_end].iter().collect(); head.push_str(&head_str); @@ -434,6 +476,7 @@ fn tex_mapper(x: char) -> String { } } +/// Escape special characters for TeX. fn format_tex_field(s: &str) -> String { let mapped_chunks: Vec = s.chars().map(tex_mapper).collect(); mapped_chunks.join("") From 5fc007b295230730bb2b67d3db32fb7defcac6a3 Mon Sep 17 00:00:00 2001 From: Wisha Wa Date: Tue, 6 Apr 2021 13:40:14 +0000 Subject: [PATCH 0284/1135] ptx: remove a hack that was added in attempt to mimick GNU ptx --- src/uu/ptx/src/ptx.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index 65e310576..6d30d471b 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -414,11 +414,7 @@ fn get_output_chunks( // end = begin + max length let tail_end = cmp::min(all_after.len(), tail_beg + max_tail_size) as usize; // in case that falls in the middle of a word, trim away the word. - let tail_end = trim_broken_word_right( - all_after, - tail_beg, - cmp::max(tail_end as isize - 1, tail_beg as isize) as usize, - ); + let tail_end = trim_broken_word_right(all_after, tail_beg, tail_end); // trim away whitespace again. let (tail_beg, tail_end) = trim_idx(all_after, tail_beg, tail_end); From 7b20c79bddb52e6b726d70ac22ede33dc80eed78 Mon Sep 17 00:00:00 2001 From: Wisha Wa Date: Tue, 6 Apr 2021 18:07:02 +0000 Subject: [PATCH 0285/1135] ptx: fix an incorrect option name in option parsing --- src/uu/ptx/src/ptx.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index 6d30d471b..38327e4e3 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -169,9 +169,9 @@ fn get_config(matches: &clap::ArgMatches) -> Config { .expect(err_msg) .to_string(); } - if matches.is_present(options::IGNORE_CASE) { + if matches.is_present(options::FLAG_TRUNCATION) { config.trunc_str = matches - .value_of(options::IGNORE_CASE) + .value_of(options::FLAG_TRUNCATION) .expect(err_msg) .to_string(); } From c965effe07b80b726f108d80d77e01da7705f2fd Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Tue, 6 Apr 2021 23:51:27 +0300 Subject: [PATCH 0286/1135] fold: move to clap, add tests (#2015) --- Cargo.lock | 1 + src/uu/fold/Cargo.toml | 1 + src/uu/fold/src/fold.rs | 76 ++++++++++++------- tests/by-util/test_fold.rs | 10 +++ tests/fixtures/fold/space_separated_words.txt | 1 + 5 files changed, 63 insertions(+), 26 deletions(-) create mode 100644 tests/fixtures/fold/space_separated_words.txt diff --git a/Cargo.lock b/Cargo.lock index ce4457231..f65ba3dff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1861,6 +1861,7 @@ dependencies = [ name = "uu_fold" version = "0.0.6" dependencies = [ + "clap", "uucore", "uucore_procs", ] diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index f99abc691..c5578384e 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/fold.rs" [dependencies] +clap = "2.33" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index fac0ff28e..e19e9db19 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -10,48 +10,71 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; use std::path::Path; const TAB_WIDTH: usize = 8; +static NAME: &str = "fold"; +static VERSION: &str = env!("CARGO_PKG_VERSION"); static SYNTAX: &str = "[OPTION]... [FILE]..."; static SUMMARY: &str = "Writes each file (or standard input if no files are given) to standard output whilst breaking long lines"; -static LONG_HELP: &str = ""; + +mod options { + pub const BYTES: &str = "bytes"; + pub const SPACES: &str = "spaces"; + pub const WIDTH: &str = "width"; + pub const FILE: &str = "file"; +} pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); let (args, obs_width) = handle_obsolete(&args[..]); - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optflag( - "b", - "bytes", - "count using bytes rather than columns (meaning control characters \ + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(SYNTAX) + .about(SUMMARY) + .arg( + Arg::with_name(options::BYTES) + .long(options::BYTES) + .short("b") + .help( + "count using bytes rather than columns (meaning control characters \ such as newline are not treated specially)", + ) + .takes_value(false), ) - .optflag( - "s", - "spaces", - "break lines at word boundaries rather than a hard cut-off", + .arg( + Arg::with_name(options::SPACES) + .long(options::SPACES) + .short("s") + .help("break lines at word boundaries rather than a hard cut-off") + .takes_value(false), ) - .optopt( - "w", - "width", - "set WIDTH as the maximum line width rather than 80", - "WIDTH", + .arg( + Arg::with_name(options::WIDTH) + .long(options::WIDTH) + .short("w") + .help("set WIDTH as the maximum line width rather than 80") + .value_name("WIDTH") + .allow_hyphen_values(true) + .takes_value(true), ) - .parse(args); + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) + .get_matches_from(args.clone()); - let bytes = matches.opt_present("b"); - let spaces = matches.opt_present("s"); - let poss_width = if matches.opt_present("w") { - matches.opt_str("w") - } else { - obs_width + let bytes = matches.is_present(options::BYTES); + let spaces = matches.is_present(options::SPACES); + let poss_width = match matches.value_of(options::WIDTH) { + Some(v) => Some(v.to_owned()), + None => obs_width, }; + let width = match poss_width { Some(inp_width) => match inp_width.parse::() { Ok(width) => width, @@ -59,11 +82,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }, None => 80, }; - let files = if matches.free.is_empty() { - vec!["-".to_owned()] - } else { - matches.free + + let files = match matches.values_of(options::FILE) { + Some(v) => v.map(|v| v.to_owned()).collect(), + None => vec!["-".to_owned()], }; + fold(files, bytes, spaces, width); 0 diff --git a/tests/by-util/test_fold.rs b/tests/by-util/test_fold.rs index cc92c8ff3..bdc5e2246 100644 --- a/tests/by-util/test_fold.rs +++ b/tests/by-util/test_fold.rs @@ -397,3 +397,13 @@ fn test_bytewise_fold_at_word_boundary_only_whitespace_preserve_final_newline() .succeeds() .stdout_is(" \n \n"); } + +#[test] +fn test_obsolete_syntax() { + new_ucmd!() + .arg("-5") + .arg("-s") + .arg("space_separated_words.txt") + .succeeds() + .stdout_is("test1\n \ntest2\n \ntest3\n \ntest4\n \ntest5\n \ntest6\n "); +} diff --git a/tests/fixtures/fold/space_separated_words.txt b/tests/fixtures/fold/space_separated_words.txt new file mode 100644 index 000000000..13b980632 --- /dev/null +++ b/tests/fixtures/fold/space_separated_words.txt @@ -0,0 +1 @@ +test1 test2 test3 test4 test5 test6 \ No newline at end of file From cccf89a48cbac9cda450caf1767881aaa8099f37 Mon Sep 17 00:00:00 2001 From: Ricardo Iglesias Date: Tue, 6 Apr 2021 21:52:56 -0700 Subject: [PATCH 0287/1135] timeout: Moved argument parsing to clap Changed from optparse to clap. None of the logic within timeout has been changed, which could use some refactoring, but that's beyond the scope of this commit. --- src/uu/timeout/Cargo.toml | 2 + src/uu/timeout/src/timeout.rs | 201 +++++++++++++++++++++------------- 2 files changed, 129 insertions(+), 74 deletions(-) diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index 51ac0bc0e..206a98c08 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -15,11 +15,13 @@ edition = "2018" path = "src/timeout.rs" [dependencies] +clap = "2.33" getopts = "0.2.18" libc = "0.2.42" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } + [[bin]] name = "timeout" path = "src/main.rs" diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index 0dd7c2016..3efd04c86 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -10,99 +10,152 @@ #[macro_use] extern crate uucore; +extern crate clap; + +use clap::{App, Arg, ArgMatches, AppSettings}; use std::io::ErrorKind; use std::process::{Command, Stdio}; use std::time::Duration; use uucore::process::ChildExt; +use uucore::signals::{Signal, signal_by_name_or_value}; + static NAME: &str = "timeout"; static VERSION: &str = env!("CARGO_PKG_VERSION"); const ERR_EXIT_STATUS: i32 = 125; +pub mod options { + pub static FOREGROUND: &str = "foreground"; + pub static KILL_AFTER: &str = "kill-after"; + pub static SIGNAL: &str = "signal"; + pub static VERSION: &str = "version"; + pub static PRESERVE_STATUS: &str = "preserve-status"; + + // Positional args. + pub static DURATION: &str = "duration"; + pub static COMMAND: &str = "command"; + pub static ARGS: &str = "args"; +} + +struct Config { + foreground: bool, + kill_after: Option, + signal: Option, + version: bool, + duration: Duration, + preserve_status: bool + + command: String, + command_args: &[String] +} + +impl Config { + fn from(options: Clap::ArgMatches) -> Config { + let timeout_signal = match options.value_of(options::SIGNAL) { + Some(signal_) => + { + let signal_result = signal_by_name_or_value(&signal_); + match signal_result{ + None => { + show_error!("invalid signal '{}'", signal_); + return ERR_EXIT_STATUS; + }, + _ => Some(signal_result) + } + }, + _ => None + }; + + let kill_after: Option = + match options.value_of(options::KILL_AFTER) { + Some(time) => Some(uucore::parse_time::from_str(&time)), + None => None + }; + + let duration: Duration = uucore::parse_time::from_str( + options.value_of(options::DURATION) + ); + + let preserve_status: bool = options.is_present(options::PRESERVE_STATUS); + + let command: String = options.value_of(options::COMMAND).to_str(); + let command_args: &[String] = options.values_of(options::ARGS) + .map(|x| x.as_str()); + + Config { + foreground: options.is_present(options::FOREGROUND), + kill_after, + signal: timeout_signal, + duration, + preserve_status, + command, + command_args + } + } +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); let program = args[0].clone(); let mut opts = getopts::Options::new(); - opts.optflag( - "", - "preserve-status", - "exit with the same status as COMMAND, even when the command times out", - ); - opts.optflag("", "foreground", "when not running timeout directly from a shell prompt, allow COMMAND to read from the TTY and get TTY signals; in this mode, children of COMMAND will not be timed out"); - opts.optopt("k", "kill-after", "also send a KILL signal if COMMAND is still running this long after the initial signal was sent", "DURATION"); - opts.optflag("s", "signal", "specify the signal to be sent on timeout; SIGNAL may be a name like 'HUP' or a number; see 'kill -l' for a list of signals"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(ERR_EXIT_STATUS, "{}", f), - }; - if matches.opt_present("help") { - print!( - "{} {} -Usage: - {} [OPTION] DURATION COMMAND [ARG]... + let mut app = App::new("timeout") + .version(VERSION) + .arg( + Arg::with_name(options::FOREGROUND) + .long(options::FOREGROUND) + .help("when not running timeout directly from a shell prompt, allow COMMAND to read from the TTY and get TTY signals; in this mode, children of COMMAND will not be timed out") + ) + .arg( + Arg::with_name(options::KILL_AFTER) + .short("k") + .takes_value(true)) + .arg( + Arg::with_name(options::PRESERVE_STATUS) + .long(options::PRESERVE_STATUS) + .help("exit with the same status as COMMAND, even when the command times out") + ) + .arg( + Arg::with_name(options::SIGNAL) + .short("s") + .long(options::SIGNAL) + .help("specify the signal to be sent on timeout; SIGNAL may be a name like 'HUP' or a number; see 'kill -l' for a list of signals") + .takes_value(true) + ) + .arg( + Arg::with_name(options::DURATION) + .index(1) + .required(true) + ) + .arg( + Arg::with_name(options::COMMAND) + .index(2) + .required(true) + ) + .arg( + Arg::with_name(options::ARGS).required(true).multiple(true) + ) + .setting(AppSettings::TrailingVarArg); -{}", - NAME, - VERSION, - program, - &opts.usage("Start COMMAND, and kill it if still running after DURATION.") - ); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else if matches.free.len() < 2 { - show_error!("missing an argument"); - show_error!("for help, try '{0} --help'", program); - return ERR_EXIT_STATUS; - } else { - let status = matches.opt_present("preserve-status"); - let foreground = matches.opt_present("foreground"); - let kill_after = match matches.opt_str("kill-after") { - Some(tstr) => match uucore::parse_time::from_str(&tstr) { - Ok(time) => time, - Err(f) => { - show_error!("{}", f); - return ERR_EXIT_STATUS; - } - }, - None => Duration::new(0, 0), - }; - let signal = match matches.opt_str("signal") { - Some(sigstr) => match uucore::signals::signal_by_name_or_value(&sigstr) { - Some(sig) => sig, - None => { - show_error!("invalid signal '{}'", sigstr); - return ERR_EXIT_STATUS; - } - }, - None => uucore::signals::signal_by_name_or_value("TERM").unwrap(), - }; - let duration = match uucore::parse_time::from_str(&matches.free[0]) { - Ok(time) => time, - Err(f) => { - show_error!("{}", f); - return ERR_EXIT_STATUS; - } - }; - return timeout( - &matches.free[1], - &matches.free[2..], - duration, - signal, - kill_after, - foreground, - status, - ); - } + let matches = app.get_matches_from(args); - 0 + let config = Config::from(matches); + timeout(config.command, + config.command_args, + config.duration, + config.signal, + config.kill_after, + config.foreground, + config.preserve_status + ) } +/// TODO: Improve exit codes, and make them consistent with the GNU Coreutil +/// exit codes. + fn timeout( cmdname: &str, args: &[String], @@ -126,10 +179,10 @@ fn timeout( Err(err) => { show_error!("failed to execute process: {}", err); if err.kind() == ErrorKind::NotFound { - // XXX: not sure which to use + // FIXME: not sure which to use return 127; } else { - // XXX: this may not be 100% correct... + // FIXME: this may not be 100% correct... return 126; } } From ea0ead6a2e8da6f76cb509c844467c956ca8a092 Mon Sep 17 00:00:00 2001 From: Ricardo Iglesias Date: Tue, 6 Apr 2021 22:16:52 -0700 Subject: [PATCH 0288/1135] Ran cargo lock update command. --- Cargo.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.lock b/Cargo.lock index f65ba3dff..d8aea5e08 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2416,6 +2416,7 @@ dependencies = [ name = "uu_timeout" version = "0.0.6" dependencies = [ + "clap", "getopts", "libc", "uucore", From 431a6ee1b5af6d901d41c29d10a56e0491ba91f7 Mon Sep 17 00:00:00 2001 From: Ricardo Iglesias Date: Tue, 6 Apr 2021 23:07:52 -0700 Subject: [PATCH 0289/1135] timeout: Fixed ownership issues Fixed some minor ownership issues in converting from the options to the arguments to the timeout COMMAND. Additionally, fixed a rustfmt issue in other files (fold/stdbuf.rs) --- src/uu/fold/src/fold.rs | 2 +- src/uu/stdbuf/src/stdbuf.rs | 3 +- src/uu/timeout/src/timeout.rs | 94 ++++++++++++++++++----------------- 3 files changed, 51 insertions(+), 48 deletions(-) diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index cfd3b74cf..c35e996f2 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -45,7 +45,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .short("b") .help( "count using bytes rather than columns (meaning control characters \ - such as newline are not treated specially)", + such as newline are not treated specially)", ) .takes_value(false), ) diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 67ed9a838..a61ba967b 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -80,7 +80,8 @@ fn print_version() { fn print_usage(opts: &Options) { let brief = "Run COMMAND, with modified buffering operations for its standard streams\n \ Mandatory arguments to long options are mandatory for short options too."; - let explanation = "If MODE is 'L' the corresponding stream will be line buffered.\n \ + let explanation = + "If MODE is 'L' the corresponding stream will be line buffered.\n \ This option is invalid with standard input.\n\n \ If MODE is '0' the corresponding stream will be unbuffered.\n\n \ Otherwise MODE is a number which may be followed by one of the following:\n\n \ diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index 3efd04c86..bd340a122 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -12,16 +12,19 @@ extern crate uucore; extern crate clap; -use clap::{App, Arg, ArgMatches, AppSettings}; +use clap::{App, AppSettings, Arg}; use std::io::ErrorKind; use std::process::{Command, Stdio}; use std::time::Duration; use uucore::process::ChildExt; -use uucore::signals::{Signal, signal_by_name_or_value}; +use uucore::signals::signal_by_name_or_value; - -static NAME: &str = "timeout"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Start COMMAND, and kill it if still running after DURATION."; + +fn get_usage() -> String { + format!("{0} [OPTION]... [FILE]...", executable!()) +} const ERR_EXIT_STATUS: i32 = 125; @@ -40,70 +43,68 @@ pub mod options { struct Config { foreground: bool, - kill_after: Option, - signal: Option, - version: bool, + kill_after: Duration, + signal: usize, duration: Duration, - preserve_status: bool + preserve_status: bool, command: String, - command_args: &[String] + command_args: Vec, } impl Config { - fn from(options: Clap::ArgMatches) -> Config { - let timeout_signal = match options.value_of(options::SIGNAL) { - Some(signal_) => - { + fn from(options: clap::ArgMatches) -> Config { + let signal = match options.value_of(options::SIGNAL) { + Some(signal_) => { let signal_result = signal_by_name_or_value(&signal_); - match signal_result{ + match signal_result { None => { - show_error!("invalid signal '{}'", signal_); - return ERR_EXIT_STATUS; - }, - _ => Some(signal_result) + unreachable!("invalid signal '{}'", signal_); + } + Some(signal_value) => signal_value, } - }, - _ => None + } + _ => uucore::signals::signal_by_name_or_value("TERM").unwrap(), }; - let kill_after: Option = - match options.value_of(options::KILL_AFTER) { - Some(time) => Some(uucore::parse_time::from_str(&time)), - None => None - }; + let kill_after: Duration = match options.value_of(options::KILL_AFTER) { + Some(time) => uucore::parse_time::from_str(&time).unwrap(), + None => Duration::new(0, 0), + }; - let duration: Duration = uucore::parse_time::from_str( - options.value_of(options::DURATION) - ); + let duration: Duration = + uucore::parse_time::from_str(options.value_of(options::DURATION).unwrap()).unwrap(); let preserve_status: bool = options.is_present(options::PRESERVE_STATUS); + let foreground = options.is_present(options::FOREGROUND); - let command: String = options.value_of(options::COMMAND).to_str(); - let command_args: &[String] = options.values_of(options::ARGS) - .map(|x| x.as_str()); + let command: String = options.value_of(options::COMMAND).unwrap().to_string(); + let command_args: Vec = options + .values_of(options::ARGS) + .unwrap() + .map(|x| x.to_owned()) + .collect(); Config { - foreground: options.is_present(options::FOREGROUND), + foreground, kill_after, - signal: timeout_signal, + signal, duration, preserve_status, command, - command_args + command_args, } } } pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); + let usage = get_usage(); - let program = args[0].clone(); - - let mut opts = getopts::Options::new(); - - let mut app = App::new("timeout") + let app = App::new("timeout") .version(VERSION) + .usage(&usage[..]) + .about(ABOUT) .arg( Arg::with_name(options::FOREGROUND) .long(options::FOREGROUND) @@ -143,13 +144,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = app.get_matches_from(args); let config = Config::from(matches); - timeout(config.command, - config.command_args, - config.duration, - config.signal, - config.kill_after, - config.foreground, - config.preserve_status + timeout( + &config.command, + &config.command_args, + config.duration, + config.signal, + config.kill_after, + config.foreground, + config.preserve_status, ) } From 8232c527a365050d91a6ee9d8931c0455d417474 Mon Sep 17 00:00:00 2001 From: Ricardo Iglesias Date: Tue, 6 Apr 2021 23:30:15 -0700 Subject: [PATCH 0290/1135] timeout: tests passing. Forgot to handle the case where no arguments were passed to the COMMAND. Because ARGS can be empty, we need two separate cases for handling options.values_of(options::ARGS) --- src/uu/timeout/src/timeout.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index bd340a122..23e2ec842 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -79,11 +79,11 @@ impl Config { let foreground = options.is_present(options::FOREGROUND); let command: String = options.value_of(options::COMMAND).unwrap().to_string(); - let command_args: Vec = options - .values_of(options::ARGS) - .unwrap() - .map(|x| x.to_owned()) - .collect(); + + let command_args: Vec = match options.values_of(options::ARGS) { + Some(values) => values.map(|x| x.to_owned()).collect(), + None => vec![], + }; Config { foreground, @@ -137,7 +137,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .required(true) ) .arg( - Arg::with_name(options::ARGS).required(true).multiple(true) + Arg::with_name(options::ARGS).multiple(true) ) .setting(AppSettings::TrailingVarArg); From 52706372aa23f3433a5fe05e226a2fb6d9f57c01 Mon Sep 17 00:00:00 2001 From: paulotten Date: Wed, 7 Apr 2021 02:41:04 -0400 Subject: [PATCH 0291/1135] Replace outdated time 0.1 dependancy with latest version of chrono (#2044) * Replace outdated time 0.1 dependancy with latest version of chrono I also noticed that times are being miscalculated on linux, so I fixed that. * Add time test for issue #2042 * Cleanup use declarations * Tie time test to `touch` feature - if we compile with the right OS feature flag then we should have it, even on Windows --- Cargo.lock | 2 +- src/uu/du/Cargo.toml | 2 +- src/uu/du/src/du.rs | 17 +++++++++-------- tests/by-util/test_du.rs | 18 ++++++++++++++++++ 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f65ba3dff..41a384ea4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1777,7 +1777,7 @@ dependencies = [ name = "uu_du" version = "0.0.6" dependencies = [ - "time", + "chrono", "uucore", "uucore_procs", "winapi 0.3.9", diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index eb7b23f8b..3ce9d8361 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/du.rs" [dependencies] -time = "0.1.40" +chrono = "0.4" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=[] } diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 9c8bb9794..615b66a4e 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -10,6 +10,8 @@ #[macro_use] extern crate uucore; +use chrono::prelude::DateTime; +use chrono::Local; use std::collections::HashSet; use std::env; use std::fs; @@ -22,7 +24,7 @@ use std::os::windows::fs::MetadataExt; #[cfg(windows)] use std::os::windows::io::AsRawHandle; use std::path::PathBuf; -use time::Timespec; +use std::time::{Duration, UNIX_EPOCH}; #[cfg(windows)] use winapi::shared::minwindef::{DWORD, LPVOID}; #[cfg(windows)] @@ -118,7 +120,7 @@ impl Stat { // https://doc.rust-lang.org/std/os/windows/fs/trait.MetadataExt.html#tymethod.creation_time // "The returned 64-bit value [...] which represents the number of 100-nanosecond intervals since January 1, 1601 (UTC)." fn windows_time_to_unix_time(win_time: u64) -> u64 { - win_time / 10_000 - 11_644_473_600_000 + win_time / 10_000_000 - 11_644_473_600 } #[cfg(windows)] @@ -555,8 +557,8 @@ Try '{} --help' for more information.", }; if matches.opt_present("time") { let tm = { - let (secs, nsecs) = { - let time = match matches.opt_str("time") { + let secs = { + match matches.opt_str("time") { Some(s) => match &s[..] { "accessed" => stat.accessed, "created" => stat.created, @@ -573,13 +575,12 @@ Try '{} --help' for more information.", } }, None => stat.modified, - }; - ((time / 1000) as i64, (time % 1000 * 1_000_000) as i32) + } }; - time::at(Timespec::new(secs, nsecs)) + DateTime::::from(UNIX_EPOCH + Duration::from_secs(secs)) }; if !summarize || index == len - 1 { - let time_str = tm.strftime(time_format_str).unwrap(); + let time_str = tm.format(time_format_str).to_string(); print!( "{}\t{}\t{}{}", convert_size(size), diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index b3b1b3465..30dcd9bb3 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -172,3 +172,21 @@ fn test_du_h_flag_empty_file() { assert_eq!(result.stderr, ""); assert_eq!(result.stdout, "0\tempty.txt\n"); } + +#[cfg(feature = "touch")] +#[test] +fn test_du_time() { + let ts = TestScenario::new("du"); + + let touch = ts.ccmd("touch").arg("-a").arg("-m").arg("-t").arg("201505150000").arg("date_test").run(); + assert!(touch.success); + + let result = ts.ucmd().arg("--time").arg("date_test").run(); + + // cleanup by removing test file + ts.cmd("rm").arg("date_test").run(); + + assert!(result.success); + assert_eq!(result.stderr, ""); + assert_eq!(result.stdout, "0\t2015-05-15 00:00\tdate_test\n"); +} From 2997413d6446ab2c414496ad39bc6e9a8d757be1 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 7 Apr 2021 11:48:01 +0200 Subject: [PATCH 0292/1135] ls: refactor tests --- tests/by-util/test_ls.rs | 722 ++++++++++++++++++--------------------- 1 file changed, 324 insertions(+), 398 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 64f8f57bf..f0db7ca9c 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -43,26 +43,22 @@ fn test_ls_a() { let at = &scene.fixtures; at.touch(".test-1"); - let result = scene.ucmd().run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - assert!(!result.stdout.contains(".test-1")); - assert!(!result.stdout.contains("..")); + let result = scene.ucmd().succeeds(); + let stdout = result.stdout_str(); + assert!(!stdout.contains(".test-1")); + assert!(!stdout.contains("..")); - let result = scene.ucmd().arg("-a").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - assert!(result.stdout.contains(".test-1")); - assert!(result.stdout.contains("..")); + scene + .ucmd() + .arg("-a") + .succeeds() + .stdout_contains(&".test-1") + .stdout_contains(&".."); - let result = scene.ucmd().arg("-A").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - assert!(result.stdout.contains(".test-1")); - assert!(!result.stdout.contains("..")); + let result = scene.ucmd().arg("-A").succeeds(); + result.stdout_contains(".test-1"); + let stdout = result.stdout_str(); + assert!(!stdout.contains("..")); } #[test] @@ -75,29 +71,19 @@ fn test_ls_width() { at.touch(&at.plus_as_string("test-width-4")); for option in &["-w 100", "-w=100", "--width=100", "--width 100"] { - let result = scene + scene .ucmd() .args(&option.split(" ").collect::>()) - .run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert_eq!( - result.stdout, - "test-width-1 test-width-2 test-width-3 test-width-4\n", - ) + .succeeds() + .stdout_only("test-width-1 test-width-2 test-width-3 test-width-4\n"); } for option in &["-w 50", "-w=50", "--width=50", "--width 50"] { - let result = scene + scene .ucmd() .args(&option.split(" ").collect::>()) - .run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert_eq!( - result.stdout, - "test-width-1 test-width-3\ntest-width-2 test-width-4\n", - ) + .succeeds() + .stdout_only("test-width-1 test-width-3\ntest-width-2 test-width-4\n"); } for option in &[ @@ -110,16 +96,11 @@ fn test_ls_width() { "--width=0", "--width 0", ] { - let result = scene + scene .ucmd() .args(&option.split(" ").collect::>()) - .run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert_eq!( - result.stdout, - "test-width-1\ntest-width-2\ntest-width-3\ntest-width-4\n", - ) + .succeeds() + .stdout_only("test-width-1\ntest-width-2\ntest-width-3\ntest-width-4\n"); } } @@ -133,48 +114,28 @@ fn test_ls_columns() { at.touch(&at.plus_as_string("test-columns-4")); // Columns is the default - let result = scene.ucmd().run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); + let result = scene.ucmd().succeeds(); #[cfg(not(windows))] - assert_eq!( - result.stdout, - "test-columns-1\ntest-columns-2\ntest-columns-3\ntest-columns-4\n" - ); + result.stdout_only("test-columns-1\ntest-columns-2\ntest-columns-3\ntest-columns-4\n"); #[cfg(windows)] - assert_eq!( - result.stdout, - "test-columns-1 test-columns-2 test-columns-3 test-columns-4\n" - ); + result.stdout_only("test-columns-1 test-columns-2 test-columns-3 test-columns-4\n"); for option in &["-C", "--format=columns"] { - let result = scene.ucmd().arg(option).run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); + let result = scene.ucmd().arg(option).succeeds(); #[cfg(not(windows))] - assert_eq!( - result.stdout, - "test-columns-1\ntest-columns-2\ntest-columns-3\ntest-columns-4\n" - ); + result.stdout_only("test-columns-1\ntest-columns-2\ntest-columns-3\ntest-columns-4\n"); #[cfg(windows)] - assert_eq!( - result.stdout, - "test-columns-1 test-columns-2 test-columns-3 test-columns-4\n" - ); + result.stdout_only("test-columns-1 test-columns-2 test-columns-3 test-columns-4\n"); } for option in &["-C", "--format=columns"] { - let result = scene.ucmd().arg("-w=40").arg(option).run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - assert_eq!( - result.stdout, - "test-columns-1 test-columns-3\ntest-columns-2 test-columns-4\n" - ); + scene + .ucmd() + .arg("-w=40") + .arg(option) + .succeeds() + .stdout_only("test-columns-1 test-columns-3\ntest-columns-2 test-columns-4\n"); } } @@ -191,31 +152,22 @@ fn test_ls_across() { let result = scene.ucmd().arg(option).succeeds(); // Because the test terminal has width 0, this is the same output as // the columns option. - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); if cfg!(unix) { - assert_eq!( - result.stdout, - "test-across-1\ntest-across-2\ntest-across-3\ntest-across-4\n" - ); + result.stdout_only("test-across-1\ntest-across-2\ntest-across-3\ntest-across-4\n"); } else { - assert_eq!( - result.stdout, - "test-across-1 test-across-2 test-across-3 test-across-4\n" - ); + result.stdout_only("test-across-1 test-across-2 test-across-3 test-across-4\n"); } } for option in &["-x", "--format=across"] { - let result = scene.ucmd().arg("-w=30").arg(option).run(); // Because the test terminal has width 0, this is the same output as // the columns option. - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert_eq!( - result.stdout, - "test-across-1 test-across-2\ntest-across-3 test-across-4\n" - ); + scene + .ucmd() + .arg("-w=30") + .arg(option) + .succeeds() + .stdout_only("test-across-1 test-across-2\ntest-across-3 test-across-4\n"); } } @@ -231,31 +183,27 @@ fn test_ls_commas() { for option in &["-m", "--format=commas"] { let result = scene.ucmd().arg(option).succeeds(); if cfg!(unix) { - assert_eq!( - result.stdout, - "test-commas-1,\ntest-commas-2,\ntest-commas-3,\ntest-commas-4\n" - ); + result.stdout_only("test-commas-1,\ntest-commas-2,\ntest-commas-3,\ntest-commas-4\n"); } else { - assert_eq!( - result.stdout, - "test-commas-1, test-commas-2, test-commas-3, test-commas-4\n" - ); + result.stdout_only("test-commas-1, test-commas-2, test-commas-3, test-commas-4\n"); } } for option in &["-m", "--format=commas"] { - let result = scene.ucmd().arg("-w=30").arg(option).succeeds(); - assert_eq!( - result.stdout, - "test-commas-1, test-commas-2,\ntest-commas-3, test-commas-4\n" - ); + scene + .ucmd() + .arg("-w=30") + .arg(option) + .succeeds() + .stdout_only("test-commas-1, test-commas-2,\ntest-commas-3, test-commas-4\n"); } for option in &["-m", "--format=commas"] { - let result = scene.ucmd().arg("-w=45").arg(option).succeeds(); - assert_eq!( - result.stdout, - "test-commas-1, test-commas-2, test-commas-3,\ntest-commas-4\n" - ); + scene + .ucmd() + .arg("-w=45") + .arg(option) + .succeeds() + .stdout_only("test-commas-1, test-commas-2, test-commas-3,\ntest-commas-4\n"); } } @@ -279,13 +227,11 @@ fn test_ls_long() { for arg in &["-l", "--long", "--format=long", "--format=verbose"] { let result = scene.ucmd().arg(arg).arg("test-long").succeeds(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); #[cfg(not(windows))] - assert!(result.stdout.contains("-rw-rw-r--")); + result.stdout_contains("-rw-rw-r--"); #[cfg(windows)] - assert!(result.stdout.contains("---------- 1 somebody somegroup")); + result.stdout_contains("---------- 1 somebody somegroup"); } #[cfg(not(windows))] @@ -331,20 +277,16 @@ fn test_ls_long_formats() { .arg("-l") .arg("--author") .arg("test-long-formats") - .run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(re_three.is_match(&result.stdout)); + .succeeds(); + assert!(re_three.is_match(result.stdout_str())); let result = scene .ucmd() .arg("-l1") .arg("--author") .arg("test-long-formats") - .run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(re_three.is_match(&result.stdout)); + .succeeds(); + assert!(re_three.is_match(&result.stdout_str())); #[cfg(unix)] { @@ -354,9 +296,7 @@ fn test_ls_long_formats() { .arg("--author") .arg("test-long-formats") .succeeds(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(re_three_num.is_match(&result.stdout)); + assert!(re_three_num.is_match(result.stdout_str())); } for arg in &[ @@ -371,9 +311,7 @@ fn test_ls_long_formats() { .args(&arg.split(" ").collect::>()) .arg("test-long-formats") .succeeds(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(re_two.is_match(&result.stdout)); + assert!(re_two.is_match(result.stdout_str())); #[cfg(unix)] { @@ -383,9 +321,7 @@ fn test_ls_long_formats() { .args(&arg.split(" ").collect::>()) .arg("test-long-formats") .succeeds(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(re_two_num.is_match(&result.stdout)); + assert!(re_two_num.is_match(result.stdout_str())); } } @@ -404,9 +340,7 @@ fn test_ls_long_formats() { .args(&arg.split(" ").collect::>()) .arg("test-long-formats") .succeeds(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(re_one.is_match(&result.stdout)); + assert!(re_one.is_match(result.stdout_str())); #[cfg(unix)] { @@ -416,9 +350,7 @@ fn test_ls_long_formats() { .args(&arg.split(" ").collect::>()) .arg("test-long-formats") .succeeds(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(re_one_num.is_match(&result.stdout)); + assert!(re_one_num.is_match(result.stdout_str())); } } @@ -440,9 +372,7 @@ fn test_ls_long_formats() { .args(&arg.split(" ").collect::>()) .arg("test-long-formats") .succeeds(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(re_zero.is_match(&result.stdout)); + assert!(re_zero.is_match(result.stdout_str())); #[cfg(unix)] { @@ -452,9 +382,7 @@ fn test_ls_long_formats() { .args(&arg.split(" ").collect::>()) .arg("test-long-formats") .succeeds(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(re_zero.is_match(&result.stdout)); + assert!(re_zero.is_match(result.stdout_str())); } } } @@ -469,11 +397,11 @@ fn test_ls_oneline() { // Bit of a weird situation: in the tests oneline and columns have the same output, // except on Windows. for option in &["-1", "--format=single-column"] { - let result = scene.ucmd().arg(option).run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - assert_eq!(result.stdout, "test-oneline-1\ntest-oneline-2\n"); + scene + .ucmd() + .arg(option) + .succeeds() + .stdout_only("test-oneline-1\ntest-oneline-2\n"); } } @@ -494,11 +422,8 @@ fn test_ls_deref() { .arg("--color=never") .arg("test-long") .arg("test-long.link") - .run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - assert!(re.is_match(&result.stdout.trim())); + .succeeds(); + assert!(re.is_match(result.stdout_str().trim())); let result = scene .ucmd() @@ -506,11 +431,8 @@ fn test_ls_deref() { .arg("--color=never") .arg("test-long") .arg("test-long.link") - .run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - assert!(!re.is_match(&result.stdout.trim())); + .succeeds(); + assert!(!re.is_match(result.stdout_str().trim())); } #[test] @@ -528,28 +450,19 @@ fn test_ls_order_size() { at.touch("test-4"); at.append("test-4", "4444"); - let result = scene.ucmd().arg("-al").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); + scene.ucmd().arg("-al").succeeds(); - let result = scene.ucmd().arg("-S").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); + let result = scene.ucmd().arg("-S").succeeds(); #[cfg(not(windows))] - assert_eq!(result.stdout, "test-4\ntest-3\ntest-2\ntest-1\n"); + result.stdout_only("test-4\ntest-3\ntest-2\ntest-1\n"); #[cfg(windows)] - assert_eq!(result.stdout, "test-4 test-3 test-2 test-1\n"); + result.stdout_only("test-4 test-3 test-2 test-1\n"); - let result = scene.ucmd().arg("-S").arg("-r").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); + let result = scene.ucmd().arg("-S").arg("-r").succeeds(); #[cfg(not(windows))] - assert_eq!(result.stdout, "test-1\ntest-2\ntest-3\ntest-4\n"); + result.stdout_only("test-1\ntest-2\ntest-3\ntest-4\n"); #[cfg(windows)] - assert_eq!(result.stdout, "test-1 test-2 test-3 test-4\n"); + result.stdout_only("test-1 test-2 test-3 test-4\n"); } #[test] @@ -562,9 +475,9 @@ fn test_ls_long_ctime() { // Should show the time on Unix, but question marks on windows. #[cfg(unix)] - assert!(result.stdout.contains(":")); + result.stdout_contains(":"); #[cfg(not(unix))] - assert!(result.stdout.contains("???")); + result.stdout_contains("???"); } #[test] @@ -596,51 +509,41 @@ fn test_ls_order_time() { ) .unwrap(); - let result = scene.ucmd().arg("-al").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); + scene.ucmd().arg("-al").succeeds(); // ctime was changed at write, so the order is 4 3 2 1 - let result = scene.ucmd().arg("-t").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); + let result = scene.ucmd().arg("-t").succeeds(); #[cfg(not(windows))] - assert_eq!(result.stdout, "test-4\ntest-3\ntest-2\ntest-1\n"); + result.stdout_only("test-4\ntest-3\ntest-2\ntest-1\n"); #[cfg(windows)] - assert_eq!(result.stdout, "test-4 test-3 test-2 test-1\n"); + result.stdout_only("test-4 test-3 test-2 test-1\n"); - let result = scene.ucmd().arg("-tr").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); + let result = scene.ucmd().arg("-tr").succeeds(); #[cfg(not(windows))] - assert_eq!(result.stdout, "test-1\ntest-2\ntest-3\ntest-4\n"); + result.stdout_only("test-1\ntest-2\ntest-3\ntest-4\n"); #[cfg(windows)] - assert_eq!(result.stdout, "test-1 test-2 test-3 test-4\n"); + result.stdout_only("test-1 test-2 test-3 test-4\n"); // 3 was accessed last in the read // So the order should be 2 3 4 1 - let result = scene.ucmd().arg("-tu").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); + let result = scene.ucmd().arg("-tu").succeeds(); let file3_access = at.open("test-3").metadata().unwrap().accessed().unwrap(); let file4_access = at.open("test-4").metadata().unwrap().accessed().unwrap(); + + // It seems to be dependent on the platform whether the access time is actually set if file3_access > file4_access { if cfg!(not(windows)) { - assert_eq!(result.stdout, "test-3\ntest-4\ntest-2\ntest-1\n"); + result.stdout_only("test-3\ntest-4\ntest-2\ntest-1\n"); } else { - assert_eq!(result.stdout, "test-3 test-4 test-2 test-1\n"); + result.stdout_only("test-3 test-4 test-2 test-1\n"); } } else { // Access time does not seem to be set on Windows and some other // systems so the order is 4 3 2 1 if cfg!(not(windows)) { - assert_eq!(result.stdout, "test-4\ntest-3\ntest-2\ntest-1\n"); + result.stdout_only("test-4\ntest-3\ntest-2\ntest-1\n"); } else { - assert_eq!(result.stdout, "test-4 test-3 test-2 test-1\n"); + result.stdout_only("test-4 test-3 test-2 test-1\n"); } } @@ -648,11 +551,8 @@ fn test_ls_order_time() { // So the order should be 2 4 3 1 #[cfg(unix)] { - let result = scene.ucmd().arg("-tc").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - assert_eq!(result.stdout, "test-2\ntest-4\ntest-3\ntest-1\n"); + let result = scene.ucmd().arg("-tc").succeeds(); + result.stdout_only("test-2\ntest-4\ntest-3\ntest-1\n"); } } @@ -676,18 +576,21 @@ fn test_ls_files_dirs() { scene.ucmd().arg("a/a").succeeds(); scene.ucmd().arg("a").arg("z").succeeds(); - let result = scene.ucmd().arg("doesntexist").fails(); // Doesn't exist - assert!(result - .stderr - .contains("error: 'doesntexist': No such file or directory")); + scene + .ucmd() + .arg("doesntexist") + .fails() + .stderr_contains(&"error: 'doesntexist': No such file or directory"); - let result = scene.ucmd().arg("a").arg("doesntexist").fails(); // One exists, the other doesn't - assert!(result - .stderr - .contains("error: 'doesntexist': No such file or directory")); - assert!(result.stdout.contains("a:")); + scene + .ucmd() + .arg("a") + .arg("doesntexist") + .fails() + .stderr_contains(&"error: 'doesntexist': No such file or directory") + .stdout_contains(&"a:"); } #[test] @@ -711,13 +614,10 @@ fn test_ls_recursive() { .arg("z") .succeeds(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); #[cfg(not(windows))] - assert!(result.stdout.contains("a/b:\nb")); + result.stdout_contains(&"a/b:\nb"); #[cfg(windows)] - assert!(result.stdout.contains("a\\b:\nb")); + result.stdout_contains(&"a\\b:\nb"); } #[cfg(unix)] @@ -737,41 +637,53 @@ fn test_ls_ls_color() { // Color is disabled by default let result = scene.ucmd().succeeds(); - assert!(!result.stdout.contains(a_with_colors)); - assert!(!result.stdout.contains(z_with_colors)); + assert!(!result.stdout_str().contains(a_with_colors)); + assert!(!result.stdout_str().contains(z_with_colors)); // Color should be enabled - let result = scene.ucmd().arg("--color").succeeds(); - assert!(result.stdout.contains(a_with_colors)); - assert!(result.stdout.contains(z_with_colors)); + scene + .ucmd() + .arg("--color") + .succeeds() + .stdout_contains(a_with_colors) + .stdout_contains(z_with_colors); // Color should be enabled - let result = scene.ucmd().arg("--color=always").succeeds(); - assert!(result.stdout.contains(a_with_colors)); - assert!(result.stdout.contains(z_with_colors)); + scene + .ucmd() + .arg("--color=always") + .succeeds() + .stdout_contains(a_with_colors) + .stdout_contains(z_with_colors); // Color should be disabled let result = scene.ucmd().arg("--color=never").succeeds(); - assert!(!result.stdout.contains(a_with_colors)); - assert!(!result.stdout.contains(z_with_colors)); + assert!(!result.stdout_str().contains(a_with_colors)); + assert!(!result.stdout_str().contains(z_with_colors)); // Nested dir should be shown and colored - let result = scene.ucmd().arg("--color").arg("a").succeeds(); - assert!(result.stdout.contains(nested_dir_with_colors)); + scene + .ucmd() + .arg("--color") + .arg("a") + .succeeds() + .stdout_contains(nested_dir_with_colors); // Color has no effect - let result = scene + scene .ucmd() .arg("--color=always") .arg("a/nested_file") - .succeeds(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.stdout.contains("a/nested_file\n")); + .succeeds() + .stdout_contains("a/nested_file\n"); // No output - let result = scene.ucmd().arg("--color=never").arg("z").succeeds(); - assert_eq!(result.stdout, ""); + scene + .ucmd() + .arg("--color=never") + .arg("z") + .succeeds() + .stdout_only(""); } #[cfg(unix)] @@ -786,39 +698,31 @@ fn test_ls_inode() { let re_short = Regex::new(r" *(\d+) test_inode").unwrap(); let re_long = Regex::new(r" *(\d+) [xrw-]{10} \d .+ test_inode").unwrap(); - let result = scene.ucmd().arg("test_inode").arg("-i").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(re_short.is_match(&result.stdout)); + let result = scene.ucmd().arg("test_inode").arg("-i").succeeds(); + assert!(re_short.is_match(result.stdout_str())); let inode_short = re_short - .captures(&result.stdout) + .captures(result.stdout_str()) .unwrap() .get(1) .unwrap() .as_str(); - let result = scene.ucmd().arg("test_inode").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(!re_short.is_match(&result.stdout)); - assert!(!result.stdout.contains(inode_short)); + let result = scene.ucmd().arg("test_inode").succeeds(); + assert!(!re_short.is_match(result.stdout_str())); + assert!(!result.stdout_str().contains(inode_short)); - let result = scene.ucmd().arg("-li").arg("test_inode").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(re_long.is_match(&result.stdout)); + let result = scene.ucmd().arg("-li").arg("test_inode").succeeds(); + assert!(re_long.is_match(result.stdout_str())); let inode_long = re_long - .captures(&result.stdout) + .captures(result.stdout_str()) .unwrap() .get(1) .unwrap() .as_str(); - let result = scene.ucmd().arg("-l").arg("test_inode").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(!re_long.is_match(&result.stdout)); - assert!(!result.stdout.contains(inode_long)); + let result = scene.ucmd().arg("-l").arg("test_inode").succeeds(); + assert!(!re_long.is_match(result.stdout_str())); + assert!(!result.stdout_str().contains(inode_long)); assert_eq!(inode_short, inode_long) } @@ -844,27 +748,33 @@ fn test_ls_indicator_style() { let options = vec!["classify", "file-type", "slash"]; for opt in options { // Verify that classify and file-type both contain indicators for symlinks. - let result = scene.ucmd().arg(format!("--indicator-style={}", opt)).run(); - println!("stdout = {:?}", result.stdout); - assert!(result.stdout.contains("/")); + scene + .ucmd() + .arg(format!("--indicator-style={}", opt)) + .succeeds() + .stdout_contains(&"/"); } // Same test as above, but with the alternate flags. let options = vec!["--classify", "--file-type", "-p"]; for opt in options { - let result = scene.ucmd().arg(format!("{}", opt)).run(); - println!("stdout = {:?}", result.stdout); - assert!(result.stdout.contains("/")); + scene + .ucmd() + .arg(format!("{}", opt)) + .succeeds() + .stdout_contains(&"/"); } // Classify and File-Type all contain indicators for pipes and links. let options = vec!["classify", "file-type"]; for opt in options { // Verify that classify and file-type both contain indicators for symlinks. - let result = scene.ucmd().arg(format!("--indicator-style={}", opt)).run(); - println!("stdout = {}", result.stdout); - assert!(result.stdout.contains("@")); - assert!(result.stdout.contains("|")); + scene + .ucmd() + .arg(format!("--indicator-style={}", opt)) + .succeeds() + .stdout_contains(&"@") + .stdout_contains(&"|"); } // Test sockets. Because the canonical way of making sockets to test is with @@ -906,26 +816,32 @@ fn test_ls_indicator_style() { let options = vec!["classify", "file-type", "slash"]; for opt in options { // Verify that classify and file-type both contain indicators for symlinks. - let result = scene.ucmd().arg(format!("--indicator-style={}", opt)).run(); - println!("stdout = {:?}", result.stdout); - assert!(result.stdout.contains("/")); + let result = scene + .ucmd() + .arg(format!("--indicator-style={}", opt)) + .succeeds() + .stdout_contains(&"/"); } // Same test as above, but with the alternate flags. let options = vec!["--classify", "--file-type", "-p"]; for opt in options { - let result = scene.ucmd().arg(format!("{}", opt)).run(); - println!("stdout = {:?}", result.stdout); - assert!(result.stdout.contains("/")); + let result = scene + .ucmd() + .arg(format!("{}", opt)) + .succeeds() + .stdout_contains(&"/"); } // Classify and File-Type all contain indicators for pipes and links. let options = vec!["classify", "file-type"]; for opt in options { // Verify that classify and file-type both contain indicators for symlinks. - let result = scene.ucmd().arg(format!("--indicator-style={}", opt)).run(); - println!("stdout = {}", result.stdout); - assert!(result.stdout.contains("@")); + let result = scene + .ucmd() + .arg(format!("--indicator-style={}", opt)) + .succeeds() + .stdout_contains(&"@"); } } @@ -934,26 +850,27 @@ fn test_ls_indicator_style() { fn test_ls_human_si() { let scene = TestScenario::new(util_name!()); let file1 = "test_human-1"; - let result = scene + scene .cmd("truncate") .arg("-s") .arg("+1000") .arg(file1) - .run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); + .succeeds(); - let result = scene.ucmd().arg("-hl").arg(file1).run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - assert!(result.stdout.contains(" 1000 ")); + scene + .ucmd() + .arg("-hl") + .arg(file1) + .succeeds() + .stdout_contains(" 1000 "); - let result = scene.ucmd().arg("-l").arg("--si").arg(file1).run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - assert!(result.stdout.contains(" 1.0k ")); + scene + .ucmd() + .arg("-l") + .arg("--si") + .arg(file1) + .succeeds() + .stdout_contains(" 1.0k "); scene .cmd("truncate") @@ -962,63 +879,68 @@ fn test_ls_human_si() { .arg(file1) .run(); - let result = scene.ucmd().arg("-hl").arg(file1).run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - assert!(result.stdout.contains(" 1001K ")); + scene + .ucmd() + .arg("-hl") + .arg(file1) + .succeeds() + .stdout_contains(" 1001K "); - let result = scene.ucmd().arg("-l").arg("--si").arg(file1).run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - assert!(result.stdout.contains(" 1.1M ")); + scene + .ucmd() + .arg("-l") + .arg("--si") + .arg(file1) + .succeeds() + .stdout_contains(" 1.1M "); let file2 = "test-human-2"; - let result = scene + scene .cmd("truncate") .arg("-s") .arg("+12300k") .arg(file2) - .run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - let result = scene.ucmd().arg("-hl").arg(file2).run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - // GNU rounds up, so we must too. - assert!(result.stdout.contains(" 13M ")); + .succeeds(); - let result = scene.ucmd().arg("-l").arg("--si").arg(file2).run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); // GNU rounds up, so we must too. - assert!(result.stdout.contains(" 13M ")); + scene + .ucmd() + .arg("-hl") + .arg(file2) + .succeeds() + .stdout_contains(" 13M "); + + // GNU rounds up, so we must too. + scene + .ucmd() + .arg("-l") + .arg("--si") + .arg(file2) + .succeeds() + .stdout_contains(" 13M "); let file3 = "test-human-3"; - let result = scene + scene .cmd("truncate") .arg("-s") .arg("+9999") .arg(file3) - .run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); + .succeeds(); - let result = scene.ucmd().arg("-hl").arg(file3).run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - assert!(result.stdout.contains(" 9.8K ")); + scene + .ucmd() + .arg("-hl") + .arg(file3) + .succeeds() + .stdout_contains(" 9.8K "); - let result = scene.ucmd().arg("-l").arg("--si").arg(file3).run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - assert!(result.stdout.contains(" 10k ")); + scene + .ucmd() + .arg("-l") + .arg("--si") + .arg(file3) + .succeeds() + .stdout_contains(" 10k "); } #[cfg(windows)] @@ -1035,16 +957,11 @@ fn test_ls_hidden_windows() { .arg("+S") .arg("+r") .arg(file) - .run(); - let result = scene.ucmd().run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - let result = scene.ucmd().arg("-a").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert!(result.success); - assert!(result.stdout.contains(file)); + .succeeds(); + + let result = scene.ucmd().succeeds(); + assert!(!result.stdout_str().contains(file)); + let result = scene.ucmd().arg("-a").succeeds().stdout_contains(file); } #[test] @@ -1104,25 +1021,25 @@ fn test_ls_version_sort() { "", // because of '\n' at the end of the output ]; - let result = scene.ucmd().arg("-1v").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); + let result = scene.ucmd().arg("-1v").succeeds(); + assert_eq!( + result.stdout_str().split('\n').collect::>(), + expected + ); - assert_eq!(result.stdout.split('\n').collect::>(), expected); - - let result = scene.ucmd().arg("-1").arg("--sort=version").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - - assert_eq!(result.stdout.split('\n').collect::>(), expected); - - let result = scene.ucmd().arg("-a1v").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); + let result = scene.ucmd().arg("-1").arg("--sort=version").succeeds(); + assert_eq!( + result.stdout_str().split('\n').collect::>(), + expected + ); + let result = scene.ucmd().arg("-a1v").succeeds(); expected.insert(0, ".."); expected.insert(0, "."); - assert_eq!(result.stdout.split('\n').collect::>(), expected,) + assert_eq!( + result.stdout_str().split('\n').collect::>(), + expected, + ) } #[test] @@ -1138,8 +1055,11 @@ fn test_ls_quoting_style() { { at.touch("one\ntwo"); // Default is shell-escape - let result = scene.ucmd().arg("one\ntwo").succeeds(); - assert_eq!(result.stdout, "'one'$'\\n''two'\n"); + scene + .ucmd() + .arg("one\ntwo") + .succeeds() + .stdout_only("'one'$'\\n''two'\n"); for (arg, correct) in &[ ("--quoting-style=literal", "one?two"), @@ -1156,10 +1076,12 @@ fn test_ls_quoting_style() { ("--quoting-style=shell", "one?two"), ("--quoting-style=shell-always", "'one?two'"), ] { - let result = scene.ucmd().arg(arg).arg("one\ntwo").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert_eq!(result.stdout, format!("{}\n", correct)); + scene + .ucmd() + .arg(arg) + .arg("one\ntwo") + .succeeds() + .stdout_only(format!("{}\n", correct)); } for (arg, correct) in &[ @@ -1169,15 +1091,13 @@ fn test_ls_quoting_style() { ("--quoting-style=shell", "one?two"), ("--quoting-style=shell-always", "'one?two'"), ] { - let result = scene + scene .ucmd() .arg(arg) .arg("--hide-control-chars") .arg("one\ntwo") - .run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert_eq!(result.stdout, format!("{}\n", correct)); + .succeeds() + .stdout_only(format!("{}\n", correct)); } for (arg, correct) in &[ @@ -1187,20 +1107,21 @@ fn test_ls_quoting_style() { ("--quoting-style=shell", "one\ntwo"), ("--quoting-style=shell-always", "'one\ntwo'"), ] { - let result = scene + scene .ucmd() .arg(arg) .arg("--show-control-chars") .arg("one\ntwo") - .run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert_eq!(result.stdout, format!("{}\n", correct)); + .succeeds() + .stdout_only(format!("{}\n", correct)); } } - let result = scene.ucmd().arg("one two").succeeds(); - assert_eq!(result.stdout, "'one two'\n"); + scene + .ucmd() + .arg("one two") + .succeeds() + .stdout_only("'one two'\n"); for (arg, correct) in &[ ("--quoting-style=literal", "one two"), @@ -1217,14 +1138,15 @@ fn test_ls_quoting_style() { ("--quoting-style=shell", "'one two'"), ("--quoting-style=shell-always", "'one two'"), ] { - let result = scene.ucmd().arg(arg).arg("one two").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert_eq!(result.stdout, format!("{}\n", correct)); + scene + .ucmd() + .arg(arg) + .arg("one two") + .succeeds() + .stdout_only(format!("{}\n", correct)); } - let result = scene.ucmd().arg("one").succeeds(); - assert_eq!(result.stdout, "one\n"); + scene.ucmd().arg("one").succeeds().stdout_only("one\n"); for (arg, correct) in &[ ("--quoting-style=literal", "one"), @@ -1239,10 +1161,12 @@ fn test_ls_quoting_style() { ("--quoting-style=shell", "one"), ("--quoting-style=shell-always", "'one'"), ] { - let result = scene.ucmd().arg(arg).arg("one").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert_eq!(result.stdout, format!("{}\n", correct)); + scene + .ucmd() + .arg(arg) + .arg("one") + .succeeds() + .stdout_only(format!("{}\n", correct)); } } @@ -1262,7 +1186,7 @@ fn test_ls_ignore_hide() { .arg("*") .arg("-1") .succeeds() - .stdout_is(""); + .stdout_only(""); scene .ucmd() @@ -1270,7 +1194,7 @@ fn test_ls_ignore_hide() { .arg("*") .arg("-1") .succeeds() - .stdout_is(""); + .stdout_only(""); scene .ucmd() @@ -1278,7 +1202,7 @@ fn test_ls_ignore_hide() { .arg("irrelevant pattern") .arg("-1") .succeeds() - .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); + .stdout_only("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); scene .ucmd() @@ -1286,7 +1210,7 @@ fn test_ls_ignore_hide() { .arg("README*.md") .arg("-1") .succeeds() - .stdout_is("CONTRIBUTING.md\nsome_other_file\n"); + .stdout_only("CONTRIBUTING.md\nsome_other_file\n"); scene .ucmd() @@ -1294,7 +1218,7 @@ fn test_ls_ignore_hide() { .arg("README*.md") .arg("-1") .succeeds() - .stdout_is("CONTRIBUTING.md\nsome_other_file\n"); + .stdout_only("CONTRIBUTING.md\nsome_other_file\n"); scene .ucmd() @@ -1302,7 +1226,7 @@ fn test_ls_ignore_hide() { .arg("*.md") .arg("-1") .succeeds() - .stdout_is("some_other_file\n"); + .stdout_only("some_other_file\n"); scene .ucmd() @@ -1311,7 +1235,7 @@ fn test_ls_ignore_hide() { .arg("*.md") .arg("-1") .succeeds() - .stdout_is(".\n..\nsome_other_file\n"); + .stdout_only(".\n..\nsome_other_file\n"); scene .ucmd() @@ -1320,7 +1244,7 @@ fn test_ls_ignore_hide() { .arg("*.md") .arg("-1") .succeeds() - .stdout_is(".\n..\nCONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); + .stdout_only(".\n..\nCONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); scene .ucmd() @@ -1329,7 +1253,7 @@ fn test_ls_ignore_hide() { .arg("*.md") .arg("-1") .succeeds() - .stdout_is("some_other_file\n"); + .stdout_only("some_other_file\n"); scene .ucmd() @@ -1338,7 +1262,7 @@ fn test_ls_ignore_hide() { .arg("*.md") .arg("-1") .succeeds() - .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); + .stdout_only("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); // Stacking multiple patterns scene @@ -1349,7 +1273,7 @@ fn test_ls_ignore_hide() { .arg("CONTRIBUTING*") .arg("-1") .succeeds() - .stdout_is("some_other_file\n"); + .stdout_only("some_other_file\n"); scene .ucmd() @@ -1359,7 +1283,7 @@ fn test_ls_ignore_hide() { .arg("CONTRIBUTING*") .arg("-1") .succeeds() - .stdout_is("some_other_file\n"); + .stdout_only("some_other_file\n"); scene .ucmd() @@ -1369,7 +1293,7 @@ fn test_ls_ignore_hide() { .arg("CONTRIBUTING*") .arg("-1") .succeeds() - .stdout_is("some_other_file\n"); + .stdout_only("some_other_file\n"); // Invalid patterns scene @@ -1378,7 +1302,8 @@ fn test_ls_ignore_hide() { .arg("READ[ME") .arg("-1") .succeeds() - .stderr_contains(&"Invalid pattern"); + .stderr_contains(&"Invalid pattern") + .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); scene .ucmd() @@ -1386,5 +1311,6 @@ fn test_ls_ignore_hide() { .arg("READ[ME") .arg("-1") .succeeds() - .stderr_contains(&"Invalid pattern"); + .stderr_contains(&"Invalid pattern") + .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); } From c65483f4bedc76160ce9aa009662199d45d12d0a Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 7 Apr 2021 11:48:21 +0200 Subject: [PATCH 0293/1135] tests: improve docstrings a bit --- tests/common/util.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/common/util.rs b/tests/common/util.rs index 708b8dbba..8a09b71c1 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -165,8 +165,8 @@ impl CmdResult { /// asserts that the command resulted in empty (zero-length) stderr stream output /// generally, it's better to use stdout_only() instead, /// but you might find yourself using this function if - /// 1. you can not know exactly what stdout will be - /// or 2. you know that stdout will also be empty + /// 1. you can not know exactly what stdout will be or + /// 2. you know that stdout will also be empty pub fn no_stderr(&self) -> &CmdResult { assert!(self.stderr.is_empty()); self @@ -176,8 +176,8 @@ impl CmdResult { /// unless asserting there was neither stdout or stderr, stderr_only is usually a better choice /// generally, it's better to use stderr_only() instead, /// but you might find yourself using this function if - /// 1. you can not know exactly what stderr will be - /// or 2. you know that stderr will also be empty + /// 1. you can not know exactly what stderr will be or + /// 2. you know that stderr will also be empty pub fn no_stdout(&self) -> &CmdResult { assert!(self.stdout.is_empty()); self @@ -223,9 +223,9 @@ impl CmdResult { } /// asserts that - /// 1. the command resulted in stdout stream output that equals the - /// passed in value, when both are trimmed of trailing whitespace - /// and 2. the command resulted in empty (zero-length) stderr stream output + /// 1. the command resulted in stdout stream output that equals the + /// passed in value + /// 2. the command resulted in empty (zero-length) stderr stream output pub fn stdout_only>(&self, msg: T) -> &CmdResult { self.no_stderr().stdout_is(msg) } @@ -245,9 +245,9 @@ impl CmdResult { } /// asserts that - /// 1. the command resulted in stderr stream output that equals the - /// passed in value, when both are trimmed of trailing whitespace - /// and 2. the command resulted in empty (zero-length) stdout stream output + /// 1. the command resulted in stderr stream output that equals the + /// passed in value, when both are trimmed of trailing whitespace + /// 2. the command resulted in empty (zero-length) stdout stream output pub fn stderr_only>(&self, msg: T) -> &CmdResult { self.no_stdout().stderr_is(msg) } From 04235854fa5f3f184eded4c34f6552a717395420 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 7 Apr 2021 20:17:52 -0500 Subject: [PATCH 0294/1135] docs/README ~ fix markdown lint complaints (no-trailing-spaces) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b2257b3fd..ad4a3393a 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Why? Many GNU, Linux and other utilities are useful, and obviously [some](http://gnuwin32.sourceforge.net) [effort](http://unxutils.sourceforge.net) has been spent in the past to port them to Windows. However, those projects -are written in platform-specific C, a language considered unsafe compared to Rust, and +are written in platform-specific C, a language considered unsafe compared to Rust, and have other issues. Rust provides a good, platform-agnostic way of writing systems utilities that are easy From 26937b5d692f950df55b941aafba01ff9b1fe91d Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 7 Apr 2021 20:20:48 -0500 Subject: [PATCH 0295/1135] docs/README ~ fix markdown lint complaints (heading-style) --- README.md | 56 ++++++++++++++++++++++--------------------------------- 1 file changed, 22 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index ad4a3393a..ce257002d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -uutils coreutils -================ +# uutils coreutils [![Crates.io](https://img.shields.io/crates/v/coreutils.svg)](https://crates.io/crates/coreutils) [![Discord](https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat)](https://discord.gg/wQVJbvJ) @@ -17,8 +16,7 @@ uutils is an attempt at writing universal (as in cross-platform) CLI utilities in [Rust](http://www.rust-lang.org). This repository is intended to aggregate GNU coreutils rewrites. -Why? ----- +## Why? Many GNU, Linux and other utilities are useful, and obviously [some](http://gnuwin32.sourceforge.net) [effort](http://unxutils.sourceforge.net) @@ -29,23 +27,21 @@ have other issues. Rust provides a good, platform-agnostic way of writing systems utilities that are easy to compile anywhere, and this is as good a way as any to try and learn it. -Requirements ------------- +## Requirements * Rust (`cargo`, `rustc`) * GNU Make (required to build documentation) * [Sphinx](http://www.sphinx-doc.org/) (for documentation) * gzip (for installing documentation) -### Rust Version ### +### 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.40.0`. On both Windows and Redox, only the nightly version is tested currently. -Build Instructions ------------------- +## Build Instructions There are currently two methods to build uutils: GNU Make and Cargo. However, while there may be two methods, both systems are required to build on Unix @@ -57,7 +53,7 @@ $ git clone https://github.com/uutils/coreutils $ cd coreutils ``` -### Cargo ### +### Cargo Building uutils using Cargo is easy because the process is the same as for every other Rust program: @@ -87,7 +83,7 @@ build the utilities as individual binaries, that is possible too. For example: $ cargo build -p uu_base32 -p uu_cat -p uu_echo -p uu_rm ``` -### GNU Make ### +### GNU Make Building using `make` is a simple process as well. @@ -106,10 +102,9 @@ To build only a few of the available utilities: $ make UTILS='UTILITY_1 UTILITY_2' ``` -Installation Instructions -------------------------- +## Installation Instructions -### Cargo ### +### Cargo Likewise, installing can simply be done using: ```bash @@ -118,7 +113,7 @@ $ cargo install --path . This command will install uutils into Cargo's *bin* folder (*e.g.* `$HOME/.cargo/bin`). -### GNU Make ### +### GNU Make To install all available utilities: ```bash @@ -156,7 +151,7 @@ Set install parent directory (default value is /usr/local): $ make PREFIX=/my/path install ``` -### NixOS ### +### NixOS The [standard package set](https://nixos.org/nixpkgs/manual/) of [NixOS](https://nixos.org/) provides this package out of the box since 18.03: @@ -165,21 +160,20 @@ provides this package out of the box since 18.03: nix-env -iA nixos.uutils-coreutils ``` -Uninstallation Instructions ---------------------------- +## Uninstallation Instructions Uninstallation differs depending on how you have installed uutils. If you used Cargo to install, use Cargo to uninstall. If you used GNU Make to install, use Make to uninstall. -### Cargo ### +### Cargo To uninstall uutils: ```bash $ cargo uninstall uutils ``` -### GNU Make ### +### GNU Make To uninstall all utilities: ```bash @@ -202,12 +196,11 @@ To uninstall from a custom parent directory: $ make PREFIX=/my/path uninstall ``` -Test Instructions ------------------ +## Test Instructions Testing can be done using either Cargo or `make`. -### Cargo ### +### Cargo Just like with building, we follow the standard procedure for testing using Cargo: @@ -238,7 +231,7 @@ $ gdb --args target/debug/coreutils ls (gdb) run ``` -### GNU Make ### +### GNU Make To simply test all available utilities: ```bash @@ -260,8 +253,7 @@ To include tests for unimplemented behavior: $ make UTILS='UTILITY_1 UTILITY_2' SPEC=y test ``` -Run Busybox Tests ------------------ +## Run Busybox Tests This testing functionality is only available on *nix operating systems and requires `make`. @@ -281,13 +273,11 @@ To pass an argument like "-v" to the busybox test runtime $ make UTILS='UTILITY_1 UTILITY_2' RUNTEST_ARGS='-v' busytest ``` -Contribute ----------- +## Contribute To contribute to uutils, please see [CONTRIBUTING](CONTRIBUTING.md). -Utilities ---------- +## Utilities | Done | Semi-Done | To Do | |-----------|-----------|--------| @@ -377,8 +367,7 @@ Utilities | whoami | | | | yes | | | -Targets that compile -------- +## Targets that compile This is an auto-generated table showing which binaries compile for each target-triple. Note that this **does not** indicate that they are fully implemented, or that the tests pass. @@ -405,8 +394,7 @@ This is an auto-generated table showing which binaries compile for each target-t |fuchsia|aarch64| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |fuchsia|x86_64| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -License -------- +## License uutils is licensed under the MIT License - see the `LICENSE` file for details From a309c7cab08a29273b2f74b9e35e2654802caa8d Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 7 Apr 2021 20:22:33 -0500 Subject: [PATCH 0296/1135] docs/README ~ fix markdown lint complaints (blanks-around-fences) --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index ce257002d..2eacbf173 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ while there may be two methods, both systems are required to build on Unix (only Cargo is required on Windows). First, for both methods, we need to fetch the repository: + ```bash $ git clone https://github.com/uutils/coreutils $ cd coreutils @@ -57,6 +58,7 @@ $ cd coreutils Building uutils using Cargo is easy because the process is the same as for every other Rust program: + ```bash # to keep debug information, compile without --release $ cargo build --release @@ -65,6 +67,7 @@ $ cargo build --release Because the above command attempts to build utilities that only work on Unix-like platforms at the moment, to build on Windows, you must do the following: + ```bash # to keep debug information, compile without --release $ cargo build --release --no-default-features --features windows @@ -73,12 +76,14 @@ $ cargo build --release --no-default-features --features windows If you don't want to build every utility available on your platform into the multicall binary (the Busybox-esque binary), you can also specify which ones you want to build manually. For example: + ```bash $ cargo build --features "base32 cat echo rm" --no-default-features ``` If you don't even want to build the multicall binary and would prefer to just build the utilities as individual binaries, that is possible too. For example: + ```bash $ cargo build -p uu_base32 -p uu_cat -p uu_echo -p uu_rm ``` @@ -88,16 +93,19 @@ $ cargo build -p uu_base32 -p uu_cat -p uu_echo -p uu_rm Building using `make` is a simple process as well. To simply build all available utilities: + ```bash $ make ``` To build all but a few of the available utilities: + ```bash $ make SKIP_UTILS='UTILITY_1 UTILITY_2' ``` To build only a few of the available utilities: + ```bash $ make UTILS='UTILITY_1 UTILITY_2' ``` @@ -107,6 +115,7 @@ $ make UTILS='UTILITY_1 UTILITY_2' ### Cargo Likewise, installing can simply be done using: + ```bash $ cargo install --path . ``` @@ -116,36 +125,43 @@ This command will install uutils into Cargo's *bin* folder (*e.g.* `$HOME/.cargo ### GNU Make To install all available utilities: + ```bash $ make install ``` To install using `sudo` switch `-E` must be used: + ```bash $ sudo -E make install ``` To install all but a few of the available utilities: + ```bash $ make SKIP_UTILS='UTILITY_1 UTILITY_2' install ``` To install only a few of the available utilities: + ```bash $ make UTILS='UTILITY_1 UTILITY_2' install ``` To install every program with a prefix (e.g. uu-echo uu-cat): + ```bash $ make PROG_PREFIX=PREFIX_GOES_HERE install ``` To install the multicall binary: + ```bash $ make MULTICALL=y install ``` Set install parent directory (default value is /usr/local): + ```bash # DESTDIR is also supported $ make PREFIX=/my/path install @@ -169,6 +185,7 @@ Make to uninstall. ### Cargo To uninstall uutils: + ```bash $ cargo uninstall uutils ``` @@ -176,21 +193,25 @@ $ cargo uninstall uutils ### GNU Make To uninstall all utilities: + ```bash $ make uninstall ``` To uninstall every program with a set prefix: + ```bash $ make PROG_PREFIX=PREFIX_GOES_HERE uninstall ``` To uninstall the multicall binary: + ```bash $ make MULTICALL=y uninstall ``` To uninstall from a custom parent directory: + ```bash # DESTDIR is also supported $ make PREFIX=/my/path uninstall @@ -204,27 +225,32 @@ Testing can be done using either Cargo or `make`. Just like with building, we follow the standard procedure for testing using Cargo: + ```bash $ cargo test ``` By default, `cargo test` only runs the common programs. To run also platform specific tests, run: + ```bash $ cargo test --features unix ``` If you would prefer to test a select few utilities: + ```bash $ cargo test --features "chmod mv tail" --no-default-features ``` If you also want to test the core utilities: + ```bash $ cargo test -p uucore -p coreutils ``` To debug: + ```bash $ gdb --args target/debug/coreutils ls (gdb) b ls.rs:79 @@ -234,21 +260,25 @@ $ gdb --args target/debug/coreutils ls ### GNU Make To simply test all available utilities: + ```bash $ make test ``` To test all but a few of the available utilities: + ```bash $ make SKIP_UTILS='UTILITY_1 UTILITY_2' test ``` To test only a few of the available utilities: + ```bash $ make UTILS='UTILITY_1 UTILITY_2' test ``` To include tests for unimplemented behavior: + ```bash $ make UTILS='UTILITY_1 UTILITY_2' SPEC=y test ``` @@ -259,16 +289,19 @@ This testing functionality is only available on *nix operating systems and requires `make`. To run busybox's tests for all utilities for which busybox has tests + ```bash $ make busytest ``` To run busybox's tests for a few of the available utilities + ```bash $ make UTILS='UTILITY_1 UTILITY_2' busytest ``` To pass an argument like "-v" to the busybox test runtime + ```bash $ make UTILS='UTILITY_1 UTILITY_2' RUNTEST_ARGS='-v' busytest ``` From bf81f93be3aa03e3572c06b9405bf184ae504550 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 7 Apr 2021 20:29:43 -0500 Subject: [PATCH 0297/1135] docs/README ~ fix markdown lint complaints (fenced-code-language) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2eacbf173..230b08d3b 100644 --- a/README.md +++ b/README.md @@ -172,8 +172,8 @@ $ make PREFIX=/my/path install The [standard package set](https://nixos.org/nixpkgs/manual/) of [NixOS](https://nixos.org/) provides this package out of the box since 18.03: -``` -nix-env -iA nixos.uutils-coreutils +```shell +$ nix-env -iA nixos.uutils-coreutils ``` ## Uninstallation Instructions From 6551d29a6e896caa2c829ab0c1c9b560c325ffaa Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 7 Apr 2021 20:32:58 -0500 Subject: [PATCH 0298/1135] docs/README ~ fix markdown lint complaints (*disable* commands-show-output & no-duplicate-heading) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 230b08d3b..c485c5c63 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ ----------------------------------------------- + + uutils is an attempt at writing universal (as in cross-platform) CLI utilities in [Rust](http://www.rust-lang.org). This repository is intended to aggregate GNU coreutils rewrites. From d0abe9e6c9756b49875b7d2923c1f4584e4050f5 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 7 Apr 2021 20:36:51 -0500 Subject: [PATCH 0299/1135] docs/README ~ fix spelling (words and exceptions) --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c485c5c63..5bad664c1 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,12 @@ [![Build Status](https://api.travis-ci.org/uutils/coreutils.svg?branch=master)](https://travis-ci.org/uutils/coreutils) [![Build Status (FreeBSD)](https://api.cirrus-ci.com/github/uutils/coreutils.svg)](https://cirrus-ci.com/github/uutils/coreutils/master) -[![codecov](https://codecov.io/gh/uutils/coreutils/branch/master/graph/badge.svg)](https://codecov.io/gh/uutils/coreutils) +[![CodeCov](https://codecov.io/gh/uutils/coreutils/branch/master/graph/badge.svg)](https://codecov.io/gh/uutils/coreutils) ----------------------------------------------- + uutils is an attempt at writing universal (as in cross-platform) CLI utilities in [Rust](http://www.rust-lang.org). This repository is intended to @@ -178,9 +179,9 @@ provides this package out of the box since 18.03: $ nix-env -iA nixos.uutils-coreutils ``` -## Uninstallation Instructions +## Un-installation Instructions -Uninstallation differs depending on how you have installed uutils. If you used +Un-installation differs depending on how you have installed uutils. If you used Cargo to install, use Cargo to uninstall. If you used GNU Make to install, use Make to uninstall. From 8d7d1b0f355dc576f41083a13d02ad40b83444c9 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 7 Apr 2021 20:59:40 -0500 Subject: [PATCH 0300/1135] docs/README ~ revise build instructions for binaries --- README.md | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 5bad664c1..76ea92ab5 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ ----------------------------------------------- - + uutils is an attempt at writing universal (as in cross-platform) CLI utilities in [Rust](http://www.rust-lang.org). This repository is intended to @@ -46,11 +46,13 @@ On both Windows and Redox, only the nightly version is tested currently. ## Build Instructions -There are currently two methods to build uutils: GNU Make and Cargo. However, -while there may be two methods, both systems are required to build on Unix -(only Cargo is required on Windows). +There are currently two methods to build the uutils binaries: either Cargo +or GNU Make. -First, for both methods, we need to fetch the repository: +> Building the full package, including all documentation, requires both Cargo +> and Gnu Make on a Unix platform. + +For either method, we first need to fetch the repository: ```bash $ git clone https://github.com/uutils/coreutils @@ -63,29 +65,37 @@ Building uutils using Cargo is easy because the process is the same as for every other Rust program: ```bash -# to keep debug information, compile without --release $ cargo build --release ``` -Because the above command attempts to build utilities that only work on -Unix-like platforms at the moment, to build on Windows, you must do the -following: +This command builds the most portable common core set of uutils into a multicall +(BusyBox-type) binary, named 'coreutils', on most Rust-supported platforms. + +Additional platform-specific uutils are often available. Building these +expanded sets of uutils for a platform (on that platform) is as simple as +specifying it as a feature: ```bash -# to keep debug information, compile without --release -$ cargo build --release --no-default-features --features windows +$ cargo build --release --features macos +# or ... +$ cargo build --release --features windows +# or ... +$ cargo build --release --features unix ``` If you don't want to build every utility available on your platform into the -multicall binary (the Busybox-esque binary), you can also specify which ones -you want to build manually. For example: +final binary, you can also specify which ones you want to build manually. +For example: ```bash $ cargo build --features "base32 cat echo rm" --no-default-features ``` -If you don't even want to build the multicall binary and would prefer to just -build the utilities as individual binaries, that is possible too. For example: +If you don't want to build the multicall binary and would prefer to build +the utilities as individual binaries, that is also possible. Each utility +is contained in it's own package within the main repository, named +"uu_UTILNAME". To build individual utilities, use cargo to build just the +specific packages (using the `--package` [aka `-p`] option). For example: ```bash $ cargo build -p uu_base32 -p uu_cat -p uu_echo -p uu_rm From 8474249e5f301068565c2d62f04b04d40b0b5817 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Thu, 8 Apr 2021 15:07:09 -0500 Subject: [PATCH 0301/1135] Sort: Implement stable sort, ignore non-printing, month sort dedup, auto parallel sort through rayon, zero terminated sort, check silent (#2008) --- Cargo.lock | 20 +- src/uu/sort/Cargo.toml | 3 +- src/uu/sort/src/sort.rs | 582 +++++++++++++----- tests/by-util/test_sort.rs | 272 ++++++-- .../sort/exponents-positive-general.expected | 12 + .../sort/exponents-positive-general.txt | 12 + .../sort/exponents-positive-numeric.expected | 12 + .../sort/exponents-positive-numeric.txt | 12 + .../sort/human-mixed-inputs-reverse.expected | 37 ++ .../sort/human-mixed-inputs-reverse.txt | 37 ++ .../sort/human-mixed-inputs-stable.expected | 37 ++ .../sort/human-mixed-inputs-stable.txt | 37 ++ .../sort/human-mixed-inputs-unique.expected | 13 + .../sort/human-mixed-inputs-unique.txt | 37 ++ .../fixtures/sort/human-mixed-inputs.expected | 37 ++ tests/fixtures/sort/human-mixed-inputs.txt | 46 ++ .../mixed_floats_ints_chars_numeric.expected | 30 + .../sort/mixed_floats_ints_chars_numeric.txt | 30 + ...floats_ints_chars_numeric_reverse.expected | 30 + ...ints_chars_numeric_reverse_stable.expected | 30 + ...oats_ints_chars_numeric_reverse_stable.txt | 30 + ..._floats_ints_chars_numeric_stable.expected | 30 + ...mixed_floats_ints_chars_numeric_stable.txt | 30 + ..._floats_ints_chars_numeric_unique.expected | 20 + ...mixed_floats_ints_chars_numeric_unique.txt | 30 + ...ints_chars_numeric_unique_reverse.expected | 20 + ...oats_ints_chars_numeric_unique_reverse.txt | 30 + ..._ints_chars_numeric_unique_stable.expected | 20 + ...loats_ints_chars_numeric_unique_stable.txt | 30 + tests/fixtures/sort/months-dedup.expected | 6 + tests/fixtures/sort/months-dedup.txt | 37 ++ .../sort/numeric-floats-with-nan2.expected | 23 + .../sort/numeric-floats-with-nan2.txt | 23 + tests/fixtures/sort/zero-terminated.expected | Bin 0 -> 907 bytes tests/fixtures/sort/zero-terminated.txt | Bin 0 -> 907 bytes 35 files changed, 1442 insertions(+), 213 deletions(-) create mode 100644 tests/fixtures/sort/exponents-positive-general.expected create mode 100644 tests/fixtures/sort/exponents-positive-general.txt create mode 100644 tests/fixtures/sort/exponents-positive-numeric.expected create mode 100644 tests/fixtures/sort/exponents-positive-numeric.txt create mode 100644 tests/fixtures/sort/human-mixed-inputs-reverse.expected create mode 100644 tests/fixtures/sort/human-mixed-inputs-reverse.txt create mode 100644 tests/fixtures/sort/human-mixed-inputs-stable.expected create mode 100644 tests/fixtures/sort/human-mixed-inputs-stable.txt create mode 100644 tests/fixtures/sort/human-mixed-inputs-unique.expected create mode 100644 tests/fixtures/sort/human-mixed-inputs-unique.txt create mode 100644 tests/fixtures/sort/human-mixed-inputs.expected create mode 100644 tests/fixtures/sort/human-mixed-inputs.txt create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric.expected create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric.txt create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse.expected create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse_stable.expected create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse_stable.txt create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.expected create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.txt create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.expected create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.txt create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.expected create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.txt create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_stable.expected create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_stable.txt create mode 100644 tests/fixtures/sort/months-dedup.expected create mode 100644 tests/fixtures/sort/months-dedup.txt create mode 100644 tests/fixtures/sort/numeric-floats-with-nan2.expected create mode 100644 tests/fixtures/sort/numeric-floats-with-nan2.txt create mode 100644 tests/fixtures/sort/zero-terminated.expected create mode 100644 tests/fixtures/sort/zero-terminated.txt diff --git a/Cargo.lock b/Cargo.lock index 9c73674c8..e094f1f48 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1362,12 +1362,6 @@ dependencies = [ "maybe-uninit", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "strsim" version = "0.8.0" @@ -1522,17 +1516,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "twox-hash" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59" -dependencies = [ - "cfg-if 0.1.10", - "rand 0.7.3", - "static_assertions", -] - [[package]] name = "typenum" version = "1.13.0" @@ -2301,10 +2284,11 @@ name = "uu_sort" version = "0.0.6" dependencies = [ "clap", + "fnv", "itertools 0.8.2", "rand 0.7.3", + "rayon", "semver", - "twox-hash", "uucore", "uucore_procs", ] diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 7a6f95c41..814e4bbba 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -15,9 +15,10 @@ edition = "2018" path = "src/sort.rs" [dependencies] +rayon = "1.5" rand = "0.7" clap = "2.33" -twox-hash = "1.6.0" +fnv = "1.0.7" itertools = "0.8.0" semver = "0.9.0" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 6c29ad98d..36e6ad71e 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -7,23 +7,29 @@ // * file that was distributed with this source code. #![allow(dead_code)] +// Although these links don't always seem to describe reality, check out the POSIX and GNU specs: +// https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sort.html +// https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html + // spell-checker:ignore (ToDO) outfile nondictionary #[macro_use] extern crate uucore; use clap::{App, Arg}; +use fnv::FnvHasher; use itertools::Itertools; use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; +use rayon::prelude::*; use semver::Version; use std::cmp::Ordering; use std::collections::BinaryHeap; +use std::env; use std::fs::File; use std::hash::{Hash, Hasher}; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Lines, Read, Write}; use std::mem::replace; use std::path::Path; -use twox_hash::XxHash64; use uucore::fs::is_stdin_interactive; // for Iterator::dedup() static NAME: &str = "sort"; @@ -33,27 +39,37 @@ static VERSION: &str = env!("CARGO_PKG_VERSION"); static OPT_HUMAN_NUMERIC_SORT: &str = "human-numeric-sort"; static OPT_MONTH_SORT: &str = "month-sort"; static OPT_NUMERIC_SORT: &str = "numeric-sort"; +static OPT_GENERAL_NUMERIC_SORT: &str = "general-numeric-sort"; static OPT_VERSION_SORT: &str = "version-sort"; static OPT_DICTIONARY_ORDER: &str = "dictionary-order"; static OPT_MERGE: &str = "merge"; static OPT_CHECK: &str = "check"; +static OPT_CHECK_SILENT: &str = "check-silent"; static OPT_IGNORE_CASE: &str = "ignore-case"; static OPT_IGNORE_BLANKS: &str = "ignore-blanks"; +static OPT_IGNORE_NONPRINTING: &str = "ignore-nonprinting"; static OPT_OUTPUT: &str = "output"; static OPT_REVERSE: &str = "reverse"; static OPT_STABLE: &str = "stable"; static OPT_UNIQUE: &str = "unique"; static OPT_RANDOM: &str = "random-sort"; +static OPT_ZERO_TERMINATED: &str = "zero-terminated"; +static OPT_PARALLEL: &str = "parallel"; +static OPT_FILES0_FROM: &str = "files0-from"; static ARG_FILES: &str = "files"; static DECIMAL_PT: char = '.'; static THOUSANDS_SEP: char = ','; +static NEGATIVE: char = '-'; +static POSITIVE: char = '+'; + #[derive(Eq, Ord, PartialEq, PartialOrd)] enum SortMode { Numeric, HumanNumeric, + GeneralNumeric, Month, Version, Default, @@ -67,10 +83,13 @@ struct Settings { stable: bool, unique: bool, check: bool, + check_silent: bool, random: bool, - compare_fns: Vec Ordering>, + compare_fn: fn(&str, &str) -> Ordering, transform_fns: Vec String>, + threads: String, salt: String, + zero_terminated: bool, } impl Default for Settings { @@ -83,10 +102,13 @@ impl Default for Settings { stable: false, unique: false, check: false, + check_silent: false, random: false, - compare_fns: Vec::new(), + compare_fn: default_compare, transform_fns: Vec::new(), + threads: String::new(), salt: String::new(), + zero_terminated: false, } } } @@ -206,6 +228,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_NUMERIC_SORT) .help("compare according to string numerical value"), ) + .arg( + Arg::with_name(OPT_GENERAL_NUMERIC_SORT) + .short("g") + .long(OPT_GENERAL_NUMERIC_SORT) + .help("compare according to string general numerical value"), + ) .arg( Arg::with_name(OPT_VERSION_SORT) .short("V") @@ -230,12 +258,24 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_CHECK) .help("check for sorted input; do not sort"), ) + .arg( + Arg::with_name(OPT_CHECK_SILENT) + .short("C") + .long(OPT_CHECK_SILENT) + .help("exit successfully if the given file is already sorted, and exit with status 1 otherwise. "), + ) .arg( Arg::with_name(OPT_IGNORE_CASE) .short("f") .long(OPT_IGNORE_CASE) .help("fold lower case to upper case characters"), ) + .arg( + Arg::with_name(OPT_IGNORE_NONPRINTING) + .short("-i") + .long(OPT_IGNORE_NONPRINTING) + .help("ignore nonprinting characters"), + ) .arg( Arg::with_name(OPT_IGNORE_BLANKS) .short("b") @@ -274,18 +314,65 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_UNIQUE) .help("output only the first of an equal run"), ) + .arg( + Arg::with_name(OPT_ZERO_TERMINATED) + .short("z") + .long(OPT_ZERO_TERMINATED) + .help("line delimiter is NUL, not newline"), + ) + .arg( + Arg::with_name(OPT_PARALLEL) + .long(OPT_PARALLEL) + .help("change the number of threads running concurrently to N") + .takes_value(true) + .value_name("NUM_THREADS"), + ) + .arg( + Arg::with_name(OPT_FILES0_FROM) + .long(OPT_FILES0_FROM) + .help("read input from the files specified by NUL-terminated NUL_FILES") + .takes_value(true) + .value_name("NUL_FILES") + .multiple(true), + ) .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) .get_matches_from(args); - let mut files: Vec = matches - .values_of(ARG_FILES) - .map(|v| v.map(ToString::to_string).collect()) - .unwrap_or_default(); + // check whether user specified a zero terminated list of files for input, otherwise read files from args + let mut files: Vec = if matches.is_present(OPT_FILES0_FROM) { + let files0_from: Vec = matches + .values_of(OPT_FILES0_FROM) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + + let mut files = Vec::new(); + for path in &files0_from { + let (reader, _) = open(path.as_str()).expect("Could not read from file specified."); + let buf_reader = BufReader::new(reader); + for line in buf_reader.split(b'\0') { + if let Ok(n) = line { + files.push( + std::str::from_utf8(&n) + .expect("Could not parse zero terminated string from input.") + .to_string(), + ); + } + } + } + files + } else { + matches + .values_of(ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default() + }; settings.mode = if matches.is_present(OPT_HUMAN_NUMERIC_SORT) { SortMode::HumanNumeric } else if matches.is_present(OPT_MONTH_SORT) { SortMode::Month + } else if matches.is_present(OPT_GENERAL_NUMERIC_SORT) { + SortMode::GeneralNumeric } else if matches.is_present(OPT_NUMERIC_SORT) { SortMode::Numeric } else if matches.is_present(OPT_VERSION_SORT) { @@ -294,12 +381,29 @@ pub fn uumain(args: impl uucore::Args) -> i32 { SortMode::Default }; - if matches.is_present(OPT_DICTIONARY_ORDER) { - settings.transform_fns.push(remove_nondictionary_chars); + if matches.is_present(OPT_PARALLEL) { + // "0" is default - threads = num of cores + settings.threads = matches + .value_of(OPT_PARALLEL) + .map(String::from) + .unwrap_or("0".to_string()); + env::set_var("RAYON_NUM_THREADS", &settings.threads); } + if matches.is_present(OPT_DICTIONARY_ORDER) { + settings.transform_fns.push(remove_nondictionary_chars); + } else if matches.is_present(OPT_IGNORE_NONPRINTING) { + settings.transform_fns.push(remove_nonprinting_chars); + } + + settings.zero_terminated = matches.is_present(OPT_ZERO_TERMINATED); settings.merge = matches.is_present(OPT_MERGE); + settings.check = matches.is_present(OPT_CHECK); + if matches.is_present(OPT_CHECK_SILENT) { + settings.check_silent = matches.is_present(OPT_CHECK_SILENT); + settings.check = true; + }; if matches.is_present(OPT_IGNORE_CASE) { settings.transform_fns.push(|s| s.to_uppercase()); @@ -327,20 +431,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { crash!(1, "sort: extra operand `{}' not allowed with -c", files[1]) } - settings.compare_fns.push(match settings.mode { + settings.compare_fn = match settings.mode { SortMode::Numeric => numeric_compare, + SortMode::GeneralNumeric => general_numeric_compare, SortMode::HumanNumeric => human_numeric_size_compare, SortMode::Month => month_compare, SortMode::Version => version_compare, SortMode::Default => default_compare, - }); - - if !settings.stable { - match settings.mode { - SortMode::Default => {} - _ => settings.compare_fns.push(default_compare), - } - } + }; exec(files, &mut settings) } @@ -359,67 +457,79 @@ fn exec(files: Vec, settings: &mut Settings) -> i32 { if settings.merge { file_merger.push_file(buf_reader.lines()); - } else if settings.check { - return exec_check_file(buf_reader.lines(), &settings); + } else if settings.zero_terminated { + for line in buf_reader.split(b'\0') { + if let Ok(n) = line { + lines.push( + std::str::from_utf8(&n) + .expect("Could not parse string from zero terminated input.") + .to_string(), + ); + } + } } else { for line in buf_reader.lines() { if let Ok(n) = line { lines.push(n); - } else { - break; } } } } - sort_by(&mut lines, &settings); + if settings.check { + return exec_check_file(lines, &settings); + } else { + sort_by(&mut lines, &settings); + } if settings.merge { if settings.unique { - print_sorted(file_merger.dedup(), &settings.outfile) + print_sorted(file_merger.dedup(), &settings) } else { - print_sorted(file_merger, &settings.outfile) + print_sorted(file_merger, &settings) } - } else if settings.unique && settings.mode == SortMode::Numeric { + } else if settings.mode == SortMode::Month && settings.unique { print_sorted( lines .iter() - .dedup_by(|a, b| num_sort_dedup(a) == num_sort_dedup(b)), - &settings.outfile, + .dedup_by(|a, b| get_months_dedup(a) == get_months_dedup(b)), + &settings, ) } else if settings.unique { - print_sorted(lines.iter().dedup(), &settings.outfile) + print_sorted( + lines + .iter() + .dedup_by(|a, b| get_nums_dedup(a) == get_nums_dedup(b)), + &settings, + ) } else { - print_sorted(lines.iter(), &settings.outfile) + print_sorted(lines.iter(), &settings) } 0 } -fn exec_check_file(lines: Lines>>, settings: &Settings) -> i32 { +fn exec_check_file(unwrapped_lines: Vec, settings: &Settings) -> i32 { // errors yields the line before each disorder, // plus the last line (quirk of .coalesce()) - let unwrapped_lines = lines.filter_map(|maybe_line| { - if let Ok(line) = maybe_line { - Some(line) - } else { - None - } - }); - let mut errors = unwrapped_lines - .enumerate() - .coalesce(|(last_i, last_line), (i, line)| { - if compare_by(&last_line, &line, &settings) == Ordering::Greater { - Err(((last_i, last_line), (i, line))) - } else { - Ok((i, line)) - } - }); + let mut errors = + unwrapped_lines + .iter() + .enumerate() + .coalesce(|(last_i, last_line), (i, line)| { + if compare_by(&last_line, &line, &settings) == Ordering::Greater { + Err(((last_i, last_line), (i, line))) + } else { + Ok((i, line)) + } + }); if let Some((first_error_index, _line)) = errors.next() { // Check for a second "error", as .coalesce() always returns the last // line, no matter what our merging function does. if let Some(_last_line_or_next_error) = errors.next() { - println!("sort: disorder in line {}", first_error_index); + if !settings.check_silent { + println!("sort: disorder in line {}", first_error_index); + }; 1 } else { // first "error" was actually the last line. @@ -431,8 +541,9 @@ fn exec_check_file(lines: Lines>>, settings: &Settings) } } +#[inline(always)] fn transform(line: &str, settings: &Settings) -> String { - let mut transformed = line.to_string(); + let mut transformed = line.to_owned(); for transform_fn in &settings.transform_fns { transformed = transform_fn(&transformed); } @@ -440,8 +551,9 @@ fn transform(line: &str, settings: &Settings) -> String { transformed } +#[inline(always)] fn sort_by(lines: &mut Vec, settings: &Settings) { - lines.sort_by(|a, b| compare_by(a, b, &settings)) + lines.par_sort_by(|a, b| compare_by(a, b, &settings)) } fn compare_by(a: &str, b: &str, settings: &Settings) -> Ordering { @@ -454,72 +566,198 @@ fn compare_by(a: &str, b: &str, settings: &Settings) -> Ordering { (a, b) }; - for compare_fn in &settings.compare_fns { - let cmp: Ordering = if settings.random { - random_shuffle(a, b, settings.salt.clone()) + // 1st Compare + let mut cmp: Ordering = if settings.random { + random_shuffle(a, b, settings.salt.clone()) + } else { + (settings.compare_fn)(a, b) + }; + + // Call "last resort compare" on any equal + if cmp == Ordering::Equal { + if settings.random || settings.stable || settings.unique { + cmp = Ordering::Equal } else { - compare_fn(a, b) + cmp = default_compare(a, b) }; - if cmp != Ordering::Equal { - if settings.reverse { - return cmp.reverse(); - } else { - return cmp; - } - } + }; + + if settings.reverse { + return cmp.reverse(); + } else { + return cmp; } - Ordering::Equal } +// Test output against BSDs and GNU with their locale +// env var set to lc_ctype=utf-8 to enjoy the exact same output. +#[inline(always)] fn default_compare(a: &str, b: &str) -> Ordering { a.cmp(b) } -fn get_leading_number(a: &str) -> &str { +// This function does the initial detection of numeric lines. +// Lines starting with a number or positive or negative sign. +// It also strips the string of any thing that could never +// be a number for the purposes of any type of numeric comparison. +#[inline(always)] +fn leading_num_common(a: &str) -> &str { let mut s = ""; - for c in a.chars() { - if !c.is_numeric() && !c.eq(&'-') && !c.eq(&' ') && !c.eq(&'.') && !c.eq(&',') { - s = a.trim().split(c).next().unwrap(); + for (idx, c) in a.char_indices() { + // check whether char is numeric, whitespace or decimal point or thousand seperator + if !c.is_numeric() + && !c.is_whitespace() + && !c.eq(&DECIMAL_PT) + && !c.eq(&THOUSANDS_SEP) + // check for e notation + && !c.eq(&'e') + && !c.eq(&'E') + // check whether first char is + or - + && !a.chars().nth(0).unwrap_or('\0').eq(&POSITIVE) + && !a.chars().nth(0).unwrap_or('\0').eq(&NEGATIVE) + { + // Strip string of non-numeric trailing chars + s = &a[..idx]; break; } - s = a.trim(); + // If line is not a number line, return the line as is + s = a; } - return s; + s } -// Matches GNU behavior, see: -// https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html -// Specifically *not* the same as sort -n | uniq -fn num_sort_dedup(a: &str) -> &str { - // Empty lines are dumped - if a.is_empty() { - return "0"; - // And lines that don't begin numerically are dumped - } else if !a.trim().chars().nth(0).unwrap_or('\0').is_numeric() { - return "0"; - } else { - // Prepare lines for comparison of only the numerical leading numbers - return get_leading_number(a); +// This function cleans up the initial comparison done by leading_num_common for a numeric compare. +// GNU sort does its numeric comparison through strnumcmp. However, we don't have or +// may not want to use libc. Instead we emulate the GNU sort numeric compare by ignoring +// those leading number lines GNU sort would not recognize. GNU numeric compare would +// not recognize a positive sign or scientific/E notation so we strip those elements here. +fn get_leading_num(a: &str) -> &str { + let mut s = ""; + let b = leading_num_common(a); + + // GNU numeric sort doesn't recognize '+' or 'e' notation so we strip + for (idx, c) in b.char_indices() { + if c.eq(&'e') || c.eq(&'E') || b.chars().nth(0).unwrap_or('\0').eq(&POSITIVE) { + s = &b[..idx]; + break; + } + // If no further processing needed to be done, return the line as-is to be sorted + s = b; + } + + // And empty number or non-number lines are to be treated as ‘0’ but only for numeric sort + // All '0'-ed lines will be sorted later, but only amongst themselves, during the so-called 'last resort comparison.' + if s.is_empty() { + s = "0"; }; + s +} + +// This function cleans up the initial comparison done by leading_num_common for a general numeric compare. +// In contrast to numeric compare, GNU general numeric/FP sort *should* recognize positive signs and +// scientific notation, so we strip those lines only after the end of the following numeric string. +// For example, 5e10KFD would be 5e10 or 5x10^10 and +10000HFKJFK would become 10000. +fn get_leading_gen(a: &str) -> String { + // Make this iter peekable to see if next char is numeric + let mut p_iter = leading_num_common(a).chars().peekable(); + let mut r = String::new(); + // Cleanup raw stripped strings + for c in p_iter.to_owned() { + let next_char_numeric = p_iter.peek().unwrap_or(&'\0').is_numeric(); + // Only general numeric recognizes e notation and, see block below, the '+' sign + if (c.eq(&'e') && !next_char_numeric) + || (c.eq(&'E') && !next_char_numeric) + { + r = a.split(c).next().unwrap_or("").to_owned(); + break; + // If positive sign and next char is not numeric, split at postive sign at keep trailing numbers + // There is a more elegant way to do this in Rust 1.45, std::str::strip_prefix + } else if c.eq(&POSITIVE) && !next_char_numeric { + let mut v: Vec<&str> = a.split(c).collect(); + let x = v.split_off(1); + r = x.join(""); + break; + // If no further processing needed to be done, return the line as-is to be sorted + } else { + r = a.to_owned(); + } + } + r +} + +fn get_months_dedup(a: &str) -> String { + let pattern = if a.trim().len().ge(&3) { + // Split at 3rd char and get first element of tuple ".0" + a.split_at(3).0 + } else { + "" + }; + + let month = match pattern.to_uppercase().as_ref() { + "JAN" => Month::January, + "FEB" => Month::February, + "MAR" => Month::March, + "APR" => Month::April, + "MAY" => Month::May, + "JUN" => Month::June, + "JUL" => Month::July, + "AUG" => Month::August, + "SEP" => Month::September, + "OCT" => Month::October, + "NOV" => Month::November, + "DEC" => Month::December, + _ => Month::Unknown, + }; + + if month == Month::Unknown { + "".to_owned() + } else { + pattern.to_uppercase() + } +} + +// *For all dedups/uniques we must compare leading numbers* +// Also note numeric compare and unique output is specifically *not* the same as a "sort | uniq" +// See: https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html +fn get_nums_dedup(a: &str) -> &str { + // Trim and remove any leading zeros + let s = a.trim().trim_start_matches('0'); + + // Get first char + let c = s.chars().nth(0).unwrap_or('\0'); + + // Empty lines and non-number lines are treated as the same for dedup + if s.is_empty() { + "" + } else if !c.eq(&NEGATIVE) && !c.is_numeric() { + "" + // Prepare lines for comparison of only the numerical leading numbers + } else { + get_leading_num(s) + } } /// Parse the beginning string into an f64, returning -inf instead of NaN on errors. +#[inline(always)] fn permissive_f64_parse(a: &str) -> f64 { + // Remove thousands seperators + let a = a.replace(THOUSANDS_SEP, ""); + // GNU sort treats "NaN" as non-number in numeric, so it needs special care. - match a.parse::() { + // *Keep this trim before parse* despite what POSIX may say about -b and -n + // because GNU and BSD both seem to require it to match their behavior + match a.trim().parse::() { Ok(a) if a.is_nan() => std::f64::NEG_INFINITY, Ok(a) => a, Err(_) => std::f64::NEG_INFINITY, } } -/// Compares two floats, with errors and non-numerics assumed to be -inf. -/// Stops coercing at the first non-numeric char. fn numeric_compare(a: &str, b: &str) -> Ordering { #![allow(clippy::comparison_chain)] - let sa = get_leading_number(a); - let sb = get_leading_number(b); + let sa = get_leading_num(a); + let sb = get_leading_num(b); let fa = permissive_f64_parse(sa); let fb = permissive_f64_parse(sb); @@ -534,27 +772,17 @@ fn numeric_compare(a: &str, b: &str) -> Ordering { } } -fn human_numeric_convert(a: &str) -> f64 { - let int_str = get_leading_number(a); - let (_, s) = a.split_at(int_str.len()); - let int_part = permissive_f64_parse(int_str); - let suffix: f64 = match s.parse().unwrap_or('\0') { - 'K' => 1000f64, - 'M' => 1E6, - 'G' => 1E9, - 'T' => 1E12, - 'P' => 1E15, - _ => 1f64, - }; - int_part * suffix -} - -/// Compare two strings as if they are human readable sizes. -/// AKA 1M > 100k -fn human_numeric_size_compare(a: &str, b: &str) -> Ordering { +/// Compares two floats, with errors and non-numerics assumed to be -inf. +/// Stops coercing at the first non-numeric char. +fn general_numeric_compare(a: &str, b: &str) -> Ordering { #![allow(clippy::comparison_chain)] - let fa = human_numeric_convert(a); - let fb = human_numeric_convert(b); + + let sa = get_leading_gen(a); + let sb = get_leading_gen(b); + + let fa = permissive_f64_parse(&sa); + let fb = permissive_f64_parse(&sb); + // f64::cmp isn't implemented (due to NaN issues); implement directly instead if fa > fb { Ordering::Greater @@ -565,14 +793,46 @@ fn human_numeric_size_compare(a: &str, b: &str) -> Ordering { } } -fn random_shuffle(a: &str, b: &str, salt: String) -> Ordering { +// GNU/BSD does not handle converting numbers to an equal scale +// properly. GNU/BSD simply recognize that there is a human scale and sorts +// those numbers ahead of other number inputs. There are perhaps limits +// to the type of behavior we should emulate, and this might be such a limit. +// Properly handling these units seems like a value add to me. And when sorting +// these types of numbers, we rarely care about pure performance. +fn human_numeric_convert(a: &str) -> f64 { + let num_str = get_leading_num(a); + let suffix = a.trim_start_matches(num_str); + let num_part = permissive_f64_parse(num_str); + let suffix: f64 = match suffix.parse().unwrap_or('\0') { + // SI Units + 'K' => 1E3, + 'M' => 1E6, + 'G' => 1E9, + 'T' => 1E12, + 'P' => 1E15, + 'E' => 1E18, + 'Z' => 1E21, + 'Y' => 1E24, + _ => 1f64, + }; + num_part * suffix +} + +/// Compare two strings as if they are human readable sizes. +/// AKA 1M > 100k +fn human_numeric_size_compare(a: &str, b: &str) -> Ordering { #![allow(clippy::comparison_chain)] - let salt_slice = salt.as_str(); + let fa = human_numeric_convert(a); + let fb = human_numeric_convert(b); - let da = hash(&[a, salt_slice].concat()); - let db = hash(&[b, salt_slice].concat()); - - da.cmp(&db) + // f64::cmp isn't implemented (due to NaN issues); implement directly instead + if fa > fb { + Ordering::Greater + } else if fa < fb { + Ordering::Less + } else { + Ordering::Equal + } } fn get_rand_string() -> String { @@ -583,12 +843,22 @@ fn get_rand_string() -> String { .collect::() } -fn hash(t: &T) -> u64 { - let mut s: XxHash64 = Default::default(); +fn get_hash(t: &T) -> u64 { + let mut s: FnvHasher = Default::default(); t.hash(&mut s); s.finish() } +fn random_shuffle(a: &str, b: &str, x: String) -> Ordering { + #![allow(clippy::comparison_chain)] + let salt_slice = x.as_str(); + + let da = get_hash(&[a, salt_slice].concat()); + let db = get_hash(&[b, salt_slice].concat()); + + da.cmp(&db) +} + #[derive(Eq, Ord, PartialEq, PartialOrd)] enum Month { Unknown, @@ -608,13 +878,15 @@ enum Month { /// Parse the beginning string into a Month, returning Month::Unknown on errors. fn month_parse(line: &str) -> Month { - match line - .split_whitespace() - .next() - .unwrap() - .to_uppercase() - .as_ref() - { + // GNU splits at any 3 letter match "JUNNNN" is JUN + let pattern = if line.trim().len().ge(&3) { + // Split a 3 and get first element of tuple ".0" + line.split_at(3).0 + } else { + "" + }; + + match pattern.to_uppercase().as_ref() { "JAN" => Month::January, "FEB" => Month::February, "MAR" => Month::March, @@ -632,7 +904,16 @@ fn month_parse(line: &str) -> Month { } fn month_compare(a: &str, b: &str) -> Ordering { - month_parse(a).cmp(&month_parse(b)) + let ma = month_parse(a); + let mb = month_parse(b); + + if ma > mb { + Ordering::Greater + } else if ma < mb { + Ordering::Less + } else { + Ordering::Equal + } } fn version_compare(a: &str, b: &str) -> Ordering { @@ -650,19 +931,26 @@ fn version_compare(a: &str, b: &str) -> Ordering { } fn remove_nondictionary_chars(s: &str) -> String { - // Using 'is_ascii_whitespace()' instead of 'is_whitespace()', because it - // uses only symbols compatible with UNIX sort (space, tab, newline). - // 'is_whitespace()' uses more symbols as whitespace (e.g. vertical tab). + // According to GNU, dictionary chars are those of ASCII + // and a blank is a space or a tab s.chars() - .filter(|c| c.is_alphanumeric() || c.is_ascii_whitespace()) + .filter(|c| c.is_ascii_alphanumeric() || c.is_ascii_whitespace()) .collect::() } -fn print_sorted>(iter: T, outfile: &Option) +fn remove_nonprinting_chars(s: &str) -> String { + // However, GNU says nonprinting chars are more permissive. + // All of ASCII except control chars ie, escape, newline + s.chars() + .filter(|c| c.is_ascii() && !c.is_ascii_control()) + .collect::() +} + +fn print_sorted>(iter: T, settings: &Settings) where S: std::fmt::Display, { - let mut file: Box = match *outfile { + let mut file: Box = match settings.outfile { Some(ref filename) => match File::create(Path::new(&filename)) { Ok(f) => Box::new(BufWriter::new(f)) as Box, Err(e) => { @@ -673,9 +961,16 @@ where None => Box::new(stdout()) as Box, }; - for line in iter { - let str = format!("{}\n", line); - crash_if_err!(1, file.write_all(str.as_bytes())) + if settings.zero_terminated { + for line in iter { + let str = format!("{}\0", line); + crash_if_err!(1, file.write_all(str.as_bytes())); + } + } else { + for line in iter { + let str = format!("{}\n", line); + crash_if_err!(1, file.write_all(str.as_bytes())); + } } } @@ -700,6 +995,22 @@ mod tests { use super::*; + #[test] + fn test_get_hash() { + let a = "Ted".to_string(); + + assert_eq!(2646829031758483623, get_hash(&a)); + } + + #[test] + fn test_random_shuffle() { + let a = "Ted"; + let b = "Ted"; + let c = get_rand_string(); + + assert_eq!(Ordering::Equal, random_shuffle(a, b, c)); + } + #[test] fn test_default_compare() { let a = "your own"; @@ -746,13 +1057,4 @@ mod tests { assert_eq!(Ordering::Less, version_compare(a, b)); } - - #[test] - fn test_random_compare() { - let a = "9"; - let b = "9"; - let c = get_rand_string(); - - assert_eq!(Ordering::Equal, random_shuffle(a, b, c)); - } } diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 2bac71def..43aaf1da1 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -1,44 +1,82 @@ use crate::common::util::*; +#[test] +fn test_check_zero_terminated_failure() { + new_ucmd!() + .arg("-z") + .arg("-c") + .arg("zero-terminated.txt") + .fails() + .stdout_is("sort: disorder in line 0\n"); +} + +#[test] +fn test_check_zero_terminated_success() { + new_ucmd!() + .arg("-z") + .arg("-c") + .arg("zero-terminated.expected") + .succeeds(); +} + +#[test] +fn test_random_shuffle_len() { + // check whether output is the same length as the input + const FILE: &'static str = "default_unsorted_ints.expected"; + let (at, _ucmd) = at_and_ucmd!(); + let result = new_ucmd!().arg("-R").arg(FILE).run().stdout; + let expected = at.read(FILE); + + assert_ne!(result, expected); + assert_eq!(result.len(), expected.len()); +} + +#[test] +fn test_random_shuffle_contains_all_lines() { + // check whether lines of input are all in output + const FILE: &'static str = "default_unsorted_ints.expected"; + let (at, _ucmd) = at_and_ucmd!(); + let result = new_ucmd!().arg("-R").arg(FILE).run().stdout; + let expected = at.read(FILE); + let result_sorted = new_ucmd!().pipe_in(result.clone()).run().stdout; + + assert_ne!(result, expected); + assert_eq!(result_sorted, expected); +} + +#[test] +fn test_random_shuffle_contains_two_runs_not_the_same() { + // check to verify that two random shuffles are not equal; this has the + // potential to fail in the unlikely event that random order is the same + // as the starting order, or if both random sorts end up having the same order. + const FILE: &'static str = "default_unsorted_ints.expected"; + let (at, _ucmd) = at_and_ucmd!(); + let result = new_ucmd!().arg("-R").arg(FILE).run().stdout; + let expected = at.read(FILE); + let unexpected = new_ucmd!().arg("-R").arg(FILE).run().stdout; + + assert_ne!(result, expected); + assert_ne!(result, unexpected); +} + #[test] fn test_numeric_floats_and_ints() { - for numeric_sort_param in vec!["-n", "--numeric-sort"] { - let input = "1.444\n8.013\n1\n-8\n1.04\n-1"; - new_ucmd!() - .arg(numeric_sort_param) - .pipe_in(input) - .succeeds() - .stdout_only("-8\n-1\n1\n1.04\n1.444\n8.013\n"); - } + test_helper("numeric_floats_and_ints", "-n"); } #[test] fn test_numeric_floats() { - for numeric_sort_param in vec!["-n", "--numeric-sort"] { - let input = "1.444\n8.013\n1.58590\n-8.90880\n1.040000000\n-.05"; - new_ucmd!() - .arg(numeric_sort_param) - .pipe_in(input) - .succeeds() - .stdout_only("-8.90880\n-.05\n1.040000000\n1.444\n1.58590\n8.013\n"); - } + test_helper("numeric_floats", "-n"); } #[test] fn test_numeric_floats_with_nan() { - for numeric_sort_param in vec!["-n", "--numeric-sort"] { - let input = "1.444\n1.0/0.0\n1.58590\n-8.90880\n1.040000000\n-.05"; - new_ucmd!() - .arg(numeric_sort_param) - .pipe_in(input) - .succeeds() - .stdout_only("-8.90880\n-.05\n1.0/0.0\n1.040000000\n1.444\n1.58590\n"); - } + test_helper("numeric_floats_with_nan", "-n"); } #[test] fn test_numeric_unfixed_floats() { - test_helper("numeric_fixed_floats", "-n"); + test_helper("numeric_unfixed_floats", "-n"); } #[test] @@ -53,26 +91,12 @@ fn test_numeric_unsorted_ints() { #[test] fn test_human_block_sizes() { - for human_numeric_sort_param in vec!["-h", "--human-numeric-sort"] { - let input = "8981K\n909991M\n-8T\n21G\n0.8M"; - new_ucmd!() - .arg(human_numeric_sort_param) - .pipe_in(input) - .succeeds() - .stdout_only("-8T\n0.8M\n8981K\n21G\n909991M\n"); - } + test_helper("human_block_sizes", "-h"); } #[test] fn test_month_default() { - for month_sort_param in vec!["-M", "--month-sort"] { - let input = "JAn\nMAY\n000may\nJun\nFeb"; - new_ucmd!() - .arg(month_sort_param) - .pipe_in(input) - .succeeds() - .stdout_only("000may\nJAn\nFeb\nMAY\nJun\n"); - } + test_helper("month_default", "-M"); } #[test] @@ -82,23 +106,12 @@ fn test_month_stable() { #[test] fn test_default_unsorted_ints() { - let input = "9\n1909888\n000\n1\n2"; - new_ucmd!() - .pipe_in(input) - .succeeds() - .stdout_only("000\n1\n1909888\n2\n9\n"); + test_helper("default_unsorted_ints", ""); } #[test] fn test_numeric_unique_ints() { - for numeric_unique_sort_param in vec!["-nu"] { - let input = "9\n9\n8\n1\n"; - new_ucmd!() - .arg(numeric_unique_sort_param) - .pipe_in(input) - .succeeds() - .stdout_only("1\n8\n9\n"); - } + test_helper("numeric_unsorted_ints_unique", "-nu"); } #[test] @@ -116,6 +129,148 @@ fn test_dictionary_order() { test_helper("dictionary_order", "-d"); } +#[test] +fn test_dictionary_order2() { + for non_dictionary_order2_param in vec!["-d"] { + new_ucmd!() + .pipe_in("a👦🏻aa b\naaaa b") + .arg(non_dictionary_order2_param) + .succeeds() + .stdout_only("a👦🏻aa b\naaaa b\n"); + } +} + +#[test] +fn test_non_printing_chars() { + for non_printing_chars_param in vec!["-i"] { + new_ucmd!() + .pipe_in("a👦🏻aa b\naaaa b") + .arg(non_printing_chars_param) + .succeeds() + .stdout_only("aaaa b\na👦🏻aa b\n"); + } +} + +#[test] +fn test_exponents_positive_general_fixed() { + for exponents_positive_general_param in vec!["-g"] { + new_ucmd!() + .pipe_in("100E6\n\n50e10\n+100000\n\n10000K78\n10E\n\n\n1000EDKLD\n\n\n100E6\n\n50e10\n+100000\n\n") + .arg(exponents_positive_general_param) + .succeeds() + .stdout_only("\n\n\n\n\n\n\n\n10000K78\n1000EDKLD\n10E\n+100000\n+100000\n100E6\n100E6\n50e10\n50e10\n"); + } +} + +#[test] +fn test_exponents_positive_numeric() { + test_helper("exponents-positive-numeric", "-n"); +} + +#[test] +fn test_months_dedup() { + test_helper("months-dedup", "-Mu"); +} + +#[test] +fn test_mixed_floats_ints_chars_numeric() { + test_helper("mixed_floats_ints_chars_numeric", "-n"); +} + +#[test] +fn test_mixed_floats_ints_chars_numeric_unique() { + test_helper("mixed_floats_ints_chars_numeric_unique", "-nu"); +} + +#[test] +fn test_mixed_floats_ints_chars_numeric_reverse() { + test_helper("mixed_floats_ints_chars_numeric_unique_reverse", "-nur"); +} + +#[test] +fn test_mixed_floats_ints_chars_numeric_stable() { + test_helper("mixed_floats_ints_chars_numeric_stable", "-ns"); +} + +#[test] +fn test_numeric_floats_and_ints2() { + for numeric_sort_param in vec!["-n", "--numeric-sort"] { + let input = "1.444\n8.013\n1\n-8\n1.04\n-1"; + new_ucmd!() + .arg(numeric_sort_param) + .pipe_in(input) + .succeeds() + .stdout_only("-8\n-1\n1\n1.04\n1.444\n8.013\n"); + } +} + +#[test] +fn test_numeric_floats2() { + for numeric_sort_param in vec!["-n", "--numeric-sort"] { + let input = "1.444\n8.013\n1.58590\n-8.90880\n1.040000000\n-.05"; + new_ucmd!() + .arg(numeric_sort_param) + .pipe_in(input) + .succeeds() + .stdout_only("-8.90880\n-.05\n1.040000000\n1.444\n1.58590\n8.013\n"); + } +} + +#[test] +fn test_numeric_floats_with_nan2() { + test_helper("numeric-floats-with-nan2", "-n"); +} + +#[test] +fn test_human_block_sizes2() { + for human_numeric_sort_param in vec!["-h", "--human-numeric-sort"] { + let input = "8981K\n909991M\n-8T\n21G\n0.8M"; + new_ucmd!() + .arg(human_numeric_sort_param) + .pipe_in(input) + .succeeds() + .stdout_only("-8T\n0.8M\n8981K\n21G\n909991M\n"); + } +} + +#[test] +fn test_month_default2() { + for month_sort_param in vec!["-M", "--month-sort"] { + let input = "JAn\nMAY\n000may\nJun\nFeb"; + new_ucmd!() + .arg(month_sort_param) + .pipe_in(input) + .succeeds() + .stdout_only("000may\nJAn\nFeb\nMAY\nJun\n"); + } +} + +#[test] +fn test_default_unsorted_ints2() { + let input = "9\n1909888\n000\n1\n2"; + new_ucmd!() + .pipe_in(input) + .succeeds() + .stdout_only("000\n1\n1909888\n2\n9\n"); +} + +#[test] +fn test_numeric_unique_ints2() { + for numeric_unique_sort_param in vec!["-nu"] { + let input = "9\n9\n8\n1\n"; + new_ucmd!() + .arg(numeric_unique_sort_param) + .pipe_in(input) + .succeeds() + .stdout_only("1\n8\n9\n"); + } +} + +#[test] +fn test_zero_terminated() { + test_helper("zero-terminated", "-z"); +} + #[test] fn test_multiple_files() { new_ucmd!() @@ -192,6 +347,15 @@ fn test_check() { .stdout_is(""); } +#[test] +fn test_check_silent() { + new_ucmd!() + .arg("-C") + .arg("check_fail.txt") + .fails() + .stdout_is(""); +} + fn test_helper(file_name: &str, args: &str) { new_ucmd!() .arg(args) diff --git a/tests/fixtures/sort/exponents-positive-general.expected b/tests/fixtures/sort/exponents-positive-general.expected new file mode 100644 index 000000000..3dbc92fe5 --- /dev/null +++ b/tests/fixtures/sort/exponents-positive-general.expected @@ -0,0 +1,12 @@ + + + + + + +10E +1000EDKLD +10000K78 ++100000 +100E6 +50e10 diff --git a/tests/fixtures/sort/exponents-positive-general.txt b/tests/fixtures/sort/exponents-positive-general.txt new file mode 100644 index 000000000..23ea52771 --- /dev/null +++ b/tests/fixtures/sort/exponents-positive-general.txt @@ -0,0 +1,12 @@ +10000K78 +10E + + +1000EDKLD + + +100E6 + +50e10 ++100000 + diff --git a/tests/fixtures/sort/exponents-positive-numeric.expected b/tests/fixtures/sort/exponents-positive-numeric.expected new file mode 100644 index 000000000..174088f63 --- /dev/null +++ b/tests/fixtures/sort/exponents-positive-numeric.expected @@ -0,0 +1,12 @@ + + + + + + ++100000 +10E +50e10 +100E6 +1000EDKLD +10000K78 diff --git a/tests/fixtures/sort/exponents-positive-numeric.txt b/tests/fixtures/sort/exponents-positive-numeric.txt new file mode 100644 index 000000000..23ea52771 --- /dev/null +++ b/tests/fixtures/sort/exponents-positive-numeric.txt @@ -0,0 +1,12 @@ +10000K78 +10E + + +1000EDKLD + + +100E6 + +50e10 ++100000 + diff --git a/tests/fixtures/sort/human-mixed-inputs-reverse.expected b/tests/fixtures/sort/human-mixed-inputs-reverse.expected new file mode 100644 index 000000000..463f44a2a --- /dev/null +++ b/tests/fixtures/sort/human-mixed-inputs-reverse.expected @@ -0,0 +1,37 @@ +.2T +2G +100M +7800900K +51887300- +1890777 +56908-90078 +6780.0009866 +6780.000986 +789----009999 90-0 90-0 +1 +0001 +apr +MAY +JUNNNN +JAN +AUG +APR +0000000 +00 + + + + + + + + + + + + + + + + +-1.4 diff --git a/tests/fixtures/sort/human-mixed-inputs-reverse.txt b/tests/fixtures/sort/human-mixed-inputs-reverse.txt new file mode 100644 index 000000000..ebef388b9 --- /dev/null +++ b/tests/fixtures/sort/human-mixed-inputs-reverse.txt @@ -0,0 +1,37 @@ +JAN + +0000000 + +00 + +0001 + +1 + +-1.4 + +JUNNNN +AUG + +apr + +APR + + +MAY +1890777 + +56908-90078 + +51887300- + +6780.0009866 + +789----009999 90-0 90-0 + +6780.000986 + +100M +7800900K +2G +.2T diff --git a/tests/fixtures/sort/human-mixed-inputs-stable.expected b/tests/fixtures/sort/human-mixed-inputs-stable.expected new file mode 100644 index 000000000..e1c85b8ce --- /dev/null +++ b/tests/fixtures/sort/human-mixed-inputs-stable.expected @@ -0,0 +1,37 @@ +-1.4 +JAN + +0000000 + +00 + + + + +JUNNNN +AUG + +apr + +APR + + +MAY + + + + + + +0001 +1 +789----009999 90-0 90-0 +6780.000986 +6780.0009866 +56908-90078 +1890777 +51887300- +7800900K +100M +2G +.2T diff --git a/tests/fixtures/sort/human-mixed-inputs-stable.txt b/tests/fixtures/sort/human-mixed-inputs-stable.txt new file mode 100644 index 000000000..ebef388b9 --- /dev/null +++ b/tests/fixtures/sort/human-mixed-inputs-stable.txt @@ -0,0 +1,37 @@ +JAN + +0000000 + +00 + +0001 + +1 + +-1.4 + +JUNNNN +AUG + +apr + +APR + + +MAY +1890777 + +56908-90078 + +51887300- + +6780.0009866 + +789----009999 90-0 90-0 + +6780.000986 + +100M +7800900K +2G +.2T diff --git a/tests/fixtures/sort/human-mixed-inputs-unique.expected b/tests/fixtures/sort/human-mixed-inputs-unique.expected new file mode 100644 index 000000000..50f53b6a0 --- /dev/null +++ b/tests/fixtures/sort/human-mixed-inputs-unique.expected @@ -0,0 +1,13 @@ +-1.4 +JAN +0001 +789----009999 90-0 90-0 +6780.000986 +6780.0009866 +56908-90078 +1890777 +51887300- +7800900K +100M +2G +.2T diff --git a/tests/fixtures/sort/human-mixed-inputs-unique.txt b/tests/fixtures/sort/human-mixed-inputs-unique.txt new file mode 100644 index 000000000..ebef388b9 --- /dev/null +++ b/tests/fixtures/sort/human-mixed-inputs-unique.txt @@ -0,0 +1,37 @@ +JAN + +0000000 + +00 + +0001 + +1 + +-1.4 + +JUNNNN +AUG + +apr + +APR + + +MAY +1890777 + +56908-90078 + +51887300- + +6780.0009866 + +789----009999 90-0 90-0 + +6780.000986 + +100M +7800900K +2G +.2T diff --git a/tests/fixtures/sort/human-mixed-inputs.expected b/tests/fixtures/sort/human-mixed-inputs.expected new file mode 100644 index 000000000..3f5692b7b --- /dev/null +++ b/tests/fixtures/sort/human-mixed-inputs.expected @@ -0,0 +1,37 @@ +-1.4 + + + + + + + + + + + + + + + + +00 +0000000 +APR +AUG +JAN +JUNNNN +MAY +apr +0001 +1 +789----009999 90-0 90-0 +6780.000986 +6780.0009866 +56908-90078 +1890777 +51887300- +7800900K +100M +2G +.2T diff --git a/tests/fixtures/sort/human-mixed-inputs.txt b/tests/fixtures/sort/human-mixed-inputs.txt new file mode 100644 index 000000000..ce5986d6e --- /dev/null +++ b/tests/fixtures/sort/human-mixed-inputs.txt @@ -0,0 +1,46 @@ +JAN + +0000000 + +00 + +0001 + +1 + +-1.4 + +JUNNNN +AUG + +apr + +APR + + +MAY +1890777 + +56908-90078 + +51887300- + +6780.0009866 + +789----009999 90-0 90-0 + +6780.000986 + +1M +10M +100M +1000M +10000M + +7800900K +780090K +78009K +7800K +780K +2G +.2T diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric.expected b/tests/fixtures/sort/mixed_floats_ints_chars_numeric.expected new file mode 100644 index 000000000..a781a36bb --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric.expected @@ -0,0 +1,30 @@ +-2028789030 +-896689 +-8.90880 +-1 +-.05 + + + + + + + + +000 +CARAvan +00000001 +1 +1.040000000 +1.444 +1.58590 +8.013 +45 +46.89 + 4567. + 37800 +576,446.88800000 +576,446.890 +4798908.340000000000 +4798908.45 +4798908.8909800 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric.txt b/tests/fixtures/sort/mixed_floats_ints_chars_numeric.txt new file mode 100644 index 000000000..a5813ea3a --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric.txt @@ -0,0 +1,30 @@ +576,446.890 +576,446.88800000 + + + 4567. +45 +46.89 +-1 +1 +00000001 +4798908.340000000000 +4798908.45 +4798908.8909800 + + + 37800 + +-2028789030 +-896689 +CARAvan + +-8.90880 +-.05 +1.444 +1.58590 +1.040000000 + +8.013 + +000 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse.expected b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse.expected new file mode 100644 index 000000000..6b024210b --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse.expected @@ -0,0 +1,30 @@ +4798908.8909800 +4798908.45 +4798908.340000000000 +576,446.890 +576,446.88800000 + 37800 + 4567. +46.89 +45 +8.013 +1.58590 +1.444 +1.040000000 +1 +00000001 +CARAvan +000 + + + + + + + + +-.05 +-1 +-8.90880 +-896689 +-2028789030 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse_stable.expected b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse_stable.expected new file mode 100644 index 000000000..cb1028f0e --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse_stable.expected @@ -0,0 +1,30 @@ +4798908.8909800 +4798908.45 +4798908.340000000000 +576,446.890 +576,446.88800000 + 37800 + 4567. +46.89 +45 +8.013 +1.58590 +1.444 +1.040000000 +1 +00000001 + + + + + +CARAvan + + + +000 +-.05 +-1 +-8.90880 +-896689 +-2028789030 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse_stable.txt b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse_stable.txt new file mode 100644 index 000000000..a5813ea3a --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse_stable.txt @@ -0,0 +1,30 @@ +576,446.890 +576,446.88800000 + + + 4567. +45 +46.89 +-1 +1 +00000001 +4798908.340000000000 +4798908.45 +4798908.8909800 + + + 37800 + +-2028789030 +-896689 +CARAvan + +-8.90880 +-.05 +1.444 +1.58590 +1.040000000 + +8.013 + +000 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.expected b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.expected new file mode 100644 index 000000000..63a3e646d --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.expected @@ -0,0 +1,30 @@ +-2028789030 +-896689 +-8.90880 +-1 +-.05 + + + + + +CARAvan + + + +000 +1 +00000001 +1.040000000 +1.444 +1.58590 +8.013 +45 +46.89 + 4567. + 37800 +576,446.88800000 +576,446.890 +4798908.340000000000 +4798908.45 +4798908.8909800 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.txt b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.txt new file mode 100644 index 000000000..a5813ea3a --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.txt @@ -0,0 +1,30 @@ +576,446.890 +576,446.88800000 + + + 4567. +45 +46.89 +-1 +1 +00000001 +4798908.340000000000 +4798908.45 +4798908.8909800 + + + 37800 + +-2028789030 +-896689 +CARAvan + +-8.90880 +-.05 +1.444 +1.58590 +1.040000000 + +8.013 + +000 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.expected b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.expected new file mode 100644 index 000000000..cb27c6664 --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.expected @@ -0,0 +1,20 @@ +-2028789030 +-896689 +-8.90880 +-1 +-.05 + +1 +1.040000000 +1.444 +1.58590 +8.013 +45 +46.89 + 4567. + 37800 +576,446.88800000 +576,446.890 +4798908.340000000000 +4798908.45 +4798908.8909800 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.txt b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.txt new file mode 100644 index 000000000..a5813ea3a --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.txt @@ -0,0 +1,30 @@ +576,446.890 +576,446.88800000 + + + 4567. +45 +46.89 +-1 +1 +00000001 +4798908.340000000000 +4798908.45 +4798908.8909800 + + + 37800 + +-2028789030 +-896689 +CARAvan + +-8.90880 +-.05 +1.444 +1.58590 +1.040000000 + +8.013 + +000 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.expected b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.expected new file mode 100644 index 000000000..bbce16934 --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.expected @@ -0,0 +1,20 @@ +4798908.8909800 +4798908.45 +4798908.340000000000 +576,446.890 +576,446.88800000 + 37800 + 4567. +46.89 +45 +8.013 +1.58590 +1.444 +1.040000000 +1 + +-.05 +-1 +-8.90880 +-896689 +-2028789030 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.txt b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.txt new file mode 100644 index 000000000..a5813ea3a --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.txt @@ -0,0 +1,30 @@ +576,446.890 +576,446.88800000 + + + 4567. +45 +46.89 +-1 +1 +00000001 +4798908.340000000000 +4798908.45 +4798908.8909800 + + + 37800 + +-2028789030 +-896689 +CARAvan + +-8.90880 +-.05 +1.444 +1.58590 +1.040000000 + +8.013 + +000 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_stable.expected b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_stable.expected new file mode 100644 index 000000000..bbce16934 --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_stable.expected @@ -0,0 +1,20 @@ +4798908.8909800 +4798908.45 +4798908.340000000000 +576,446.890 +576,446.88800000 + 37800 + 4567. +46.89 +45 +8.013 +1.58590 +1.444 +1.040000000 +1 + +-.05 +-1 +-8.90880 +-896689 +-2028789030 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_stable.txt b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_stable.txt new file mode 100644 index 000000000..a5813ea3a --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_stable.txt @@ -0,0 +1,30 @@ +576,446.890 +576,446.88800000 + + + 4567. +45 +46.89 +-1 +1 +00000001 +4798908.340000000000 +4798908.45 +4798908.8909800 + + + 37800 + +-2028789030 +-896689 +CARAvan + +-8.90880 +-.05 +1.444 +1.58590 +1.040000000 + +8.013 + +000 diff --git a/tests/fixtures/sort/months-dedup.expected b/tests/fixtures/sort/months-dedup.expected new file mode 100644 index 000000000..dfb693492 --- /dev/null +++ b/tests/fixtures/sort/months-dedup.expected @@ -0,0 +1,6 @@ + +JAN +apr +MAY +JUNNNN +AUG diff --git a/tests/fixtures/sort/months-dedup.txt b/tests/fixtures/sort/months-dedup.txt new file mode 100644 index 000000000..ebef388b9 --- /dev/null +++ b/tests/fixtures/sort/months-dedup.txt @@ -0,0 +1,37 @@ +JAN + +0000000 + +00 + +0001 + +1 + +-1.4 + +JUNNNN +AUG + +apr + +APR + + +MAY +1890777 + +56908-90078 + +51887300- + +6780.0009866 + +789----009999 90-0 90-0 + +6780.000986 + +100M +7800900K +2G +.2T diff --git a/tests/fixtures/sort/numeric-floats-with-nan2.expected b/tests/fixtures/sort/numeric-floats-with-nan2.expected new file mode 100644 index 000000000..51c9985c3 --- /dev/null +++ b/tests/fixtures/sort/numeric-floats-with-nan2.expected @@ -0,0 +1,23 @@ +-8.90880 +-.05 + + + + + + + + + + + + + + +Karma +1 +1.0/0.0 +1.040000000 +1.2 +1.444 +1.58590 diff --git a/tests/fixtures/sort/numeric-floats-with-nan2.txt b/tests/fixtures/sort/numeric-floats-with-nan2.txt new file mode 100644 index 000000000..9b78741fe --- /dev/null +++ b/tests/fixtures/sort/numeric-floats-with-nan2.txt @@ -0,0 +1,23 @@ +Karma + +1.0/0.0 + + +-8.90880 + + +-.05 + + +1.040000000 + +1.444 + + +1.58590 + + +1 + +1.2 + diff --git a/tests/fixtures/sort/zero-terminated.expected b/tests/fixtures/sort/zero-terminated.expected new file mode 100644 index 0000000000000000000000000000000000000000..4e53b304bb3e3d9582633426168624f066e082cb GIT binary patch literal 907 zcmdPX)7R5u0F(MjmAa)RnK@8ia(-@Zejb#QmRV6!T9jIh#??Qu?guHrxuo`<|Si>PfBJ{a(+&J5k|nJl%hK;rBuJTGzp7);S%~Osi_62 z82&-X=Vaz(W7w3MSB7p?YDGa}UJANsS}um)((-dKlw~9qXJCopjMPL7rCIrz=m|(a z7sEAquoMSNWcqofxmX;Nk70g6VsQyZ#1)iOp!=*iqcjaeEWZfDyI8zcl9-IHvm_Co aN8m0lDaK-4X&&}~F3rm- zsF94JAQ97L1rS9L5|Q*u5;HM^0`6k{l+@IMRLqD;O~i=qto%$^ Date: Fri, 9 Apr 2021 10:14:41 +0200 Subject: [PATCH 0302/1135] Ignore a test (#2053) * Disable chksum: test_arg_overrides_stdin fails often with: ---- test_cksum::test_arg_overrides_stdin stdout ---- current_directory_resolved: touch: /tmp/.tmpv9hydc/a run: /target/x86_64-unknown-linux-gnu/debug/coreutils cksum a thread 'test_cksum::test_arg_overrides_stdin' panicked at 'Broken pipe (os error 32)', tests/common/util.rs:742:37 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace * rustfmt the recent change --- src/uu/sort/src/sort.rs | 6 ++---- src/uu/stdbuf/src/stdbuf.rs | 3 +-- tests/by-util/test_cksum.rs | 1 + 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 36e6ad71e..4e0e25d65 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -665,9 +665,7 @@ fn get_leading_gen(a: &str) -> String { for c in p_iter.to_owned() { let next_char_numeric = p_iter.peek().unwrap_or(&'\0').is_numeric(); // Only general numeric recognizes e notation and, see block below, the '+' sign - if (c.eq(&'e') && !next_char_numeric) - || (c.eq(&'E') && !next_char_numeric) - { + if (c.eq(&'e') && !next_char_numeric) || (c.eq(&'E') && !next_char_numeric) { r = a.split(c).next().unwrap_or("").to_owned(); break; // If positive sign and next char is not numeric, split at postive sign at keep trailing numbers @@ -813,7 +811,7 @@ fn human_numeric_convert(a: &str) -> f64 { 'E' => 1E18, 'Z' => 1E21, 'Y' => 1E24, - _ => 1f64, + _ => 1f64, }; num_part * suffix } diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index a61ba967b..67ed9a838 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -80,8 +80,7 @@ fn print_version() { fn print_usage(opts: &Options) { let brief = "Run COMMAND, with modified buffering operations for its standard streams\n \ Mandatory arguments to long options are mandatory for short options too."; - let explanation = - "If MODE is 'L' the corresponding stream will be line buffered.\n \ + let explanation = "If MODE is 'L' the corresponding stream will be line buffered.\n \ This option is invalid with standard input.\n\n \ If MODE is '0' the corresponding stream will be unbuffered.\n\n \ Otherwise MODE is a number which may be followed by one of the following:\n\n \ diff --git a/tests/by-util/test_cksum.rs b/tests/by-util/test_cksum.rs index 8c8a551a0..8b41c782c 100644 --- a/tests/by-util/test_cksum.rs +++ b/tests/by-util/test_cksum.rs @@ -35,6 +35,7 @@ fn test_empty() { } #[test] +#[ignore] fn test_arg_overrides_stdin() { let (at, mut ucmd) = at_and_ucmd!(); let input = "foobarfoobar"; From d51ca4098678b4109c5c608da3ee65ba81682543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reto=20Habl=C3=BCtzel?= Date: Fri, 9 Apr 2021 11:08:31 +0200 Subject: [PATCH 0303/1135] allow ignoring stdin write errors in tests * if we want to test an irregular scenario, ignoring errors caused by writing to stdin of the command can be uselful. * for example, when writing some text to stdin of cksum in a scenario where it doesn't consume this input, the child process might have exited before the text was written. therefore, this test sometimes fails with a 'Broken pipe'. --- tests/by-util/test_cksum.rs | 9 +++++++-- tests/common/util.rs | 29 ++++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/tests/by-util/test_cksum.rs b/tests/by-util/test_cksum.rs index 8b41c782c..1a0915cd5 100644 --- a/tests/by-util/test_cksum.rs +++ b/tests/by-util/test_cksum.rs @@ -35,14 +35,19 @@ fn test_empty() { } #[test] -#[ignore] fn test_arg_overrides_stdin() { let (at, mut ucmd) = at_and_ucmd!(); let input = "foobarfoobar"; at.touch("a"); - let result = ucmd.arg("a").pipe_in(input.as_bytes()).run(); + let result = ucmd + .arg("a") + .pipe_in(input.as_bytes()) + // the command might have exited before all bytes have been pipe in. + // in that case, we don't care about the error (broken pipe) + .ignore_stdin_write_error() + .run(); println!("{}, {}", result.stdout, result.stderr); diff --git a/tests/common/util.rs b/tests/common/util.rs index 8a09b71c1..d0f8083fd 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -33,6 +33,8 @@ static ALREADY_RUN: &str = " you have already run this UCommand, if you want to testing();"; static MULTIPLE_STDIN_MEANINGLESS: &str = "Ucommand is designed around a typical use case of: provide args and input stream -> spawn process -> block until completion -> return output streams. For verifying that a particular section of the input stream is what causes a particular behavior, use the Command type directly."; +static NO_STDIN_MEANINGLESS: &str = "Setting this flag has no effect if there is no stdin"; + /// Test if the program is running under CI pub fn is_ci() -> bool { std::env::var("CI") @@ -624,6 +626,7 @@ pub struct UCommand { tmpd: Option>, has_run: bool, stdin: Option>, + ignore_stdin_write_error: bool, } impl UCommand { @@ -653,6 +656,7 @@ impl UCommand { }, comm_string: String::from(arg.as_ref().to_str().unwrap()), stdin: None, + ignore_stdin_write_error: false, } } @@ -705,6 +709,17 @@ impl UCommand { self.pipe_in(contents) } + /// Ignores error caused by feeding stdin to the command. + /// This is typically useful to test non-standard workflows + /// like feeding something to a command that does not read it + pub fn ignore_stdin_write_error(&mut self) -> &mut UCommand { + if self.stdin.is_none() { + panic!("{}", NO_STDIN_MEANINGLESS); + } + self.ignore_stdin_write_error = true; + self + } + pub fn env(&mut self, key: K, val: V) -> &mut UCommand where K: AsRef, @@ -725,7 +740,7 @@ impl UCommand { } self.has_run = true; log_info("run", &self.comm_string); - let mut result = self + let mut child = self .raw .stdin(Stdio::piped()) .stdout(Stdio::piped()) @@ -734,15 +749,19 @@ impl UCommand { .unwrap(); if let Some(ref input) = self.stdin { - result + let write_result = child .stdin .take() .unwrap_or_else(|| panic!("Could not take child process stdin")) - .write_all(input) - .unwrap_or_else(|e| panic!("{}", e)); + .write_all(input); + if !self.ignore_stdin_write_error { + if let Err(e) = write_result { + panic!("failed to write to stdin of child: {}", e) + } + } } - result + child } /// Spawns the command, feeds the stdin if any, waits for the result From 1253323027e0b0f1d6adf204d5591f2fda1da9e4 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Fri, 9 Apr 2021 14:28:46 -0500 Subject: [PATCH 0304/1135] Various fixes and performance improvements --- src/uu/sort/src/sort.rs | 114 ++++++++++++------ tests/.DS_Store | Bin 0 -> 6148 bytes tests/by-util/test_sort.rs | 49 ++++++-- tests/fixtures/.DS_Store | Bin 0 -> 6148 bytes ...ars_numeric_unique_reverse_stable.expected | 20 +++ .../fixtures/sort/multiple_decimals.expected | 33 +++++ .../sort/multiple_decimals_general.txt | 35 ++++++ .../sort/multiple_decimals_numeric.txt | 35 ++++++ 8 files changed, 242 insertions(+), 44 deletions(-) create mode 100644 tests/.DS_Store create mode 100644 tests/fixtures/.DS_Store create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse_stable.expected create mode 100644 tests/fixtures/sort/multiple_decimals.expected create mode 100644 tests/fixtures/sort/multiple_decimals_general.txt create mode 100644 tests/fixtures/sort/multiple_decimals_numeric.txt diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 4e0e25d65..211f87672 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -22,6 +22,7 @@ use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; use rayon::prelude::*; use semver::Version; +use std::borrow::Cow; use std::cmp::Ordering; use std::collections::BinaryHeap; use std::env; @@ -262,7 +263,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(OPT_CHECK_SILENT) .short("C") .long(OPT_CHECK_SILENT) - .help("exit successfully if the given file is already sorted, and exit with status 1 otherwise. "), + .help("exit successfully if the given file is already sorted, and exit with status 1 otherwise."), ) .arg( Arg::with_name(OPT_IGNORE_CASE) @@ -353,7 +354,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if let Ok(n) = line { files.push( std::str::from_utf8(&n) - .expect("Could not parse zero terminated string from input.") + .expect("Could not parse string from zero terminated input.") .to_string(), ); } @@ -488,6 +489,8 @@ fn exec(files: Vec, settings: &mut Settings) -> i32 { } else { print_sorted(file_merger, &settings) } + } else if settings.mode == SortMode::Default && settings.unique { + print_sorted(lines.iter().dedup(), &settings) } else if settings.mode == SortMode::Month && settings.unique { print_sorted( lines @@ -499,7 +502,7 @@ fn exec(files: Vec, settings: &mut Settings) -> i32 { print_sorted( lines .iter() - .dedup_by(|a, b| get_nums_dedup(a) == get_nums_dedup(b)), + .dedup_by(|a, b| get_num_dedup(a, &settings) == get_num_dedup(b, &settings)), &settings, ) } else { @@ -603,12 +606,13 @@ fn default_compare(a: &str, b: &str) -> Ordering { #[inline(always)] fn leading_num_common(a: &str) -> &str { let mut s = ""; + + // check whether char is numeric, whitespace or decimal point or thousand seperator for (idx, c) in a.char_indices() { - // check whether char is numeric, whitespace or decimal point or thousand seperator if !c.is_numeric() && !c.is_whitespace() - && !c.eq(&DECIMAL_PT) && !c.eq(&THOUSANDS_SEP) + && !c.eq(&DECIMAL_PT) // check for e notation && !c.eq(&'e') && !c.eq(&'E') @@ -621,7 +625,7 @@ fn leading_num_common(a: &str) -> &str { break; } // If line is not a number line, return the line as is - s = a; + s = &a; } s } @@ -633,16 +637,17 @@ fn leading_num_common(a: &str) -> &str { // not recognize a positive sign or scientific/E notation so we strip those elements here. fn get_leading_num(a: &str) -> &str { let mut s = ""; - let b = leading_num_common(a); - // GNU numeric sort doesn't recognize '+' or 'e' notation so we strip - for (idx, c) in b.char_indices() { - if c.eq(&'e') || c.eq(&'E') || b.chars().nth(0).unwrap_or('\0').eq(&POSITIVE) { - s = &b[..idx]; + let a = leading_num_common(a); + + // GNU numeric sort doesn't recognize '+' or 'e' notation so we strip trailing chars + for (idx, c) in a.char_indices() { + if c.eq(&'e') || c.eq(&'E') || a.chars().nth(0).unwrap_or('\0').eq(&POSITIVE) { + s = &a[..idx]; break; } // If no further processing needed to be done, return the line as-is to be sorted - s = b; + s = &a; } // And empty number or non-number lines are to be treated as ‘0’ but only for numeric sort @@ -657,30 +662,32 @@ fn get_leading_num(a: &str) -> &str { // In contrast to numeric compare, GNU general numeric/FP sort *should* recognize positive signs and // scientific notation, so we strip those lines only after the end of the following numeric string. // For example, 5e10KFD would be 5e10 or 5x10^10 and +10000HFKJFK would become 10000. -fn get_leading_gen(a: &str) -> String { +fn get_leading_gen(a: &str) -> &str { // Make this iter peekable to see if next char is numeric - let mut p_iter = leading_num_common(a).chars().peekable(); - let mut r = String::new(); + let raw_leading_num = leading_num_common(a); + let mut p_iter = raw_leading_num.chars().peekable(); + let mut result = ""; // Cleanup raw stripped strings for c in p_iter.to_owned() { let next_char_numeric = p_iter.peek().unwrap_or(&'\0').is_numeric(); - // Only general numeric recognizes e notation and, see block below, the '+' sign - if (c.eq(&'e') && !next_char_numeric) || (c.eq(&'E') && !next_char_numeric) { - r = a.split(c).next().unwrap_or("").to_owned(); + // Only general numeric recognizes e notation and the '+' sign + if (c.eq(&'e') && !next_char_numeric) + || (c.eq(&'E') && !next_char_numeric) + // Only GNU (non-general) numeric recognize thousands seperators, takes only leading # + || c.eq(&THOUSANDS_SEP) + { + result = a.split(c).next().unwrap_or(""); break; // If positive sign and next char is not numeric, split at postive sign at keep trailing numbers // There is a more elegant way to do this in Rust 1.45, std::str::strip_prefix } else if c.eq(&POSITIVE) && !next_char_numeric { - let mut v: Vec<&str> = a.split(c).collect(); - let x = v.split_off(1); - r = x.join(""); + result = a.trim().trim_start_matches('+'); break; - // If no further processing needed to be done, return the line as-is to be sorted - } else { - r = a.to_owned(); } + // If no further processing needed to be done, return the line as-is to be sorted + result = a; } - r + result } fn get_months_dedup(a: &str) -> String { @@ -714,10 +721,10 @@ fn get_months_dedup(a: &str) -> String { } } -// *For all dedups/uniques we must compare leading numbers* +// *For all dedups/uniques expect default we must compare leading numbers* // Also note numeric compare and unique output is specifically *not* the same as a "sort | uniq" // See: https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html -fn get_nums_dedup(a: &str) -> &str { +fn get_num_dedup<'a>(a: &'a str, settings: &&mut Settings) -> &'a str { // Trim and remove any leading zeros let s = a.trim().trim_start_matches('0'); @@ -731,20 +738,50 @@ fn get_nums_dedup(a: &str) -> &str { "" // Prepare lines for comparison of only the numerical leading numbers } else { - get_leading_num(s) + let result = match settings.mode { + SortMode::Numeric => get_leading_num(s), + SortMode::GeneralNumeric => get_leading_gen(s), + SortMode::HumanNumeric => get_leading_num(s), + SortMode::Version => get_leading_num(s), + _ => s, + }; + result + } +} + +#[inline(always)] +fn remove_thousands_sep<'a, S: Into>>(input: S) -> Cow<'a, str> { + let input = input.into(); + if input.contains(THOUSANDS_SEP) { + let output = input.replace(THOUSANDS_SEP, ""); + Cow::Owned(output) + } else { + input + } +} + +#[inline(always)] +fn remove_trailing_dec<'a, S: Into>>(input: S) -> Cow<'a, str> { + let input = input.into(); + if let Some(s) = input.find(DECIMAL_PT) { + let (leading, trailing) = input.split_at(s); + let output = [leading, ".", trailing.replace(DECIMAL_PT, "").as_str()].concat(); + Cow::Owned(output) + } else { + input } } /// Parse the beginning string into an f64, returning -inf instead of NaN on errors. #[inline(always)] fn permissive_f64_parse(a: &str) -> f64 { - // Remove thousands seperators - let a = a.replace(THOUSANDS_SEP, ""); - // GNU sort treats "NaN" as non-number in numeric, so it needs special care. // *Keep this trim before parse* despite what POSIX may say about -b and -n // because GNU and BSD both seem to require it to match their behavior - match a.trim().parse::() { + // + // Remove any trailing decimals, ie 4568..890... becomes 4568.890 + // Then, we trim whitespace and parse + match remove_trailing_dec(a).trim().parse::() { Ok(a) if a.is_nan() => std::f64::NEG_INFINITY, Ok(a) => a, Err(_) => std::f64::NEG_INFINITY, @@ -757,8 +794,13 @@ fn numeric_compare(a: &str, b: &str) -> Ordering { let sa = get_leading_num(a); let sb = get_leading_num(b); - let fa = permissive_f64_parse(sa); - let fb = permissive_f64_parse(sb); + // Avoids a string alloc for every line to remove thousands seperators here + // instead of inside the get_leading_num function, which is a HUGE performance benefit + let ta = remove_thousands_sep(sa); + let tb = remove_thousands_sep(sb); + + let fa = permissive_f64_parse(&ta); + let fb = permissive_f64_parse(&tb); // f64::cmp isn't implemented (due to NaN issues); implement directly instead if fa > fb { @@ -799,8 +841,8 @@ fn general_numeric_compare(a: &str, b: &str) -> Ordering { // these types of numbers, we rarely care about pure performance. fn human_numeric_convert(a: &str) -> f64 { let num_str = get_leading_num(a); - let suffix = a.trim_start_matches(num_str); - let num_part = permissive_f64_parse(num_str); + let suffix = a.trim_start_matches(&num_str); + let num_part = permissive_f64_parse(&num_str); let suffix: f64 = match suffix.parse().unwrap_or('\0') { // SI Units 'K' => 1E3, diff --git a/tests/.DS_Store b/tests/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmZQzU|@7AO)+F(5MW?n;9!8z45|!R0Z1N%F(jFgL>QrFAPJ2!M?+vV1V%$(Gz3ON zU^D~25V%SxcdJP zRior+2#kinunYl47MEZbCs3t{!+W4QHvuXKVuPw;Mo^s$(F3lEVT}ML$bg~*R5_@+ b2Uo?6kTwK}57Iu`5P${HC_Nei0}uiLNUI8I literal 0 HcmV?d00001 diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 43aaf1da1..6455d837b 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -1,5 +1,31 @@ use crate::common::util::*; +fn test_helper(file_name: &str, args: &str) { + new_ucmd!() + .arg(args) + .arg(format!("{}.txt", file_name)) + .succeeds() + .stdout_is_fixture(format!("{}.expected", file_name)); +} + +#[test] +fn test_multiple_decimals_general() { + new_ucmd!() + .arg("-g") + .arg("multiple_decimals_general.txt") + .succeeds() + .stdout_is("\n\n\n\n\n\n\n\nCARAvan\n-2028789030\n-896689\n-8.90880\n-1\n-.05\n000\n00000001\n1\n1.040000000\n1.444\n1.58590\n8.013\n45\n46.89\n576,446.88800000\n576,446.890\n 4567.\n4567.1\n4567.34\n\t\t\t\t\t\t\t\t\t\t4567..457\n\t\t\t\t37800\n\t\t\t\t\t\t45670.89079.098\n\t\t\t\t\t\t45670.89079.1\n4798908.340000000000\n4798908.45\n4798908.8909800\n"); +} + +#[test] +fn test_multiple_decimals_numeric() { + new_ucmd!() + .arg("-n") + .arg("multiple_decimals_numeric.txt") + .succeeds() + .stdout_is("-2028789030\n-896689\n-8.90880\n-1\n-.05\n\n\n\n\n\n\n\n\n000\nCARAvan\n00000001\n1\n1.040000000\n1.444\n1.58590\n8.013\n45\n46.89\n 4567.\n4567.1\n4567.34\n\t\t\t\t\t\t\t\t\t\t4567..457\n\t\t\t\t37800\n\t\t\t\t\t\t45670.89079.098\n\t\t\t\t\t\t45670.89079.1\n576,446.88800000\n576,446.890\n4798908.340000000000\n4798908.45\n4798908.8909800\n"); +} + #[test] fn test_check_zero_terminated_failure() { new_ucmd!() @@ -44,6 +70,21 @@ fn test_random_shuffle_contains_all_lines() { assert_eq!(result_sorted, expected); } +#[test] +fn test_random_shuffle_two_runs_not_the_same() { + // check to verify that two random shuffles are not equal; this has the + // potential to fail in the very unlikely event that the random order is the same + // as the starting order, or if both random sorts end up having the same order. + const FILE: &'static str = "default_unsorted_ints.expected"; + let (at, _ucmd) = at_and_ucmd!(); + let result = new_ucmd!().arg("-R").arg(FILE).run().stdout; + let expected = at.read(FILE); + let unexpected = new_ucmd!().arg("-R").arg(FILE).run().stdout; + + assert_ne!(result, expected); + assert_ne!(result, unexpected); +} + #[test] fn test_random_shuffle_contains_two_runs_not_the_same() { // check to verify that two random shuffles are not equal; this has the @@ -355,11 +396,3 @@ fn test_check_silent() { .fails() .stdout_is(""); } - -fn test_helper(file_name: &str, args: &str) { - new_ucmd!() - .arg(args) - .arg(format!("{}{}", file_name, ".txt")) - .succeeds() - .stdout_is_fixture(format!("{}{}", file_name, ".expected")); -} diff --git a/tests/fixtures/.DS_Store b/tests/fixtures/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..607a7386a75b94e7df52bcee971a48217dc92331 GIT binary patch literal 6148 zcmZQzU|@7AO)+F(5MW?n;9!8zOq>i@0Z1N%F(jFwA|RR(WJXeXaY0f}ei8!%!%3*z zC^fi402FsD48;uj3`Gnj$nlp{kds+lVqkEck%^gwm5rSP1b8`OgER8WgG&-iN{gKm zi=siifW(rFBq%#1KR*Y~PD~2ROf8QW5OL1WD@n}EODzH^56(kXDc!NGpg2X=Pvp zvB2_RtqhC|5Uq^hZU_SdBe+WfqQTl37#YCY85kMB+8JQ&JVuCi21bZ>21aNPg%Q-F z0htfc&cF!K4s+fpJsJX|Api{lW(X|+s{dUX7;yFfA*x2n(GVC7fngZ}j4Up}E>56I z6NmRebuFkqO@PXSYJX65%m}Kd5n|w~mEQChs K(GZ}22mk;)qfplX literal 0 HcmV?d00001 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse_stable.expected b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse_stable.expected new file mode 100644 index 000000000..bbce16934 --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse_stable.expected @@ -0,0 +1,20 @@ +4798908.8909800 +4798908.45 +4798908.340000000000 +576,446.890 +576,446.88800000 + 37800 + 4567. +46.89 +45 +8.013 +1.58590 +1.444 +1.040000000 +1 + +-.05 +-1 +-8.90880 +-896689 +-2028789030 diff --git a/tests/fixtures/sort/multiple_decimals.expected b/tests/fixtures/sort/multiple_decimals.expected new file mode 100644 index 000000000..6afbdcaa0 --- /dev/null +++ b/tests/fixtures/sort/multiple_decimals.expected @@ -0,0 +1,33 @@ +-2028789030 +-896689 +-8.90880 +-1 +-.05 + + + + + + + + +000 +CARAvan +00000001 +1 +1.040000000 +1.444 +1.58590 +8.013 +45 +46.89 + 4567..457 + 4567. +4567.1 +4567.34 + 37800 +576,446.88800000 +576,446.890 +4798908.340000000000 +4798908.45 +4798908.8909800 diff --git a/tests/fixtures/sort/multiple_decimals_general.txt b/tests/fixtures/sort/multiple_decimals_general.txt new file mode 100644 index 000000000..4e65ecfda --- /dev/null +++ b/tests/fixtures/sort/multiple_decimals_general.txt @@ -0,0 +1,35 @@ +576,446.890 +576,446.88800000 + +4567.1 + 4567..457 + 45670.89079.1 + 45670.89079.098 +4567.34 + 4567. +45 +46.89 +-1 +1 +00000001 +4798908.340000000000 +4798908.45 +4798908.8909800 + + + 37800 + +-2028789030 +-896689 +CARAvan + +-8.90880 +-.05 +1.444 +1.58590 +1.040000000 + +8.013 + +000 + diff --git a/tests/fixtures/sort/multiple_decimals_numeric.txt b/tests/fixtures/sort/multiple_decimals_numeric.txt new file mode 100644 index 000000000..4e65ecfda --- /dev/null +++ b/tests/fixtures/sort/multiple_decimals_numeric.txt @@ -0,0 +1,35 @@ +576,446.890 +576,446.88800000 + +4567.1 + 4567..457 + 45670.89079.1 + 45670.89079.098 +4567.34 + 4567. +45 +46.89 +-1 +1 +00000001 +4798908.340000000000 +4798908.45 +4798908.8909800 + + + 37800 + +-2028789030 +-896689 +CARAvan + +-8.90880 +-.05 +1.444 +1.58590 +1.040000000 + +8.013 + +000 + From a9209049bf586ce40008d6a1151d2f21adef3c10 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 9 Apr 2021 22:18:52 +0200 Subject: [PATCH 0305/1135] fix a typo Co-authored-by: Michael Debertol --- src/uu/sort/src/sort.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 211f87672..4aa3fbed2 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -607,7 +607,7 @@ fn default_compare(a: &str, b: &str) -> Ordering { fn leading_num_common(a: &str) -> &str { let mut s = ""; - // check whether char is numeric, whitespace or decimal point or thousand seperator + // check whether char is numeric, whitespace or decimal point or thousand separator for (idx, c) in a.char_indices() { if !c.is_numeric() && !c.is_whitespace() From c54b5f2d8220317323f5ab2d6b3643380629f758 Mon Sep 17 00:00:00 2001 From: joppich Date: Thu, 1 Apr 2021 09:44:24 +0200 Subject: [PATCH 0306/1135] stdbuf: move from getopts to clap --- Cargo.lock | 2 +- src/uu/stdbuf/Cargo.toml | 2 +- src/uu/stdbuf/src/stdbuf.rs | 253 +++++++++++++++-------------------- tests/by-util/test_stdbuf.rs | 74 ++++++++-- 4 files changed, 175 insertions(+), 156 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e094f1f48..9dfeba336 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2316,7 +2316,7 @@ dependencies = [ name = "uu_stdbuf" version = "0.0.6" dependencies = [ - "getopts", + "clap", "tempfile", "uu_stdbuf_libstdbuf", "uucore", diff --git a/src/uu/stdbuf/Cargo.toml b/src/uu/stdbuf/Cargo.toml index 22ce4de6a..884a98785 100644 --- a/src/uu/stdbuf/Cargo.toml +++ b/src/uu/stdbuf/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/stdbuf.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" tempfile = "3.1" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 67ed9a838..a6c9f9dc5 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -10,7 +10,8 @@ #[macro_use] extern crate uucore; -use getopts::{Matches, Options}; +use clap::{App, AppSettings, Arg, ArgMatches}; +use std::convert::TryFrom; use std::fs::File; use std::io::{self, Write}; use std::os::unix::process::ExitStatusExt; @@ -19,8 +20,35 @@ use std::process::Command; use tempfile::tempdir; use tempfile::TempDir; -static NAME: &str = "stdbuf"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = + "Run COMMAND, with modified buffering operations for its standard streams.\n\n\ + Mandatory arguments to long options are mandatory for short options too."; +static LONG_HELP: &str = "If MODE is 'L' the corresponding stream will be line buffered.\n\ + This option is invalid with standard input.\n\n\ + If MODE is '0' the corresponding stream will be unbuffered.\n\n\ + Otherwise MODE is a number which may be followed by one of the following:\n\n\ + KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.\n\ + In this case the corresponding stream will be fully buffered with the buffer size set to \ + MODE bytes.\n\n\ + NOTE: If COMMAND adjusts the buffering of its standard streams ('tee' does for e.g.) then \ + that will override corresponding settings changed by 'stdbuf'.\n\ + Also some filters (like 'dd' and 'cat' etc.) don't use streams for I/O, \ + and are thus unaffected by 'stdbuf' settings.\n"; + +mod options { + pub const INPUT: &str = "input"; + pub const INPUT_SHORT: &str = "i"; + pub const OUTPUT: &str = "output"; + pub const OUTPUT_SHORT: &str = "o"; + pub const ERROR: &str = "error"; + pub const ERROR_SHORT: &str = "e"; + pub const COMMAND: &str = "command"; +} + +fn get_usage() -> String { + format!("{0} OPTION... COMMAND", executable!()) +} const STDBUF_INJECT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/libstdbuf.so")); @@ -36,16 +64,19 @@ struct ProgramOptions { stderr: BufferType, } -enum ErrMsg { - Retry, - Fatal, +impl<'a> TryFrom<&ArgMatches<'a>> for ProgramOptions { + type Error = ProgramOptionsError; + + fn try_from(matches: &ArgMatches) -> Result { + Ok(ProgramOptions { + stdin: check_option(&matches, options::INPUT)?, + stdout: check_option(&matches, options::OUTPUT)?, + stderr: check_option(&matches, options::ERROR)?, + }) + } } -enum OkMsg { - Buffering, - Help, - Version, -} +struct ProgramOptionsError(String); #[cfg(any( target_os = "linux", @@ -73,31 +104,6 @@ fn preload_strings() -> (&'static str, &'static str) { crash!(1, "Command not supported for this operating system!") } -fn print_version() { - println!("{} {}", NAME, VERSION); -} - -fn print_usage(opts: &Options) { - let brief = "Run COMMAND, with modified buffering operations for its standard streams\n \ - Mandatory arguments to long options are mandatory for short options too."; - let explanation = "If MODE is 'L' the corresponding stream will be line buffered.\n \ - This option is invalid with standard input.\n\n \ - If MODE is '0' the corresponding stream will be unbuffered.\n\n \ - Otherwise MODE is a number which may be followed by one of the following:\n\n \ - KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.\n \ - In this case the corresponding stream will be fully buffered with the buffer size set to \ - MODE bytes.\n\n \ - NOTE: If COMMAND adjusts the buffering of its standard streams ('tee' does for e.g.) then \ - that will override corresponding settings changed by 'stdbuf'.\n \ - Also some filters (like 'dd' and 'cat' etc.) don't use streams for I/O, \ - and are thus unaffected by 'stdbuf' settings.\n"; - println!("{} {}", NAME, VERSION); - println!(); - println!("Usage: stdbuf OPTION... COMMAND"); - println!(); - println!("{}\n{}", opts.usage(brief), explanation); -} - fn parse_size(size: &str) -> Option { let ext = size.trim_start_matches(|c: char| c.is_digit(10)); let num = size.trim_end_matches(char::is_alphabetic); @@ -133,65 +139,30 @@ fn parse_size(size: &str) -> Option { Some(buf_size * base.pow(power)) } -fn check_option(matches: &Matches, name: &str, modified: &mut bool) -> Option { - match matches.opt_str(name) { - Some(value) => { - *modified = true; - match &value[..] { - "L" => { - if name == "input" { - show_info!("line buffering stdin is meaningless"); - None - } else { - Some(BufferType::Line) - } - } - x => { - let size = match parse_size(x) { - Some(m) => m, - None => { - show_error!("Invalid mode {}", x); - return None; - } - }; - Some(BufferType::Size(size)) +fn check_option(matches: &ArgMatches, name: &str) -> Result { + match matches.value_of(name) { + Some(value) => match &value[..] { + "L" => { + if name == options::INPUT { + Err(ProgramOptionsError(format!( + "line buffering stdin is meaningless" + ))) + } else { + Ok(BufferType::Line) } } - } - None => Some(BufferType::Default), + x => { + let size = match parse_size(x) { + Some(m) => m, + None => return Err(ProgramOptionsError(format!("invalid mode {}", x))), + }; + Ok(BufferType::Size(size)) + } + }, + None => Ok(BufferType::Default), } } -fn parse_options( - args: &[String], - options: &mut ProgramOptions, - optgrps: &Options, -) -> Result { - let matches = match optgrps.parse(args) { - Ok(m) => m, - Err(_) => return Err(ErrMsg::Retry), - }; - if matches.opt_present("help") { - return Ok(OkMsg::Help); - } - if matches.opt_present("version") { - return Ok(OkMsg::Version); - } - let mut modified = false; - options.stdin = check_option(&matches, "input", &mut modified).ok_or(ErrMsg::Fatal)?; - options.stdout = check_option(&matches, "output", &mut modified).ok_or(ErrMsg::Fatal)?; - options.stderr = check_option(&matches, "error", &mut modified).ok_or(ErrMsg::Fatal)?; - - if matches.free.len() != 1 { - return Err(ErrMsg::Retry); - } - if !modified { - show_error!("you must specify a buffering mode option"); - return Err(ErrMsg::Fatal); - } - Ok(OkMsg::Buffering) -} - fn set_command_env(command: &mut Command, buffer_name: &str, buffer_type: BufferType) { match buffer_type { BufferType::Size(m) => { @@ -215,72 +186,62 @@ fn get_preload_env(tmp_dir: &mut TempDir) -> io::Result<(String, PathBuf)> { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let mut opts = Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(LONG_HELP) + .setting(AppSettings::TrailingVarArg) + .arg( + Arg::with_name(options::INPUT) + .long(options::INPUT) + .short(options::INPUT_SHORT) + .help("adjust standard input stream buffering") + .value_name("MODE") + .required_unless_one(&[options::OUTPUT, options::ERROR]), + ) + .arg( + Arg::with_name(options::OUTPUT) + .long(options::OUTPUT) + .short(options::OUTPUT_SHORT) + .help("adjust standard output stream buffering") + .value_name("MODE") + .required_unless_one(&[options::INPUT, options::ERROR]), + ) + .arg( + Arg::with_name(options::ERROR) + .long(options::ERROR) + .short(options::ERROR_SHORT) + .help("adjust standard error stream buffering") + .value_name("MODE") + .required_unless_one(&[options::INPUT, options::OUTPUT]), + ) + .arg( + Arg::with_name(options::COMMAND) + .multiple(true) + .takes_value(true) + .hidden(true) + .required(true), + ) + .get_matches_from(args); - opts.optopt( - "i", - "input", - "adjust standard input stream buffering", - "MODE", - ); - opts.optopt( - "o", - "output", - "adjust standard output stream buffering", - "MODE", - ); - opts.optopt( - "e", - "error", - "adjust standard error stream buffering", - "MODE", - ); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); + let options = ProgramOptions::try_from(&matches) + .unwrap_or_else(|e| crash!(125, "{}\nTry 'stdbuf --help' for more information.", e.0)); - let mut options = ProgramOptions { - stdin: BufferType::Default, - stdout: BufferType::Default, - stderr: BufferType::Default, - }; - let mut command_idx: i32 = -1; - for i in 1..=args.len() { - match parse_options(&args[1..i], &mut options, &opts) { - Ok(OkMsg::Buffering) => { - command_idx = (i as i32) - 1; - break; - } - Ok(OkMsg::Help) => { - print_usage(&opts); - return 0; - } - Ok(OkMsg::Version) => { - print_version(); - return 0; - } - Err(ErrMsg::Fatal) => break, - Err(ErrMsg::Retry) => continue, - } - } - if command_idx == -1 { - crash!( - 125, - "Invalid options\nTry 'stdbuf --help' for more information." - ); - } - let command_name = &args[command_idx as usize]; - let mut command = Command::new(command_name); + let mut command_values = matches.values_of::<&str>(options::COMMAND).unwrap(); + let mut command = Command::new(command_values.next().unwrap()); + let command_params: Vec<&str> = command_values.collect(); let mut tmp_dir = tempdir().unwrap(); let (preload_env, libstdbuf) = return_if_err!(1, get_preload_env(&mut tmp_dir)); - command - .args(&args[(command_idx as usize) + 1..]) - .env(preload_env, libstdbuf); + command.env(preload_env, libstdbuf); set_command_env(&mut command, "_STDBUF_I", options.stdin); set_command_env(&mut command, "_STDBUF_O", options.stdout); set_command_env(&mut command, "_STDBUF_E", options.stderr); + command.args(command_params); + let mut process = match command.spawn() { Ok(p) => p, Err(e) => crash!(1, "failed to execute process: {}", e), diff --git a/tests/by-util/test_stdbuf.rs b/tests/by-util/test_stdbuf.rs index 9adb0cfda..61fa36977 100644 --- a/tests/by-util/test_stdbuf.rs +++ b/tests/by-util/test_stdbuf.rs @@ -1,13 +1,71 @@ +#[cfg(not(target_os = "windows"))] use crate::common::util::*; +#[cfg(not(target_os = "windows"))] #[test] fn test_stdbuf_unbuffered_stdout() { - if cfg!(target_os = "linux") { - // This is a basic smoke test - new_ucmd!() - .args(&["-o0", "head"]) - .pipe_in("The quick brown fox jumps over the lazy dog.") - .run() - .stdout_is("The quick brown fox jumps over the lazy dog."); - } + // This is a basic smoke test + new_ucmd!() + .args(&["-o0", "head"]) + .pipe_in("The quick brown fox jumps over the lazy dog.") + .run() + .stdout_is("The quick brown fox jumps over the lazy dog."); +} + +#[cfg(not(target_os = "windows"))] +#[test] +fn test_stdbuf_line_buffered_stdout() { + new_ucmd!() + .args(&["-oL", "head"]) + .pipe_in("The quick brown fox jumps over the lazy dog.") + .run() + .stdout_is("The quick brown fox jumps over the lazy dog."); +} + +#[cfg(not(target_os = "windows"))] +#[test] +fn test_stdbuf_no_buffer_option_fails() { + new_ucmd!() + .args(&["head"]) + .pipe_in("The quick brown fox jumps over the lazy dog.") + .fails() + .stderr_is( + "error: The following required arguments were not provided:\n \ + --error \n \ + --input \n \ + --output \n\n\ + USAGE:\n \ + stdbuf OPTION... COMMAND\n\n\ + For more information try --help", + ); +} + +#[cfg(not(target_os = "windows"))] +#[test] +fn test_stdbuf_trailing_var_arg() { + new_ucmd!() + .args(&["-i", "1024", "tail", "-1"]) + .pipe_in("The quick brown fox\njumps over the lazy dog.") + .run() + .stdout_is("jumps over the lazy dog."); +} + +#[cfg(not(target_os = "windows"))] +#[test] +fn test_stdbuf_line_buffering_stdin_fails() { + new_ucmd!() + .args(&["-i", "L", "head"]) + .pipe_in("The quick brown fox jumps over the lazy dog.") + .fails() + .stderr_is("stdbuf: error: line buffering stdin is meaningless\nTry 'stdbuf --help' for more information."); +} + +#[cfg(not(target_os = "windows"))] +#[test] +fn test_stdbuf_invalid_mode_fails() { + new_ucmd!() + .args(&["-i", "1024R", "head"]) + .pipe_in("The quick brown fox jumps over the lazy dog.") + .fails() + .stderr_is("stdbuf: error: invalid mode 1024R\nTry 'stdbuf --help' for more information."); } From 18191f9212bfa61b333a4ace437a02c493c1d67f Mon Sep 17 00:00:00 2001 From: Aleksandar Janicijevic Date: Sat, 10 Apr 2021 04:41:59 -0400 Subject: [PATCH 0307/1135] shred: Implemented --force option (#2012) --- src/uu/shred/src/shred.rs | 67 ++++++++++++++++++++++++++++++------- tests/by-util/test_shred.rs | 52 +++++++++++++++++++++++++++- tests/common/util.rs | 7 ++++ 3 files changed, 112 insertions(+), 14 deletions(-) diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index d5f910297..7e0e77184 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -259,6 +259,7 @@ static AFTER_HELP: &str = "; pub mod options { + pub const FORCE: &str = "force"; pub const FILE: &str = "file"; pub const ITERATIONS: &str = "iterations"; pub const SIZE: &str = "size"; @@ -278,6 +279,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .after_help(AFTER_HELP) .usage(&usage[..]) + .arg( + Arg::with_name(options::FORCE) + .long(options::FORCE) + .short("f") + .help("change permissions to allow writing if necessary"), + ) .arg( Arg::with_name(options::ITERATIONS) .long(options::ITERATIONS) @@ -354,8 +361,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // TODO: implement --random-source - // TODO: implement --force - + let force = matches.is_present(options::FORCE); let remove = matches.is_present(options::REMOVE); let size_arg = match matches.value_of(options::SIZE) { Some(s) => Some(s.to_string()), @@ -375,7 +381,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } for path_str in matches.values_of(options::FILE).unwrap() { - wipe_file(&path_str, iterations, remove, size, exact, zero, verbose); + wipe_file( + &path_str, iterations, remove, size, exact, zero, verbose, force, + ); } 0 @@ -439,18 +447,40 @@ fn wipe_file( exact: bool, zero: bool, verbose: bool, + force: bool, ) { // Get these potential errors out of the way first let path: &Path = Path::new(path_str); if !path.exists() { - println!("{}: {}: No such file or directory", NAME, path.display()); + show_error!("{}: No such file or directory", path.display()); return; } if !path.is_file() { - println!("{}: {}: Not a file", NAME, path.display()); + show_error!("{}: Not a file", path.display()); return; } + // If force is true, set file permissions to not-readonly. + if force { + let metadata = match fs::metadata(path) { + Ok(m) => m, + Err(e) => { + show_error!("{}", e); + return; + } + }; + + let mut perms = metadata.permissions(); + perms.set_readonly(false); + match fs::set_permissions(path, perms) { + Err(e) => { + show_error!("{}", e); + return; + } + _ => {} + } + } + // Fill up our pass sequence let mut pass_sequence: Vec = Vec::new(); @@ -489,11 +519,13 @@ fn wipe_file( { let total_passes: usize = pass_sequence.len(); - let mut file: File = OpenOptions::new() - .write(true) - .truncate(false) - .open(path) - .expect("Failed to open file for writing"); + let mut file: File = match OpenOptions::new().write(true).truncate(false).open(path) { + Ok(f) => f, + Err(e) => { + show_error!("{}: failed to open for writing: {}", path.display(), e); + return; + } + }; // NOTE: it does not really matter what we set for total_bytes and gen_type here, so just // use bogus values @@ -523,14 +555,23 @@ fn wipe_file( } } // size is an optional argument for exactly how many bytes we want to shred - do_pass(&mut file, path, &mut generator, *pass_type, size) - .expect("File write pass failed"); + match do_pass(&mut file, path, &mut generator, *pass_type, size) { + Ok(_) => {} + Err(e) => { + show_error!("{}: File write pass failed: {}", path.display(), e); + } + } // Ignore failed writes; just keep trying } } if remove { - do_remove(path, path_str, verbose).expect("Failed to remove file"); + match do_remove(path, path_str, verbose) { + Ok(_) => {} + Err(e) => { + show_error!("{}: failed to remove file: {}", path.display(), e); + } + } } } diff --git a/tests/by-util/test_shred.rs b/tests/by-util/test_shred.rs index 651491045..de54fae5b 100644 --- a/tests/by-util/test_shred.rs +++ b/tests/by-util/test_shred.rs @@ -1 +1,51 @@ -// ToDO: add tests +use crate::common::util::*; + +#[test] +fn test_shred_remove() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let file_a = "test_shred_remove_a"; + let file_b = "test_shred_remove_b"; + + // Create file_a and file_b. + at.touch(file_a); + at.touch(file_b); + + // Shred file_a. + scene.ucmd().arg("-u").arg(file_a).run(); + + // file_a was deleted, file_b exists. + assert!(!at.file_exists(file_a)); + assert!(at.file_exists(file_b)); +} + +#[cfg(not(target_os = "freebsd"))] +#[test] +fn test_shred_force() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let file = "test_shred_force"; + + // Create file_a. + at.touch(file); + assert!(at.file_exists(file)); + + // Make file_a readonly. + at.set_readonly(file); + + // Try shred -u. + let result = scene.ucmd().arg("-u").arg(file).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + + // file_a was not deleted because it is readonly. + assert!(at.file_exists(file)); + + // Try shred -u -f. + scene.ucmd().arg("-u").arg("-f").arg(file).run(); + + // file_a was deleted. + assert!(!at.file_exists(file)); +} diff --git a/tests/common/util.rs b/tests/common/util.rs index 8a09b71c1..13c58747d 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -351,6 +351,13 @@ impl AtPath { String::from(self.minus(name).to_str().unwrap()) } + pub fn set_readonly(&self, name: &str) { + let metadata = fs::metadata(self.plus(name)).unwrap(); + let mut permissions = metadata.permissions(); + permissions.set_readonly(true); + fs::set_permissions(self.plus(name), permissions).unwrap(); + } + pub fn open(&self, name: &str) -> File { log_info("open", self.plus_as_string(name)); File::open(self.plus(name)).unwrap() From 698924a20a66568b13b360cb7d0f1677c9be659f Mon Sep 17 00:00:00 2001 From: Nicolas Thery Date: Sat, 10 Apr 2021 11:50:21 +0200 Subject: [PATCH 0308/1135] unlink: move from getopts to clap (#2052) (#2058) --- Cargo.lock | 2 +- src/uu/unlink/Cargo.toml | 2 +- src/uu/unlink/src/unlink.rs | 63 +++++++++++++++---------------------- 3 files changed, 28 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e094f1f48..0af3a8222 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2500,7 +2500,7 @@ dependencies = [ name = "uu_unlink" version = "0.0.6" dependencies = [ - "getopts", + "clap", "libc", "uucore", "uucore_procs", diff --git a/src/uu/unlink/Cargo.toml b/src/uu/unlink/Cargo.toml index b193bd1b5..08da2624e 100644 --- a/src/uu/unlink/Cargo.toml +++ b/src/uu/unlink/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/unlink.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/unlink/src/unlink.rs b/src/uu/unlink/src/unlink.rs index b85b6ea94..26460e59c 100644 --- a/src/uu/unlink/src/unlink.rs +++ b/src/uu/unlink/src/unlink.rs @@ -12,59 +12,53 @@ #[macro_use] extern crate uucore; -use getopts::Options; +use clap::{App, Arg}; use libc::{lstat, stat, unlink}; use libc::{S_IFLNK, S_IFMT, S_IFREG}; use std::ffi::CString; use std::io::{Error, ErrorKind}; -static NAME: &str = "unlink"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Unlink the file at [FILE]."; +static OPT_PATH: &str = "FILE"; + +fn get_usage() -> String { + format!("{} [OPTION]... FILE", executable!()) +} pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = Options::new(); + let usage = get_usage(); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg(Arg::with_name(OPT_PATH).hidden(true).multiple(true)) + .get_matches_from(args); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "invalid options\n{}", f), - }; + let paths: Vec = matches + .values_of(OPT_PATH) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(); - println!("Usage:"); - println!(" {} [FILE]... [OPTION]...", NAME); - println!(); - println!("{}", opts.usage("Unlink the file at [FILE].")); - return 0; - } - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - if matches.free.is_empty() { + if paths.is_empty() { crash!( 1, "missing operand\nTry '{0} --help' for more information.", - NAME + executable!() ); - } else if matches.free.len() > 1 { + } else if paths.len() > 1 { crash!( 1, "extra operand: '{1}'\nTry '{0} --help' for more information.", - NAME, - matches.free[1] + executable!(), + paths[1] ); } - let c_string = CString::new(matches.free[0].clone()).unwrap(); // unwrap() cannot fail, the string comes from argv so it cannot contain a \0. + let c_string = CString::new(paths[0].clone()).unwrap(); // unwrap() cannot fail, the string comes from argv so it cannot contain a \0. let st_mode = { #[allow(deprecated)] @@ -72,12 +66,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let result = unsafe { lstat(c_string.as_ptr(), &mut buf as *mut stat) }; if result < 0 { - crash!( - 1, - "Cannot stat '{}': {}", - matches.free[0], - Error::last_os_error() - ); + crash!(1, "Cannot stat '{}': {}", paths[0], Error::last_os_error()); } buf.st_mode & S_IFMT @@ -101,7 +90,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { match result { Ok(_) => (), Err(e) => { - crash!(1, "cannot unlink '{0}': {1}", matches.free[0], e); + crash!(1, "cannot unlink '{0}': {1}", paths[0], e); } } From ee070028e411bec7f0fa8f129abd72b88c5d077e Mon Sep 17 00:00:00 2001 From: Sivachandran Date: Sat, 10 Apr 2021 15:23:29 +0530 Subject: [PATCH 0309/1135] install: implement stripping symbol table (#2047) --- src/uu/install/src/install.rs | 35 +++++++-- tests/by-util/test_install.rs | 96 ++++++++++++++++++++++++ tests/fixtures/install/helloworld.rs | 3 + tests/fixtures/install/helloworld_linux | Bin 0 -> 3343560 bytes tests/fixtures/install/helloworld_macos | Bin 0 -> 424240 bytes 5 files changed, 126 insertions(+), 8 deletions(-) create mode 100644 tests/fixtures/install/helloworld.rs create mode 100755 tests/fixtures/install/helloworld_linux create mode 100755 tests/fixtures/install/helloworld_macos diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index a4f1ca6e6..e902862a8 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -23,9 +23,11 @@ use std::fs; use std::fs::File; use std::os::unix::fs::MetadataExt; use std::path::{Path, PathBuf}; +use std::process::Command; use std::result::Result; const DEFAULT_MODE: u32 = 0o755; +const DEFAULT_STRIP_PROGRAM: &str = "strip"; #[allow(dead_code)] pub struct Behavior { @@ -37,6 +39,8 @@ pub struct Behavior { verbose: bool, preserve_timestamps: bool, compare: bool, + strip: bool, + strip_program: String, } #[derive(Clone, Eq, PartialEq)] @@ -164,17 +168,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("apply access/modification times of SOURCE files to corresponding destination files") ) .arg( - // TODO implement flag Arg::with_name(OPT_STRIP) .short("s") .long(OPT_STRIP) - .help("(unimplemented) strip symbol tables") + .help("strip symbol tables (no action Windows)") ) .arg( - // TODO implement flag Arg::with_name(OPT_STRIP_PROGRAM) .long(OPT_STRIP_PROGRAM) - .help("(unimplemented) program used to strip binaries") + .help("program used to strip binaries (no action Windows)") .value_name("PROGRAM") ) .arg( @@ -266,10 +268,6 @@ fn check_unimplemented<'a>(matches: &ArgMatches) -> Result<(), &'a str> { Err("-b") } else if matches.is_present(OPT_CREATED) { Err("-D") - } else if matches.is_present(OPT_STRIP) { - Err("--strip, -s") - } else if matches.is_present(OPT_STRIP_PROGRAM) { - Err("--strip-program") } else if matches.is_present(OPT_SUFFIX) { Err("--suffix, -S") } else if matches.is_present(OPT_TARGET_DIRECTORY) { @@ -339,6 +337,12 @@ fn behavior(matches: &ArgMatches) -> Result { verbose: matches.is_present(OPT_VERBOSE), preserve_timestamps: matches.is_present(OPT_PRESERVE_TIMESTAMPS), compare: matches.is_present(OPT_COMPARE), + strip: matches.is_present(OPT_STRIP), + strip_program: String::from( + matches + .value_of(OPT_STRIP_PROGRAM) + .unwrap_or(DEFAULT_STRIP_PROGRAM), + ), }) } @@ -521,6 +525,21 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { return Err(()); } + if b.strip && cfg!(not(windows)) { + match Command::new(&b.strip_program).arg(to).output() { + Ok(o) => { + if !o.status.success() { + crash!( + 1, + "strip program failed: {}", + String::from_utf8(o.stderr).unwrap_or_default() + ); + } + } + Err(e) => crash!(1, "strip program execution failed: {}", e), + } + } + if mode::chmod(&to, b.mode()).is_err() { return Err(()); } diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 8ac6396fd..840b2f6c7 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -2,6 +2,8 @@ use crate::common::util::*; use filetime::FileTime; use rust_users::*; use std::os::unix::fs::PermissionsExt; +#[cfg(not(windows))] +use std::process::Command; #[cfg(target_os = "linux")] use std::thread::sleep; @@ -566,3 +568,97 @@ fn test_install_copy_then_compare_file_with_extra_mode() { assert!(after_install_sticky != after_install_sticky_again); } + +const STRIP_TARGET_FILE: &str = "helloworld_installed"; +const SYMBOL_DUMP_PROGRAM: &str = "objdump"; +const STRIP_SOURCE_FILE_SYMBOL: &str = "main"; + +fn strip_source_file() -> &'static str { + if cfg!(target_os = "macos") { + "helloworld_macos" + } else { + "helloworld_linux" + } +} + +#[test] +#[cfg(not(windows))] +fn test_install_and_strip() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + scene + .ucmd() + .arg("-s") + .arg(strip_source_file()) + .arg(STRIP_TARGET_FILE) + .succeeds() + .no_stderr(); + + let output = Command::new(SYMBOL_DUMP_PROGRAM) + .arg("-t") + .arg(at.plus(STRIP_TARGET_FILE)) + .output() + .unwrap(); + + let stdout = String::from_utf8(output.stdout).unwrap(); + assert!(!stdout.contains(STRIP_SOURCE_FILE_SYMBOL)); +} + +#[test] +#[cfg(not(windows))] +fn test_install_and_strip_with_program() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + scene + .ucmd() + .arg("-s") + .arg("--strip-program") + .arg("/usr/bin/strip") + .arg(strip_source_file()) + .arg(STRIP_TARGET_FILE) + .succeeds() + .no_stderr(); + + let output = Command::new(SYMBOL_DUMP_PROGRAM) + .arg("-t") + .arg(at.plus(STRIP_TARGET_FILE)) + .output() + .unwrap(); + + let stdout = String::from_utf8(output.stdout).unwrap(); + assert!(!stdout.contains(STRIP_SOURCE_FILE_SYMBOL)); +} + +#[test] +#[cfg(not(windows))] +fn test_install_and_strip_with_invalid_program() { + let scene = TestScenario::new(util_name!()); + + let stderr = scene + .ucmd() + .arg("-s") + .arg("--strip-program") + .arg("/bin/date") + .arg(strip_source_file()) + .arg(STRIP_TARGET_FILE) + .fails() + .stderr; + assert!(stderr.contains("strip program failed")); +} + +#[test] +#[cfg(not(windows))] +fn test_install_and_strip_with_non_existent_program() { + let scene = TestScenario::new(util_name!()); + + let stderr = scene + .ucmd() + .arg("-s") + .arg("--strip-program") + .arg("/usr/bin/non_existent_program") + .arg(strip_source_file()) + .arg(STRIP_TARGET_FILE) + .fails() + .stderr; + assert!(stderr.contains("No such file or directory")); +} diff --git a/tests/fixtures/install/helloworld.rs b/tests/fixtures/install/helloworld.rs new file mode 100644 index 000000000..47ad8c634 --- /dev/null +++ b/tests/fixtures/install/helloworld.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello World!"); +} diff --git a/tests/fixtures/install/helloworld_linux b/tests/fixtures/install/helloworld_linux new file mode 100755 index 0000000000000000000000000000000000000000..c1c6b9b37226b201e0ecdd470f59022353f602c2 GIT binary patch literal 3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8;f z8LLFDZxDl(28I@?#%3mo2FV6SX(^y7LR2SXj&-5RmlRcEDv6Ks!_pTz4U$uh4K2V|pg(c=Lb2x-!SlLllg1G&3`(sc(H58&Dr)Mtm5Dyb$Z zW}t&$EscyV4NakkqJT0!bn%Z_NCs$l66!Kbb0b5GBqKA6M03-`V$p(q83=De3mANH}NerN~c_4H~aY+%F z1s=92V9?9UFGGlfA9#LGx5&S20>smv>`%!SY;MG%>? z)S}|d{5%v+d=Z0QQEE;iNCT8rkW<2-2TFYmdIdQpdg=Kk40@pBsTuS@qt*<1Mfu?M z>w2jf@o7bgxvB9PDMbu$9)n(bax%1Q7heL}cgdhvl2lv_F)|*!j~`+Zj14jk ze6V{Hb2F0}^gyBvdSH#9r5~wzB@B9y#GD8|%%K>@EhtR_Ed_z|LHmOM={Z1fB1_p)-P=F%Q9#C(DVm#A6RJsm}Fpp(&A7qi~_k8#s<-yX!;eP`e3vJND&f-dXE7{PeIe40M!qp zVeW+)0pr8yxoG+ep!#8Sy(TDiz;rXf?S+XfM$`YH5~3bPbHWrtX>|XugzAUIA43B~ zKa9TW1JwwnVE%@388)Knzi|elA4b37g{g$l==SeN(|_U?L_dsPfM!1|+#segFq}lw zpP>%10Y-<&!c;;Tn`$p0__QAUUuOn(4We*jcJykdfCfY}S>GDtz~H-HI1X_$Uo^%txh zR)*?_YJ*cbF#ACT99$IQS0pZj5ib2-ApSRom)sCtFnb|91_mb_`saUvPM)6u$p&jf*EyS5<$T9!9*tD(9gIFqJM!Js*BO} zgZR)a1~U>&uXq4z*)TA?05uR87#P$U7#OB8LDD)%0j&N6MGq|PgT!HYg1Hfx8F~;* f!3mIka1H|lgCMm1fh-1MKm7sGKMzd<8kYe8TB&X2 literal 0 HcmV?d00001 diff --git a/tests/fixtures/install/helloworld_macos b/tests/fixtures/install/helloworld_macos new file mode 100755 index 0000000000000000000000000000000000000000..40e6ee515245014a961cf6fd0ab1176289cf9fce GIT binary patch literal 424240 zcmX^A>+L^w1_nlE1_lN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O`&UniM0T00HIo7 z0_sRuq#C6pCZ`&trhu0H#7FrNYXR02lnF_vP#;*Dr5L7Kn5G)0B$}j{q@j0{!AX?F zASy+%z|<(wG&R-G)Xd1(&>#hNmJF&7AcuDo9S87C4fTVGNh)YrrjdE7p@|`QlQz7G z0#X6?1Bq5-!paSh0iYo=BXd*BG(*FrG;?E1%M_F%1D2CNIo1#KfdjQ;c3W+#96X0j<12sSz~IZ)9#^YG4Ao ze%Ht-33WOInkB&gfSmS(EpuZHDzpemHZ(V}G&V~HtDukh)M<(-X<0) zM#iaTiSRB8#7NL}I#?z?AaM=qmm}53hK9zL$*D$3My6?r=1EDg)JeKQW(Ed{patBf z=EkN;=E<W2nJ0lyKLyojkW_-#MbK1_ILzMM(9kT=%+l1t(!|U(4K}0>T{s8H zlAvwvu*Nc|heFC+P-3z%=$;=73uE(SgH%K0G9T7IFf@X;+2d0ZOA?Kelg)DS^RvPG z`BT%<%nXduj8jw1K+bBlJR8&@&;-Of4 Date: Sat, 10 Apr 2021 04:56:20 -0500 Subject: [PATCH 0310/1135] Sort: Various fixes and performance improvements (#2057) * Various fixes and performance improvements * fix a typo Co-authored-by: Michael Debertol Co-authored-by: Sylvestre Ledru Co-authored-by: Michael Debertol --- src/uu/sort/src/sort.rs | 114 ++++++++++++------ tests/.DS_Store | Bin 0 -> 6148 bytes tests/by-util/test_sort.rs | 49 ++++++-- tests/fixtures/.DS_Store | Bin 0 -> 6148 bytes ...ars_numeric_unique_reverse_stable.expected | 20 +++ .../fixtures/sort/multiple_decimals.expected | 33 +++++ .../sort/multiple_decimals_general.txt | 35 ++++++ .../sort/multiple_decimals_numeric.txt | 35 ++++++ 8 files changed, 242 insertions(+), 44 deletions(-) create mode 100644 tests/.DS_Store create mode 100644 tests/fixtures/.DS_Store create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse_stable.expected create mode 100644 tests/fixtures/sort/multiple_decimals.expected create mode 100644 tests/fixtures/sort/multiple_decimals_general.txt create mode 100644 tests/fixtures/sort/multiple_decimals_numeric.txt diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 4e0e25d65..4aa3fbed2 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -22,6 +22,7 @@ use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; use rayon::prelude::*; use semver::Version; +use std::borrow::Cow; use std::cmp::Ordering; use std::collections::BinaryHeap; use std::env; @@ -262,7 +263,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(OPT_CHECK_SILENT) .short("C") .long(OPT_CHECK_SILENT) - .help("exit successfully if the given file is already sorted, and exit with status 1 otherwise. "), + .help("exit successfully if the given file is already sorted, and exit with status 1 otherwise."), ) .arg( Arg::with_name(OPT_IGNORE_CASE) @@ -353,7 +354,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if let Ok(n) = line { files.push( std::str::from_utf8(&n) - .expect("Could not parse zero terminated string from input.") + .expect("Could not parse string from zero terminated input.") .to_string(), ); } @@ -488,6 +489,8 @@ fn exec(files: Vec, settings: &mut Settings) -> i32 { } else { print_sorted(file_merger, &settings) } + } else if settings.mode == SortMode::Default && settings.unique { + print_sorted(lines.iter().dedup(), &settings) } else if settings.mode == SortMode::Month && settings.unique { print_sorted( lines @@ -499,7 +502,7 @@ fn exec(files: Vec, settings: &mut Settings) -> i32 { print_sorted( lines .iter() - .dedup_by(|a, b| get_nums_dedup(a) == get_nums_dedup(b)), + .dedup_by(|a, b| get_num_dedup(a, &settings) == get_num_dedup(b, &settings)), &settings, ) } else { @@ -603,12 +606,13 @@ fn default_compare(a: &str, b: &str) -> Ordering { #[inline(always)] fn leading_num_common(a: &str) -> &str { let mut s = ""; + + // check whether char is numeric, whitespace or decimal point or thousand separator for (idx, c) in a.char_indices() { - // check whether char is numeric, whitespace or decimal point or thousand seperator if !c.is_numeric() && !c.is_whitespace() - && !c.eq(&DECIMAL_PT) && !c.eq(&THOUSANDS_SEP) + && !c.eq(&DECIMAL_PT) // check for e notation && !c.eq(&'e') && !c.eq(&'E') @@ -621,7 +625,7 @@ fn leading_num_common(a: &str) -> &str { break; } // If line is not a number line, return the line as is - s = a; + s = &a; } s } @@ -633,16 +637,17 @@ fn leading_num_common(a: &str) -> &str { // not recognize a positive sign or scientific/E notation so we strip those elements here. fn get_leading_num(a: &str) -> &str { let mut s = ""; - let b = leading_num_common(a); - // GNU numeric sort doesn't recognize '+' or 'e' notation so we strip - for (idx, c) in b.char_indices() { - if c.eq(&'e') || c.eq(&'E') || b.chars().nth(0).unwrap_or('\0').eq(&POSITIVE) { - s = &b[..idx]; + let a = leading_num_common(a); + + // GNU numeric sort doesn't recognize '+' or 'e' notation so we strip trailing chars + for (idx, c) in a.char_indices() { + if c.eq(&'e') || c.eq(&'E') || a.chars().nth(0).unwrap_or('\0').eq(&POSITIVE) { + s = &a[..idx]; break; } // If no further processing needed to be done, return the line as-is to be sorted - s = b; + s = &a; } // And empty number or non-number lines are to be treated as ‘0’ but only for numeric sort @@ -657,30 +662,32 @@ fn get_leading_num(a: &str) -> &str { // In contrast to numeric compare, GNU general numeric/FP sort *should* recognize positive signs and // scientific notation, so we strip those lines only after the end of the following numeric string. // For example, 5e10KFD would be 5e10 or 5x10^10 and +10000HFKJFK would become 10000. -fn get_leading_gen(a: &str) -> String { +fn get_leading_gen(a: &str) -> &str { // Make this iter peekable to see if next char is numeric - let mut p_iter = leading_num_common(a).chars().peekable(); - let mut r = String::new(); + let raw_leading_num = leading_num_common(a); + let mut p_iter = raw_leading_num.chars().peekable(); + let mut result = ""; // Cleanup raw stripped strings for c in p_iter.to_owned() { let next_char_numeric = p_iter.peek().unwrap_or(&'\0').is_numeric(); - // Only general numeric recognizes e notation and, see block below, the '+' sign - if (c.eq(&'e') && !next_char_numeric) || (c.eq(&'E') && !next_char_numeric) { - r = a.split(c).next().unwrap_or("").to_owned(); + // Only general numeric recognizes e notation and the '+' sign + if (c.eq(&'e') && !next_char_numeric) + || (c.eq(&'E') && !next_char_numeric) + // Only GNU (non-general) numeric recognize thousands seperators, takes only leading # + || c.eq(&THOUSANDS_SEP) + { + result = a.split(c).next().unwrap_or(""); break; // If positive sign and next char is not numeric, split at postive sign at keep trailing numbers // There is a more elegant way to do this in Rust 1.45, std::str::strip_prefix } else if c.eq(&POSITIVE) && !next_char_numeric { - let mut v: Vec<&str> = a.split(c).collect(); - let x = v.split_off(1); - r = x.join(""); + result = a.trim().trim_start_matches('+'); break; - // If no further processing needed to be done, return the line as-is to be sorted - } else { - r = a.to_owned(); } + // If no further processing needed to be done, return the line as-is to be sorted + result = a; } - r + result } fn get_months_dedup(a: &str) -> String { @@ -714,10 +721,10 @@ fn get_months_dedup(a: &str) -> String { } } -// *For all dedups/uniques we must compare leading numbers* +// *For all dedups/uniques expect default we must compare leading numbers* // Also note numeric compare and unique output is specifically *not* the same as a "sort | uniq" // See: https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html -fn get_nums_dedup(a: &str) -> &str { +fn get_num_dedup<'a>(a: &'a str, settings: &&mut Settings) -> &'a str { // Trim and remove any leading zeros let s = a.trim().trim_start_matches('0'); @@ -731,20 +738,50 @@ fn get_nums_dedup(a: &str) -> &str { "" // Prepare lines for comparison of only the numerical leading numbers } else { - get_leading_num(s) + let result = match settings.mode { + SortMode::Numeric => get_leading_num(s), + SortMode::GeneralNumeric => get_leading_gen(s), + SortMode::HumanNumeric => get_leading_num(s), + SortMode::Version => get_leading_num(s), + _ => s, + }; + result + } +} + +#[inline(always)] +fn remove_thousands_sep<'a, S: Into>>(input: S) -> Cow<'a, str> { + let input = input.into(); + if input.contains(THOUSANDS_SEP) { + let output = input.replace(THOUSANDS_SEP, ""); + Cow::Owned(output) + } else { + input + } +} + +#[inline(always)] +fn remove_trailing_dec<'a, S: Into>>(input: S) -> Cow<'a, str> { + let input = input.into(); + if let Some(s) = input.find(DECIMAL_PT) { + let (leading, trailing) = input.split_at(s); + let output = [leading, ".", trailing.replace(DECIMAL_PT, "").as_str()].concat(); + Cow::Owned(output) + } else { + input } } /// Parse the beginning string into an f64, returning -inf instead of NaN on errors. #[inline(always)] fn permissive_f64_parse(a: &str) -> f64 { - // Remove thousands seperators - let a = a.replace(THOUSANDS_SEP, ""); - // GNU sort treats "NaN" as non-number in numeric, so it needs special care. // *Keep this trim before parse* despite what POSIX may say about -b and -n // because GNU and BSD both seem to require it to match their behavior - match a.trim().parse::() { + // + // Remove any trailing decimals, ie 4568..890... becomes 4568.890 + // Then, we trim whitespace and parse + match remove_trailing_dec(a).trim().parse::() { Ok(a) if a.is_nan() => std::f64::NEG_INFINITY, Ok(a) => a, Err(_) => std::f64::NEG_INFINITY, @@ -757,8 +794,13 @@ fn numeric_compare(a: &str, b: &str) -> Ordering { let sa = get_leading_num(a); let sb = get_leading_num(b); - let fa = permissive_f64_parse(sa); - let fb = permissive_f64_parse(sb); + // Avoids a string alloc for every line to remove thousands seperators here + // instead of inside the get_leading_num function, which is a HUGE performance benefit + let ta = remove_thousands_sep(sa); + let tb = remove_thousands_sep(sb); + + let fa = permissive_f64_parse(&ta); + let fb = permissive_f64_parse(&tb); // f64::cmp isn't implemented (due to NaN issues); implement directly instead if fa > fb { @@ -799,8 +841,8 @@ fn general_numeric_compare(a: &str, b: &str) -> Ordering { // these types of numbers, we rarely care about pure performance. fn human_numeric_convert(a: &str) -> f64 { let num_str = get_leading_num(a); - let suffix = a.trim_start_matches(num_str); - let num_part = permissive_f64_parse(num_str); + let suffix = a.trim_start_matches(&num_str); + let num_part = permissive_f64_parse(&num_str); let suffix: f64 = match suffix.parse().unwrap_or('\0') { // SI Units 'K' => 1E3, diff --git a/tests/.DS_Store b/tests/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmZQzU|@7AO)+F(5MW?n;9!8z45|!R0Z1N%F(jFgL>QrFAPJ2!M?+vV1V%$(Gz3ON zU^D~25V%SxcdJP zRior+2#kinunYl47MEZbCs3t{!+W4QHvuXKVuPw;Mo^s$(F3lEVT}ML$bg~*R5_@+ b2Uo?6kTwK}57Iu`5P${HC_Nei0}uiLNUI8I literal 0 HcmV?d00001 diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 43aaf1da1..6455d837b 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -1,5 +1,31 @@ use crate::common::util::*; +fn test_helper(file_name: &str, args: &str) { + new_ucmd!() + .arg(args) + .arg(format!("{}.txt", file_name)) + .succeeds() + .stdout_is_fixture(format!("{}.expected", file_name)); +} + +#[test] +fn test_multiple_decimals_general() { + new_ucmd!() + .arg("-g") + .arg("multiple_decimals_general.txt") + .succeeds() + .stdout_is("\n\n\n\n\n\n\n\nCARAvan\n-2028789030\n-896689\n-8.90880\n-1\n-.05\n000\n00000001\n1\n1.040000000\n1.444\n1.58590\n8.013\n45\n46.89\n576,446.88800000\n576,446.890\n 4567.\n4567.1\n4567.34\n\t\t\t\t\t\t\t\t\t\t4567..457\n\t\t\t\t37800\n\t\t\t\t\t\t45670.89079.098\n\t\t\t\t\t\t45670.89079.1\n4798908.340000000000\n4798908.45\n4798908.8909800\n"); +} + +#[test] +fn test_multiple_decimals_numeric() { + new_ucmd!() + .arg("-n") + .arg("multiple_decimals_numeric.txt") + .succeeds() + .stdout_is("-2028789030\n-896689\n-8.90880\n-1\n-.05\n\n\n\n\n\n\n\n\n000\nCARAvan\n00000001\n1\n1.040000000\n1.444\n1.58590\n8.013\n45\n46.89\n 4567.\n4567.1\n4567.34\n\t\t\t\t\t\t\t\t\t\t4567..457\n\t\t\t\t37800\n\t\t\t\t\t\t45670.89079.098\n\t\t\t\t\t\t45670.89079.1\n576,446.88800000\n576,446.890\n4798908.340000000000\n4798908.45\n4798908.8909800\n"); +} + #[test] fn test_check_zero_terminated_failure() { new_ucmd!() @@ -44,6 +70,21 @@ fn test_random_shuffle_contains_all_lines() { assert_eq!(result_sorted, expected); } +#[test] +fn test_random_shuffle_two_runs_not_the_same() { + // check to verify that two random shuffles are not equal; this has the + // potential to fail in the very unlikely event that the random order is the same + // as the starting order, or if both random sorts end up having the same order. + const FILE: &'static str = "default_unsorted_ints.expected"; + let (at, _ucmd) = at_and_ucmd!(); + let result = new_ucmd!().arg("-R").arg(FILE).run().stdout; + let expected = at.read(FILE); + let unexpected = new_ucmd!().arg("-R").arg(FILE).run().stdout; + + assert_ne!(result, expected); + assert_ne!(result, unexpected); +} + #[test] fn test_random_shuffle_contains_two_runs_not_the_same() { // check to verify that two random shuffles are not equal; this has the @@ -355,11 +396,3 @@ fn test_check_silent() { .fails() .stdout_is(""); } - -fn test_helper(file_name: &str, args: &str) { - new_ucmd!() - .arg(args) - .arg(format!("{}{}", file_name, ".txt")) - .succeeds() - .stdout_is_fixture(format!("{}{}", file_name, ".expected")); -} diff --git a/tests/fixtures/.DS_Store b/tests/fixtures/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..607a7386a75b94e7df52bcee971a48217dc92331 GIT binary patch literal 6148 zcmZQzU|@7AO)+F(5MW?n;9!8zOq>i@0Z1N%F(jFwA|RR(WJXeXaY0f}ei8!%!%3*z zC^fi402FsD48;uj3`Gnj$nlp{kds+lVqkEck%^gwm5rSP1b8`OgER8WgG&-iN{gKm zi=siifW(rFBq%#1KR*Y~PD~2ROf8QW5OL1WD@n}EODzH^56(kXDc!NGpg2X=Pvp zvB2_RtqhC|5Uq^hZU_SdBe+WfqQTl37#YCY85kMB+8JQ&JVuCi21bZ>21aNPg%Q-F z0htfc&cF!K4s+fpJsJX|Api{lW(X|+s{dUX7;yFfA*x2n(GVC7fngZ}j4Up}E>56I z6NmRebuFkqO@PXSYJX65%m}Kd5n|w~mEQChs K(GZ}22mk;)qfplX literal 0 HcmV?d00001 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse_stable.expected b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse_stable.expected new file mode 100644 index 000000000..bbce16934 --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse_stable.expected @@ -0,0 +1,20 @@ +4798908.8909800 +4798908.45 +4798908.340000000000 +576,446.890 +576,446.88800000 + 37800 + 4567. +46.89 +45 +8.013 +1.58590 +1.444 +1.040000000 +1 + +-.05 +-1 +-8.90880 +-896689 +-2028789030 diff --git a/tests/fixtures/sort/multiple_decimals.expected b/tests/fixtures/sort/multiple_decimals.expected new file mode 100644 index 000000000..6afbdcaa0 --- /dev/null +++ b/tests/fixtures/sort/multiple_decimals.expected @@ -0,0 +1,33 @@ +-2028789030 +-896689 +-8.90880 +-1 +-.05 + + + + + + + + +000 +CARAvan +00000001 +1 +1.040000000 +1.444 +1.58590 +8.013 +45 +46.89 + 4567..457 + 4567. +4567.1 +4567.34 + 37800 +576,446.88800000 +576,446.890 +4798908.340000000000 +4798908.45 +4798908.8909800 diff --git a/tests/fixtures/sort/multiple_decimals_general.txt b/tests/fixtures/sort/multiple_decimals_general.txt new file mode 100644 index 000000000..4e65ecfda --- /dev/null +++ b/tests/fixtures/sort/multiple_decimals_general.txt @@ -0,0 +1,35 @@ +576,446.890 +576,446.88800000 + +4567.1 + 4567..457 + 45670.89079.1 + 45670.89079.098 +4567.34 + 4567. +45 +46.89 +-1 +1 +00000001 +4798908.340000000000 +4798908.45 +4798908.8909800 + + + 37800 + +-2028789030 +-896689 +CARAvan + +-8.90880 +-.05 +1.444 +1.58590 +1.040000000 + +8.013 + +000 + diff --git a/tests/fixtures/sort/multiple_decimals_numeric.txt b/tests/fixtures/sort/multiple_decimals_numeric.txt new file mode 100644 index 000000000..4e65ecfda --- /dev/null +++ b/tests/fixtures/sort/multiple_decimals_numeric.txt @@ -0,0 +1,35 @@ +576,446.890 +576,446.88800000 + +4567.1 + 4567..457 + 45670.89079.1 + 45670.89079.098 +4567.34 + 4567. +45 +46.89 +-1 +1 +00000001 +4798908.340000000000 +4798908.45 +4798908.8909800 + + + 37800 + +-2028789030 +-896689 +CARAvan + +-8.90880 +-.05 +1.444 +1.58590 +1.040000000 + +8.013 + +000 + From 49c9d8c9018eeeb2ae68a43f3763e087c44b1653 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 10 Apr 2021 14:54:58 +0200 Subject: [PATCH 0311/1135] sort: implement -k and -t support (#1996) * sort: implement basic -k and -t support This allows to specify keys after the -k flag and a custom field separator using -t. Support for options for specific keys is still missing, and the -b flag is not passed down correctly. * sort: implement support for key options * remove unstable feature use * don't pipe in input when we expect a failure * only tokenize when needed, remove a clone() * improve comments * fix clippy lints * re-add test * buffer writes to stdout * fix ignore_non_printing and make the test fail in case it is broken :) * move attribute to the right position * add more tests * add my name to the copyright section * disallow dead code * move a comment * re-add a loc * use smallvec for a perf improvement in the common case * add BENCHMARKING.md * add ignore_case to benchmarks --- Cargo.lock | 11 +- src/uu/sort/BENCHMARKING.md | 33 ++ src/uu/sort/Cargo.toml | 1 + src/uu/sort/src/sort.rs | 674 ++++++++++++++++++++++++++++-------- tests/by-util/test_sort.rs | 164 ++++++++- 5 files changed, 742 insertions(+), 141 deletions(-) create mode 100644 src/uu/sort/BENCHMARKING.md diff --git a/Cargo.lock b/Cargo.lock index 615c1a961..d2b2fa32e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "advapi32-sys" version = "0.2.0" @@ -1362,6 +1364,12 @@ dependencies = [ "maybe-uninit", ] +[[package]] +name = "smallvec" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" + [[package]] name = "strsim" version = "0.8.0" @@ -1816,7 +1824,7 @@ dependencies = [ "quickcheck", "rand 0.7.3", "rand_chacha", - "smallvec", + "smallvec 0.6.14", "uucore", "uucore_procs", ] @@ -2289,6 +2297,7 @@ dependencies = [ "rand 0.7.3", "rayon", "semver", + "smallvec 1.6.1", "uucore", "uucore_procs", ] diff --git a/src/uu/sort/BENCHMARKING.md b/src/uu/sort/BENCHMARKING.md new file mode 100644 index 000000000..b20db014d --- /dev/null +++ b/src/uu/sort/BENCHMARKING.md @@ -0,0 +1,33 @@ +# Benchmarking sort + +Most of the time when sorting is spent comparing lines. The comparison functions however differ based +on which arguments are passed to `sort`, therefore it is important to always benchmark multiple scenarios. +This is an overwiew over what was benchmarked, and if you make changes to `sort`, you are encouraged to check +how performance was affected for the workloads listed below. Feel free to add other workloads to the +list that we should improve / make sure not to regress. + +Run `cargo build --release` before benchmarking after you make a change! + +## Sorting a wordlist +- Get a wordlist, for example with [words](https://en.wikipedia.org/wiki/Words_(Unix)) on Linux. The exact wordlist + doesn't matter for performance comparisons. In this example I'm using `/usr/share/dict/american-english` as the wordlist. +- Shuffle the wordlist by running `sort -R /usr/share/dict/american-english > shuffled_wordlist.txt`. +- Benchmark sorting the wordlist with hyperfine: `hyperfine "target/release/coreutils sort shuffled_wordlist.txt -o output.txt"`. + +## Sorting a wordlist with ignore_case +- Same wordlist as above +- Benchmark sorting the wordlist ignoring the case with hyperfine: `hyperfine "target/release/coreutils sort shuffled_wordlist.txt -f -o output.txt"`. + +## Sorting numbers +- Generate a list of numbers: `seq 0 100000 | sort -R > shuffled_numbers.txt`. +- Benchmark numeric sorting with hyperfine: `hyperfine "target/release/coreutils sort shuffled_numbers.txt -n -o output.txt"`. + +## Stdout and stdin performance +Try to run the above benchmarks by piping the input through stdin (standard input) and redirect the +output through stdout (standard output): +- Remove the input file from the arguments and add `cat [inputfile] | ` at the beginning. +- Remove `-o output.txt` and add `> output.txt` at the end. + +Example: `hyperfine "target/release/coreutils sort shuffled_numbers.txt -n -o output.txt"` becomes +`hyperfine "cat shuffled_numbers.txt | target/release/coreutils sort -n > output.txt` +- Check that performance is similar to the original benchmark. \ No newline at end of file diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 814e4bbba..96e88ebc9 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -21,6 +21,7 @@ clap = "2.33" fnv = "1.0.7" itertools = "0.8.0" semver = "0.9.0" +smallvec = "1.6.1" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 4aa3fbed2..4f669f578 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -2,10 +2,10 @@ // * // * (c) Michael Yin // * (c) Robert Swinford +// * (c) Michael Debertol // * // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -#![allow(dead_code)] // Although these links don't always seem to describe reality, check out the POSIX and GNU specs: // https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sort.html @@ -22,6 +22,7 @@ use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; use rayon::prelude::*; use semver::Version; +use smallvec::SmallVec; use std::borrow::Cow; use std::cmp::Ordering; use std::collections::BinaryHeap; @@ -30,6 +31,7 @@ use std::fs::File; use std::hash::{Hash, Hasher}; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Lines, Read, Write}; use std::mem::replace; +use std::ops::{Range, RangeInclusive}; use std::path::Path; use uucore::fs::is_stdin_interactive; // for Iterator::dedup() @@ -37,6 +39,16 @@ static NAME: &str = "sort"; static ABOUT: &str = "Display sorted concatenation of all FILE(s)."; static VERSION: &str = env!("CARGO_PKG_VERSION"); +const LONG_HELP_KEYS: &str = "The key format is FIELD[.CHAR][OPTIONS][,FIELD[.CHAR]][OPTIONS]. + +Fields by default are separated by the first whitespace after a non-whitespace character. Use -t to specify a custom separator. +In the default case, whitespace is appended at the beginning of each field. Custom separators however are not included in fields. + +FIELD and CHAR both start at 1 (i.e. they are 1-indexed). If there is no end specified after a comma, the end will be the end of the line. +If CHAR is set 0, it means the end of the field. CHAR defaults to 1 for the start position and to 0 for the end position. + +Valid options are: MbdfhnRrV. They override the global options for this key."; + static OPT_HUMAN_NUMERIC_SORT: &str = "human-numeric-sort"; static OPT_MONTH_SORT: &str = "month-sort"; static OPT_NUMERIC_SORT: &str = "numeric-sort"; @@ -54,6 +66,8 @@ static OPT_OUTPUT: &str = "output"; static OPT_REVERSE: &str = "reverse"; static OPT_STABLE: &str = "stable"; static OPT_UNIQUE: &str = "unique"; +static OPT_KEY: &str = "key"; +static OPT_SEPARATOR: &str = "field-separator"; static OPT_RANDOM: &str = "random-sort"; static OPT_ZERO_TERMINATED: &str = "zero-terminated"; static OPT_PARALLEL: &str = "parallel"; @@ -63,10 +77,11 @@ static ARG_FILES: &str = "files"; static DECIMAL_PT: char = '.'; static THOUSANDS_SEP: char = ','; + static NEGATIVE: char = '-'; static POSITIVE: char = '+'; -#[derive(Eq, Ord, PartialEq, PartialOrd)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Clone)] enum SortMode { Numeric, HumanNumeric, @@ -76,8 +91,12 @@ enum SortMode { Default, } -struct Settings { +struct GlobalSettings { mode: SortMode, + ignore_blanks: bool, + ignore_case: bool, + dictionary_order: bool, + ignore_non_printing: bool, merge: bool, reverse: bool, outfile: Option, @@ -86,17 +105,21 @@ struct Settings { check: bool, check_silent: bool, random: bool, - compare_fn: fn(&str, &str) -> Ordering, - transform_fns: Vec String>, - threads: String, salt: String, + selectors: Vec, + separator: Option, + threads: String, zero_terminated: bool, } -impl Default for Settings { - fn default() -> Settings { - Settings { +impl Default for GlobalSettings { + fn default() -> GlobalSettings { + GlobalSettings { mode: SortMode::Default, + ignore_blanks: false, + ignore_case: false, + dictionary_order: false, + ignore_non_printing: false, merge: false, reverse: false, outfile: None, @@ -105,19 +128,330 @@ impl Default for Settings { check: false, check_silent: false, random: false, - compare_fn: default_compare, - transform_fns: Vec::new(), - threads: String::new(), salt: String::new(), + selectors: vec![], + separator: None, + threads: String::new(), zero_terminated: false, } } } +struct KeySettings { + mode: SortMode, + ignore_blanks: bool, + ignore_case: bool, + dictionary_order: bool, + ignore_non_printing: bool, + random: bool, + reverse: bool, +} + +impl From<&GlobalSettings> for KeySettings { + fn from(settings: &GlobalSettings) -> Self { + Self { + mode: settings.mode.clone(), + ignore_blanks: settings.ignore_blanks, + ignore_case: settings.ignore_case, + ignore_non_printing: settings.ignore_non_printing, + random: settings.random, + reverse: settings.reverse, + dictionary_order: settings.dictionary_order, + } + } +} + +/// Represents the string selected by a FieldSelector. +enum Selection { + /// If we had to transform this selection, we have to store a new string. + String(String), + /// If there was no transformation, we can store an index into the line. + ByIndex(Range), +} + +impl Selection { + /// Gets the actual string slice represented by this Selection. + fn get_str<'a>(&'a self, line: &'a Line) -> &'a str { + match self { + Selection::String(string) => string.as_str(), + Selection::ByIndex(range) => &line.line[range.to_owned()], + } + } +} + +type Field = Range; + +struct Line { + line: String, + // The common case is not to specify fields. Let's make this fast. + selections: SmallVec<[Selection; 1]>, +} + +impl Line { + fn new(line: String, settings: &GlobalSettings) -> Self { + let fields = if settings + .selectors + .iter() + .any(|selector| selector.needs_tokens()) + { + // Only tokenize if we will need tokens. + Some(tokenize(&line, settings.separator)) + } else { + None + }; + + let selections = settings + .selectors + .iter() + .map(|selector| { + if let Some(range) = selector.get_selection(&line, fields.as_deref()) { + if let Some(transformed) = + transform(&line[range.to_owned()], &selector.settings) + { + Selection::String(transformed) + } else { + Selection::ByIndex(range.start().to_owned()..range.end() + 1) + } + } else { + // If there is no match, match the empty string. + Selection::ByIndex(0..0) + } + }) + .collect(); + Self { line, selections } + } +} + +/// Transform this line. Returns None if there's no need to transform. +fn transform(line: &str, settings: &KeySettings) -> Option { + let mut transformed = None; + if settings.ignore_case { + transformed = Some(line.to_uppercase()); + } + if settings.ignore_blanks { + transformed = Some( + transformed + .as_deref() + .unwrap_or(line) + .trim_start() + .to_string(), + ); + } + if settings.dictionary_order { + transformed = Some(remove_nondictionary_chars( + transformed.as_deref().unwrap_or(line), + )); + } + if settings.ignore_non_printing { + transformed = Some(remove_nonprinting_chars( + transformed.as_deref().unwrap_or(line), + )); + } + transformed +} + +/// Tokenize a line into fields. +fn tokenize(line: &str, separator: Option) -> Vec { + if let Some(separator) = separator { + tokenize_with_separator(line, separator) + } else { + tokenize_default(line) + } +} + +/// By default fields are separated by the first whitespace after non-whitespace. +/// Whitespace is included in fields at the start. +fn tokenize_default(line: &str) -> Vec { + let mut tokens = vec![0..0]; + // pretend that there was whitespace in front of the line + let mut previous_was_whitespace = true; + for (idx, char) in line.char_indices() { + if char.is_whitespace() { + if !previous_was_whitespace { + tokens.last_mut().unwrap().end = idx; + tokens.push(idx..0); + } + previous_was_whitespace = true; + } else { + previous_was_whitespace = false; + } + } + tokens.last_mut().unwrap().end = line.len(); + tokens +} + +/// Split between separators. These separators are not included in fields. +fn tokenize_with_separator(line: &str, separator: char) -> Vec { + let mut tokens = vec![0..0]; + let mut previous_was_separator = false; + for (idx, char) in line.char_indices() { + if previous_was_separator { + tokens.push(idx..0); + } + if char == separator { + tokens.last_mut().unwrap().end = idx; + previous_was_separator = true; + } else { + previous_was_separator = false; + } + } + tokens.last_mut().unwrap().end = line.len(); + tokens +} + +struct KeyPosition { + /// 1-indexed, 0 is invalid. + field: usize, + /// 1-indexed, 0 is end of field. + char: usize, + ignore_blanks: bool, +} + +impl KeyPosition { + fn parse(key: &str, default_char_index: usize, settings: &mut KeySettings) -> Self { + let mut field_and_char = key.split('.'); + let mut field = field_and_char + .next() + .unwrap_or_else(|| crash!(1, "invalid key `{}`", key)); + let mut char = field_and_char.next(); + + // If there is a char index, we expect options to appear after it. Otherwise we expect them after the field index. + let value_with_options = char.as_mut().unwrap_or(&mut field); + + let mut ignore_blanks = settings.ignore_blanks; + if let Some(options_start) = value_with_options.chars().position(char::is_alphabetic) { + for option in value_with_options[options_start..].chars() { + // valid options: MbdfghinRrV + match option { + 'M' => settings.mode = SortMode::Month, + 'b' => ignore_blanks = true, + 'd' => settings.dictionary_order = true, + 'f' => settings.ignore_case = true, + 'g' => settings.mode = SortMode::GeneralNumeric, + 'h' => settings.mode = SortMode::HumanNumeric, + 'i' => settings.ignore_non_printing = true, + 'n' => settings.mode = SortMode::Numeric, + 'R' => settings.random = true, + 'r' => settings.reverse = true, + 'V' => settings.mode = SortMode::Version, + c => { + crash!(1, "invalid option for key: `{}`", c) + } + } + } + // Strip away option characters from the original value so we can parse it later + *value_with_options = &value_with_options[..options_start]; + } + + let field = field + .parse() + .unwrap_or_else(|e| crash!(1, "failed to parse field index for key `{}`: {}", key, e)); + if field == 0 { + crash!(1, "field index was 0"); + } + let char = char.map_or(default_char_index, |char| { + char.parse().unwrap_or_else(|e| { + crash!( + 1, + "failed to parse character index for key `{}`: {}", + key, + e + ) + }) + }); + Self { + field, + char, + ignore_blanks, + } + } +} + +struct FieldSelector { + from: KeyPosition, + to: Option, + settings: KeySettings, +} + +impl FieldSelector { + fn needs_tokens(&self) -> bool { + self.from.field != 1 || self.from.char == 0 || self.to.is_some() + } + + /// Look up the slice that corresponds to this selector for the given line. + /// If needs_fields returned false, fields may be None. + fn get_selection<'a>( + &self, + line: &'a str, + tokens: Option<&[Field]>, + ) -> Option> { + enum ResolutionErr { + TooLow, + TooHigh, + } + + // Get the index for this line given the KeyPosition + fn resolve_index( + line: &str, + tokens: Option<&[Field]>, + position: &KeyPosition, + ) -> Result { + if tokens.map_or(false, |fields| fields.len() < position.field) { + Err(ResolutionErr::TooHigh) + } else if position.char == 0 { + let end = tokens.unwrap()[position.field - 1].end; + if end == 0 { + Err(ResolutionErr::TooLow) + } else { + Ok(end - 1) + } + } else { + let mut idx = if position.field == 1 { + // The first field always starts at 0. + // We don't need tokens for this case. + 0 + } else { + tokens.unwrap()[position.field - 1].start + } + position.char + - 1; + if idx >= line.len() { + Err(ResolutionErr::TooHigh) + } else { + if position.ignore_blanks { + if let Some(not_whitespace) = + line[idx..].chars().position(|c| !c.is_whitespace()) + { + idx += not_whitespace; + } else { + return Err(ResolutionErr::TooHigh); + } + } + Ok(idx) + } + } + } + + if let Ok(from) = resolve_index(line, tokens, &self.from) { + let to = self.to.as_ref().map(|to| resolve_index(line, tokens, &to)); + match to { + Some(Ok(to)) => Some(from..=to), + // If `to` was not given or the match would be after the end of the line, + // match everything until the end of the line. + None | Some(Err(ResolutionErr::TooHigh)) => Some(from..=line.len() - 1), + // If `to` is before the start of the line, report no match. + // This can happen if the line starts with a separator. + Some(Err(ResolutionErr::TooLow)) => None, + } + } else { + None + } + } +} + struct MergeableFile<'a> { lines: Lines>>, - current_line: String, - settings: &'a Settings, + current_line: Line, + settings: &'a GlobalSettings, } // BinaryHeap depends on `Ord`. Note that we want to pop smallest items @@ -125,7 +459,7 @@ struct MergeableFile<'a> { // trick it into the right order by calling reverse() here. impl<'a> Ord for MergeableFile<'a> { fn cmp(&self, other: &MergeableFile) -> Ordering { - compare_by(&self.current_line, &other.current_line, &self.settings).reverse() + compare_by(&self.current_line, &other.current_line, self.settings).reverse() } } @@ -137,7 +471,7 @@ impl<'a> PartialOrd for MergeableFile<'a> { impl<'a> PartialEq for MergeableFile<'a> { fn eq(&self, other: &MergeableFile) -> bool { - Ordering::Equal == compare_by(&self.current_line, &other.current_line, &self.settings) + Ordering::Equal == compare_by(&self.current_line, &other.current_line, self.settings) } } @@ -145,11 +479,11 @@ impl<'a> Eq for MergeableFile<'a> {} struct FileMerger<'a> { heap: BinaryHeap>, - settings: &'a Settings, + settings: &'a GlobalSettings, } impl<'a> FileMerger<'a> { - fn new(settings: &'a Settings) -> FileMerger<'a> { + fn new(settings: &'a GlobalSettings) -> FileMerger<'a> { FileMerger { heap: BinaryHeap::new(), settings, @@ -159,7 +493,7 @@ impl<'a> FileMerger<'a> { if let Some(Ok(next_line)) = lines.next() { let mergeable_file = MergeableFile { lines, - current_line: next_line, + current_line: Line::new(next_line, &self.settings), settings: &self.settings, }; self.heap.push(mergeable_file); @@ -174,14 +508,17 @@ impl<'a> Iterator for FileMerger<'a> { Some(mut current) => { match current.lines.next() { Some(Ok(next_line)) => { - let ret = replace(&mut current.current_line, next_line); + let ret = replace( + &mut current.current_line, + Line::new(next_line, &self.settings), + ); self.heap.push(current); - Some(ret) + Some(ret.line) } _ => { // Don't put it back in the heap (it's empty/erroring) // but its first line is still valid. - Some(current.current_line) + Some(current.current_line.line) } } } @@ -205,7 +542,7 @@ With no FILE, or when FILE is -, read standard input.", pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); let usage = get_usage(); - let mut settings: Settings = Default::default(); + let mut settings: GlobalSettings = Default::default(); let matches = App::new(executable!()) .version(VERSION) @@ -316,7 +653,21 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("output only the first of an equal run"), ) .arg( - Arg::with_name(OPT_ZERO_TERMINATED) + Arg::with_name(OPT_KEY) + .short("k") + .long(OPT_KEY) + .help("sort by a key") + .long_help(LONG_HELP_KEYS) + .multiple(true) + .takes_value(true), + ) + .arg( + Arg::with_name(OPT_SEPARATOR) + .short("t") + .long(OPT_SEPARATOR) + .help("custom separator for -k") + .takes_value(true)) + .arg(Arg::with_name(OPT_ZERO_TERMINATED) .short("z") .long(OPT_ZERO_TERMINATED) .help("line delimiter is NUL, not newline"), @@ -350,14 +701,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { for path in &files0_from { let (reader, _) = open(path.as_str()).expect("Could not read from file specified."); let buf_reader = BufReader::new(reader); - for line in buf_reader.split(b'\0') { - if let Ok(n) = line { - files.push( - std::str::from_utf8(&n) - .expect("Could not parse string from zero terminated input.") - .to_string(), - ); - } + for line in buf_reader.split(b'\0').flatten() { + files.push( + std::str::from_utf8(&line) + .expect("Could not parse string from zero terminated input.") + .to_string(), + ); } } files @@ -382,21 +731,17 @@ pub fn uumain(args: impl uucore::Args) -> i32 { SortMode::Default }; + settings.dictionary_order = matches.is_present(OPT_DICTIONARY_ORDER); + settings.ignore_non_printing = matches.is_present(OPT_IGNORE_NONPRINTING); if matches.is_present(OPT_PARALLEL) { // "0" is default - threads = num of cores settings.threads = matches .value_of(OPT_PARALLEL) .map(String::from) - .unwrap_or("0".to_string()); + .unwrap_or_else(|| "0".to_string()); env::set_var("RAYON_NUM_THREADS", &settings.threads); } - if matches.is_present(OPT_DICTIONARY_ORDER) { - settings.transform_fns.push(remove_nondictionary_chars); - } else if matches.is_present(OPT_IGNORE_NONPRINTING) { - settings.transform_fns.push(remove_nonprinting_chars); - } - settings.zero_terminated = matches.is_present(OPT_ZERO_TERMINATED); settings.merge = matches.is_present(OPT_MERGE); @@ -406,13 +751,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.check = true; }; - if matches.is_present(OPT_IGNORE_CASE) { - settings.transform_fns.push(|s| s.to_uppercase()); - } + settings.ignore_case = matches.is_present(OPT_IGNORE_CASE); - if matches.is_present(OPT_IGNORE_BLANKS) { - settings.transform_fns.push(|s| s.trim_start().to_string()); - } + settings.ignore_blanks = matches.is_present(OPT_IGNORE_BLANKS); settings.outfile = matches.value_of(OPT_OUTPUT).map(String::from); settings.reverse = matches.is_present(OPT_REVERSE); @@ -424,27 +765,64 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.salt = get_rand_string(); } - //let mut files = matches.free; if files.is_empty() { /* if no file, default to stdin */ files.push("-".to_owned()); } else if settings.check && files.len() != 1 { - crash!(1, "sort: extra operand `{}' not allowed with -c", files[1]) + crash!(1, "extra operand `{}' not allowed with -c", files[1]) } - settings.compare_fn = match settings.mode { - SortMode::Numeric => numeric_compare, - SortMode::GeneralNumeric => general_numeric_compare, - SortMode::HumanNumeric => human_numeric_size_compare, - SortMode::Month => month_compare, - SortMode::Version => version_compare, - SortMode::Default => default_compare, - }; + if let Some(arg) = matches.args.get(OPT_SEPARATOR) { + let separator = arg.vals[0].to_string_lossy(); + let separator = separator; + if separator.len() != 1 { + crash!(1, "separator must be exactly one character long"); + } + settings.separator = Some(separator.chars().next().unwrap()) + } - exec(files, &mut settings) + if matches.is_present(OPT_KEY) { + for key in &matches.args[OPT_KEY].vals { + let key = key.to_string_lossy(); + let mut from_to = key.split(','); + let mut key_settings = KeySettings::from(&settings); + let from = KeyPosition::parse( + from_to + .next() + .unwrap_or_else(|| crash!(1, "invalid key `{}`", key)), + 1, + &mut key_settings, + ); + let to = from_to + .next() + .map(|to| KeyPosition::parse(to, 0, &mut key_settings)); + let field_selector = FieldSelector { + from, + to, + settings: key_settings, + }; + settings.selectors.push(field_selector); + } + } + + if !settings.stable || !matches.is_present(OPT_KEY) { + // add a default selector matching the whole line + let key_settings = KeySettings::from(&settings); + settings.selectors.push(FieldSelector { + from: KeyPosition { + field: 1, + char: 1, + ignore_blanks: key_settings.ignore_blanks, + }, + to: None, + settings: key_settings, + }); + } + + exec(files, &settings) } -fn exec(files: Vec, settings: &mut Settings) -> i32 { +fn exec(files: Vec, settings: &GlobalSettings) -> i32 { let mut lines = Vec::new(); let mut file_merger = FileMerger::new(&settings); @@ -459,26 +837,27 @@ fn exec(files: Vec, settings: &mut Settings) -> i32 { if settings.merge { file_merger.push_file(buf_reader.lines()); } else if settings.zero_terminated { - for line in buf_reader.split(b'\0') { - if let Ok(n) = line { - lines.push( - std::str::from_utf8(&n) - .expect("Could not parse string from zero terminated input.") - .to_string(), - ); - } + for line in buf_reader.split(b'\0').flatten() { + lines.push(Line::new( + std::str::from_utf8(&line) + .expect("Could not parse string from zero terminated input.") + .to_string(), + &settings, + )); } } else { for line in buf_reader.lines() { if let Ok(n) = line { - lines.push(n); + lines.push(Line::new(n, &settings)); + } else { + break; } } } } if settings.check { - return exec_check_file(lines, &settings); + return exec_check_file(&lines, &settings); } else { sort_by(&mut lines, &settings); } @@ -490,29 +869,31 @@ fn exec(files: Vec, settings: &mut Settings) -> i32 { print_sorted(file_merger, &settings) } } else if settings.mode == SortMode::Default && settings.unique { - print_sorted(lines.iter().dedup(), &settings) + print_sorted(lines.into_iter().map(|line| line.line).dedup(), &settings) } else if settings.mode == SortMode::Month && settings.unique { print_sorted( lines - .iter() + .into_iter() + .map(|line| line.line) .dedup_by(|a, b| get_months_dedup(a) == get_months_dedup(b)), &settings, ) } else if settings.unique { print_sorted( lines - .iter() - .dedup_by(|a, b| get_num_dedup(a, &settings) == get_num_dedup(b, &settings)), + .into_iter() + .map(|line| line.line) + .dedup_by(|a, b| get_num_dedup(a, settings) == get_num_dedup(b, settings)), &settings, ) } else { - print_sorted(lines.iter(), &settings) + print_sorted(lines.into_iter().map(|line| line.line), &settings) } 0 } -fn exec_check_file(unwrapped_lines: Vec, settings: &Settings) -> i32 { +fn exec_check_file(unwrapped_lines: &[Line], settings: &GlobalSettings) -> i32 { // errors yields the line before each disorder, // plus the last line (quirk of .coalesce()) let mut errors = @@ -544,51 +925,45 @@ fn exec_check_file(unwrapped_lines: Vec, settings: &Settings) -> i32 { } } -#[inline(always)] -fn transform(line: &str, settings: &Settings) -> String { - let mut transformed = line.to_owned(); - for transform_fn in &settings.transform_fns { - transformed = transform_fn(&transformed); - } - - transformed -} - -#[inline(always)] -fn sort_by(lines: &mut Vec, settings: &Settings) { +fn sort_by(lines: &mut Vec, settings: &GlobalSettings) { lines.par_sort_by(|a, b| compare_by(a, b, &settings)) } -fn compare_by(a: &str, b: &str, settings: &Settings) -> Ordering { - let (a_transformed, b_transformed): (String, String); - let (a, b) = if !settings.transform_fns.is_empty() { - a_transformed = transform(&a, &settings); - b_transformed = transform(&b, &settings); - (a_transformed.as_str(), b_transformed.as_str()) - } else { - (a, b) - }; +fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering { + for (idx, selector) in global_settings.selectors.iter().enumerate() { + let a = a.selections[idx].get_str(a); + let b = b.selections[idx].get_str(b); + let settings = &selector.settings; - // 1st Compare - let mut cmp: Ordering = if settings.random { - random_shuffle(a, b, settings.salt.clone()) - } else { - (settings.compare_fn)(a, b) - }; - - // Call "last resort compare" on any equal - if cmp == Ordering::Equal { - if settings.random || settings.stable || settings.unique { - cmp = Ordering::Equal + let cmp: Ordering = if settings.random { + random_shuffle(a, b, global_settings.salt.clone()) } else { - cmp = default_compare(a, b) + (match settings.mode { + SortMode::Numeric => numeric_compare, + SortMode::GeneralNumeric => general_numeric_compare, + SortMode::HumanNumeric => human_numeric_size_compare, + SortMode::Month => month_compare, + SortMode::Version => version_compare, + SortMode::Default => default_compare, + })(a, b) }; + if cmp != Ordering::Equal { + return if settings.reverse { cmp.reverse() } else { cmp }; + } + } + + // Call "last resort compare" if all selectors returned Equal + + let cmp = if global_settings.random || global_settings.stable || global_settings.unique { + Ordering::Equal + } else { + default_compare(&a.line, &b.line) }; - if settings.reverse { - return cmp.reverse(); + if global_settings.reverse { + cmp.reverse() } else { - return cmp; + cmp } } @@ -617,8 +992,8 @@ fn leading_num_common(a: &str) -> &str { && !c.eq(&'e') && !c.eq(&'E') // check whether first char is + or - - && !a.chars().nth(0).unwrap_or('\0').eq(&POSITIVE) - && !a.chars().nth(0).unwrap_or('\0').eq(&NEGATIVE) + && !a.chars().next().unwrap_or('\0').eq(&POSITIVE) + && !a.chars().next().unwrap_or('\0').eq(&NEGATIVE) { // Strip string of non-numeric trailing chars s = &a[..idx]; @@ -640,9 +1015,9 @@ fn get_leading_num(a: &str) -> &str { let a = leading_num_common(a); - // GNU numeric sort doesn't recognize '+' or 'e' notation so we strip trailing chars + // GNU numeric sort doesn't recognize '+' or 'e' notation so we strip for (idx, c) in a.char_indices() { - if c.eq(&'e') || c.eq(&'E') || a.chars().nth(0).unwrap_or('\0').eq(&POSITIVE) { + if c.eq(&'e') || c.eq(&'E') || a.chars().next().unwrap_or('\0').eq(&POSITIVE) { s = &a[..idx]; break; } @@ -670,12 +1045,9 @@ fn get_leading_gen(a: &str) -> &str { // Cleanup raw stripped strings for c in p_iter.to_owned() { let next_char_numeric = p_iter.peek().unwrap_or(&'\0').is_numeric(); - // Only general numeric recognizes e notation and the '+' sign - if (c.eq(&'e') && !next_char_numeric) - || (c.eq(&'E') && !next_char_numeric) - // Only GNU (non-general) numeric recognize thousands seperators, takes only leading # - || c.eq(&THOUSANDS_SEP) - { + // Only general numeric recognizes e notation and, see block below, the '+' sign + // Only GNU (non-general) numeric recognize thousands seperators, takes only leading # + if (c.eq(&'e') || c.eq(&'E')) && !next_char_numeric || c.eq(&THOUSANDS_SEP) { result = a.split(c).next().unwrap_or(""); break; // If positive sign and next char is not numeric, split at postive sign at keep trailing numbers @@ -724,19 +1096,17 @@ fn get_months_dedup(a: &str) -> String { // *For all dedups/uniques expect default we must compare leading numbers* // Also note numeric compare and unique output is specifically *not* the same as a "sort | uniq" // See: https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html -fn get_num_dedup<'a>(a: &'a str, settings: &&mut Settings) -> &'a str { +fn get_num_dedup<'a>(a: &'a str, settings: &GlobalSettings) -> &'a str { // Trim and remove any leading zeros let s = a.trim().trim_start_matches('0'); // Get first char - let c = s.chars().nth(0).unwrap_or('\0'); + let c = s.chars().next().unwrap_or('\0'); // Empty lines and non-number lines are treated as the same for dedup - if s.is_empty() { - "" - } else if !c.eq(&NEGATIVE) && !c.is_numeric() { - "" // Prepare lines for comparison of only the numerical leading numbers + if s.is_empty() || (!c.eq(&NEGATIVE) && !c.is_numeric()) { + "" } else { let result = match settings.mode { SortMode::Numeric => get_leading_num(s), @@ -794,7 +1164,7 @@ fn numeric_compare(a: &str, b: &str) -> Ordering { let sa = get_leading_num(a); let sb = get_leading_num(b); - // Avoids a string alloc for every line to remove thousands seperators here + // Avoids a string alloc for every line to remove thousands seperators here // instead of inside the get_leading_num function, which is a HUGE performance benefit let ta = remove_thousands_sep(sa); let tb = remove_thousands_sep(sb); @@ -944,6 +1314,7 @@ fn month_parse(line: &str) -> Month { } fn month_compare(a: &str, b: &str) -> Ordering { + #![allow(clippy::comparison_chain)] let ma = month_parse(a); let mb = month_parse(b); @@ -986,32 +1357,29 @@ fn remove_nonprinting_chars(s: &str) -> String { .collect::() } -fn print_sorted>(iter: T, settings: &Settings) -where - S: std::fmt::Display, -{ +fn print_sorted>(iter: T, settings: &GlobalSettings) { let mut file: Box = match settings.outfile { Some(ref filename) => match File::create(Path::new(&filename)) { Ok(f) => Box::new(BufWriter::new(f)) as Box, Err(e) => { - show_error!("sort: {0}: {1}", filename, e.to_string()); + show_error!("{0}: {1}", filename, e.to_string()); panic!("Could not open output file"); } }, - None => Box::new(stdout()) as Box, + None => Box::new(BufWriter::new(stdout())) as Box, }; - if settings.zero_terminated { for line in iter { - let str = format!("{}\0", line); - crash_if_err!(1, file.write_all(str.as_bytes())); + crash_if_err!(1, file.write_all(line.as_bytes())); + crash_if_err!(1, file.write_all("\0".as_bytes())); } } else { for line in iter { - let str = format!("{}\n", line); - crash_if_err!(1, file.write_all(str.as_bytes())); + crash_if_err!(1, file.write_all(line.as_bytes())); + crash_if_err!(1, file.write_all("\n".as_bytes())); } } + crash_if_err!(1, file.flush()); } // from cat.rs @@ -1024,7 +1392,7 @@ fn open(path: &str) -> Option<(Box, bool)> { match File::open(Path::new(path)) { Ok(f) => Some((Box::new(f) as Box, false)), Err(e) => { - show_error!("sort: {0}: {1}", path, e.to_string()); + show_error!("{0}: {1}", path, e.to_string()); None } } @@ -1097,4 +1465,34 @@ mod tests { assert_eq!(Ordering::Less, version_compare(a, b)); } + + #[test] + fn test_random_compare() { + let a = "9"; + let b = "9"; + let c = get_rand_string(); + + assert_eq!(Ordering::Equal, random_shuffle(a, b, c)); + } + + #[test] + fn test_tokenize_fields() { + let line = "foo bar b x"; + assert_eq!(tokenize(line, None), vec![0..3, 3..7, 7..9, 9..14,],); + } + + #[test] + fn test_tokenize_fields_leading_whitespace() { + let line = " foo bar b x"; + assert_eq!(tokenize(line, None), vec![0..7, 7..11, 11..13, 13..18,]); + } + + #[test] + fn test_tokenize_fields_custom_separator() { + let line = "aaa foo bar b x"; + assert_eq!( + tokenize(line, Some('a')), + vec![0..0, 1..1, 2..2, 3..9, 10..18,] + ); + } } diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 6455d837b..668e783ae 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -185,10 +185,10 @@ fn test_dictionary_order2() { fn test_non_printing_chars() { for non_printing_chars_param in vec!["-i"] { new_ucmd!() - .pipe_in("a👦🏻aa b\naaaa b") + .pipe_in("a👦🏻aa\naaaa") .arg(non_printing_chars_param) .succeeds() - .stdout_only("aaaa b\na👦🏻aa b\n"); + .stdout_only("a👦🏻aa\naaaa\n"); } } @@ -307,6 +307,166 @@ fn test_numeric_unique_ints2() { } } +#[test] +fn test_keys_open_ended() { + let input = "aa bb cc\ndd aa ff\ngg aa cc\n"; + new_ucmd!() + .args(&["-k", "2.2"]) + .pipe_in(input) + .succeeds() + .stdout_only("gg aa cc\ndd aa ff\naa bb cc\n"); +} + +#[test] +fn test_keys_closed_range() { + let input = "aa bb cc\ndd aa ff\ngg aa cc\n"; + new_ucmd!() + .args(&["-k", "2.2,2.2"]) + .pipe_in(input) + .succeeds() + .stdout_only("dd aa ff\ngg aa cc\naa bb cc\n"); +} + +#[test] +fn test_keys_multiple_ranges() { + let input = "aa bb cc\ndd aa ff\ngg aa cc\n"; + new_ucmd!() + .args(&["-k", "2,2", "-k", "3,3"]) + .pipe_in(input) + .succeeds() + .stdout_only("gg aa cc\ndd aa ff\naa bb cc\n"); +} + +#[test] +fn test_keys_no_field_match() { + let input = "aa aa aa aa\naa bb cc\ndd aa ff\n"; + new_ucmd!() + .args(&["-k", "4,4"]) + .pipe_in(input) + .succeeds() + .stdout_only("aa bb cc\ndd aa ff\naa aa aa aa\n"); +} + +#[test] +fn test_keys_no_char_match() { + let input = "aaa\nba\nc\n"; + new_ucmd!() + .args(&["-k", "1.2"]) + .pipe_in(input) + .succeeds() + .stdout_only("c\nba\naaa\n"); +} + +#[test] +fn test_keys_custom_separator() { + let input = "aaxbbxcc\nddxaaxff\nggxaaxcc\n"; + new_ucmd!() + .args(&["-k", "2.2,2.2", "-t", "x"]) + .pipe_in(input) + .succeeds() + .stdout_only("ddxaaxff\nggxaaxcc\naaxbbxcc\n"); +} + +#[test] +fn test_keys_invalid_field() { + new_ucmd!() + .args(&["-k", "1."]) + .fails() + .stderr_only("sort: error: failed to parse character index for key `1.`: cannot parse integer from empty string"); +} + +#[test] +fn test_keys_invalid_field_option() { + new_ucmd!() + .args(&["-k", "1.1x"]) + .fails() + .stderr_only("sort: error: invalid option for key: `x`"); +} + +#[test] +fn test_keys_invalid_field_zero() { + new_ucmd!() + .args(&["-k", "0.1"]) + .fails() + .stderr_only("sort: error: field index was 0"); +} + +#[test] +fn test_keys_with_options() { + let input = "aa 3 cc\ndd 1 ff\ngg 2 cc\n"; + for param in &[ + &["-k", "2,2n"][..], + &["-k", "2n,2"][..], + &["-k", "2,2", "-n"][..], + ] { + new_ucmd!() + .args(param) + .pipe_in(input) + .succeeds() + .stdout_only("dd 1 ff\ngg 2 cc\naa 3 cc\n"); + } +} + +#[test] +fn test_keys_with_options_blanks_start() { + let input = "aa 3 cc\ndd 1 ff\ngg 2 cc\n"; + for param in &[&["-k", "2b,2"][..], &["-k", "2,2", "-b"][..]] { + new_ucmd!() + .args(param) + .pipe_in(input) + .succeeds() + .stdout_only("dd 1 ff\ngg 2 cc\naa 3 cc\n"); + } +} + +#[test] +fn test_keys_with_options_blanks_end() { + let input = "a b +a b +a b +"; + new_ucmd!() + .args(&["-k", "1,2.1b", "-s"]) + .pipe_in(input) + .succeeds() + .stdout_only( + "a b +a b +a b +", + ); +} + +#[test] +fn test_keys_stable() { + let input = "a b +a b +a b +"; + new_ucmd!() + .args(&["-k", "1,2.1", "-s"]) + .pipe_in(input) + .succeeds() + .stdout_only( + "a b +a b +a b +", + ); +} + +#[test] +fn test_keys_empty_match() { + let input = "a a a a +aaaa +"; + new_ucmd!() + .args(&["-k", "1,1", "-t", "a"]) + .pipe_in(input) + .succeeds() + .stdout_only(input); +} + #[test] fn test_zero_terminated() { test_helper("zero-terminated", "-z"); From 2d9f15d12cca22d2a397a7de851b6b768ebc88fe Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sat, 10 Apr 2021 12:02:02 -0500 Subject: [PATCH 0312/1135] Fix month parse for months with leading whitespace --- src/uu/sort/src/sort.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 4f669f578..f60302622 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1291,7 +1291,7 @@ fn month_parse(line: &str) -> Month { // GNU splits at any 3 letter match "JUNNNN" is JUN let pattern = if line.trim().len().ge(&3) { // Split a 3 and get first element of tuple ".0" - line.split_at(3).0 + line.trim().split_at(3).0 } else { "" }; From 69f4410a8a7460e9fd50c570e569770305ce1b49 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 10 Apr 2021 19:49:10 +0200 Subject: [PATCH 0313/1135] sort: dedup using compare_by (#2064) compare_by is the function used for sorting, we should use it for dedup as well. --- Cargo.lock | 2 +- src/uu/sort/Cargo.toml | 2 +- src/uu/sort/src/sort.rs | 73 ++------------------- tests/by-util/test_sort.rs | 10 +++ tests/fixtures/sort/numeric_unique.expected | 2 + tests/fixtures/sort/numeric_unique.txt | 3 + tests/fixtures/sort/words_unique.expected | 3 + tests/fixtures/sort/words_unique.txt | 4 ++ 8 files changed, 28 insertions(+), 71 deletions(-) create mode 100644 tests/fixtures/sort/numeric_unique.expected create mode 100644 tests/fixtures/sort/numeric_unique.txt create mode 100644 tests/fixtures/sort/words_unique.expected create mode 100644 tests/fixtures/sort/words_unique.txt diff --git a/Cargo.lock b/Cargo.lock index d2b2fa32e..a6ddf7105 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2293,7 +2293,7 @@ version = "0.0.6" dependencies = [ "clap", "fnv", - "itertools 0.8.2", + "itertools 0.10.0", "rand 0.7.3", "rayon", "semver", diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 96e88ebc9..6a9976278 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -19,7 +19,7 @@ rayon = "1.5" rand = "0.7" clap = "2.33" fnv = "1.0.7" -itertools = "0.8.0" +itertools = "0.10.0" semver = "0.9.0" smallvec = "1.6.1" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 4f669f578..35ab71ba2 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -162,6 +162,7 @@ impl From<&GlobalSettings> for KeySettings { } /// Represents the string selected by a FieldSelector. +#[derive(Debug)] enum Selection { /// If we had to transform this selection, we have to store a new string. String(String), @@ -181,6 +182,7 @@ impl Selection { type Field = Range; +#[derive(Debug)] struct Line { line: String, // The common case is not to specify fields. Let's make this fast. @@ -868,22 +870,12 @@ fn exec(files: Vec, settings: &GlobalSettings) -> i32 { } else { print_sorted(file_merger, &settings) } - } else if settings.mode == SortMode::Default && settings.unique { - print_sorted(lines.into_iter().map(|line| line.line).dedup(), &settings) - } else if settings.mode == SortMode::Month && settings.unique { - print_sorted( - lines - .into_iter() - .map(|line| line.line) - .dedup_by(|a, b| get_months_dedup(a) == get_months_dedup(b)), - &settings, - ) } else if settings.unique { print_sorted( lines .into_iter() - .map(|line| line.line) - .dedup_by(|a, b| get_num_dedup(a, settings) == get_num_dedup(b, settings)), + .dedup_by(|a, b| compare_by(a, b, settings) == Ordering::Equal) + .map(|line| line.line), &settings, ) } else { @@ -1062,63 +1054,6 @@ fn get_leading_gen(a: &str) -> &str { result } -fn get_months_dedup(a: &str) -> String { - let pattern = if a.trim().len().ge(&3) { - // Split at 3rd char and get first element of tuple ".0" - a.split_at(3).0 - } else { - "" - }; - - let month = match pattern.to_uppercase().as_ref() { - "JAN" => Month::January, - "FEB" => Month::February, - "MAR" => Month::March, - "APR" => Month::April, - "MAY" => Month::May, - "JUN" => Month::June, - "JUL" => Month::July, - "AUG" => Month::August, - "SEP" => Month::September, - "OCT" => Month::October, - "NOV" => Month::November, - "DEC" => Month::December, - _ => Month::Unknown, - }; - - if month == Month::Unknown { - "".to_owned() - } else { - pattern.to_uppercase() - } -} - -// *For all dedups/uniques expect default we must compare leading numbers* -// Also note numeric compare and unique output is specifically *not* the same as a "sort | uniq" -// See: https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html -fn get_num_dedup<'a>(a: &'a str, settings: &GlobalSettings) -> &'a str { - // Trim and remove any leading zeros - let s = a.trim().trim_start_matches('0'); - - // Get first char - let c = s.chars().next().unwrap_or('\0'); - - // Empty lines and non-number lines are treated as the same for dedup - // Prepare lines for comparison of only the numerical leading numbers - if s.is_empty() || (!c.eq(&NEGATIVE) && !c.is_numeric()) { - "" - } else { - let result = match settings.mode { - SortMode::Numeric => get_leading_num(s), - SortMode::GeneralNumeric => get_leading_gen(s), - SortMode::HumanNumeric => get_leading_num(s), - SortMode::Version => get_leading_num(s), - _ => s, - }; - result - } -} - #[inline(always)] fn remove_thousands_sep<'a, S: Into>>(input: S) -> Cow<'a, str> { let input = input.into(); diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 668e783ae..866beefff 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -223,6 +223,16 @@ fn test_mixed_floats_ints_chars_numeric_unique() { test_helper("mixed_floats_ints_chars_numeric_unique", "-nu"); } +#[test] +fn test_words_unique() { + test_helper("words_unique", "-u"); +} + +#[test] +fn test_numeric_unique() { + test_helper("numeric_unique", "-nu"); +} + #[test] fn test_mixed_floats_ints_chars_numeric_reverse() { test_helper("mixed_floats_ints_chars_numeric_unique_reverse", "-nur"); diff --git a/tests/fixtures/sort/numeric_unique.expected b/tests/fixtures/sort/numeric_unique.expected new file mode 100644 index 000000000..8a31187f6 --- /dev/null +++ b/tests/fixtures/sort/numeric_unique.expected @@ -0,0 +1,2 @@ +-10 bb +aa diff --git a/tests/fixtures/sort/numeric_unique.txt b/tests/fixtures/sort/numeric_unique.txt new file mode 100644 index 000000000..15cc08022 --- /dev/null +++ b/tests/fixtures/sort/numeric_unique.txt @@ -0,0 +1,3 @@ +aa +-10 bb +-10 aa diff --git a/tests/fixtures/sort/words_unique.expected b/tests/fixtures/sort/words_unique.expected new file mode 100644 index 000000000..2444ce1c6 --- /dev/null +++ b/tests/fixtures/sort/words_unique.expected @@ -0,0 +1,3 @@ +aaa +bbb +zzz diff --git a/tests/fixtures/sort/words_unique.txt b/tests/fixtures/sort/words_unique.txt new file mode 100644 index 000000000..9c6666029 --- /dev/null +++ b/tests/fixtures/sort/words_unique.txt @@ -0,0 +1,4 @@ +zzz +aaa +bbb +bbb From 77411f3fb5b95b893894958497fbef7dafb6a14c Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sat, 10 Apr 2021 13:36:57 -0500 Subject: [PATCH 0314/1135] Implement test for months whitespace fix --- Cargo.lock | 2 -- tests/by-util/test_sort.rs | 5 +++++ tests/fixtures/sort/months-whitespace.expected | 8 ++++++++ tests/fixtures/sort/months-whitespace.txt | 8 ++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 tests/fixtures/sort/months-whitespace.expected create mode 100644 tests/fixtures/sort/months-whitespace.txt diff --git a/Cargo.lock b/Cargo.lock index a6ddf7105..d45e41c16 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,7 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 - [[package]] name = "advapi32-sys" version = "0.2.0" diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 866beefff..c09ebd256 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -8,6 +8,11 @@ fn test_helper(file_name: &str, args: &str) { .stdout_is_fixture(format!("{}.expected", file_name)); } +#[test] +fn test_months_whitespace() { + test_helper("months-whitespace", "-M"); +} + #[test] fn test_multiple_decimals_general() { new_ucmd!() diff --git a/tests/fixtures/sort/months-whitespace.expected b/tests/fixtures/sort/months-whitespace.expected new file mode 100644 index 000000000..84a44d564 --- /dev/null +++ b/tests/fixtures/sort/months-whitespace.expected @@ -0,0 +1,8 @@ + + +JAN + FEb + apr + apr + JUNNNN +AUG diff --git a/tests/fixtures/sort/months-whitespace.txt b/tests/fixtures/sort/months-whitespace.txt new file mode 100644 index 000000000..45c477477 --- /dev/null +++ b/tests/fixtures/sort/months-whitespace.txt @@ -0,0 +1,8 @@ +JAN + JUNNNN +AUG + + apr + apr + + FEb From 9bcf752b0c3feb820a87a31968dfac2f121301fc Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sat, 10 Apr 2021 14:06:24 -0500 Subject: [PATCH 0315/1135] Confirm human numeric works as expected with whitespace with a test --- tests/by-util/test_sort.rs | 5 +++++ tests/fixtures/sort/human-numeric-whitespace.expected | 11 +++++++++++ tests/fixtures/sort/human-numeric-whitespace.txt | 11 +++++++++++ 3 files changed, 27 insertions(+) create mode 100644 tests/fixtures/sort/human-numeric-whitespace.expected create mode 100644 tests/fixtures/sort/human-numeric-whitespace.txt diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index c09ebd256..23ce3258d 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -13,6 +13,11 @@ fn test_months_whitespace() { test_helper("months-whitespace", "-M"); } +#[test] +fn test_human_numeric_whitespace() { + test_helper("human-numeric-whitespace", "-h"); +} + #[test] fn test_multiple_decimals_general() { new_ucmd!() diff --git a/tests/fixtures/sort/human-numeric-whitespace.expected b/tests/fixtures/sort/human-numeric-whitespace.expected new file mode 100644 index 000000000..6fb9291ff --- /dev/null +++ b/tests/fixtures/sort/human-numeric-whitespace.expected @@ -0,0 +1,11 @@ + + + + + + + +456K +4568K + 456M + 6.2G diff --git a/tests/fixtures/sort/human-numeric-whitespace.txt b/tests/fixtures/sort/human-numeric-whitespace.txt new file mode 100644 index 000000000..19db648b1 --- /dev/null +++ b/tests/fixtures/sort/human-numeric-whitespace.txt @@ -0,0 +1,11 @@ + + +456K + + 456M + + +4568K + + 6.2G + From 713327372529c335551eccf36ff17ab55266e651 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sat, 10 Apr 2021 14:13:49 -0500 Subject: [PATCH 0316/1135] Correct arg help value name for --parallel --- src/uu/sort/src/sort.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 10e4229d4..6611a70e4 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -677,7 +677,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg( Arg::with_name(OPT_PARALLEL) .long(OPT_PARALLEL) - .help("change the number of threads running concurrently to N") + .help("change the number of threads running concurrently to NUM_THREADS") .takes_value(true) .value_name("NUM_THREADS"), ) From bf1944271ccfa062fce566388615faa18c7eebc0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 10 Apr 2021 21:57:03 +0200 Subject: [PATCH 0317/1135] remove .DS_Store --- tests/.DS_Store | Bin 6148 -> 0 bytes tests/fixtures/.DS_Store | Bin 6148 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tests/.DS_Store delete mode 100644 tests/fixtures/.DS_Store diff --git a/tests/.DS_Store b/tests/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmZQzU|@7AO)+F(5MW?n;9!8z45|!R0Z1N%F(jFgL>QrFAPJ2!M?+vV1V%$(Gz3ON zU^D~25V%SxcdJP zRior+2#kinunYl47MEZbCs3t{!+W4QHvuXKVuPw;Mo^s$(F3lEVT}ML$bg~*R5_@+ b2Uo?6kTwK}57Iu`5P${HC_Nei0}uiLNUI8I diff --git a/tests/fixtures/.DS_Store b/tests/fixtures/.DS_Store deleted file mode 100644 index 607a7386a75b94e7df52bcee971a48217dc92331..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmZQzU|@7AO)+F(5MW?n;9!8zOq>i@0Z1N%F(jFwA|RR(WJXeXaY0f}ei8!%!%3*z zC^fi402FsD48;uj3`Gnj$nlp{kds+lVqkEck%^gwm5rSP1b8`OgER8WgG&-iN{gKm zi=siifW(rFBq%#1KR*Y~PD~2ROf8QW5OL1WD@n}EODzH^56(kXDc!NGpg2X=Pvp zvB2_RtqhC|5Uq^hZU_SdBe+WfqQTl37#YCY85kMB+8JQ&JVuCi21bZ>21aNPg%Q-F z0htfc&cF!K4s+fpJsJX|Api{lW(X|+s{dUX7;yFfA*x2n(GVC7fngZ}j4Up}E>56I z6NmRebuFkqO@PXSYJX65%m}Kd5n|w~mEQChs K(GZ}22mk;)qfplX From eb4971e6f4050e749127260c89a7a6eaf164faad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81rni=20Dagur?= Date: Sat, 10 Apr 2021 20:19:53 +0000 Subject: [PATCH 0318/1135] cat: Unrevert splice patch (#2020) * cat: Unrevert splice patch * cat: Add fifo test * cat: Add tests for error cases * cat: Add tests for character devices * wc: Make sure we handle short splice writes * cat: Fix tests for 1.40.0 compiler * cat: Run rustfmt on test_cat.rs * Run 'cargo +1.40.0 update' --- Cargo.lock | 7 +- src/uu/cat/Cargo.toml | 5 +- src/uu/cat/src/cat.rs | 418 +++++++++++------- src/uu/wc/src/count_bytes.rs | 17 +- tests/by-util/test_cat.rs | 184 +++++++- tests/by-util/test_wc.rs | 28 ++ tests/common/util.rs | 15 + tests/fixtures/cat/empty.txt | 0 ...ctories_and_file_and_stdin.stderr.expected | 5 + 9 files changed, 496 insertions(+), 183 deletions(-) create mode 100644 tests/fixtures/cat/empty.txt create mode 100644 tests/fixtures/cat/three_directories_and_file_and_stdin.stderr.expected diff --git a/Cargo.lock b/Cargo.lock index a6ddf7105..430abf921 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1396,9 +1396,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87" +checksum = "48fe99c6bd8b1cc636890bcc071842de909d902c81ac7dab53ba33c421ab8ffb" dependencies = [ "proc-macro2", "quote 1.0.9", @@ -1618,7 +1618,8 @@ name = "uu_cat" version = "0.0.6" dependencies = [ "clap", - "quick-error", + "nix 0.20.0", + "thiserror", "unix_socket", "uucore", "uucore_procs", diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index e44a874c1..09b289253 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -16,13 +16,16 @@ path = "src/cat.rs" [dependencies] clap = "2.33" -quick-error = "1.2.3" +thiserror = "1.0" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] unix_socket = "0.5.0" +[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies] +nix = "0.20" + [[bin]] name = "cat" path = "src/main.rs" diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index cf5a384a4..7d56a7485 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -3,14 +3,13 @@ // (c) Jordi Boggiano // (c) Evgeniy Klyuchikov // (c) Joshua S. Miller +// (c) Árni Dagur // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. // spell-checker:ignore (ToDO) nonprint nonblank nonprinting -#[macro_use] -extern crate quick_error; #[cfg(unix)] extern crate unix_socket; #[macro_use] @@ -18,9 +17,9 @@ extern crate uucore; // last synced with: cat (GNU coreutils) 8.13 use clap::{App, Arg}; -use quick_error::ResultExt; use std::fs::{metadata, File}; -use std::io::{self, stderr, stdin, stdout, BufWriter, Read, Write}; +use std::io::{self, Read, Write}; +use thiserror::Error; use uucore::fs::is_stdin_interactive; /// Unix domain socket support @@ -31,12 +30,41 @@ use std::os::unix::fs::FileTypeExt; #[cfg(unix)] use unix_socket::UnixStream; +/// Linux splice support +#[cfg(any(target_os = "linux", target_os = "android"))] +use nix::fcntl::{splice, SpliceFFlags}; +#[cfg(any(target_os = "linux", target_os = "android"))] +use nix::unistd::pipe; +#[cfg(any(target_os = "linux", target_os = "android"))] +use std::os::unix::io::{AsRawFd, RawFd}; + static NAME: &str = "cat"; static VERSION: &str = env!("CARGO_PKG_VERSION"); static SYNTAX: &str = "[OPTION]... [FILE]..."; static SUMMARY: &str = "Concatenate FILE(s), or standard input, to standard output With no FILE, or when FILE is -, read standard input."; +#[derive(Error, Debug)] +enum CatError { + /// Wrapper around `io::Error` + #[error("{0}")] + Io(#[from] io::Error), + /// Wrapper around `nix::Error` + #[cfg(any(target_os = "linux", target_os = "android"))] + #[error("{0}")] + Nix(#[from] nix::Error), + /// Unknown file type; it's not a regular file, socket, etc. + #[error("unknown filetype: {}", ft_debug)] + UnknownFiletype { + /// A debug print of the file type + ft_debug: String, + }, + #[error("Is a directory")] + IsDirectory, +} + +type CatResult = Result; + #[derive(PartialEq)] enum NumberingMode { None, @@ -44,39 +72,6 @@ enum NumberingMode { All, } -quick_error! { - #[derive(Debug)] - enum CatError { - /// Wrapper for io::Error with path context - Input(err: io::Error, path: String) { - display("cat: {0}: {1}", path, err) - context(path: &'a str, err: io::Error) -> (err, path.to_owned()) - cause(err) - } - - /// Wrapper for io::Error with no context - Output(err: io::Error) { - display("cat: {0}", err) from() - cause(err) - } - - /// Unknown Filetype classification - UnknownFiletype(path: String) { - display("cat: {0}: unknown filetype", path) - } - - /// At least one error was encountered in reading or writing - EncounteredErrors(count: usize) { - display("cat: encountered {0} errors", count) - } - - /// Denotes an error caused by trying to `cat` a directory - IsDirectory(path: String) { - display("cat: {0}: Is a directory", path) - } - } -} - struct OutputOptions { /// Line numbering mode number: NumberingMode, @@ -87,21 +82,56 @@ struct OutputOptions { /// display TAB characters as `tab` show_tabs: bool, - /// If `show_tabs == true`, this string will be printed in the - /// place of tabs - tab: String, - - /// Can be set to show characters other than '\n' a the end of - /// each line, e.g. $ - end_of_line: String, + /// Show end of lines + show_ends: bool, /// use ^ and M- notation, except for LF (\\n) and TAB (\\t) show_nonprint: bool, } +impl OutputOptions { + fn tab(&self) -> &'static str { + if self.show_tabs { + "^I" + } else { + "\t" + } + } + + fn end_of_line(&self) -> &'static str { + if self.show_ends { + "$\n" + } else { + "\n" + } + } + + /// We can write fast if we can simply copy the contents of the file to + /// stdout, without augmenting the output with e.g. line numbers. + fn can_write_fast(&self) -> bool { + !(self.show_tabs + || self.show_nonprint + || self.show_ends + || self.squeeze_blank + || self.number != NumberingMode::None) + } +} + +/// State that persists between output of each file. This struct is only used +/// when we can't write fast. +struct OutputState { + /// The current line number + line_number: usize, + + /// Whether the output cursor is at the beginning of a new line + at_line_start: bool, +} + /// Represents an open file handle, stream, or other device -struct InputHandle { - reader: Box, +struct InputHandle { + #[cfg(any(target_os = "linux", target_os = "android"))] + file_descriptor: RawFd, + reader: R, is_interactive: bool, } @@ -124,8 +154,6 @@ enum InputType { Socket, } -type CatResult = Result; - mod options { pub static FILE: &str = "file"; pub static SHOW_ALL: &str = "show-all"; @@ -243,30 +271,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { None => vec!["-".to_owned()], }; - let can_write_fast = !(show_tabs - || show_nonprint - || show_ends - || squeeze_blank - || number_mode != NumberingMode::None); - - let success = if can_write_fast { - write_fast(files).is_ok() - } else { - let tab = if show_tabs { "^I" } else { "\t" }.to_owned(); - - let end_of_line = if show_ends { "$\n" } else { "\n" }.to_owned(); - - let options = OutputOptions { - end_of_line, - number: number_mode, - show_nonprint, - show_tabs, - squeeze_blank, - tab, - }; - - write_lines(files, &options).is_ok() + let options = OutputOptions { + show_ends, + number: number_mode, + show_nonprint, + show_tabs, + squeeze_blank, }; + let success = cat_files(files, &options).is_ok(); if success { 0 @@ -275,6 +287,76 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } +fn cat_handle( + handle: &mut InputHandle, + options: &OutputOptions, + state: &mut OutputState, +) -> CatResult<()> { + if options.can_write_fast() { + write_fast(handle) + } else { + write_lines(handle, &options, state) + } +} + +fn cat_path(path: &str, options: &OutputOptions, state: &mut OutputState) -> CatResult<()> { + if path == "-" { + let stdin = io::stdin(); + let mut handle = InputHandle { + #[cfg(any(target_os = "linux", target_os = "android"))] + file_descriptor: stdin.as_raw_fd(), + reader: stdin, + is_interactive: is_stdin_interactive(), + }; + return cat_handle(&mut handle, &options, state); + } + match get_input_type(path)? { + InputType::Directory => Err(CatError::IsDirectory), + #[cfg(unix)] + InputType::Socket => { + let socket = UnixStream::connect(path)?; + socket.shutdown(Shutdown::Write)?; + let mut handle = InputHandle { + #[cfg(any(target_os = "linux", target_os = "android"))] + file_descriptor: socket.as_raw_fd(), + reader: socket, + is_interactive: false, + }; + cat_handle(&mut handle, &options, state) + } + _ => { + let file = File::open(path)?; + let mut handle = InputHandle { + #[cfg(any(target_os = "linux", target_os = "android"))] + file_descriptor: file.as_raw_fd(), + reader: file, + is_interactive: false, + }; + cat_handle(&mut handle, &options, state) + } + } +} + +fn cat_files(files: Vec, options: &OutputOptions) -> Result<(), u32> { + let mut error_count = 0; + let mut state = OutputState { + line_number: 1, + at_line_start: true, + }; + + for path in &files { + if let Err(err) = cat_path(path, &options, &mut state) { + show_info!("{}: {}", path, err); + error_count += 1; + } + } + if error_count == 0 { + Ok(()) + } else { + Err(error_count) + } +} + /// Classifies the `InputType` of file at `path` if possible /// /// # Arguments @@ -285,7 +367,8 @@ fn get_input_type(path: &str) -> CatResult { return Ok(InputType::StdIn); } - match metadata(path).context(path)?.file_type() { + let ft = metadata(path)?.file_type(); + match ft { #[cfg(unix)] ft if ft.is_block_device() => Ok(InputType::BlockDevice), #[cfg(unix)] @@ -297,125 +380,116 @@ fn get_input_type(path: &str) -> CatResult { ft if ft.is_dir() => Ok(InputType::Directory), ft if ft.is_file() => Ok(InputType::File), ft if ft.is_symlink() => Ok(InputType::SymLink), - _ => Err(CatError::UnknownFiletype(path.to_owned())), + _ => Err(CatError::UnknownFiletype { + ft_debug: format!("{:?}", ft), + }), } } -/// Returns an InputHandle from which a Reader can be accessed or an -/// error -/// -/// # Arguments -/// -/// * `path` - `InputHandler` will wrap a reader from this file path -fn open(path: &str) -> CatResult { - if path == "-" { - let stdin = stdin(); - return Ok(InputHandle { - reader: Box::new(stdin) as Box, - is_interactive: is_stdin_interactive(), - }); - } - - match get_input_type(path)? { - InputType::Directory => Err(CatError::IsDirectory(path.to_owned())), - #[cfg(unix)] - InputType::Socket => { - let socket = UnixStream::connect(path).context(path)?; - socket.shutdown(Shutdown::Write).context(path)?; - Ok(InputHandle { - reader: Box::new(socket) as Box, - is_interactive: false, - }) - } - _ => { - let file = File::open(path).context(path)?; - Ok(InputHandle { - reader: Box::new(file) as Box, - is_interactive: false, - }) +/// Writes handle to stdout with no configuration. This allows a +/// simple memory copy. +fn write_fast(handle: &mut InputHandle) -> CatResult<()> { + let stdout = io::stdout(); + let mut stdout_lock = stdout.lock(); + #[cfg(any(target_os = "linux", target_os = "android"))] + { + // If we're on Linux or Android, try to use the splice() system call + // for faster writing. If it works, we're done. + if !write_fast_using_splice(handle, stdout_lock.as_raw_fd())? { + return Ok(()); } } + // If we're not on Linux or Android, or the splice() call failed, + // fall back on slower writing. + let mut buf = [0; 1024 * 64]; + while let Ok(n) = handle.reader.read(&mut buf) { + if n == 0 { + break; + } + stdout_lock.write_all(&buf[..n])?; + } + Ok(()) } -/// Writes files to stdout with no configuration. This allows a -/// simple memory copy. Returns `Ok(())` if no errors were -/// encountered, or an error with the number of errors encountered. +/// This function is called from `write_fast()` on Linux and Android. The +/// function `splice()` is used to move data between two file descriptors +/// without copying between kernel- and userspace. This results in a large +/// speedup. /// -/// # Arguments -/// -/// * `files` - There is no short circuit when encountering an error -/// reading a file in this vector -fn write_fast(files: Vec) -> CatResult<()> { - let mut writer = stdout(); - let mut in_buf = [0; 1024 * 64]; - let mut error_count = 0; +/// The `bool` in the result value indicates if we need to fall back to normal +/// copying or not. False means we don't have to. +#[cfg(any(target_os = "linux", target_os = "android"))] +#[inline] +fn write_fast_using_splice(handle: &mut InputHandle, writer: RawFd) -> CatResult { + const BUF_SIZE: usize = 1024 * 16; - for file in files { - match open(&file[..]) { - Ok(mut handle) => { - while let Ok(n) = handle.reader.read(&mut in_buf) { - if n == 0 { - break; - } - writer.write_all(&in_buf[..n]).context(&file[..])?; - } - } - Err(error) => { - writeln!(&mut stderr(), "{}", error)?; - error_count += 1; + let (pipe_rd, pipe_wr) = pipe()?; + + // We only fall back if splice fails on the first call. + match splice( + handle.file_descriptor, + None, + pipe_wr, + None, + BUF_SIZE, + SpliceFFlags::empty(), + ) { + Ok(n) => { + if n == 0 { + return Ok(false); } + splice_exact(pipe_rd, writer, n)?; + } + Err(_) => { + return Ok(true); } } - match error_count { - 0 => Ok(()), - _ => Err(CatError::EncounteredErrors(error_count)), + loop { + let n = splice( + handle.file_descriptor, + None, + pipe_wr, + None, + BUF_SIZE, + SpliceFFlags::empty(), + )?; + if n == 0 { + // We read 0 bytes from the input, + // which means we're done copying. + break; + } + splice_exact(pipe_rd, writer, n)?; } + + Ok(false) } -/// State that persists between output of each file -struct OutputState { - /// The current line number - line_number: usize, - - /// Whether the output cursor is at the beginning of a new line - at_line_start: bool, -} - -/// Writes files to stdout with `options` as configuration. Returns -/// `Ok(())` if no errors were encountered, or an error with the -/// number of errors encountered. -/// -/// # Arguments -/// -/// * `files` - There is no short circuit when encountering an error -/// reading a file in this vector -fn write_lines(files: Vec, options: &OutputOptions) -> CatResult<()> { - let mut error_count = 0; - let mut state = OutputState { - line_number: 1, - at_line_start: true, - }; - - for file in files { - if let Err(error) = write_file_lines(&file, options, &mut state) { - writeln!(&mut stderr(), "{}", error).context(&file[..])?; - error_count += 1; +/// Splice wrapper which handles short writes +#[cfg(any(target_os = "linux", target_os = "android"))] +#[inline] +fn splice_exact(read_fd: RawFd, write_fd: RawFd, num_bytes: usize) -> nix::Result<()> { + let mut left = num_bytes; + loop { + let written = splice(read_fd, None, write_fd, None, left, SpliceFFlags::empty())?; + left -= written; + if left == 0 { + break; } } - - match error_count { - 0 => Ok(()), - _ => Err(CatError::EncounteredErrors(error_count)), - } + Ok(()) } /// Outputs file contents to stdout in a line-by-line fashion, /// propagating any errors that might occur. -fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState) -> CatResult<()> { - let mut handle = open(file)?; +fn write_lines( + handle: &mut InputHandle, + options: &OutputOptions, + state: &mut OutputState, +) -> CatResult<()> { let mut in_buf = [0; 1024 * 31]; - let mut writer = BufWriter::with_capacity(1024 * 64, stdout()); + let stdout = io::stdout(); + let mut writer = stdout.lock(); let mut one_blank_kept = false; while let Ok(n) = handle.reader.read(&mut in_buf) { @@ -433,9 +507,9 @@ fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState write!(&mut writer, "{0:6}\t", state.line_number)?; state.line_number += 1; } - writer.write_all(options.end_of_line.as_bytes())?; + writer.write_all(options.end_of_line().as_bytes())?; if handle.is_interactive { - writer.flush().context(file)?; + writer.flush()?; } } state.at_line_start = true; @@ -450,7 +524,7 @@ fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState // print to end of line or end of buffer let offset = if options.show_nonprint { - write_nonprint_to_end(&in_buf[pos..], &mut writer, options.tab.as_bytes()) + write_nonprint_to_end(&in_buf[pos..], &mut writer, options.tab().as_bytes()) } else if options.show_tabs { write_tab_to_end(&in_buf[pos..], &mut writer) } else { @@ -462,7 +536,7 @@ fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState break; } // print suitable end of line - writer.write_all(options.end_of_line.as_bytes())?; + writer.write_all(options.end_of_line().as_bytes())?; if handle.is_interactive { writer.flush()?; } diff --git a/src/uu/wc/src/count_bytes.rs b/src/uu/wc/src/count_bytes.rs index dc90f67cc..0c3b5edb7 100644 --- a/src/uu/wc/src/count_bytes.rs +++ b/src/uu/wc/src/count_bytes.rs @@ -20,6 +20,21 @@ use nix::unistd::pipe; const BUF_SIZE: usize = 16384; +/// Splice wrapper which handles short writes +#[cfg(any(target_os = "linux", target_os = "android"))] +#[inline] +fn splice_exact(read_fd: RawFd, write_fd: RawFd, num_bytes: usize) -> nix::Result<()> { + let mut left = num_bytes; + loop { + let written = splice(read_fd, None, write_fd, None, left, SpliceFFlags::empty())?; + left -= written; + if left == 0 { + break; + } + } + Ok(()) +} + /// This is a Linux-specific function to count the number of bytes using the /// `splice` system call, which is faster than using `read`. #[inline] @@ -39,7 +54,7 @@ fn count_bytes_using_splice(fd: RawFd) -> nix::Result { break; } byte_count += res; - splice(pipe_rd, None, null, None, res, SpliceFFlags::empty())?; + splice_exact(pipe_rd, null, res)?; } Ok(byte_count) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index 481b1683d..7b4c9924e 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -1,7 +1,5 @@ -#[cfg(unix)] -extern crate unix_socket; - use crate::common::util::*; +use std::io::Read; #[test] fn test_output_simple() { @@ -11,6 +9,129 @@ fn test_output_simple() { .stdout_only("abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); } +#[test] +fn test_no_options() { + for fixture in &["empty.txt", "alpha.txt", "nonewline.txt"] { + // Give fixture through command line file argument + new_ucmd!() + .args(&[fixture]) + .succeeds() + .stdout_is_fixture(fixture); + // Give fixture through stdin + new_ucmd!() + .pipe_in_fixture(fixture) + .succeeds() + .stdout_is_fixture(fixture); + } +} + +#[test] +fn test_no_options_big_input() { + for &n in &[ + 0, + 1, + 42, + 16 * 1024 - 7, + 16 * 1024 - 1, + 16 * 1024, + 16 * 1024 + 1, + 16 * 1024 + 3, + 32 * 1024, + 64 * 1024, + 80 * 1024, + 96 * 1024, + 112 * 1024, + 128 * 1024, + ] { + let data = vec_of_size(n); + let data2 = data.clone(); + assert_eq!(data.len(), data2.len()); + new_ucmd!().pipe_in(data).succeeds().stdout_is_bytes(&data2); + } +} + +#[test] +#[cfg(unix)] +fn test_fifo_symlink() { + use std::fs::OpenOptions; + use std::io::Write; + use std::thread; + + let s = TestScenario::new(util_name!()); + s.fixtures.mkdir("dir"); + s.fixtures.mkfifo("dir/pipe"); + assert!(s.fixtures.is_fifo("dir/pipe")); + + // Make cat read the pipe through a symlink + s.fixtures.symlink_file("dir/pipe", "sympipe"); + let proc = s.ucmd().args(&["sympipe"]).run_no_wait(); + + let data = vec_of_size(128 * 1024); + let data2 = data.clone(); + + let pipe_path = s.fixtures.plus("dir/pipe"); + let thread = thread::spawn(move || { + let mut pipe = OpenOptions::new() + .write(true) + .create(false) + .open(pipe_path) + .unwrap(); + pipe.write_all(&data).unwrap(); + }); + + let output = proc.wait_with_output().unwrap(); + assert_eq!(&output.stdout, &data2); + thread.join().unwrap(); +} + +#[test] +fn test_directory() { + let s = TestScenario::new(util_name!()); + s.fixtures.mkdir("test_directory"); + s.ucmd() + .args(&["test_directory"]) + .fails() + .stderr_is("cat: test_directory: Is a directory"); +} + +#[test] +fn test_directory_and_file() { + let s = TestScenario::new(util_name!()); + s.fixtures.mkdir("test_directory2"); + for fixture in &["empty.txt", "alpha.txt", "nonewline.txt"] { + s.ucmd() + .args(&["test_directory2", fixture]) + .fails() + .stderr_is("cat: test_directory2: Is a directory") + .stdout_is_fixture(fixture); + } +} + +#[test] +fn test_three_directories_and_file_and_stdin() { + let s = TestScenario::new(util_name!()); + s.fixtures.mkdir("test_directory3"); + s.fixtures.mkdir("test_directory3/test_directory4"); + s.fixtures.mkdir("test_directory3/test_directory5"); + s.ucmd() + .args(&[ + "test_directory3/test_directory4", + "alpha.txt", + "-", + "filewhichdoesnotexist.txt", + "nonewline.txt", + "test_directory3/test_directory5", + "test_directory3/../test_directory3/test_directory5", + "test_directory3", + ]) + .pipe_in("stdout bytes") + .fails() + .stderr_is_fixture("three_directories_and_file_and_stdin.stderr.expected") + .stdout_is( + "abcde\nfghij\nklmno\npqrst\nuvwxyz\nstdout bytestext without a trailing newline", + ); +} + #[test] fn test_output_multi_files_print_all_chars() { new_ucmd!() @@ -149,13 +270,64 @@ fn test_squeeze_blank_before_numbering() { } } +/// This tests reading from Unix character devices #[test] -#[cfg(foo)] +#[cfg(unix)] +fn test_dev_random() { + let mut buf = [0; 2048]; + let mut proc = new_ucmd!().args(&["/dev/random"]).run_no_wait(); + let mut proc_stdout = proc.stdout.take().unwrap(); + proc_stdout.read_exact(&mut buf).unwrap(); + + let num_zeroes = buf.iter().fold(0, |mut acc, &n| { + if n == 0 { + acc += 1; + } + acc + }); + // The probability of more than 512 zero bytes is essentially zero if the + // output is truly random. + assert!(num_zeroes < 512); + proc.kill().unwrap(); +} + +/// Reading from /dev/full should return an infinite amount of zero bytes. +/// Wikipedia says there is support on Linux, FreeBSD, and NetBSD. +#[test] +#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))] +fn test_dev_full() { + let mut buf = [0; 2048]; + let mut proc = new_ucmd!().args(&["/dev/full"]).run_no_wait(); + let mut proc_stdout = proc.stdout.take().unwrap(); + let expected = [0; 2048]; + proc_stdout.read_exact(&mut buf).unwrap(); + assert_eq!(&buf[..], &expected[..]); + proc.kill().unwrap(); +} + +#[test] +#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))] +fn test_dev_full_show_all() { + let mut buf = [0; 2048]; + let mut proc = new_ucmd!().args(&["-A", "/dev/full"]).run_no_wait(); + let mut proc_stdout = proc.stdout.take().unwrap(); + proc_stdout.read_exact(&mut buf).unwrap(); + + let expected: Vec = (0..buf.len()) + .map(|n| if n & 1 == 0 { b'^' } else { b'@' }) + .collect(); + + assert_eq!(&buf[..], &expected[..]); + proc.kill().unwrap(); +} + +#[test] +#[cfg(unix)] fn test_domain_socket() { - use self::tempdir::TempDir; - use self::unix_socket::UnixListener; use std::io::prelude::*; use std::thread; + use tempdir::TempDir; + use unix_socket::UnixListener; let dir = TempDir::new("unix_socket").expect("failed to create dir"); let socket_path = dir.path().join("sock"); diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index fc1665efc..075878470 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -1,5 +1,33 @@ use crate::common::util::*; +#[test] +fn test_count_bytes_large_stdin() { + for &n in &[ + 0, + 1, + 42, + 16 * 1024 - 7, + 16 * 1024 - 1, + 16 * 1024, + 16 * 1024 + 1, + 16 * 1024 + 3, + 32 * 1024, + 64 * 1024, + 80 * 1024, + 96 * 1024, + 112 * 1024, + 128 * 1024, + ] { + let data = vec_of_size(n); + let expected = format!("{}\n", n); + new_ucmd!() + .args(&["-c"]) + .pipe_in(data) + .succeeds() + .stdout_is_bytes(&expected.as_bytes()); + } +} + #[test] fn test_stdin_default() { new_ucmd!() diff --git a/tests/common/util.rs b/tests/common/util.rs index 13c58747d..d5663e9ed 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -222,6 +222,12 @@ impl CmdResult { self } + /// Like stdout_is_fixture, but for stderr + pub fn stderr_is_fixture>(&self, file_rel_path: T) -> &CmdResult { + let contents = read_scenario_fixture(&self.tmpd, file_rel_path); + self.stderr_is_bytes(contents) + } + /// asserts that /// 1. the command resulted in stdout stream output that equals the /// passed in value @@ -804,3 +810,12 @@ pub fn read_size(child: &mut Child, size: usize) -> String { .unwrap(); String::from_utf8(output).unwrap() } + +pub fn vec_of_size(n: usize) -> Vec { + let mut result = Vec::new(); + for _ in 0..n { + result.push('a' as u8); + } + assert_eq!(result.len(), n); + result +} diff --git a/tests/fixtures/cat/empty.txt b/tests/fixtures/cat/empty.txt new file mode 100644 index 000000000..e69de29bb diff --git a/tests/fixtures/cat/three_directories_and_file_and_stdin.stderr.expected b/tests/fixtures/cat/three_directories_and_file_and_stdin.stderr.expected new file mode 100644 index 000000000..1a8a33d77 --- /dev/null +++ b/tests/fixtures/cat/three_directories_and_file_and_stdin.stderr.expected @@ -0,0 +1,5 @@ +cat: test_directory3/test_directory4: Is a directory +cat: filewhichdoesnotexist.txt: No such file or directory (os error 2) +cat: test_directory3/test_directory5: Is a directory +cat: test_directory3/../test_directory3/test_directory5: Is a directory +cat: test_directory3: Is a directory From c6021e10c2fa46d906cb8d3b804d8348b68d0c92 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sat, 10 Apr 2021 15:27:16 -0500 Subject: [PATCH 0319/1135] Fix SemVer non version lines/empty line sorting with a test --- src/uu/sort/src/sort.rs | 15 +++++++++++++-- tests/by-util/test_sort.rs | 9 +++++++++ tests/fixtures/sort/version-empty-lines.expected | 11 +++++++++++ tests/fixtures/sort/version-empty-lines.txt | 11 +++++++++++ 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 tests/fixtures/sort/version-empty-lines.expected create mode 100644 tests/fixtures/sort/version-empty-lines.txt diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 6611a70e4..8bf6eb1e8 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1262,10 +1262,21 @@ fn month_compare(a: &str, b: &str) -> Ordering { } } +fn version_parse(a: &str) -> Version { + let result = Version::parse(a); + + match result { + Ok(vers_a) => vers_a, + // Non-version lines parse to 0.0.0 + Err(_e) => Version::parse("0.0.0").unwrap(), + } +} + fn version_compare(a: &str, b: &str) -> Ordering { #![allow(clippy::comparison_chain)] - let ver_a = Version::parse(a); - let ver_b = Version::parse(b); + let ver_a = version_parse(a); + let ver_b = version_parse(b); + // Version::cmp is not implemented; implement comparison directly if ver_a > ver_b { Ordering::Greater diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 23ce3258d..0f8020688 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -13,6 +13,15 @@ fn test_months_whitespace() { test_helper("months-whitespace", "-M"); } +#[test] +fn test_version_empty_lines() { + new_ucmd!() + .arg("-V") + .arg("version-empty-lines.txt") + .succeeds() + .stdout_is("\n\n\n\n\n\n\n1.2.3-alpha\n1.2.3-alpha2\n\t\t\t1.12.4\n11.2.3\n"); +} + #[test] fn test_human_numeric_whitespace() { test_helper("human-numeric-whitespace", "-h"); diff --git a/tests/fixtures/sort/version-empty-lines.expected b/tests/fixtures/sort/version-empty-lines.expected new file mode 100644 index 000000000..c496c0ff5 --- /dev/null +++ b/tests/fixtures/sort/version-empty-lines.expected @@ -0,0 +1,11 @@ + + + + + + + +1.2.3-alpha +1.2.3-alpha2 +11.2.3 + 1.12.4 diff --git a/tests/fixtures/sort/version-empty-lines.txt b/tests/fixtures/sort/version-empty-lines.txt new file mode 100644 index 000000000..9b6b89788 --- /dev/null +++ b/tests/fixtures/sort/version-empty-lines.txt @@ -0,0 +1,11 @@ +11.2.3 + + + +1.2.3-alpha2 + + +1.2.3-alpha + + + 1.12.4 From 81d42aa2b36186bb6b1d58e92968a8d0f06373b3 Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Mon, 5 Apr 2021 23:03:43 +0300 Subject: [PATCH 0320/1135] Fix some tests to not use CmdResult fields --- tests/by-util/test_arch.rs | 14 ++- tests/by-util/test_basename.rs | 2 +- tests/by-util/test_chgrp.rs | 2 +- tests/by-util/test_chmod.rs | 100 ++++++++------------- tests/by-util/test_chown.rs | 157 +++++++++++++++++---------------- tests/by-util/test_chroot.rs | 16 ++-- tests/by-util/test_cp.rs | 30 +++---- tests/by-util/test_date.rs | 20 ++--- tests/by-util/test_du.rs | 52 +++++------ tests/by-util/test_echo.rs | 57 ++++++------ tests/by-util/test_env.rs | 71 ++++++--------- tests/by-util/test_expand.rs | 63 +++++++------ tests/by-util/test_factor.rs | 7 +- tests/by-util/test_fmt.rs | 6 +- tests/by-util/test_groups.rs | 31 ++++--- tests/by-util/test_hashsum.rs | 4 +- tests/by-util/test_hostid.rs | 2 +- tests/by-util/test_hostname.rs | 14 +-- tests/by-util/test_id.rs | 126 +++++++++----------------- tests/by-util/test_install.rs | 35 ++------ tests/by-util/test_ln.rs | 10 +-- tests/by-util/test_logname.rs | 12 +-- 22 files changed, 353 insertions(+), 478 deletions(-) diff --git a/tests/by-util/test_arch.rs b/tests/by-util/test_arch.rs index d2ec138d9..909e0ee80 100644 --- a/tests/by-util/test_arch.rs +++ b/tests/by-util/test_arch.rs @@ -2,17 +2,13 @@ use crate::common::util::*; #[test] fn test_arch() { - let (_, mut ucmd) = at_and_ucmd!(); - - let result = ucmd.run(); - assert!(result.success); + new_ucmd!().succeeds(); } #[test] fn test_arch_help() { - let (_, mut ucmd) = at_and_ucmd!(); - - let result = ucmd.arg("--help").run(); - assert!(result.success); - assert!(result.stdout.contains("architecture name")); + new_ucmd!() + .arg("--help") + .succeeds() + .stdout_contains("architecture name"); } diff --git a/tests/by-util/test_basename.rs b/tests/by-util/test_basename.rs index fa599644d..3483e800c 100644 --- a/tests/by-util/test_basename.rs +++ b/tests/by-util/test_basename.rs @@ -66,7 +66,7 @@ fn test_zero_param() { } fn expect_error(input: Vec<&str>) { - assert!(new_ucmd!().args(&input).fails().no_stdout().stderr.len() > 0); + assert!(new_ucmd!().args(&input).fails().no_stdout().stderr().len() > 0); } #[test] diff --git a/tests/by-util/test_chgrp.rs b/tests/by-util/test_chgrp.rs index 613f52fd2..343b336a6 100644 --- a/tests/by-util/test_chgrp.rs +++ b/tests/by-util/test_chgrp.rs @@ -149,7 +149,7 @@ fn test_big_h() { .arg("bin") .arg("/proc/self/fd") .fails() - .stderr + .stderr_str() .lines() .fold(0, |acc, _| acc + 1) > 1 diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index b85567166..d60b8a50b 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -48,7 +48,7 @@ fn run_single_test(test: &TestCase, at: AtPath, mut ucmd: UCommand) { } let r = ucmd.run(); if !r.success { - println!("{}", r.stderr); + println!("{}", r.stderr_str()); panic!("{:?}: failed", ucmd.raw); } @@ -297,13 +297,14 @@ fn test_chmod_recursive() { mkfile(&at.plus_as_string("a/b/c/c"), 0o100444); mkfile(&at.plus_as_string("z/y"), 0o100444); - let result = ucmd - .arg("-R") + ucmd.arg("-R") .arg("--verbose") .arg("-r,a+w") .arg("a") .arg("z") - .succeeds(); + .succeeds() + .stderr_contains(&"to 333 (-wx-wx-wx)") + .stderr_contains(&"to 222 (-w--w--w-)"); assert_eq!(at.metadata("z/y").permissions().mode(), 0o100222); assert_eq!(at.metadata("a/a").permissions().mode(), 0o100222); @@ -312,8 +313,6 @@ fn test_chmod_recursive() { println!("mode {:o}", at.metadata("a").permissions().mode()); assert_eq!(at.metadata("a").permissions().mode(), 0o40333); assert_eq!(at.metadata("z").permissions().mode(), 0o40333); - assert!(result.stderr.contains("to 333 (-wx-wx-wx)")); - assert!(result.stderr.contains("to 222 (-w--w--w-)")); unsafe { umask(original_umask); @@ -322,30 +321,24 @@ fn test_chmod_recursive() { #[test] fn test_chmod_non_existing_file() { - let (_at, mut ucmd) = at_and_ucmd!(); - let result = ucmd + new_ucmd!() .arg("-R") .arg("--verbose") .arg("-r,a+w") .arg("dont-exist") - .fails(); - assert!(result - .stderr - .contains("cannot access 'dont-exist': No such file or directory")); + .fails() + .stderr_contains(&"cannot access 'dont-exist': No such file or directory"); } #[test] fn test_chmod_preserve_root() { - let (_at, mut ucmd) = at_and_ucmd!(); - let result = ucmd + new_ucmd!() .arg("-R") .arg("--preserve-root") .arg("755") .arg("/") - .fails(); - assert!(result - .stderr - .contains("chmod: error: it is dangerous to operate recursively on '/'")); + .fails() + .stderr_contains(&"chmod: error: it is dangerous to operate recursively on '/'"); } #[test] @@ -362,33 +355,27 @@ fn test_chmod_symlink_non_existing_file() { let expected_stderr = &format!("cannot operate on dangling symlink '{}'", test_symlink); at.symlink_file(non_existing, test_symlink); - let mut result; // this cannot succeed since the symbolic link dangles - result = scene.ucmd().arg("755").arg("-v").arg(test_symlink).fails(); - - println!("stdout = {:?}", result.stdout); - println!("stderr = {:?}", result.stderr); - - assert!(result.stdout.contains(expected_stdout)); - assert!(result.stderr.contains(expected_stderr)); - assert_eq!(result.code, Some(1)); + scene.ucmd() + .arg("755") + .arg("-v") + .arg(test_symlink) + .fails() + .code_is(1) + .stdout_contains(expected_stdout) + .stderr_contains(expected_stderr); // this should be the same than with just '-v' but without stderr - result = scene - .ucmd() + scene.ucmd() .arg("755") .arg("-v") .arg("-f") .arg(test_symlink) - .fails(); - - println!("stdout = {:?}", result.stdout); - println!("stderr = {:?}", result.stderr); - - assert!(result.stdout.contains(expected_stdout)); - assert!(result.stderr.is_empty()); - assert_eq!(result.code, Some(1)); + .run() + .code_is(1) + .no_stderr() + .stdout_contains(expected_stdout); } #[test] @@ -405,18 +392,15 @@ fn test_chmod_symlink_non_existing_file_recursive() { non_existing, &format!("{}/{}", test_directory, test_symlink), ); - let mut result; // this should succeed - result = scene - .ucmd() + scene.ucmd() .arg("-R") .arg("755") .arg(test_directory) - .succeeds(); - assert_eq!(result.code, Some(0)); - assert!(result.stdout.is_empty()); - assert!(result.stderr.is_empty()); + .succeeds() + .no_stderr() + .no_stdout(); let expected_stdout = &format!( "mode of '{}' retained as 0755 (rwxr-xr-x)\nneither symbolic link '{}/{}' nor referent has been changed", @@ -424,37 +408,25 @@ fn test_chmod_symlink_non_existing_file_recursive() { ); // '-v': this should succeed without stderr - result = scene - .ucmd() + scene.ucmd() .arg("-R") .arg("-v") .arg("755") .arg(test_directory) - .succeeds(); - - println!("stdout = {:?}", result.stdout); - println!("stderr = {:?}", result.stderr); - - assert!(result.stdout.contains(expected_stdout)); - assert!(result.stderr.is_empty()); - assert_eq!(result.code, Some(0)); + .succeeds() + .stdout_contains(expected_stdout) + .no_stderr(); // '-vf': this should be the same than with just '-v' - result = scene - .ucmd() + scene.ucmd() .arg("-R") .arg("-v") .arg("-f") .arg("755") .arg(test_directory) - .succeeds(); - - println!("stdout = {:?}", result.stdout); - println!("stderr = {:?}", result.stderr); - - assert!(result.stdout.contains(expected_stdout)); - assert!(result.stderr.is_empty()); - assert_eq!(result.code, Some(0)); + .succeeds() + .stdout_contains(expected_stdout) + .no_stderr(); } #[test] diff --git a/tests/by-util/test_chown.rs b/tests/by-util/test_chown.rs index 7b663e9c9..e27fba3d4 100644 --- a/tests/by-util/test_chown.rs +++ b/tests/by-util/test_chown.rs @@ -53,22 +53,22 @@ fn test_chown_myself() { // test chown username file.txt let scene = TestScenario::new(util_name!()); let result = scene.cmd("whoami").run(); - if is_ci() && result.stderr.contains("No such user/group") { + if is_ci() && result.stderr_str().contains("No such user/group") { // In the CI, some server are failing to return whoami. // As seems to be a configuration issue, ignoring it return; } - println!("results {}", result.stdout); - let username = result.stdout.trim_end(); + println!("results {}", result.stdout_str()); + let username = result.stdout_str().trim_end(); let (at, mut ucmd) = at_and_ucmd!(); let file1 = "test_install_target_dir_file_a1"; at.touch(file1); let result = ucmd.arg(username).arg(file1).run(); - println!("results stdout {}", result.stdout); - println!("results stderr {}", result.stderr); - if is_ci() && result.stderr.contains("invalid user") { + println!("results stdout {}", result.stdout_str()); + println!("results stderr {}", result.stderr_str()); + if is_ci() && result.stderr_str().contains("invalid user") { // In the CI, some server are failing to return id. // As seems to be a configuration issue, ignoring it return; @@ -81,24 +81,24 @@ fn test_chown_myself_second() { // test chown username: file.txt let scene = TestScenario::new(util_name!()); let result = scene.cmd("whoami").run(); - if is_ci() && result.stderr.contains("No such user/group") { + if is_ci() && result.stderr_str().contains("No such user/group") { // In the CI, some server are failing to return whoami. // As seems to be a configuration issue, ignoring it return; } - println!("results {}", result.stdout); + println!("results {}", result.stdout_str()); let (at, mut ucmd) = at_and_ucmd!(); let file1 = "test_install_target_dir_file_a1"; at.touch(file1); let result = ucmd - .arg(result.stdout.trim_end().to_owned() + ":") + .arg(result.stdout_str().trim_end().to_owned() + ":") .arg(file1) .run(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); assert!(result.success); } @@ -107,31 +107,31 @@ fn test_chown_myself_group() { // test chown username:group file.txt let scene = TestScenario::new(util_name!()); let result = scene.cmd("whoami").run(); - if is_ci() && result.stderr.contains("No such user/group") { + if is_ci() && result.stderr_str().contains("No such user/group") { // In the CI, some server are failing to return whoami. // As seems to be a configuration issue, ignoring it return; } - println!("user name = {}", result.stdout); - let username = result.stdout.trim_end(); + println!("user name = {}", result.stdout_str()); + let username = result.stdout_str().trim_end(); let result = scene.cmd("id").arg("-gn").run(); - if is_ci() && result.stderr.contains("No such user/group") { + if is_ci() && result.stderr_str().contains("No such user/group") { // In the CI, some server are failing to return whoami. // As seems to be a configuration issue, ignoring it return; } - println!("group name = {}", result.stdout); - let group = result.stdout.trim_end(); + println!("group name = {}", result.stdout_str()); + let group = result.stdout_str().trim_end(); let (at, mut ucmd) = at_and_ucmd!(); let file1 = "test_install_target_dir_file_a1"; let perm = username.to_owned() + ":" + group; at.touch(file1); let result = ucmd.arg(perm).arg(file1).run(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - if is_ci() && result.stderr.contains("chown: invalid group:") { + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + if is_ci() && result.stderr_str().contains("chown: invalid group:") { // With some Ubuntu into the CI, we can get this answer return; } @@ -143,27 +143,27 @@ fn test_chown_only_group() { // test chown :group file.txt let scene = TestScenario::new(util_name!()); let result = scene.cmd("whoami").run(); - if is_ci() && result.stderr.contains("No such user/group") { + if is_ci() && result.stderr_str().contains("No such user/group") { // In the CI, some server are failing to return whoami. // As seems to be a configuration issue, ignoring it return; } - println!("results {}", result.stdout); + println!("results {}", result.stdout_str()); let (at, mut ucmd) = at_and_ucmd!(); let file1 = "test_install_target_dir_file_a1"; - let perm = ":".to_owned() + result.stdout.trim_end(); + let perm = ":".to_owned() + result.stdout_str().trim_end(); at.touch(file1); let result = ucmd.arg(perm).arg(file1).run(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); - if is_ci() && result.stderr.contains("Operation not permitted") { + if is_ci() && result.stderr_str().contains("Operation not permitted") { // With ubuntu with old Rust in the CI, we can get an error return; } - if is_ci() && result.stderr.contains("chown: invalid group:") { + if is_ci() && result.stderr_str().contains("chown: invalid group:") { // With mac into the CI, we can get this answer return; } @@ -174,14 +174,14 @@ fn test_chown_only_group() { fn test_chown_only_id() { // test chown 1111 file.txt let result = TestScenario::new("id").ucmd_keepenv().arg("-u").run(); - if is_ci() && result.stderr.contains("No such user/group") { + if is_ci() && result.stderr_str().contains("No such user/group") { // In the CI, some server are failing to return whoami. // As seems to be a configuration issue, ignoring it return; } - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let id = String::from(result.stdout.trim()); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + let id = String::from(result.stdout_str().trim()); let (at, mut ucmd) = at_and_ucmd!(); let file1 = "test_install_target_dir_file_a1"; @@ -189,9 +189,9 @@ fn test_chown_only_id() { at.touch(file1); let result = ucmd.arg(id).arg(file1).run(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - if is_ci() && result.stderr.contains("chown: invalid user:") { + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + if is_ci() && result.stderr_str().contains("chown: invalid user:") { // With some Ubuntu into the CI, we can get this answer return; } @@ -202,14 +202,14 @@ fn test_chown_only_id() { fn test_chown_only_group_id() { // test chown :1111 file.txt let result = TestScenario::new("id").ucmd_keepenv().arg("-g").run(); - if is_ci() && result.stderr.contains("No such user/group") { + if is_ci() && result.stderr_str().contains("No such user/group") { // In the CI, some server are failing to return whoami. // As seems to be a configuration issue, ignoring it return; } - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let id = String::from(result.stdout.trim()); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + let id = String::from(result.stdout_str().trim()); let (at, mut ucmd) = at_and_ucmd!(); let file1 = "test_install_target_dir_file_a1"; @@ -219,9 +219,9 @@ fn test_chown_only_group_id() { let result = ucmd.arg(perm).arg(file1).run(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - if is_ci() && result.stderr.contains("chown: invalid group:") { + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + if is_ci() && result.stderr_str().contains("chown: invalid group:") { // With mac into the CI, we can get this answer return; } @@ -232,24 +232,24 @@ fn test_chown_only_group_id() { fn test_chown_both_id() { // test chown 1111:1111 file.txt let result = TestScenario::new("id").ucmd_keepenv().arg("-u").run(); - if is_ci() && result.stderr.contains("No such user/group") { + if is_ci() && result.stderr_str().contains("No such user/group") { // In the CI, some server are failing to return whoami. // As seems to be a configuration issue, ignoring it return; } - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let id_user = String::from(result.stdout.trim()); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + let id_user = String::from(result.stdout_str().trim()); let result = TestScenario::new("id").ucmd_keepenv().arg("-g").run(); - if is_ci() && result.stderr.contains("No such user/group") { + if is_ci() && result.stderr_str().contains("No such user/group") { // In the CI, some server are failing to return whoami. // As seems to be a configuration issue, ignoring it return; } - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let id_group = String::from(result.stdout.trim()); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + let id_group = String::from(result.stdout_str().trim()); let (at, mut ucmd) = at_and_ucmd!(); let file1 = "test_install_target_dir_file_a1"; @@ -258,10 +258,10 @@ fn test_chown_both_id() { let perm = id_user + &":".to_owned() + &id_group; let result = ucmd.arg(perm).arg(file1).run(); - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); - if is_ci() && result.stderr.contains("invalid user") { + if is_ci() && result.stderr_str().contains("invalid user") { // In the CI, some server are failing to return id. // As seems to be a configuration issue, ignoring it return; @@ -274,24 +274,24 @@ fn test_chown_both_id() { fn test_chown_both_mix() { // test chown 1111:1111 file.txt let result = TestScenario::new("id").ucmd_keepenv().arg("-u").run(); - if is_ci() && result.stderr.contains("No such user/group") { + if is_ci() && result.stderr_str().contains("No such user/group") { // In the CI, some server are failing to return whoami. // As seems to be a configuration issue, ignoring it return; } - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let id_user = String::from(result.stdout.trim()); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + let id_user = String::from(result.stdout_str().trim()); let result = TestScenario::new("id").ucmd_keepenv().arg("-gn").run(); - if is_ci() && result.stderr.contains("No such user/group") { + if is_ci() && result.stderr_str().contains("No such user/group") { // In the CI, some server are failing to return whoami. // As seems to be a configuration issue, ignoring it return; } - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let group_name = String::from(result.stdout.trim()); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + let group_name = String::from(result.stdout_str().trim()); let (at, mut ucmd) = at_and_ucmd!(); let file1 = "test_install_target_dir_file_a1"; @@ -301,7 +301,7 @@ fn test_chown_both_mix() { let result = ucmd.arg(perm).arg(file1).run(); - if is_ci() && result.stderr.contains("invalid user") { + if is_ci() && result.stderr_str().contains("invalid user") { // In the CI, some server are failing to return id. // As seems to be a configuration issue, ignoring it return; @@ -313,14 +313,14 @@ fn test_chown_both_mix() { fn test_chown_recursive() { let scene = TestScenario::new(util_name!()); let result = scene.cmd("whoami").run(); - if is_ci() && result.stderr.contains("No such user/group") { + if is_ci() && result.stderr_str().contains("No such user/group") { // In the CI, some server are failing to return whoami. // As seems to be a configuration issue, ignoring it return; } - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let username = result.stdout.trim_end(); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + let username = result.stdout_str().trim_end(); let (at, mut ucmd) = at_and_ucmd!(); at.mkdir("a"); @@ -339,31 +339,32 @@ fn test_chown_recursive() { .arg("a") .arg("z") .run(); - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - if is_ci() && result.stderr.contains("invalid user") { + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + if is_ci() && result.stderr_str().contains("invalid user") { // In the CI, some server are failing to return id. // As seems to be a configuration issue, ignoring it return; } - assert!(result.stderr.contains("ownership of 'a/a' retained as")); - assert!(result.stderr.contains("ownership of 'z/y' retained as")); - assert!(result.success); + result + .stderr_contains(&"ownership of 'a/a' retained as") + .stderr_contains(&"ownership of 'z/y' retained as") + .success(); } #[test] fn test_root_preserve() { let scene = TestScenario::new(util_name!()); let result = scene.cmd("whoami").run(); - if is_ci() && result.stderr.contains("No such user/group") { + if is_ci() && result.stderr_str().contains("No such user/group") { // In the CI, some server are failing to return whoami. // As seems to be a configuration issue, ignoring it return; } - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let username = result.stdout.trim_end(); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + let username = result.stdout_str().trim_end(); let result = new_ucmd!() .arg("--preserve-root") @@ -371,9 +372,9 @@ fn test_root_preserve() { .arg(username) .arg("/") .fails(); - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - if is_ci() && result.stderr.contains("invalid user") { + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + if is_ci() && result.stderr_str().contains("invalid user") { // In the CI, some server are failing to return id. // As seems to be a configuration issue, ignoring it return; diff --git a/tests/by-util/test_chroot.rs b/tests/by-util/test_chroot.rs index 9a8fb71dd..05efd23ae 100644 --- a/tests/by-util/test_chroot.rs +++ b/tests/by-util/test_chroot.rs @@ -64,14 +64,14 @@ fn test_preference_of_userspec() { // As seems to be a configuration issue, ignoring it return; } - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let username = result.stdout.trim_end(); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + let username = result.stdout_str().trim_end(); let ts = TestScenario::new("id"); let result = ts.cmd("id").arg("-g").arg("-n").run(); - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); if is_ci() && result.stderr.contains("cannot find name for user ID") { // In the CI, some server are failing to return id. @@ -79,7 +79,7 @@ fn test_preference_of_userspec() { return; } - let group_name = result.stdout.trim_end(); + let group_name = result.stdout_str().trim_end(); let (at, mut ucmd) = at_and_ucmd!(); at.mkdir("a"); @@ -93,6 +93,6 @@ fn test_preference_of_userspec() { .arg(format!("--userspec={}:{}", username, group_name)) .run(); - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); } diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 1fa8212ca..07880d5c0 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -275,8 +275,8 @@ fn test_cp_arg_no_clobber_twice() { .arg("dest.txt") .run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); + println!("stderr = {:?}", result.stderr_str()); + println!("stdout = {:?}", result.stdout_str()); assert!(result.success); assert!(result.stderr.is_empty()); assert_eq!(at.read("source.txt"), ""); @@ -317,8 +317,8 @@ fn test_cp_arg_force() { .arg(TEST_HELLO_WORLD_DEST) .run(); - println!("{:?}", result.stderr); - println!("{:?}", result.stdout); + println!("{:?}", result.stderr_str()); + println!("{:?}", result.stdout_str()); assert!(result.success); assert_eq!(at.read(TEST_HELLO_WORLD_DEST), "Hello, World!\n"); @@ -602,7 +602,7 @@ fn test_cp_deref_folder_to_folder() { .arg(TEST_COPY_FROM_FOLDER) .arg(TEST_COPY_TO_FOLDER_NEW) .run(); - println!("cp output {}", result.stdout); + println!("cp output {}", result.stdout_str()); // Check that the exit code represents a successful copy. assert!(result.success); @@ -611,12 +611,12 @@ fn test_cp_deref_folder_to_folder() { { let scene2 = TestScenario::new("ls"); let result = scene2.cmd("ls").arg("-al").arg(path_to_new_symlink).run(); - println!("ls source {}", result.stdout); + println!("ls source {}", result.stdout_str()); let path_to_new_symlink = at.subdir.join(TEST_COPY_TO_FOLDER_NEW); let result = scene2.cmd("ls").arg("-al").arg(path_to_new_symlink).run(); - println!("ls dest {}", result.stdout); + println!("ls dest {}", result.stdout_str()); } #[cfg(windows)] @@ -706,7 +706,7 @@ fn test_cp_no_deref_folder_to_folder() { .arg(TEST_COPY_FROM_FOLDER) .arg(TEST_COPY_TO_FOLDER_NEW) .run(); - println!("cp output {}", result.stdout); + println!("cp output {}", result.stdout_str()); // Check that the exit code represents a successful copy. assert!(result.success); @@ -715,12 +715,12 @@ fn test_cp_no_deref_folder_to_folder() { { let scene2 = TestScenario::new("ls"); let result = scene2.cmd("ls").arg("-al").arg(path_to_new_symlink).run(); - println!("ls source {}", result.stdout); + println!("ls source {}", result.stdout_str()); let path_to_new_symlink = at.subdir.join(TEST_COPY_TO_FOLDER_NEW); let result = scene2.cmd("ls").arg("-al").arg(path_to_new_symlink).run(); - println!("ls dest {}", result.stdout); + println!("ls dest {}", result.stdout_str()); } #[cfg(windows)] @@ -809,7 +809,7 @@ fn test_cp_archive() { let scene2 = TestScenario::new("ls"); let result = scene2.cmd("ls").arg("-al").arg(at.subdir).run(); - println!("ls dest {}", result.stdout); + println!("ls dest {}", result.stdout_str()); assert_eq!(creation, creation2); assert!(result.success); } @@ -863,7 +863,7 @@ fn test_cp_archive_recursive() { .arg(&at.subdir.join(TEST_COPY_TO_FOLDER)) .run(); - println!("ls dest {}", result.stdout); + println!("ls dest {}", result.stdout_str()); let scene2 = TestScenario::new("ls"); let result = scene2 @@ -872,7 +872,7 @@ fn test_cp_archive_recursive() { .arg(&at.subdir.join(TEST_COPY_TO_FOLDER_NEW)) .run(); - println!("ls dest {}", result.stdout); + println!("ls dest {}", result.stdout_str()); assert!(at.file_exists( &at.subdir .join(TEST_COPY_TO_FOLDER_NEW) @@ -946,7 +946,7 @@ fn test_cp_preserve_timestamps() { let scene2 = TestScenario::new("ls"); let result = scene2.cmd("ls").arg("-al").arg(at.subdir).run(); - println!("ls dest {}", result.stdout); + println!("ls dest {}", result.stdout_str()); assert_eq!(creation, creation2); assert!(result.success); } @@ -984,7 +984,7 @@ fn test_cp_dont_preserve_timestamps() { let scene2 = TestScenario::new("ls"); let result = scene2.cmd("ls").arg("-al").arg(at.subdir).run(); - println!("ls dest {}", result.stdout); + println!("ls dest {}", result.stdout_str()); println!("creation {:?} / {:?}", creation, creation2); assert_ne!(creation, creation2); diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 5619aed94..1933fdba3 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -28,13 +28,13 @@ fn test_date_rfc_3339() { // Check that the output matches the regexp let rfc_regexp = r"(\d+)-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])\s([01]\d|2[0-3]):([0-5]\d):([0-5]\d|60)(\.\d+)?(([Zz])|([\+|\-]([01]\d|2[0-3])))"; let re = Regex::new(rfc_regexp).unwrap(); - assert!(re.is_match(&result.stdout.trim())); + assert!(re.is_match(&result.stdout_str().trim())); result = scene.ucmd().arg("--rfc-3339=seconds").succeeds(); // Check that the output matches the regexp let re = Regex::new(rfc_regexp).unwrap(); - assert!(re.is_match(&result.stdout.trim())); + assert!(re.is_match(&result.stdout_str().trim())); } #[test] @@ -73,13 +73,13 @@ fn test_date_format_y() { assert!(result.success); let mut re = Regex::new(r"^\d{4}$").unwrap(); - assert!(re.is_match(&result.stdout.trim())); + assert!(re.is_match(&result.stdout_str().trim())); result = scene.ucmd().arg("+%y").succeeds(); assert!(result.success); re = Regex::new(r"^\d{2}$").unwrap(); - assert!(re.is_match(&result.stdout.trim())); + assert!(re.is_match(&result.stdout_str().trim())); } #[test] @@ -90,13 +90,13 @@ fn test_date_format_m() { assert!(result.success); let mut re = Regex::new(r"\S+").unwrap(); - assert!(re.is_match(&result.stdout.trim())); + assert!(re.is_match(&result.stdout_str().trim())); result = scene.ucmd().arg("+%m").succeeds(); assert!(result.success); re = Regex::new(r"^\d{2}$").unwrap(); - assert!(re.is_match(&result.stdout.trim())); + assert!(re.is_match(&result.stdout_str().trim())); } #[test] @@ -107,20 +107,20 @@ fn test_date_format_day() { assert!(result.success); let mut re = Regex::new(r"\S+").unwrap(); - assert!(re.is_match(&result.stdout.trim())); + assert!(re.is_match(&result.stdout_str().trim())); result = scene.ucmd().arg("+%A").succeeds(); assert!(result.success); re = Regex::new(r"\S+").unwrap(); - assert!(re.is_match(&result.stdout.trim())); + assert!(re.is_match(&result.stdout_str().trim())); result = scene.ucmd().arg("+%u").succeeds(); assert!(result.success); re = Regex::new(r"^\d{1}$").unwrap(); - assert!(re.is_match(&result.stdout.trim())); + assert!(re.is_match(&result.stdout_str().trim())); } #[test] @@ -131,7 +131,7 @@ fn test_date_format_full_day() { assert!(result.success); let re = Regex::new(r"\S+ \d{4}-\d{2}-\d{2}").unwrap(); - assert!(re.is_match(&result.stdout.trim())); + assert!(re.is_match(&result.stdout_str().trim())); } #[test] diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index 30dcd9bb3..8f2cff65d 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -7,10 +7,9 @@ const SUB_LINK: &str = "subdir/links/sublink.txt"; #[test] fn test_du_basics() { - let (_at, mut ucmd) = at_and_ucmd!(); - let result = ucmd.run(); - assert!(result.success); - assert_eq!(result.stderr, ""); + new_ucmd!() + .succeeds() + .no_stderr(); } #[cfg(target_vendor = "apple")] fn _du_basics(s: String) { @@ -22,7 +21,7 @@ fn _du_basics(s: String) { assert_eq!(s, answer); } #[cfg(not(target_vendor = "apple"))] -fn _du_basics(s: String) { +fn _du_basics(s: &str) { let answer = "28\t./subdir 8\t./subdir/deeper 16\t./subdir/links @@ -38,19 +37,19 @@ fn test_du_basics_subdir() { let result = ucmd.arg(SUB_DIR).run(); assert!(result.success); assert_eq!(result.stderr, ""); - _du_basics_subdir(result.stdout); + _du_basics_subdir(result.stdout_str()); } #[cfg(target_vendor = "apple")] -fn _du_basics_subdir(s: String) { +fn _du_basics_subdir(s: &str) { assert_eq!(s, "4\tsubdir/deeper\n"); } #[cfg(target_os = "windows")] -fn _du_basics_subdir(s: String) { +fn _du_basics_subdir(s: &str) { assert_eq!(s, "0\tsubdir/deeper\n"); } #[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] -fn _du_basics_subdir(s: String) { +fn _du_basics_subdir(s: &str) { // MS-WSL linux has altered expected output if !is_wsl() { assert_eq!(s, "8\tsubdir/deeper\n"); @@ -64,7 +63,7 @@ fn test_du_basics_bad_name() { let (_at, mut ucmd) = at_and_ucmd!(); let result = ucmd.arg("bad_name").run(); - assert_eq!(result.stdout, ""); + assert_eq!(result.stdout_str(), ""); assert_eq!( result.stderr, "du: error: bad_name: No such file or directory\n" @@ -81,20 +80,20 @@ fn test_du_soft_link() { let result = ts.ucmd().arg(SUB_DIR_LINKS).run(); assert!(result.success); assert_eq!(result.stderr, ""); - _du_soft_link(result.stdout); + _du_soft_link(result.stdout_str()); } #[cfg(target_vendor = "apple")] -fn _du_soft_link(s: String) { +fn _du_soft_link(s: &str) { // 'macos' host variants may have `du` output variation for soft links assert!((s == "12\tsubdir/links\n") || (s == "16\tsubdir/links\n")); } #[cfg(target_os = "windows")] -fn _du_soft_link(s: String) { +fn _du_soft_link(s: &str) { assert_eq!(s, "8\tsubdir/links\n"); } #[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] -fn _du_soft_link(s: String) { +fn _du_soft_link(s: &str) { // MS-WSL linux has altered expected output if !is_wsl() { assert_eq!(s, "16\tsubdir/links\n"); @@ -114,19 +113,19 @@ fn test_du_hard_link() { assert!(result.success); assert_eq!(result.stderr, ""); // We do not double count hard links as the inodes are identical - _du_hard_link(result.stdout); + _du_hard_link(result.stdout_str()); } #[cfg(target_vendor = "apple")] -fn _du_hard_link(s: String) { +fn _du_hard_link(s: &str) { assert_eq!(s, "12\tsubdir/links\n") } #[cfg(target_os = "windows")] -fn _du_hard_link(s: String) { +fn _du_hard_link(s: &str) { assert_eq!(s, "8\tsubdir/links\n") } #[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] -fn _du_hard_link(s: String) { +fn _du_hard_link(s: &str) { // MS-WSL linux has altered expected output if !is_wsl() { assert_eq!(s, "16\tsubdir/links\n"); @@ -142,19 +141,19 @@ fn test_du_d_flag() { let result = ts.ucmd().arg("-d").arg("1").run(); assert!(result.success); assert_eq!(result.stderr, ""); - _du_d_flag(result.stdout); + _du_d_flag(result.stdout_str()); } #[cfg(target_vendor = "apple")] -fn _du_d_flag(s: String) { +fn _du_d_flag(s: &str) { assert_eq!(s, "16\t./subdir\n20\t./\n"); } #[cfg(target_os = "windows")] -fn _du_d_flag(s: String) { +fn _du_d_flag(s: &str) { assert_eq!(s, "8\t./subdir\n8\t./\n"); } #[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] -fn _du_d_flag(s: String) { +fn _du_d_flag(s: &str) { // MS-WSL linux has altered expected output if !is_wsl() { assert_eq!(s, "28\t./subdir\n36\t./\n"); @@ -167,10 +166,11 @@ fn _du_d_flag(s: String) { fn test_du_h_flag_empty_file() { let ts = TestScenario::new("du"); - let result = ts.ucmd().arg("-h").arg("empty.txt").run(); - assert!(result.success); - assert_eq!(result.stderr, ""); - assert_eq!(result.stdout, "0\tempty.txt\n"); + ts.ucmd() + .arg("-h") + .arg("empty.txt") + .succeeds() + .stdout_only("0\tempty.txt\n"); } #[cfg(feature = "touch")] diff --git a/tests/by-util/test_echo.rs b/tests/by-util/test_echo.rs index 7394ffc1e..99c8f3a1e 100644 --- a/tests/by-util/test_echo.rs +++ b/tests/by-util/test_echo.rs @@ -2,22 +2,20 @@ use crate::common::util::*; #[test] fn test_default() { - //CmdResult.stdout_only(...) trims trailing newlines - assert_eq!("hi\n", new_ucmd!().arg("hi").succeeds().no_stderr().stdout); + new_ucmd!() + .arg("hi") + .succeeds() + .stdout_only("hi\n"); } #[test] fn test_no_trailing_newline() { - //CmdResult.stdout_only(...) trims trailing newlines - assert_eq!( - "hi", - new_ucmd!() - .arg("-n") - .arg("hi") - .succeeds() - .no_stderr() - .stdout - ); + new_ucmd!() + .arg("-n") + .arg("hi") + .succeeds() + .no_stderr() + .stdout_only("hi"); } #[test] @@ -192,39 +190,38 @@ fn test_hyphen_values_inside_string() { new_ucmd!() .arg("'\"\n'CXXFLAGS=-g -O2'\n\"'") .succeeds() - .stdout - .contains("CXXFLAGS"); + .stdout_contains("CXXFLAGS"); } #[test] fn test_hyphen_values_at_start() { - let result = new_ucmd!() + new_ucmd!() .arg("-E") .arg("-test") .arg("araba") .arg("-merci") - .run(); - - assert!(result.success); - assert_eq!(false, result.stdout.contains("-E")); - assert_eq!(result.stdout, "-test araba -merci\n"); + .run() + .success() + .stdout_does_not_contain("-E") + .stdout_is("-test araba -merci\n"); } #[test] fn test_hyphen_values_between() { - let result = new_ucmd!().arg("test").arg("-E").arg("araba").run(); + new_ucmd!() + .arg("test") + .arg("-E") + .arg("araba") + .run() + .success() + .stdout_is("test -E araba\n"); - assert!(result.success); - assert_eq!(result.stdout, "test -E araba\n"); - - let result = new_ucmd!() + new_ucmd!() .arg("dumdum ") .arg("dum dum dum") .arg("-e") .arg("dum") - .run(); - - assert!(result.success); - assert_eq!(result.stdout, "dumdum dum dum dum -e dum\n"); - assert_eq!(true, result.stdout.contains("-e")); + .run() + .success() + .stdout_is("dumdum dum dum dum -e dum\n"); } diff --git a/tests/by-util/test_env.rs b/tests/by-util/test_env.rs index 2ffb2bc48..19ecd7afb 100644 --- a/tests/by-util/test_env.rs +++ b/tests/by-util/test_env.rs @@ -8,45 +8,35 @@ use tempfile::tempdir; #[test] fn test_env_help() { - assert!(new_ucmd!() + new_ucmd!() .arg("--help") .succeeds() .no_stderr() - .stdout - .contains("OPTIONS:")); + .stdout_contains("OPTIONS:"); } #[test] fn test_env_version() { - assert!(new_ucmd!() + new_ucmd!() .arg("--version") .succeeds() .no_stderr() - .stdout - .contains(util_name!())); + .stdout_contains(util_name!()); } #[test] fn test_echo() { - // assert!(new_ucmd!().arg("printf").arg("FOO-bar").succeeds().no_stderr().stdout.contains("FOO-bar")); - let mut cmd = new_ucmd!(); - cmd.arg("echo").arg("FOO-bar"); - println!("cmd={:?}", cmd); + let result = new_ucmd!() + .arg("echo") + .arg("FOO-bar") + .succeeds(); - let result = cmd.run(); - println!("success={:?}", result.success); - println!("stdout={:?}", result.stdout); - println!("stderr={:?}", result.stderr); - assert!(result.success); - - let out = result.stdout.trim_end(); - - assert_eq!(out, "FOO-bar"); + assert_eq!(result.stdout_str().trim(), "FOO-bar"); } #[test] fn test_file_option() { - let out = new_ucmd!().arg("-f").arg("vars.conf.txt").run().stdout; + let out = new_ucmd!().arg("-f").arg("vars.conf.txt").run().stdout_move_str(); assert_eq!( out.lines() @@ -63,7 +53,7 @@ fn test_combined_file_set() { .arg("vars.conf.txt") .arg("FOO=bar.alt") .run() - .stdout; + .stdout_move_str(); assert_eq!(out.lines().filter(|&line| line == "FOO=bar.alt").count(), 1); } @@ -76,8 +66,8 @@ fn test_combined_file_set_unset() { .arg("-f") .arg("vars.conf.txt") .arg("FOO=bar.alt") - .run() - .stdout; + .succeeds() + .stdout_move_str(); assert_eq!( out.lines() @@ -89,17 +79,17 @@ fn test_combined_file_set_unset() { #[test] fn test_single_name_value_pair() { - let out = new_ucmd!().arg("FOO=bar").run().stdout; + let out = new_ucmd!().arg("FOO=bar").run(); - assert!(out.lines().any(|line| line == "FOO=bar")); + assert!(out.stdout_str().lines().any(|line| line == "FOO=bar")); } #[test] fn test_multiple_name_value_pairs() { - let out = new_ucmd!().arg("FOO=bar").arg("ABC=xyz").run().stdout; + let out = new_ucmd!().arg("FOO=bar").arg("ABC=xyz").run(); assert_eq!( - out.lines() + out.stdout_str().lines() .filter(|&line| line == "FOO=bar" || line == "ABC=xyz") .count(), 2 @@ -110,13 +100,8 @@ fn test_multiple_name_value_pairs() { fn test_ignore_environment() { let scene = TestScenario::new(util_name!()); - let out = scene.ucmd().arg("-i").run().stdout; - - assert_eq!(out, ""); - - let out = scene.ucmd().arg("-").run().stdout; - - assert_eq!(out, ""); + scene.ucmd().arg("-i").run().no_stdout(); + scene.ucmd().arg("-").run().no_stdout(); } #[test] @@ -126,8 +111,8 @@ fn test_null_delimiter() { .arg("--null") .arg("FOO=bar") .arg("ABC=xyz") - .run() - .stdout; + .succeeds() + .stdout_move_str(); let mut vars: Vec<_> = out.split('\0').collect(); assert_eq!(vars.len(), 3); @@ -145,8 +130,8 @@ fn test_unset_variable() { .ucmd_keepenv() .arg("-u") .arg("HOME") - .run() - .stdout; + .succeeds() + .stdout_move_str(); assert_eq!(out.lines().any(|line| line.starts_with("HOME=")), false); } @@ -173,8 +158,8 @@ fn test_change_directory() { .arg("--chdir") .arg(&temporary_path) .arg(pwd) - .run() - .stdout; + .succeeds() + .stdout_move_str(); assert_eq!(out.trim(), temporary_path.as_os_str()) } @@ -193,8 +178,8 @@ fn test_change_directory() { .ucmd() .arg("--chdir") .arg(&temporary_path) - .run() - .stdout; + .succeeds() + .stdout_move_str(); assert_eq!( out.lines() .any(|line| line.ends_with(temporary_path.file_name().unwrap().to_str().unwrap())), @@ -214,6 +199,6 @@ fn test_fail_change_directory() { .arg(some_non_existing_path) .arg("pwd") .fails() - .stderr; + .stderr_move_str(); assert!(out.contains("env: cannot change directory to ")); } diff --git a/tests/by-util/test_expand.rs b/tests/by-util/test_expand.rs index 801bf9d98..834a09736 100644 --- a/tests/by-util/test_expand.rs +++ b/tests/by-util/test_expand.rs @@ -2,57 +2,54 @@ use crate::common::util::*; #[test] fn test_with_tab() { - let (_, mut ucmd) = at_and_ucmd!(); - - let result = ucmd.arg("with-tab.txt").run(); - assert!(result.success); - assert!(result.stdout.contains(" ")); - assert!(!result.stdout.contains("\t")); + new_ucmd!() + .arg("with-tab.txt") + .succeeds() + .stdout_contains(" ") + .stdout_does_not_contain("\t"); } #[test] fn test_with_trailing_tab() { - let (_, mut ucmd) = at_and_ucmd!(); - - let result = ucmd.arg("with-trailing-tab.txt").run(); - assert!(result.success); - assert!(result.stdout.contains("with tabs=> ")); - assert!(!result.stdout.contains("\t")); + new_ucmd!() + .arg("with-trailing-tab.txt") + .succeeds() + .stdout_contains("with tabs=> ") + .stdout_does_not_contain("\t"); } #[test] fn test_with_trailing_tab_i() { - let (_, mut ucmd) = at_and_ucmd!(); - - let result = ucmd.arg("with-trailing-tab.txt").arg("-i").run(); - assert!(result.success); - assert!(result.stdout.contains(" // with tabs=>\t")); + new_ucmd!() + .arg("with-trailing-tab.txt") + .arg("-i") + .succeeds() + .stdout_contains(" // with tabs=>\t"); } #[test] fn test_with_tab_size() { - let (_, mut ucmd) = at_and_ucmd!(); - - let result = ucmd.arg("with-tab.txt").arg("--tabs=10").run(); - assert!(result.success); - assert!(result.stdout.contains(" ")); + new_ucmd!() + .arg("with-tab.txt") + .arg("--tabs=10") + .succeeds() + .stdout_contains(" "); } #[test] fn test_with_space() { - let (_, mut ucmd) = at_and_ucmd!(); - - let result = ucmd.arg("with-spaces.txt").run(); - assert!(result.success); - assert!(result.stdout.contains(" return")); + new_ucmd!() + .arg("with-spaces.txt") + .succeeds() + .stdout_contains(" return"); } #[test] fn test_with_multiple_files() { - let (_, mut ucmd) = at_and_ucmd!(); - - let result = ucmd.arg("with-spaces.txt").arg("with-tab.txt").run(); - assert!(result.success); - assert!(result.stdout.contains(" return")); - assert!(result.stdout.contains(" ")); + new_ucmd!() + .arg("with-spaces.txt") + .arg("with-tab.txt") + .succeeds() + .stdout_contains(" return") + .stdout_contains(" "); } diff --git a/tests/by-util/test_factor.rs b/tests/by-util/test_factor.rs index 5bde17cdb..af2ff4ddb 100644 --- a/tests/by-util/test_factor.rs +++ b/tests/by-util/test_factor.rs @@ -32,13 +32,10 @@ fn test_first_100000_integers() { } println!("STDIN='{}'", instring); - let result = new_ucmd!().pipe_in(instring.as_bytes()).run(); - let stdout = result.stdout; - - assert!(result.success); + let result = new_ucmd!().pipe_in(instring.as_bytes()).succeeds(); // `seq 0 100000 | factor | sha1sum` => "4ed2d8403934fa1c76fe4b84c5d4b8850299c359" - let hash_check = sha1::Sha1::from(stdout.as_bytes()).hexdigest(); + let hash_check = sha1::Sha1::from(result.stdout()).hexdigest(); assert_eq!(hash_check, "4ed2d8403934fa1c76fe4b84c5d4b8850299c359"); } diff --git a/tests/by-util/test_fmt.rs b/tests/by-util/test_fmt.rs index 4533cdf24..f962a9137 100644 --- a/tests/by-util/test_fmt.rs +++ b/tests/by-util/test_fmt.rs @@ -5,7 +5,7 @@ fn test_fmt() { let result = new_ucmd!().arg("one-word-per-line.txt").run(); //.stdout_is_fixture("call_graph.expected"); assert_eq!( - result.stdout.trim(), + result.stdout_str().trim(), "this is a file with one word per line" ); } @@ -15,7 +15,7 @@ fn test_fmt_q() { let result = new_ucmd!().arg("-q").arg("one-word-per-line.txt").run(); //.stdout_is_fixture("call_graph.expected"); assert_eq!( - result.stdout.trim(), + result.stdout_str().trim(), "this is a file with one word per line" ); } @@ -42,7 +42,7 @@ fn test_fmt_w() { .arg("one-word-per-line.txt") .run(); //.stdout_is_fixture("call_graph.expected"); - assert_eq!(result.stdout.trim(), "this is a file with one word per line"); + assert_eq!(result.stdout_str().trim(), "this is a file with one word per line"); } diff --git a/tests/by-util/test_groups.rs b/tests/by-util/test_groups.rs index 5c326fe2d..32a16cc1a 100644 --- a/tests/by-util/test_groups.rs +++ b/tests/by-util/test_groups.rs @@ -2,26 +2,25 @@ use crate::common::util::*; #[test] fn test_groups() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.run(); - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - if is_ci() && result.stdout.trim().is_empty() { + let result = new_ucmd!().run(); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + if is_ci() && result.stdout_str().trim().is_empty() { // In the CI, some server are failing to return the group. // As seems to be a configuration issue, ignoring it return; } assert!(result.success); - assert!(!result.stdout.trim().is_empty()); + assert!(!result.stdout_str().trim().is_empty()); } #[test] fn test_groups_arg() { // get the username with the "id -un" command let result = TestScenario::new("id").ucmd_keepenv().arg("-un").run(); - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let s1 = String::from(result.stdout.trim()); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + let s1 = String::from(result.stdout_str().trim()); if is_ci() && s1.parse::().is_ok() { // In the CI, some server are failing to return id -un. // So, if we are getting a uid, just skip this test @@ -29,18 +28,18 @@ fn test_groups_arg() { return; } - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); assert!(result.success); - assert!(!result.stdout.is_empty()); - let username = result.stdout.trim(); + assert!(!result.stdout_str().is_empty()); + let username = result.stdout_str().trim(); // call groups with the user name to check that we // are getting something let (_, mut ucmd) = at_and_ucmd!(); let result = ucmd.arg(username).run(); - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); assert!(result.success); - assert!(!result.stdout.is_empty()); + assert!(!result.stdout_str().is_empty()); } diff --git a/tests/by-util/test_hashsum.rs b/tests/by-util/test_hashsum.rs index 6e7d59107..f059e53f3 100644 --- a/tests/by-util/test_hashsum.rs +++ b/tests/by-util/test_hashsum.rs @@ -17,14 +17,14 @@ macro_rules! test_digest { fn test_single_file() { let ts = TestScenario::new("hashsum"); assert_eq!(ts.fixtures.read(EXPECTED_FILE), - get_hash!(ts.ucmd().arg(DIGEST_ARG).arg(BITS_ARG).arg("input.txt").succeeds().no_stderr().stdout)); + get_hash!(ts.ucmd().arg(DIGEST_ARG).arg(BITS_ARG).arg("input.txt").succeeds().no_stderr().stdout_str())); } #[test] fn test_stdin() { let ts = TestScenario::new("hashsum"); assert_eq!(ts.fixtures.read(EXPECTED_FILE), - get_hash!(ts.ucmd().arg(DIGEST_ARG).arg(BITS_ARG).pipe_in_fixture("input.txt").succeeds().no_stderr().stdout)); + get_hash!(ts.ucmd().arg(DIGEST_ARG).arg(BITS_ARG).pipe_in_fixture("input.txt").succeeds().no_stderr().stdout_str())); } } )*) diff --git a/tests/by-util/test_hostid.rs b/tests/by-util/test_hostid.rs index 17aad4aff..b5b668901 100644 --- a/tests/by-util/test_hostid.rs +++ b/tests/by-util/test_hostid.rs @@ -9,5 +9,5 @@ fn test_normal() { assert!(result.success); let re = Regex::new(r"^[0-9a-f]{8}").unwrap(); - assert!(re.is_match(&result.stdout.trim())); + assert!(re.is_match(&result.stdout_str())); } diff --git a/tests/by-util/test_hostname.rs b/tests/by-util/test_hostname.rs index 804d47642..9fa63241f 100644 --- a/tests/by-util/test_hostname.rs +++ b/tests/by-util/test_hostname.rs @@ -6,8 +6,8 @@ fn test_hostname() { let ls_short_res = new_ucmd!().arg("-s").succeeds(); let ls_domain_res = new_ucmd!().arg("-d").succeeds(); - assert!(ls_default_res.stdout.len() >= ls_short_res.stdout.len()); - assert!(ls_default_res.stdout.len() >= ls_domain_res.stdout.len()); + assert!(ls_default_res.stdout().len() >= ls_short_res.stdout().len()); + assert!(ls_default_res.stdout().len() >= ls_domain_res.stdout().len()); } // FixME: fails for "MacOS" @@ -17,14 +17,14 @@ fn test_hostname_ip() { let result = new_ucmd!().arg("-i").run(); println!("{:#?}", result); assert!(result.success); - assert!(!result.stdout.trim().is_empty()); + assert!(!result.stdout_str().trim().is_empty()); } #[test] fn test_hostname_full() { - let result = new_ucmd!().arg("-f").succeeds(); - assert!(!result.stdout.trim().is_empty()); - let ls_short_res = new_ucmd!().arg("-s").succeeds(); - assert!(result.stdout.trim().contains(ls_short_res.stdout.trim())); + assert!(!ls_short_res.stdout_str().trim().is_empty()); + + new_ucmd!().arg("-f").succeeds() + .stdout_contains(ls_short_res.stdout_str().trim()); } diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index 116c73995..7e2791467 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -9,33 +9,29 @@ fn return_whoami_username() -> String { return String::from(""); } - result.stdout.trim().to_string() + result.stdout_str().trim().to_string() } #[test] fn test_id() { - let scene = TestScenario::new(util_name!()); - - let mut result = scene.ucmd().arg("-u").run(); + let result = new_ucmd!().arg("-u").run(); if result.stderr.contains("cannot find name for user ID") { // In the CI, some server are failing to return whoami. // As seems to be a configuration issue, ignoring it return; } - assert!(result.success); - let uid = String::from(result.stdout.trim()); - result = scene.ucmd().run(); + let uid = result.success().stdout_str().trim(); + let result = new_ucmd!().run(); if is_ci() && result.stderr.contains("cannot find name for user ID") { // In the CI, some server are failing to return whoami. // As seems to be a configuration issue, ignoring it return; } - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - if !result.stderr.contains("Could not find uid") { + + if !result.stderr_str().contains("Could not find uid") { // Verify that the id found by --user/-u exists in the list - assert!(result.stdout.contains(&uid)); + result.success().stdout_contains(&uid); } } @@ -47,88 +43,64 @@ fn test_id_from_name() { return; } - let scene = TestScenario::new(util_name!()); - let result = scene.ucmd().arg(&username).succeeds(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - assert!(result.success); - let uid = String::from(result.stdout.trim()); - let result = scene.ucmd().succeeds(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - // Verify that the id found by --user/-u exists in the list - assert!(result.stdout.contains(&uid)); - // Verify that the username found by whoami exists in the list - assert!(result.stdout.contains(&username)); + let result = new_ucmd!().arg(&username).succeeds(); + let uid = result.stdout_str().trim(); + + new_ucmd!().succeeds() + // Verify that the id found by --user/-u exists in the list + .stdout_contains(uid) + // Verify that the username found by whoami exists in the list + .stdout_contains(username); } #[test] fn test_id_name_from_id() { - let mut scene = TestScenario::new(util_name!()); - let result = scene.ucmd().arg("-u").run(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - assert!(result.success); - let uid = String::from(result.stdout.trim()); + let result = new_ucmd!().arg("-u").succeeds(); + let uid = result.stdout_str().trim(); - scene = TestScenario::new(util_name!()); - let result = scene.ucmd().arg("-nu").arg(uid).run(); + let result = new_ucmd!().arg("-nu").arg(uid).run(); if is_ci() && result.stderr.contains("No such user/group") { // In the CI, some server are failing to return whoami. // As seems to be a configuration issue, ignoring it return; } - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - assert!(result.success); - let username_id = String::from(result.stdout.trim()); + let username_id = result + .success() + .stdout_str() + .trim(); - scene = TestScenario::new("whoami"); - let result = scene.cmd("whoami").run(); + let scene = TestScenario::new("whoami"); + let result = scene.cmd("whoami").succeeds(); - let username_whoami = result.stdout.trim(); + let username_whoami = result.stdout_str().trim(); assert_eq!(username_id, username_whoami); } #[test] fn test_id_group() { - let scene = TestScenario::new(util_name!()); - - let mut result = scene.ucmd().arg("-g").succeeds(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - assert!(result.success); - let s1 = String::from(result.stdout.trim()); + let mut result = new_ucmd!().arg("-g").succeeds(); + let s1 = result.stdout_str().trim(); assert!(s1.parse::().is_ok()); - result = scene.ucmd().arg("--group").succeeds(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - assert!(result.success); - let s1 = String::from(result.stdout.trim()); + result = new_ucmd!().arg("--group").succeeds(); + let s1 = result.stdout_str().trim(); assert!(s1.parse::().is_ok()); } #[test] fn test_id_groups() { - let scene = TestScenario::new(util_name!()); - - let result = scene.ucmd().arg("-G").succeeds(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); + let result = new_ucmd!().arg("-G").succeeds(); assert!(result.success); - let groups = result.stdout.trim().split_whitespace(); + let groups = result.stdout_str().trim().split_whitespace(); for s in groups { assert!(s.parse::().is_ok()); } - let result = scene.ucmd().arg("--groups").succeeds(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); + let result = new_ucmd!().arg("--groups").succeeds(); assert!(result.success); - let groups = result.stdout.trim().split_whitespace(); + let groups = result.stdout_str().trim().split_whitespace(); for s in groups { assert!(s.parse::().is_ok()); } @@ -136,15 +108,12 @@ fn test_id_groups() { #[test] fn test_id_user() { - let scene = TestScenario::new(util_name!()); - - let mut result = scene.ucmd().arg("-u").succeeds(); - assert!(result.success); - let s1 = String::from(result.stdout.trim()); + let mut result = new_ucmd!().arg("-u").succeeds(); + let s1 = result.stdout_str().trim(); assert!(s1.parse::().is_ok()); - result = scene.ucmd().arg("--user").succeeds(); - assert!(result.success); - let s1 = String::from(result.stdout.trim()); + + result = new_ucmd!().arg("--user").succeeds(); + let s1 = result.stdout_str().trim(); assert!(s1.parse::().is_ok()); } @@ -156,17 +125,13 @@ fn test_id_pretty_print() { return; } - let scene = TestScenario::new(util_name!()); - let result = scene.ucmd().arg("-p").run(); - if result.stdout.trim() == "" { + let result = new_ucmd!().arg("-p").run(); + if result.stdout_str().trim() == "" { // Sometimes, the CI is failing here with // old rust versions on Linux return; } - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - assert!(result.success); - assert!(result.stdout.contains(&username)); + result.success().stdout_contains(username); } #[test] @@ -176,12 +141,7 @@ fn test_id_password_style() { // Sometimes, the CI is failing here return; } - let scene = TestScenario::new(util_name!()); - let result = scene.ucmd().arg("-P").succeeds(); - - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - assert!(result.success); - assert!(result.stdout.starts_with(&username)); + let result = new_ucmd!().arg("-P").succeeds(); + assert!(result.stdout_str().starts_with(&username)); } diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 840b2f6c7..32df8d460 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -195,12 +195,8 @@ fn test_install_mode_numeric() { let mode_arg = "-m 0333"; at.mkdir(dir2); - let result = scene.ucmd().arg(mode_arg).arg(file).arg(dir2).run(); + scene.ucmd().arg(mode_arg).arg(file).arg(dir2).succeeds(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - - assert!(result.success); let dest_file = &format!("{}/{}", dir2, file); assert!(at.file_exists(file)); assert!(at.file_exists(dest_file)); @@ -313,16 +309,13 @@ fn test_install_target_new_file_with_group() { .arg(format!("{}/{}", dir, file)) .run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - - if is_ci() && result.stderr.contains("error: no such group:") { + if is_ci() && result.stderr_str().contains("error: no such group:") { // In the CI, some server are failing to return the group. // As seems to be a configuration issue, ignoring it return; } - assert!(result.success); + result.success(); assert!(at.file_exists(file)); assert!(at.file_exists(&format!("{}/{}", dir, file))); } @@ -343,16 +336,13 @@ fn test_install_target_new_file_with_owner() { .arg(format!("{}/{}", dir, file)) .run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - if is_ci() && result.stderr.contains("error: no such user:") { // In the CI, some server are failing to return the user id. // As seems to be a configuration issue, ignoring it return; } - assert!(result.success); + result.success(); assert!(at.file_exists(file)); assert!(at.file_exists(&format!("{}/{}", dir, file))); } @@ -366,13 +356,10 @@ fn test_install_target_new_file_failing_nonexistent_parent() { at.touch(file1); - let err = ucmd - .arg(file1) + ucmd.arg(file1) .arg(format!("{}/{}", dir, file2)) .fails() - .stderr; - - assert!(err.contains("not a directory")) + .stderr_contains(&"not a directory"); } #[test] @@ -417,18 +404,12 @@ fn test_install_copy_file() { #[test] #[cfg(target_os = "linux")] fn test_install_target_file_dev_null() { - let scene = TestScenario::new(util_name!()); - let at = &scene.fixtures; + let (at, mut ucmd) = at_and_ucmd!(); let file1 = "/dev/null"; let file2 = "target_file"; - let result = scene.ucmd().arg(file1).arg(file2).run(); - - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - - assert!(result.success); + ucmd.arg(file1).arg(file2).succeeds(); assert!(at.file_exists(file2)); } diff --git a/tests/by-util/test_ln.rs b/tests/by-util/test_ln.rs index 89261036d..d7a13b0d4 100644 --- a/tests/by-util/test_ln.rs +++ b/tests/by-util/test_ln.rs @@ -520,10 +520,7 @@ fn test_symlink_no_deref_dir() { scene.ucmd().args(&["-sn", dir1, link]).fails(); // Try with the no-deref - let result = scene.ucmd().args(&["-sfn", dir1, link]).run(); - println!("stdout {}", result.stdout); - println!("stderr {}", result.stderr); - assert!(result.success); + scene.ucmd().args(&["-sfn", dir1, link]).succeeds(); assert!(at.dir_exists(dir1)); assert!(at.dir_exists(dir2)); assert!(at.is_symlink(link)); @@ -566,10 +563,7 @@ fn test_symlink_no_deref_file() { scene.ucmd().args(&["-sn", file1, link]).fails(); // Try with the no-deref - let result = scene.ucmd().args(&["-sfn", file1, link]).run(); - println!("stdout {}", result.stdout); - println!("stderr {}", result.stderr); - assert!(result.success); + scene.ucmd().args(&["-sfn", file1, link]).succeeds(); assert!(at.file_exists(file1)); assert!(at.file_exists(file2)); assert!(at.is_symlink(link)); diff --git a/tests/by-util/test_logname.rs b/tests/by-util/test_logname.rs index b15941c06..8d1996e63 100644 --- a/tests/by-util/test_logname.rs +++ b/tests/by-util/test_logname.rs @@ -3,23 +3,19 @@ use std::env; #[test] fn test_normal() { - let (_, mut ucmd) = at_and_ucmd!(); - - let result = ucmd.run(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); + let result = new_ucmd!().run(); println!("env::var(CI).is_ok() = {}", env::var("CI").is_ok()); for (key, value) in env::vars() { println!("{}: {}", key, value); } - if (is_ci() || is_wsl()) && result.stderr.contains("error: no login name") { + if (is_ci() || is_wsl()) && result.stderr_str().contains("error: no login name") { // ToDO: investigate WSL failure // In the CI, some server are failing to return logname. // As seems to be a configuration issue, ignoring it return; } - assert!(result.success); - assert!(!result.stdout.trim().is_empty()); + result.success(); + assert!(!result.stdout_str().trim().is_empty()); } From cd3dba24816a6b01a6af85716ecb31e7b2114fa4 Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Sat, 10 Apr 2021 21:24:30 +0300 Subject: [PATCH 0321/1135] Added some tests utils for future refactoring --- tests/common/macros.rs | 37 -------------------------- tests/common/util.rs | 59 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 55 insertions(+), 41 deletions(-) diff --git a/tests/common/macros.rs b/tests/common/macros.rs index e8b9c9d5d..81878bf1b 100644 --- a/tests/common/macros.rs +++ b/tests/common/macros.rs @@ -1,40 +1,3 @@ -/// Assertion helper macro for [`CmdResult`] types -/// -/// [`CmdResult`]: crate::tests::common::util::CmdResult -#[macro_export] -macro_rules! assert_empty_stderr( - ($cond:expr) => ( - if $cond.stderr.len() > 0 { - panic!("stderr: {}", $cond.stderr_str()) - } - ); -); - -/// Assertion helper macro for [`CmdResult`] types -/// -/// [`CmdResult`]: crate::tests::common::util::CmdResult -#[macro_export] -macro_rules! assert_empty_stdout( - ($cond:expr) => ( - if $cond.stdout.len() > 0 { - panic!("stdout: {}", $cond.stdout_str()) - } - ); -); - -/// Assertion helper macro for [`CmdResult`] types -/// -/// [`CmdResult`]: crate::tests::common::util::CmdResult -#[macro_export] -macro_rules! assert_no_error( - ($cond:expr) => ( - assert!($cond.success); - if $cond.stderr.len() > 0 { - panic!("stderr: {}", $cond.stderr_str()) - } - ); -); - /// Platform-independent helper for constructing a PathBuf from individual elements #[macro_export] macro_rules! path_concat { diff --git a/tests/common/util.rs b/tests/common/util.rs index d5663e9ed..18830919c 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -130,6 +130,11 @@ impl CmdResult { self.code.expect("Program must be run first") } + pub fn code_is(&self, expected_code: i32) -> &CmdResult { + assert_eq!(self.code(), expected_code); + self + } + /// Returns the program's TempDir /// Panics if not present pub fn tmpd(&self) -> Rc { @@ -146,13 +151,25 @@ impl CmdResult { /// asserts that the command resulted in a success (zero) status code pub fn success(&self) -> &CmdResult { - assert!(self.success); + if !self.success { + panic!( + "Command was expected to succeed.\nstdout = {}\n stderr = {}", + self.stdout_str(), + self.stderr_str() + ); + } self } /// asserts that the command resulted in a failure (non-zero) status code pub fn failure(&self) -> &CmdResult { - assert!(!self.success); + if self.success { + panic!( + "Command was expected to fail.\nstdout = {}\n stderr = {}", + self.stdout_str(), + self.stderr_str() + ); + } self } @@ -168,7 +185,12 @@ impl CmdResult { /// 1. you can not know exactly what stdout will be or /// 2. you know that stdout will also be empty pub fn no_stderr(&self) -> &CmdResult { - assert!(self.stderr.is_empty()); + if !self.stderr.is_empty() { + panic!( + "Expected stderr to be empty, but it's:\n{}", + self.stderr_str() + ); + } self } @@ -179,7 +201,12 @@ impl CmdResult { /// 1. you can not know exactly what stderr will be or /// 2. you know that stderr will also be empty pub fn no_stdout(&self) -> &CmdResult { - assert!(self.stdout.is_empty()); + if !self.stdout.is_empty() { + panic!( + "Expected stdout to be empty, but it's:\n{}", + self.stderr_str() + ); + } self } @@ -281,6 +308,30 @@ impl CmdResult { assert!(self.stderr_str().contains(cmp.as_ref())); self } + + pub fn stdout_does_not_contain>(&self, cmp: T) -> &CmdResult { + assert!(!self.stdout_str().contains(cmp.as_ref())); + self + } + + pub fn stderr_does_not_contain>(&self, cmp: &T) -> &CmdResult { + assert!(!self.stderr_str().contains(cmp.as_ref())); + self + } + + pub fn stdout_matches(&self, regex: ®ex::Regex) -> &CmdResult { + if !regex.is_match(self.stdout_str()) { + panic!("Stdout does not match regex:\n{}", self.stdout_str()) + } + self + } + + pub fn stdout_does_not_match(&self, regex: ®ex::Regex) -> &CmdResult { + if regex.is_match(self.stdout_str()) { + panic!("Stdout matches regex:\n{}", self.stdout_str()) + } + self + } } pub fn log_info, U: AsRef>(msg: T, par: U) { From 4695667c7ce7230f75fb39d0a232e0ad5564e7d4 Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Sat, 10 Apr 2021 21:18:38 +0300 Subject: [PATCH 0322/1135] Added sanity checks for test utils --- tests/common/util.rs | 214 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 211 insertions(+), 3 deletions(-) diff --git a/tests/common/util.rs b/tests/common/util.rs index 18830919c..aca8ef216 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -64,7 +64,7 @@ fn read_scenario_fixture>(tmpd: &Option>, file_rel_p /// A command result is the outputs of a command (streams and status code) /// within a struct which has convenience assertion functions about those outputs -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct CmdResult { //tmpd is used for convenience functions for asserts against fixtures tmpd: Option>, @@ -304,7 +304,7 @@ impl CmdResult { self } - pub fn stderr_contains>(&self, cmp: &T) -> &CmdResult { + pub fn stderr_contains>(&self, cmp: T) -> &CmdResult { assert!(self.stderr_str().contains(cmp.as_ref())); self } @@ -314,7 +314,7 @@ impl CmdResult { self } - pub fn stderr_does_not_contain>(&self, cmp: &T) -> &CmdResult { + pub fn stderr_does_not_contain>(&self, cmp: T) -> &CmdResult { assert!(!self.stderr_str().contains(cmp.as_ref())); self } @@ -870,3 +870,211 @@ pub fn vec_of_size(n: usize) -> Vec { assert_eq!(result.len(), n); result } + +/// Sanity checks for test utils +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_code_is() { + let res = CmdResult { + tmpd: None, + code: Some(32), + success: false, + stdout: "".into(), + stderr: "".into(), + }; + res.code_is(32); + } + + #[test] + #[should_panic] + fn test_code_is_fail() { + let res = CmdResult { + tmpd: None, + code: Some(32), + success: false, + stdout: "".into(), + stderr: "".into(), + }; + res.code_is(1); + } + + #[test] + fn test_failure() { + let res = CmdResult { + tmpd: None, + code: None, + success: false, + stdout: "".into(), + stderr: "".into(), + }; + res.failure(); + } + + #[test] + #[should_panic] + fn test_failure_fail() { + let res = CmdResult { + tmpd: None, + code: None, + success: true, + stdout: "".into(), + stderr: "".into(), + }; + res.failure(); + } + + #[test] + fn test_success() { + let res = CmdResult { + tmpd: None, + code: None, + success: true, + stdout: "".into(), + stderr: "".into(), + }; + res.success(); + } + + #[test] + #[should_panic] + fn test_success_fail() { + let res = CmdResult { + tmpd: None, + code: None, + success: false, + stdout: "".into(), + stderr: "".into(), + }; + res.success(); + } + + #[test] + fn test_no_std_errout() { + let res = CmdResult { + tmpd: None, + code: None, + success: true, + stdout: "".into(), + stderr: "".into(), + }; + res.no_stderr(); + res.no_stdout(); + } + + #[test] + #[should_panic] + fn test_no_stderr_fail() { + let res = CmdResult { + tmpd: None, + code: None, + success: true, + stdout: "".into(), + stderr: "asdfsadfa".into(), + }; + + res.no_stderr(); + } + + #[test] + #[should_panic] + fn test_no_stdout_fail() { + let res = CmdResult { + tmpd: None, + code: None, + success: true, + stdout: "asdfsadfa".into(), + stderr: "".into(), + }; + + res.no_stdout(); + } + + #[test] + fn test_std_does_not_contain() { + let res = CmdResult { + tmpd: None, + code: None, + success: true, + stdout: "This is a likely error message\n".into(), + stderr: "This is a likely error message\n".into(), + }; + res.stdout_does_not_contain("unlikely"); + res.stderr_does_not_contain("unlikely"); + } + + #[test] + #[should_panic] + fn test_stdout_does_not_contain_fail() { + let res = CmdResult { + tmpd: None, + code: None, + success: true, + stdout: "This is a likely error message\n".into(), + stderr: "".into(), + }; + + res.stdout_does_not_contain("likely"); + } + + #[test] + #[should_panic] + fn test_stderr_does_not_contain_fail() { + let res = CmdResult { + tmpd: None, + code: None, + success: true, + stdout: "".into(), + stderr: "This is a likely error message\n".into(), + }; + + res.stderr_does_not_contain("likely"); + } + + #[test] + fn test_stdout_matches() { + let res = CmdResult { + tmpd: None, + code: None, + success: true, + stdout: "This is a likely error message\n".into(), + stderr: "This is a likely error message\n".into(), + }; + let positive = regex::Regex::new(".*likely.*").unwrap(); + let negative = regex::Regex::new(".*unlikely.*").unwrap(); + res.stdout_matches(&positive); + res.stdout_does_not_match(&negative); + } + + #[test] + #[should_panic] + fn test_stdout_matches_fail() { + let res = CmdResult { + tmpd: None, + code: None, + success: true, + stdout: "This is a likely error message\n".into(), + stderr: "This is a likely error message\n".into(), + }; + let negative = regex::Regex::new(".*unlikely.*").unwrap(); + + res.stdout_matches(&negative); + } + + #[test] + #[should_panic] + fn test_stdout_not_matches_fail() { + let res = CmdResult { + tmpd: None, + code: None, + success: true, + stdout: "This is a likely error message\n".into(), + stderr: "This is a likely error message\n".into(), + }; + let positive = regex::Regex::new(".*likely.*").unwrap(); + + res.stdout_does_not_match(&positive); + } +} From 5f00a0f9079638b58f0099a3244e9af30c599593 Mon Sep 17 00:00:00 2001 From: ReggaeMuffin <644950+reggaemuffin@users.noreply.github.com> Date: Sun, 11 Apr 2021 10:49:52 +0100 Subject: [PATCH 0323/1135] remove the unused imports --- tests/by-util/test_chgrp.rs | 1 - tests/by-util/test_date.rs | 1 - tests/by-util/test_du.rs | 1 - tests/by-util/test_logname.rs | 1 - 4 files changed, 4 deletions(-) diff --git a/tests/by-util/test_chgrp.rs b/tests/by-util/test_chgrp.rs index ffb078137..fa5d71bc7 100644 --- a/tests/by-util/test_chgrp.rs +++ b/tests/by-util/test_chgrp.rs @@ -1,6 +1,5 @@ use crate::common::util::*; use rust_users::*; -use uucore; #[test] fn test_invalid_option() { diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index b4e49e775..b736a9401 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -4,7 +4,6 @@ use self::regex::Regex; use crate::common::util::*; #[cfg(all(unix, not(target_os = "macos")))] use rust_users::*; -use uucore; #[test] fn test_date_email() { diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index a0d698de0..4543b804a 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -1,5 +1,4 @@ use crate::common::util::*; -use uucore; const SUB_DIR: &str = "subdir/deeper"; const SUB_DIR_LINKS: &str = "subdir/links"; diff --git a/tests/by-util/test_logname.rs b/tests/by-util/test_logname.rs index baaad63cc..b95265a8f 100644 --- a/tests/by-util/test_logname.rs +++ b/tests/by-util/test_logname.rs @@ -1,6 +1,5 @@ use crate::common::util::*; use std::env; -use uucore; #[test] fn test_normal() { From 97d12d6e3c7b8afcde13555e34e35545b7f0a96a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reto=20Habl=C3=BCtzel?= Date: Sun, 11 Apr 2021 16:05:25 +0200 Subject: [PATCH 0324/1135] fix trivial warnings without features --- src/uu/basename/src/basename.rs | 10 +-- src/uu/cp/src/cp.rs | 16 ++--- src/uu/cut/src/cut.rs | 66 +++++++++---------- src/uu/du/src/du.rs | 2 +- src/uu/expr/src/expr.rs | 2 +- src/uu/expr/src/syntax_tree.rs | 36 +++++----- src/uu/fmt/src/parasplit.rs | 2 +- src/uu/fold/src/fold.rs | 2 +- src/uu/head/src/head.rs | 2 +- src/uu/ln/src/ln.rs | 14 ++-- src/uu/ls/src/ls.rs | 8 +-- src/uu/mv/src/mv.rs | 16 ++--- src/uu/od/src/od.rs | 2 +- src/uu/od/src/parse_inputs.rs | 6 +- .../num_format/formatters/base_conv/mod.rs | 6 +- src/uu/readlink/src/readlink.rs | 6 +- src/uu/realpath/src/realpath.rs | 4 +- src/uu/rm/src/rm.rs | 2 +- src/uu/seq/src/seq.rs | 8 +-- src/uu/shred/src/shred.rs | 10 ++- src/uu/sum/src/sum.rs | 2 +- src/uu/tac/src/tac.rs | 2 +- src/uu/test/src/test.rs | 24 +++---- src/uu/tr/src/expand.rs | 2 +- src/uu/tsort/src/tsort.rs | 17 +++-- src/uu/wc/src/count_bytes.rs | 31 ++++----- src/uu/wc/src/wc.rs | 19 +++--- 27 files changed, 151 insertions(+), 166 deletions(-) diff --git a/src/uu/basename/src/basename.rs b/src/uu/basename/src/basename.rs index 84521bdd1..b7f99af27 100644 --- a/src/uu/basename/src/basename.rs +++ b/src/uu/basename/src/basename.rs @@ -113,12 +113,8 @@ fn basename(fullname: &str, suffix: &str) -> String { fn strip_suffix(name: &str, suffix: &str) -> String { if name == suffix { - return name.to_owned(); + name.to_owned() + } else { + name.strip_suffix(suffix).unwrap_or(name).to_owned() } - - if name.ends_with(suffix) { - return name[..name.len() - suffix.len()].to_owned(); - } - - name.to_owned() } diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 569ee78bc..60484a79a 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -547,14 +547,13 @@ impl FromStr for Attribute { } fn add_all_attributes() -> Vec { - let mut attr = Vec::new(); + use Attribute::*; + + let mut attr = vec![Ownership, Timestamps, Context, Xattr, Links]; + #[cfg(unix)] - attr.push(Attribute::Mode); - attr.push(Attribute::Ownership); - attr.push(Attribute::Timestamps); - attr.push(Attribute::Context); - attr.push(Attribute::Xattr); - attr.push(Attribute::Links); + attr.insert(0, Mode); + attr } @@ -714,7 +713,7 @@ fn parse_path_args(path_args: &[String], options: &Options) -> CopyResult<(Vec, - source: &std::path::PathBuf, + source: &std::path::Path, dest: std::path::PathBuf, found_hard_link: &mut bool, ) -> CopyResult<()> { @@ -1068,6 +1067,7 @@ fn copy_attribute(source: &Path, dest: &Path, attribute: &Attribute) -> CopyResu } #[cfg(not(windows))] +#[allow(clippy::unnecessary_wraps)] // needed for windows version fn symlink_file(source: &Path, dest: &Path, context: &str) -> CopyResult<()> { match std::os::unix::fs::symlink(source, dest).context(context) { Ok(_) => Ok(()), diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index 6b09b91d9..5bf310daa 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -406,7 +406,7 @@ fn cut_files(mut filenames: Vec, mode: Mode) -> i32 { continue; } - if !path.metadata().is_ok() { + if path.metadata().is_err() { show_error!("{}: No such file or directory", filename); continue; } @@ -487,7 +487,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("filter field columns from the input source") .takes_value(true) .allow_hyphen_values(true) - .value_name("LIST") + .value_name("LIST") .display_order(4), ) .arg( @@ -535,40 +535,36 @@ pub fn uumain(args: impl uucore::Args) -> i32 { matches.value_of(options::CHARACTERS), matches.value_of(options::FIELDS), ) { - (Some(byte_ranges), None, None) => { - list_to_ranges(&byte_ranges[..], complement).map(|ranges| { - Mode::Bytes( - ranges, - Options { - out_delim: Some( - matches - .value_of(options::OUTPUT_DELIMITER) - .unwrap_or_default() - .to_owned(), - ), - zero_terminated: matches.is_present(options::ZERO_TERMINATED), - }, - ) - }) - } - (None, Some(char_ranges), None) => { - list_to_ranges(&char_ranges[..], complement).map(|ranges| { - Mode::Characters( - ranges, - Options { - out_delim: Some( - matches - .value_of(options::OUTPUT_DELIMITER) - .unwrap_or_default() - .to_owned(), - ), - zero_terminated: matches.is_present(options::ZERO_TERMINATED), - }, - ) - }) - } + (Some(byte_ranges), None, None) => list_to_ranges(byte_ranges, complement).map(|ranges| { + Mode::Bytes( + ranges, + Options { + out_delim: Some( + matches + .value_of(options::OUTPUT_DELIMITER) + .unwrap_or_default() + .to_owned(), + ), + zero_terminated: matches.is_present(options::ZERO_TERMINATED), + }, + ) + }), + (None, Some(char_ranges), None) => list_to_ranges(char_ranges, complement).map(|ranges| { + Mode::Characters( + ranges, + Options { + out_delim: Some( + matches + .value_of(options::OUTPUT_DELIMITER) + .unwrap_or_default() + .to_owned(), + ), + zero_terminated: matches.is_present(options::ZERO_TERMINATED), + }, + ) + }), (None, None, Some(field_ranges)) => { - list_to_ranges(&field_ranges[..], complement).and_then(|ranges| { + list_to_ranges(field_ranges, complement).and_then(|ranges| { let out_delim = match matches.value_of(options::OUTPUT_DELIMITER) { Some(s) => { if s.is_empty() { diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 615b66a4e..07635881a 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -322,7 +322,7 @@ fn convert_size_human(size: u64, multiplier: u64, _block_size: u64) -> String { } } if size == 0 { - return format!("0"); + return "0".to_string(); } format!("{}B", size) } diff --git a/src/uu/expr/src/expr.rs b/src/uu/expr/src/expr.rs index fee85dfe1..4a13812d3 100644 --- a/src/uu/expr/src/expr.rs +++ b/src/uu/expr/src/expr.rs @@ -51,7 +51,7 @@ fn print_expr_error(expr_error: &str) -> ! { crash!(2, "{}", expr_error) } -fn evaluate_ast(maybe_ast: Result, String>) -> Result { +fn evaluate_ast(maybe_ast: Result, String>) -> Result { if maybe_ast.is_err() { Err(maybe_ast.err().unwrap()) } else { diff --git a/src/uu/expr/src/syntax_tree.rs b/src/uu/expr/src/syntax_tree.rs index 3381c29bd..c81adf0c8 100644 --- a/src/uu/expr/src/syntax_tree.rs +++ b/src/uu/expr/src/syntax_tree.rs @@ -17,10 +17,10 @@ use onig::{Regex, RegexOptions, Syntax}; use crate::tokens::Token; type TokenStack = Vec<(usize, Token)>; -pub type OperandsList = Vec>; +pub type OperandsList = Vec>; #[derive(Debug)] -pub enum ASTNode { +pub enum AstNode { Leaf { token_idx: usize, value: String, @@ -31,7 +31,7 @@ pub enum ASTNode { operands: OperandsList, }, } -impl ASTNode { +impl AstNode { fn debug_dump(&self) { self.debug_dump_impl(1); } @@ -40,7 +40,7 @@ impl ASTNode { print!("\t",); } match *self { - ASTNode::Leaf { + AstNode::Leaf { ref token_idx, ref value, } => println!( @@ -49,7 +49,7 @@ impl ASTNode { token_idx, self.evaluate() ), - ASTNode::Node { + AstNode::Node { ref token_idx, ref op_type, ref operands, @@ -67,23 +67,23 @@ impl ASTNode { } } - fn new_node(token_idx: usize, op_type: &str, operands: OperandsList) -> Box { - Box::new(ASTNode::Node { + fn new_node(token_idx: usize, op_type: &str, operands: OperandsList) -> Box { + Box::new(AstNode::Node { token_idx, op_type: op_type.into(), operands, }) } - fn new_leaf(token_idx: usize, value: &str) -> Box { - Box::new(ASTNode::Leaf { + fn new_leaf(token_idx: usize, value: &str) -> Box { + Box::new(AstNode::Leaf { token_idx, value: value.into(), }) } pub fn evaluate(&self) -> Result { match *self { - ASTNode::Leaf { ref value, .. } => Ok(value.clone()), - ASTNode::Node { ref op_type, .. } => match self.operand_values() { + AstNode::Leaf { ref value, .. } => Ok(value.clone()), + AstNode::Node { ref op_type, .. } => match self.operand_values() { Err(reason) => Err(reason), Ok(operand_values) => match op_type.as_ref() { "+" => infix_operator_two_ints( @@ -161,7 +161,7 @@ impl ASTNode { } } pub fn operand_values(&self) -> Result, String> { - if let ASTNode::Node { ref operands, .. } = *self { + if let AstNode::Node { ref operands, .. } = *self { let mut out = Vec::with_capacity(operands.len()); for operand in operands { match operand.evaluate() { @@ -178,7 +178,7 @@ impl ASTNode { pub fn tokens_to_ast( maybe_tokens: Result, String>, -) -> Result, String> { +) -> Result, String> { if maybe_tokens.is_err() { Err(maybe_tokens.err().unwrap()) } else { @@ -212,7 +212,7 @@ pub fn tokens_to_ast( } } -fn maybe_dump_ast(result: &Result, String>) { +fn maybe_dump_ast(result: &Result, String>) { use std::env; if let Ok(debug_var) = env::var("EXPR_DEBUG_AST") { if debug_var == "1" { @@ -238,11 +238,11 @@ fn maybe_dump_rpn(rpn: &TokenStack) { } } -fn ast_from_rpn(rpn: &mut TokenStack) -> Result, String> { +fn ast_from_rpn(rpn: &mut TokenStack) -> Result, String> { match rpn.pop() { None => Err("syntax error (premature end of expression)".to_owned()), - Some((token_idx, Token::Value { value })) => Ok(ASTNode::new_leaf(token_idx, &value)), + Some((token_idx, Token::Value { value })) => Ok(AstNode::new_leaf(token_idx, &value)), Some((token_idx, Token::InfixOp { value, .. })) => { maybe_ast_node(token_idx, &value, 2, rpn) @@ -262,7 +262,7 @@ fn maybe_ast_node( op_type: &str, arity: usize, rpn: &mut TokenStack, -) -> Result, String> { +) -> Result, String> { let mut operands = Vec::with_capacity(arity); for _ in 0..arity { match ast_from_rpn(rpn) { @@ -271,7 +271,7 @@ fn maybe_ast_node( } } operands.reverse(); - Ok(ASTNode::new_node(token_idx, op_type, operands)) + Ok(AstNode::new_node(token_idx, op_type, operands)) } fn move_rest_of_ops_to_out( diff --git a/src/uu/fmt/src/parasplit.rs b/src/uu/fmt/src/parasplit.rs index f74a25413..950b3f66d 100644 --- a/src/uu/fmt/src/parasplit.rs +++ b/src/uu/fmt/src/parasplit.rs @@ -267,7 +267,7 @@ impl<'a> ParagraphStream<'a> { #[allow(clippy::match_like_matches_macro)] // `matches!(...)` macro not stabilized until rust v1.42 l_slice[..colon_posn].chars().all(|x| match x as usize { - y if y < 33 || y > 126 => false, + y if !(33..=126).contains(&y) => false, _ => true, }) } diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index c35e996f2..fa703eade 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -66,7 +66,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true), ) .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) - .get_matches_from(args.clone()); + .get_matches_from(args); let bytes = matches.is_present(options::BYTES); let spaces = matches.is_present(options::SPACES); diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 3500af544..807d04314 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -625,7 +625,7 @@ mod tests { assert_eq!(arg_outputs("head"), Ok("head".to_owned())); } #[test] - #[cfg(linux)] + #[cfg(target_os = "linux")] fn test_arg_iterate_bad_encoding() { let invalid = unsafe { std::str::from_utf8_unchecked(b"\x80\x81") }; // this arises from a conversion from OsString to &str diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index 96a0df813..04358a415 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -303,7 +303,7 @@ fn exec(files: &[PathBuf], settings: &Settings) -> i32 { } } -fn link_files_in_dir(files: &[PathBuf], target_dir: &PathBuf, settings: &Settings) -> i32 { +fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings) -> i32 { if !target_dir.is_dir() { show_error!("target '{}' is not a directory", target_dir.display()); return 1; @@ -329,7 +329,7 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &PathBuf, settings: &Setting }; } } - target_dir.clone() + target_dir.to_path_buf() } else { match srcpath.as_os_str().to_str() { Some(name) => { @@ -370,7 +370,7 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &PathBuf, settings: &Setting } } -fn relative_path<'a>(src: &PathBuf, dst: &PathBuf) -> Result> { +fn relative_path<'a>(src: &Path, dst: &Path) -> Result> { let abssrc = canonicalize(src, CanonicalizeMode::Normal)?; let absdst = canonicalize(dst, CanonicalizeMode::Normal)?; let suffix_pos = abssrc @@ -390,7 +390,7 @@ fn relative_path<'a>(src: &PathBuf, dst: &PathBuf) -> Result> { Ok(result.into()) } -fn link(src: &PathBuf, dst: &PathBuf, settings: &Settings) -> Result<()> { +fn link(src: &Path, dst: &Path, settings: &Settings) -> Result<()> { let mut backup_path = None; let source: Cow<'_, Path> = if settings.relative { relative_path(&src, dst)? @@ -453,13 +453,13 @@ fn read_yes() -> bool { } } -fn simple_backup_path(path: &PathBuf, suffix: &str) -> PathBuf { +fn simple_backup_path(path: &Path, suffix: &str) -> PathBuf { let mut p = path.as_os_str().to_str().unwrap().to_owned(); p.push_str(suffix); PathBuf::from(p) } -fn numbered_backup_path(path: &PathBuf) -> PathBuf { +fn numbered_backup_path(path: &Path) -> PathBuf { let mut i: u64 = 1; loop { let new_path = simple_backup_path(path, &format!(".~{}~", i)); @@ -470,7 +470,7 @@ fn numbered_backup_path(path: &PathBuf) -> PathBuf { } } -fn existing_backup_path(path: &PathBuf, suffix: &str) -> PathBuf { +fn existing_backup_path(path: &Path, suffix: &str) -> PathBuf { let test_path = simple_backup_path(path, &".~1~".to_owned()); if test_path.exists() { return numbered_backup_path(path); diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index fdc11144a..4024328b5 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1076,7 +1076,7 @@ fn should_display(entry: &DirEntry, config: &Config) -> bool { true } -fn enter_directory(dir: &PathBuf, config: &Config) { +fn enter_directory(dir: &Path, config: &Config) { let mut entries: Vec<_> = safe_unwrap!(fs::read_dir(dir).and_then(Iterator::collect)); entries.retain(|e| should_display(e, config)); @@ -1101,7 +1101,7 @@ fn enter_directory(dir: &PathBuf, config: &Config) { } } -fn get_metadata(entry: &PathBuf, config: &Config) -> std::io::Result { +fn get_metadata(entry: &Path, config: &Config) -> std::io::Result { if config.dereference { entry.metadata().or_else(|_| entry.symlink_metadata()) } else { @@ -1109,7 +1109,7 @@ fn get_metadata(entry: &PathBuf, config: &Config) -> std::io::Result { } } -fn display_dir_entry_size(entry: &PathBuf, config: &Config) -> (usize, usize) { +fn display_dir_entry_size(entry: &Path, config: &Config) -> (usize, usize) { if let Ok(md) = get_metadata(entry, config) { ( display_symlink_count(&md).len(), @@ -1204,7 +1204,7 @@ fn display_grid(names: impl Iterator, width: u16, direction: Direct use uucore::fs::display_permissions; fn display_item_long( - item: &PathBuf, + item: &Path, strip: Option<&Path>, max_links: usize, max_size: usize, diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index b481aeebc..f57178a09 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -335,7 +335,7 @@ fn exec(files: &[PathBuf], b: Behavior) -> i32 { 0 } -fn move_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behavior) -> i32 { +fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> i32 { if !target_dir.is_dir() { show_error!("target ‘{}’ is not a directory", target_dir.display()); return 1; @@ -373,7 +373,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behavior) -> } } -fn rename(from: &PathBuf, to: &PathBuf, b: &Behavior) -> io::Result<()> { +fn rename(from: &Path, to: &Path, b: &Behavior) -> io::Result<()> { let mut backup_path = None; if to.exists() { @@ -429,7 +429,7 @@ fn rename(from: &PathBuf, to: &PathBuf, b: &Behavior) -> io::Result<()> { /// A wrapper around `fs::rename`, so that if it fails, we try falling back on /// copying and removing. -fn rename_with_fallback(from: &PathBuf, to: &PathBuf) -> io::Result<()> { +fn rename_with_fallback(from: &Path, to: &Path) -> io::Result<()> { if fs::rename(from, to).is_err() { // Get metadata without following symlinks let metadata = from.symlink_metadata()?; @@ -464,7 +464,7 @@ fn rename_with_fallback(from: &PathBuf, to: &PathBuf) -> io::Result<()> { /// Move the given symlink to the given destination. On Windows, dangling /// symlinks return an error. #[inline] -fn rename_symlink_fallback(from: &PathBuf, to: &PathBuf) -> io::Result<()> { +fn rename_symlink_fallback(from: &Path, to: &Path) -> io::Result<()> { let path_symlink_points_to = fs::read_link(from)?; #[cfg(unix)] { @@ -507,20 +507,20 @@ fn read_yes() -> bool { } } -fn simple_backup_path(path: &PathBuf, suffix: &str) -> PathBuf { +fn simple_backup_path(path: &Path, suffix: &str) -> PathBuf { let mut p = path.to_string_lossy().into_owned(); p.push_str(suffix); PathBuf::from(p) } -fn numbered_backup_path(path: &PathBuf) -> PathBuf { +fn numbered_backup_path(path: &Path) -> PathBuf { (1_u64..) .map(|i| path.with_extension(format!("~{}~", i))) .find(|p| !p.exists()) .expect("cannot create backup") } -fn existing_backup_path(path: &PathBuf, suffix: &str) -> PathBuf { +fn existing_backup_path(path: &Path, suffix: &str) -> PathBuf { let test_path = path.with_extension("~1~"); if test_path.exists() { numbered_backup_path(path) @@ -529,7 +529,7 @@ fn existing_backup_path(path: &PathBuf, suffix: &str) -> PathBuf { } } -fn is_empty_dir(path: &PathBuf) -> bool { +fn is_empty_dir(path: &Path) -> bool { match fs::read_dir(path) { Ok(contents) => contents.peekable().peek().is_none(), Err(_e) => false, diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index c3b39fca1..36eae66ab 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -118,7 +118,7 @@ struct OdOptions { } impl OdOptions { - fn new<'a>(matches: ArgMatches<'a>, args: Vec) -> Result { + fn new(matches: ArgMatches, args: Vec) -> Result { let byte_order = match matches.value_of(options::ENDIAN) { None => ByteOrder::Native, Some("little") => ByteOrder::Little, diff --git a/src/uu/od/src/parse_inputs.rs b/src/uu/od/src/parse_inputs.rs index 915aa1d92..533f4f106 100644 --- a/src/uu/od/src/parse_inputs.rs +++ b/src/uu/od/src/parse_inputs.rs @@ -63,7 +63,7 @@ pub fn parse_inputs(matches: &dyn CommandLineOpts) -> Result) -> Result Ok(CommandLineInputs::FileAndOffset(( - input_strings[0].clone().to_owned(), + input_strings[0].to_string(), m, None, ))), @@ -118,7 +118,7 @@ pub fn parse_inputs_traditional(input_strings: Vec<&str>) -> Result Ok(CommandLineInputs::FileAndOffset(( - input_strings[0].clone().to_owned(), + input_strings[0].to_string(), n, Some(m), ))), diff --git a/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs b/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs index 79af9abd5..04d33b52c 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs @@ -199,8 +199,7 @@ pub fn arrnum_int_add(arrnum: &[u8], basenum: u8, base_ten_int_term: u8) -> Vec< } pub fn base_conv_vec(src: &[u8], radix_src: u8, radix_dest: u8) -> Vec { - let mut result: Vec = Vec::new(); - result.push(0); + let mut result = vec![0]; for i in src { result = arrnum_int_mult(&result, radix_dest, radix_src); result = arrnum_int_add(&result, radix_dest, *i); @@ -226,8 +225,7 @@ pub fn base_conv_float(src: &[u8], radix_src: u8, radix_dest: u8) -> f64 { // to implement this for arbitrary string input. // until then, the below operates as an outline // of how it would work. - let mut result: Vec = Vec::new(); - result.push(0); + let result: Vec = vec![0]; let mut factor: f64 = 1_f64; let radix_src_float: f64 = f64::from(radix_src); let mut r: f64 = 0_f64; diff --git a/src/uu/readlink/src/readlink.rs b/src/uu/readlink/src/readlink.rs index 727c2cce5..43a4ca656 100644 --- a/src/uu/readlink/src/readlink.rs +++ b/src/uu/readlink/src/readlink.rs @@ -13,7 +13,7 @@ extern crate uucore; use clap::{App, Arg}; use std::fs; use std::io::{stdout, Write}; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use uucore::fs::{canonicalize, CanonicalizeMode}; const NAME: &str = "readlink"; @@ -160,8 +160,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } -fn show(path: &PathBuf, no_newline: bool, use_zero: bool) { - let path = path.as_path().to_str().unwrap(); +fn show(path: &Path, no_newline: bool, use_zero: bool) { + let path = path.to_str().unwrap(); if use_zero { print!("{}\0", path); } else if no_newline { diff --git a/src/uu/realpath/src/realpath.rs b/src/uu/realpath/src/realpath.rs index 5cc8f3d9a..37ff70fb2 100644 --- a/src/uu/realpath/src/realpath.rs +++ b/src/uu/realpath/src/realpath.rs @@ -12,7 +12,7 @@ extern crate uucore; use clap::{App, Arg}; use std::fs; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use uucore::fs::{canonicalize, CanonicalizeMode}; static ABOUT: &str = "print the resolved path"; @@ -82,7 +82,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { retcode } -fn resolve_path(p: &PathBuf, strip: bool, zero: bool, quiet: bool) -> bool { +fn resolve_path(p: &Path, strip: bool, zero: bool, quiet: bool) -> bool { let abs = canonicalize(p, CanonicalizeMode::Normal).unwrap(); if strip { diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 09671768b..94626b4e7 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -176,7 +176,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } else if matches.is_present(OPT_PROMPT_MORE) { InteractiveMode::Once } else if matches.is_present(OPT_INTERACTIVE) { - match &matches.value_of(OPT_INTERACTIVE).unwrap()[..] { + match matches.value_of(OPT_INTERACTIVE).unwrap() { "none" => InteractiveMode::None, "once" => InteractiveMode::Once, "always" => InteractiveMode::Always, diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index 671dd7e1c..c3bba1c78 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -102,7 +102,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let mut largest_dec = 0; let mut padding = 0; let first = if numbers.len() > 1 { - let slice = &numbers[0][..]; + let slice = numbers[0]; let len = slice.len(); let dec = slice.find('.').unwrap_or(len); largest_dec = len - dec; @@ -118,7 +118,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 1.0 }; let increment = if numbers.len() > 2 { - let slice = &numbers[1][..]; + let slice = numbers[1]; let len = slice.len(); let dec = slice.find('.').unwrap_or(len); largest_dec = cmp::max(largest_dec, len - dec); @@ -134,11 +134,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 1.0 }; if increment == 0.0 { - show_error!("increment value: '{}'", &numbers[1][..]); + show_error!("increment value: '{}'", numbers[1]); return 1; } let last = { - let slice = &numbers[numbers.len() - 1][..]; + let slice = numbers[numbers.len() - 1]; padding = cmp::max(padding, slice.find('.').unwrap_or_else(|| slice.len())); match parse_float(slice) { Ok(n) => n, diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 7e0e77184..c56f14280 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -439,6 +439,7 @@ fn pass_name(pass_type: PassType) -> String { } } +#[allow(clippy::too_many_arguments)] fn wipe_file( path_str: &str, n_passes: usize, @@ -472,12 +473,9 @@ fn wipe_file( let mut perms = metadata.permissions(); perms.set_readonly(false); - match fs::set_permissions(path, perms) { - Err(e) => { - show_error!("{}", e); - return; - } - _ => {} + if let Err(e) = fs::set_permissions(path, perms) { + show_error!("{}", e); + return; } } diff --git a/src/uu/sum/src/sum.rs b/src/uu/sum/src/sum.rs index ed5655a3d..d0fbc7c0d 100644 --- a/src/uu/sum/src/sum.rs +++ b/src/uu/sum/src/sum.rs @@ -75,7 +75,7 @@ fn open(name: &str) -> Result> { "Is a directory", )); }; - if !path.metadata().is_ok() { + if path.metadata().is_err() { return Err(std::io::Error::new( std::io::ErrorKind::NotFound, "No such file or directory", diff --git a/src/uu/tac/src/tac.rs b/src/uu/tac/src/tac.rs index 68dae94e2..666ba3384 100644 --- a/src/uu/tac/src/tac.rs +++ b/src/uu/tac/src/tac.rs @@ -90,7 +90,7 @@ fn tac(filenames: Vec, before: bool, _: bool, separator: &str) -> i32 { Box::new(stdin()) as Box } else { let path = Path::new(filename); - if path.is_dir() || !path.metadata().is_ok() { + if path.is_dir() || path.metadata().is_err() { show_error!( "failed to open '{}' for reading: No such file or directory", filename diff --git a/src/uu/test/src/test.rs b/src/uu/test/src/test.rs index 4394e4a8e..f882ff5ae 100644 --- a/src/uu/test/src/test.rs +++ b/src/uu/test/src/test.rs @@ -55,16 +55,16 @@ fn two(args: &[&[u8]], error: &mut bool) -> bool { b"-d" => path(args[1], PathCondition::Directory), b"-e" => path(args[1], PathCondition::Exists), b"-f" => path(args[1], PathCondition::Regular), - b"-g" => path(args[1], PathCondition::GroupIDFlag), + b"-g" => path(args[1], PathCondition::GroupIdFlag), b"-h" => path(args[1], PathCondition::SymLink), b"-L" => path(args[1], PathCondition::SymLink), b"-n" => one(&args[1..]), - b"-p" => path(args[1], PathCondition::FIFO), + b"-p" => path(args[1], PathCondition::Fifo), b"-r" => path(args[1], PathCondition::Readable), b"-S" => path(args[1], PathCondition::Socket), b"-s" => path(args[1], PathCondition::NonEmpty), b"-t" => isatty(args[1]), - b"-u" => path(args[1], PathCondition::UserIDFlag), + b"-u" => path(args[1], PathCondition::UserIdFlag), b"-w" => path(args[1], PathCondition::Writable), b"-x" => path(args[1], PathCondition::Executable), b"-z" => !one(&args[1..]), @@ -322,13 +322,13 @@ enum PathCondition { Directory, Exists, Regular, - GroupIDFlag, + GroupIdFlag, SymLink, - FIFO, + Fifo, Readable, Socket, NonEmpty, - UserIDFlag, + UserIdFlag, Writable, Executable, } @@ -390,13 +390,13 @@ fn path(path: &[u8], cond: PathCondition) -> bool { PathCondition::Directory => file_type.is_dir(), PathCondition::Exists => true, PathCondition::Regular => file_type.is_file(), - PathCondition::GroupIDFlag => metadata.mode() & S_ISGID != 0, + PathCondition::GroupIdFlag => metadata.mode() & S_ISGID != 0, PathCondition::SymLink => metadata.file_type().is_symlink(), - PathCondition::FIFO => file_type.is_fifo(), + PathCondition::Fifo => file_type.is_fifo(), PathCondition::Readable => perm(metadata, Permission::Read), PathCondition::Socket => file_type.is_socket(), PathCondition::NonEmpty => metadata.size() > 0, - PathCondition::UserIDFlag => metadata.mode() & S_ISUID != 0, + PathCondition::UserIdFlag => metadata.mode() & S_ISUID != 0, PathCondition::Writable => perm(metadata, Permission::Write), PathCondition::Executable => perm(metadata, Permission::Execute), } @@ -416,13 +416,13 @@ fn path(path: &[u8], cond: PathCondition) -> bool { PathCondition::Directory => stat.is_dir(), PathCondition::Exists => true, PathCondition::Regular => stat.is_file(), - PathCondition::GroupIDFlag => false, + PathCondition::GroupIdFlag => false, PathCondition::SymLink => false, - PathCondition::FIFO => false, + PathCondition::Fifo => false, PathCondition::Readable => false, // TODO PathCondition::Socket => false, PathCondition::NonEmpty => stat.len() > 0, - PathCondition::UserIDFlag => false, + PathCondition::UserIdFlag => false, PathCondition::Writable => false, // TODO PathCondition::Executable => false, // TODO } diff --git a/src/uu/tr/src/expand.rs b/src/uu/tr/src/expand.rs index e71cf262c..73612a065 100644 --- a/src/uu/tr/src/expand.rs +++ b/src/uu/tr/src/expand.rs @@ -24,7 +24,7 @@ use std::ops::RangeInclusive; fn parse_sequence(s: &str) -> (char, usize) { let c = s.chars().next().expect("invalid escape: empty string"); - if '0' <= c && c <= '7' { + if ('0'..='7').contains(&c) { let mut v = c.to_digit(8).unwrap(); let mut consumed = 1; let bits_per_digit = 3; diff --git a/src/uu/tsort/src/tsort.rs b/src/uu/tsort/src/tsort.rs index 3440972a2..967a9514a 100644 --- a/src/uu/tsort/src/tsort.rs +++ b/src/uu/tsort/src/tsort.rs @@ -16,8 +16,8 @@ use std::io::{stdin, BufRead, BufReader, Read}; use std::path::Path; static VERSION: &str = env!("CARGO_PKG_VERSION"); -static SUMMARY: &str = "Topological sort the strings in FILE. -Strings are defined as any sequence of tokens separated by whitespace (tab, space, or newline). +static SUMMARY: &str = "Topological sort the strings in FILE. +Strings are defined as any sequence of tokens separated by whitespace (tab, space, or newline). If FILE is not passed in, stdin is used instead."; static USAGE: &str = "tsort [OPTIONS] FILE"; @@ -32,13 +32,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .version(VERSION) .usage(USAGE) .about(SUMMARY) - .arg(Arg::with_name(options::FILE).hidden(true)) + .arg( + Arg::with_name(options::FILE) + .default_value("-") + .hidden(true), + ) .get_matches_from(args); - let input = match matches.value_of(options::FILE) { - Some(v) => v, - None => "-", - }; + let input = matches + .value_of(options::FILE) + .expect("Value is required by clap"); let mut stdin_buf; let mut file_buf; diff --git a/src/uu/wc/src/count_bytes.rs b/src/uu/wc/src/count_bytes.rs index 0c3b5edb7..7f06f8171 100644 --- a/src/uu/wc/src/count_bytes.rs +++ b/src/uu/wc/src/count_bytes.rs @@ -72,30 +72,27 @@ pub(crate) fn count_bytes_fast(handle: &mut T) -> WcResult { - // If the file is regular, then the `st_size` should hold - // the file's size in bytes. - if (stat.st_mode & S_IFREG) != 0 { - return Ok(stat.st_size as usize); - } - #[cfg(any(target_os = "linux", target_os = "android"))] - { - // Else, if we're on Linux and our file is a FIFO pipe - // (or stdin), we use splice to count the number of bytes. - if (stat.st_mode & S_IFIFO) != 0 { - if let Ok(n) = count_bytes_using_splice(fd) { - return Ok(n); - } + if let Ok(stat) = fstat(fd) { + // If the file is regular, then the `st_size` should hold + // the file's size in bytes. + if (stat.st_mode & S_IFREG) != 0 { + return Ok(stat.st_size as usize); + } + #[cfg(any(target_os = "linux", target_os = "android"))] + { + // Else, if we're on Linux and our file is a FIFO pipe + // (or stdin), we use splice to count the number of bytes. + if (stat.st_mode & S_IFIFO) != 0 { + if let Ok(n) = count_bytes_using_splice(fd) { + return Ok(n); } } } - _ => {} } } // Fall back on `read`, but without the overhead of counting words and lines. - let mut buf = [0 as u8; BUF_SIZE]; + let mut buf = [0_u8; BUF_SIZE]; let mut byte_count = 0; loop { match handle.read(&mut buf) { diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 22463caa4..59ca10141 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -138,11 +138,8 @@ impl AddAssign for WordCount { } impl WordCount { - fn with_title<'a>(self, title: &'a str) -> TitledWordCount<'a> { - return TitledWordCount { - title: title, - count: self, - }; + fn with_title(self, title: &str) -> TitledWordCount { + TitledWordCount { title, count: self } } } @@ -251,7 +248,7 @@ fn is_word_separator(byte: u8) -> bool { fn word_count_from_reader( mut reader: T, settings: &Settings, - path: &String, + path: &str, ) -> WcResult { let only_count_bytes = settings.show_bytes && (!(settings.show_chars @@ -333,18 +330,18 @@ fn word_count_from_reader( }) } -fn word_count_from_path(path: &String, settings: &Settings) -> WcResult { +fn word_count_from_path(path: &str, settings: &Settings) -> WcResult { if path == "-" { let stdin = io::stdin(); let stdin_lock = stdin.lock(); - return Ok(word_count_from_reader(stdin_lock, settings, path)?); + word_count_from_reader(stdin_lock, settings, path) } else { let path_obj = Path::new(path); if path_obj.is_dir() { - return Err(WcError::IsDirectory(path.clone())); + Err(WcError::IsDirectory(path.to_owned())) } else { let file = File::open(path)?; - return Ok(word_count_from_reader(file, settings, path)?); + word_count_from_reader(file, settings, path) } } } @@ -425,7 +422,7 @@ fn print_stats( } if result.title == "-" { - writeln!(stdout_lock, "")?; + writeln!(stdout_lock)?; } else { writeln!(stdout_lock, " {}", result.title)?; } From 75a76613e43308c53477b41575a33a01f7fdaa05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reto=20Habl=C3=BCtzel?= Date: Sun, 11 Apr 2021 16:09:18 +0200 Subject: [PATCH 0325/1135] fix clippy in cp --- src/uu/cp/src/cp.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 60484a79a..4e245b298 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -132,7 +132,9 @@ macro_rules! prompt_yes( pub type CopyResult = Result; pub type Source = PathBuf; +pub type SourceSlice = Path; pub type Target = PathBuf; +pub type TargetSlice = Path; /// Specifies whether when overwrite files #[derive(Clone, Eq, PartialEq)] @@ -664,7 +666,7 @@ impl TargetType { /// /// Treat target as a dir if we have multiple sources or the target /// exists and already is a directory - fn determine(sources: &[Source], target: &Target) -> TargetType { + fn determine(sources: &[Source], target: &TargetSlice) -> TargetType { if sources.len() > 1 || target.is_dir() { TargetType::Directory } else { @@ -787,7 +789,7 @@ fn preserve_hardlinks( /// Behavior depends on `options`, see [`Options`] for details. /// /// [`Options`]: ./struct.Options.html -fn copy(sources: &[Source], target: &Target, options: &Options) -> CopyResult<()> { +fn copy(sources: &[Source], target: &TargetSlice, options: &Options) -> CopyResult<()> { let target_type = TargetType::determine(sources, target); verify_target_type(target, &target_type)?; @@ -839,7 +841,7 @@ fn copy(sources: &[Source], target: &Target, options: &Options) -> CopyResult<() fn construct_dest_path( source_path: &Path, - target: &Target, + target: &TargetSlice, target_type: &TargetType, options: &Options, ) -> CopyResult { @@ -869,8 +871,8 @@ fn construct_dest_path( } fn copy_source( - source: &Source, - target: &Target, + source: &SourceSlice, + target: &TargetSlice, target_type: &TargetType, options: &Options, ) -> CopyResult<()> { @@ -911,7 +913,7 @@ fn adjust_canonicalization(p: &Path) -> Cow { /// /// Any errors encountered copying files in the tree will be logged but /// will not cause a short-circuit. -fn copy_directory(root: &Path, target: &Target, options: &Options) -> CopyResult<()> { +fn copy_directory(root: &Path, target: &TargetSlice, options: &Options) -> CopyResult<()> { if !options.recursive { return Err(format!("omitting directory '{}'", root.display()).into()); } From b465c34eeffc99ba6d5b390ed92209c08baa11e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reto=20Habl=C3=BCtzel?= Date: Sun, 11 Apr 2021 16:16:38 +0200 Subject: [PATCH 0326/1135] fix ls --- src/uu/ls/src/ls.rs | 2 +- src/uu/ls/src/version_cmp.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 4024328b5..d198f1588 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1042,7 +1042,7 @@ fn sort_entries(entries: &mut Vec, config: &Config) { .sort_by_key(|k| Reverse(get_metadata(k, config).map(|md| md.len()).unwrap_or(0))), // The default sort in GNU ls is case insensitive Sort::Name => entries.sort_by_key(|k| k.to_string_lossy().to_lowercase()), - Sort::Version => entries.sort_by(version_cmp::version_cmp), + Sort::Version => entries.sort_by(|a, b| version_cmp::version_cmp(a, b)), Sort::None => {} } diff --git a/src/uu/ls/src/version_cmp.rs b/src/uu/ls/src/version_cmp.rs index 3cd5989f1..4cd39f916 100644 --- a/src/uu/ls/src/version_cmp.rs +++ b/src/uu/ls/src/version_cmp.rs @@ -1,8 +1,9 @@ -use std::{cmp::Ordering, path::PathBuf}; +use std::cmp::Ordering; +use std::path::Path; -/// Compare pathbufs in a way that matches the GNU version sort, meaning that +/// Compare paths in a way that matches the GNU version sort, meaning that /// numbers get sorted in a natural way. -pub(crate) fn version_cmp(a: &PathBuf, b: &PathBuf) -> Ordering { +pub(crate) fn version_cmp(a: &Path, b: &Path) -> Ordering { let a_string = a.to_string_lossy(); let b_string = b.to_string_lossy(); let mut a = a_string.chars().peekable(); From d67560c37ac6e2a4443920ced20b788249fba45e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reto=20Habl=C3=BCtzel?= Date: Sun, 11 Apr 2021 16:34:19 +0200 Subject: [PATCH 0327/1135] fix clippy for unix --- src/uu/chgrp/src/chgrp.rs | 2 +- src/uu/chmod/src/chmod.rs | 8 ++++---- src/uu/chown/src/chown.rs | 4 ++-- src/uu/chroot/src/chroot.rs | 14 +++++++------- src/uu/install/src/install.rs | 18 +++++++++--------- src/uu/ls/src/ls.rs | 1 + src/uu/pinky/src/pinky.rs | 12 +++--------- src/uu/stdbuf/src/libstdbuf/src/libstdbuf.rs | 4 ++-- src/uu/stdbuf/src/stdbuf.rs | 6 ++---- src/uu/touch/src/touch.rs | 2 +- src/uu/tty/src/tty.rs | 4 ++-- src/uucore/src/lib/features/perms.rs | 4 ++-- 12 files changed, 36 insertions(+), 43 deletions(-) diff --git a/src/uu/chgrp/src/chgrp.rs b/src/uu/chgrp/src/chgrp.rs index b4c3360c5..592a0a905 100644 --- a/src/uu/chgrp/src/chgrp.rs +++ b/src/uu/chgrp/src/chgrp.rs @@ -286,7 +286,7 @@ impl Chgrper { ret = match wrap_chgrp(path, &meta, self.dest_gid, follow, self.verbosity.clone()) { Ok(n) => { - if n != "" { + if !n.is_empty() { show_info!("{}", n); } 0 diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index d9d8c8cf2..dc11be7b8 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -171,13 +171,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // of a prefix '-' if it's associated with MODE // e.g. "chmod -v -xw -R FILE" -> "chmod -v xw -R FILE" pub fn strip_minus_from_mode(args: &mut Vec) -> bool { - for i in 0..args.len() { - if args[i].starts_with("-") { - if let Some(second) = args[i].chars().nth(1) { + for arg in args { + if arg.starts_with('-') { + if let Some(second) = arg.chars().nth(1) { match second { 'r' | 'w' | 'x' | 'X' | 's' | 't' | 'u' | 'g' | 'o' | '0'..='7' => { // TODO: use strip_prefix() once minimum rust version reaches 1.45.0 - args[i] = args[i][1..args[i].len()].to_string(); + *arg = arg[1..arg.len()].to_string(); return true; } _ => {} diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index 42010de03..0e3273b3b 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -391,7 +391,7 @@ impl Chowner { self.verbosity.clone(), ) { Ok(n) => { - if n != "" { + if !n.is_empty() { show_info!("{}", n); } 0 @@ -446,7 +446,7 @@ impl Chowner { self.verbosity.clone(), ) { Ok(n) => { - if n != "" { + if !n.is_empty() { show_info!("{}", n); } 0 diff --git a/src/uu/chroot/src/chroot.rs b/src/uu/chroot/src/chroot.rs index 44c5dfa02..7e672da1e 100644 --- a/src/uu/chroot/src/chroot.rs +++ b/src/uu/chroot/src/chroot.rs @@ -104,7 +104,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { _ => { let mut vector: Vec<&str> = Vec::new(); for (&k, v) in matches.args.iter() { - vector.push(k.clone()); + vector.push(k); vector.push(&v.vals[0].to_str().unwrap()); } vector @@ -133,7 +133,7 @@ fn set_context(root: &Path, options: &clap::ArgMatches) { let userspec = match userspec_str { Some(ref u) => { let s: Vec<&str> = u.split(':').collect(); - if s.len() != 2 || s.iter().any(|&spec| spec == "") { + if s.len() != 2 || s.iter().any(|&spec| spec.is_empty()) { crash!(1, "invalid userspec: `{}`", u) }; s @@ -142,16 +142,16 @@ fn set_context(root: &Path, options: &clap::ArgMatches) { }; let (user, group) = if userspec.is_empty() { - (&user_str[..], &group_str[..]) + (user_str, group_str) } else { - (&userspec[0][..], &userspec[1][..]) + (userspec[0], userspec[1]) }; enter_chroot(root); - set_groups_from_str(&groups_str[..]); - set_main_group(&group[..]); - set_user(&user[..]); + set_groups_from_str(groups_str); + set_main_group(group); + set_user(user); } fn enter_chroot(root: &Path) { diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index e902862a8..a75ce45be 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -302,7 +302,7 @@ fn behavior(matches: &ArgMatches) -> Result { let specified_mode: Option = if matches.is_present(OPT_MODE) { match matches.value_of(OPT_MODE) { - Some(x) => match mode::parse(&x[..], considering_dir) { + Some(x) => match mode::parse(x, considering_dir) { Ok(y) => Some(y), Err(err) => { show_error!("Invalid mode string: {}", err); @@ -429,7 +429,7 @@ fn standard(paths: Vec, b: Behavior) -> i32 { /// _files_ must all exist as non-directories. /// _target_dir_ must be a directory. /// -fn copy_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behavior) -> i32 { +fn copy_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> i32 { if !target_dir.is_dir() { show_error!("target '{}' is not a directory", target_dir.display()); return 1; @@ -453,7 +453,7 @@ fn copy_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behavior) -> continue; } - let mut targetpath = target_dir.clone().to_path_buf(); + let mut targetpath = target_dir.to_path_buf(); let filename = sourcepath.components().last().unwrap(); targetpath.push(filename); @@ -478,7 +478,7 @@ fn copy_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behavior) -> /// _file_ must exist as a non-directory. /// _target_ must be a non-directory /// -fn copy_file_to_file(file: &PathBuf, target: &PathBuf, b: &Behavior) -> i32 { +fn copy_file_to_file(file: &Path, target: &Path, b: &Behavior) -> i32 { if copy(file, &target, b).is_err() { 1 } else { @@ -497,7 +497,7 @@ fn copy_file_to_file(file: &PathBuf, target: &PathBuf, b: &Behavior) -> i32 { /// /// If the copy system call fails, we print a verbose error and return an empty error value. /// -fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { +fn copy(from: &Path, to: &Path, b: &Behavior) -> Result<(), ()> { if b.compare && !need_copy(from, to, b) { return Ok(()); } @@ -556,7 +556,7 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { }; let gid = meta.gid(); match wrap_chown( - to.as_path(), + to, &meta, Some(owner_id), Some(gid), @@ -582,7 +582,7 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { Ok(g) => g, _ => crash!(1, "no such group: {}", b.group), }; - match wrap_chgrp(to.as_path(), &meta, group_id, false, Verbosity::Normal) { + match wrap_chgrp(to, &meta, group_id, false, Verbosity::Normal) { Ok(n) => { if !n.is_empty() { show_info!("{}", n); @@ -601,7 +601,7 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { let modified_time = FileTime::from_last_modification_time(&meta); let accessed_time = FileTime::from_last_access_time(&meta); - match set_file_times(to.as_path(), accessed_time, modified_time) { + match set_file_times(to, accessed_time, modified_time) { Ok(_) => {} Err(e) => show_info!("{}", e), } @@ -630,7 +630,7 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { /// /// Crashes the program if a nonexistent owner or group is specified in _b_. /// -fn need_copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> bool { +fn need_copy(from: &Path, to: &Path, b: &Behavior) -> bool { let from_meta = match fs::metadata(from) { Ok(meta) => meta, Err(_) => return true, diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index d198f1588..aebaa6b44 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -370,6 +370,7 @@ impl Config { }) .or_else(|| termsize::get().map(|s| s.cols)); + #[allow(clippy::needless_bool)] let show_control = if options.is_present(options::HIDE_CONTROL_CHARS) { false } else if options.is_present(options::SHOW_CONTROL_CHARS) { diff --git a/src/uu/pinky/src/pinky.rs b/src/uu/pinky/src/pinky.rs index 772e311d6..851a3cd42 100644 --- a/src/uu/pinky/src/pinky.rs +++ b/src/uu/pinky/src/pinky.rs @@ -15,7 +15,6 @@ use uucore::utmpx::{self, time, Utmpx}; use std::io::prelude::*; use std::io::BufReader; -use std::io::Result as IOResult; use std::fs::File; use std::os::unix::fs::MetadataExt; @@ -136,12 +135,8 @@ The utmp file will be {}", }; if do_short_format { - if let Err(e) = pk.short_pinky() { - show_usage_error!("{}", e); - 1 - } else { - 0 - } + pk.short_pinky(); + 0 } else { pk.long_pinky() } @@ -282,7 +277,7 @@ impl Pinky { println!(); } - fn short_pinky(&self) -> IOResult<()> { + fn short_pinky(&self) { if self.include_heading { self.print_heading(); } @@ -295,7 +290,6 @@ impl Pinky { } } } - Ok(()) } fn long_pinky(&self) -> i32 { diff --git a/src/uu/stdbuf/src/libstdbuf/src/libstdbuf.rs b/src/uu/stdbuf/src/libstdbuf/src/libstdbuf.rs index fa36d4ab5..d08427d98 100644 --- a/src/uu/stdbuf/src/libstdbuf/src/libstdbuf.rs +++ b/src/uu/stdbuf/src/libstdbuf/src/libstdbuf.rs @@ -35,8 +35,8 @@ extern "C" { fn set_buffer(stream: *mut FILE, value: &str) { let (mode, size): (c_int, size_t) = match value { - "0" => (_IONBF, 0 as size_t), - "L" => (_IOLBF, 0 as size_t), + "0" => (_IONBF, 0_usize), + "L" => (_IOLBF, 0_usize), input => { let buff_size: usize = match input.parse() { Ok(num) => num, diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index a6c9f9dc5..8c65a5c7e 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -141,12 +141,10 @@ fn parse_size(size: &str) -> Option { fn check_option(matches: &ArgMatches, name: &str) -> Result { match matches.value_of(name) { - Some(value) => match &value[..] { + Some(value) => match value { "L" => { if name == options::INPUT { - Err(ProgramOptionsError(format!( - "line buffering stdin is meaningless" - ))) + Err(ProgramOptionsError("line buffering stdin is meaningless".to_string())) } else { Ok(BufferType::Line) } diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 39405900e..f0c3c12d2 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -137,7 +137,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let (mut atime, mut mtime) = if matches.is_present(options::sources::REFERENCE) { stat( - &matches.value_of(options::sources::REFERENCE).unwrap()[..], + matches.value_of(options::sources::REFERENCE).unwrap(), !matches.is_present(options::NO_DEREF), ) } else if matches.is_present(options::sources::DATE) diff --git a/src/uu/tty/src/tty.rs b/src/uu/tty/src/tty.rs index 18d69db46..815c6f96b 100644 --- a/src/uu/tty/src/tty.rs +++ b/src/uu/tty/src/tty.rs @@ -65,9 +65,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } - return if is_stdin_interactive() { + if is_stdin_interactive() { libc::EXIT_SUCCESS } else { libc::EXIT_FAILURE - }; + } } diff --git a/src/uucore/src/lib/features/perms.rs b/src/uucore/src/lib/features/perms.rs index 66db15451..36f56206d 100644 --- a/src/uucore/src/lib/features/perms.rs +++ b/src/uucore/src/lib/features/perms.rs @@ -31,9 +31,9 @@ fn chgrp>(path: P, dgid: gid_t, follow: bool) -> IOResult<()> { let s = CString::new(path.as_os_str().as_bytes()).unwrap(); let ret = unsafe { if follow { - libc::chown(s.as_ptr(), (0 as gid_t).wrapping_sub(1), dgid) + libc::chown(s.as_ptr(), 0_u32.wrapping_sub(1), dgid) } else { - lchown(s.as_ptr(), (0 as gid_t).wrapping_sub(1), dgid) + lchown(s.as_ptr(), 0_u32.wrapping_sub(1), dgid) } }; if ret == 0 { From d219b6e705b8f48a73f19481aad4fdd9b25beca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reto=20Habl=C3=BCtzel?= Date: Mon, 12 Apr 2021 19:50:23 +0200 Subject: [PATCH 0328/1135] strip_suffix is not avaialble with rust 1.40 --- src/uu/basename/src/basename.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/uu/basename/src/basename.rs b/src/uu/basename/src/basename.rs index b7f99af27..84521bdd1 100644 --- a/src/uu/basename/src/basename.rs +++ b/src/uu/basename/src/basename.rs @@ -113,8 +113,12 @@ fn basename(fullname: &str, suffix: &str) -> String { fn strip_suffix(name: &str, suffix: &str) -> String { if name == suffix { - name.to_owned() - } else { - name.strip_suffix(suffix).unwrap_or(name).to_owned() + return name.to_owned(); } + + if name.ends_with(suffix) { + return name[..name.len() - suffix.len()].to_owned(); + } + + name.to_owned() } From 07e9c5896c9dc72fa2c1ec5f20db2b7dc1e39327 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reto=20Habl=C3=BCtzel?= Date: Mon, 12 Apr 2021 19:53:47 +0200 Subject: [PATCH 0329/1135] ignore strip_suffix until minimum rust version is 1.45 --- src/uu/basename/src/basename.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uu/basename/src/basename.rs b/src/uu/basename/src/basename.rs index 84521bdd1..7b02a7a83 100644 --- a/src/uu/basename/src/basename.rs +++ b/src/uu/basename/src/basename.rs @@ -111,6 +111,7 @@ fn basename(fullname: &str, suffix: &str) -> String { } } +#[allow(clippy::manual_strip)] // can be replaced with strip_suffix once the minimum rust version is 1.45 fn strip_suffix(name: &str, suffix: &str) -> String { if name == suffix { return name.to_owned(); From a4253d125497a98e15f4da27191053302a1870e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reto=20Habl=C3=BCtzel?= Date: Mon, 12 Apr 2021 20:07:10 +0200 Subject: [PATCH 0330/1135] apply more clippy suggestions from nightly --- src/uu/df/src/df.rs | 5 ----- src/uu/hashsum/src/hashsum.rs | 14 +++++++------- .../printf/src/tokenize/num_format/num_format.rs | 6 +----- src/uu/ptx/src/ptx.rs | 4 ++-- src/uu/shred/src/shred.rs | 5 +---- src/uu/unexpand/src/unexpand.rs | 6 ++---- src/uu/who/src/who.rs | 5 +---- 7 files changed, 14 insertions(+), 31 deletions(-) diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index 57caf7970..e898b187c 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -116,7 +116,6 @@ struct Options { show_listed_fs: bool, show_fs_type: bool, show_inode_instead: bool, - print_grand_total: bool, // block_size: usize, human_readable_base: i64, fs_selector: FsSelector, @@ -286,7 +285,6 @@ impl Options { show_listed_fs: false, show_fs_type: false, show_inode_instead: false, - print_grand_total: false, // block_size: match env::var("BLOCKSIZE") { // Ok(size) => size.parse().unwrap(), // Err(_) => 512, @@ -871,9 +869,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if matches.is_present(OPT_ALL) { opt.show_all_fs = true; } - if matches.is_present(OPT_TOTAL) { - opt.print_grand_total = true; - } if matches.is_present(OPT_INODES) { opt.show_inode_instead = true; } diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index ee7d2a0f7..2e31ddd25 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -78,7 +78,7 @@ fn detect_algo<'a>( "sha512sum" => ("SHA512", Box::new(Sha512::new()) as Box, 512), "b2sum" => ("BLAKE2", Box::new(Blake2b::new(64)) as Box, 512), "sha3sum" => match matches.value_of("bits") { - Some(bits_str) => match usize::from_str_radix(&bits_str, 10) { + Some(bits_str) => match (&bits_str).parse::() { Ok(224) => ( "SHA3-224", Box::new(Sha3_224::new()) as Box, @@ -128,7 +128,7 @@ fn detect_algo<'a>( 512, ), "shake128sum" => match matches.value_of("bits") { - Some(bits_str) => match usize::from_str_radix(&bits_str, 10) { + Some(bits_str) => match (&bits_str).parse::() { Ok(bits) => ( "SHAKE128", Box::new(Shake128::new()) as Box, @@ -139,7 +139,7 @@ fn detect_algo<'a>( None => crash!(1, "--bits required for SHAKE-128"), }, "shake256sum" => match matches.value_of("bits") { - Some(bits_str) => match usize::from_str_radix(&bits_str, 10) { + Some(bits_str) => match (&bits_str).parse::() { Ok(bits) => ( "SHAKE256", Box::new(Shake256::new()) as Box, @@ -182,7 +182,7 @@ fn detect_algo<'a>( } if matches.is_present("sha3") { match matches.value_of("bits") { - Some(bits_str) => match usize::from_str_radix(&bits_str, 10) { + Some(bits_str) => match (&bits_str).parse::() { Ok(224) => set_or_crash( "SHA3-224", Box::new(Sha3_224::new()) as Box, @@ -226,7 +226,7 @@ fn detect_algo<'a>( } if matches.is_present("shake128") { match matches.value_of("bits") { - Some(bits_str) => match usize::from_str_radix(&bits_str, 10) { + Some(bits_str) => match (&bits_str).parse::() { Ok(bits) => set_or_crash("SHAKE128", Box::new(Shake128::new()), bits), Err(err) => crash!(1, "{}", err), }, @@ -235,7 +235,7 @@ fn detect_algo<'a>( } if matches.is_present("shake256") { match matches.value_of("bits") { - Some(bits_str) => match usize::from_str_radix(&bits_str, 10) { + Some(bits_str) => match (&bits_str).parse::() { Ok(bits) => set_or_crash("SHAKE256", Box::new(Shake256::new()), bits), Err(err) => crash!(1, "{}", err), }, @@ -253,7 +253,7 @@ fn detect_algo<'a>( // TODO: return custom error type fn parse_bit_num(arg: &str) -> Result { - usize::from_str_radix(arg, 10) + arg.parse() } fn is_valid_bit_num(arg: String) -> Result<(), String> { diff --git a/src/uu/printf/src/tokenize/num_format/num_format.rs b/src/uu/printf/src/tokenize/num_format/num_format.rs index 9a519e95e..812f51b5a 100644 --- a/src/uu/printf/src/tokenize/num_format/num_format.rs +++ b/src/uu/printf/src/tokenize/num_format/num_format.rs @@ -263,9 +263,5 @@ pub fn num_format(field: &FormatField, in_str_opt: Option<&String>) -> Option Config { } if matches.is_present(options::WIDTH) { let width_str = matches.value_of(options::WIDTH).expect(err_msg).to_string(); - config.line_width = crash_if_err!(1, usize::from_str_radix(&width_str, 10)); + config.line_width = crash_if_err!(1, (&width_str).parse::()); } if matches.is_present(options::GAP_SIZE) { let gap_str = matches .value_of(options::GAP_SIZE) .expect(err_msg) .to_string(); - config.gap_size = crash_if_err!(1, usize::from_str_radix(&gap_str, 10)); + config.gap_size = crash_if_err!(1, (&gap_str).parse::()); } if matches.is_present(options::FORMAT_ROFF) { config.format = OutFormat::Roff; diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index c56f14280..b89d48a10 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -363,10 +363,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let force = matches.is_present(options::FORCE); let remove = matches.is_present(options::REMOVE); - let size_arg = match matches.value_of(options::SIZE) { - Some(s) => Some(s.to_string()), - None => None, - }; + let size_arg = matches.value_of(options::SIZE).map(|s| s.to_string()); let size = get_size(size_arg); let exact = matches.is_present(options::EXACT) && size.is_none(); // if -s is given, ignore -x let zero = matches.is_present(options::ZERO); diff --git a/src/uu/unexpand/src/unexpand.rs b/src/uu/unexpand/src/unexpand.rs index 5b08c33cf..3d80bd6e9 100644 --- a/src/uu/unexpand/src/unexpand.rs +++ b/src/uu/unexpand/src/unexpand.rs @@ -149,10 +149,8 @@ fn next_tabstop(tabstops: &[usize], col: usize) -> Option { Some(tabstops[0] - col % tabstops[0]) } else { // find next larger tab - match tabstops.iter().find(|&&t| t > col) { - Some(t) => Some(t - col), - None => None, // if there isn't one in the list, tab becomes a single space - } + // if there isn't one in the list, tab becomes a single space + tabstops.iter().find(|&&t| t > col).map(|t| t-col) } } diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index 8c7ff3211..9444985dc 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -222,7 +222,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { need_runlevel, need_users, my_line_only, - has_records: false, args: matches.free, }; @@ -247,7 +246,6 @@ struct Who { need_runlevel: bool, need_users: bool, my_line_only: bool, - has_records: bool, args: Vec, } @@ -321,8 +319,7 @@ impl Who { println!("{}", users.join(" ")); println!("# users={}", users.len()); } else { - let mut records = Utmpx::iter_all_records().read_from(f).peekable(); - self.has_records = records.peek().is_some(); + let records = Utmpx::iter_all_records().read_from(f).peekable(); if self.include_heading { self.print_heading() From e6c195a675eb9043ad7ee1668e784de2387bf21b Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Mon, 12 Apr 2021 14:24:22 -0500 Subject: [PATCH 0331/1135] ExtSort --- Cargo.lock | 139 +++++++++++++++++++++++++++++++++++++++- src/uu/sort/Cargo.toml | 6 +- src/uu/sort/src/sort.rs | 96 +++++++++++++++++++++++---- 3 files changed, 223 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d45e41c16..052d6de40 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,12 +119,40 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" +[[package]] +name = "bytecount" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72feb31ffc86498dacdbd0fcebb56138e7177a8cc5cea4516031d15ae85a742e" + [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +[[package]] +name = "cargo-platform" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0226944a63d1bf35a3b5f948dd7c59e263db83695c9e8bffc4037de02e30f1d7" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7714a157da7991e23d90686b9524b9e12e0407a108647f52e9328f4b3d51ac7f" +dependencies = [ + "cargo-platform", + "semver 0.11.0", + "semver-parser 0.10.2", + "serde", + "serde_json", +] + [[package]] name = "cast" version = "0.2.3" @@ -560,6 +588,26 @@ dependencies = [ "regex", ] +[[package]] +name = "error-chain" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" +dependencies = [ + "version_check", +] + +[[package]] +name = "extsort" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc5bb6fbca3c5ce6a51f6857eab8c35c898b2fbcb62ff1b728243dd19ec0c9f" +dependencies = [ + "rayon", + "skeptic", + "tempfile", +] + [[package]] name = "fake-simd" version = "0.1.2" @@ -944,6 +992,15 @@ dependencies = [ "proc-macro-hack", ] +[[package]] +name = "pest" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +dependencies = [ + "ucd-trie", +] + [[package]] name = "pkg-config" version = "0.3.19" @@ -1009,6 +1066,17 @@ dependencies = [ "unicode-xid 0.2.1", ] +[[package]] +name = "pulldown-cmark" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffade02495f22453cd593159ea2f59827aae7f53fa8323f756799b670881dcf8" +dependencies = [ + "bitflags", + "memchr 2.3.4", + "unicase", +] + [[package]] name = "quick-error" version = "1.2.3" @@ -1245,7 +1313,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver", + "semver 0.9.0", ] [[package]] @@ -1275,7 +1343,17 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser", + "semver-parser 0.7.0", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser 0.10.2", + "serde", ] [[package]] @@ -1284,11 +1362,23 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + [[package]] name = "serde" version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" +dependencies = [ + "serde_derive", +] [[package]] name = "serde_cbor" @@ -1353,6 +1443,21 @@ dependencies = [ "generic-array", ] +[[package]] +name = "skeptic" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "188b810342d98f23f0bb875045299f34187b559370b041eb11520c905370a888" +dependencies = [ + "bytecount", + "cargo_metadata", + "error-chain", + "glob 0.3.0", + "pulldown-cmark", + "tempfile", + "walkdir", +] + [[package]] name = "smallvec" version = "0.6.14" @@ -1367,6 +1472,9 @@ name = "smallvec" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" +dependencies = [ + "serde", +] [[package]] name = "strsim" @@ -1528,6 +1636,21 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" + +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + [[package]] name = "unicode-segmentation" version = "1.7.1" @@ -2289,12 +2412,16 @@ dependencies = [ name = "uu_sort" version = "0.0.6" dependencies = [ + "byteorder", "clap", + "extsort", "fnv", "itertools 0.10.0", "rand 0.7.3", "rayon", - "semver", + "semver 0.9.0", + "serde", + "serde_json", "smallvec 1.6.1", "uucore", "uucore_procs", @@ -2604,6 +2731,12 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +[[package]] +name = "version_check" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" + [[package]] name = "void" version = "1.0.2" diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 6a9976278..8ad0a681f 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -15,13 +15,17 @@ edition = "2018" path = "src/sort.rs" [dependencies] +byteorder = "1.4.3" +extsort = "0.4.2" +serde_json = { version = "1.0", default-features = false, features = ["alloc"] } +serde = { version = "1.0", features = ["derive"] } rayon = "1.5" rand = "0.7" clap = "2.33" fnv = "1.0.7" itertools = "0.10.0" semver = "0.9.0" -smallvec = "1.6.1" +smallvec = { version = "1.6.1", features = ["serde"] } uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 8bf6eb1e8..cb07f60b7 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -20,7 +20,6 @@ use fnv::FnvHasher; use itertools::Itertools; use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; -use rayon::prelude::*; use semver::Version; use smallvec::SmallVec; use std::borrow::Cow; @@ -34,6 +33,14 @@ use std::mem::replace; use std::ops::{Range, RangeInclusive}; use std::path::Path; use uucore::fs::is_stdin_interactive; // for Iterator::dedup() +use extsort::*; +use std::str; +use serde::{Serialize, Deserialize}; +use std::ffi::OsString; +use std::usize; +use std::path::PathBuf; +use std::string::*; +use serde_json::Result; static NAME: &str = "sort"; static ABOUT: &str = "Display sorted concatenation of all FILE(s)."; @@ -72,6 +79,8 @@ static OPT_RANDOM: &str = "random-sort"; static OPT_ZERO_TERMINATED: &str = "zero-terminated"; static OPT_PARALLEL: &str = "parallel"; static OPT_FILES0_FROM: &str = "files0-from"; +static OPT_BUF_SIZE: &str = "buffer-size"; +static OPT_TMP_DIR: &str = "temporary-directory"; static ARG_FILES: &str = "files"; @@ -110,6 +119,8 @@ struct GlobalSettings { separator: Option, threads: String, zero_terminated: bool, + buffer_size: usize, + tmp_dir: PathBuf, } impl Default for GlobalSettings { @@ -133,6 +144,8 @@ impl Default for GlobalSettings { separator: None, threads: String::new(), zero_terminated: false, + buffer_size: 10000000usize, + tmp_dir: PathBuf::from(r"/tmp"), } } } @@ -162,7 +175,7 @@ impl From<&GlobalSettings> for KeySettings { } /// Represents the string selected by a FieldSelector. -#[derive(Debug)] +#[derive(Debug, Serialize, Deserialize, Clone)] enum Selection { /// If we had to transform this selection, we have to store a new string. String(String), @@ -182,13 +195,29 @@ impl Selection { type Field = Range; -#[derive(Debug)] +#[derive(Serialize, Deserialize, Debug, Clone)] struct Line { line: String, // The common case is not to specify fields. Let's make this fast. selections: SmallVec<[Selection; 1]>, } +impl Sortable for Line { + fn encode(&self, write: &mut W) { + let line = Line { line: self.line.clone(), selections: self.selections.clone() } ; + let serialized = serde_json::to_string(&line).unwrap(); + write.write_all(serialized.as_bytes()).unwrap(); + } + + fn decode(read: &mut R) -> Option { + let mut buf = String::new(); + read.read_to_string(&mut buf).ok(); + let line: Option = buf; + println!("deserialized = {:?}", line); + line + } +} + impl Line { fn new(line: String, settings: &GlobalSettings) -> Self { let fields = if settings @@ -681,6 +710,20 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .value_name("NUM_THREADS"), ) + .arg( + Arg::with_name(OPT_BUF_SIZE) + .long(OPT_BUF_SIZE) + .help("sets the maximum SIZE of each segment in number of sorted items") + .takes_value(true) + .value_name("SIZE"), + ) + .arg( + Arg::with_name(OPT_TMP_DIR) + .long(OPT_TMP_DIR) + .help("use DIR for temporaries, not $TMPDIR or /tmp") + .takes_value(true) + .value_name("DIR"), + ) .arg( Arg::with_name(OPT_FILES0_FROM) .long(OPT_FILES0_FROM) @@ -744,6 +787,32 @@ pub fn uumain(args: impl uucore::Args) -> i32 { env::set_var("RAYON_NUM_THREADS", &settings.threads); } + if matches.is_present(OPT_BUF_SIZE) { + // 10000 is the default extsort buffer, but it's too small + settings.buffer_size = matches + .value_of(OPT_BUF_SIZE) + .map(String::from) + .unwrap_or( format! ( "{}", 10000000usize ) ) + .parse::() + .unwrap_or(10000000usize); + } + + if matches.is_present(OPT_TMP_DIR) { + let result = matches + .value_of(OPT_TMP_DIR) + .map(String::from) + .unwrap_or("/tmp".to_owned() ); + settings.tmp_dir = PathBuf::from(format!(r"{}", result)); + } else { + for (key, value) in env::vars_os() { + if key == OsString::from("TMPDIR") { + settings.tmp_dir = PathBuf::from(format!(r"{}", value.into_string().unwrap_or("/tmp".to_owned()))); + break + } + settings.tmp_dir = PathBuf::from(r"/tmp"); + } + } + settings.zero_terminated = matches.is_present(OPT_ZERO_TERMINATED); settings.merge = matches.is_present(OPT_MERGE); @@ -860,9 +929,9 @@ fn exec(files: Vec, settings: &GlobalSettings) -> i32 { if settings.check { return exec_check_file(&lines, &settings); - } else { - sort_by(&mut lines, &settings); } + + lines = sort_by(lines, &settings); if settings.merge { if settings.unique { @@ -917,8 +986,9 @@ fn exec_check_file(unwrapped_lines: &[Line], settings: &GlobalSettings) -> i32 { } } -fn sort_by(lines: &mut Vec, settings: &GlobalSettings) { - lines.par_sort_by(|a, b| compare_by(a, b, &settings)) +fn sort_by(lines: Vec, settings: &GlobalSettings) -> Vec { + let sorter = ExternalSorter::new().with_segment_size(settings.buffer_size).with_sort_dir(settings.tmp_dir.clone()).with_parallel_sort(); + sorter.sort_by(lines.into_iter(), |a, b| compare_by(a, b, &settings)).unwrap().collect() } fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering { @@ -1004,7 +1074,6 @@ fn leading_num_common(a: &str) -> &str { // not recognize a positive sign or scientific/E notation so we strip those elements here. fn get_leading_num(a: &str) -> &str { let mut s = ""; - let a = leading_num_common(a); // GNU numeric sort doesn't recognize '+' or 'e' notation so we strip @@ -1019,9 +1088,7 @@ fn get_leading_num(a: &str) -> &str { // And empty number or non-number lines are to be treated as ‘0’ but only for numeric sort // All '0'-ed lines will be sorted later, but only amongst themselves, during the so-called 'last resort comparison.' - if s.is_empty() { - s = "0"; - }; + if s.is_empty() { s = "0"; }; s } @@ -1087,8 +1154,8 @@ fn permissive_f64_parse(a: &str) -> f64 { // Remove any trailing decimals, ie 4568..890... becomes 4568.890 // Then, we trim whitespace and parse match remove_trailing_dec(a).trim().parse::() { - Ok(a) if a.is_nan() => std::f64::NEG_INFINITY, - Ok(a) => a, + Ok(val) if val.is_nan() => std::f64::NEG_INFINITY, + Ok(val) => val, Err(_) => std::f64::NEG_INFINITY, } } @@ -1107,7 +1174,6 @@ fn numeric_compare(a: &str, b: &str) -> Ordering { let fa = permissive_f64_parse(&ta); let fb = permissive_f64_parse(&tb); - // f64::cmp isn't implemented (due to NaN issues); implement directly instead if fa > fb { Ordering::Greater } else if fa < fb { @@ -1150,6 +1216,7 @@ fn human_numeric_convert(a: &str) -> f64 { let num_part = permissive_f64_parse(&num_str); let suffix: f64 = match suffix.parse().unwrap_or('\0') { // SI Units + 'b' => 1f64, 'K' => 1E3, 'M' => 1E6, 'G' => 1E9, @@ -1262,6 +1329,7 @@ fn month_compare(a: &str, b: &str) -> Ordering { } } +#[inline(always)] fn version_parse(a: &str) -> Version { let result = Version::parse(a); From fbb2125812657c5eb9b8b1395314033c8bb72b0d Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci Date: Mon, 12 Apr 2021 22:50:29 +0300 Subject: [PATCH 0332/1135] doc: update CONTRIBUTING.md --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3c40e5dfd..d52f2a8af 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,6 +22,7 @@ search the issues to make sure no one else is working on it. 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. Unsafe code should be documented with Safety comments ## Commit messages From 3aee0dfa88973beb23f4d6ded0c59aab1571303b Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci Date: Mon, 12 Apr 2021 22:52:17 +0300 Subject: [PATCH 0333/1135] add dot --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d52f2a8af..bcb1f8fff 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,7 +22,7 @@ search the issues to make sure no one else is working on it. 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. Unsafe code should be documented with Safety comments +1. Unsafe code should be documented with Safety comments. ## Commit messages From c49f93c9af2582c276b85c8e78841797fe7e938d Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Mon, 12 Apr 2021 18:05:37 -0500 Subject: [PATCH 0334/1135] Psuedo working extsort --- src/uu/sort/Cargo.toml | 2 +- src/uu/sort/src/sort.rs | 27 +++++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 8ad0a681f..8a3d1ed25 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -17,7 +17,7 @@ path = "src/sort.rs" [dependencies] byteorder = "1.4.3" extsort = "0.4.2" -serde_json = { version = "1.0", default-features = false, features = ["alloc"] } +serde_json = { version = "1.0.64", default-features = false, features = ["alloc"] } serde = { version = "1.0", features = ["derive"] } rayon = "1.5" rand = "0.7" diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index cb07f60b7..986db59f8 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -40,7 +40,6 @@ use std::ffi::OsString; use std::usize; use std::path::PathBuf; use std::string::*; -use serde_json::Result; static NAME: &str = "sort"; static ABOUT: &str = "Display sorted concatenation of all FILE(s)."; @@ -195,7 +194,7 @@ impl Selection { type Field = Range; -#[derive(Serialize, Deserialize, Debug, Clone)] +#[derive(Debug, Serialize, Deserialize, Clone)] struct Line { line: String, // The common case is not to specify fields. Let's make this fast. @@ -203,18 +202,22 @@ struct Line { } impl Sortable for Line { + fn encode(&self, write: &mut W) { - let line = Line { line: self.line.clone(), selections: self.selections.clone() } ; - let serialized = serde_json::to_string(&line).unwrap(); - write.write_all(serialized.as_bytes()).unwrap(); + let line = Line {line: self.line.clone(), selections: self.selections.clone()}; + let serialized = serde_json::ser::to_string(&line).unwrap(); + write.write_all(format!("{}{}", serialized, "\n").as_bytes()).unwrap(); } fn decode(read: &mut R) -> Option { - let mut buf = String::new(); - read.read_to_string(&mut buf).ok(); - let line: Option = buf; - println!("deserialized = {:?}", line); - line + let buf_reader = BufReader::new(read); + + let mut result: Option = None; + for line in buf_reader.lines() { + let line_as_str: Line = serde_json::de::from_str(&line.unwrap()).unwrap(); + result = Some( Line {line: line_as_str.line, selections: line_as_str.selections} ); + } + result } } @@ -235,7 +238,7 @@ impl Line { .selectors .iter() .map(|selector| { - if let Some(range) = selector.get_selection(&line, fields.as_deref()) { + if let Some(range) = selector.get_field_selection(&line, fields.as_deref()) { if let Some(transformed) = transform(&line[range.to_owned()], &selector.settings) { @@ -411,7 +414,7 @@ impl FieldSelector { /// Look up the slice that corresponds to this selector for the given line. /// If needs_fields returned false, fields may be None. - fn get_selection<'a>( + fn get_field_selection<'a>( &self, line: &'a str, tokens: Option<&[Field]>, From 5c28ac1b0de516d20da19971f199e9e43198842b Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 14 Apr 2021 14:12:00 +0200 Subject: [PATCH 0335/1135] ls: dereference command line --- src/uu/ls/src/ls.rs | 151 ++++++++++++++++++++++++++++--------- tests/by-util/test_ls.rs | 156 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 273 insertions(+), 34 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index fdc11144a..d0733357b 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -120,6 +120,11 @@ pub mod options { pub static FILE_TYPE: &str = "file-type"; pub static CLASSIFY: &str = "classify"; } + pub mod dereference { + pub static ALL: &str = "dereference"; + pub static ARGS: &str = "dereference-command-line"; + pub static DIR_ARGS: &str = "dereference-command-line-symlink-to-dir"; + } pub static HIDE_CONTROL_CHARS: &str = "hide-control-chars"; pub static SHOW_CONTROL_CHARS: &str = "show-control-chars"; pub static WIDTH: &str = "width"; @@ -134,7 +139,6 @@ pub mod options { pub static FILE_TYPE: &str = "file-type"; pub static SLASH: &str = "p"; pub static INODE: &str = "inode"; - pub static DEREFERENCE: &str = "dereference"; pub static REVERSE: &str = "reverse"; pub static RECURSIVE: &str = "recursive"; pub static COLOR: &str = "color"; @@ -180,6 +184,13 @@ enum Time { Change, } +enum Dereference { + None, + DirArgs, + Args, + All, +} + #[derive(PartialEq, Eq)] enum IndicatorStyle { None, @@ -194,7 +205,7 @@ struct Config { sort: Sort, recursive: bool, reverse: bool, - dereference: bool, + dereference: Dereference, ignore_patterns: GlobSet, size_format: SizeFormat, directory: bool, @@ -482,13 +493,27 @@ impl Config { let ignore_patterns = ignore_patterns.build().unwrap(); + let dereference = if options.is_present(options::dereference::ALL) { + Dereference::All + } else if options.is_present(options::dereference::ARGS) { + Dereference::Args + } else if options.is_present(options::dereference::DIR_ARGS) { + Dereference::DirArgs + } else if options.is_present(options::DIRECTORY) + || indicator_style == IndicatorStyle::Classify + { + Dereference::None + } else { + Dereference::DirArgs + }; + Config { format, files, sort, recursive: options.is_present(options::RECURSIVE), reverse: options.is_present(options::REVERSE), - dereference: options.is_present(options::DEREFERENCE), + dereference, ignore_patterns, size_format, directory: options.is_present(options::DIRECTORY), @@ -819,6 +844,48 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ]) ) + // Dereferencing + .arg( + Arg::with_name(options::dereference::ALL) + .short("L") + .long(options::dereference::ALL) + .help( + "When showing file information for a symbolic link, show information for the \ + file the link references rather than the link itself.", + ) + .overrides_with_all(&[ + options::dereference::ALL, + options::dereference::DIR_ARGS, + options::dereference::ARGS, + ]) + ) + .arg( + Arg::with_name(options::dereference::DIR_ARGS) + .long(options::dereference::DIR_ARGS) + .help( + "Do not dereference symlinks except when they link to directories and are \ + given as command line arguments.", + ) + .overrides_with_all(&[ + options::dereference::ALL, + options::dereference::DIR_ARGS, + options::dereference::ARGS, + ]) + ) + .arg( + Arg::with_name(options::dereference::ARGS) + .short("H") + .long(options::dereference::ARGS) + .help( + "Do not dereference symlinks except when given as command line arguments.", + ) + .overrides_with_all(&[ + options::dereference::ALL, + options::dereference::DIR_ARGS, + options::dereference::ARGS, + ]) + ) + // Long format options .arg( Arg::with_name(options::NO_GROUP) @@ -877,15 +944,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::INODE) .help("print the index number of each file"), ) - .arg( - Arg::with_name(options::DEREFERENCE) - .short("L") - .long(options::DEREFERENCE) - .help( - "When showing file information for a symbolic link, show information for the \ - file the link references rather than the link itself.", - ), - ) .arg( Arg::with_name(options::REVERSE) .short("r") @@ -993,26 +1051,32 @@ fn list(locs: Vec, config: Config) -> i32 { has_failed = true; continue; } - let mut dir = false; - if p.is_dir() && !config.directory { - dir = true; - if config.format == Format::Long && !config.dereference { - if let Ok(md) = p.symlink_metadata() { - if md.file_type().is_symlink() && !p.ends_with("/") { - dir = false; + let show_dir_contents = if !config.directory { + match config.dereference { + Dereference::None => { + if let Ok(md) = p.symlink_metadata() { + md.is_dir() + } else { + show_error!("'{}': {}", &loc, "No such file or directory"); + has_failed = true; + continue; } } + _ => p.is_dir(), } - } - if dir { + } else { + false + }; + + if show_dir_contents { dirs.push(p); } else { files.push(p); } } sort_entries(&mut files, &config); - display_items(&files, None, &config); + display_items(&files, None, &config, true); sort_entries(&mut dirs, &config); for dir in dirs { @@ -1032,14 +1096,15 @@ fn sort_entries(entries: &mut Vec, config: &Config) { match config.sort { Sort::Time => entries.sort_by_key(|k| { Reverse( - get_metadata(k, config) + get_metadata(k, false) .ok() .and_then(|md| get_system_time(&md, config)) .unwrap_or(UNIX_EPOCH), ) }), - Sort::Size => entries - .sort_by_key(|k| Reverse(get_metadata(k, config).map(|md| md.len()).unwrap_or(0))), + Sort::Size => { + entries.sort_by_key(|k| Reverse(get_metadata(k, false).map(|md| md.len()).unwrap_or(0))) + } // The default sort in GNU ls is case insensitive Sort::Name => entries.sort_by_key(|k| k.to_string_lossy().to_lowercase()), Sort::Version => entries.sort_by(version_cmp::version_cmp), @@ -1088,9 +1153,9 @@ fn enter_directory(dir: &PathBuf, config: &Config) { let mut display_entries = entries.clone(); display_entries.insert(0, dir.join("..")); display_entries.insert(0, dir.join(".")); - display_items(&display_entries, Some(dir), config); + display_items(&display_entries, Some(dir), config, false); } else { - display_items(&entries, Some(dir), config); + display_items(&entries, Some(dir), config, false); } if config.recursive { @@ -1101,8 +1166,8 @@ fn enter_directory(dir: &PathBuf, config: &Config) { } } -fn get_metadata(entry: &PathBuf, config: &Config) -> std::io::Result { - if config.dereference { +fn get_metadata(entry: &PathBuf, dereference: bool) -> std::io::Result { + if dereference { entry.metadata().or_else(|_| entry.symlink_metadata()) } else { entry.symlink_metadata() @@ -1110,7 +1175,7 @@ fn get_metadata(entry: &PathBuf, config: &Config) -> std::io::Result { } fn display_dir_entry_size(entry: &PathBuf, config: &Config) -> (usize, usize) { - if let Ok(md) = get_metadata(entry, config) { + if let Ok(md) = get_metadata(entry, false) { ( display_symlink_count(&md).len(), display_file_size(&md, config).len(), @@ -1124,7 +1189,7 @@ fn pad_left(string: String, count: usize) -> String { format!("{:>width$}", string, width = count) } -fn display_items(items: &[PathBuf], strip: Option<&Path>, config: &Config) { +fn display_items(items: &[PathBuf], strip: Option<&Path>, config: &Config, command_line: bool) { if config.format == Format::Long { let (mut max_links, mut max_size) = (1, 1); for item in items { @@ -1133,11 +1198,11 @@ fn display_items(items: &[PathBuf], strip: Option<&Path>, config: &Config) { max_size = size.max(max_size); } for item in items { - display_item_long(item, strip, max_links, max_size, config); + display_item_long(item, strip, max_links, max_size, config, command_line); } } else { let names = items.iter().filter_map(|i| { - let md = get_metadata(i, config); + let md = get_metadata(i, false); match md { Err(e) => { let filename = get_file_name(i, strip); @@ -1209,8 +1274,26 @@ fn display_item_long( max_links: usize, max_size: usize, config: &Config, + command_line: bool, ) { - let md = match get_metadata(item, config) { + let dereference = match &config.dereference { + Dereference::All => true, + Dereference::Args => command_line, + Dereference::DirArgs => { + if command_line { + if let Ok(md) = item.metadata() { + md.is_dir() + } else { + false + } + } else { + false + } + } + Dereference::None => false, + }; + + let md = match get_metadata(item, dereference) { Err(e) => { let filename = get_file_name(&item, strip); show_error!("{}: {}", filename, e); diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index f0db7ca9c..ef6c23b73 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1314,3 +1314,159 @@ fn test_ls_ignore_hide() { .stderr_contains(&"Invalid pattern") .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); } + +#[test] +fn test_ls_directory() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.mkdir("some_dir"); + at.symlink_dir("some_dir", "sym_dir"); + + at.touch("some_dir/nested_file"); + + scene + .ucmd() + .arg("some_dir") + .succeeds() + .stdout_is("nested_file\n"); + + scene + .ucmd() + .arg("--directory") + .arg("some_dir") + .succeeds() + .stdout_is("some_dir\n"); + + scene + .ucmd() + .arg("sym_dir") + .succeeds() + .stdout_is("nested_file\n"); +} + +#[test] +fn test_ls_deref_command_line() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.touch("some_file"); + at.symlink_file("some_file", "sym_file"); + + scene + .ucmd() + .arg("-l") + .arg("sym_file") + .succeeds() + .stdout_contains("sym_file ->"); + + scene + .ucmd() + .arg("-l") + .arg("--dereference-command-line-symlink-to-dir") + .arg("sym_file") + .succeeds() + .stdout_contains("sym_file ->"); + + let result = scene + .ucmd() + .arg("-l") + .arg("--dereference-command-line") + .arg("sym_file") + .succeeds(); + + assert!(!result.stdout_str().contains("->")); + + let result = scene.ucmd().arg("-lH").arg("sym_file").succeeds(); + + assert!(!result.stdout_str().contains("sym_file ->")); + + // If the symlink is not a command line argument, it must be shown normally + scene + .ucmd() + .arg("-l") + .arg("--dereference-command-line") + .succeeds() + .stdout_contains("sym_file ->"); +} + +#[test] +fn test_ls_deref_command_line_dir() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.mkdir("some_dir"); + at.symlink_dir("some_dir", "sym_dir"); + + at.touch("some_dir/nested_file"); + + scene + .ucmd() + .arg("-l") + .arg("sym_dir") + .succeeds() + .stdout_contains("nested_file"); + + scene + .ucmd() + .arg("-l") + .arg("--dereference-command-line-symlink-to-dir") + .arg("sym_dir") + .succeeds() + .stdout_contains("nested_file"); + + scene + .ucmd() + .arg("-l") + .arg("--dereference-command-line") + .arg("sym_dir") + .succeeds() + .stdout_contains("nested_file"); + + scene + .ucmd() + .arg("-lH") + .arg("sym_dir") + .succeeds() + .stdout_contains("nested_file"); + + // If the symlink is not a command line argument, it must be shown normally + scene + .ucmd() + .arg("-l") + .arg("--dereference-command-line") + .succeeds() + .stdout_contains("sym_dir ->"); + + scene + .ucmd() + .arg("-lH") + .succeeds() + .stdout_contains("sym_dir ->"); + + scene + .ucmd() + .arg("-l") + .arg("--dereference-command-line-symlink-to-dir") + .succeeds() + .stdout_contains("sym_dir ->"); + + // --directory does not dereference anything by default + scene + .ucmd() + .arg("-l") + .arg("--directory") + .arg("sym_dir") + .succeeds() + .stdout_contains("sym_dir ->"); + + let result = scene + .ucmd() + .arg("-l") + .arg("--directory") + .arg("--dereference-command-line-symlink-to-dir") + .arg("sym_dir") + .succeeds(); + + assert!(!result.stdout_str().ends_with("sym_dir")); +} From 2c130ae7c0194ad652d70c1d1bfe34a23f169545 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 14 Apr 2021 14:42:14 +0200 Subject: [PATCH 0336/1135] ls: take `-l` into account with dereference-command-line --- src/uu/ls/src/ls.rs | 1 + tests/by-util/test_ls.rs | 60 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index d0733357b..f22c83c48 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -501,6 +501,7 @@ impl Config { Dereference::DirArgs } else if options.is_present(options::DIRECTORY) || indicator_style == IndicatorStyle::Classify + || format == Format::Long { Dereference::None } else { diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index ef6c23b73..bdf4440e0 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1353,6 +1353,13 @@ fn test_ls_deref_command_line() { at.touch("some_file"); at.symlink_file("some_file", "sym_file"); + scene + .ucmd() + .arg("sym_file") + .succeeds() + .stdout_is("sym_file\n"); + + // -l changes the default to no dereferencing scene .ucmd() .arg("-l") @@ -1360,6 +1367,13 @@ fn test_ls_deref_command_line() { .succeeds() .stdout_contains("sym_file ->"); + scene + .ucmd() + .arg("--dereference-command-line-symlink-to-dir") + .arg("sym_file") + .succeeds() + .stdout_is("sym_file\n"); + scene .ucmd() .arg("-l") @@ -1368,6 +1382,13 @@ fn test_ls_deref_command_line() { .succeeds() .stdout_contains("sym_file ->"); + scene + .ucmd() + .arg("--dereference-command-line") + .arg("sym_file") + .succeeds() + .stdout_is("sym_file\n"); + let result = scene .ucmd() .arg("-l") @@ -1400,11 +1421,24 @@ fn test_ls_deref_command_line_dir() { at.touch("some_dir/nested_file"); + scene + .ucmd() + .arg("sym_dir") + .succeeds() + .stdout_contains("nested_file"); + scene .ucmd() .arg("-l") .arg("sym_dir") .succeeds() + .stdout_contains("sym_dir ->"); + + scene + .ucmd() + .arg("--dereference-command-line-symlink-to-dir") + .arg("sym_dir") + .succeeds() .stdout_contains("nested_file"); scene @@ -1415,6 +1449,13 @@ fn test_ls_deref_command_line_dir() { .succeeds() .stdout_contains("nested_file"); + scene + .ucmd() + .arg("--dereference-command-line") + .arg("sym_dir") + .succeeds() + .stdout_contains("nested_file"); + scene .ucmd() .arg("-l") @@ -1469,4 +1510,23 @@ fn test_ls_deref_command_line_dir() { .succeeds(); assert!(!result.stdout_str().ends_with("sym_dir")); + + // --classify does not dereference anything by default + scene + .ucmd() + .arg("-l") + .arg("--directory") + .arg("sym_dir") + .succeeds() + .stdout_contains("sym_dir ->"); + + let result = scene + .ucmd() + .arg("-l") + .arg("--directory") + .arg("--dereference-command-line-symlink-to-dir") + .arg("sym_dir") + .succeeds(); + + assert!(!result.stdout_str().ends_with("sym_dir")); } From c81cf9b6266e7dc8dccaec318c9a9a47290f8717 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sat, 10 Apr 2021 23:03:07 +0200 Subject: [PATCH 0337/1135] chown: refactor tests --- tests/by-util/test_chown.rs | 503 ++++++++++++++++++++++-------------- 1 file changed, 308 insertions(+), 195 deletions(-) diff --git a/tests/by-util/test_chown.rs b/tests/by-util/test_chown.rs index 7b663e9c9..4ec9d60f8 100644 --- a/tests/by-util/test_chown.rs +++ b/tests/by-util/test_chown.rs @@ -4,6 +4,28 @@ use rust_users::get_effective_uid; extern crate chown; +// Apparently some CI environments have configuration issues, e.g. with 'whoami' and 'id'. +// If we are running inside the CI and "needle" is in "stderr" skipping this test is +// considered okay. If we are not inside the CI this calls assert!(result.success). +// +// From the Logs: "Build (ubuntu-18.04, x86_64-unknown-linux-gnu, feat_os_unix, use-cross)" +// stderr: "whoami: cannot find name for user ID 1001" +// Maybe: "adduser --uid 1001 username" can put things right? +// stderr: "id: cannot find name for group ID 116" +fn skipping_test_is_okay(result: &CmdResult, needle: &str) -> bool { + if !result.succeeded() { + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + if is_ci() && result.stderr_str().contains(needle) { + println!("test skipped:"); + return true; + } else { + result.success(); + } + } + false +} + #[cfg(test)] mod test_passgrp { use super::chown::entries::{gid2grp, grp2gid, uid2usr, usr2uid}; @@ -49,338 +71,403 @@ fn test_invalid_option() { } #[test] -fn test_chown_myself() { +fn test_chown_only_owner() { // test chown username file.txt + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let result = scene.cmd("whoami").run(); - if is_ci() && result.stderr.contains("No such user/group") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + if skipping_test_is_okay(&result, "whoami: cannot find name for user ID") { return; } - println!("results {}", result.stdout); - let username = result.stdout.trim_end(); - - let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_dir_file_a1"; + let user_name = String::from(result.stdout_str().trim()); + assert!(!user_name.is_empty()); + let file1 = "test_chown_file1"; at.touch(file1); - let result = ucmd.arg(username).arg(file1).run(); - println!("results stdout {}", result.stdout); - println!("results stderr {}", result.stderr); - if is_ci() && result.stderr.contains("invalid user") { - // In the CI, some server are failing to return id. - // As seems to be a configuration issue, ignoring it - return; - } - assert!(result.success); + + // since only superuser can change owner, we have to change from ourself to ourself + let result = scene + .ucmd() + .arg(user_name) + .arg("--verbose") + .arg(file1) + .run(); + result.stderr_contains(&"retained as"); + + // try to change to another existing user, e.g. 'root' + scene + .ucmd() + .arg("root") + .arg("--verbose") + .arg(file1) + .fails() + .stderr_contains(&"failed to change"); } #[test] -fn test_chown_myself_second() { +fn test_chown_only_owner_colon() { // test chown username: file.txt + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let result = scene.cmd("whoami").run(); - if is_ci() && result.stderr.contains("No such user/group") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + if skipping_test_is_okay(&result, "whoami: cannot find name for user ID") { return; } - println!("results {}", result.stdout); - - let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_dir_file_a1"; + let user_name = String::from(result.stdout_str().trim()); + assert!(!user_name.is_empty()); + let file1 = "test_chown_file1"; at.touch(file1); - let result = ucmd - .arg(result.stdout.trim_end().to_owned() + ":") + + scene + .ucmd() + .arg(format!("{}:", user_name)) + .arg("--verbose") .arg(file1) .run(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - assert!(result.success); + // scene // TODO: uncomment once #2060 is fixed + // .ucmd() + // .arg("root:") + // .arg("--verbose") + // .arg(file1) + // .fails() + // .stderr_contains(&"failed to change"); } #[test] -fn test_chown_myself_group() { +fn test_chown_only_colon() { + // test chown : file.txt + + // TODO: implement once #2060 is fixed + // expected: + // $ chown -v : file.txt 2>out_err ; echo $? ; cat out_err + // ownership of 'file.txt' retained + // 0 +} + +#[test] +fn test_chown_failed_stdout() { + // test chown root file.txt + + // TODO: implement once output "failed to change" to stdout is fixed + // expected: + // $ chown -v root file.txt 2>out_err ; echo $? ; cat out_err + // failed to change ownership of 'file.txt' from jhs to root + // 1 + // chown: changing ownership of 'file.txt': Operation not permitted +} + +#[test] +fn test_chown_owner_group() { // test chown username:group file.txt + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let result = scene.cmd("whoami").run(); - if is_ci() && result.stderr.contains("No such user/group") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + if skipping_test_is_okay(&result, "whoami: cannot find name for user ID") { return; } - println!("user name = {}", result.stdout); - let username = result.stdout.trim_end(); + + let user_name = String::from(result.stdout_str().trim()); + assert!(!user_name.is_empty()); + + let file1 = "test_chown_file1"; + at.touch(file1); let result = scene.cmd("id").arg("-gn").run(); - if is_ci() && result.stderr.contains("No such user/group") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + if skipping_test_is_okay(&result, "id: cannot find name for group ID") { return; } - println!("group name = {}", result.stdout); - let group = result.stdout.trim_end(); + let group_name = String::from(result.stdout_str().trim()); + assert!(!group_name.is_empty()); - let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_dir_file_a1"; - let perm = username.to_owned() + ":" + group; - at.touch(file1); - let result = ucmd.arg(perm).arg(file1).run(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - if is_ci() && result.stderr.contains("chown: invalid group:") { - // With some Ubuntu into the CI, we can get this answer + let result = scene + .ucmd() + .arg(format!("{}:{}", user_name, group_name)) + .arg("--verbose") + .arg(file1) + .run(); + if skipping_test_is_okay(&result, "chown: invalid group:") { return; } - assert!(result.success); + result.stderr_contains(&"retained as"); + + // TODO: on macos group name is not recognized correctly: "chown: invalid group: 'root:root' + #[cfg(any(windows, all(unix, not(target_os = "macos"))))] + scene + .ucmd() + .arg("root:root") + .arg("--verbose") + .arg(file1) + .fails() + .stderr_contains(&"failed to change"); } #[test] +// TODO: on macos group name is not recognized correctly: "chown: invalid group: ':groupname' +#[cfg(any(windows, all(unix, not(target_os = "macos"))))] fn test_chown_only_group() { // test chown :group file.txt + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let result = scene.cmd("whoami").run(); - if is_ci() && result.stderr.contains("No such user/group") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + if skipping_test_is_okay(&result, "whoami: cannot find name for user ID") { return; } - println!("results {}", result.stdout); + let user_name = String::from(result.stdout_str().trim()); + assert!(!user_name.is_empty()); - let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_dir_file_a1"; - let perm = ":".to_owned() + result.stdout.trim_end(); + let file1 = "test_chown_file1"; at.touch(file1); - let result = ucmd.arg(perm).arg(file1).run(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - - if is_ci() && result.stderr.contains("Operation not permitted") { + let result = scene + .ucmd() + .arg(format!(":{}", user_name)) + .arg("--verbose") + .arg(file1) + .run(); + if is_ci() && result.stderr_str().contains("Operation not permitted") { // With ubuntu with old Rust in the CI, we can get an error return; } - if is_ci() && result.stderr.contains("chown: invalid group:") { + if is_ci() && result.stderr_str().contains("chown: invalid group:") { // With mac into the CI, we can get this answer return; } - assert!(result.success); + result.stderr_contains(&"retained as"); + result.success(); + + scene + .ucmd() + .arg(":root") + .arg("--verbose") + .arg(file1) + .fails() + .stderr_contains(&"failed to change"); } #[test] -fn test_chown_only_id() { +fn test_chown_only_user_id() { // test chown 1111 file.txt - let result = TestScenario::new("id").ucmd_keepenv().arg("-u").run(); - if is_ci() && result.stderr.contains("No such user/group") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let result = scene.cmd_keepenv("id").arg("-u").run(); + if skipping_test_is_okay(&result, "id: cannot find name for group ID") { return; } - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let id = String::from(result.stdout.trim()); - - let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_dir_file_a1"; + let user_id = String::from(result.stdout_str().trim()); + assert!(!user_id.is_empty()); + let file1 = "test_chown_file1"; at.touch(file1); - let result = ucmd.arg(id).arg(file1).run(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - if is_ci() && result.stderr.contains("chown: invalid user:") { - // With some Ubuntu into the CI, we can get this answer + let result = scene.ucmd().arg(user_id).arg("--verbose").arg(file1).run(); + if skipping_test_is_okay(&result, "invalid user") { + // From the Logs: "Build (ubuntu-18.04, x86_64-unknown-linux-gnu, feat_os_unix, use-cross)" + // stderr: "chown: invalid user: '1001' return; } - assert!(result.success); + result.stderr_contains(&"retained as"); + + scene + .ucmd() + .arg("0") + .arg("--verbose") + .arg(file1) + .fails() + .stderr_contains(&"failed to change"); } #[test] fn test_chown_only_group_id() { // test chown :1111 file.txt - let result = TestScenario::new("id").ucmd_keepenv().arg("-g").run(); - if is_ci() && result.stderr.contains("No such user/group") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let result = scene.cmd_keepenv("id").arg("-g").run(); + if skipping_test_is_okay(&result, "id: cannot find name for group ID") { return; } - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let id = String::from(result.stdout.trim()); - - let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_dir_file_a1"; + let group_id = String::from(result.stdout_str().trim()); + assert!(!group_id.is_empty()); + let file1 = "test_chown_file1"; at.touch(file1); - let perm = ":".to_owned() + &id; - let result = ucmd.arg(perm).arg(file1).run(); - - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - if is_ci() && result.stderr.contains("chown: invalid group:") { + let result = scene + .ucmd() + .arg(format!(":{}", group_id)) + .arg("--verbose") + .arg(file1) + .run(); + if skipping_test_is_okay(&result, "chown: invalid group:") { // With mac into the CI, we can get this answer return; } - assert!(result.success); + result.stderr_contains(&"retained as"); + + // Apparently on CI "macos-latest, x86_64-apple-darwin, feat_os_macos" + // the process has the rights to change from runner:staff to runner:wheel + #[cfg(any(windows, all(unix, not(target_os = "macos"))))] + scene + .ucmd() + .arg(":0") + .arg("--verbose") + .arg(file1) + .fails() + .stderr_contains(&"failed to change"); } #[test] -fn test_chown_both_id() { +fn test_chown_owner_group_id() { // test chown 1111:1111 file.txt - let result = TestScenario::new("id").ucmd_keepenv().arg("-u").run(); - if is_ci() && result.stderr.contains("No such user/group") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let result = scene.cmd_keepenv("id").arg("-u").run(); + if skipping_test_is_okay(&result, "id: cannot find name for group ID") { return; } - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let id_user = String::from(result.stdout.trim()); + let user_id = String::from(result.stdout_str().trim()); + assert!(!user_id.is_empty()); - let result = TestScenario::new("id").ucmd_keepenv().arg("-g").run(); - if is_ci() && result.stderr.contains("No such user/group") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + let result = scene.cmd_keepenv("id").arg("-g").run(); + if skipping_test_is_okay(&result, "id: cannot find name for group ID") { return; } - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let id_group = String::from(result.stdout.trim()); - - let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_dir_file_a1"; + let group_id = String::from(result.stdout_str().trim()); + assert!(!group_id.is_empty()); + let file1 = "test_chown_file1"; at.touch(file1); - let perm = id_user + &":".to_owned() + &id_group; - let result = ucmd.arg(perm).arg(file1).run(); - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - - if is_ci() && result.stderr.contains("invalid user") { - // In the CI, some server are failing to return id. - // As seems to be a configuration issue, ignoring it + let result = scene + .ucmd() + .arg(format!("{}:{}", user_id, group_id)) + .arg("--verbose") + .arg(file1) + .run(); + if skipping_test_is_okay(&result, "invalid user") { + // From the Logs: "Build (ubuntu-18.04, x86_64-unknown-linux-gnu, feat_os_unix, use-cross)" + // stderr: "chown: invalid user: '1001:116' return; } + result.stderr_contains(&"retained as"); - assert!(result.success); + scene + .ucmd() + .arg("0:0") + .arg("--verbose") + .arg(file1) + .fails() + .stderr_contains(&"failed to change"); } #[test] -fn test_chown_both_mix() { - // test chown 1111:1111 file.txt - let result = TestScenario::new("id").ucmd_keepenv().arg("-u").run(); - if is_ci() && result.stderr.contains("No such user/group") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it +fn test_chown_owner_group_mix() { + // test chown 1111:group file.txt + + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let result = scene.cmd_keepenv("id").arg("-u").run(); + if skipping_test_is_okay(&result, "id: cannot find name for group ID") { return; } - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let id_user = String::from(result.stdout.trim()); + let user_id = String::from(result.stdout_str().trim()); + assert!(!user_id.is_empty()); - let result = TestScenario::new("id").ucmd_keepenv().arg("-gn").run(); - if is_ci() && result.stderr.contains("No such user/group") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + let result = scene.cmd_keepenv("id").arg("-gn").run(); + if skipping_test_is_okay(&result, "id: cannot find name for group ID") { return; } - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let group_name = String::from(result.stdout.trim()); - - let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_dir_file_a1"; + let group_name = String::from(result.stdout_str().trim()); + assert!(!group_name.is_empty()); + let file1 = "test_chown_file1"; at.touch(file1); - let perm = id_user + &":".to_owned() + &group_name; - let result = ucmd.arg(perm).arg(file1).run(); + let result = scene + .ucmd() + .arg(format!("{}:{}", user_id, group_name)) + .arg("--verbose") + .arg(file1) + .run(); + result.stderr_contains(&"retained as"); - if is_ci() && result.stderr.contains("invalid user") { - // In the CI, some server are failing to return id. - // As seems to be a configuration issue, ignoring it - return; - } - assert!(result.success); + // TODO: on macos group name is not recognized correctly: "chown: invalid group: '0:root' + #[cfg(any(windows, all(unix, not(target_os = "macos"))))] + scene + .ucmd() + .arg("0:root") + .arg("--verbose") + .arg(file1) + .fails() + .stderr_contains(&"failed to change"); } #[test] fn test_chown_recursive() { let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let result = scene.cmd("whoami").run(); - if is_ci() && result.stderr.contains("No such user/group") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + if skipping_test_is_okay(&result, "whoami: cannot find name for user ID") { return; } - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let username = result.stdout.trim_end(); + let user_name = String::from(result.stdout_str().trim()); + assert!(!user_name.is_empty()); - let (at, mut ucmd) = at_and_ucmd!(); - at.mkdir("a"); - at.mkdir("a/b"); - at.mkdir("a/b/c"); + at.mkdir_all("a/b/c"); at.mkdir("z"); at.touch(&at.plus_as_string("a/a")); at.touch(&at.plus_as_string("a/b/b")); at.touch(&at.plus_as_string("a/b/c/c")); at.touch(&at.plus_as_string("z/y")); - let result = ucmd + let result = scene + .ucmd() .arg("-R") .arg("--verbose") - .arg(username) + .arg(user_name) .arg("a") .arg("z") .run(); - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - if is_ci() && result.stderr.contains("invalid user") { - // In the CI, some server are failing to return id. - // As seems to be a configuration issue, ignoring it - return; - } - - assert!(result.stderr.contains("ownership of 'a/a' retained as")); - assert!(result.stderr.contains("ownership of 'z/y' retained as")); - assert!(result.success); + result.stderr_contains(&"ownership of 'a/a' retained as"); + result.stderr_contains(&"ownership of 'z/y' retained as"); } #[test] fn test_root_preserve() { let scene = TestScenario::new(util_name!()); + let result = scene.cmd("whoami").run(); - if is_ci() && result.stderr.contains("No such user/group") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + if skipping_test_is_okay(&result, "whoami: cannot find name for user ID") { return; } - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - let username = result.stdout.trim_end(); + let user_name = String::from(result.stdout_str().trim()); + assert!(!user_name.is_empty()); - let result = new_ucmd!() + let result = scene + .ucmd() .arg("--preserve-root") .arg("-R") - .arg(username) + .arg(user_name) .arg("/") .fails(); - println!("result.stdout {}", result.stdout); - println!("result.stderr = {}", result.stderr); - if is_ci() && result.stderr.contains("invalid user") { - // In the CI, some server are failing to return id. - // As seems to be a configuration issue, ignoring it - return; - } - assert!(result - .stderr - .contains("chown: it is dangerous to operate recursively")); + result.stderr_contains(&"chown: it is dangerous to operate recursively"); } #[cfg(target_os = "linux")] @@ -397,3 +484,29 @@ fn test_big_p() { ); } } + +#[test] +fn test_chown_file_notexisting() { + // test chown username not_existing + + let scene = TestScenario::new(util_name!()); + + let result = scene.cmd("whoami").run(); + if skipping_test_is_okay(&result, "whoami: cannot find name for user ID") { + return; + } + let user_name = String::from(result.stdout_str().trim()); + assert!(!user_name.is_empty()); + + let _result = scene + .ucmd() + .arg(user_name) + .arg("--verbose") + .arg("not_existing") + .fails(); + + // TODO: uncomment once "failed to change ownership of '{}' to {}" added to stdout + // result.stderr_contains(&"retained as"); + // TODO: uncomment once message changed from "cannot dereference" to "cannot access" + // result.stderr_contains(&"cannot access 'not_existing': No such file or directory"); +} From 3aff898acd9722f325c761d9faf6675a077853a7 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 16 Apr 2021 18:58:46 +0200 Subject: [PATCH 0338/1135] Disable test_no_options_big_input on Windows --- tests/by-util/test_cat.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index 7b4c9924e..f83d51328 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -26,6 +26,7 @@ fn test_no_options() { } #[test] +#[cfg(unix)] fn test_no_options_big_input() { for &n in &[ 0, From 58a2821dce70ed0d60704cbabb2924080f39f5f6 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 16 Apr 2021 19:44:40 +0200 Subject: [PATCH 0339/1135] Also disable on test_three_directories_and_file_and_stdin --- tests/by-util/test_cat.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index f83d51328..eb6cc9148 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -109,6 +109,7 @@ fn test_directory_and_file() { } #[test] +#[cfg(unix)] fn test_three_directories_and_file_and_stdin() { let s = TestScenario::new(util_name!()); s.fixtures.mkdir("test_directory3"); From 685493f72bb07bcdd7c230f44d33952ac582e203 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 16 Apr 2021 18:27:36 +0200 Subject: [PATCH 0340/1135] ls: make path platform independent --- tests/by-util/test_ls.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index bdf4440e0..d810cdc29 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -5,6 +5,7 @@ use crate::common::util::*; extern crate regex; use self::regex::Regex; +use std::path::Path; use std::thread::sleep; use std::time::Duration; @@ -1323,7 +1324,7 @@ fn test_ls_directory() { at.mkdir("some_dir"); at.symlink_dir("some_dir", "sym_dir"); - at.touch("some_dir/nested_file"); + at.touch(Path::new("some_dir").join("nested_file").to_str().unwrap()); scene .ucmd() @@ -1419,7 +1420,7 @@ fn test_ls_deref_command_line_dir() { at.mkdir("some_dir"); at.symlink_dir("some_dir", "sym_dir"); - at.touch("some_dir/nested_file"); + at.touch(Path::new("some_dir").join("nested_file").to_str().unwrap()); scene .ucmd() From a76d452f75e1a503e1e1369143555d9153004edb Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sat, 17 Apr 2021 03:06:19 -0500 Subject: [PATCH 0341/1135] Sort: More small fixes (#2065) * Various fixes and performance improvements * fix a typo Co-authored-by: Michael Debertol * Fix month parse for months with leading whitespace * Implement test for months whitespace fix * Confirm human numeric works as expected with whitespace with a test * Correct arg help value name for --parallel * Fix SemVer non version lines/empty line sorting with a test Co-authored-by: Sylvestre Ledru Co-authored-by: Michael Debertol --- Cargo.lock | 2 -- src/uu/sort/src/sort.rs | 19 +++++++++++++++---- tests/by-util/test_sort.rs | 19 +++++++++++++++++++ .../sort/human-numeric-whitespace.expected | 11 +++++++++++ .../sort/human-numeric-whitespace.txt | 11 +++++++++++ .../fixtures/sort/months-whitespace.expected | 8 ++++++++ tests/fixtures/sort/months-whitespace.txt | 8 ++++++++ .../sort/version-empty-lines.expected | 11 +++++++++++ tests/fixtures/sort/version-empty-lines.txt | 11 +++++++++++ 9 files changed, 94 insertions(+), 6 deletions(-) create mode 100644 tests/fixtures/sort/human-numeric-whitespace.expected create mode 100644 tests/fixtures/sort/human-numeric-whitespace.txt create mode 100644 tests/fixtures/sort/months-whitespace.expected create mode 100644 tests/fixtures/sort/months-whitespace.txt create mode 100644 tests/fixtures/sort/version-empty-lines.expected create mode 100644 tests/fixtures/sort/version-empty-lines.txt diff --git a/Cargo.lock b/Cargo.lock index 430abf921..461716b1b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,7 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 - [[package]] name = "advapi32-sys" version = "0.2.0" diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 35ab71ba2..8bf6eb1e8 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -677,7 +677,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg( Arg::with_name(OPT_PARALLEL) .long(OPT_PARALLEL) - .help("change the number of threads running concurrently to N") + .help("change the number of threads running concurrently to NUM_THREADS") .takes_value(true) .value_name("NUM_THREADS"), ) @@ -1226,7 +1226,7 @@ fn month_parse(line: &str) -> Month { // GNU splits at any 3 letter match "JUNNNN" is JUN let pattern = if line.trim().len().ge(&3) { // Split a 3 and get first element of tuple ".0" - line.split_at(3).0 + line.trim().split_at(3).0 } else { "" }; @@ -1262,10 +1262,21 @@ fn month_compare(a: &str, b: &str) -> Ordering { } } +fn version_parse(a: &str) -> Version { + let result = Version::parse(a); + + match result { + Ok(vers_a) => vers_a, + // Non-version lines parse to 0.0.0 + Err(_e) => Version::parse("0.0.0").unwrap(), + } +} + fn version_compare(a: &str, b: &str) -> Ordering { #![allow(clippy::comparison_chain)] - let ver_a = Version::parse(a); - let ver_b = Version::parse(b); + let ver_a = version_parse(a); + let ver_b = version_parse(b); + // Version::cmp is not implemented; implement comparison directly if ver_a > ver_b { Ordering::Greater diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 866beefff..0f8020688 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -8,6 +8,25 @@ fn test_helper(file_name: &str, args: &str) { .stdout_is_fixture(format!("{}.expected", file_name)); } +#[test] +fn test_months_whitespace() { + test_helper("months-whitespace", "-M"); +} + +#[test] +fn test_version_empty_lines() { + new_ucmd!() + .arg("-V") + .arg("version-empty-lines.txt") + .succeeds() + .stdout_is("\n\n\n\n\n\n\n1.2.3-alpha\n1.2.3-alpha2\n\t\t\t1.12.4\n11.2.3\n"); +} + +#[test] +fn test_human_numeric_whitespace() { + test_helper("human-numeric-whitespace", "-h"); +} + #[test] fn test_multiple_decimals_general() { new_ucmd!() diff --git a/tests/fixtures/sort/human-numeric-whitespace.expected b/tests/fixtures/sort/human-numeric-whitespace.expected new file mode 100644 index 000000000..6fb9291ff --- /dev/null +++ b/tests/fixtures/sort/human-numeric-whitespace.expected @@ -0,0 +1,11 @@ + + + + + + + +456K +4568K + 456M + 6.2G diff --git a/tests/fixtures/sort/human-numeric-whitespace.txt b/tests/fixtures/sort/human-numeric-whitespace.txt new file mode 100644 index 000000000..19db648b1 --- /dev/null +++ b/tests/fixtures/sort/human-numeric-whitespace.txt @@ -0,0 +1,11 @@ + + +456K + + 456M + + +4568K + + 6.2G + diff --git a/tests/fixtures/sort/months-whitespace.expected b/tests/fixtures/sort/months-whitespace.expected new file mode 100644 index 000000000..84a44d564 --- /dev/null +++ b/tests/fixtures/sort/months-whitespace.expected @@ -0,0 +1,8 @@ + + +JAN + FEb + apr + apr + JUNNNN +AUG diff --git a/tests/fixtures/sort/months-whitespace.txt b/tests/fixtures/sort/months-whitespace.txt new file mode 100644 index 000000000..45c477477 --- /dev/null +++ b/tests/fixtures/sort/months-whitespace.txt @@ -0,0 +1,8 @@ +JAN + JUNNNN +AUG + + apr + apr + + FEb diff --git a/tests/fixtures/sort/version-empty-lines.expected b/tests/fixtures/sort/version-empty-lines.expected new file mode 100644 index 000000000..c496c0ff5 --- /dev/null +++ b/tests/fixtures/sort/version-empty-lines.expected @@ -0,0 +1,11 @@ + + + + + + + +1.2.3-alpha +1.2.3-alpha2 +11.2.3 + 1.12.4 diff --git a/tests/fixtures/sort/version-empty-lines.txt b/tests/fixtures/sort/version-empty-lines.txt new file mode 100644 index 000000000..9b6b89788 --- /dev/null +++ b/tests/fixtures/sort/version-empty-lines.txt @@ -0,0 +1,11 @@ +11.2.3 + + + +1.2.3-alpha2 + + +1.2.3-alpha + + + 1.12.4 From f33320e58133c1e4182ddb1eac72ee0743e77ba0 Mon Sep 17 00:00:00 2001 From: joppich Date: Sat, 17 Apr 2021 10:07:45 +0200 Subject: [PATCH 0342/1135] do not pipe data into failure tests (#2072) Co-authored-by: joppich --- tests/by-util/test_stdbuf.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/by-util/test_stdbuf.rs b/tests/by-util/test_stdbuf.rs index 61fa36977..808b7382a 100644 --- a/tests/by-util/test_stdbuf.rs +++ b/tests/by-util/test_stdbuf.rs @@ -25,19 +25,15 @@ fn test_stdbuf_line_buffered_stdout() { #[cfg(not(target_os = "windows"))] #[test] fn test_stdbuf_no_buffer_option_fails() { - new_ucmd!() - .args(&["head"]) - .pipe_in("The quick brown fox jumps over the lazy dog.") - .fails() - .stderr_is( - "error: The following required arguments were not provided:\n \ + new_ucmd!().args(&["head"]).fails().stderr_is( + "error: The following required arguments were not provided:\n \ --error \n \ --input \n \ --output \n\n\ USAGE:\n \ stdbuf OPTION... COMMAND\n\n\ For more information try --help", - ); + ); } #[cfg(not(target_os = "windows"))] @@ -55,7 +51,6 @@ fn test_stdbuf_trailing_var_arg() { fn test_stdbuf_line_buffering_stdin_fails() { new_ucmd!() .args(&["-i", "L", "head"]) - .pipe_in("The quick brown fox jumps over the lazy dog.") .fails() .stderr_is("stdbuf: error: line buffering stdin is meaningless\nTry 'stdbuf --help' for more information."); } @@ -65,7 +60,6 @@ fn test_stdbuf_line_buffering_stdin_fails() { fn test_stdbuf_invalid_mode_fails() { new_ucmd!() .args(&["-i", "1024R", "head"]) - .pipe_in("The quick brown fox jumps over the lazy dog.") .fails() .stderr_is("stdbuf: error: invalid mode 1024R\nTry 'stdbuf --help' for more information."); } From fe207640e24b25ec3cade4384da8b156265418b2 Mon Sep 17 00:00:00 2001 From: Aleksandar Janicijevic Date: Sat, 17 Apr 2021 04:08:10 -0400 Subject: [PATCH 0343/1135] touch: dealing with DST in touch -m -t (#2073) --- src/uu/touch/src/touch.rs | 23 ++++++++++++++++++++++- tests/by-util/test_touch.rs | 19 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index f0c3c12d2..b158fdc0e 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -18,6 +18,7 @@ use filetime::*; use std::fs::{self, File}; use std::io::Error; use std::path::Path; +use std::process; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Update the access and modification times of each FILE to the current time."; @@ -261,7 +262,27 @@ fn parse_timestamp(s: &str) -> FileTime { }; match time::strptime(&ts, format) { - Ok(tm) => local_tm_to_filetime(to_local(tm)), + Ok(tm) => { + let mut local = to_local(tm); + local.tm_isdst = -1; + let ft = local_tm_to_filetime(local); + + // We have to check that ft is valid time. Due to daylight saving + // time switch, local time can jump from 1:59 AM to 3:00 AM, + // in which case any time between 2:00 AM and 2:59 AM is not valid. + // Convert back to local time and see if we got the same value back. + let ts = time::Timespec { + sec: ft.unix_seconds(), + nsec: 0, + }; + let tm2 = time::at(ts); + if tm.tm_hour != tm2.tm_hour { + show_error!("invalid date format {}", s); + process::exit(1); + } + + ft + } Err(e) => panic!("Unable to parse timestamp\n{}", e), } } diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index 9921c16b5..9f2c079b0 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -29,6 +29,7 @@ fn set_file_times(at: &AtPath, path: &str, atime: FileTime, mtime: FileTime) { fn str_to_filetime(format: &str, s: &str) -> FileTime { let mut tm = time::strptime(s, format).unwrap(); tm.tm_utcoff = time::now().tm_utcoff; + tm.tm_isdst = -1; // Unknown flag DST let ts = tm.to_timespec(); FileTime::from_unix_time(ts.sec as i64, ts.nsec as u32) } @@ -352,3 +353,21 @@ fn test_touch_set_date() { assert_eq!(atime, start_of_year); assert_eq!(mtime, start_of_year); } + +#[test] +fn test_touch_mtime_dst_succeeds() { + let (at, mut ucmd) = at_and_ucmd!(); + let file = "test_touch_set_mtime_dst_succeeds"; + + ucmd.args(&["-m", "-t", "202103140300", file]) + .succeeds() + .no_stderr(); + + assert!(at.file_exists(file)); + + let target_time = str_to_filetime("%Y%m%d%H%M", "202103140300"); + let (_, mtime) = get_file_times(&at, file); + eprintln!("target_time: {:?}", target_time); + eprintln!("mtime: {:?}", mtime); + assert!(target_time == mtime); +} From d0c7e8c09e6101a10975640762006d6228ca0ed0 Mon Sep 17 00:00:00 2001 From: Andrew Rowson Date: Sat, 17 Apr 2021 09:26:52 +0100 Subject: [PATCH 0344/1135] du error output should match GNU (#1776) * du error output should match GNU * Created a new error macro which allows the customization of the "error:" string part * Match the du output based on the type of error encountered. Can extend to handling other errors I guess. * Rustfmt updates * Added non-windows test for du no permission output --- src/uu/du/src/du.rs | 18 ++++++++++++++++-- src/uucore/src/lib/macros.rs | 8 ++++++++ tests/by-util/test_du.rs | 30 ++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 07635881a..e01af5195 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -15,7 +15,7 @@ use chrono::Local; use std::collections::HashSet; use std::env; use std::fs; -use std::io::{stderr, Result, Write}; +use std::io::{stderr, ErrorKind, Result, Write}; use std::iter; #[cfg(not(windows))] use std::os::unix::fs::MetadataExt; @@ -296,7 +296,21 @@ fn du( } } } - Err(error) => show_error!("{}", error), + Err(error) => match error.kind() { + ErrorKind::PermissionDenied => { + let description = format!( + "cannot access '{}'", + entry + .path() + .as_os_str() + .to_str() + .unwrap_or("") + ); + let error_message = "Permission denied"; + show_error_custom_description!(description, "{}", error_message) + } + _ => show_error!("{}", error), + }, }, Err(error) => show_error!("{}", error), } diff --git a/src/uucore/src/lib/macros.rs b/src/uucore/src/lib/macros.rs index 24b392ebd..637e91f8f 100644 --- a/src/uucore/src/lib/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -31,6 +31,14 @@ macro_rules! show_error( ); /// Show a warning to stderr in a silimar style to GNU coreutils. +#[macro_export] +macro_rules! show_error_custom_description ( + ($err:expr,$($args:tt)+) => ({ + eprint!("{}: {}: ", executable!(), $err); + eprintln!($($args)+); + }) +); + #[macro_export] macro_rules! show_warning( ($($args:tt)+) => ({ diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index 8f2cff65d..f668edeef 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -190,3 +190,33 @@ fn test_du_time() { assert_eq!(result.stderr, ""); assert_eq!(result.stdout, "0\t2015-05-15 00:00\tdate_test\n"); } + +#[cfg(not(target_os = "windows"))] +#[cfg(feature = "chmod")] +#[test] +fn test_du_no_permission() { + let ts = TestScenario::new("du"); + + let chmod = ts.ccmd("chmod").arg("-r").arg(SUB_DIR_LINKS).run(); + println!("chmod output: {:?}", chmod); + assert!(chmod.success); + let result = ts.ucmd().arg(SUB_DIR_LINKS).run(); + + ts.ccmd("chmod").arg("+r").arg(SUB_DIR_LINKS).run(); + + assert!(result.success); + assert_eq!( + result.stderr, + "du: cannot read directory ‘subdir/links‘: Permission denied (os error 13)\n" + ); + _du_no_permission(result.stdout); +} + +#[cfg(target_vendor = "apple")] +fn _du_no_permission(s: String) { + assert_eq!(s, "0\tsubdir/links\n"); +} +#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] +fn _du_no_permission(s: String) { + assert_eq!(s, "4\tsubdir/links\n"); +} From c5b43c09943a719d81412f431241f5b412d64c4e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 17 Apr 2021 11:22:49 +0200 Subject: [PATCH 0345/1135] rustfmt the recent change --- src/uu/stdbuf/src/stdbuf.rs | 4 +++- src/uu/unexpand/src/unexpand.rs | 2 +- tests/by-util/test_chmod.rs | 15 ++++++++++----- tests/by-util/test_du.rs | 13 +++++++++---- tests/by-util/test_echo.rs | 5 +---- tests/by-util/test_env.rs | 14 ++++++++------ tests/by-util/test_fold.rs | 2 +- tests/by-util/test_hostname.rs | 4 +++- tests/by-util/test_id.rs | 8 +++----- tests/by-util/test_sort.rs | 8 ++++---- 10 files changed, 43 insertions(+), 32 deletions(-) diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 8c65a5c7e..ddbd76133 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -144,7 +144,9 @@ fn check_option(matches: &ArgMatches, name: &str) -> Result match value { "L" => { if name == options::INPUT { - Err(ProgramOptionsError("line buffering stdin is meaningless".to_string())) + Err(ProgramOptionsError( + "line buffering stdin is meaningless".to_string(), + )) } else { Ok(BufferType::Line) } diff --git a/src/uu/unexpand/src/unexpand.rs b/src/uu/unexpand/src/unexpand.rs index 3d80bd6e9..a811d3b66 100644 --- a/src/uu/unexpand/src/unexpand.rs +++ b/src/uu/unexpand/src/unexpand.rs @@ -150,7 +150,7 @@ fn next_tabstop(tabstops: &[usize], col: usize) -> Option { } else { // find next larger tab // if there isn't one in the list, tab becomes a single space - tabstops.iter().find(|&&t| t > col).map(|t| t-col) + tabstops.iter().find(|&&t| t > col).map(|t| t - col) } } diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index d60b8a50b..9eda769f1 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -357,7 +357,8 @@ fn test_chmod_symlink_non_existing_file() { at.symlink_file(non_existing, test_symlink); // this cannot succeed since the symbolic link dangles - scene.ucmd() + scene + .ucmd() .arg("755") .arg("-v") .arg(test_symlink) @@ -367,7 +368,8 @@ fn test_chmod_symlink_non_existing_file() { .stderr_contains(expected_stderr); // this should be the same than with just '-v' but without stderr - scene.ucmd() + scene + .ucmd() .arg("755") .arg("-v") .arg("-f") @@ -394,7 +396,8 @@ fn test_chmod_symlink_non_existing_file_recursive() { ); // this should succeed - scene.ucmd() + scene + .ucmd() .arg("-R") .arg("755") .arg(test_directory) @@ -408,7 +411,8 @@ fn test_chmod_symlink_non_existing_file_recursive() { ); // '-v': this should succeed without stderr - scene.ucmd() + scene + .ucmd() .arg("-R") .arg("-v") .arg("755") @@ -418,7 +422,8 @@ fn test_chmod_symlink_non_existing_file_recursive() { .no_stderr(); // '-vf': this should be the same than with just '-v' - scene.ucmd() + scene + .ucmd() .arg("-R") .arg("-v") .arg("-f") diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index f668edeef..ea6b18937 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -7,9 +7,7 @@ const SUB_LINK: &str = "subdir/links/sublink.txt"; #[test] fn test_du_basics() { - new_ucmd!() - .succeeds() - .no_stderr(); + new_ucmd!().succeeds().no_stderr(); } #[cfg(target_vendor = "apple")] fn _du_basics(s: String) { @@ -178,7 +176,14 @@ fn test_du_h_flag_empty_file() { fn test_du_time() { let ts = TestScenario::new("du"); - let touch = ts.ccmd("touch").arg("-a").arg("-m").arg("-t").arg("201505150000").arg("date_test").run(); + let touch = ts + .ccmd("touch") + .arg("-a") + .arg("-m") + .arg("-t") + .arg("201505150000") + .arg("date_test") + .run(); assert!(touch.success); let result = ts.ucmd().arg("--time").arg("date_test").run(); diff --git a/tests/by-util/test_echo.rs b/tests/by-util/test_echo.rs index 99c8f3a1e..5d1b68e6c 100644 --- a/tests/by-util/test_echo.rs +++ b/tests/by-util/test_echo.rs @@ -2,10 +2,7 @@ use crate::common::util::*; #[test] fn test_default() { - new_ucmd!() - .arg("hi") - .succeeds() - .stdout_only("hi\n"); + new_ucmd!().arg("hi").succeeds().stdout_only("hi\n"); } #[test] diff --git a/tests/by-util/test_env.rs b/tests/by-util/test_env.rs index 19ecd7afb..39baf473b 100644 --- a/tests/by-util/test_env.rs +++ b/tests/by-util/test_env.rs @@ -26,17 +26,18 @@ fn test_env_version() { #[test] fn test_echo() { - let result = new_ucmd!() - .arg("echo") - .arg("FOO-bar") - .succeeds(); + let result = new_ucmd!().arg("echo").arg("FOO-bar").succeeds(); assert_eq!(result.stdout_str().trim(), "FOO-bar"); } #[test] fn test_file_option() { - let out = new_ucmd!().arg("-f").arg("vars.conf.txt").run().stdout_move_str(); + let out = new_ucmd!() + .arg("-f") + .arg("vars.conf.txt") + .run() + .stdout_move_str(); assert_eq!( out.lines() @@ -89,7 +90,8 @@ fn test_multiple_name_value_pairs() { let out = new_ucmd!().arg("FOO=bar").arg("ABC=xyz").run(); assert_eq!( - out.stdout_str().lines() + out.stdout_str() + .lines() .filter(|&line| line == "FOO=bar" || line == "ABC=xyz") .count(), 2 diff --git a/tests/by-util/test_fold.rs b/tests/by-util/test_fold.rs index ffcd65737..5224a50dc 100644 --- a/tests/by-util/test_fold.rs +++ b/tests/by-util/test_fold.rs @@ -542,4 +542,4 @@ fn test_obsolete_syntax() { .arg("space_separated_words.txt") .succeeds() .stdout_is("test1\n \ntest2\n \ntest3\n \ntest4\n \ntest5\n \ntest6\n "); -} \ No newline at end of file +} diff --git a/tests/by-util/test_hostname.rs b/tests/by-util/test_hostname.rs index 9fa63241f..c9dc99040 100644 --- a/tests/by-util/test_hostname.rs +++ b/tests/by-util/test_hostname.rs @@ -25,6 +25,8 @@ fn test_hostname_full() { let ls_short_res = new_ucmd!().arg("-s").succeeds(); assert!(!ls_short_res.stdout_str().trim().is_empty()); - new_ucmd!().arg("-f").succeeds() + new_ucmd!() + .arg("-f") + .succeeds() .stdout_contains(ls_short_res.stdout_str().trim()); } diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index 7e2791467..719cfd876 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -46,7 +46,8 @@ fn test_id_from_name() { let result = new_ucmd!().arg(&username).succeeds(); let uid = result.stdout_str().trim(); - new_ucmd!().succeeds() + new_ucmd!() + .succeeds() // Verify that the id found by --user/-u exists in the list .stdout_contains(uid) // Verify that the username found by whoami exists in the list @@ -65,10 +66,7 @@ fn test_id_name_from_id() { return; } - let username_id = result - .success() - .stdout_str() - .trim(); + let username_id = result.success().stdout_str().trim(); let scene = TestScenario::new("whoami"); let result = scene.cmd("whoami").succeeds(); diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 0f8020688..c3b8870b9 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -16,10 +16,10 @@ fn test_months_whitespace() { #[test] fn test_version_empty_lines() { new_ucmd!() - .arg("-V") - .arg("version-empty-lines.txt") - .succeeds() - .stdout_is("\n\n\n\n\n\n\n1.2.3-alpha\n1.2.3-alpha2\n\t\t\t1.12.4\n11.2.3\n"); + .arg("-V") + .arg("version-empty-lines.txt") + .succeeds() + .stdout_is("\n\n\n\n\n\n\n1.2.3-alpha\n1.2.3-alpha2\n\t\t\t1.12.4\n11.2.3\n"); } #[test] From 4bbbe3a3f2f65673beee7f1edca416784a02a20c Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 17 Apr 2021 13:49:35 +0200 Subject: [PATCH 0346/1135] sort: implement numeric string comparison (#2070) * sort: implement numeric string comparison This implements -n and -h using a string comparison algorithm instead of parsing each number to a f64 and comparing those. This should result in a moderate performance increase and eliminate loss of precision. * cache parsed f64 numbers For general numeric comparisons we have to parse numbers as f64, as this behavior is explicitly documented by GNU coreutils. We can however cache the parsed value to speed up comparisons. * fix leading zeroes for negative numbers * use more appropriate name for exponent * improvements to the parse function * move checks into main loop and fix thousands separator condition * remove unneeded checks * rustfmt --- src/uu/sort/BENCHMARKING.md | 81 +++- src/uu/sort/src/numeric_str_cmp.rs | 455 ++++++++++++++++++ src/uu/sort/src/sort.rs | 274 ++++------- tests/by-util/test_sort.rs | 6 +- .../sort/multiple_decimals_numeric.expected | 35 ++ 5 files changed, 667 insertions(+), 184 deletions(-) create mode 100644 src/uu/sort/src/numeric_str_cmp.rs create mode 100644 tests/fixtures/sort/multiple_decimals_numeric.expected diff --git a/src/uu/sort/BENCHMARKING.md b/src/uu/sort/BENCHMARKING.md index b20db014d..78c2e2b2d 100644 --- a/src/uu/sort/BENCHMARKING.md +++ b/src/uu/sort/BENCHMARKING.md @@ -9,25 +9,84 @@ list that we should improve / make sure not to regress. Run `cargo build --release` before benchmarking after you make a change! ## Sorting a wordlist -- Get a wordlist, for example with [words](https://en.wikipedia.org/wiki/Words_(Unix)) on Linux. The exact wordlist - doesn't matter for performance comparisons. In this example I'm using `/usr/share/dict/american-english` as the wordlist. -- Shuffle the wordlist by running `sort -R /usr/share/dict/american-english > shuffled_wordlist.txt`. -- Benchmark sorting the wordlist with hyperfine: `hyperfine "target/release/coreutils sort shuffled_wordlist.txt -o output.txt"`. + +- Get a wordlist, for example with [words]() on Linux. The exact wordlist + doesn't matter for performance comparisons. In this example I'm using `/usr/share/dict/american-english` as the wordlist. +- Shuffle the wordlist by running `sort -R /usr/share/dict/american-english > shuffled_wordlist.txt`. +- Benchmark sorting the wordlist with hyperfine: `hyperfine "target/release/coreutils sort shuffled_wordlist.txt -o output.txt"`. ## Sorting a wordlist with ignore_case -- Same wordlist as above -- Benchmark sorting the wordlist ignoring the case with hyperfine: `hyperfine "target/release/coreutils sort shuffled_wordlist.txt -f -o output.txt"`. + +- Same wordlist as above +- Benchmark sorting the wordlist ignoring the case with hyperfine: `hyperfine "target/release/coreutils sort shuffled_wordlist.txt -f -o output.txt"`. ## Sorting numbers -- Generate a list of numbers: `seq 0 100000 | sort -R > shuffled_numbers.txt`. -- Benchmark numeric sorting with hyperfine: `hyperfine "target/release/coreutils sort shuffled_numbers.txt -n -o output.txt"`. + +- Generate a list of numbers: `seq 0 100000 | sort -R > shuffled_numbers.txt`. +- Benchmark numeric sorting with hyperfine: `hyperfine "target/release/coreutils sort shuffled_numbers.txt -n -o output.txt"`. + +## Sorting numbers with -g + +- Same list of numbers as above. +- Benchmark numeric sorting with hyperfine: `hyperfine "target/release/coreutils sort shuffled_numbers.txt -g -o output.txt"`. + +## Sorting numbers with SI prefixes + +- Generate a list of numbers: +
+ Rust script + + ## Cargo.toml + + ```toml + [dependencies] + rand = "0.8.3" + ``` + + ## main.rs + + ```rust + use rand::prelude::*; + fn main() { + let suffixes = ['k', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; + let mut rng = thread_rng(); + for _ in 0..100000 { + println!( + "{}{}", + rng.gen_range(0..1000000), + suffixes.choose(&mut rng).unwrap() + ) + } + } + + ``` + + ## running + + `cargo run > shuffled_numbers_si.txt` + +
+ +- Benchmark numeric sorting with hyperfine: `hyperfine "target/release/coreutils sort shuffled_numbers_si.txt -h -o output.txt"`. ## Stdout and stdin performance + Try to run the above benchmarks by piping the input through stdin (standard input) and redirect the output through stdout (standard output): -- Remove the input file from the arguments and add `cat [inputfile] | ` at the beginning. -- Remove `-o output.txt` and add `> output.txt` at the end. + +- Remove the input file from the arguments and add `cat [inputfile] | ` at the beginning. +- Remove `-o output.txt` and add `> output.txt` at the end. Example: `hyperfine "target/release/coreutils sort shuffled_numbers.txt -n -o output.txt"` becomes `hyperfine "cat shuffled_numbers.txt | target/release/coreutils sort -n > output.txt` -- Check that performance is similar to the original benchmark. \ No newline at end of file + +- Check that performance is similar to the original benchmark. + +## Comparing with GNU sort + +Hyperfine accepts multiple commands to run and will compare them. To compare performance with GNU sort +duplicate the string you passed to hyperfine but remove the `target/release/coreutils` bit from it. + +Example: `hyperfine "target/release/coreutils sort shuffled_numbers_si.txt -h -o output.txt"` becomes +`hyperfine "target/release/coreutils sort shuffled_numbers_si.txt -h -o output.txt" "sort shuffled_numbers_si.txt -h -o output.txt"` +(This assumes GNU sort is installed as `sort`) diff --git a/src/uu/sort/src/numeric_str_cmp.rs b/src/uu/sort/src/numeric_str_cmp.rs new file mode 100644 index 000000000..a50734ebd --- /dev/null +++ b/src/uu/sort/src/numeric_str_cmp.rs @@ -0,0 +1,455 @@ +// * This file is part of the uutils coreutils package. +// * +// * (c) Michael Debertol +// * +// * For the full copyright and license information, please view the LICENSE +// * file that was distributed with this source code. + +//! Fast comparison for strings representing a base 10 number without precision loss. +//! +//! To be able to short-circuit when comparing, [NumInfo] must be passed along with each number +//! to [numeric_str_cmp]. [NumInfo] is generally obtained by calling [NumInfo::parse] and should be cached. +//! It is allowed to arbitrarily modify the exponent afterwards, which is equivalent to shifting the decimal point. +//! +//! More specifically, exponent can be understood so that the original number is in (1..10)*10^exponent. +//! From that follows the constraints of this algorithm: It is able to compare numbers in ±(1*10^[i64::MIN]..10*10^[i64::MAX]). + +use std::{cmp::Ordering, ops::Range}; + +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)] +enum Sign { + Negative, + Positive, +} + +#[derive(Debug, PartialEq)] +pub struct NumInfo { + exponent: i64, + sign: Sign, +} + +pub struct NumInfoParseSettings { + pub accept_si_units: bool, + pub thousands_separator: Option, + pub decimal_pt: Option, +} + +impl Default for NumInfoParseSettings { + fn default() -> Self { + Self { + accept_si_units: false, + thousands_separator: None, + decimal_pt: Some('.'), + } + } +} + +impl NumInfo { + /// Parse NumInfo for this number. + /// Also returns the range of num that should be passed to numeric_str_cmp later + pub fn parse(num: &str, parse_settings: NumInfoParseSettings) -> (Self, Range) { + let mut exponent = -1; + let mut had_decimal_pt = false; + let mut had_digit = false; + let mut start = None; + let mut sign = Sign::Positive; + + let mut first_char = true; + + for (idx, char) in num.char_indices() { + if first_char && char.is_whitespace() { + continue; + } + + if first_char && char == '-' { + sign = Sign::Negative; + first_char = false; + continue; + } + first_char = false; + + if parse_settings + .thousands_separator + .map_or(false, |c| c == char) + { + continue; + } + + if Self::is_invalid_char(char, &mut had_decimal_pt, &parse_settings) { + let si_unit = if parse_settings.accept_si_units { + match char { + 'K' | 'k' => 3, + 'M' => 6, + 'G' => 9, + 'T' => 12, + 'P' => 15, + 'E' => 18, + 'Z' => 21, + 'Y' => 24, + _ => 0, + } + } else { + 0 + }; + return if let Some(start) = start { + ( + NumInfo { + exponent: exponent + si_unit, + sign, + }, + start..idx, + ) + } else { + ( + NumInfo { + sign: if had_digit { sign } else { Sign::Positive }, + exponent: 0, + }, + 0..0, + ) + }; + } + if Some(char) == parse_settings.decimal_pt { + continue; + } + had_digit = true; + if start.is_none() && char == '0' { + if had_decimal_pt { + // We're parsing a number whose first nonzero digit is after the decimal point. + exponent -= 1; + } else { + // Skip leading zeroes + continue; + } + } + if !had_decimal_pt { + exponent += 1; + } + if start.is_none() && char != '0' { + start = Some(idx); + } + } + if let Some(start) = start { + (NumInfo { exponent, sign }, start..num.len()) + } else { + ( + NumInfo { + sign: if had_digit { sign } else { Sign::Positive }, + exponent: 0, + }, + 0..0, + ) + } + } + + fn is_invalid_char( + c: char, + had_decimal_pt: &mut bool, + parse_settings: &NumInfoParseSettings, + ) -> bool { + if Some(c) == parse_settings.decimal_pt { + if *had_decimal_pt { + // this is a decimal pt but we already had one, so it is invalid + true + } else { + *had_decimal_pt = true; + false + } + } else { + !c.is_ascii_digit() + } + } +} + +/// compare two numbers as strings without parsing them as a number first. This should be more performant and can handle numbers more precisely. +/// NumInfo is needed to provide a fast path for most numbers. +pub fn numeric_str_cmp((a, a_info): (&str, &NumInfo), (b, b_info): (&str, &NumInfo)) -> Ordering { + // check for a difference in the sign + if a_info.sign != b_info.sign { + return a_info.sign.cmp(&b_info.sign); + } + + // check for a difference in the exponent + let ordering = if a_info.exponent != b_info.exponent && !a.is_empty() && !b.is_empty() { + a_info.exponent.cmp(&b_info.exponent) + } else { + // walk the characters from the front until we find a difference + let mut a_chars = a.chars().filter(|c| c.is_ascii_digit()); + let mut b_chars = b.chars().filter(|c| c.is_ascii_digit()); + loop { + let a_next = a_chars.next(); + let b_next = b_chars.next(); + match (a_next, b_next) { + (None, None) => break Ordering::Equal, + (Some(c), None) => { + break if c == '0' && a_chars.all(|c| c == '0') { + Ordering::Equal + } else { + Ordering::Greater + } + } + (None, Some(c)) => { + break if c == '0' && b_chars.all(|c| c == '0') { + Ordering::Equal + } else { + Ordering::Less + } + } + (Some(a_char), Some(b_char)) => { + let ord = a_char.cmp(&b_char); + if ord != Ordering::Equal { + break ord; + } + } + } + } + }; + + if a_info.sign == Sign::Negative { + ordering.reverse() + } else { + ordering + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn parses_exp() { + let n = "1"; + assert_eq!( + NumInfo::parse(n, Default::default()), + ( + NumInfo { + exponent: 0, + sign: Sign::Positive + }, + 0..1 + ) + ); + let n = "100"; + assert_eq!( + NumInfo::parse(n, Default::default()), + ( + NumInfo { + exponent: 2, + sign: Sign::Positive + }, + 0..3 + ) + ); + let n = "1,000"; + assert_eq!( + NumInfo::parse( + n, + NumInfoParseSettings { + thousands_separator: Some(','), + ..Default::default() + } + ), + ( + NumInfo { + exponent: 3, + sign: Sign::Positive + }, + 0..5 + ) + ); + let n = "1,000"; + assert_eq!( + NumInfo::parse(n, Default::default()), + ( + NumInfo { + exponent: 0, + sign: Sign::Positive + }, + 0..1 + ) + ); + let n = "1000.00"; + assert_eq!( + NumInfo::parse(n, Default::default()), + ( + NumInfo { + exponent: 3, + sign: Sign::Positive + }, + 0..7 + ) + ); + } + #[test] + fn parses_negative_exp() { + let n = "0.00005"; + assert_eq!( + NumInfo::parse(n, Default::default()), + ( + NumInfo { + exponent: -5, + sign: Sign::Positive + }, + 6..7 + ) + ); + let n = "00000.00005"; + assert_eq!( + NumInfo::parse(n, Default::default()), + ( + NumInfo { + exponent: -5, + sign: Sign::Positive + }, + 10..11 + ) + ); + } + + #[test] + fn parses_sign() { + let n = "5"; + assert_eq!( + NumInfo::parse(n, Default::default()), + ( + NumInfo { + exponent: 0, + sign: Sign::Positive + }, + 0..1 + ) + ); + let n = "-5"; + assert_eq!( + NumInfo::parse(n, Default::default()), + ( + NumInfo { + exponent: 0, + sign: Sign::Negative + }, + 1..2 + ) + ); + let n = " -5"; + assert_eq!( + NumInfo::parse(n, Default::default()), + ( + NumInfo { + exponent: 0, + sign: Sign::Negative + }, + 5..6 + ) + ); + } + + fn test_helper(a: &str, b: &str, expected: Ordering) { + let (a_info, a_range) = NumInfo::parse(a, Default::default()); + let (b_info, b_range) = NumInfo::parse(b, Default::default()); + let ordering = numeric_str_cmp( + (&a[a_range.to_owned()], &a_info), + (&b[b_range.to_owned()], &b_info), + ); + assert_eq!(ordering, expected); + let ordering = numeric_str_cmp((&b[b_range], &b_info), (&a[a_range], &a_info)); + assert_eq!(ordering, expected.reverse()); + } + #[test] + fn test_single_digit() { + test_helper("1", "2", Ordering::Less); + test_helper("0", "0", Ordering::Equal); + } + #[test] + fn test_minus() { + test_helper("-1", "-2", Ordering::Greater); + test_helper("-0", "-0", Ordering::Equal); + } + #[test] + fn test_different_len() { + test_helper("-20", "-100", Ordering::Greater); + test_helper("10.0", "2.000000", Ordering::Greater); + } + #[test] + fn test_decimal_digits() { + test_helper("20.1", "20.2", Ordering::Less); + test_helper("20.1", "20.15", Ordering::Less); + test_helper("-20.1", "+20.15", Ordering::Less); + test_helper("-20.1", "-20", Ordering::Less); + } + #[test] + fn test_trailing_zeroes() { + test_helper("20.00000", "20.1", Ordering::Less); + test_helper("20.00000", "20.0", Ordering::Equal); + } + #[test] + fn test_invalid_digits() { + test_helper("foo", "bar", Ordering::Equal); + test_helper("20.1", "a", Ordering::Greater); + test_helper("-20.1", "a", Ordering::Less); + test_helper("a", "0.15", Ordering::Less); + } + #[test] + fn test_multiple_decimal_pts() { + test_helper("10.0.0", "50.0.0", Ordering::Less); + test_helper("0.1.", "0.2.0", Ordering::Less); + test_helper("1.1.", "0", Ordering::Greater); + test_helper("1.1.", "-0", Ordering::Greater); + } + #[test] + fn test_leading_decimal_pts() { + test_helper(".0", ".0", Ordering::Equal); + test_helper(".1", ".0", Ordering::Greater); + test_helper(".02", "0", Ordering::Greater); + } + #[test] + fn test_leading_zeroes() { + test_helper("000000.0", ".0", Ordering::Equal); + test_helper("0.1", "0000000000000.0", Ordering::Greater); + test_helper("-01", "-2", Ordering::Greater); + } + + #[test] + fn minus_zero() { + // This matches GNU sort behavior. + test_helper("-0", "0", Ordering::Less); + test_helper("-0x", "0", Ordering::Less); + } + #[test] + fn double_minus() { + test_helper("--1", "0", Ordering::Equal); + } + #[test] + fn single_minus() { + let info = NumInfo::parse("-", Default::default()); + assert_eq!( + info, + ( + NumInfo { + exponent: 0, + sign: Sign::Positive + }, + 0..0 + ) + ); + } + #[test] + fn invalid_with_unit() { + let info = NumInfo::parse( + "-K", + NumInfoParseSettings { + accept_si_units: true, + ..Default::default() + }, + ); + assert_eq!( + info, + ( + NumInfo { + exponent: 0, + sign: Sign::Positive + }, + 0..0 + ) + ); + } +} diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 8bf6eb1e8..c097861fc 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -15,9 +15,12 @@ #[macro_use] extern crate uucore; +mod numeric_str_cmp; + use clap::{App, Arg}; use fnv::FnvHasher; use itertools::Itertools; +use numeric_str_cmp::{numeric_str_cmp, NumInfo, NumInfoParseSettings}; use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; use rayon::prelude::*; @@ -162,27 +165,71 @@ impl From<&GlobalSettings> for KeySettings { } /// Represents the string selected by a FieldSelector. -#[derive(Debug)] -enum Selection { +enum SelectionRange { /// If we had to transform this selection, we have to store a new string. String(String), /// If there was no transformation, we can store an index into the line. ByIndex(Range), } +impl SelectionRange { + /// Gets the actual string slice represented by this Selection. + fn get_str<'a>(&'a self, line: &'a str) -> &'a str { + match self { + SelectionRange::String(string) => string.as_str(), + SelectionRange::ByIndex(range) => &line[range.to_owned()], + } + } + + fn shorten(&mut self, new_range: Range) { + match self { + SelectionRange::String(string) => { + string.drain(new_range.end..); + string.drain(..new_range.start); + } + SelectionRange::ByIndex(range) => { + range.end = range.start + new_range.end; + range.start += new_range.start; + } + } + } +} + +enum NumCache { + AsF64(f64), + WithInfo(NumInfo), + None, +} + +impl NumCache { + fn as_f64(&self) -> f64 { + match self { + NumCache::AsF64(n) => *n, + _ => unreachable!(), + } + } + fn as_num_info(&self) -> &NumInfo { + match self { + NumCache::WithInfo(n) => n, + _ => unreachable!(), + } + } +} + +struct Selection { + range: SelectionRange, + num_cache: NumCache, +} + impl Selection { /// Gets the actual string slice represented by this Selection. fn get_str<'a>(&'a self, line: &'a Line) -> &'a str { - match self { - Selection::String(string) => string.as_str(), - Selection::ByIndex(range) => &line.line[range.to_owned()], - } + self.range.get_str(&line.line) } } type Field = Range; -#[derive(Debug)] struct Line { line: String, // The common case is not to specify fields. Let's make this fast. @@ -206,18 +253,38 @@ impl Line { .selectors .iter() .map(|selector| { - if let Some(range) = selector.get_selection(&line, fields.as_deref()) { - if let Some(transformed) = - transform(&line[range.to_owned()], &selector.settings) - { - Selection::String(transformed) + let mut range = + if let Some(range) = selector.get_selection(&line, fields.as_deref()) { + if let Some(transformed) = + transform(&line[range.to_owned()], &selector.settings) + { + SelectionRange::String(transformed) + } else { + SelectionRange::ByIndex(range.start().to_owned()..range.end() + 1) + } } else { - Selection::ByIndex(range.start().to_owned()..range.end() + 1) - } + // If there is no match, match the empty string. + SelectionRange::ByIndex(0..0) + }; + let num_cache = if selector.settings.mode == SortMode::Numeric + || selector.settings.mode == SortMode::HumanNumeric + { + let (info, num_range) = NumInfo::parse( + range.get_str(&line), + NumInfoParseSettings { + accept_si_units: selector.settings.mode == SortMode::HumanNumeric, + thousands_separator: Some(THOUSANDS_SEP), + decimal_pt: Some(DECIMAL_PT), + }, + ); + range.shorten(num_range); + NumCache::WithInfo(info) + } else if selector.settings.mode == SortMode::GeneralNumeric { + NumCache::AsF64(permissive_f64_parse(get_leading_gen(range.get_str(&line)))) } else { - // If there is no match, match the empty string. - Selection::ByIndex(0..0) - } + NumCache::None + }; + Selection { range, num_cache } }) .collect(); Self { line, selections } @@ -923,21 +990,28 @@ fn sort_by(lines: &mut Vec, settings: &GlobalSettings) { fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering { for (idx, selector) in global_settings.selectors.iter().enumerate() { - let a = a.selections[idx].get_str(a); - let b = b.selections[idx].get_str(b); + let a_selection = &a.selections[idx]; + let b_selection = &b.selections[idx]; + let a_str = a_selection.get_str(a); + let b_str = b_selection.get_str(b); let settings = &selector.settings; let cmp: Ordering = if settings.random { - random_shuffle(a, b, global_settings.salt.clone()) + random_shuffle(a_str, b_str, global_settings.salt.clone()) } else { - (match settings.mode { - SortMode::Numeric => numeric_compare, - SortMode::GeneralNumeric => general_numeric_compare, - SortMode::HumanNumeric => human_numeric_size_compare, - SortMode::Month => month_compare, - SortMode::Version => version_compare, - SortMode::Default => default_compare, - })(a, b) + match settings.mode { + SortMode::Numeric | SortMode::HumanNumeric => numeric_str_cmp( + (a_str, a_selection.num_cache.as_num_info()), + (b_str, b_selection.num_cache.as_num_info()), + ), + SortMode::GeneralNumeric => general_numeric_compare( + a_selection.num_cache.as_f64(), + b_selection.num_cache.as_f64(), + ), + SortMode::Month => month_compare(a_str, b_str), + SortMode::Version => version_compare(a_str, b_str), + SortMode::Default => default_compare(a_str, b_str), + } }; if cmp != Ordering::Equal { return if settings.reverse { cmp.reverse() } else { cmp }; @@ -945,7 +1019,6 @@ fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering } // Call "last resort compare" if all selectors returned Equal - let cmp = if global_settings.random || global_settings.stable || global_settings.unique { Ordering::Equal } else { @@ -997,34 +1070,6 @@ fn leading_num_common(a: &str) -> &str { s } -// This function cleans up the initial comparison done by leading_num_common for a numeric compare. -// GNU sort does its numeric comparison through strnumcmp. However, we don't have or -// may not want to use libc. Instead we emulate the GNU sort numeric compare by ignoring -// those leading number lines GNU sort would not recognize. GNU numeric compare would -// not recognize a positive sign or scientific/E notation so we strip those elements here. -fn get_leading_num(a: &str) -> &str { - let mut s = ""; - - let a = leading_num_common(a); - - // GNU numeric sort doesn't recognize '+' or 'e' notation so we strip - for (idx, c) in a.char_indices() { - if c.eq(&'e') || c.eq(&'E') || a.chars().next().unwrap_or('\0').eq(&POSITIVE) { - s = &a[..idx]; - break; - } - // If no further processing needed to be done, return the line as-is to be sorted - s = &a; - } - - // And empty number or non-number lines are to be treated as ‘0’ but only for numeric sort - // All '0'-ed lines will be sorted later, but only amongst themselves, during the so-called 'last resort comparison.' - if s.is_empty() { - s = "0"; - }; - s -} - // This function cleans up the initial comparison done by leading_num_common for a general numeric compare. // In contrast to numeric compare, GNU general numeric/FP sort *should* recognize positive signs and // scientific notation, so we strip those lines only after the end of the following numeric string. @@ -1054,17 +1099,6 @@ fn get_leading_gen(a: &str) -> &str { result } -#[inline(always)] -fn remove_thousands_sep<'a, S: Into>>(input: S) -> Cow<'a, str> { - let input = input.into(); - if input.contains(THOUSANDS_SEP) { - let output = input.replace(THOUSANDS_SEP, ""); - Cow::Owned(output) - } else { - input - } -} - #[inline(always)] fn remove_trailing_dec<'a, S: Into>>(input: S) -> Cow<'a, str> { let input = input.into(); @@ -1093,87 +1127,15 @@ fn permissive_f64_parse(a: &str) -> f64 { } } -fn numeric_compare(a: &str, b: &str) -> Ordering { - #![allow(clippy::comparison_chain)] - - let sa = get_leading_num(a); - let sb = get_leading_num(b); - - // Avoids a string alloc for every line to remove thousands seperators here - // instead of inside the get_leading_num function, which is a HUGE performance benefit - let ta = remove_thousands_sep(sa); - let tb = remove_thousands_sep(sb); - - let fa = permissive_f64_parse(&ta); - let fb = permissive_f64_parse(&tb); - - // f64::cmp isn't implemented (due to NaN issues); implement directly instead - if fa > fb { - Ordering::Greater - } else if fa < fb { - Ordering::Less - } else { - Ordering::Equal - } -} - /// Compares two floats, with errors and non-numerics assumed to be -inf. /// Stops coercing at the first non-numeric char. -fn general_numeric_compare(a: &str, b: &str) -> Ordering { +/// We explicitly need to convert to f64 in this case. +fn general_numeric_compare(a: f64, b: f64) -> Ordering { #![allow(clippy::comparison_chain)] - - let sa = get_leading_gen(a); - let sb = get_leading_gen(b); - - let fa = permissive_f64_parse(&sa); - let fb = permissive_f64_parse(&sb); - // f64::cmp isn't implemented (due to NaN issues); implement directly instead - if fa > fb { + if a > b { Ordering::Greater - } else if fa < fb { - Ordering::Less - } else { - Ordering::Equal - } -} - -// GNU/BSD does not handle converting numbers to an equal scale -// properly. GNU/BSD simply recognize that there is a human scale and sorts -// those numbers ahead of other number inputs. There are perhaps limits -// to the type of behavior we should emulate, and this might be such a limit. -// Properly handling these units seems like a value add to me. And when sorting -// these types of numbers, we rarely care about pure performance. -fn human_numeric_convert(a: &str) -> f64 { - let num_str = get_leading_num(a); - let suffix = a.trim_start_matches(&num_str); - let num_part = permissive_f64_parse(&num_str); - let suffix: f64 = match suffix.parse().unwrap_or('\0') { - // SI Units - 'K' => 1E3, - 'M' => 1E6, - 'G' => 1E9, - 'T' => 1E12, - 'P' => 1E15, - 'E' => 1E18, - 'Z' => 1E21, - 'Y' => 1E24, - _ => 1f64, - }; - num_part * suffix -} - -/// Compare two strings as if they are human readable sizes. -/// AKA 1M > 100k -fn human_numeric_size_compare(a: &str, b: &str) -> Ordering { - #![allow(clippy::comparison_chain)] - let fa = human_numeric_convert(a); - let fb = human_numeric_convert(b); - - // f64::cmp isn't implemented (due to NaN issues); implement directly instead - if fa > fb { - Ordering::Greater - } else if fa < fb { + } else if a < b { Ordering::Less } else { Ordering::Equal @@ -1373,30 +1335,6 @@ mod tests { assert_eq!(Ordering::Less, default_compare(a, b)); } - #[test] - fn test_numeric_compare1() { - let a = "149:7"; - let b = "150:5"; - - assert_eq!(Ordering::Less, numeric_compare(a, b)); - } - - #[test] - fn test_numeric_compare2() { - let a = "-1.02"; - let b = "1"; - - assert_eq!(Ordering::Less, numeric_compare(a, b)); - } - - #[test] - fn test_human_numeric_compare() { - let a = "300K"; - let b = "1M"; - - assert_eq!(Ordering::Less, human_numeric_size_compare(a, b)); - } - #[test] fn test_month_compare() { let a = "JaN"; diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index c3b8870b9..aacc34eb0 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -38,11 +38,7 @@ fn test_multiple_decimals_general() { #[test] fn test_multiple_decimals_numeric() { - new_ucmd!() - .arg("-n") - .arg("multiple_decimals_numeric.txt") - .succeeds() - .stdout_is("-2028789030\n-896689\n-8.90880\n-1\n-.05\n\n\n\n\n\n\n\n\n000\nCARAvan\n00000001\n1\n1.040000000\n1.444\n1.58590\n8.013\n45\n46.89\n 4567.\n4567.1\n4567.34\n\t\t\t\t\t\t\t\t\t\t4567..457\n\t\t\t\t37800\n\t\t\t\t\t\t45670.89079.098\n\t\t\t\t\t\t45670.89079.1\n576,446.88800000\n576,446.890\n4798908.340000000000\n4798908.45\n4798908.8909800\n"); + test_helper("multiple_decimals_numeric", "-n") } #[test] diff --git a/tests/fixtures/sort/multiple_decimals_numeric.expected b/tests/fixtures/sort/multiple_decimals_numeric.expected new file mode 100644 index 000000000..3ef4d22e8 --- /dev/null +++ b/tests/fixtures/sort/multiple_decimals_numeric.expected @@ -0,0 +1,35 @@ +-2028789030 +-896689 +-8.90880 +-1 +-.05 + + + + + + + + +000 +CARAvan +00000001 +1 +1.040000000 +1.444 +1.58590 +8.013 +45 +46.89 + 4567..457 + 4567. +4567.1 +4567.34 + 37800 + 45670.89079.098 + 45670.89079.1 +576,446.88800000 +576,446.890 +4798908.340000000000 +4798908.45 +4798908.8909800 From 0d1946a5d27e4ff79196d18cc51835a1836da8f9 Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Sat, 17 Apr 2021 15:01:52 +0300 Subject: [PATCH 0347/1135] cksum: Remove direct usage of CmdResult fields in tests --- tests/by-util/test_cksum.rs | 54 ++++++++++++++++++------------------- tests/common/util.rs | 36 +++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 27 deletions(-) diff --git a/tests/by-util/test_cksum.rs b/tests/by-util/test_cksum.rs index 1a0915cd5..c8e60f8a9 100644 --- a/tests/by-util/test_cksum.rs +++ b/tests/by-util/test_cksum.rs @@ -31,7 +31,10 @@ fn test_empty() { at.touch("a"); - ucmd.arg("a").succeeds().stdout.ends_with("0 a"); + ucmd.arg("a") + .succeeds() + .no_stderr() + .normalized_newlines_stdout_is("4294967295 0 a\n"); } #[test] @@ -41,36 +44,35 @@ fn test_arg_overrides_stdin() { at.touch("a"); - let result = ucmd - .arg("a") + ucmd.arg("a") .pipe_in(input.as_bytes()) // the command might have exited before all bytes have been pipe in. // in that case, we don't care about the error (broken pipe) .ignore_stdin_write_error() - .run(); - - println!("{}, {}", result.stdout, result.stderr); - - assert!(result.stdout.ends_with("0 a\n")) + .succeeds() + .no_stderr() + .normalized_newlines_stdout_is("4294967295 0 a\n"); } #[test] fn test_invalid_file() { - let (_, mut ucmd) = at_and_ucmd!(); + let ts = TestScenario::new(util_name!()); + let at = ts.fixtures.clone(); - let ls = TestScenario::new("ls"); - let files = ls.cmd("ls").arg("-l").run(); - println!("{:?}", files.stdout); - println!("{:?}", files.stderr); + let folder_name = "asdf"; - let folder_name = "asdf".to_string(); - - let result = ucmd.arg(&folder_name).run(); - - println!("stdout: {:?}", result.stdout); - println!("stderr: {:?}", result.stderr); - assert!(result.stderr.contains("cksum: error: 'asdf'")); - assert!(!result.success); + // First check when file doesn't exist + ts.ucmd().arg(folder_name) + .fails() + .no_stdout() + .stderr_contains("cksum: error: 'asdf' No such file or directory"); + + // Then check when the file is of an invalid type + at.mkdir(folder_name); + ts.ucmd().arg(folder_name) + .fails() + .no_stdout() + .stderr_contains("cksum: error: 'asdf' Is a directory"); } // Make sure crc is correct for files larger than 32 bytes @@ -79,14 +81,13 @@ fn test_invalid_file() { fn test_crc_for_bigger_than_32_bytes() { let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("chars.txt").run(); + let result = ucmd.arg("chars.txt").succeeds(); - let mut stdout_splitted = result.stdout.split(" "); + let mut stdout_splitted = result.stdout_str().split(" "); let cksum: i64 = stdout_splitted.next().unwrap().parse().unwrap(); let bytes_cnt: i64 = stdout_splitted.next().unwrap().parse().unwrap(); - assert!(result.success); assert_eq!(cksum, 586047089); assert_eq!(bytes_cnt, 16); } @@ -95,14 +96,13 @@ fn test_crc_for_bigger_than_32_bytes() { fn test_stdin_larger_than_128_bytes() { let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("larger_than_2056_bytes.txt").run(); + let result = ucmd.arg("larger_than_2056_bytes.txt").succeeds(); - let mut stdout_splitted = result.stdout.split(" "); + let mut stdout_splitted = result.stdout_str().split(" "); let cksum: i64 = stdout_splitted.next().unwrap().parse().unwrap(); let bytes_cnt: i64 = stdout_splitted.next().unwrap().parse().unwrap(); - assert!(result.success); assert_eq!(cksum, 945881979); assert_eq!(bytes_cnt, 2058); } diff --git a/tests/common/util.rs b/tests/common/util.rs index c7f46c2a9..b54c8ee39 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -220,6 +220,13 @@ impl CmdResult { self } + /// Like `stdout_is` but newlines are normalized to `\n`. + pub fn normalized_newlines_stdout_is>(&self, msg: T) -> &CmdResult { + let msg = msg.as_ref().replace("\r\n", "\n"); + assert_eq!(self.stdout.replace("\r\n", "\n"), msg); + self + } + /// asserts that the command resulted in stdout stream output, /// whose bytes equal those of the passed in slice pub fn stdout_is_bytes>(&self, msg: T) -> &CmdResult { @@ -1096,4 +1103,33 @@ mod tests { res.stdout_does_not_match(&positive); } + + #[test] + fn test_normalized_newlines_stdout_is() { + let res = CmdResult { + tmpd: None, + code: None, + success: true, + stdout: "A\r\nB\nC".into(), + stderr: "".into(), + }; + + res.normalized_newlines_stdout_is("A\r\nB\nC"); + res.normalized_newlines_stdout_is("A\nB\nC"); + res.normalized_newlines_stdout_is("A\nB\r\nC"); + } + + #[test] + #[should_panic] + fn test_normalized_newlines_stdout_is_fail() { + let res = CmdResult { + tmpd: None, + code: None, + success: true, + stdout: "A\r\nB\nC".into(), + stderr: "".into(), + }; + + res.normalized_newlines_stdout_is("A\r\nB\nC\n"); + } } From 7c7e64e79c41cffce6ce00c02f97f53e911e11d0 Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Sat, 17 Apr 2021 15:14:49 +0300 Subject: [PATCH 0348/1135] pinky, mktemp: Remove direct usage of CmdResult fields in test --- tests/by-util/test_mktemp.rs | 24 +++++++++--------------- tests/by-util/test_pinky.rs | 12 ++++-------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index 2639a2c2f..aa3ff5f1f 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -113,17 +113,14 @@ fn test_mktemp_mktemp_t() { .arg("-t") .arg(TEST_TEMPLATE7) .succeeds(); - let result = scene + scene .ucmd() .env(TMPDIR, &pathname) .arg("-t") .arg(TEST_TEMPLATE8) - .fails(); - println!("stdout {}", result.stdout); - println!("stderr {}", result.stderr); - assert!(result - .stderr - .contains("error: suffix cannot contain any path separators")); + .fails() + .no_stdout() + .stderr_contains("error: suffix cannot contain any path separators"); } #[test] @@ -391,10 +388,9 @@ fn test_mktemp_tmpdir_one_arg() { .arg("--tmpdir") .arg("apt-key-gpghome.XXXXXXXXXX") .succeeds(); - println!("stdout {}", result.stdout); - println!("stderr {}", result.stderr); - assert!(result.stdout.contains("apt-key-gpghome.")); - assert!(PathBuf::from(result.stdout.trim()).is_file()); + result.no_stderr() + .stdout_contains("apt-key-gpghome."); + assert!(PathBuf::from(result.stdout_str().trim()).is_file()); } #[test] @@ -407,8 +403,6 @@ fn test_mktemp_directory_tmpdir() { .arg("--tmpdir") .arg("apt-key-gpghome.XXXXXXXXXX") .succeeds(); - println!("stdout {}", result.stdout); - println!("stderr {}", result.stderr); - assert!(result.stdout.contains("apt-key-gpghome.")); - assert!(PathBuf::from(result.stdout.trim()).is_dir()); + result.no_stderr().stdout_contains("apt-key-gpghome."); + assert!(PathBuf::from(result.stdout_str().trim()).is_dir()); } diff --git a/tests/by-util/test_pinky.rs b/tests/by-util/test_pinky.rs index c8e8334ab..161054b2c 100644 --- a/tests/by-util/test_pinky.rs +++ b/tests/by-util/test_pinky.rs @@ -43,11 +43,9 @@ fn test_short_format_i() { let actual = TestScenario::new(util_name!()) .ucmd() .args(&args) - .run() - .stdout; + .succeeds() + .stdout_move_str(); let expect = expected_result(&args); - println!("actual: {:?}", actual); - println!("expect: {:?}", expect); let v_actual: Vec<&str> = actual.split_whitespace().collect(); let v_expect: Vec<&str> = expect.split_whitespace().collect(); assert_eq!(v_actual, v_expect); @@ -62,11 +60,9 @@ fn test_short_format_q() { let actual = TestScenario::new(util_name!()) .ucmd() .args(&args) - .run() - .stdout; + .succeeds() + .stdout_move_str(); let expect = expected_result(&args); - println!("actual: {:?}", actual); - println!("expect: {:?}", expect); let v_actual: Vec<&str> = actual.split_whitespace().collect(); let v_expect: Vec<&str> = expect.split_whitespace().collect(); assert_eq!(v_actual, v_expect); From 600bab52ffcfa90ec69c1ec45fc2e4ec7280a19c Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Sat, 17 Apr 2021 15:22:20 +0300 Subject: [PATCH 0349/1135] shred, stat, tail: Remove direct usage of CmdResult fields in test --- tests/by-util/test_shred.rs | 4 +--- tests/by-util/test_stat.rs | 6 +++--- tests/by-util/test_tail.rs | 8 ++++---- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/tests/by-util/test_shred.rs b/tests/by-util/test_shred.rs index de54fae5b..b29b9bfec 100644 --- a/tests/by-util/test_shred.rs +++ b/tests/by-util/test_shred.rs @@ -36,9 +36,7 @@ fn test_shred_force() { at.set_readonly(file); // Try shred -u. - let result = scene.ucmd().arg("-u").arg(file).run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); + scene.ucmd().arg("-u").arg(file).run(); // file_a was not deleted because it is readonly. assert!(at.file_exists(file)); diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 225ea52cd..376b3db51 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -194,7 +194,7 @@ fn test_terse_normal_format() { // note: contains birth/creation date which increases test fragility // * results may vary due to built-in `stat` limitations as well as linux kernel and rust version capability variations let args = ["-t", "/"]; - let actual = new_ucmd!().args(&args).run().stdout; + let actual = new_ucmd!().args(&args).succeeds().stdout_move_str(); let expect = expected_result(&args); println!("actual: {:?}", actual); println!("expect: {:?}", expect); @@ -216,7 +216,7 @@ fn test_terse_normal_format() { #[cfg(target_os = "linux")] fn test_format_created_time() { let args = ["-c", "%w", "/boot"]; - let actual = new_ucmd!().args(&args).run().stdout; + let actual = new_ucmd!().args(&args).succeeds().stdout_move_str(); let expect = expected_result(&args); println!("actual: {:?}", actual); println!("expect: {:?}", expect); @@ -240,7 +240,7 @@ fn test_format_created_time() { #[cfg(target_os = "linux")] fn test_format_created_seconds() { let args = ["-c", "%W", "/boot"]; - let actual = new_ucmd!().args(&args).run().stdout; + let actual = new_ucmd!().args(&args).succeeds().stdout_move_str(); let expect = expected_result(&args); println!("actual: {:?}", actual); println!("expect: {:?}", expect); diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 5edff4d55..6e9eb4a17 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -226,8 +226,8 @@ fn test_bytes_big() { .arg(FILE) .arg("-c") .arg(format!("{}", N_ARG)) - .run() - .stdout; + .succeeds() + .stdout_move_str(); let expected = at.read(EXPECTED_FILE); assert_eq!(result.len(), expected.len()); @@ -340,6 +340,6 @@ fn test_negative_indexing() { let negative_bytes_index = new_ucmd!().arg("-c").arg("-20").arg(FOOBAR_TXT).run(); - assert_eq!(positive_lines_index.stdout, negative_lines_index.stdout); - assert_eq!(positive_bytes_index.stdout, negative_bytes_index.stdout); + assert_eq!(positive_lines_index.stdout(), negative_lines_index.stdout()); + assert_eq!(positive_bytes_index.stdout(), negative_bytes_index.stdout()); } From c5d7f63b3ca9214f2aa5dc07f378eab8752d7cbf Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Sat, 17 Apr 2021 16:48:23 +0300 Subject: [PATCH 0350/1135] Make CmdResult::code private --- tests/by-util/test_cp.rs | 8 +++----- tests/by-util/test_install.rs | 18 ++++++++++++------ tests/common/util.rs | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 07880d5c0..f4aabff3e 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1029,7 +1029,7 @@ fn test_cp_one_file_system() { at_src.mkdir(TEST_MOUNT_MOUNTPOINT); let mountpoint_path = &at_src.plus_as_string(TEST_MOUNT_MOUNTPOINT); - let _r = scene + scene .cmd("mount") .arg("-t") .arg("tmpfs") @@ -1037,8 +1037,7 @@ fn test_cp_one_file_system() { .arg("size=640k") // ought to be enough .arg("tmpfs") .arg(mountpoint_path) - .run(); - assert!(_r.code == Some(0), "{}", _r.stderr); + .succeeds(); at_src.touch(TEST_MOUNT_OTHER_FILESYSTEM_FILE); @@ -1051,8 +1050,7 @@ fn test_cp_one_file_system() { .run(); // Ditch the mount before the asserts - let _r = scene.cmd("umount").arg(mountpoint_path).run(); - assert!(_r.code == Some(0), "{}", _r.stderr); + scene.cmd("umount").arg(mountpoint_path).succeeds(); assert!(result.success); assert!(!at_dst.file_exists(TEST_MOUNT_OTHER_FILESYSTEM_FILE)); diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 32df8d460..dfaaabce6 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -443,9 +443,12 @@ fn test_install_failing_omitting_directory() { at.mkdir(dir2); at.touch(file1); - let r = ucmd.arg(dir1).arg(file1).arg(dir2).run(); - assert!(r.code == Some(1)); - assert!(r.stderr.contains("omitting directory")); + ucmd.arg(dir1) + .arg(file1) + .arg(dir2) + .fails() + .code_is(1) + .stderr_contains("omitting directory"); } #[test] @@ -458,9 +461,12 @@ fn test_install_failing_no_such_file() { at.mkdir(dir1); at.touch(file1); - let r = ucmd.arg(file1).arg(file2).arg(dir1).run(); - assert!(r.code == Some(1)); - assert!(r.stderr.contains("No such file or directory")); + ucmd.arg(file1) + .arg(file2) + .arg(dir1) + .fails() + .code_is(1) + .stderr_contains("No such file or directory"); } #[test] diff --git a/tests/common/util.rs b/tests/common/util.rs index b54c8ee39..55e121737 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -71,7 +71,7 @@ pub struct CmdResult { //tmpd is used for convenience functions for asserts against fixtures tmpd: Option>, /// exit status for command (if there is one) - pub code: Option, + code: Option, /// zero-exit from running the Command? /// see [`success`] pub success: bool, From 01fef7014394ebc4462951f855c8069b0b9c58d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Jord=C3=A3o?= Date: Sat, 17 Apr 2021 20:23:48 +0100 Subject: [PATCH 0351/1135] Changes parameter parsing to clap - Uses clap to parse parameters - Removes of "allow" directive where they are not necessary - Removes of unused variables --- Cargo.lock | 2 -- src/uu/printf/src/cli.rs | 11 ++++------ src/uu/printf/src/printf.rs | 2 -- .../num_format/formatters/base_conv/mod.rs | 10 +++------ .../formatters/cninetyninehexfloatf.rs | 22 +++++++++---------- .../tokenize/num_format/formatters/decf.rs | 7 +++--- .../tokenize/num_format/formatters/floatf.rs | 6 ++--- .../tokenize/num_format/formatters/intf.rs | 4 ++-- .../tokenize/num_format/formatters/scif.rs | 7 +++--- src/uu/printf/src/tokenize/unescaped_text.rs | 6 ++--- 10 files changed, 29 insertions(+), 48 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 430abf921..461716b1b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,7 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 - [[package]] name = "advapi32-sys" version = "0.2.0" diff --git a/src/uu/printf/src/cli.rs b/src/uu/printf/src/cli.rs index 12e80a925..a5e9c9775 100644 --- a/src/uu/printf/src/cli.rs +++ b/src/uu/printf/src/cli.rs @@ -18,18 +18,15 @@ pub fn err_msg(msg: &str) { // by default stdout only flushes // to console when a newline is passed. -#[allow(unused_must_use)] pub fn flush_char(c: char) { print!("{}", c); - stdout().flush(); + let _ = stdout().flush(); } -#[allow(unused_must_use)] pub fn flush_str(s: &str) { print!("{}", s); - stdout().flush(); + let _ = stdout().flush(); } -#[allow(unused_must_use)] pub fn flush_bytes(bslice: &[u8]) { - stdout().write(bslice); - stdout().flush(); + let _ = stdout().write(bslice); + let _ = stdout().flush(); } diff --git a/src/uu/printf/src/printf.rs b/src/uu/printf/src/printf.rs index c2952e5a9..d947a7d83 100644 --- a/src/uu/printf/src/printf.rs +++ b/src/uu/printf/src/printf.rs @@ -1,5 +1,4 @@ #![allow(dead_code)] - // spell-checker:ignore (change!) each's // spell-checker:ignore (ToDO) LONGHELP FORMATSTRING templating parameterizing formatstr @@ -9,7 +8,6 @@ mod tokenize; static NAME: &str = "printf"; static VERSION: &str = env!("CARGO_PKG_VERSION"); -static SHORT_USAGE: &str = "printf: usage: printf [-v var] format [arguments]"; static LONGHELP_LEAD: &str = "printf USAGE: printf FORMATSTRING [ARGUMENT]... diff --git a/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs b/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs index 79af9abd5..701fb5dfc 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs @@ -28,8 +28,7 @@ pub fn arrnum_int_mult(arr_num: &[u8], basenum: u8, base_ten_int_fact: u8) -> Ve } } } - #[allow(clippy::map_clone)] - let ret: Vec = ret_rev.iter().rev().map(|x| *x).collect(); + let ret: Vec = ret_rev.into_iter().rev().collect(); ret } @@ -193,8 +192,7 @@ pub fn arrnum_int_add(arrnum: &[u8], basenum: u8, base_ten_int_term: u8) -> Vec< } } } - #[allow(clippy::map_clone)] - let ret: Vec = ret_rev.iter().rev().map(|x| *x).collect(); + let ret: Vec = ret_rev.into_iter().rev().collect(); ret } @@ -220,8 +218,7 @@ pub fn unsigned_to_arrnum(src: u16) -> Vec { } // temporary needs-improvement-function -#[allow(unused_variables)] -pub fn base_conv_float(src: &[u8], radix_src: u8, radix_dest: u8) -> f64 { +pub fn base_conv_float(src: &[u8], radix_src: u8, _radix_dest: u8) -> f64 { // it would require a lot of addl code // to implement this for arbitrary string input. // until then, the below operates as an outline @@ -269,7 +266,6 @@ pub fn arrnum_to_str(src: &[u8], radix_def_dest: &dyn RadixDef) -> String { str_out } -#[allow(unused_variables)] pub fn base_conv_str( src: &str, radix_def_src: &dyn RadixDef, diff --git a/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs b/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs index 10e58cc32..f28121d3e 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs @@ -43,13 +43,11 @@ impl Formatter for CninetyNineHexFloatf { // c99 hex has unique requirements of all floating point subs in pretty much every part of building a primitive, from prefix and suffix to need for base conversion (in all other cases if you don't have decimal you must have decimal, here it's the other way around) // on the todo list is to have a trait for get_primitive that is implemented by each float formatter and can override a default. when that happens we can take the parts of get_primitive_dec specific to dec and spin them out to their own functions that can be overridden. -#[allow(unused_variables)] -#[allow(unused_assignments)] fn get_primitive_hex( inprefix: &InPrefix, - str_in: &str, - analysis: &FloatAnalysis, - last_dec_place: usize, + _str_in: &str, + _analysis: &FloatAnalysis, + _last_dec_place: usize, capitalized: bool, ) -> FormatPrimitive { let prefix = Some(String::from(if inprefix.sign == -1 { "-0x" } else { "0x" })); @@ -57,13 +55,13 @@ fn get_primitive_hex( // assign the digits before and after the decimal points // to separate slices. If no digits after decimal point, // assign 0 - let (mut first_segment_raw, second_segment_raw) = match analysis.decimal_pos { - Some(pos) => (&str_in[..pos], &str_in[pos + 1..]), - None => (str_in, "0"), - }; - if first_segment_raw.is_empty() { - first_segment_raw = "0"; - } + //let (mut first_segment_raw, second_segment_raw) = match analysis.decimal_pos { + //Some(pos) => (&str_in[..pos], &str_in[pos + 1..]), + //None => (str_in, "0"), + //}; + //if first_segment_raw.is_empty() { + //first_segment_raw = "0"; + //} // convert to string, hexifying if input is in dec. // let (first_segment, second_segment) = // match inprefix.radix_in { diff --git a/src/uu/printf/src/tokenize/num_format/formatters/decf.rs b/src/uu/printf/src/tokenize/num_format/formatters/decf.rs index 6b2baa890..448771f22 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/decf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/decf.rs @@ -22,12 +22,11 @@ fn get_len_fprim(fprim: &FormatPrimitive) -> usize { len } -pub struct Decf { - as_num: f64, -} +pub struct Decf; + impl Decf { pub fn new() -> Decf { - Decf { as_num: 0.0 } + Decf } } impl Formatter for Decf { diff --git a/src/uu/printf/src/tokenize/num_format/formatters/floatf.rs b/src/uu/printf/src/tokenize/num_format/formatters/floatf.rs index 97ceafe8d..b3de2f98a 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/floatf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/floatf.rs @@ -5,12 +5,10 @@ use super::super::format_field::FormatField; use super::super::formatter::{FormatPrimitive, Formatter, InPrefix}; use super::float_common::{get_primitive_dec, primitive_to_str_common, FloatAnalysis}; -pub struct Floatf { - as_num: f64, -} +pub struct Floatf; impl Floatf { pub fn new() -> Floatf { - Floatf { as_num: 0.0 } + Floatf } } impl Formatter for Floatf { diff --git a/src/uu/printf/src/tokenize/num_format/formatters/intf.rs b/src/uu/printf/src/tokenize/num_format/formatters/intf.rs index 9231bd027..2e4e67047 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/intf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/intf.rs @@ -11,7 +11,7 @@ use std::i64; use std::u64; pub struct Intf { - a: u32, + _a: u32, } // see the Intf::analyze() function below @@ -24,7 +24,7 @@ struct IntAnalysis { impl Intf { pub fn new() -> Intf { - Intf { a: 0 } + Intf { _a: 0 } } // take a ref to argument string, and basic information // about prefix (offset, radix, sign), and analyze string diff --git a/src/uu/printf/src/tokenize/num_format/formatters/scif.rs b/src/uu/printf/src/tokenize/num_format/formatters/scif.rs index 69a703042..ebac1565e 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/scif.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/scif.rs @@ -5,12 +5,11 @@ use super::super::format_field::FormatField; use super::super::formatter::{FormatPrimitive, Formatter, InPrefix}; use super::float_common::{get_primitive_dec, primitive_to_str_common, FloatAnalysis}; -pub struct Scif { - as_num: f64, -} +pub struct Scif; + impl Scif { pub fn new() -> Scif { - Scif { as_num: 0.0 } + Scif } } impl Formatter for Scif { diff --git a/src/uu/printf/src/tokenize/unescaped_text.rs b/src/uu/printf/src/tokenize/unescaped_text.rs index 3b9f0123e..084014ae9 100644 --- a/src/uu/printf/src/tokenize/unescaped_text.rs +++ b/src/uu/printf/src/tokenize/unescaped_text.rs @@ -242,18 +242,16 @@ impl UnescapedText { } } } -#[allow(unused_variables)] impl token::Tokenizer for UnescapedText { fn from_it( it: &mut PutBackN, - args: &mut Peekable>, + _: &mut Peekable>, ) -> Option> { UnescapedText::from_it_core(it, false) } } -#[allow(unused_variables)] impl token::Token for UnescapedText { - fn print(&self, pf_args_it: &mut Peekable>) { + fn print(&self, _: &mut Peekable>) { cli::flush_bytes(&self.0[..]); } } From 48121daf94217924942a1f3ec07f6413e2dce144 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sat, 17 Apr 2021 22:29:07 +0200 Subject: [PATCH 0352/1135] whoami/id: refactor tests for #1982 --- tests/by-util/test_id.rs | 130 +++++++++++++++++++++-------------- tests/by-util/test_whoami.rs | 67 ++++++++++-------- 2 files changed, 117 insertions(+), 80 deletions(-) diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index 719cfd876..534736a32 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -1,11 +1,32 @@ use crate::common::util::*; +// Apparently some CI environments have configuration issues, e.g. with 'whoami' and 'id'. +// If we are running inside the CI and "needle" is in "stderr" skipping this test is +// considered okay. If we are not inside the CI this calls assert!(result.success). +// +// From the Logs: "Build (ubuntu-18.04, x86_64-unknown-linux-gnu, feat_os_unix, use-cross)" +// stderr: "whoami: cannot find name for user ID 1001" +// Maybe: "adduser --uid 1001 username" can put things right? +// stderr = id: error: Could not find uid 1001: No such id: 1001 +fn skipping_test_is_okay(result: &CmdResult, needle: &str) -> bool { + if !result.succeeded() { + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + if is_ci() && result.stderr_str().contains(needle) { + println!("test skipped:"); + return true; + } else { + result.success(); + } + } + false +} + fn return_whoami_username() -> String { let scene = TestScenario::new("whoami"); let result = scene.cmd("whoami").run(); - if is_ci() && result.stderr.contains("cannot find name for user ID") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + if skipping_test_is_okay(&result, "whoami: cannot find name for user ID") { + println!("test skipped:"); return String::from(""); } @@ -14,40 +35,41 @@ fn return_whoami_username() -> String { #[test] fn test_id() { - let result = new_ucmd!().arg("-u").run(); - if result.stderr.contains("cannot find name for user ID") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + let scene = TestScenario::new(util_name!()); + + let result = scene.ucmd().arg("-u").succeeds(); + let uid = result.stdout_str().trim(); + + let result = scene.ucmd().run(); + if skipping_test_is_okay(&result, "Could not find uid") { return; } - let uid = result.success().stdout_str().trim(); - let result = new_ucmd!().run(); - if is_ci() && result.stderr.contains("cannot find name for user ID") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it - return; - } - - if !result.stderr_str().contains("Could not find uid") { - // Verify that the id found by --user/-u exists in the list - result.success().stdout_contains(&uid); - } + // Verify that the id found by --user/-u exists in the list + result.stdout_contains(uid); } #[test] fn test_id_from_name() { let username = return_whoami_username(); - if username == "" { - // Sometimes, the CI is failing here + if username.is_empty() { + return; + } + + let scene = TestScenario::new(util_name!()); + let result = scene.ucmd().arg(&username).run(); + if skipping_test_is_okay(&result, "Could not find uid") { return; } - let result = new_ucmd!().arg(&username).succeeds(); let uid = result.stdout_str().trim(); - new_ucmd!() - .succeeds() + let result = scene.ucmd().run(); + if skipping_test_is_okay(&result, "Could not find uid") { + return; + } + + result // Verify that the id found by --user/-u exists in the list .stdout_contains(uid) // Verify that the username found by whoami exists in the list @@ -56,48 +78,42 @@ fn test_id_from_name() { #[test] fn test_id_name_from_id() { - let result = new_ucmd!().arg("-u").succeeds(); - let uid = result.stdout_str().trim(); + let result = new_ucmd!().arg("-nu").run(); - let result = new_ucmd!().arg("-nu").arg(uid).run(); - if is_ci() && result.stderr.contains("No such user/group") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + let username_id = result.stdout_str().trim(); + + let username_whoami = return_whoami_username(); + if username_whoami.is_empty() { return; } - let username_id = result.success().stdout_str().trim(); - - let scene = TestScenario::new("whoami"); - let result = scene.cmd("whoami").succeeds(); - - let username_whoami = result.stdout_str().trim(); - assert_eq!(username_id, username_whoami); } #[test] fn test_id_group() { - let mut result = new_ucmd!().arg("-g").succeeds(); + let scene = TestScenario::new(util_name!()); + + let mut result = scene.ucmd().arg("-g").succeeds(); let s1 = result.stdout_str().trim(); assert!(s1.parse::().is_ok()); - result = new_ucmd!().arg("--group").succeeds(); + result = scene.ucmd().arg("--group").succeeds(); let s1 = result.stdout_str().trim(); assert!(s1.parse::().is_ok()); } #[test] fn test_id_groups() { - let result = new_ucmd!().arg("-G").succeeds(); - assert!(result.success); + let scene = TestScenario::new(util_name!()); + + let result = scene.ucmd().arg("-G").succeeds(); let groups = result.stdout_str().trim().split_whitespace(); for s in groups { assert!(s.parse::().is_ok()); } - let result = new_ucmd!().arg("--groups").succeeds(); - assert!(result.success); + let result = scene.ucmd().arg("--groups").succeeds(); let groups = result.stdout_str().trim().split_whitespace(); for s in groups { assert!(s.parse::().is_ok()); @@ -106,11 +122,13 @@ fn test_id_groups() { #[test] fn test_id_user() { - let mut result = new_ucmd!().arg("-u").succeeds(); + let scene = TestScenario::new(util_name!()); + + let result = scene.ucmd().arg("-u").succeeds(); let s1 = result.stdout_str().trim(); assert!(s1.parse::().is_ok()); - result = new_ucmd!().arg("--user").succeeds(); + let result = scene.ucmd().arg("--user").succeeds(); let s1 = result.stdout_str().trim(); assert!(s1.parse::().is_ok()); } @@ -118,28 +136,34 @@ fn test_id_user() { #[test] fn test_id_pretty_print() { let username = return_whoami_username(); - if username == "" { - // Sometimes, the CI is failing here + if username.is_empty() { return; } - let result = new_ucmd!().arg("-p").run(); - if result.stdout_str().trim() == "" { - // Sometimes, the CI is failing here with - // old rust versions on Linux + let scene = TestScenario::new(util_name!()); + let result = scene.ucmd().arg("-p").run(); + if result.stdout_str().trim().is_empty() { + // this fails only on: "MinRustV (ubuntu-latest, feat_os_unix)" + // `rustc 1.40.0 (73528e339 2019-12-16)` + // run: /home/runner/work/coreutils/coreutils/target/debug/coreutils id -p + // thread 'test_id::test_id_pretty_print' panicked at 'Command was expected to succeed. + // stdout = + // stderr = ', tests/common/util.rs:157:13 + println!("test skipped:"); return; } + result.success().stdout_contains(username); } #[test] fn test_id_password_style() { let username = return_whoami_username(); - if username == "" { - // Sometimes, the CI is failing here + if username.is_empty() { return; } let result = new_ucmd!().arg("-P").succeeds(); + assert!(result.stdout_str().starts_with(&username)); } diff --git a/tests/by-util/test_whoami.rs b/tests/by-util/test_whoami.rs index c6ec6990f..dc6a1ceed 100644 --- a/tests/by-util/test_whoami.rs +++ b/tests/by-util/test_whoami.rs @@ -1,50 +1,63 @@ use crate::common::util::*; -use std::env; + +// Apparently some CI environments have configuration issues, e.g. with 'whoami' and 'id'. +// If we are running inside the CI and "needle" is in "stderr" skipping this test is +// considered okay. If we are not inside the CI this calls assert!(result.success). +// +// From the Logs: "Build (ubuntu-18.04, x86_64-unknown-linux-gnu, feat_os_unix, use-cross)" +// stderr: "whoami: error: failed to get username" +// Maybe: "adduser --uid 1001 username" can put things right? +fn skipping_test_is_okay(result: &CmdResult, needle: &str) -> bool { + if !result.succeeded() { + println!("result.stdout = {}", result.stdout_str()); + println!("result.stderr = {}", result.stderr_str()); + if is_ci() && result.stderr_str().contains(needle) { + println!("test skipped:"); + return true; + } else { + result.success(); + } + } + false +} #[test] fn test_normal() { let (_, mut ucmd) = at_and_ucmd!(); let result = ucmd.run(); - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - println!("env::var(CI).is_ok() = {}", env::var("CI").is_ok()); - for (key, value) in env::vars() { - println!("{}: {}", key, value); - } - if is_ci() && result.stderr.contains("failed to get username") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + // use std::env; + // println!("env::var(CI).is_ok() = {}", env::var("CI").is_ok()); + // for (key, value) in env::vars() { + // println!("{}: {}", key, value); + // } + + if skipping_test_is_okay(&result, "failed to get username") { return; } - assert!(result.success); - assert!(!result.stdout.trim().is_empty()); + result.no_stderr(); + assert!(!result.stdout_str().trim().is_empty()); } #[test] #[cfg(not(windows))] fn test_normal_compare_id() { - let (_, mut ucmd) = at_and_ucmd!(); + let scene = TestScenario::new(util_name!()); - let result = ucmd.run(); - - println!("result.stdout = {}", result.stdout); - println!("result.stderr = {}", result.stderr); - if is_ci() && result.stderr.contains("failed to get username") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + let result_ucmd = scene.ucmd().run(); + if skipping_test_is_okay(&result_ucmd, "failed to get username") { return; } - assert!(result.success); - let ts = TestScenario::new("id"); - let id = ts.cmd("id").arg("-un").run(); - if is_ci() && id.stderr.contains("cannot find name for user ID") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + let result_cmd = scene.cmd("id").arg("-un").run(); + if skipping_test_is_okay(&result_cmd, "cannot find name for user ID") { return; } - assert_eq!(result.stdout.trim(), id.stdout.trim()); + + assert_eq!( + result_ucmd.stdout_str().trim(), + result_cmd.stdout_str().trim() + ); } From 519b9d34a68ccd282c6f47235e060d5783783173 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 17 Apr 2021 22:40:13 +0200 Subject: [PATCH 0353/1135] sort: use unstable sort when possible (#2076) * sort: use unstable sort when possible This results in a very minor performance (speed) improvement. It does however result in a memory usage reduction, because unstable sort does not allocate auxiliary memory. There's also an improvement in overall CPU usage. * add benchmarking instructions * add user time * fix typo --- src/uu/sort/BENCHMARKING.md | 41 +++++++++++++++++++++++++++++++++++++ src/uu/sort/src/sort.rs | 6 +++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/uu/sort/BENCHMARKING.md b/src/uu/sort/BENCHMARKING.md index 78c2e2b2d..1caea0326 100644 --- a/src/uu/sort/BENCHMARKING.md +++ b/src/uu/sort/BENCHMARKING.md @@ -90,3 +90,44 @@ duplicate the string you passed to hyperfine but remove the `target/release/core Example: `hyperfine "target/release/coreutils sort shuffled_numbers_si.txt -h -o output.txt"` becomes `hyperfine "target/release/coreutils sort shuffled_numbers_si.txt -h -o output.txt" "sort shuffled_numbers_si.txt -h -o output.txt"` (This assumes GNU sort is installed as `sort`) + +## Memory and CPU usage + +The above benchmarks use hyperfine to measure the speed of sorting. There are however other useful metrics to determine overall +resource usage. One way to measure them is the `time` command. This is not to be confused with the `time` that is built in to the bash shell. +You may have to install `time` first, then you have to run it with `/bin/time -v` to give it precedence over the built in `time`. + +
+ Example output + + Command being timed: "target/release/coreutils sort shuffled_numbers.txt" + User time (seconds): 0.10 + System time (seconds): 0.00 + Percent of CPU this job got: 365% + Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.02 + Average shared text size (kbytes): 0 + Average unshared data size (kbytes): 0 + Average stack size (kbytes): 0 + Average total size (kbytes): 0 + Maximum resident set size (kbytes): 25360 + Average resident set size (kbytes): 0 + Major (requiring I/O) page faults: 0 + Minor (reclaiming a frame) page faults: 5802 + Voluntary context switches: 462 + Involuntary context switches: 73 + Swaps: 0 + File system inputs: 1184 + File system outputs: 0 + Socket messages sent: 0 + Socket messages received: 0 + Signals delivered: 0 + Page size (bytes): 4096 + Exit status: 0 + +
+ +Useful metrics to look at could be: + +- User time +- Percent of CPU this job got +- Maximum resident set size diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index c097861fc..07b852921 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -985,7 +985,11 @@ fn exec_check_file(unwrapped_lines: &[Line], settings: &GlobalSettings) -> i32 { } fn sort_by(lines: &mut Vec, settings: &GlobalSettings) { - lines.par_sort_by(|a, b| compare_by(a, b, &settings)) + if settings.stable || settings.unique { + lines.par_sort_by(|a, b| compare_by(a, b, &settings)) + } else { + lines.par_sort_unstable_by(|a, b| compare_by(a, b, &settings)) + } } fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering { From b91fadd8f4f18ef861da155434f5a9f707c73234 Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Sun, 18 Apr 2021 02:28:06 +0300 Subject: [PATCH 0354/1135] Refactored tests for more utilities --- tests/by-util/test_hostid.rs | 6 +----- tests/by-util/test_hostname.rs | 4 +--- tests/by-util/test_nproc.rs | 34 ++++++++++++----------------- tests/by-util/test_pinky.rs | 2 +- tests/by-util/test_printenv.rs | 16 +++++++------- tests/by-util/test_readlink.rs | 15 ++++++++----- tests/by-util/test_sort.rs | 14 ++++++------ tests/by-util/test_sync.rs | 19 ++++++++++------- tests/by-util/test_tsort.rs | 4 ++-- tests/by-util/test_uname.rs | 39 +++++++++------------------------- tests/by-util/test_uptime.rs | 26 +++++++---------------- tests/by-util/test_users.rs | 13 +++++------- 12 files changed, 77 insertions(+), 115 deletions(-) diff --git a/tests/by-util/test_hostid.rs b/tests/by-util/test_hostid.rs index b5b668901..3ea818480 100644 --- a/tests/by-util/test_hostid.rs +++ b/tests/by-util/test_hostid.rs @@ -4,10 +4,6 @@ use self::regex::Regex; #[test] fn test_normal() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.run(); - - assert!(result.success); let re = Regex::new(r"^[0-9a-f]{8}").unwrap(); - assert!(re.is_match(&result.stdout_str())); + new_ucmd!().succeeds().stdout_matches(&re); } diff --git a/tests/by-util/test_hostname.rs b/tests/by-util/test_hostname.rs index c9dc99040..3fcb1ae8b 100644 --- a/tests/by-util/test_hostname.rs +++ b/tests/by-util/test_hostname.rs @@ -14,9 +14,7 @@ fn test_hostname() { #[cfg(not(target_vendor = "apple"))] #[test] fn test_hostname_ip() { - let result = new_ucmd!().arg("-i").run(); - println!("{:#?}", result); - assert!(result.success); + let result = new_ucmd!().arg("-i").succeeds(); assert!(!result.stdout_str().trim().is_empty()); } diff --git a/tests/by-util/test_nproc.rs b/tests/by-util/test_nproc.rs index 055b4890d..abf758829 100644 --- a/tests/by-util/test_nproc.rs +++ b/tests/by-util/test_nproc.rs @@ -2,54 +2,46 @@ use crate::common::util::*; #[test] fn test_nproc() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.run(); - assert!(result.success); - let nproc: u8 = result.stdout.trim().parse().unwrap(); + let nproc: u8 = new_ucmd!().succeeds().stdout_str().trim().parse().unwrap(); assert!(nproc > 0); } #[test] fn test_nproc_all_omp() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("--all").run(); - assert!(result.success); - let nproc: u8 = result.stdout.trim().parse().unwrap(); + let result = new_ucmd!().arg("--all").succeeds(); + + let nproc: u8 = result.stdout_str().trim().parse().unwrap(); assert!(nproc > 0); let result = TestScenario::new(util_name!()) .ucmd_keepenv() .env("OMP_NUM_THREADS", "1") - .run(); - assert!(result.success); - let nproc_omp: u8 = result.stdout.trim().parse().unwrap(); + .succeeds(); + + let nproc_omp: u8 = result.stdout_str().trim().parse().unwrap(); assert!(nproc - 1 == nproc_omp); let result = TestScenario::new(util_name!()) .ucmd_keepenv() .env("OMP_NUM_THREADS", "1") // Has no effect .arg("--all") - .run(); - assert!(result.success); - let nproc_omp: u8 = result.stdout.trim().parse().unwrap(); + .succeeds(); + let nproc_omp: u8 = result.stdout_str().trim().parse().unwrap(); assert!(nproc == nproc_omp); } #[test] fn test_nproc_ignore() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.run(); - assert!(result.success); - let nproc: u8 = result.stdout.trim().parse().unwrap(); + let result = new_ucmd!().succeeds(); + let nproc: u8 = result.stdout_str().trim().parse().unwrap(); if nproc > 1 { // Ignore all CPU but one let result = TestScenario::new(util_name!()) .ucmd_keepenv() .arg("--ignore") .arg((nproc - 1).to_string()) - .run(); - assert!(result.success); - let nproc: u8 = result.stdout.trim().parse().unwrap(); + .succeeds(); + let nproc: u8 = result.stdout_str().trim().parse().unwrap(); assert!(nproc == 1); } } diff --git a/tests/by-util/test_pinky.rs b/tests/by-util/test_pinky.rs index 161054b2c..7a4a3f3df 100644 --- a/tests/by-util/test_pinky.rs +++ b/tests/by-util/test_pinky.rs @@ -75,5 +75,5 @@ fn expected_result(args: &[&str]) -> String { .env("LANGUAGE", "C") .args(args) .run() - .stdout + .stdout_move_str() } diff --git a/tests/by-util/test_printenv.rs b/tests/by-util/test_printenv.rs index 9d90051ea..bc0bc0f3c 100644 --- a/tests/by-util/test_printenv.rs +++ b/tests/by-util/test_printenv.rs @@ -7,10 +7,11 @@ fn test_get_all() { env::set_var(key, "VALUE"); assert_eq!(env::var(key), Ok("VALUE".to_string())); - let result = TestScenario::new(util_name!()).ucmd_keepenv().run(); - assert!(result.success); - assert!(result.stdout.contains("HOME=")); - assert!(result.stdout.contains("KEY=VALUE")); + TestScenario::new(util_name!()) + .ucmd_keepenv() + .succeeds() + .stdout_contains("HOME=") + .stdout_contains("KEY=VALUE"); } #[test] @@ -22,9 +23,8 @@ fn test_get_var() { let result = TestScenario::new(util_name!()) .ucmd_keepenv() .arg("KEY") - .run(); + .succeeds(); - assert!(result.success); - assert!(!result.stdout.is_empty()); - assert!(result.stdout.trim() == "VALUE"); + assert!(!result.stdout_str().is_empty()); + assert!(result.stdout_str().trim() == "VALUE"); } diff --git a/tests/by-util/test_readlink.rs b/tests/by-util/test_readlink.rs index 84747b24c..cae5eafee 100644 --- a/tests/by-util/test_readlink.rs +++ b/tests/by-util/test_readlink.rs @@ -5,7 +5,7 @@ static GIBBERISH: &'static str = "supercalifragilisticexpialidocious"; #[test] fn test_canonicalize() { let (at, mut ucmd) = at_and_ucmd!(); - let actual = ucmd.arg("-f").arg(".").run().stdout; + let actual = ucmd.arg("-f").arg(".").run().stdout_move_str(); let expect = at.root_dir_resolved() + "\n"; println!("actual: {:?}", actual); println!("expect: {:?}", expect); @@ -15,7 +15,7 @@ fn test_canonicalize() { #[test] fn test_canonicalize_existing() { let (at, mut ucmd) = at_and_ucmd!(); - let actual = ucmd.arg("-e").arg(".").run().stdout; + let actual = ucmd.arg("-e").arg(".").run().stdout_move_str(); let expect = at.root_dir_resolved() + "\n"; println!("actual: {:?}", actual); println!("expect: {:?}", expect); @@ -25,7 +25,7 @@ fn test_canonicalize_existing() { #[test] fn test_canonicalize_missing() { let (at, mut ucmd) = at_and_ucmd!(); - let actual = ucmd.arg("-m").arg(GIBBERISH).run().stdout; + let actual = ucmd.arg("-m").arg(GIBBERISH).run().stdout_move_str(); let expect = path_concat!(at.root_dir_resolved(), GIBBERISH) + "\n"; println!("actual: {:?}", actual); println!("expect: {:?}", expect); @@ -37,7 +37,7 @@ fn test_long_redirection_to_current_dir() { let (at, mut ucmd) = at_and_ucmd!(); // Create a 256-character path to current directory let dir = path_concat!(".", ..128); - let actual = ucmd.arg("-n").arg("-m").arg(dir).run().stdout; + let actual = ucmd.arg("-n").arg("-m").arg(dir).run().stdout_move_str(); let expect = at.root_dir_resolved(); println!("actual: {:?}", actual); println!("expect: {:?}", expect); @@ -48,7 +48,12 @@ fn test_long_redirection_to_current_dir() { fn test_long_redirection_to_root() { // Create a 255-character path to root let dir = path_concat!("..", ..85); - let actual = new_ucmd!().arg("-n").arg("-m").arg(dir).run().stdout; + let actual = new_ucmd!() + .arg("-n") + .arg("-m") + .arg(dir) + .run() + .stdout_move_str(); let expect = get_root_path(); println!("actual: {:?}", actual); println!("expect: {:?}", expect); diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index aacc34eb0..a4a9a383c 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -65,7 +65,7 @@ fn test_random_shuffle_len() { // check whether output is the same length as the input const FILE: &'static str = "default_unsorted_ints.expected"; let (at, _ucmd) = at_and_ucmd!(); - let result = new_ucmd!().arg("-R").arg(FILE).run().stdout; + let result = new_ucmd!().arg("-R").arg(FILE).run().stdout_move_str(); let expected = at.read(FILE); assert_ne!(result, expected); @@ -77,9 +77,9 @@ fn test_random_shuffle_contains_all_lines() { // check whether lines of input are all in output const FILE: &'static str = "default_unsorted_ints.expected"; let (at, _ucmd) = at_and_ucmd!(); - let result = new_ucmd!().arg("-R").arg(FILE).run().stdout; + let result = new_ucmd!().arg("-R").arg(FILE).run().stdout_move_str(); let expected = at.read(FILE); - let result_sorted = new_ucmd!().pipe_in(result.clone()).run().stdout; + let result_sorted = new_ucmd!().pipe_in(result.clone()).run().stdout_move_str(); assert_ne!(result, expected); assert_eq!(result_sorted, expected); @@ -92,9 +92,9 @@ fn test_random_shuffle_two_runs_not_the_same() { // as the starting order, or if both random sorts end up having the same order. const FILE: &'static str = "default_unsorted_ints.expected"; let (at, _ucmd) = at_and_ucmd!(); - let result = new_ucmd!().arg("-R").arg(FILE).run().stdout; + let result = new_ucmd!().arg("-R").arg(FILE).run().stdout_move_str(); let expected = at.read(FILE); - let unexpected = new_ucmd!().arg("-R").arg(FILE).run().stdout; + let unexpected = new_ucmd!().arg("-R").arg(FILE).run().stdout_move_str(); assert_ne!(result, expected); assert_ne!(result, unexpected); @@ -107,9 +107,9 @@ fn test_random_shuffle_contains_two_runs_not_the_same() { // as the starting order, or if both random sorts end up having the same order. const FILE: &'static str = "default_unsorted_ints.expected"; let (at, _ucmd) = at_and_ucmd!(); - let result = new_ucmd!().arg("-R").arg(FILE).run().stdout; + let result = new_ucmd!().arg("-R").arg(FILE).run().stdout_move_str(); let expected = at.read(FILE); - let unexpected = new_ucmd!().arg("-R").arg(FILE).run().stdout; + let unexpected = new_ucmd!().arg("-R").arg(FILE).run().stdout_move_str(); assert_ne!(result, expected); assert_ne!(result, unexpected); diff --git a/tests/by-util/test_sync.rs b/tests/by-util/test_sync.rs index ddd6969a3..436bfdef3 100644 --- a/tests/by-util/test_sync.rs +++ b/tests/by-util/test_sync.rs @@ -5,8 +5,7 @@ use tempfile::tempdir; #[test] fn test_sync_default() { - let result = new_ucmd!().run(); - assert!(result.success); + new_ucmd!().succeeds(); } #[test] @@ -18,8 +17,10 @@ fn test_sync_incorrect_arg() { fn test_sync_fs() { let temporary_directory = tempdir().unwrap(); let temporary_path = fs::canonicalize(temporary_directory.path()).unwrap(); - let result = new_ucmd!().arg("--file-system").arg(&temporary_path).run(); - assert!(result.success); + new_ucmd!() + .arg("--file-system") + .arg(&temporary_path) + .succeeds(); } #[test] @@ -27,12 +28,14 @@ fn test_sync_data() { // Todo add a second arg let temporary_directory = tempdir().unwrap(); let temporary_path = fs::canonicalize(temporary_directory.path()).unwrap(); - let result = new_ucmd!().arg("--data").arg(&temporary_path).run(); - assert!(result.success); + new_ucmd!().arg("--data").arg(&temporary_path).succeeds(); } #[test] fn test_sync_no_existing_files() { - let result = new_ucmd!().arg("--data").arg("do-no-exist").fails(); - assert!(result.stderr.contains("error: cannot stat")); + new_ucmd!() + .arg("--data") + .arg("do-no-exist") + .fails() + .stderr_contains("error: cannot stat"); } diff --git a/tests/by-util/test_tsort.rs b/tests/by-util/test_tsort.rs index 159b80025..0ea6de281 100644 --- a/tests/by-util/test_tsort.rs +++ b/tests/by-util/test_tsort.rs @@ -28,7 +28,7 @@ fn test_version_flag() { let version_short = new_ucmd!().arg("-V").run(); let version_long = new_ucmd!().arg("--version").run(); - assert_eq!(version_short.stdout, version_long.stdout); + assert_eq!(version_short.stdout(), version_long.stdout()); } #[test] @@ -36,7 +36,7 @@ fn test_help_flag() { let help_short = new_ucmd!().arg("-h").run(); let help_long = new_ucmd!().arg("--help").run(); - assert_eq!(help_short.stdout, help_long.stdout); + assert_eq!(help_short.stdout(), help_long.stdout()); } #[test] diff --git a/tests/by-util/test_uname.rs b/tests/by-util/test_uname.rs index f0e32b430..6b8d2d59d 100644 --- a/tests/by-util/test_uname.rs +++ b/tests/by-util/test_uname.rs @@ -2,60 +2,41 @@ use crate::common::util::*; #[test] fn test_uname_compatible() { - let (_, mut ucmd) = at_and_ucmd!(); - - let result = ucmd.arg("-a").run(); - assert!(result.success); + new_ucmd!().arg("-a").succeeds(); } #[test] fn test_uname_name() { - let (_, mut ucmd) = at_and_ucmd!(); - - let result = ucmd.arg("-n").run(); - assert!(result.success); + new_ucmd!().arg("-n").succeeds(); } #[test] fn test_uname_processor() { - let (_, mut ucmd) = at_and_ucmd!(); - - let result = ucmd.arg("-p").run(); - assert!(result.success); - assert_eq!(result.stdout.trim_end(), "unknown"); + let result = new_ucmd!().arg("-p").succeeds(); + assert_eq!(result.stdout_str().trim_end(), "unknown"); } #[test] fn test_uname_hwplatform() { - let (_, mut ucmd) = at_and_ucmd!(); - - let result = ucmd.arg("-i").run(); - assert!(result.success); - assert_eq!(result.stdout.trim_end(), "unknown"); + let result = new_ucmd!().arg("-i").succeeds(); + assert_eq!(result.stdout_str().trim_end(), "unknown"); } #[test] fn test_uname_machine() { - let (_, mut ucmd) = at_and_ucmd!(); - - let result = ucmd.arg("-m").run(); - assert!(result.success); + new_ucmd!().arg("-m").succeeds(); } #[test] fn test_uname_kernel_version() { - let (_, mut ucmd) = at_and_ucmd!(); - - let result = ucmd.arg("-v").run(); - assert!(result.success); + new_ucmd!().arg("-v").succeeds(); } #[test] fn test_uname_kernel() { let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("-o").run(); - assert!(result.success); + let result = ucmd.arg("-o").succeeds(); #[cfg(target_os = "linux")] - assert!(result.stdout.to_lowercase().contains("linux")); + assert!(result.stdout_str().to_lowercase().contains("linux")); } diff --git a/tests/by-util/test_uptime.rs b/tests/by-util/test_uptime.rs index c8f6a11d3..d20ad90c9 100644 --- a/tests/by-util/test_uptime.rs +++ b/tests/by-util/test_uptime.rs @@ -4,33 +4,23 @@ use crate::common::util::*; #[test] fn test_uptime() { - let result = TestScenario::new(util_name!()).ucmd_keepenv().run(); + TestScenario::new(util_name!()) + .ucmd_keepenv() + .succeeds() + .stdout_contains("load average:") + .stdout_contains(" up "); - println!("stdout = {}", result.stdout); - println!("stderr = {}", result.stderr); - - assert!(result.success); - assert!(result.stdout.contains("load average:")); - assert!(result.stdout.contains(" up ")); // Don't check for users as it doesn't show in some CI } #[test] fn test_uptime_since() { - let scene = TestScenario::new(util_name!()); - - let result = scene.ucmd().arg("--since").succeeds(); - - println!("stdout = {}", result.stdout); - println!("stderr = {}", result.stderr); - - assert!(result.success); let re = Regex::new(r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}").unwrap(); - assert!(re.is_match(&result.stdout.trim())); + + new_ucmd!().arg("--since").succeeds().stdout_matches(&re); } #[test] fn test_failed() { - let (_at, mut ucmd) = at_and_ucmd!(); - ucmd.arg("willfail").fails(); + new_ucmd!().arg("willfail").fails(); } diff --git a/tests/by-util/test_users.rs b/tests/by-util/test_users.rs index cb444b8be..3c5789820 100644 --- a/tests/by-util/test_users.rs +++ b/tests/by-util/test_users.rs @@ -3,14 +3,11 @@ use std::env; #[test] fn test_users_noarg() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.run(); - assert!(result.success); + new_ucmd!().succeeds(); } #[test] fn test_users_check_name() { - let result = TestScenario::new(util_name!()).ucmd_keepenv().run(); - assert!(result.success); + let result = TestScenario::new(util_name!()).ucmd_keepenv().succeeds(); // Expectation: USER is often set let key = "USER"; @@ -21,9 +18,9 @@ fn test_users_check_name() { // Check if "users" contains the name of the user { println!("username found {}", &username); - println!("result.stdout {}", &result.stdout); - if !&result.stdout.is_empty() { - assert!(result.stdout.contains(&username)) + // println!("result.stdout {}", &result.stdout); + if !result.stdout_str().is_empty() { + result.stdout_contains(&username); } } } From 93b03bf9a608ef0602ab29b6fa6796171a8e46c1 Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Sun, 18 Apr 2021 02:33:52 +0300 Subject: [PATCH 0355/1135] Ran cargo fmt --- tests/by-util/test_cksum.rs | 8 +++++--- tests/by-util/test_mktemp.rs | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/by-util/test_cksum.rs b/tests/by-util/test_cksum.rs index c8e60f8a9..592e45c58 100644 --- a/tests/by-util/test_cksum.rs +++ b/tests/by-util/test_cksum.rs @@ -62,14 +62,16 @@ fn test_invalid_file() { let folder_name = "asdf"; // First check when file doesn't exist - ts.ucmd().arg(folder_name) + ts.ucmd() + .arg(folder_name) .fails() .no_stdout() .stderr_contains("cksum: error: 'asdf' No such file or directory"); - + // Then check when the file is of an invalid type at.mkdir(folder_name); - ts.ucmd().arg(folder_name) + ts.ucmd() + .arg(folder_name) .fails() .no_stdout() .stderr_contains("cksum: error: 'asdf' Is a directory"); diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index aa3ff5f1f..c273c407c 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -388,8 +388,7 @@ fn test_mktemp_tmpdir_one_arg() { .arg("--tmpdir") .arg("apt-key-gpghome.XXXXXXXXXX") .succeeds(); - result.no_stderr() - .stdout_contains("apt-key-gpghome."); + result.no_stderr().stdout_contains("apt-key-gpghome."); assert!(PathBuf::from(result.stdout_str().trim()).is_file()); } From df2dcc5b998e321881ca4c83c0fb67053cf1afe8 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sat, 17 Apr 2021 23:20:19 +0200 Subject: [PATCH 0356/1135] chown: fix parse_spec() for colon (#2060) --- src/uu/chown/src/chown.rs | 14 +++++----- tests/by-util/test_chown.rs | 54 ++++++++++++++++++++++++++++--------- 2 files changed, 49 insertions(+), 19 deletions(-) diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index 0e3273b3b..23fb030ba 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -272,16 +272,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } fn parse_spec(spec: &str) -> Result<(Option, Option), String> { - let args = spec.split(':').collect::>(); - let usr_only = args.len() == 1; - let grp_only = args.len() == 2 && args[0].is_empty() && !args[1].is_empty(); + let args = spec.split_terminator(':').collect::>(); + let usr_only = args.len() == 1 && !args[0].is_empty(); + let grp_only = args.len() == 2 && args[0].is_empty(); let usr_grp = args.len() == 2 && !args[0].is_empty() && !args[1].is_empty(); if usr_only { Ok(( Some(match Passwd::locate(args[0]) { Ok(v) => v.uid(), - _ => return Err(format!("invalid user: '{}'", spec)), + _ => return Err(format!("invalid user: ‘{}’", spec)), }), None, )) @@ -290,18 +290,18 @@ fn parse_spec(spec: &str) -> Result<(Option, Option), String> { None, Some(match Group::locate(args[1]) { Ok(v) => v.gid(), - _ => return Err(format!("invalid group: '{}'", spec)), + _ => return Err(format!("invalid group: ‘{}’", spec)), }), )) } else if usr_grp { Ok(( Some(match Passwd::locate(args[0]) { Ok(v) => v.uid(), - _ => return Err(format!("invalid user: '{}'", spec)), + _ => return Err(format!("invalid user: ‘{}’", spec)), }), Some(match Group::locate(args[1]) { Ok(v) => v.gid(), - _ => return Err(format!("invalid group: '{}'", spec)), + _ => return Err(format!("invalid group: ‘{}’", spec)), }), )) } else { diff --git a/tests/by-util/test_chown.rs b/tests/by-util/test_chown.rs index 4ec9d60f8..3d94632a6 100644 --- a/tests/by-util/test_chown.rs +++ b/tests/by-util/test_chown.rs @@ -9,9 +9,15 @@ extern crate chown; // considered okay. If we are not inside the CI this calls assert!(result.success). // // From the Logs: "Build (ubuntu-18.04, x86_64-unknown-linux-gnu, feat_os_unix, use-cross)" +// // stderr: "whoami: cannot find name for user ID 1001" -// Maybe: "adduser --uid 1001 username" can put things right? +// TODO: Maybe `adduser --uid 1001 username` can put things right? +// // stderr: "id: cannot find name for group ID 116" +// stderr: "thread 'main' panicked at 'called `Result::unwrap()` on an `Err` +// value: Custom { kind: NotFound, error: "No such id: 1001" }', +// /project/src/uucore/src/lib/features/perms.rs:176:44" +// fn skipping_test_is_okay(result: &CmdResult, needle: &str) -> bool { if !result.succeeded() { println!("result.stdout = {}", result.stdout_str()); @@ -128,26 +134,50 @@ fn test_chown_only_owner_colon() { .arg(format!("{}:", user_name)) .arg("--verbose") .arg(file1) - .run(); + .succeeds() + .stderr_contains(&"retained as"); - // scene // TODO: uncomment once #2060 is fixed - // .ucmd() - // .arg("root:") - // .arg("--verbose") - // .arg(file1) - // .fails() - // .stderr_contains(&"failed to change"); + scene + .ucmd() + .arg("root:") + .arg("--verbose") + .arg(file1) + .fails() + .stderr_contains(&"failed to change"); } #[test] fn test_chown_only_colon() { // test chown : file.txt - // TODO: implement once #2060 is fixed + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let file1 = "test_chown_file1"; + at.touch(file1); + // expected: // $ chown -v : file.txt 2>out_err ; echo $? ; cat out_err // ownership of 'file.txt' retained // 0 + let result = scene.ucmd().arg(":").arg("--verbose").arg(file1).run(); + if skipping_test_is_okay(&result, "No such id") { + return; + } + result.stderr_contains(&"retained as"); // TODO: verbose is not printed to stderr in GNU chown + + // test chown : file.txt + // expected: + // $ chown -v :: file.txt 2>out_err ; echo $? ; cat out_err + // 1 + // chown: invalid group: ‘::’ + scene + .ucmd() + .arg("::") + .arg("--verbose") + .arg(file1) + .fails() + .stderr_contains(&"invalid group: ‘::’"); } #[test] @@ -479,8 +509,8 @@ fn test_big_p() { .arg("bin") .arg("/proc/self/cwd") .fails() - .stderr_is( - "chown: changing ownership of '/proc/self/cwd': Operation not permitted (os error 1)\n", + .stderr_contains( + "chown: changing ownership of '/proc/self/cwd': Operation not permitted (os error 1)", ); } } From 826b6004708f3fcfcb07cfb977c5e9933fb986cc Mon Sep 17 00:00:00 2001 From: Denis Isidoro Date: Sat, 17 Apr 2021 21:14:05 -0300 Subject: [PATCH 0357/1135] Fix typo in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 76ea92ab5..12dfb5609 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ $ cargo build --features "base32 cat echo rm" --no-default-features If you don't want to build the multicall binary and would prefer to build the utilities as individual binaries, that is also possible. Each utility -is contained in it's own package within the main repository, named +is contained in its own package within the main repository, named "uu_UTILNAME". To build individual utilities, use cargo to build just the specific packages (using the `--package` [aka `-p`] option). For example: From 65e9c7b1b54cbeeed39c508c47992786d37b077d Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sat, 17 Apr 2021 21:30:03 -0500 Subject: [PATCH 0358/1135] Sorta working ExtSort - concat struct elements --- src/uu/sort/src/numeric_str_cmp.rs | 7 ++++--- src/uu/sort/src/sort.rs | 27 +++++++++++++++++---------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/uu/sort/src/numeric_str_cmp.rs b/src/uu/sort/src/numeric_str_cmp.rs index a50734ebd..ac615d1f7 100644 --- a/src/uu/sort/src/numeric_str_cmp.rs +++ b/src/uu/sort/src/numeric_str_cmp.rs @@ -15,19 +15,20 @@ //! From that follows the constraints of this algorithm: It is able to compare numbers in ±(1*10^[i64::MIN]..10*10^[i64::MAX]). use std::{cmp::Ordering, ops::Range}; +use serde::{Serialize, Deserialize}; -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, Clone)] enum Sign { Negative, Positive, } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] pub struct NumInfo { exponent: i64, sign: Sign, } - +#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] pub struct NumInfoParseSettings { pub accept_si_units: bool, pub thousands_separator: Option, diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index b355c1e68..1e533cf65 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -176,6 +176,7 @@ impl From<&GlobalSettings> for KeySettings { } } +#[derive(Debug, Serialize, Deserialize, Clone)] /// Represents the string selected by a FieldSelector. enum SelectionRange { /// If we had to transform this selection, we have to store a new string. @@ -206,7 +207,7 @@ impl SelectionRange { } } } - +#[derive(Debug, Serialize, Deserialize, Clone)] enum NumCache { AsF64(f64), WithInfo(NumInfo), @@ -227,7 +228,7 @@ impl NumCache { } } } - +#[derive(Debug, Serialize, Deserialize, Clone)] struct Selection { range: SelectionRange, num_cache: NumCache, @@ -241,7 +242,7 @@ impl Selection { } type Field = Range; - +#[derive(Debug, Serialize, Deserialize, Clone)] struct Line { line: String, // The common case is not to specify fields. Let's make this fast. @@ -251,7 +252,7 @@ struct Line { impl Sortable for Line { fn encode(&self, write: &mut W) { - let line = Line {line: self.line.clone(), selections: self.selections.clone()}; + let line = Line {line: self.line.to_owned(), selections: self.selections.to_owned() }; let serialized = serde_json::ser::to_string(&line).unwrap(); write.write_all(format!("{}{}", serialized, "\n").as_bytes()).unwrap(); } @@ -259,11 +260,17 @@ impl Sortable for Line { fn decode(read: &mut R) -> Option { let buf_reader = BufReader::new(read); - let mut result: Option = None; - for line in buf_reader.lines() { - let line_as_str: Line = serde_json::de::from_str(&line.unwrap()).unwrap(); - result = Some( Line {line: line_as_str.line, selections: line_as_str.selections} ); - } + let result = { + let mut line_joined= String::new(); + let mut selections_joined= SmallVec::new(); + for line in buf_reader.lines() { + let mut deserialized_line: Line = serde_json::de::from_str(&line.unwrap()).unwrap(); + line_joined = format!("{}\n{}", line_joined, deserialized_line.line); + selections_joined.append(&mut deserialized_line.selections); + selections_joined.dedup(); + } + Some( Line {line: line_joined, selections: selections_joined} ) + }; result } } @@ -286,7 +293,7 @@ impl Line { .iter() .map(|selector| { let mut range = - if let Some(range) = selector.get_selection(&line, fields.as_deref()) { + if let Some(range) = selector.get_field_selection(&line, fields.as_deref()) { if let Some(transformed) = transform(&line[range.to_owned()], &selector.settings) { From 7a8767e359433044ae1e9428b85fa05e93a78caa Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sat, 17 Apr 2021 22:34:03 -0500 Subject: [PATCH 0359/1135] Cleanup --- src/uu/sort/src/sort.rs | 46 +++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 1e533cf65..ce6ba8fa7 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -43,6 +43,7 @@ use std::ffi::OsString; use std::usize; use std::path::PathBuf; use std::string::*; +use rayon::prelude::*; static NAME: &str = "sort"; static ABOUT: &str = "Display sorted concatenation of all FILE(s)."; @@ -92,6 +93,9 @@ static THOUSANDS_SEP: char = ','; static NEGATIVE: char = '-'; static POSITIVE: char = '+'; +static DEFAULT_TMPDIR: &str = r"/tmp"; +static DEFAULT_BUF_SIZE: usize = 10000000usize; + #[derive(Eq, Ord, PartialEq, PartialOrd, Clone)] enum SortMode { Numeric, @@ -146,8 +150,8 @@ impl Default for GlobalSettings { separator: None, threads: String::new(), zero_terminated: false, - buffer_size: 10000000usize, - tmp_dir: PathBuf::from(r"/tmp"), + buffer_size: DEFAULT_BUF_SIZE, + tmp_dir: PathBuf::from(DEFAULT_TMPDIR), } } } @@ -242,7 +246,7 @@ impl Selection { } type Field = Range; -#[derive(Debug, Serialize, Deserialize, Clone)] +#[derive(Debug, Serialize, Deserialize)] struct Line { line: String, // The common case is not to specify fields. Let's make this fast. @@ -250,16 +254,20 @@ struct Line { } impl Sortable for Line { - fn encode(&self, write: &mut W) { let line = Line {line: self.line.to_owned(), selections: self.selections.to_owned() }; let serialized = serde_json::ser::to_string(&line).unwrap(); + // Valid JSON needs to be seperated by something, so here we use a newline write.write_all(format!("{}{}", serialized, "\n").as_bytes()).unwrap(); } + // This crate asks us to write one line at a time, but returns multiple lines(?). + // However, this crate also expects us to return a result of Option, + // so we concat the these lines into a single Option. So, this may be broken, + // and needs to be tested more thoroughly. Perhaps we need to rethink our struct or rewrite a + // ext sorter ourselves. fn decode(read: &mut R) -> Option { let buf_reader = BufReader::new(read); - let result = { let mut line_joined= String::new(); let mut selections_joined= SmallVec::new(); @@ -267,7 +275,6 @@ impl Sortable for Line { let mut deserialized_line: Line = serde_json::de::from_str(&line.unwrap()).unwrap(); line_joined = format!("{}\n{}", line_joined, deserialized_line.line); selections_joined.append(&mut deserialized_line.selections); - selections_joined.dedup(); } Some( Line {line: line_joined, selections: selections_joined} ) }; @@ -869,16 +876,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.buffer_size = matches .value_of(OPT_BUF_SIZE) .map(String::from) - .unwrap_or( format! ( "{}", 10000000usize ) ) + .unwrap_or( format! ( "{}", DEFAULT_BUF_SIZE ) ) .parse::() - .unwrap_or(10000000usize); + .unwrap_or( DEFAULT_BUF_SIZE ); } if matches.is_present(OPT_TMP_DIR) { let result = matches .value_of(OPT_TMP_DIR) .map(String::from) - .unwrap_or("/tmp".to_owned() ); + .unwrap_or(DEFAULT_TMPDIR.to_owned() ); settings.tmp_dir = PathBuf::from(format!(r"{}", result)); } else { for (key, value) in env::vars_os() { @@ -886,7 +893,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.tmp_dir = PathBuf::from(format!(r"{}", value.into_string().unwrap_or("/tmp".to_owned()))); break } - settings.tmp_dir = PathBuf::from(r"/tmp"); + settings.tmp_dir = PathBuf::from(DEFAULT_TMPDIR); } } @@ -1008,7 +1015,11 @@ fn exec(files: Vec, settings: &GlobalSettings) -> i32 { return exec_check_file(&lines, &settings); } - lines = sort_by(lines, &settings); + if ( settings.buffer_size != DEFAULT_BUF_SIZE ) || ( settings.tmp_dir.as_os_str() != DEFAULT_TMPDIR ) { + lines = ext_sort_by(lines, &settings); + } else { + sort_by(&mut lines, &settings); + } if settings.merge { if settings.unique { @@ -1063,9 +1074,18 @@ fn exec_check_file(unwrapped_lines: &[Line], settings: &GlobalSettings) -> i32 { } } -fn sort_by(lines: Vec, settings: &GlobalSettings) -> Vec { +fn ext_sort_by(lines: Vec, settings: &GlobalSettings) -> Vec { let sorter = ExternalSorter::new().with_segment_size(settings.buffer_size).with_sort_dir(settings.tmp_dir.clone()).with_parallel_sort(); - sorter.sort_by(lines.into_iter(), |a, b| compare_by(a, b, &settings)).unwrap().collect() + let result = sorter.sort_by(lines.into_iter(), |a, b| compare_by(a, b, &settings)).unwrap().collect(); + result +} + +fn sort_by(lines: &mut Vec, settings: &GlobalSettings) { + if settings.stable || settings.unique { + lines.par_sort_by(|a, b| compare_by(a, b, &settings)) + } else { + lines.par_sort_unstable_by(|a, b| compare_by(a, b, &settings)) + } } fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering { From 3a1e92fdd286f7078957a18b0eda2b4b45c11bd2 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sat, 17 Apr 2021 22:39:05 -0500 Subject: [PATCH 0360/1135] More cleanup --- src/uu/sort/src/sort.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index ce6ba8fa7..1c72e3427 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -180,7 +180,7 @@ impl From<&GlobalSettings> for KeySettings { } } -#[derive(Debug, Serialize, Deserialize, Clone)] +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] /// Represents the string selected by a FieldSelector. enum SelectionRange { /// If we had to transform this selection, we have to store a new string. @@ -211,7 +211,7 @@ impl SelectionRange { } } } -#[derive(Debug, Serialize, Deserialize, Clone)] +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] enum NumCache { AsF64(f64), WithInfo(NumInfo), @@ -232,7 +232,7 @@ impl NumCache { } } } -#[derive(Debug, Serialize, Deserialize, Clone)] +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] struct Selection { range: SelectionRange, num_cache: NumCache, @@ -275,6 +275,7 @@ impl Sortable for Line { let mut deserialized_line: Line = serde_json::de::from_str(&line.unwrap()).unwrap(); line_joined = format!("{}\n{}", line_joined, deserialized_line.line); selections_joined.append(&mut deserialized_line.selections); + selections_joined.dedup(); } Some( Line {line: line_joined, selections: selections_joined} ) }; From 4c8d62c2be89dba9158106abf47c0b97392a5f5e Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sat, 17 Apr 2021 23:24:32 -0500 Subject: [PATCH 0361/1135] More cleanup --- src/uu/sort/src/sort.rs | 42 ++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 1c72e3427..9052b2a5b 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -257,14 +257,14 @@ impl Sortable for Line { fn encode(&self, write: &mut W) { let line = Line {line: self.line.to_owned(), selections: self.selections.to_owned() }; let serialized = serde_json::ser::to_string(&line).unwrap(); - // Valid JSON needs to be seperated by something, so here we use a newline + // Each instance of valid JSON needs to be seperated by something, so here we use a newline write.write_all(format!("{}{}", serialized, "\n").as_bytes()).unwrap(); } - // This crate asks us to write one line at a time, but returns multiple lines(?). + // This crate asks us to write one Line at a time, but returns multiple Lines to us(?). // However, this crate also expects us to return a result of Option, - // so we concat the these lines into a single Option. So, this may be broken, - // and needs to be tested more thoroughly. Perhaps we need to rethink our struct or rewrite a + // so we concat the these lines into a single Option. So, it's possible this is broken, + // and/or needs to be tested more thoroughly. Perhaps we need to rethink our Line struct or rewrite a // ext sorter ourselves. fn decode(read: &mut R) -> Option { let buf_reader = BufReader::new(read); @@ -274,6 +274,7 @@ impl Sortable for Line { for line in buf_reader.lines() { let mut deserialized_line: Line = serde_json::de::from_str(&line.unwrap()).unwrap(); line_joined = format!("{}\n{}", line_joined, deserialized_line.line); + // I think we've done our sorting already and these are irrelevant? @miDeb what's your sense? selections_joined.append(&mut deserialized_line.selections); selections_joined.dedup(); } @@ -873,13 +874,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } if matches.is_present(OPT_BUF_SIZE) { - // 10000 is the default extsort buffer, but it's too small - settings.buffer_size = matches + // 10K is the default extsort buffer, but that's too small, so we set at 10M + // Although the "default" is never used unless extsort options are given + settings.buffer_size = { + let input = matches .value_of(OPT_BUF_SIZE) .map(String::from) - .unwrap_or( format! ( "{}", DEFAULT_BUF_SIZE ) ) - .parse::() - .unwrap_or( DEFAULT_BUF_SIZE ); + .unwrap_or( format! ( "{}", DEFAULT_BUF_SIZE ) ); + + human_numeric_convert(&input) + } } if matches.is_present(OPT_TMP_DIR) { @@ -1133,6 +1137,26 @@ fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering } } +// Brought back! Probably want to do through numstrcmp somehow now +fn human_numeric_convert(a: &str) -> usize { + let num_part = leading_num_common(a); + let (_, s) = a.split_at(num_part.len()); + let num_part = permissive_f64_parse(num_part); + let suffix = match s.parse().unwrap_or('\0') { + // SI Units + 'K' => 1E3, + 'M' => 1E6, + 'G' => 1E9, + 'T' => 1E12, + 'P' => 1E15, + 'E' => 1E18, + 'Z' => 1E21, + 'Y' => 1E24, + _ => 1f64, + }; + num_part as usize * suffix as usize +} + // Test output against BSDs and GNU with their locale // env var set to lc_ctype=utf-8 to enjoy the exact same output. #[inline(always)] From f36832c39264718f3b41d8e80e92e39f1726ae06 Mon Sep 17 00:00:00 2001 From: Nicolas Thery Date: Sun, 18 Apr 2021 14:17:55 +0200 Subject: [PATCH 0362/1135] cp: add support for --reflink=never - Passing `never` to `--reflink` does not raise an error anymore. - Remove `Options::reflink` flag as it was redundant with `reflink_mode`. - Add basic tests for this option. Does not check that a copy-on-write rather than a regular copy was made. --- src/uu/cp/src/cp.rs | 5 ++-- tests/by-util/test_cp.rs | 64 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 4e245b298..da8c9037e 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -210,7 +210,6 @@ pub struct Options { overwrite: OverwriteMode, parents: bool, strip_trailing_slashes: bool, - reflink: bool, reflink_mode: ReflinkMode, preserve_attributes: Vec, recursive: bool, @@ -633,12 +632,12 @@ impl Options { update: matches.is_present(OPT_UPDATE), verbose: matches.is_present(OPT_VERBOSE), strip_trailing_slashes: matches.is_present(OPT_STRIP_TRAILING_SLASHES), - reflink: matches.is_present(OPT_REFLINK), reflink_mode: { if let Some(reflink) = matches.value_of(OPT_REFLINK) { match reflink { "always" => ReflinkMode::Always, "auto" => ReflinkMode::Auto, + "never" => ReflinkMode::Never, value => { return Err(Error::InvalidArgument(format!( "invalid argument '{}' for \'reflink\'", @@ -1196,7 +1195,7 @@ fn copy_file(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> { ///Copy the file from `source` to `dest` either using the normal `fs::copy` or the ///`FICLONE` ioctl if --reflink is specified and the filesystem supports it. fn copy_helper(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> { - if options.reflink { + if options.reflink_mode != ReflinkMode::Never { #[cfg(not(target_os = "linux"))] return Err("--reflink is only supported on linux".to_string().into()); diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index f4aabff3e..c90dff061 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1072,3 +1072,67 @@ fn test_cp_one_file_system() { } } } + +#[test] +#[cfg(target_os = "linux")] +fn test_cp_reflink_always() { + let (at, mut ucmd) = at_and_ucmd!(); + let result = ucmd + .arg("--reflink=always") + .arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_EXISTING_FILE) + .run(); + + if result.success { + // Check the content of the destination file + assert_eq!(at.read(TEST_EXISTING_FILE), "Hello, World!\n"); + } else { + // Older Linux versions do not support cloning. + } +} + +#[test] +#[cfg(target_os = "linux")] +fn test_cp_reflink_auto() { + let (at, mut ucmd) = at_and_ucmd!(); + let result = ucmd + .arg("--reflink=auto") + .arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_EXISTING_FILE) + .run(); + + assert!(result.success); + + // Check the content of the destination file + assert_eq!(at.read(TEST_EXISTING_FILE), "Hello, World!\n"); +} + +#[test] +#[cfg(target_os = "linux")] +fn test_cp_reflink_never() { + let (at, mut ucmd) = at_and_ucmd!(); + let result = ucmd + .arg("--reflink=never") + .arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_EXISTING_FILE) + .run(); + + assert!(result.success); + + // Check the content of the destination file + assert_eq!(at.read(TEST_EXISTING_FILE), "Hello, World!\n"); +} + +#[test] +#[cfg(target_os = "linux")] +fn test_cp_reflink_bad() { + let (_, mut ucmd) = at_and_ucmd!(); + let result = ucmd + .arg("--reflink=bad") + .arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_EXISTING_FILE) + .run(); + + assert!(!result.success); + assert!(result.stderr.contains("invalid argument")); +} From d7b7ce52bc28904f8af8ae36a9e43e698cbdd295 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 11:54:18 -0500 Subject: [PATCH 0363/1135] Vendored ext_sorter, removed unstable, created a byte buffer sized vector instead of a numbered capacity vector --- Cargo.lock | 1 + src/uu/sort/Cargo.toml | 1 + src/uu/sort/src/ext_sorter.rs | 347 +++++++++++++++++++++++++++++ src/uu/sort/src/numeric_str_cmp.rs | 2 +- src/uu/sort/src/sort.rs | 112 +++++----- 5 files changed, 409 insertions(+), 54 deletions(-) create mode 100644 src/uu/sort/src/ext_sorter.rs diff --git a/Cargo.lock b/Cargo.lock index b7328009c..76f43d8b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2424,6 +2424,7 @@ dependencies = [ "serde", "serde_json", "smallvec 1.6.1", + "tempfile", "uucore", "uucore_procs", ] diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 8a3d1ed25..e1e0d1b87 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -28,6 +28,7 @@ semver = "0.9.0" smallvec = { version = "1.6.1", features = ["serde"] } uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +tempfile = "3.1.0" [[bin]] name = "sort" diff --git a/src/uu/sort/src/ext_sorter.rs b/src/uu/sort/src/ext_sorter.rs new file mode 100644 index 000000000..c19f1262b --- /dev/null +++ b/src/uu/sort/src/ext_sorter.rs @@ -0,0 +1,347 @@ +// Copyright 2018 Andre-Philippe Paquet +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use rayon::prelude::*; +use std::{ + cmp::Ordering, + collections::VecDeque, + fs::{File, OpenOptions}, + io::{BufReader, BufWriter, Error, Read, Seek, SeekFrom, Write}, + path::{Path, PathBuf}, +}; + +/// Exposes external sorting (i.e. on disk sorting) capability on arbitrarily +/// sized iterator, even if the generated content of the iterator doesn't fit in +/// memory. +/// +/// It uses an in-memory buffer sorted and flushed to disk in segment files when +/// full. Once sorted, it returns a new sorted iterator with all items. In order +/// to remain efficient for all implementations, the crate doesn't handle +/// serialization, but leaves that to the user. +pub struct ExternalSorter { + segment_size: usize, + sort_dir: Option, + parallel: bool, +} + +impl ExternalSorter { + pub fn new() -> ExternalSorter { + ExternalSorter { + segment_size: 10000000, + sort_dir: None, + parallel: false, + } + } + + /// Sets the maximum size of each segment in number of sorted items. + /// + /// This number of items needs to fit in memory. While sorting, a + /// in-memory buffer is used to collect the items to be sorted. Once + /// it reaches the maximum size, it is sorted and then written to disk. + /// + /// Using a higher segment size makes sorting faster by leveraging + /// faster in-memory operations. + pub fn with_segment_size(mut self, size: usize) -> Self { + self.segment_size = size; + self + } + + /// Sets directory in which sorted segments will be written (if it doesn't + /// fit in memory). + pub fn with_sort_dir(mut self, path: PathBuf) -> Self { + self.sort_dir = Some(path); + self + } + + /// Uses Rayon to sort the in-memory buffer. + /// + /// This may not be needed if the buffer isn't big enough for parallelism to + /// be gainful over the overhead of multithreading. + pub fn with_parallel_sort(mut self) -> Self { + self.parallel = true; + self + } + + /// Sorts a given iterator, returning a new iterator with items + pub fn sort( + &self, + iterator: I, + ) -> Result Ordering + Send + Sync>, Error> + where + T: Sortable + Ord, + I: Iterator, + { + self.sort_by(iterator, |a, b| a.cmp(b)) + } + + /// Sorts a given iterator with a comparator function, returning a new iterator with items + pub fn sort_by(&self, iterator: I, cmp: F) -> Result, Error> + where + T: Sortable, + I: Iterator, + F: Fn(&T, &T) -> Ordering + Send + Sync, + { + let mut tempdir: Option = None; + let mut sort_dir: Option = None; + + let mut count = 0; + let mut segments_file: Vec = Vec::new(); + let size_of_items = std::mem::size_of::(); + let mut buffer: Vec = Vec::with_capacity(self.segment_size / size_of_items); + for next_item in iterator { + count += 1; + buffer.push(next_item); + if buffer.len() > self.segment_size { + let sort_dir = self.lazy_create_dir(&mut tempdir, &mut sort_dir)?; + self.sort_and_write_segment(sort_dir, &mut segments_file, &mut buffer, &cmp)?; + } + } + + // Write any items left in buffer, but only if we had at least 1 segment + // written. Otherwise we use the buffer itself to iterate from memory + let pass_through_queue = if !buffer.is_empty() && !segments_file.is_empty() { + let sort_dir = self.lazy_create_dir(&mut tempdir, &mut sort_dir)?; + self.sort_and_write_segment(sort_dir, &mut segments_file, &mut buffer, &cmp)?; + None + } else { + buffer.sort_by(&cmp); + Some(VecDeque::from(buffer)) + }; + + SortedIterator::new(tempdir, pass_through_queue, segments_file, count, cmp) + } + + /// Sorts a given iterator with a key extraction function, returning a new iterator with items + pub fn sort_by_key( + &self, + iterator: I, + f: F, + ) -> Result Ordering + Send + Sync>, Error> + where + T: Sortable, + I: Iterator, + F: Fn(&T) -> K + Send + Sync, + K: Ord, + { + self.sort_by(iterator, move |a, b| f(a).cmp(&f(b))) + } + + /// We only want to create directory if it's needed (i.e. if the dataset + /// doesn't fit in memory) to prevent filesystem latency + fn lazy_create_dir<'a>( + &self, + tempdir: &mut Option, + sort_dir: &'a mut Option, + ) -> Result<&'a Path, Error> { + if let Some(sort_dir) = sort_dir { + return Ok(sort_dir); + } + + *sort_dir = if let Some(ref sort_dir) = self.sort_dir { + Some(sort_dir.to_path_buf()) + } else { + *tempdir = Some(tempfile::TempDir::new()?); + Some(tempdir.as_ref().unwrap().path().to_path_buf()) + }; + + Ok(sort_dir.as_ref().unwrap()) + } + + fn sort_and_write_segment( + &self, + sort_dir: &Path, + segments: &mut Vec, + buffer: &mut Vec, + cmp: F, + ) -> Result<(), Error> + where + T: Sortable, + F: Fn(&T, &T) -> Ordering + Send + Sync, + { + if self.parallel { + buffer.par_sort_by(|a, b| cmp(a, b)); + } else { + buffer.sort_by(|a, b| cmp(a, b)); + } + + let segment_path = sort_dir.join(format!("{}", segments.len())); + let segment_file = OpenOptions::new() + .create(true) + .truncate(true) + .read(true) + .write(true) + .open(&segment_path)?; + let mut buf_writer = BufWriter::new(segment_file); + + for item in buffer.drain(0..) { + item.encode(&mut buf_writer); + } + + let file = buf_writer.into_inner()?; + segments.push(file); + + Ok(()) + } +} + +impl Default for ExternalSorter { + fn default() -> Self { + ExternalSorter::new() + } +} + +pub trait Sortable: Sized + Send { + fn encode(&self, writer: &mut W); + fn decode(reader: &mut R) -> Option; +} + +pub struct SortedIterator { + _tempdir: Option, + pass_through_queue: Option>, + segments_file: Vec>, + next_values: Vec>, + count: u64, + cmp: F, +} + +impl Ordering + Send + Sync> SortedIterator { + fn new( + tempdir: Option, + pass_through_queue: Option>, + mut segments_file: Vec, + count: u64, + cmp: F, + ) -> Result, Error> { + for segment in &mut segments_file { + segment.seek(SeekFrom::Start(0))?; + } + + let next_values = segments_file + .iter_mut() + .map(|file| T::decode(file)) + .collect(); + + let segments_file_buffered = segments_file.into_iter().map(BufReader::new).collect(); + + Ok(SortedIterator { + _tempdir: tempdir, + pass_through_queue, + segments_file: segments_file_buffered, + next_values, + count, + cmp, + }) + } + + pub fn sorted_count(&self) -> u64 { + self.count + } +} + +impl Ordering> Iterator for SortedIterator { + type Item = T; + + fn next(&mut self) -> Option { + // if we have a pass through, we dequeue from it directly + if let Some(ptb) = self.pass_through_queue.as_mut() { + return ptb.pop_front(); + } + + // otherwise, we iter from segments on disk + let mut smallest_idx: Option = None; + { + let mut smallest: Option<&T> = None; + for idx in 0..self.segments_file.len() { + let next_value = self.next_values[idx].as_ref(); + if next_value.is_none() { + continue; + } + + if smallest.is_none() + || (self.cmp)(next_value.unwrap(), smallest.unwrap()) == Ordering::Less + { + smallest = Some(next_value.unwrap()); + smallest_idx = Some(idx); + } + } + } + + smallest_idx.map(|idx| { + let file = &mut self.segments_file[idx]; + let value = self.next_values[idx].take().unwrap(); + self.next_values[idx] = T::decode(file); + value + }) + } +} + +#[cfg(test)] +pub mod test { + use super::*; + + use byteorder::{ReadBytesExt, WriteBytesExt}; + + #[test] + fn test_smaller_than_segment() { + let sorter = ExternalSorter::new(); + let data: Vec = (0..100u32).collect(); + let data_rev: Vec = data.iter().rev().cloned().collect(); + + let sorted_iter = sorter.sort(data_rev.into_iter()).unwrap(); + + // should not have used any segments (all in memory) + assert_eq!(sorted_iter.segments_file.len(), 0); + let sorted_data: Vec = sorted_iter.collect(); + + assert_eq!(data, sorted_data); + } + + #[test] + fn test_multiple_segments() { + let sorter = ExternalSorter::new().with_segment_size(100); + let data: Vec = (0..1000u32).collect(); + + let data_rev: Vec = data.iter().rev().cloned().collect(); + let sorted_iter = sorter.sort(data_rev.into_iter()).unwrap(); + assert_eq!(sorted_iter.segments_file.len(), 10); + + let sorted_data: Vec = sorted_iter.collect(); + assert_eq!(data, sorted_data); + } + + #[test] + fn test_parallel() { + let sorter = ExternalSorter::new() + .with_segment_size(100) + .with_parallel_sort(); + let data: Vec = (0..1000u32).collect(); + + let data_rev: Vec = data.iter().rev().cloned().collect(); + let sorted_iter = sorter.sort(data_rev.into_iter()).unwrap(); + assert_eq!(sorted_iter.segments_file.len(), 10); + + let sorted_data: Vec = sorted_iter.collect(); + assert_eq!(data, sorted_data); + } + + impl Sortable for u32 { + fn encode(&self, writer: &mut W) { + writer.write_u32::(*self).unwrap(); + } + + fn decode(reader: &mut R) -> Option { + reader.read_u32::().ok() + } + } +} diff --git a/src/uu/sort/src/numeric_str_cmp.rs b/src/uu/sort/src/numeric_str_cmp.rs index ac615d1f7..b15eec988 100644 --- a/src/uu/sort/src/numeric_str_cmp.rs +++ b/src/uu/sort/src/numeric_str_cmp.rs @@ -14,8 +14,8 @@ //! More specifically, exponent can be understood so that the original number is in (1..10)*10^exponent. //! From that follows the constraints of this algorithm: It is able to compare numbers in ±(1*10^[i64::MIN]..10*10^[i64::MAX]). +use serde::{Deserialize, Serialize}; use std::{cmp::Ordering, ops::Range}; -use serde::{Serialize, Deserialize}; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, Clone)] enum Sign { diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 9052b2a5b..07a8879b7 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -16,6 +16,8 @@ extern crate uucore; mod numeric_str_cmp; +pub mod ext_sorter; +pub use ext_sorter::{ExternalSorter, Sortable, SortedIterator}; use clap::{App, Arg}; use fnv::FnvHasher; @@ -24,26 +26,20 @@ use numeric_str_cmp::{numeric_str_cmp, NumInfo, NumInfoParseSettings}; use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; use semver::Version; +use serde::{Deserialize, Serialize}; use smallvec::SmallVec; use std::borrow::Cow; use std::cmp::Ordering; use std::collections::BinaryHeap; use std::env; +use std::ffi::OsString; use std::fs::File; use std::hash::{Hash, Hasher}; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Lines, Read, Write}; use std::mem::replace; use std::ops::{Range, RangeInclusive}; -use std::path::Path; +use std::path::{Path, PathBuf}; use uucore::fs::is_stdin_interactive; // for Iterator::dedup() -use extsort::*; -use std::str; -use serde::{Serialize, Deserialize}; -use std::ffi::OsString; -use std::usize; -use std::path::PathBuf; -use std::string::*; -use rayon::prelude::*; static NAME: &str = "sort"; static ABOUT: &str = "Display sorted concatenation of all FILE(s)."; @@ -255,30 +251,39 @@ struct Line { impl Sortable for Line { fn encode(&self, write: &mut W) { - let line = Line {line: self.line.to_owned(), selections: self.selections.to_owned() }; + let line = Line { + line: self.line.to_owned(), + selections: self.selections.to_owned(), + }; let serialized = serde_json::ser::to_string(&line).unwrap(); // Each instance of valid JSON needs to be seperated by something, so here we use a newline - write.write_all(format!("{}{}", serialized, "\n").as_bytes()).unwrap(); + write + .write_all(format!("{}{}", serialized, "\n").as_bytes()) + .unwrap(); } // This crate asks us to write one Line at a time, but returns multiple Lines to us(?). - // However, this crate also expects us to return a result of Option, - // so we concat the these lines into a single Option. So, it's possible this is broken, + // However, this crate also expects us to return a result of Option, + // so we concat the these lines into a single Option. So, it's possible this is broken, // and/or needs to be tested more thoroughly. Perhaps we need to rethink our Line struct or rewrite a - // ext sorter ourselves. + // ext sorter ourselves. fn decode(read: &mut R) -> Option { let buf_reader = BufReader::new(read); let result = { - let mut line_joined= String::new(); - let mut selections_joined= SmallVec::new(); - for line in buf_reader.lines() { + let mut line_joined = String::new(); + let mut selections_joined = SmallVec::new(); + let p_iter = buf_reader.lines().peekable(); + for line in p_iter { let mut deserialized_line: Line = serde_json::de::from_str(&line.unwrap()).unwrap(); - line_joined = format!("{}\n{}", line_joined, deserialized_line.line); - // I think we've done our sorting already and these are irrelevant? @miDeb what's your sense? + line_joined = format!("{}\n{}\n", line_joined, deserialized_line.line); + // I think we've done our sorting already and these are irrelevant? + // @miDeb what's your sense? Could we just return an empty vec? selections_joined.append(&mut deserialized_line.selections); - selections_joined.dedup(); } - Some( Line {line: line_joined, selections: selections_joined} ) + Some(Line { + line: line_joined.strip_suffix("\n").unwrap().to_owned(), + selections: selections_joined, + }) }; result } @@ -798,6 +803,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) .arg( Arg::with_name(OPT_BUF_SIZE) + .short("S") .long(OPT_BUF_SIZE) .help("sets the maximum SIZE of each segment in number of sorted items") .takes_value(true) @@ -805,6 +811,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) .arg( Arg::with_name(OPT_TMP_DIR) + .short("T") .long(OPT_TMP_DIR) .help("use DIR for temporaries, not $TMPDIR or /tmp") .takes_value(true) @@ -875,13 +882,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if matches.is_present(OPT_BUF_SIZE) { // 10K is the default extsort buffer, but that's too small, so we set at 10M - // Although the "default" is never used unless extsort options are given - settings.buffer_size = { + // Although the "default" is never used unless extsort options are given + settings.buffer_size = { let input = matches - .value_of(OPT_BUF_SIZE) - .map(String::from) - .unwrap_or( format! ( "{}", DEFAULT_BUF_SIZE ) ); - + .value_of(OPT_BUF_SIZE) + .map(String::from) + .unwrap_or(format!("{}", DEFAULT_BUF_SIZE)); + human_numeric_convert(&input) } } @@ -890,13 +897,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let result = matches .value_of(OPT_TMP_DIR) .map(String::from) - .unwrap_or(DEFAULT_TMPDIR.to_owned() ); + .unwrap_or(DEFAULT_TMPDIR.to_owned()); settings.tmp_dir = PathBuf::from(format!(r"{}", result)); } else { for (key, value) in env::vars_os() { if key == OsString::from("TMPDIR") { - settings.tmp_dir = PathBuf::from(format!(r"{}", value.into_string().unwrap_or("/tmp".to_owned()))); - break + settings.tmp_dir = PathBuf::from(format!( + r"{}", + value.into_string().unwrap_or("/tmp".to_owned()) + )); + break; } settings.tmp_dir = PathBuf::from(DEFAULT_TMPDIR); } @@ -1019,12 +1029,9 @@ fn exec(files: Vec, settings: &GlobalSettings) -> i32 { if settings.check { return exec_check_file(&lines, &settings); } - - if ( settings.buffer_size != DEFAULT_BUF_SIZE ) || ( settings.tmp_dir.as_os_str() != DEFAULT_TMPDIR ) { - lines = ext_sort_by(lines, &settings); - } else { - sort_by(&mut lines, &settings); - } + + + lines = sort_by(lines, &settings); if settings.merge { if settings.unique { @@ -1079,20 +1086,18 @@ fn exec_check_file(unwrapped_lines: &[Line], settings: &GlobalSettings) -> i32 { } } -fn ext_sort_by(lines: Vec, settings: &GlobalSettings) -> Vec { - let sorter = ExternalSorter::new().with_segment_size(settings.buffer_size).with_sort_dir(settings.tmp_dir.clone()).with_parallel_sort(); - let result = sorter.sort_by(lines.into_iter(), |a, b| compare_by(a, b, &settings)).unwrap().collect(); +fn sort_by(lines: Vec, settings: &GlobalSettings) -> Vec { + let sorter = ExternalSorter::new() + .with_segment_size(settings.buffer_size) + .with_sort_dir(settings.tmp_dir.clone()) + .with_parallel_sort(); + let result = sorter + .sort_by(lines.into_iter(), |a, b| compare_by(a, b, &settings)) + .unwrap() + .collect(); result } -fn sort_by(lines: &mut Vec, settings: &GlobalSettings) { - if settings.stable || settings.unique { - lines.par_sort_by(|a, b| compare_by(a, b, &settings)) - } else { - lines.par_sort_unstable_by(|a, b| compare_by(a, b, &settings)) - } -} - fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering { for (idx, selector) in global_settings.selectors.iter().enumerate() { let a_selection = &a.selections[idx]; @@ -1137,14 +1142,14 @@ fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering } } -// Brought back! Probably want to do through numstrcmp somehow now +// It's back to do conversions for command options! Probably want to do through numstrcmp somehow now fn human_numeric_convert(a: &str) -> usize { let num_part = leading_num_common(a); let (_, s) = a.split_at(num_part.len()); let num_part = permissive_f64_parse(num_part); let suffix = match s.parse().unwrap_or('\0') { // SI Units - 'K' => 1E3, + 'K' | 'k' => 1E3, 'M' => 1E6, 'G' => 1E9, 'T' => 1E12, @@ -1164,7 +1169,7 @@ fn default_compare(a: &str, b: &str) -> Ordering { a.cmp(b) } -// This function does the initial detection of numeric lines. +/// This function does the initial detection of numeric lines for FP compares. // Lines starting with a number or positive or negative sign. // It also strips the string of any thing that could never // be a number for the purposes of any type of numeric comparison. @@ -1195,7 +1200,7 @@ fn leading_num_common(a: &str) -> &str { s } -// This function cleans up the initial comparison done by leading_num_common for a general numeric compare. +/// This function cleans up the initial comparison done by leading_num_common for a general numeric compare. // In contrast to numeric compare, GNU general numeric/FP sort *should* recognize positive signs and // scientific notation, so we strip those lines only after the end of the following numeric string. // For example, 5e10KFD would be 5e10 or 5x10^10 and +10000HFKJFK would become 10000. @@ -1318,7 +1323,7 @@ fn month_parse(line: &str) -> Month { "" }; - match pattern.to_uppercase().as_ref() { + let result = match pattern.to_uppercase().as_ref() { "JAN" => Month::January, "FEB" => Month::February, "MAR" => Month::March, @@ -1332,7 +1337,8 @@ fn month_parse(line: &str) -> Month { "NOV" => Month::November, "DEC" => Month::December, _ => Month::Unknown, - } + }; + result } fn month_compare(a: &str, b: &str) -> Ordering { From da94e350448239ca6ddd6442d76e4cd610dd6d98 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 13:02:50 -0500 Subject: [PATCH 0364/1135] Cleanup, removed unused code, add copyright --- src/uu/sort/src/ext_sorter.rs | 94 +---------------------------------- src/uu/sort/src/sort.rs | 20 +++++--- 2 files changed, 14 insertions(+), 100 deletions(-) diff --git a/src/uu/sort/src/ext_sorter.rs b/src/uu/sort/src/ext_sorter.rs index c19f1262b..d607cbd3e 100644 --- a/src/uu/sort/src/ext_sorter.rs +++ b/src/uu/sort/src/ext_sorter.rs @@ -1,4 +1,5 @@ // Copyright 2018 Andre-Philippe Paquet +// Copyright 2021 Robert Swinford // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -38,7 +39,7 @@ pub struct ExternalSorter { impl ExternalSorter { pub fn new() -> ExternalSorter { ExternalSorter { - segment_size: 10000000, + segment_size: 16000000000, sort_dir: None, parallel: false, } @@ -73,18 +74,6 @@ impl ExternalSorter { self } - /// Sorts a given iterator, returning a new iterator with items - pub fn sort( - &self, - iterator: I, - ) -> Result Ordering + Send + Sync>, Error> - where - T: Sortable + Ord, - I: Iterator, - { - self.sort_by(iterator, |a, b| a.cmp(b)) - } - /// Sorts a given iterator with a comparator function, returning a new iterator with items pub fn sort_by(&self, iterator: I, cmp: F) -> Result, Error> where @@ -122,21 +111,6 @@ impl ExternalSorter { SortedIterator::new(tempdir, pass_through_queue, segments_file, count, cmp) } - /// Sorts a given iterator with a key extraction function, returning a new iterator with items - pub fn sort_by_key( - &self, - iterator: I, - f: F, - ) -> Result Ordering + Send + Sync>, Error> - where - T: Sortable, - I: Iterator, - F: Fn(&T) -> K + Send + Sync, - K: Ord, - { - self.sort_by(iterator, move |a, b| f(a).cmp(&f(b))) - } - /// We only want to create directory if it's needed (i.e. if the dataset /// doesn't fit in memory) to prevent filesystem latency fn lazy_create_dir<'a>( @@ -243,10 +217,6 @@ impl Ordering + Send + Sync> SortedIterator cmp, }) } - - pub fn sorted_count(&self) -> u64 { - self.count - } } impl Ordering> Iterator for SortedIterator { @@ -285,63 +255,3 @@ impl Ordering> Iterator for SortedIterator { }) } } - -#[cfg(test)] -pub mod test { - use super::*; - - use byteorder::{ReadBytesExt, WriteBytesExt}; - - #[test] - fn test_smaller_than_segment() { - let sorter = ExternalSorter::new(); - let data: Vec = (0..100u32).collect(); - let data_rev: Vec = data.iter().rev().cloned().collect(); - - let sorted_iter = sorter.sort(data_rev.into_iter()).unwrap(); - - // should not have used any segments (all in memory) - assert_eq!(sorted_iter.segments_file.len(), 0); - let sorted_data: Vec = sorted_iter.collect(); - - assert_eq!(data, sorted_data); - } - - #[test] - fn test_multiple_segments() { - let sorter = ExternalSorter::new().with_segment_size(100); - let data: Vec = (0..1000u32).collect(); - - let data_rev: Vec = data.iter().rev().cloned().collect(); - let sorted_iter = sorter.sort(data_rev.into_iter()).unwrap(); - assert_eq!(sorted_iter.segments_file.len(), 10); - - let sorted_data: Vec = sorted_iter.collect(); - assert_eq!(data, sorted_data); - } - - #[test] - fn test_parallel() { - let sorter = ExternalSorter::new() - .with_segment_size(100) - .with_parallel_sort(); - let data: Vec = (0..1000u32).collect(); - - let data_rev: Vec = data.iter().rev().cloned().collect(); - let sorted_iter = sorter.sort(data_rev.into_iter()).unwrap(); - assert_eq!(sorted_iter.segments_file.len(), 10); - - let sorted_data: Vec = sorted_iter.collect(); - assert_eq!(data, sorted_data); - } - - impl Sortable for u32 { - fn encode(&self, writer: &mut W) { - writer.write_u32::(*self).unwrap(); - } - - fn decode(reader: &mut R) -> Option { - reader.read_u32::().ok() - } - } -} diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 07a8879b7..fab712978 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -15,14 +15,14 @@ #[macro_use] extern crate uucore; +mod ext_sorter; mod numeric_str_cmp; -pub mod ext_sorter; -pub use ext_sorter::{ExternalSorter, Sortable, SortedIterator}; use clap::{App, Arg}; use fnv::FnvHasher; use itertools::Itertools; use numeric_str_cmp::{numeric_str_cmp, NumInfo, NumInfoParseSettings}; +use ext_sorter::{ExternalSorter, Sortable}; use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; use semver::Version; @@ -39,7 +39,7 @@ use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Lines, Read, Write}; use std::mem::replace; use std::ops::{Range, RangeInclusive}; use std::path::{Path, PathBuf}; -use uucore::fs::is_stdin_interactive; // for Iterator::dedup() +use uucore::fs::is_stdin_interactive; // for Iterator::dedup(); static NAME: &str = "sort"; static ABOUT: &str = "Display sorted concatenation of all FILE(s)."; @@ -90,7 +90,8 @@ static NEGATIVE: char = '-'; static POSITIVE: char = '+'; static DEFAULT_TMPDIR: &str = r"/tmp"; -static DEFAULT_BUF_SIZE: usize = 10000000usize; +// 16GB buffer for Vec before we dump to disk +static DEFAULT_BUF_SIZE: usize = 16000000000; #[derive(Eq, Ord, PartialEq, PartialOrd, Clone)] enum SortMode { @@ -281,7 +282,7 @@ impl Sortable for Line { selections_joined.append(&mut deserialized_line.selections); } Some(Line { - line: line_joined.strip_suffix("\n").unwrap().to_owned(), + line: line_joined.strip_suffix("\n").unwrap_or("").to_owned(), selections: selections_joined, }) }; @@ -881,7 +882,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } if matches.is_present(OPT_BUF_SIZE) { - // 10K is the default extsort buffer, but that's too small, so we set at 10M + // 10K is the default extsort buffer, but that's too small, so we set at 100M // Although the "default" is never used unless extsort options are given settings.buffer_size = { let input = matches @@ -889,7 +890,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .map(String::from) .unwrap_or(format!("{}", DEFAULT_BUF_SIZE)); - human_numeric_convert(&input) + if human_numeric_convert(&input) < 128000 { + panic!("sort will not operate with less than 128K of memory."); + } else { + human_numeric_convert(&input) + } } } @@ -1030,7 +1035,6 @@ fn exec(files: Vec, settings: &GlobalSettings) -> i32 { return exec_check_file(&lines, &settings); } - lines = sort_by(lines, &settings); if settings.merge { From dad7761be96e18bb66d3ff50642fab36fb242955 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 13:43:41 -0500 Subject: [PATCH 0365/1135] Add test --- src/uu/sort/src/ext_sorter.rs | 72 +++++++++++++++++++++++++++++++++++ src/uu/sort/src/sort.rs | 6 +-- tests/by-util/test_sort.rs | 25 +++++------- 3 files changed, 83 insertions(+), 20 deletions(-) diff --git a/src/uu/sort/src/ext_sorter.rs b/src/uu/sort/src/ext_sorter.rs index d607cbd3e..00fe9b401 100644 --- a/src/uu/sort/src/ext_sorter.rs +++ b/src/uu/sort/src/ext_sorter.rs @@ -74,6 +74,18 @@ impl ExternalSorter { self } + /// Sorts a given iterator, returning a new iterator with items + pub fn sort( + &self, + iterator: I, + ) -> Result Ordering + Send + Sync>, Error> + where + T: Sortable + Ord, + I: Iterator, + { + self.sort_by(iterator, |a, b| a.cmp(b)) + } + /// Sorts a given iterator with a comparator function, returning a new iterator with items pub fn sort_by(&self, iterator: I, cmp: F) -> Result, Error> where @@ -255,3 +267,63 @@ impl Ordering> Iterator for SortedIterator { }) } } + +#[cfg(test)] +pub mod test { + use super::*; + + use byteorder::{ReadBytesExt, WriteBytesExt}; + + #[test] + fn test_smaller_than_segment() { + let sorter = ExternalSorter::new(); + let data: Vec = (0..100u32).collect(); + let data_rev: Vec = data.iter().rev().cloned().collect(); + + let sorted_iter = sorter.sort(data_rev.into_iter()).unwrap(); + + // should not have used any segments (all in memory) + assert_eq!(sorted_iter.segments_file.len(), 0); + let sorted_data: Vec = sorted_iter.collect(); + + assert_eq!(data, sorted_data); + } + + #[test] + fn test_multiple_segments() { + let sorter = ExternalSorter::new().with_segment_size(100); + let data: Vec = (0..1000u32).collect(); + + let data_rev: Vec = data.iter().rev().cloned().collect(); + let sorted_iter = sorter.sort(data_rev.into_iter()).unwrap(); + assert_eq!(sorted_iter.segments_file.len(), 10); + + let sorted_data: Vec = sorted_iter.collect(); + assert_eq!(data, sorted_data); + } + + #[test] + fn test_parallel() { + let sorter = ExternalSorter::new() + .with_segment_size(100) + .with_parallel_sort(); + let data: Vec = (0..1000u32).collect(); + + let data_rev: Vec = data.iter().rev().cloned().collect(); + let sorted_iter = sorter.sort(data_rev.into_iter()).unwrap(); + assert_eq!(sorted_iter.segments_file.len(), 10); + + let sorted_data: Vec = sorted_iter.collect(); + assert_eq!(data, sorted_data); + } + + impl Sortable for u32 { + fn encode(&self, writer: &mut W) { + writer.write_u32::(*self).unwrap(); + } + + fn decode(reader: &mut R) -> Option { + reader.read_u32::().ok() + } + } +} diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index fab712978..4854990e6 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -90,7 +90,7 @@ static NEGATIVE: char = '-'; static POSITIVE: char = '+'; static DEFAULT_TMPDIR: &str = r"/tmp"; -// 16GB buffer for Vec before we dump to disk +// 16GB buffer for Vec before we dump to disk static DEFAULT_BUF_SIZE: usize = 16000000000; #[derive(Eq, Ord, PartialEq, PartialOrd, Clone)] @@ -890,11 +890,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .map(String::from) .unwrap_or(format!("{}", DEFAULT_BUF_SIZE)); - if human_numeric_convert(&input) < 128000 { - panic!("sort will not operate with less than 128K of memory."); - } else { human_numeric_convert(&input) - } } } diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index a4a9a383c..0ca917a86 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -8,6 +8,16 @@ fn test_helper(file_name: &str, args: &str) { .stdout_is_fixture(format!("{}.expected", file_name)); } +#[test] +fn test_larger_than_specified_segment() { + new_ucmd!() + .arg("-n") + .arg("-S 100") + .arg("numeric_unsorted_ints.txt") + .succeeds() + .stdout_is_fixture(format!("{}", "numeric_unsorted_ints.expected")); +} + #[test] fn test_months_whitespace() { test_helper("months-whitespace", "-M"); @@ -100,21 +110,6 @@ fn test_random_shuffle_two_runs_not_the_same() { assert_ne!(result, unexpected); } -#[test] -fn test_random_shuffle_contains_two_runs_not_the_same() { - // check to verify that two random shuffles are not equal; this has the - // potential to fail in the unlikely event that random order is the same - // as the starting order, or if both random sorts end up having the same order. - const FILE: &'static str = "default_unsorted_ints.expected"; - let (at, _ucmd) = at_and_ucmd!(); - let result = new_ucmd!().arg("-R").arg(FILE).run().stdout_move_str(); - let expected = at.read(FILE); - let unexpected = new_ucmd!().arg("-R").arg(FILE).run().stdout_move_str(); - - assert_ne!(result, expected); - assert_ne!(result, unexpected); -} - #[test] fn test_numeric_floats_and_ints() { test_helper("numeric_floats_and_ints", "-n"); From 42da444f40df869406e1d0138341b308a148001e Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 13:49:11 -0500 Subject: [PATCH 0366/1135] Remove unused deps --- Cargo.lock | 131 +---------------------------------------- src/uu/sort/Cargo.toml | 2 - 2 files changed, 3 insertions(+), 130 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 76f43d8b4..eb99af34b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,40 +119,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" -[[package]] -name = "bytecount" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72feb31ffc86498dacdbd0fcebb56138e7177a8cc5cea4516031d15ae85a742e" - [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -[[package]] -name = "cargo-platform" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0226944a63d1bf35a3b5f948dd7c59e263db83695c9e8bffc4037de02e30f1d7" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7714a157da7991e23d90686b9524b9e12e0407a108647f52e9328f4b3d51ac7f" -dependencies = [ - "cargo-platform", - "semver 0.11.0", - "semver-parser 0.10.2", - "serde", - "serde_json", -] - [[package]] name = "cast" version = "0.2.3" @@ -588,26 +560,6 @@ dependencies = [ "regex", ] -[[package]] -name = "error-chain" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" -dependencies = [ - "version_check", -] - -[[package]] -name = "extsort" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc5bb6fbca3c5ce6a51f6857eab8c35c898b2fbcb62ff1b728243dd19ec0c9f" -dependencies = [ - "rayon", - "skeptic", - "tempfile", -] - [[package]] name = "fake-simd" version = "0.1.2" @@ -992,15 +944,6 @@ dependencies = [ "proc-macro-hack", ] -[[package]] -name = "pest" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" -dependencies = [ - "ucd-trie", -] - [[package]] name = "pkg-config" version = "0.3.19" @@ -1066,17 +1009,6 @@ dependencies = [ "unicode-xid 0.2.1", ] -[[package]] -name = "pulldown-cmark" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffade02495f22453cd593159ea2f59827aae7f53fa8323f756799b670881dcf8" -dependencies = [ - "bitflags", - "memchr 2.3.4", - "unicase", -] - [[package]] name = "quick-error" version = "1.2.3" @@ -1313,7 +1245,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver 0.9.0", + "semver", ] [[package]] @@ -1343,17 +1275,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser 0.7.0", -] - -[[package]] -name = "semver" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser 0.10.2", - "serde", + "semver-parser", ] [[package]] @@ -1362,15 +1284,6 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] - [[package]] name = "serde" version = "1.0.125" @@ -1443,21 +1356,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "skeptic" -version = "0.13.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "188b810342d98f23f0bb875045299f34187b559370b041eb11520c905370a888" -dependencies = [ - "bytecount", - "cargo_metadata", - "error-chain", - "glob 0.3.0", - "pulldown-cmark", - "tempfile", - "walkdir", -] - [[package]] name = "smallvec" version = "0.6.14" @@ -1636,21 +1534,6 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" -[[package]] -name = "ucd-trie" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" - -[[package]] -name = "unicase" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" -dependencies = [ - "version_check", -] - [[package]] name = "unicode-segmentation" version = "1.7.1" @@ -2413,14 +2296,12 @@ dependencies = [ name = "uu_sort" version = "0.0.6" dependencies = [ - "byteorder", "clap", - "extsort", "fnv", "itertools 0.10.0", "rand 0.7.3", "rayon", - "semver 0.9.0", + "semver", "serde", "serde_json", "smallvec 1.6.1", @@ -2733,12 +2614,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" -[[package]] -name = "version_check" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" - [[package]] name = "void" version = "1.0.2" diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index e1e0d1b87..f29df6ab8 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -15,8 +15,6 @@ edition = "2018" path = "src/sort.rs" [dependencies] -byteorder = "1.4.3" -extsort = "0.4.2" serde_json = { version = "1.0.64", default-features = false, features = ["alloc"] } serde = { version = "1.0", features = ["derive"] } rayon = "1.5" From 0275a43c5bc414c52e40edbb1e2cd2d531255009 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 14:05:27 -0500 Subject: [PATCH 0367/1135] Make modifications clearer per Apache license --- src/uu/sort/src/ext_sorter.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/uu/sort/src/ext_sorter.rs b/src/uu/sort/src/ext_sorter.rs index 00fe9b401..782e80429 100644 --- a/src/uu/sort/src/ext_sorter.rs +++ b/src/uu/sort/src/ext_sorter.rs @@ -1,5 +1,5 @@ // Copyright 2018 Andre-Philippe Paquet -// Copyright 2021 Robert Swinford +// Modifications copyright 2021 Robert Swinford // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -13,6 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// This file has been modified for use in the uutils project. + use rayon::prelude::*; use std::{ cmp::Ordering, From e3e1ee30ebd378b8dfdf9502a271bcda71c80667 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 14:37:16 -0500 Subject: [PATCH 0368/1135] Add additional notices --- src/uu/sort/src/APACHE_LICENSE_EXT_SORTER | 202 ++++++++++++++++++++++ src/uu/sort/src/NOTICE | 8 + src/uu/sort/src/ext_sorter.rs | 2 +- 3 files changed, 211 insertions(+), 1 deletion(-) create mode 100644 src/uu/sort/src/APACHE_LICENSE_EXT_SORTER create mode 100644 src/uu/sort/src/NOTICE diff --git a/src/uu/sort/src/APACHE_LICENSE_EXT_SORTER b/src/uu/sort/src/APACHE_LICENSE_EXT_SORTER new file mode 100644 index 000000000..7a4a3ea24 --- /dev/null +++ b/src/uu/sort/src/APACHE_LICENSE_EXT_SORTER @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/src/uu/sort/src/NOTICE b/src/uu/sort/src/NOTICE new file mode 100644 index 000000000..3a20ec6e7 --- /dev/null +++ b/src/uu/sort/src/NOTICE @@ -0,0 +1,8 @@ +extsort +Copyright 2016 Andre-Philippe Paquet + +This project includes software developed by Andre-Philippe Paquet. + +The ext_sorter.rs file was copied and modified for use in the uutils' coreutils subproject, sort. + +Except as otherwise specified, all other contributions to sort are licensed according to the terms of the LICENSE file. \ No newline at end of file diff --git a/src/uu/sort/src/ext_sorter.rs b/src/uu/sort/src/ext_sorter.rs index 782e80429..026c6d8da 100644 --- a/src/uu/sort/src/ext_sorter.rs +++ b/src/uu/sort/src/ext_sorter.rs @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// This file has been modified for use in the uutils project. +// This file has been modified for use in the uutils' coreutils subproject, sort. use rayon::prelude::*; use std::{ From 0151f30c4ed420962a77365044ae6a6151aaa51e Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 15:04:25 -0500 Subject: [PATCH 0369/1135] Change directory structure --- src/uu/sort/src/APACHE_LICENSE_EXT_SORTER | 202 ------------------ src/uu/sort/src/ext_sorter/LICENSE | 202 ++++++++++++++++++ src/uu/sort/src/{ => ext_sorter}/NOTICE | 0 .../src/{ext_sorter.rs => ext_sorter/mod.rs} | 62 +----- src/uu/sort/src/sort.rs | 4 +- 5 files changed, 205 insertions(+), 265 deletions(-) delete mode 100644 src/uu/sort/src/APACHE_LICENSE_EXT_SORTER create mode 100644 src/uu/sort/src/ext_sorter/LICENSE rename src/uu/sort/src/{ => ext_sorter}/NOTICE (100%) rename src/uu/sort/src/{ext_sorter.rs => ext_sorter/mod.rs} (82%) diff --git a/src/uu/sort/src/APACHE_LICENSE_EXT_SORTER b/src/uu/sort/src/APACHE_LICENSE_EXT_SORTER deleted file mode 100644 index 7a4a3ea24..000000000 --- a/src/uu/sort/src/APACHE_LICENSE_EXT_SORTER +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/src/uu/sort/src/ext_sorter/LICENSE b/src/uu/sort/src/ext_sorter/LICENSE new file mode 100644 index 000000000..fe647bd7f --- /dev/null +++ b/src/uu/sort/src/ext_sorter/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/src/uu/sort/src/NOTICE b/src/uu/sort/src/ext_sorter/NOTICE similarity index 100% rename from src/uu/sort/src/NOTICE rename to src/uu/sort/src/ext_sorter/NOTICE diff --git a/src/uu/sort/src/ext_sorter.rs b/src/uu/sort/src/ext_sorter/mod.rs similarity index 82% rename from src/uu/sort/src/ext_sorter.rs rename to src/uu/sort/src/ext_sorter/mod.rs index 026c6d8da..c5d7e59e8 100644 --- a/src/uu/sort/src/ext_sorter.rs +++ b/src/uu/sort/src/ext_sorter/mod.rs @@ -12,7 +12,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - +// // This file has been modified for use in the uutils' coreutils subproject, sort. use rayon::prelude::*; @@ -269,63 +269,3 @@ impl Ordering> Iterator for SortedIterator { }) } } - -#[cfg(test)] -pub mod test { - use super::*; - - use byteorder::{ReadBytesExt, WriteBytesExt}; - - #[test] - fn test_smaller_than_segment() { - let sorter = ExternalSorter::new(); - let data: Vec = (0..100u32).collect(); - let data_rev: Vec = data.iter().rev().cloned().collect(); - - let sorted_iter = sorter.sort(data_rev.into_iter()).unwrap(); - - // should not have used any segments (all in memory) - assert_eq!(sorted_iter.segments_file.len(), 0); - let sorted_data: Vec = sorted_iter.collect(); - - assert_eq!(data, sorted_data); - } - - #[test] - fn test_multiple_segments() { - let sorter = ExternalSorter::new().with_segment_size(100); - let data: Vec = (0..1000u32).collect(); - - let data_rev: Vec = data.iter().rev().cloned().collect(); - let sorted_iter = sorter.sort(data_rev.into_iter()).unwrap(); - assert_eq!(sorted_iter.segments_file.len(), 10); - - let sorted_data: Vec = sorted_iter.collect(); - assert_eq!(data, sorted_data); - } - - #[test] - fn test_parallel() { - let sorter = ExternalSorter::new() - .with_segment_size(100) - .with_parallel_sort(); - let data: Vec = (0..1000u32).collect(); - - let data_rev: Vec = data.iter().rev().cloned().collect(); - let sorted_iter = sorter.sort(data_rev.into_iter()).unwrap(); - assert_eq!(sorted_iter.segments_file.len(), 10); - - let sorted_data: Vec = sorted_iter.collect(); - assert_eq!(data, sorted_data); - } - - impl Sortable for u32 { - fn encode(&self, writer: &mut W) { - writer.write_u32::(*self).unwrap(); - } - - fn decode(reader: &mut R) -> Option { - reader.read_u32::().ok() - } - } -} diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 4854990e6..7b19547ea 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -256,7 +256,7 @@ impl Sortable for Line { line: self.line.to_owned(), selections: self.selections.to_owned(), }; - let serialized = serde_json::ser::to_string(&line).unwrap(); + let serialized = serde_json::to_string(&line).unwrap(); // Each instance of valid JSON needs to be seperated by something, so here we use a newline write .write_all(format!("{}{}", serialized, "\n").as_bytes()) @@ -275,7 +275,7 @@ impl Sortable for Line { let mut selections_joined = SmallVec::new(); let p_iter = buf_reader.lines().peekable(); for line in p_iter { - let mut deserialized_line: Line = serde_json::de::from_str(&line.unwrap()).unwrap(); + let mut deserialized_line: Line = serde_json::from_str(&line.unwrap()).unwrap(); line_joined = format!("{}\n{}\n", line_joined, deserialized_line.line); // I think we've done our sorting already and these are irrelevant? // @miDeb what's your sense? Could we just return an empty vec? From 298e269531b8c1ba0f29e6d31d476c0a824c078e Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 15:08:42 -0500 Subject: [PATCH 0370/1135] Remove unsed code --- src/uu/sort/src/ext_sorter/mod.rs | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/uu/sort/src/ext_sorter/mod.rs b/src/uu/sort/src/ext_sorter/mod.rs index c5d7e59e8..07ae3bb09 100644 --- a/src/uu/sort/src/ext_sorter/mod.rs +++ b/src/uu/sort/src/ext_sorter/mod.rs @@ -75,18 +75,6 @@ impl ExternalSorter { self.parallel = true; self } - - /// Sorts a given iterator, returning a new iterator with items - pub fn sort( - &self, - iterator: I, - ) -> Result Ordering + Send + Sync>, Error> - where - T: Sortable + Ord, - I: Iterator, - { - self.sort_by(iterator, |a, b| a.cmp(b)) - } /// Sorts a given iterator with a comparator function, returning a new iterator with items pub fn sort_by(&self, iterator: I, cmp: F) -> Result, Error> @@ -98,12 +86,10 @@ impl ExternalSorter { let mut tempdir: Option = None; let mut sort_dir: Option = None; - let mut count = 0; let mut segments_file: Vec = Vec::new(); let size_of_items = std::mem::size_of::(); let mut buffer: Vec = Vec::with_capacity(self.segment_size / size_of_items); for next_item in iterator { - count += 1; buffer.push(next_item); if buffer.len() > self.segment_size { let sort_dir = self.lazy_create_dir(&mut tempdir, &mut sort_dir)?; @@ -122,7 +108,7 @@ impl ExternalSorter { Some(VecDeque::from(buffer)) }; - SortedIterator::new(tempdir, pass_through_queue, segments_file, count, cmp) + SortedIterator::new(tempdir, pass_through_queue, segments_file, cmp) } /// We only want to create directory if it's needed (i.e. if the dataset @@ -199,7 +185,6 @@ pub struct SortedIterator { pass_through_queue: Option>, segments_file: Vec>, next_values: Vec>, - count: u64, cmp: F, } @@ -208,7 +193,6 @@ impl Ordering + Send + Sync> SortedIterator tempdir: Option, pass_through_queue: Option>, mut segments_file: Vec, - count: u64, cmp: F, ) -> Result, Error> { for segment in &mut segments_file { @@ -227,7 +211,6 @@ impl Ordering + Send + Sync> SortedIterator pass_through_queue, segments_file: segments_file_buffered, next_values, - count, cmp, }) } From 9170e7a5112f6ca437e564bfd6b2fbaac13ea6d6 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 15:15:12 -0500 Subject: [PATCH 0371/1135] Modify NOTICE --- src/uu/sort/src/ext_sorter/NOTICE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/sort/src/ext_sorter/NOTICE b/src/uu/sort/src/ext_sorter/NOTICE index 3a20ec6e7..168d9d3b5 100644 --- a/src/uu/sort/src/ext_sorter/NOTICE +++ b/src/uu/sort/src/ext_sorter/NOTICE @@ -1,8 +1,8 @@ extsort Copyright 2016 Andre-Philippe Paquet -This project includes software developed by Andre-Philippe Paquet. +This ext_sorter module includes software developed by Andre-Philippe Paquet. -The ext_sorter.rs file was copied and modified for use in the uutils' coreutils subproject, sort. +The sorter.rs file was copied and modified for use in the uutils' coreutils subproject, sort. Except as otherwise specified, all other contributions to sort are licensed according to the terms of the LICENSE file. \ No newline at end of file From e841bb6a2414114669bd2d75a23260f54d2da505 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 15:20:16 -0500 Subject: [PATCH 0372/1135] More license cleanup --- src/uu/sort/src/ext_sorter/{LICENSE => APACHE_LICENSE} | 0 src/uu/sort/src/ext_sorter/NOTICE | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename src/uu/sort/src/ext_sorter/{LICENSE => APACHE_LICENSE} (100%) diff --git a/src/uu/sort/src/ext_sorter/LICENSE b/src/uu/sort/src/ext_sorter/APACHE_LICENSE similarity index 100% rename from src/uu/sort/src/ext_sorter/LICENSE rename to src/uu/sort/src/ext_sorter/APACHE_LICENSE diff --git a/src/uu/sort/src/ext_sorter/NOTICE b/src/uu/sort/src/ext_sorter/NOTICE index 168d9d3b5..2964ac31d 100644 --- a/src/uu/sort/src/ext_sorter/NOTICE +++ b/src/uu/sort/src/ext_sorter/NOTICE @@ -1,8 +1,8 @@ extsort -Copyright 2016 Andre-Philippe Paquet +Copyright 2018 Andre-Philippe Paquet This ext_sorter module includes software developed by Andre-Philippe Paquet. The sorter.rs file was copied and modified for use in the uutils' coreutils subproject, sort. -Except as otherwise specified, all other contributions to sort are licensed according to the terms of the LICENSE file. \ No newline at end of file +Except as otherwise specified, all other contributions to sort are licensed according to the terms of the LICENSE file found in root directory of this project. \ No newline at end of file From df0304d8f436e674267d33377918b059ae0ad31e Mon Sep 17 00:00:00 2001 From: Aleksandar Janicijevic Date: Sun, 18 Apr 2021 16:36:43 -0400 Subject: [PATCH 0373/1135] touch: added unit test for test -m -t fail (#2089) --- tests/by-util/test_touch.rs | 55 +++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index 9f2c079b0..40fbb8aa9 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -367,7 +367,58 @@ fn test_touch_mtime_dst_succeeds() { let target_time = str_to_filetime("%Y%m%d%H%M", "202103140300"); let (_, mtime) = get_file_times(&at, file); - eprintln!("target_time: {:?}", target_time); - eprintln!("mtime: {:?}", mtime); assert!(target_time == mtime); } + +// is_dst_switch_hour returns true if timespec ts is just before the switch +// to Daylight Saving Time. +// For example, in EST (UTC-5), Timespec { sec: 1583647200, nsec: 0 } +// for March 8 2020 01:00:00 AM +// is just before the switch because on that day clock jumps by 1 hour, +// so 1 minute after 01:59:00 is 03:00:00. +fn is_dst_switch_hour(ts: time::Timespec) -> bool { + let ts_after = ts + time::Duration::hours(1); + let tm = time::at(ts); + let tm_after = time::at(ts_after); + tm_after.tm_hour == tm.tm_hour + 2 +} + +// get_dstswitch_hour returns date string for which touch -m -t fails. +// For example, in EST (UTC-5), that will be "202003080200" so +// touch -m -t 202003080200 somefile +// fails (that date/time does not exist). +// In other locales it will be a different date/time, and in some locales +// it doesn't exist at all, in which case this function will return None. +fn get_dstswitch_hour() -> Option { + let now = time::now(); + // Start from January 1, 2020, 00:00. + let mut tm = time::strptime("20200101-0000", "%Y%m%d-%H%M").unwrap(); + tm.tm_isdst = -1; + tm.tm_utcoff = now.tm_utcoff; + let mut ts = tm.to_timespec(); + // Loop through all hours in year 2020 until we find the hour just + // before the switch to DST. + for _i in 0..(366 * 24) { + if is_dst_switch_hour(ts) { + let mut tm = time::at(ts); + tm.tm_hour = tm.tm_hour + 1; + let s = time::strftime("%Y%m%d%H%M", &tm).unwrap().to_string(); + return Some(s); + } + ts = ts + time::Duration::hours(1); + } + None +} + +#[test] +fn test_touch_mtime_dst_fails() { + let (_at, mut ucmd) = at_and_ucmd!(); + let file = "test_touch_set_mtime_dst_fails"; + + match get_dstswitch_hour() { + Some(s) => { + ucmd.args(&["-m", "-t", &s, file]).fails(); + } + None => (), + } +} From fb19522ca05401ec95eed6f091c89f5fd0c94fbb Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 15:39:20 -0500 Subject: [PATCH 0374/1135] Bring back non-external sort as default --- src/uu/sort/src/sort.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 7b19547ea..e04688e70 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -18,6 +18,7 @@ extern crate uucore; mod ext_sorter; mod numeric_str_cmp; +use rayon::prelude::*; use clap::{App, Arg}; use fnv::FnvHasher; use itertools::Itertools; @@ -1031,8 +1032,15 @@ fn exec(files: Vec, settings: &GlobalSettings) -> i32 { return exec_check_file(&lines, &settings); } - lines = sort_by(lines, &settings); - + // Only use ext_sorter when we need to. + // Probably faster that we don't create + // an owned value each run + if settings.buffer_size != DEFAULT_BUF_SIZE { + lines = ext_sort_by(lines, &settings); + } else { + sort_by(&mut lines, &settings); + } + if settings.merge { if settings.unique { print_sorted(file_merger.dedup(), &settings) @@ -1086,7 +1094,7 @@ fn exec_check_file(unwrapped_lines: &[Line], settings: &GlobalSettings) -> i32 { } } -fn sort_by(lines: Vec, settings: &GlobalSettings) -> Vec { +fn ext_sort_by(lines: Vec, settings: &GlobalSettings) -> Vec { let sorter = ExternalSorter::new() .with_segment_size(settings.buffer_size) .with_sort_dir(settings.tmp_dir.clone()) @@ -1098,6 +1106,10 @@ fn sort_by(lines: Vec, settings: &GlobalSettings) -> Vec { result } +fn sort_by(lines: &mut Vec, settings: &GlobalSettings) { + lines.par_sort_by(|a, b| compare_by(a, b, &settings)) +} + fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering { for (idx, selector) in global_settings.selectors.iter().enumerate() { let a_selection = &a.selections[idx]; From 559f4e81f607749c4af505c97211459c78854287 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 15:47:05 -0500 Subject: [PATCH 0375/1135] More license cleanup --- src/uu/sort/src/ext_sorter/NOTICE | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/uu/sort/src/ext_sorter/NOTICE b/src/uu/sort/src/ext_sorter/NOTICE index 2964ac31d..d7c2199d1 100644 --- a/src/uu/sort/src/ext_sorter/NOTICE +++ b/src/uu/sort/src/ext_sorter/NOTICE @@ -1,8 +1,9 @@ -extsort +ext_sorter Copyright 2018 Andre-Philippe Paquet +Copyright 2021 Robert Swinford -This ext_sorter module includes software developed by Andre-Philippe Paquet. +This ext_sorter module includes software developed by Andre-Philippe Paquet as extsort. The sorter.rs file was copied and modified for use in the uutils' coreutils subproject, sort. -Except as otherwise specified, all other contributions to sort are licensed according to the terms of the LICENSE file found in root directory of this project. \ No newline at end of file +sort is licensed according to the term of the LICENSE file found in root directory of the uutils' coreutils project. \ No newline at end of file From deb94cef7aca462e0c1dc405ff1a13ec0fc23b0c Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 15:52:48 -0500 Subject: [PATCH 0376/1135] Cleanup --- src/uu/sort/src/sort.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index e04688e70..1df3b1bc9 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -264,11 +264,8 @@ impl Sortable for Line { .unwrap(); } - // This crate asks us to write one Line at a time, but returns multiple Lines to us(?). - // However, this crate also expects us to return a result of Option, - // so we concat the these lines into a single Option. So, it's possible this is broken, - // and/or needs to be tested more thoroughly. Perhaps we need to rethink our Line struct or rewrite a - // ext sorter ourselves. + // This crate asks us to write one Line struct at a time, but then returns multiple Lines to us at once. + // We concatanate them and return them as one big Line here. fn decode(read: &mut R) -> Option { let buf_reader = BufReader::new(read); let result = { @@ -278,7 +275,7 @@ impl Sortable for Line { for line in p_iter { let mut deserialized_line: Line = serde_json::from_str(&line.unwrap()).unwrap(); line_joined = format!("{}\n{}\n", line_joined, deserialized_line.line); - // I think we've done our sorting already and these are irrelevant? + // I think we've done our sorting already and these selctions are irrelevant? // @miDeb what's your sense? Could we just return an empty vec? selections_joined.append(&mut deserialized_line.selections); } From 8072e2092af919eab71cfffe144851ff943edf2c Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 16:33:18 -0500 Subject: [PATCH 0377/1135] Cleanup loop, run rustfmt --- src/uu/sort/src/ext_sorter/mod.rs | 2 +- src/uu/sort/src/sort.rs | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/uu/sort/src/ext_sorter/mod.rs b/src/uu/sort/src/ext_sorter/mod.rs index 07ae3bb09..92b88637d 100644 --- a/src/uu/sort/src/ext_sorter/mod.rs +++ b/src/uu/sort/src/ext_sorter/mod.rs @@ -75,7 +75,7 @@ impl ExternalSorter { self.parallel = true; self } - + /// Sorts a given iterator with a comparator function, returning a new iterator with items pub fn sort_by(&self, iterator: I, cmp: F) -> Result, Error> where diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 1df3b1bc9..ea41ce24f 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -18,14 +18,14 @@ extern crate uucore; mod ext_sorter; mod numeric_str_cmp; -use rayon::prelude::*; use clap::{App, Arg}; +use ext_sorter::{ExternalSorter, Sortable}; use fnv::FnvHasher; use itertools::Itertools; use numeric_str_cmp::{numeric_str_cmp, NumInfo, NumInfoParseSettings}; -use ext_sorter::{ExternalSorter, Sortable}; use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; +use rayon::prelude::*; use semver::Version; use serde::{Deserialize, Serialize}; use smallvec::SmallVec; @@ -271,16 +271,21 @@ impl Sortable for Line { let result = { let mut line_joined = String::new(); let mut selections_joined = SmallVec::new(); - let p_iter = buf_reader.lines().peekable(); - for line in p_iter { - let mut deserialized_line: Line = serde_json::from_str(&line.unwrap()).unwrap(); - line_joined = format!("{}\n{}\n", line_joined, deserialized_line.line); + let mut p_iter = buf_reader.lines().peekable(); + while let Some(line) = p_iter.next() { + let mut deserialized_line: Line = + serde_json::from_str(&line.as_ref().unwrap()).unwrap(); + if let Some(_next_line) = p_iter.peek() { + line_joined = format!("{}\n{}\n", line_joined, deserialized_line.line) + } else { + line_joined = format!("{}\n{}", line_joined, deserialized_line.line) + } // I think we've done our sorting already and these selctions are irrelevant? // @miDeb what's your sense? Could we just return an empty vec? selections_joined.append(&mut deserialized_line.selections); } Some(Line { - line: line_joined.strip_suffix("\n").unwrap_or("").to_owned(), + line: line_joined, selections: selections_joined, }) }; @@ -888,7 +893,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .map(String::from) .unwrap_or(format!("{}", DEFAULT_BUF_SIZE)); - human_numeric_convert(&input) + human_numeric_convert(&input) } } @@ -1030,14 +1035,14 @@ fn exec(files: Vec, settings: &GlobalSettings) -> i32 { } // Only use ext_sorter when we need to. - // Probably faster that we don't create + // Probably faster that we don't create // an owned value each run if settings.buffer_size != DEFAULT_BUF_SIZE { lines = ext_sort_by(lines, &settings); } else { sort_by(&mut lines, &settings); } - + if settings.merge { if settings.unique { print_sorted(file_merger.dedup(), &settings) From 258325491f341db66341e8133f72fc586b281af4 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 17:39:42 -0500 Subject: [PATCH 0378/1135] Make human_numeric_convert a method --- src/uu/sort/src/sort.rs | 45 ++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index ea41ce24f..7da1c8cd7 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -127,6 +127,29 @@ struct GlobalSettings { tmp_dir: PathBuf, } +impl GlobalSettings { + // It's back to do conversions for command line opts! + // Probably want to do through numstrcmp somehow now? + fn human_numeric_convert(a: &str) -> usize { + let num_part = leading_num_common(a); + let (_, s) = a.split_at(num_part.len()); + let num_part = permissive_f64_parse(num_part); + let suffix = match s.parse().unwrap_or('\0') { + // SI Units + 'K' | 'k' => 1E3, + 'M' => 1E6, + 'G' => 1E9, + 'T' => 1E12, + 'P' => 1E15, + 'E' => 1E18, + 'Z' => 1E21, + 'Y' => 1E24, + _ => 1f64, + }; + num_part as usize * suffix as usize + } +} + impl Default for GlobalSettings { fn default() -> GlobalSettings { GlobalSettings { @@ -893,7 +916,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .map(String::from) .unwrap_or(format!("{}", DEFAULT_BUF_SIZE)); - human_numeric_convert(&input) + GlobalSettings::human_numeric_convert(&input) } } @@ -1156,26 +1179,6 @@ fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering } } -// It's back to do conversions for command options! Probably want to do through numstrcmp somehow now -fn human_numeric_convert(a: &str) -> usize { - let num_part = leading_num_common(a); - let (_, s) = a.split_at(num_part.len()); - let num_part = permissive_f64_parse(num_part); - let suffix = match s.parse().unwrap_or('\0') { - // SI Units - 'K' | 'k' => 1E3, - 'M' => 1E6, - 'G' => 1E9, - 'T' => 1E12, - 'P' => 1E15, - 'E' => 1E18, - 'Z' => 1E21, - 'Y' => 1E24, - _ => 1f64, - }; - num_part as usize * suffix as usize -} - // Test output against BSDs and GNU with their locale // env var set to lc_ctype=utf-8 to enjoy the exact same output. #[inline(always)] From 72858dda423cd9df812425c53f1aa5ac29bdf951 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 17:40:59 -0500 Subject: [PATCH 0379/1135] Ran rustfmt --- src/uu/sort/src/sort.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 7da1c8cd7..4938450f4 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -127,8 +127,8 @@ struct GlobalSettings { tmp_dir: PathBuf, } -impl GlobalSettings { - // It's back to do conversions for command line opts! +impl GlobalSettings { + // It's back to do conversions for command line opts! // Probably want to do through numstrcmp somehow now? fn human_numeric_convert(a: &str) -> usize { let num_part = leading_num_common(a); From 5efd67b5e2d969cb8a8e8d17e2cb4da216a1d016 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 17:44:45 -0500 Subject: [PATCH 0380/1135] License cleanup --- src/uu/sort/src/ext_sorter/NOTICE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/sort/src/ext_sorter/NOTICE b/src/uu/sort/src/ext_sorter/NOTICE index d7c2199d1..fdfc6f04f 100644 --- a/src/uu/sort/src/ext_sorter/NOTICE +++ b/src/uu/sort/src/ext_sorter/NOTICE @@ -1,6 +1,6 @@ ext_sorter Copyright 2018 Andre-Philippe Paquet -Copyright 2021 Robert Swinford +Modifications copyright 2021 Robert Swinford This ext_sorter module includes software developed by Andre-Philippe Paquet as extsort. From fcebdbb7a737750b70b7bfd8883bee5b2acaaa04 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 17:51:44 -0500 Subject: [PATCH 0381/1135] Cleanup comment --- src/uu/sort/src/sort.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 4938450f4..3b13e5bbb 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -908,7 +908,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } if matches.is_present(OPT_BUF_SIZE) { - // 10K is the default extsort buffer, but that's too small, so we set at 100M + // 16G is the default in memory buffer. // Although the "default" is never used unless extsort options are given settings.buffer_size = { let input = matches From e7bcd5955815461873e9a4ed304afe796e42b6ab Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 18 Apr 2021 18:22:30 -0500 Subject: [PATCH 0382/1135] Remove a clone --- src/uu/sort/src/sort.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 3b13e5bbb..d5a2ccbf4 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1227,7 +1227,7 @@ fn get_leading_gen(a: &str) -> &str { let mut p_iter = raw_leading_num.chars().peekable(); let mut result = ""; // Cleanup raw stripped strings - for c in p_iter.to_owned() { + while let Some(c) = p_iter.next() { let next_char_numeric = p_iter.peek().unwrap_or(&'\0').is_numeric(); // Only general numeric recognizes e notation and, see block below, the '+' sign // Only GNU (non-general) numeric recognize thousands seperators, takes only leading # From 049f21a1990648647c73611a10082d9226604b22 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 19 Apr 2021 10:45:51 +0200 Subject: [PATCH 0383/1135] du: fix tests on linux (#2066) (#2090) --- src/uu/du/src/du.rs | 2 +- tests/by-util/test_du.rs | 130 +++++++++++++++++++++++---------------- 2 files changed, 79 insertions(+), 53 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index e01af5195..fa3b3c80a 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -500,7 +500,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; let strs = if matches.free.is_empty() { - vec!["./".to_owned()] + vec!["./".to_owned()] // TODO: gnu `du` doesn't use trailing "/" here } else { matches.free.clone() }; diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index ea6b18937..16adcb974 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -10,7 +10,7 @@ fn test_du_basics() { new_ucmd!().succeeds().no_stderr(); } #[cfg(target_vendor = "apple")] -fn _du_basics(s: String) { +fn _du_basics(s: &str) { let answer = "32\t./subdir 8\t./subdir/deeper 24\t./subdir/links @@ -30,11 +30,18 @@ fn _du_basics(s: &str) { #[test] fn test_du_basics_subdir() { - let (_at, mut ucmd) = at_and_ucmd!(); + let scene = TestScenario::new(util_name!()); - let result = ucmd.arg(SUB_DIR).run(); - assert!(result.success); - assert_eq!(result.stderr, ""); + let result = scene.ucmd().arg(SUB_DIR).succeeds(); + + #[cfg(target_os = "linux")] + { + let result_reference = scene.cmd("du").arg(SUB_DIR).run(); + if result_reference.succeeded() { + assert_eq!(result.stdout_str(), result_reference.stdout_str()); + return; + } + } _du_basics_subdir(result.stdout_str()); } @@ -58,26 +65,29 @@ fn _du_basics_subdir(s: &str) { #[test] fn test_du_basics_bad_name() { - let (_at, mut ucmd) = at_and_ucmd!(); - - let result = ucmd.arg("bad_name").run(); - assert_eq!(result.stdout_str(), ""); - assert_eq!( - result.stderr, - "du: error: bad_name: No such file or directory\n" - ); + new_ucmd!() + .arg("bad_name") + .succeeds() // TODO: replace with ".fails()" once `du` is fixed + .stderr_only("du: error: bad_name: No such file or directory\n"); } #[test] fn test_du_soft_link() { - let ts = TestScenario::new("du"); + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; - let link = ts.ccmd("ln").arg("-s").arg(SUB_FILE).arg(SUB_LINK).run(); - assert!(link.success); + at.symlink_file(SUB_FILE, SUB_LINK); - let result = ts.ucmd().arg(SUB_DIR_LINKS).run(); - assert!(result.success); - assert_eq!(result.stderr, ""); + let result = scene.ucmd().arg(SUB_DIR_LINKS).succeeds(); + + #[cfg(target_os = "linux")] + { + let result_reference = scene.cmd("du").arg(SUB_DIR_LINKS).run(); + if result_reference.succeeded() { + assert_eq!(result.stdout_str(), result_reference.stdout_str()); + return; + } + } _du_soft_link(result.stdout_str()); } @@ -102,14 +112,23 @@ fn _du_soft_link(s: &str) { #[test] fn test_du_hard_link() { - let ts = TestScenario::new("du"); + let scene = TestScenario::new(util_name!()); - let link = ts.ccmd("ln").arg(SUB_FILE).arg(SUB_LINK).run(); - assert!(link.success); + let result_ln = scene.cmd("ln").arg(SUB_FILE).arg(SUB_LINK).run(); + if !result_ln.succeeded() { + scene.ccmd("ln").arg(SUB_FILE).arg(SUB_LINK).succeeds(); + } - let result = ts.ucmd().arg(SUB_DIR_LINKS).run(); - assert!(result.success); - assert_eq!(result.stderr, ""); + let result = scene.ucmd().arg(SUB_DIR_LINKS).succeeds(); + + #[cfg(target_os = "linux")] + { + let result_reference = scene.cmd("du").arg(SUB_DIR_LINKS).run(); + if result_reference.succeeded() { + assert_eq!(result.stdout_str(), result_reference.stdout_str()); + return; + } + } // We do not double count hard links as the inodes are identical _du_hard_link(result.stdout_str()); } @@ -134,11 +153,23 @@ fn _du_hard_link(s: &str) { #[test] fn test_du_d_flag() { - let ts = TestScenario::new("du"); + let scene = TestScenario::new(util_name!()); - let result = ts.ucmd().arg("-d").arg("1").run(); - assert!(result.success); - assert_eq!(result.stderr, ""); + let result = scene.ucmd().arg("-d1").succeeds(); + + #[cfg(target_os = "linux")] + { + let result_reference = scene.cmd("du").arg("-d1").run(); + if result_reference.succeeded() { + assert_eq!( + // TODO: gnu `du` doesn't use trailing "/" here + // result.stdout_str(), result_reference.stdout_str() + result.stdout_str().trim_end_matches("/\n"), + result_reference.stdout_str().trim_end_matches("\n") + ); + return; + } + } _du_d_flag(result.stdout_str()); } @@ -162,9 +193,7 @@ fn _du_d_flag(s: &str) { #[test] fn test_du_h_flag_empty_file() { - let ts = TestScenario::new("du"); - - ts.ucmd() + new_ucmd!() .arg("-h") .arg("empty.txt") .succeeds() @@ -174,54 +203,51 @@ fn test_du_h_flag_empty_file() { #[cfg(feature = "touch")] #[test] fn test_du_time() { - let ts = TestScenario::new("du"); + let scene = TestScenario::new(util_name!()); - let touch = ts + scene .ccmd("touch") .arg("-a") .arg("-m") .arg("-t") .arg("201505150000") .arg("date_test") - .run(); - assert!(touch.success); + .succeeds(); - let result = ts.ucmd().arg("--time").arg("date_test").run(); + scene + .ucmd() + .arg("--time") + .arg("date_test") + .succeeds() + .stdout_only("0\t2015-05-15 00:00\tdate_test\n"); // cleanup by removing test file - ts.cmd("rm").arg("date_test").run(); - - assert!(result.success); - assert_eq!(result.stderr, ""); - assert_eq!(result.stdout, "0\t2015-05-15 00:00\tdate_test\n"); + scene.cmd("rm").arg("date_test").succeeds(); // TODO: is this necessary? } #[cfg(not(target_os = "windows"))] #[cfg(feature = "chmod")] #[test] fn test_du_no_permission() { - let ts = TestScenario::new("du"); + let ts = TestScenario::new(util_name!()); - let chmod = ts.ccmd("chmod").arg("-r").arg(SUB_DIR_LINKS).run(); - println!("chmod output: {:?}", chmod); - assert!(chmod.success); - let result = ts.ucmd().arg(SUB_DIR_LINKS).run(); + let _chmod = ts.ccmd("chmod").arg("-r").arg(SUB_DIR_LINKS).succeeds(); + let result = ts.ucmd().arg(SUB_DIR_LINKS).succeeds(); ts.ccmd("chmod").arg("+r").arg(SUB_DIR_LINKS).run(); - assert!(result.success); assert_eq!( - result.stderr, + result.stderr_str(), "du: cannot read directory ‘subdir/links‘: Permission denied (os error 13)\n" ); - _du_no_permission(result.stdout); + _du_no_permission(result.stdout_str()); } #[cfg(target_vendor = "apple")] -fn _du_no_permission(s: String) { +fn _du_no_permission(s: &str) { assert_eq!(s, "0\tsubdir/links\n"); } #[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] -fn _du_no_permission(s: String) { +fn _du_no_permission(s: &str) { assert_eq!(s, "4\tsubdir/links\n"); } From 879ab2ecb02a9f85cdbe2bcafbc5f3a5463f8810 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 19 Apr 2021 11:14:04 +0200 Subject: [PATCH 0384/1135] Disable test_no_options_big_input on freebsd too (#2093) --- tests/by-util/test_cat.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index eb6cc9148..389269395 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -26,7 +26,7 @@ fn test_no_options() { } #[test] -#[cfg(unix)] +#[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))] fn test_no_options_big_input() { for &n in &[ 0, From 3bb99e70477e134c634da20c01644ca2e77c5677 Mon Sep 17 00:00:00 2001 From: Chirag Jadwani Date: Mon, 19 Apr 2021 17:02:24 +0530 Subject: [PATCH 0385/1135] uniq: avoid building list of duplicate lines This reduces memory usage by only storing two lines of the input file at a time. The current implementation first builds a list of all duplicate lines ('group') and then decides which lines of the group should be printed. --- src/uu/uniq/src/uniq.rs | 89 ++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 45 deletions(-) diff --git a/src/uu/uniq/src/uniq.rs b/src/uu/uniq/src/uniq.rs index a61a78a61..7e9862e65 100644 --- a/src/uu/uniq/src/uniq.rs +++ b/src/uu/uniq/src/uniq.rs @@ -61,34 +61,43 @@ impl Uniq { reader: &mut BufReader, writer: &mut BufWriter, ) { - let mut lines: Vec = vec![]; let mut first_line_printed = false; - let delimiters = self.delimiters; + let mut group_count = 1; let line_terminator = self.get_line_terminator(); - // Don't print any delimiting lines before, after or between groups if delimiting method is 'none' - let no_delimiters = delimiters == Delimiters::None; - // The 'prepend' and 'both' delimit methods will cause output to start with delimiter line - let prepend_delimiter = delimiters == Delimiters::Prepend || delimiters == Delimiters::Both; - // The 'append' and 'both' delimit methods will cause output to end with delimiter line - let append_delimiter = delimiters == Delimiters::Append || delimiters == Delimiters::Both; + let mut lines = reader.split(line_terminator).map(get_line_string); + let mut line = match lines.next() { + Some(l) => l, + None => return, + }; - for line in reader.split(line_terminator).map(get_line_string) { - if !lines.is_empty() && self.cmp_keys(&lines[0], &line) { - // Print delimiter if delimit method is not 'none' and any line has been output - // before or if we need to start output with delimiter - let print_delimiter = !no_delimiters && (prepend_delimiter || first_line_printed); - first_line_printed |= self.print_lines(writer, &lines, print_delimiter); - lines.truncate(0); + // compare current `line` with consecutive lines (`next_line`) of the input + // and if needed, print `line` based on the command line options provided + for next_line in lines { + if self.cmp_keys(&line, &next_line) { + if (group_count == 1 && !self.repeats_only) + || (group_count > 1 && !self.uniques_only) + { + self.print_line(writer, &line, group_count, first_line_printed); + first_line_printed = true; + } + line = next_line; + group_count = 1; + } else { + if self.all_repeated { + self.print_line(writer, &line, group_count, first_line_printed); + first_line_printed = true; + line = next_line; + } + group_count += 1; } - lines.push(line); } - if !lines.is_empty() { - // Print delimiter if delimit method is not 'none' and any line has been output - // before or if we need to start output with delimiter - let print_delimiter = !no_delimiters && (prepend_delimiter || first_line_printed); - first_line_printed |= self.print_lines(writer, &lines, print_delimiter); + if (group_count == 1 && !self.repeats_only) || (group_count > 1 && !self.uniques_only) { + self.print_line(writer, &line, group_count, first_line_printed); + first_line_printed = true; } - if append_delimiter && first_line_printed { + if (self.delimiters == Delimiters::Append || self.delimiters == Delimiters::Both) + && first_line_printed + { crash_if_err!(1, writer.write_all(&[line_terminator])); } } @@ -163,27 +172,17 @@ impl Uniq { } } - fn print_lines( - &self, - writer: &mut BufWriter, - lines: &[String], - print_delimiter: bool, - ) -> bool { - let mut first_line_printed = false; - let mut count = if self.all_repeated { 1 } else { lines.len() }; - if lines.len() == 1 && !self.repeats_only || lines.len() > 1 && !self.uniques_only { - self.print_line(writer, &lines[0], count, print_delimiter); - first_line_printed = true; - count += 1; - } - if self.all_repeated { - for line in lines[1..].iter() { - self.print_line(writer, line, count, print_delimiter && !first_line_printed); - first_line_printed = true; - count += 1; - } - } - first_line_printed + fn should_print_delimiter(&self, group_count: usize, first_line_printed: bool) -> bool { + // if no delimiter option is selected then no other checks needed + self.delimiters != Delimiters::None + // print delimiter only before the first line of a group, not between lines of a group + && group_count == 1 + // if at least one line has been output before current group then print delimiter + && (first_line_printed + // or if we need to prepend delimiter then print it even at the start of the output + || self.delimiters == Delimiters::Prepend + // the 'both' delimit mode should prepend and append delimiters + || self.delimiters == Delimiters::Both) } fn print_line( @@ -191,11 +190,11 @@ impl Uniq { writer: &mut BufWriter, line: &str, count: usize, - print_delimiter: bool, + first_line_printed: bool, ) { let line_terminator = self.get_line_terminator(); - if print_delimiter { + if self.should_print_delimiter(count, first_line_printed) { crash_if_err!(1, writer.write_all(&[line_terminator])); } From 158ae35da5d6ef828d7945546b2276137cdff985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Jord=C3=A3o?= Date: Mon, 19 Apr 2021 14:21:49 +0100 Subject: [PATCH 0386/1135] Commented out code removal --- .../num_format/formatters/base_conv/mod.rs | 64 ------------------- .../formatters/cninetyninehexfloatf.rs | 28 -------- 2 files changed, 92 deletions(-) diff --git a/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs b/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs index 701fb5dfc..e3c34df6b 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs @@ -101,70 +101,6 @@ pub fn arrnum_int_div_step( remainder: rem_out, } } -// pub struct ArrFloat { -// pub leading_zeros: u8, -// pub values: Vec, -// pub basenum: u8 -// } -// -// pub struct ArrFloatDivOut { -// pub quotient: u8, -// pub remainder: ArrFloat -// } -// -// pub fn arrfloat_int_div( -// arrfloat_in : &ArrFloat, -// base_ten_int_divisor : u8, -// precision : u16 -// ) -> DivOut { -// -// let mut remainder = ArrFloat { -// basenum: arrfloat_in.basenum, -// leading_zeros: arrfloat_in.leading_zeroes, -// values: Vec::new() -// } -// let mut quotient = 0; -// -// let mut bufferval : u16 = 0; -// let base : u16 = arrfloat_in.basenum as u16; -// let divisor : u16 = base_ten_int_divisor as u16; -// -// let mut it_f = arrfloat_in.values.iter(); -// let mut position = 0 + arrfloat_in.leading_zeroes as u16; -// let mut at_end = false; -// while position< precision { -// let next_digit = match it_f.next() { -// Some(c) => {} -// None => { 0 } -// } -// match u_cur { -// Some(u) => { -// bufferval += u.clone() as u16; -// if bufferval > divisor { -// while bufferval >= divisor { -// quotient+=1; -// bufferval -= divisor; -// } -// if bufferval == 0 { -// rem_out.position +=1; -// } else { -// rem_out.replace = Some(bufferval as u8); -// } -// break; -// } else { -// bufferval *= base; -// } -// }, -// None => { -// break; -// } -// } -// u_cur = it_f.next().clone(); -// rem_out.position+=1; -// } -// ArrFloatDivOut { quotient: quotient, remainder: remainder } -// } -// pub fn arrnum_int_add(arrnum: &[u8], basenum: u8, base_ten_int_term: u8) -> Vec { let mut carry: u16 = u16::from(base_ten_int_term); let mut rem: u16; diff --git a/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs b/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs index f28121d3e..870e64712 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs @@ -52,34 +52,6 @@ fn get_primitive_hex( ) -> FormatPrimitive { let prefix = Some(String::from(if inprefix.sign == -1 { "-0x" } else { "0x" })); - // assign the digits before and after the decimal points - // to separate slices. If no digits after decimal point, - // assign 0 - //let (mut first_segment_raw, second_segment_raw) = match analysis.decimal_pos { - //Some(pos) => (&str_in[..pos], &str_in[pos + 1..]), - //None => (str_in, "0"), - //}; - //if first_segment_raw.is_empty() { - //first_segment_raw = "0"; - //} - // convert to string, hexifying if input is in dec. - // let (first_segment, second_segment) = - // match inprefix.radix_in { - // Base::Ten => { - // (to_hex(first_segment_raw, true), - // to_hex(second_segment_raw, false)) - // } - // _ => { - // (String::from(first_segment_raw), - // String::from(second_segment_raw)) - // } - // }; - // - // - // f.pre_decimal = Some(first_segment); - // f.post_decimal = Some(second_segment); - // - // TODO actual conversion, make sure to get back mantissa. // for hex to hex, it's really just a matter of moving the // decimal point and calculating the mantissa by its initial From b8d667c38393e17baf7fd10ef61eeeb717fb2cec Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Mon, 19 Apr 2021 10:57:53 -0500 Subject: [PATCH 0387/1135] Clippy lints, more work on ext_sorter leads to 2 failing tests --- .../ext_sorter/{APACHE_LICENSE => LICENSE} | 0 src/uu/sort/src/ext_sorter/mod.rs | 28 ++++++++++++++++--- src/uu/sort/src/sort.rs | 14 ++++------ 3 files changed, 29 insertions(+), 13 deletions(-) rename src/uu/sort/src/ext_sorter/{APACHE_LICENSE => LICENSE} (100%) diff --git a/src/uu/sort/src/ext_sorter/APACHE_LICENSE b/src/uu/sort/src/ext_sorter/LICENSE similarity index 100% rename from src/uu/sort/src/ext_sorter/APACHE_LICENSE rename to src/uu/sort/src/ext_sorter/LICENSE diff --git a/src/uu/sort/src/ext_sorter/mod.rs b/src/uu/sort/src/ext_sorter/mod.rs index 92b88637d..eef7befe4 100644 --- a/src/uu/sort/src/ext_sorter/mod.rs +++ b/src/uu/sort/src/ext_sorter/mod.rs @@ -86,14 +86,24 @@ impl ExternalSorter { let mut tempdir: Option = None; let mut sort_dir: Option = None; + let mut count = 0; let mut segments_file: Vec = Vec::new(); + // FYI, the initialization size of struct Line is 96 bytes, but below works for all let size_of_items = std::mem::size_of::(); - let mut buffer: Vec = Vec::with_capacity(self.segment_size / size_of_items); + let initial_capacity = + if self.segment_size / size_of_items >= 2 { + self.segment_size / size_of_items + } else { 2 }; + let mut buffer: Vec = Vec::with_capacity(initial_capacity); for next_item in iterator { + count += 1; buffer.push(next_item); - if buffer.len() > self.segment_size { + // if after push, number of elements in vector > initial capacity + if buffer.len() > initial_capacity { let sort_dir = self.lazy_create_dir(&mut tempdir, &mut sort_dir)?; self.sort_and_write_segment(sort_dir, &mut segments_file, &mut buffer, &cmp)?; + // Resize buffer after write out + // buffer.shrink_to_fit(); } } @@ -108,7 +118,7 @@ impl ExternalSorter { Some(VecDeque::from(buffer)) }; - SortedIterator::new(tempdir, pass_through_queue, segments_file, cmp) + SortedIterator::new(tempdir, pass_through_queue, segments_file, count, cmp) } /// We only want to create directory if it's needed (i.e. if the dataset @@ -158,7 +168,10 @@ impl ExternalSorter { .open(&segment_path)?; let mut buf_writer = BufWriter::new(segment_file); - for item in buffer.drain(0..) { + // Possible panic here. + // Why use drain here, if we want to dump the entire buffer? + // Was "buffer.drain(0..)" + for item in buffer { item.encode(&mut buf_writer); } @@ -185,6 +198,7 @@ pub struct SortedIterator { pass_through_queue: Option>, segments_file: Vec>, next_values: Vec>, + count: u64, cmp: F, } @@ -193,6 +207,7 @@ impl Ordering + Send + Sync> SortedIterator tempdir: Option, pass_through_queue: Option>, mut segments_file: Vec, + count: u64, cmp: F, ) -> Result, Error> { for segment in &mut segments_file { @@ -211,9 +226,14 @@ impl Ordering + Send + Sync> SortedIterator pass_through_queue, segments_file: segments_file_buffered, next_values, + count, cmp, }) } + + pub fn sorted_count(&self) -> u64 { + self.count + } } impl Ordering> Iterator for SortedIterator { diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index d5a2ccbf4..2bbc02e78 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -924,15 +924,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let result = matches .value_of(OPT_TMP_DIR) .map(String::from) - .unwrap_or(DEFAULT_TMPDIR.to_owned()); - settings.tmp_dir = PathBuf::from(format!(r"{}", result)); + .unwrap_or_else(|| DEFAULT_TMPDIR.to_owned()); + settings.tmp_dir = PathBuf::from(result); } else { for (key, value) in env::vars_os() { if key == OsString::from("TMPDIR") { - settings.tmp_dir = PathBuf::from(format!( - r"{}", - value.into_string().unwrap_or("/tmp".to_owned()) - )); + settings.tmp_dir = PathBuf::from(value); break; } settings.tmp_dir = PathBuf::from(DEFAULT_TMPDIR); @@ -1124,11 +1121,10 @@ fn ext_sort_by(lines: Vec, settings: &GlobalSettings) -> Vec { .with_segment_size(settings.buffer_size) .with_sort_dir(settings.tmp_dir.clone()) .with_parallel_sort(); - let result = sorter + sorter .sort_by(lines.into_iter(), |a, b| compare_by(a, b, &settings)) .unwrap() - .collect(); - result + .collect() } fn sort_by(lines: &mut Vec, settings: &GlobalSettings) { From 0ea35f3fbcbb3596b379e2f6dd7eac2f676da298 Mon Sep 17 00:00:00 2001 From: Sivachandran Date: Tue, 20 Apr 2021 01:33:13 +0530 Subject: [PATCH 0388/1135] Implement install create leading components(-D) option (#2092) * Implement install's create leading components(-D) option * Format changes * Add install test to check fail on long dir name --- src/uu/install/src/install.rs | 39 ++++++++++++++++++++++++++------- tests/by-util/test_install.rs | 41 ++++++++++++++++++++++++++++++++++- 2 files changed, 71 insertions(+), 9 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index a75ce45be..4ce665b80 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -41,6 +41,7 @@ pub struct Behavior { compare: bool, strip: bool, strip_program: String, + create_leading: bool, } #[derive(Clone, Eq, PartialEq)] @@ -70,7 +71,7 @@ static OPT_BACKUP: &str = "backup"; static OPT_BACKUP_2: &str = "backup2"; static OPT_DIRECTORY: &str = "directory"; static OPT_IGNORED: &str = "ignored"; -static OPT_CREATED: &str = "created"; +static OPT_CREATE_LEADING: &str = "create-leading"; static OPT_GROUP: &str = "group"; static OPT_MODE: &str = "mode"; static OPT_OWNER: &str = "owner"; @@ -133,9 +134,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg( // TODO implement flag - Arg::with_name(OPT_CREATED) + Arg::with_name(OPT_CREATE_LEADING) .short("D") - .help("(unimplemented) create all leading components of DEST except the last, then copy SOURCE to DEST") + .help("create all leading components of DEST except the last, then copy SOURCE to DEST") ) .arg( Arg::with_name(OPT_GROUP) @@ -266,8 +267,6 @@ fn check_unimplemented<'a>(matches: &ArgMatches) -> Result<(), &'a str> { Err("--backup") } else if matches.is_present(OPT_BACKUP_2) { Err("-b") - } else if matches.is_present(OPT_CREATED) { - Err("-D") } else if matches.is_present(OPT_SUFFIX) { Err("--suffix, -S") } else if matches.is_present(OPT_TARGET_DIRECTORY) { @@ -343,6 +342,7 @@ fn behavior(matches: &ArgMatches) -> Result { .value_of(OPT_STRIP_PROGRAM) .unwrap_or(DEFAULT_STRIP_PROGRAM), ), + create_leading: matches.is_present(OPT_CREATE_LEADING), }) } @@ -410,12 +410,35 @@ fn standard(paths: Vec, b: Behavior) -> i32 { .iter() .map(PathBuf::from) .collect::>(); + let target = Path::new(paths.last().unwrap()); - if (target.is_file() || is_new_file_path(target)) && sources.len() == 1 { - copy_file_to_file(&sources[0], &target.to_path_buf(), &b) - } else { + if sources.len() > 1 || (target.exists() && target.is_dir()) { copy_files_into_dir(sources, &target.to_path_buf(), &b) + } else { + if let Some(parent) = target.parent() { + if !parent.exists() && b.create_leading { + if let Err(e) = fs::create_dir_all(parent) { + show_error!("failed to create {}: {}", parent.display(), e); + return 1; + } + + if mode::chmod(&parent, b.mode()).is_err() { + show_error!("failed to chmod {}", parent.display()); + return 1; + } + } + } + + if target.is_file() || is_new_file_path(target) { + copy_file_to_file(&sources[0], &target.to_path_buf(), &b) + } else { + show_error!( + "invalid target {}: No such file or directory", + target.display() + ); + 1 + } } } diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index dfaaabce6..fa23de745 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -359,7 +359,7 @@ fn test_install_target_new_file_failing_nonexistent_parent() { ucmd.arg(file1) .arg(format!("{}/{}", dir, file2)) .fails() - .stderr_contains(&"not a directory"); + .stderr_contains(&"No such file or directory"); } #[test] @@ -649,3 +649,42 @@ fn test_install_and_strip_with_non_existent_program() { .stderr; assert!(stderr.contains("No such file or directory")); } + +#[test] +fn test_install_creating_leading_dirs() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let source = "create_leading_test_file"; + let target = "dir1/dir2/dir3/test_file"; + + at.touch(source); + + scene + .ucmd() + .arg("-D") + .arg(source) + .arg(at.plus(target)) + .succeeds() + .no_stderr(); +} + +#[test] +#[cfg(not(windows))] +fn test_install_creating_leading_dir_fails_on_long_name() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let source = "create_leading_test_file"; + let target = format!("{}/test_file", "d".repeat(libc::PATH_MAX as usize + 1)); + + at.touch(source); + + scene + .ucmd() + .arg("-D") + .arg(source) + .arg(at.plus(target.as_str())) + .fails() + .stderr_contains("failed to create"); +} From 25021f31ebd927e61ff2d2815b4d3cf169ce1c00 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Mon, 19 Apr 2021 21:24:52 -0500 Subject: [PATCH 0389/1135] Incorporate overhead of Line struct --- src/uu/sort/src/ext_sorter/mod.rs | 17 +- src/uu/sort/src/sort.rs | 11 +- tests/by-util/test_sort.rs | 31 +- tests/fixtures/sort/ext_sort.expected | 20000 ++++++++++++++++++++++++ tests/fixtures/sort/ext_sort.txt | 20000 ++++++++++++++++++++++++ 5 files changed, 40033 insertions(+), 26 deletions(-) create mode 100644 tests/fixtures/sort/ext_sort.expected create mode 100644 tests/fixtures/sort/ext_sort.txt diff --git a/src/uu/sort/src/ext_sorter/mod.rs b/src/uu/sort/src/ext_sorter/mod.rs index eef7befe4..a90be6bb0 100644 --- a/src/uu/sort/src/ext_sorter/mod.rs +++ b/src/uu/sort/src/ext_sorter/mod.rs @@ -41,6 +41,8 @@ pub struct ExternalSorter { impl ExternalSorter { pub fn new() -> ExternalSorter { ExternalSorter { + // Default is 16G - But we never use it, + // because we always set or ignore segment_size: 16000000000, sort_dir: None, parallel: false, @@ -88,13 +90,14 @@ impl ExternalSorter { let mut count = 0; let mut segments_file: Vec = Vec::new(); - // FYI, the initialization size of struct Line is 96 bytes, but below works for all + let size_of_items = std::mem::size_of::(); - let initial_capacity = - if self.segment_size / size_of_items >= 2 { - self.segment_size / size_of_items - } else { 2 }; + // Get size of iterator + let (_, upper_bound) = iterator.size_hint(); + // Buffer size specified + minimum overhead of struct / size of items + let initial_capacity = (self.segment_size + (upper_bound.unwrap() * size_of_items)) / size_of_items; let mut buffer: Vec = Vec::with_capacity(initial_capacity); + for next_item in iterator { count += 1; buffer.push(next_item); @@ -102,8 +105,8 @@ impl ExternalSorter { if buffer.len() > initial_capacity { let sort_dir = self.lazy_create_dir(&mut tempdir, &mut sort_dir)?; self.sort_and_write_segment(sort_dir, &mut segments_file, &mut buffer, &cmp)?; - // Resize buffer after write out - // buffer.shrink_to_fit(); + // Truncate buffer back to initial capacity + buffer.truncate(initial_capacity); } } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 2bbc02e78..571541fc6 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -293,10 +293,11 @@ impl Sortable for Line { let buf_reader = BufReader::new(read); let result = { let mut line_joined = String::new(); - let mut selections_joined = SmallVec::new(); + // Return an empty vec for selections + let selections_joined = SmallVec::new(); let mut p_iter = buf_reader.lines().peekable(); while let Some(line) = p_iter.next() { - let mut deserialized_line: Line = + let deserialized_line: Line = serde_json::from_str(&line.as_ref().unwrap()).unwrap(); if let Some(_next_line) = p_iter.peek() { line_joined = format!("{}\n{}\n", line_joined, deserialized_line.line) @@ -305,7 +306,7 @@ impl Sortable for Line { } // I think we've done our sorting already and these selctions are irrelevant? // @miDeb what's your sense? Could we just return an empty vec? - selections_joined.append(&mut deserialized_line.selections); + //selections_joined.append(&mut deserialized_line.selections); } Some(Line { line: line_joined, @@ -909,13 +910,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if matches.is_present(OPT_BUF_SIZE) { // 16G is the default in memory buffer. - // Although the "default" is never used unless extsort options are given + // Although the "default" is never used settings.buffer_size = { let input = matches .value_of(OPT_BUF_SIZE) .map(String::from) .unwrap_or(format!("{}", DEFAULT_BUF_SIZE)); - + GlobalSettings::human_numeric_convert(&input) } } diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 0ca917a86..c76ab219a 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -8,14 +8,28 @@ fn test_helper(file_name: &str, args: &str) { .stdout_is_fixture(format!("{}.expected", file_name)); } +// FYI, the initialization size of our Line struct is 96 bytes. +// +// At very small buffer sizes, with that overhead we are certainly going +// to overrun our buffer way, way, way too quickly because of these excess +// bytes for the struct. +// +// For instance, seq 0..20000 > ...text = 108894 bytes +// But overhead is 1920000 + 108894 = 2028894 bytes +// +// Or kjvbible-random.txt = 4332506 bytes, but minimum size of its +// 99817 lines in memory * 96 bytes = 9582432 bytes +// +// Here, we test 108894 bytes with a 50K buffer +// #[test] fn test_larger_than_specified_segment() { new_ucmd!() .arg("-n") - .arg("-S 100") - .arg("numeric_unsorted_ints.txt") + .arg("-S 50K") + .arg("ext_sort.txt") .succeeds() - .stdout_is_fixture(format!("{}", "numeric_unsorted_ints.expected")); + .stdout_is_fixture(format!("{}", "ext_sort.expected")); } #[test] @@ -202,17 +216,6 @@ fn test_non_printing_chars() { } } -#[test] -fn test_exponents_positive_general_fixed() { - for exponents_positive_general_param in vec!["-g"] { - new_ucmd!() - .pipe_in("100E6\n\n50e10\n+100000\n\n10000K78\n10E\n\n\n1000EDKLD\n\n\n100E6\n\n50e10\n+100000\n\n") - .arg(exponents_positive_general_param) - .succeeds() - .stdout_only("\n\n\n\n\n\n\n\n10000K78\n1000EDKLD\n10E\n+100000\n+100000\n100E6\n100E6\n50e10\n50e10\n"); - } -} - #[test] fn test_exponents_positive_numeric() { test_helper("exponents-positive-numeric", "-n"); diff --git a/tests/fixtures/sort/ext_sort.expected b/tests/fixtures/sort/ext_sort.expected new file mode 100644 index 000000000..7599e0c96 --- /dev/null +++ b/tests/fixtures/sort/ext_sort.expected @@ -0,0 +1,20000 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 +512 +513 +514 +515 +516 +517 +518 +519 +520 +521 +522 +523 +524 +525 +526 +527 +528 +529 +530 +531 +532 +533 +534 +535 +536 +537 +538 +539 +540 +541 +542 +543 +544 +545 +546 +547 +548 +549 +550 +551 +552 +553 +554 +555 +556 +557 +558 +559 +560 +561 +562 +563 +564 +565 +566 +567 +568 +569 +570 +571 +572 +573 +574 +575 +576 +577 +578 +579 +580 +581 +582 +583 +584 +585 +586 +587 +588 +589 +590 +591 +592 +593 +594 +595 +596 +597 +598 +599 +600 +601 +602 +603 +604 +605 +606 +607 +608 +609 +610 +611 +612 +613 +614 +615 +616 +617 +618 +619 +620 +621 +622 +623 +624 +625 +626 +627 +628 +629 +630 +631 +632 +633 +634 +635 +636 +637 +638 +639 +640 +641 +642 +643 +644 +645 +646 +647 +648 +649 +650 +651 +652 +653 +654 +655 +656 +657 +658 +659 +660 +661 +662 +663 +664 +665 +666 +667 +668 +669 +670 +671 +672 +673 +674 +675 +676 +677 +678 +679 +680 +681 +682 +683 +684 +685 +686 +687 +688 +689 +690 +691 +692 +693 +694 +695 +696 +697 +698 +699 +700 +701 +702 +703 +704 +705 +706 +707 +708 +709 +710 +711 +712 +713 +714 +715 +716 +717 +718 +719 +720 +721 +722 +723 +724 +725 +726 +727 +728 +729 +730 +731 +732 +733 +734 +735 +736 +737 +738 +739 +740 +741 +742 +743 +744 +745 +746 +747 +748 +749 +750 +751 +752 +753 +754 +755 +756 +757 +758 +759 +760 +761 +762 +763 +764 +765 +766 +767 +768 +769 +770 +771 +772 +773 +774 +775 +776 +777 +778 +779 +780 +781 +782 +783 +784 +785 +786 +787 +788 +789 +790 +791 +792 +793 +794 +795 +796 +797 +798 +799 +800 +801 +802 +803 +804 +805 +806 +807 +808 +809 +810 +811 +812 +813 +814 +815 +816 +817 +818 +819 +820 +821 +822 +823 +824 +825 +826 +827 +828 +829 +830 +831 +832 +833 +834 +835 +836 +837 +838 +839 +840 +841 +842 +843 +844 +845 +846 +847 +848 +849 +850 +851 +852 +853 +854 +855 +856 +857 +858 +859 +860 +861 +862 +863 +864 +865 +866 +867 +868 +869 +870 +871 +872 +873 +874 +875 +876 +877 +878 +879 +880 +881 +882 +883 +884 +885 +886 +887 +888 +889 +890 +891 +892 +893 +894 +895 +896 +897 +898 +899 +900 +901 +902 +903 +904 +905 +906 +907 +908 +909 +910 +911 +912 +913 +914 +915 +916 +917 +918 +919 +920 +921 +922 +923 +924 +925 +926 +927 +928 +929 +930 +931 +932 +933 +934 +935 +936 +937 +938 +939 +940 +941 +942 +943 +944 +945 +946 +947 +948 +949 +950 +951 +952 +953 +954 +955 +956 +957 +958 +959 +960 +961 +962 +963 +964 +965 +966 +967 +968 +969 +970 +971 +972 +973 +974 +975 +976 +977 +978 +979 +980 +981 +982 +983 +984 +985 +986 +987 +988 +989 +990 +991 +992 +993 +994 +995 +996 +997 +998 +999 +1000 +1001 +1002 +1003 +1004 +1005 +1006 +1007 +1008 +1009 +1010 +1011 +1012 +1013 +1014 +1015 +1016 +1017 +1018 +1019 +1020 +1021 +1022 +1023 +1024 +1025 +1026 +1027 +1028 +1029 +1030 +1031 +1032 +1033 +1034 +1035 +1036 +1037 +1038 +1039 +1040 +1041 +1042 +1043 +1044 +1045 +1046 +1047 +1048 +1049 +1050 +1051 +1052 +1053 +1054 +1055 +1056 +1057 +1058 +1059 +1060 +1061 +1062 +1063 +1064 +1065 +1066 +1067 +1068 +1069 +1070 +1071 +1072 +1073 +1074 +1075 +1076 +1077 +1078 +1079 +1080 +1081 +1082 +1083 +1084 +1085 +1086 +1087 +1088 +1089 +1090 +1091 +1092 +1093 +1094 +1095 +1096 +1097 +1098 +1099 +1100 +1101 +1102 +1103 +1104 +1105 +1106 +1107 +1108 +1109 +1110 +1111 +1112 +1113 +1114 +1115 +1116 +1117 +1118 +1119 +1120 +1121 +1122 +1123 +1124 +1125 +1126 +1127 +1128 +1129 +1130 +1131 +1132 +1133 +1134 +1135 +1136 +1137 +1138 +1139 +1140 +1141 +1142 +1143 +1144 +1145 +1146 +1147 +1148 +1149 +1150 +1151 +1152 +1153 +1154 +1155 +1156 +1157 +1158 +1159 +1160 +1161 +1162 +1163 +1164 +1165 +1166 +1167 +1168 +1169 +1170 +1171 +1172 +1173 +1174 +1175 +1176 +1177 +1178 +1179 +1180 +1181 +1182 +1183 +1184 +1185 +1186 +1187 +1188 +1189 +1190 +1191 +1192 +1193 +1194 +1195 +1196 +1197 +1198 +1199 +1200 +1201 +1202 +1203 +1204 +1205 +1206 +1207 +1208 +1209 +1210 +1211 +1212 +1213 +1214 +1215 +1216 +1217 +1218 +1219 +1220 +1221 +1222 +1223 +1224 +1225 +1226 +1227 +1228 +1229 +1230 +1231 +1232 +1233 +1234 +1235 +1236 +1237 +1238 +1239 +1240 +1241 +1242 +1243 +1244 +1245 +1246 +1247 +1248 +1249 +1250 +1251 +1252 +1253 +1254 +1255 +1256 +1257 +1258 +1259 +1260 +1261 +1262 +1263 +1264 +1265 +1266 +1267 +1268 +1269 +1270 +1271 +1272 +1273 +1274 +1275 +1276 +1277 +1278 +1279 +1280 +1281 +1282 +1283 +1284 +1285 +1286 +1287 +1288 +1289 +1290 +1291 +1292 +1293 +1294 +1295 +1296 +1297 +1298 +1299 +1300 +1301 +1302 +1303 +1304 +1305 +1306 +1307 +1308 +1309 +1310 +1311 +1312 +1313 +1314 +1315 +1316 +1317 +1318 +1319 +1320 +1321 +1322 +1323 +1324 +1325 +1326 +1327 +1328 +1329 +1330 +1331 +1332 +1333 +1334 +1335 +1336 +1337 +1338 +1339 +1340 +1341 +1342 +1343 +1344 +1345 +1346 +1347 +1348 +1349 +1350 +1351 +1352 +1353 +1354 +1355 +1356 +1357 +1358 +1359 +1360 +1361 +1362 +1363 +1364 +1365 +1366 +1367 +1368 +1369 +1370 +1371 +1372 +1373 +1374 +1375 +1376 +1377 +1378 +1379 +1380 +1381 +1382 +1383 +1384 +1385 +1386 +1387 +1388 +1389 +1390 +1391 +1392 +1393 +1394 +1395 +1396 +1397 +1398 +1399 +1400 +1401 +1402 +1403 +1404 +1405 +1406 +1407 +1408 +1409 +1410 +1411 +1412 +1413 +1414 +1415 +1416 +1417 +1418 +1419 +1420 +1421 +1422 +1423 +1424 +1425 +1426 +1427 +1428 +1429 +1430 +1431 +1432 +1433 +1434 +1435 +1436 +1437 +1438 +1439 +1440 +1441 +1442 +1443 +1444 +1445 +1446 +1447 +1448 +1449 +1450 +1451 +1452 +1453 +1454 +1455 +1456 +1457 +1458 +1459 +1460 +1461 +1462 +1463 +1464 +1465 +1466 +1467 +1468 +1469 +1470 +1471 +1472 +1473 +1474 +1475 +1476 +1477 +1478 +1479 +1480 +1481 +1482 +1483 +1484 +1485 +1486 +1487 +1488 +1489 +1490 +1491 +1492 +1493 +1494 +1495 +1496 +1497 +1498 +1499 +1500 +1501 +1502 +1503 +1504 +1505 +1506 +1507 +1508 +1509 +1510 +1511 +1512 +1513 +1514 +1515 +1516 +1517 +1518 +1519 +1520 +1521 +1522 +1523 +1524 +1525 +1526 +1527 +1528 +1529 +1530 +1531 +1532 +1533 +1534 +1535 +1536 +1537 +1538 +1539 +1540 +1541 +1542 +1543 +1544 +1545 +1546 +1547 +1548 +1549 +1550 +1551 +1552 +1553 +1554 +1555 +1556 +1557 +1558 +1559 +1560 +1561 +1562 +1563 +1564 +1565 +1566 +1567 +1568 +1569 +1570 +1571 +1572 +1573 +1574 +1575 +1576 +1577 +1578 +1579 +1580 +1581 +1582 +1583 +1584 +1585 +1586 +1587 +1588 +1589 +1590 +1591 +1592 +1593 +1594 +1595 +1596 +1597 +1598 +1599 +1600 +1601 +1602 +1603 +1604 +1605 +1606 +1607 +1608 +1609 +1610 +1611 +1612 +1613 +1614 +1615 +1616 +1617 +1618 +1619 +1620 +1621 +1622 +1623 +1624 +1625 +1626 +1627 +1628 +1629 +1630 +1631 +1632 +1633 +1634 +1635 +1636 +1637 +1638 +1639 +1640 +1641 +1642 +1643 +1644 +1645 +1646 +1647 +1648 +1649 +1650 +1651 +1652 +1653 +1654 +1655 +1656 +1657 +1658 +1659 +1660 +1661 +1662 +1663 +1664 +1665 +1666 +1667 +1668 +1669 +1670 +1671 +1672 +1673 +1674 +1675 +1676 +1677 +1678 +1679 +1680 +1681 +1682 +1683 +1684 +1685 +1686 +1687 +1688 +1689 +1690 +1691 +1692 +1693 +1694 +1695 +1696 +1697 +1698 +1699 +1700 +1701 +1702 +1703 +1704 +1705 +1706 +1707 +1708 +1709 +1710 +1711 +1712 +1713 +1714 +1715 +1716 +1717 +1718 +1719 +1720 +1721 +1722 +1723 +1724 +1725 +1726 +1727 +1728 +1729 +1730 +1731 +1732 +1733 +1734 +1735 +1736 +1737 +1738 +1739 +1740 +1741 +1742 +1743 +1744 +1745 +1746 +1747 +1748 +1749 +1750 +1751 +1752 +1753 +1754 +1755 +1756 +1757 +1758 +1759 +1760 +1761 +1762 +1763 +1764 +1765 +1766 +1767 +1768 +1769 +1770 +1771 +1772 +1773 +1774 +1775 +1776 +1777 +1778 +1779 +1780 +1781 +1782 +1783 +1784 +1785 +1786 +1787 +1788 +1789 +1790 +1791 +1792 +1793 +1794 +1795 +1796 +1797 +1798 +1799 +1800 +1801 +1802 +1803 +1804 +1805 +1806 +1807 +1808 +1809 +1810 +1811 +1812 +1813 +1814 +1815 +1816 +1817 +1818 +1819 +1820 +1821 +1822 +1823 +1824 +1825 +1826 +1827 +1828 +1829 +1830 +1831 +1832 +1833 +1834 +1835 +1836 +1837 +1838 +1839 +1840 +1841 +1842 +1843 +1844 +1845 +1846 +1847 +1848 +1849 +1850 +1851 +1852 +1853 +1854 +1855 +1856 +1857 +1858 +1859 +1860 +1861 +1862 +1863 +1864 +1865 +1866 +1867 +1868 +1869 +1870 +1871 +1872 +1873 +1874 +1875 +1876 +1877 +1878 +1879 +1880 +1881 +1882 +1883 +1884 +1885 +1886 +1887 +1888 +1889 +1890 +1891 +1892 +1893 +1894 +1895 +1896 +1897 +1898 +1899 +1900 +1901 +1902 +1903 +1904 +1905 +1906 +1907 +1908 +1909 +1910 +1911 +1912 +1913 +1914 +1915 +1916 +1917 +1918 +1919 +1920 +1921 +1922 +1923 +1924 +1925 +1926 +1927 +1928 +1929 +1930 +1931 +1932 +1933 +1934 +1935 +1936 +1937 +1938 +1939 +1940 +1941 +1942 +1943 +1944 +1945 +1946 +1947 +1948 +1949 +1950 +1951 +1952 +1953 +1954 +1955 +1956 +1957 +1958 +1959 +1960 +1961 +1962 +1963 +1964 +1965 +1966 +1967 +1968 +1969 +1970 +1971 +1972 +1973 +1974 +1975 +1976 +1977 +1978 +1979 +1980 +1981 +1982 +1983 +1984 +1985 +1986 +1987 +1988 +1989 +1990 +1991 +1992 +1993 +1994 +1995 +1996 +1997 +1998 +1999 +2000 +2001 +2002 +2003 +2004 +2005 +2006 +2007 +2008 +2009 +2010 +2011 +2012 +2013 +2014 +2015 +2016 +2017 +2018 +2019 +2020 +2021 +2022 +2023 +2024 +2025 +2026 +2027 +2028 +2029 +2030 +2031 +2032 +2033 +2034 +2035 +2036 +2037 +2038 +2039 +2040 +2041 +2042 +2043 +2044 +2045 +2046 +2047 +2048 +2049 +2050 +2051 +2052 +2053 +2054 +2055 +2056 +2057 +2058 +2059 +2060 +2061 +2062 +2063 +2064 +2065 +2066 +2067 +2068 +2069 +2070 +2071 +2072 +2073 +2074 +2075 +2076 +2077 +2078 +2079 +2080 +2081 +2082 +2083 +2084 +2085 +2086 +2087 +2088 +2089 +2090 +2091 +2092 +2093 +2094 +2095 +2096 +2097 +2098 +2099 +2100 +2101 +2102 +2103 +2104 +2105 +2106 +2107 +2108 +2109 +2110 +2111 +2112 +2113 +2114 +2115 +2116 +2117 +2118 +2119 +2120 +2121 +2122 +2123 +2124 +2125 +2126 +2127 +2128 +2129 +2130 +2131 +2132 +2133 +2134 +2135 +2136 +2137 +2138 +2139 +2140 +2141 +2142 +2143 +2144 +2145 +2146 +2147 +2148 +2149 +2150 +2151 +2152 +2153 +2154 +2155 +2156 +2157 +2158 +2159 +2160 +2161 +2162 +2163 +2164 +2165 +2166 +2167 +2168 +2169 +2170 +2171 +2172 +2173 +2174 +2175 +2176 +2177 +2178 +2179 +2180 +2181 +2182 +2183 +2184 +2185 +2186 +2187 +2188 +2189 +2190 +2191 +2192 +2193 +2194 +2195 +2196 +2197 +2198 +2199 +2200 +2201 +2202 +2203 +2204 +2205 +2206 +2207 +2208 +2209 +2210 +2211 +2212 +2213 +2214 +2215 +2216 +2217 +2218 +2219 +2220 +2221 +2222 +2223 +2224 +2225 +2226 +2227 +2228 +2229 +2230 +2231 +2232 +2233 +2234 +2235 +2236 +2237 +2238 +2239 +2240 +2241 +2242 +2243 +2244 +2245 +2246 +2247 +2248 +2249 +2250 +2251 +2252 +2253 +2254 +2255 +2256 +2257 +2258 +2259 +2260 +2261 +2262 +2263 +2264 +2265 +2266 +2267 +2268 +2269 +2270 +2271 +2272 +2273 +2274 +2275 +2276 +2277 +2278 +2279 +2280 +2281 +2282 +2283 +2284 +2285 +2286 +2287 +2288 +2289 +2290 +2291 +2292 +2293 +2294 +2295 +2296 +2297 +2298 +2299 +2300 +2301 +2302 +2303 +2304 +2305 +2306 +2307 +2308 +2309 +2310 +2311 +2312 +2313 +2314 +2315 +2316 +2317 +2318 +2319 +2320 +2321 +2322 +2323 +2324 +2325 +2326 +2327 +2328 +2329 +2330 +2331 +2332 +2333 +2334 +2335 +2336 +2337 +2338 +2339 +2340 +2341 +2342 +2343 +2344 +2345 +2346 +2347 +2348 +2349 +2350 +2351 +2352 +2353 +2354 +2355 +2356 +2357 +2358 +2359 +2360 +2361 +2362 +2363 +2364 +2365 +2366 +2367 +2368 +2369 +2370 +2371 +2372 +2373 +2374 +2375 +2376 +2377 +2378 +2379 +2380 +2381 +2382 +2383 +2384 +2385 +2386 +2387 +2388 +2389 +2390 +2391 +2392 +2393 +2394 +2395 +2396 +2397 +2398 +2399 +2400 +2401 +2402 +2403 +2404 +2405 +2406 +2407 +2408 +2409 +2410 +2411 +2412 +2413 +2414 +2415 +2416 +2417 +2418 +2419 +2420 +2421 +2422 +2423 +2424 +2425 +2426 +2427 +2428 +2429 +2430 +2431 +2432 +2433 +2434 +2435 +2436 +2437 +2438 +2439 +2440 +2441 +2442 +2443 +2444 +2445 +2446 +2447 +2448 +2449 +2450 +2451 +2452 +2453 +2454 +2455 +2456 +2457 +2458 +2459 +2460 +2461 +2462 +2463 +2464 +2465 +2466 +2467 +2468 +2469 +2470 +2471 +2472 +2473 +2474 +2475 +2476 +2477 +2478 +2479 +2480 +2481 +2482 +2483 +2484 +2485 +2486 +2487 +2488 +2489 +2490 +2491 +2492 +2493 +2494 +2495 +2496 +2497 +2498 +2499 +2500 +2501 +2502 +2503 +2504 +2505 +2506 +2507 +2508 +2509 +2510 +2511 +2512 +2513 +2514 +2515 +2516 +2517 +2518 +2519 +2520 +2521 +2522 +2523 +2524 +2525 +2526 +2527 +2528 +2529 +2530 +2531 +2532 +2533 +2534 +2535 +2536 +2537 +2538 +2539 +2540 +2541 +2542 +2543 +2544 +2545 +2546 +2547 +2548 +2549 +2550 +2551 +2552 +2553 +2554 +2555 +2556 +2557 +2558 +2559 +2560 +2561 +2562 +2563 +2564 +2565 +2566 +2567 +2568 +2569 +2570 +2571 +2572 +2573 +2574 +2575 +2576 +2577 +2578 +2579 +2580 +2581 +2582 +2583 +2584 +2585 +2586 +2587 +2588 +2589 +2590 +2591 +2592 +2593 +2594 +2595 +2596 +2597 +2598 +2599 +2600 +2601 +2602 +2603 +2604 +2605 +2606 +2607 +2608 +2609 +2610 +2611 +2612 +2613 +2614 +2615 +2616 +2617 +2618 +2619 +2620 +2621 +2622 +2623 +2624 +2625 +2626 +2627 +2628 +2629 +2630 +2631 +2632 +2633 +2634 +2635 +2636 +2637 +2638 +2639 +2640 +2641 +2642 +2643 +2644 +2645 +2646 +2647 +2648 +2649 +2650 +2651 +2652 +2653 +2654 +2655 +2656 +2657 +2658 +2659 +2660 +2661 +2662 +2663 +2664 +2665 +2666 +2667 +2668 +2669 +2670 +2671 +2672 +2673 +2674 +2675 +2676 +2677 +2678 +2679 +2680 +2681 +2682 +2683 +2684 +2685 +2686 +2687 +2688 +2689 +2690 +2691 +2692 +2693 +2694 +2695 +2696 +2697 +2698 +2699 +2700 +2701 +2702 +2703 +2704 +2705 +2706 +2707 +2708 +2709 +2710 +2711 +2712 +2713 +2714 +2715 +2716 +2717 +2718 +2719 +2720 +2721 +2722 +2723 +2724 +2725 +2726 +2727 +2728 +2729 +2730 +2731 +2732 +2733 +2734 +2735 +2736 +2737 +2738 +2739 +2740 +2741 +2742 +2743 +2744 +2745 +2746 +2747 +2748 +2749 +2750 +2751 +2752 +2753 +2754 +2755 +2756 +2757 +2758 +2759 +2760 +2761 +2762 +2763 +2764 +2765 +2766 +2767 +2768 +2769 +2770 +2771 +2772 +2773 +2774 +2775 +2776 +2777 +2778 +2779 +2780 +2781 +2782 +2783 +2784 +2785 +2786 +2787 +2788 +2789 +2790 +2791 +2792 +2793 +2794 +2795 +2796 +2797 +2798 +2799 +2800 +2801 +2802 +2803 +2804 +2805 +2806 +2807 +2808 +2809 +2810 +2811 +2812 +2813 +2814 +2815 +2816 +2817 +2818 +2819 +2820 +2821 +2822 +2823 +2824 +2825 +2826 +2827 +2828 +2829 +2830 +2831 +2832 +2833 +2834 +2835 +2836 +2837 +2838 +2839 +2840 +2841 +2842 +2843 +2844 +2845 +2846 +2847 +2848 +2849 +2850 +2851 +2852 +2853 +2854 +2855 +2856 +2857 +2858 +2859 +2860 +2861 +2862 +2863 +2864 +2865 +2866 +2867 +2868 +2869 +2870 +2871 +2872 +2873 +2874 +2875 +2876 +2877 +2878 +2879 +2880 +2881 +2882 +2883 +2884 +2885 +2886 +2887 +2888 +2889 +2890 +2891 +2892 +2893 +2894 +2895 +2896 +2897 +2898 +2899 +2900 +2901 +2902 +2903 +2904 +2905 +2906 +2907 +2908 +2909 +2910 +2911 +2912 +2913 +2914 +2915 +2916 +2917 +2918 +2919 +2920 +2921 +2922 +2923 +2924 +2925 +2926 +2927 +2928 +2929 +2930 +2931 +2932 +2933 +2934 +2935 +2936 +2937 +2938 +2939 +2940 +2941 +2942 +2943 +2944 +2945 +2946 +2947 +2948 +2949 +2950 +2951 +2952 +2953 +2954 +2955 +2956 +2957 +2958 +2959 +2960 +2961 +2962 +2963 +2964 +2965 +2966 +2967 +2968 +2969 +2970 +2971 +2972 +2973 +2974 +2975 +2976 +2977 +2978 +2979 +2980 +2981 +2982 +2983 +2984 +2985 +2986 +2987 +2988 +2989 +2990 +2991 +2992 +2993 +2994 +2995 +2996 +2997 +2998 +2999 +3000 +3001 +3002 +3003 +3004 +3005 +3006 +3007 +3008 +3009 +3010 +3011 +3012 +3013 +3014 +3015 +3016 +3017 +3018 +3019 +3020 +3021 +3022 +3023 +3024 +3025 +3026 +3027 +3028 +3029 +3030 +3031 +3032 +3033 +3034 +3035 +3036 +3037 +3038 +3039 +3040 +3041 +3042 +3043 +3044 +3045 +3046 +3047 +3048 +3049 +3050 +3051 +3052 +3053 +3054 +3055 +3056 +3057 +3058 +3059 +3060 +3061 +3062 +3063 +3064 +3065 +3066 +3067 +3068 +3069 +3070 +3071 +3072 +3073 +3074 +3075 +3076 +3077 +3078 +3079 +3080 +3081 +3082 +3083 +3084 +3085 +3086 +3087 +3088 +3089 +3090 +3091 +3092 +3093 +3094 +3095 +3096 +3097 +3098 +3099 +3100 +3101 +3102 +3103 +3104 +3105 +3106 +3107 +3108 +3109 +3110 +3111 +3112 +3113 +3114 +3115 +3116 +3117 +3118 +3119 +3120 +3121 +3122 +3123 +3124 +3125 +3126 +3127 +3128 +3129 +3130 +3131 +3132 +3133 +3134 +3135 +3136 +3137 +3138 +3139 +3140 +3141 +3142 +3143 +3144 +3145 +3146 +3147 +3148 +3149 +3150 +3151 +3152 +3153 +3154 +3155 +3156 +3157 +3158 +3159 +3160 +3161 +3162 +3163 +3164 +3165 +3166 +3167 +3168 +3169 +3170 +3171 +3172 +3173 +3174 +3175 +3176 +3177 +3178 +3179 +3180 +3181 +3182 +3183 +3184 +3185 +3186 +3187 +3188 +3189 +3190 +3191 +3192 +3193 +3194 +3195 +3196 +3197 +3198 +3199 +3200 +3201 +3202 +3203 +3204 +3205 +3206 +3207 +3208 +3209 +3210 +3211 +3212 +3213 +3214 +3215 +3216 +3217 +3218 +3219 +3220 +3221 +3222 +3223 +3224 +3225 +3226 +3227 +3228 +3229 +3230 +3231 +3232 +3233 +3234 +3235 +3236 +3237 +3238 +3239 +3240 +3241 +3242 +3243 +3244 +3245 +3246 +3247 +3248 +3249 +3250 +3251 +3252 +3253 +3254 +3255 +3256 +3257 +3258 +3259 +3260 +3261 +3262 +3263 +3264 +3265 +3266 +3267 +3268 +3269 +3270 +3271 +3272 +3273 +3274 +3275 +3276 +3277 +3278 +3279 +3280 +3281 +3282 +3283 +3284 +3285 +3286 +3287 +3288 +3289 +3290 +3291 +3292 +3293 +3294 +3295 +3296 +3297 +3298 +3299 +3300 +3301 +3302 +3303 +3304 +3305 +3306 +3307 +3308 +3309 +3310 +3311 +3312 +3313 +3314 +3315 +3316 +3317 +3318 +3319 +3320 +3321 +3322 +3323 +3324 +3325 +3326 +3327 +3328 +3329 +3330 +3331 +3332 +3333 +3334 +3335 +3336 +3337 +3338 +3339 +3340 +3341 +3342 +3343 +3344 +3345 +3346 +3347 +3348 +3349 +3350 +3351 +3352 +3353 +3354 +3355 +3356 +3357 +3358 +3359 +3360 +3361 +3362 +3363 +3364 +3365 +3366 +3367 +3368 +3369 +3370 +3371 +3372 +3373 +3374 +3375 +3376 +3377 +3378 +3379 +3380 +3381 +3382 +3383 +3384 +3385 +3386 +3387 +3388 +3389 +3390 +3391 +3392 +3393 +3394 +3395 +3396 +3397 +3398 +3399 +3400 +3401 +3402 +3403 +3404 +3405 +3406 +3407 +3408 +3409 +3410 +3411 +3412 +3413 +3414 +3415 +3416 +3417 +3418 +3419 +3420 +3421 +3422 +3423 +3424 +3425 +3426 +3427 +3428 +3429 +3430 +3431 +3432 +3433 +3434 +3435 +3436 +3437 +3438 +3439 +3440 +3441 +3442 +3443 +3444 +3445 +3446 +3447 +3448 +3449 +3450 +3451 +3452 +3453 +3454 +3455 +3456 +3457 +3458 +3459 +3460 +3461 +3462 +3463 +3464 +3465 +3466 +3467 +3468 +3469 +3470 +3471 +3472 +3473 +3474 +3475 +3476 +3477 +3478 +3479 +3480 +3481 +3482 +3483 +3484 +3485 +3486 +3487 +3488 +3489 +3490 +3491 +3492 +3493 +3494 +3495 +3496 +3497 +3498 +3499 +3500 +3501 +3502 +3503 +3504 +3505 +3506 +3507 +3508 +3509 +3510 +3511 +3512 +3513 +3514 +3515 +3516 +3517 +3518 +3519 +3520 +3521 +3522 +3523 +3524 +3525 +3526 +3527 +3528 +3529 +3530 +3531 +3532 +3533 +3534 +3535 +3536 +3537 +3538 +3539 +3540 +3541 +3542 +3543 +3544 +3545 +3546 +3547 +3548 +3549 +3550 +3551 +3552 +3553 +3554 +3555 +3556 +3557 +3558 +3559 +3560 +3561 +3562 +3563 +3564 +3565 +3566 +3567 +3568 +3569 +3570 +3571 +3572 +3573 +3574 +3575 +3576 +3577 +3578 +3579 +3580 +3581 +3582 +3583 +3584 +3585 +3586 +3587 +3588 +3589 +3590 +3591 +3592 +3593 +3594 +3595 +3596 +3597 +3598 +3599 +3600 +3601 +3602 +3603 +3604 +3605 +3606 +3607 +3608 +3609 +3610 +3611 +3612 +3613 +3614 +3615 +3616 +3617 +3618 +3619 +3620 +3621 +3622 +3623 +3624 +3625 +3626 +3627 +3628 +3629 +3630 +3631 +3632 +3633 +3634 +3635 +3636 +3637 +3638 +3639 +3640 +3641 +3642 +3643 +3644 +3645 +3646 +3647 +3648 +3649 +3650 +3651 +3652 +3653 +3654 +3655 +3656 +3657 +3658 +3659 +3660 +3661 +3662 +3663 +3664 +3665 +3666 +3667 +3668 +3669 +3670 +3671 +3672 +3673 +3674 +3675 +3676 +3677 +3678 +3679 +3680 +3681 +3682 +3683 +3684 +3685 +3686 +3687 +3688 +3689 +3690 +3691 +3692 +3693 +3694 +3695 +3696 +3697 +3698 +3699 +3700 +3701 +3702 +3703 +3704 +3705 +3706 +3707 +3708 +3709 +3710 +3711 +3712 +3713 +3714 +3715 +3716 +3717 +3718 +3719 +3720 +3721 +3722 +3723 +3724 +3725 +3726 +3727 +3728 +3729 +3730 +3731 +3732 +3733 +3734 +3735 +3736 +3737 +3738 +3739 +3740 +3741 +3742 +3743 +3744 +3745 +3746 +3747 +3748 +3749 +3750 +3751 +3752 +3753 +3754 +3755 +3756 +3757 +3758 +3759 +3760 +3761 +3762 +3763 +3764 +3765 +3766 +3767 +3768 +3769 +3770 +3771 +3772 +3773 +3774 +3775 +3776 +3777 +3778 +3779 +3780 +3781 +3782 +3783 +3784 +3785 +3786 +3787 +3788 +3789 +3790 +3791 +3792 +3793 +3794 +3795 +3796 +3797 +3798 +3799 +3800 +3801 +3802 +3803 +3804 +3805 +3806 +3807 +3808 +3809 +3810 +3811 +3812 +3813 +3814 +3815 +3816 +3817 +3818 +3819 +3820 +3821 +3822 +3823 +3824 +3825 +3826 +3827 +3828 +3829 +3830 +3831 +3832 +3833 +3834 +3835 +3836 +3837 +3838 +3839 +3840 +3841 +3842 +3843 +3844 +3845 +3846 +3847 +3848 +3849 +3850 +3851 +3852 +3853 +3854 +3855 +3856 +3857 +3858 +3859 +3860 +3861 +3862 +3863 +3864 +3865 +3866 +3867 +3868 +3869 +3870 +3871 +3872 +3873 +3874 +3875 +3876 +3877 +3878 +3879 +3880 +3881 +3882 +3883 +3884 +3885 +3886 +3887 +3888 +3889 +3890 +3891 +3892 +3893 +3894 +3895 +3896 +3897 +3898 +3899 +3900 +3901 +3902 +3903 +3904 +3905 +3906 +3907 +3908 +3909 +3910 +3911 +3912 +3913 +3914 +3915 +3916 +3917 +3918 +3919 +3920 +3921 +3922 +3923 +3924 +3925 +3926 +3927 +3928 +3929 +3930 +3931 +3932 +3933 +3934 +3935 +3936 +3937 +3938 +3939 +3940 +3941 +3942 +3943 +3944 +3945 +3946 +3947 +3948 +3949 +3950 +3951 +3952 +3953 +3954 +3955 +3956 +3957 +3958 +3959 +3960 +3961 +3962 +3963 +3964 +3965 +3966 +3967 +3968 +3969 +3970 +3971 +3972 +3973 +3974 +3975 +3976 +3977 +3978 +3979 +3980 +3981 +3982 +3983 +3984 +3985 +3986 +3987 +3988 +3989 +3990 +3991 +3992 +3993 +3994 +3995 +3996 +3997 +3998 +3999 +4000 +4001 +4002 +4003 +4004 +4005 +4006 +4007 +4008 +4009 +4010 +4011 +4012 +4013 +4014 +4015 +4016 +4017 +4018 +4019 +4020 +4021 +4022 +4023 +4024 +4025 +4026 +4027 +4028 +4029 +4030 +4031 +4032 +4033 +4034 +4035 +4036 +4037 +4038 +4039 +4040 +4041 +4042 +4043 +4044 +4045 +4046 +4047 +4048 +4049 +4050 +4051 +4052 +4053 +4054 +4055 +4056 +4057 +4058 +4059 +4060 +4061 +4062 +4063 +4064 +4065 +4066 +4067 +4068 +4069 +4070 +4071 +4072 +4073 +4074 +4075 +4076 +4077 +4078 +4079 +4080 +4081 +4082 +4083 +4084 +4085 +4086 +4087 +4088 +4089 +4090 +4091 +4092 +4093 +4094 +4095 +4096 +4097 +4098 +4099 +4100 +4101 +4102 +4103 +4104 +4105 +4106 +4107 +4108 +4109 +4110 +4111 +4112 +4113 +4114 +4115 +4116 +4117 +4118 +4119 +4120 +4121 +4122 +4123 +4124 +4125 +4126 +4127 +4128 +4129 +4130 +4131 +4132 +4133 +4134 +4135 +4136 +4137 +4138 +4139 +4140 +4141 +4142 +4143 +4144 +4145 +4146 +4147 +4148 +4149 +4150 +4151 +4152 +4153 +4154 +4155 +4156 +4157 +4158 +4159 +4160 +4161 +4162 +4163 +4164 +4165 +4166 +4167 +4168 +4169 +4170 +4171 +4172 +4173 +4174 +4175 +4176 +4177 +4178 +4179 +4180 +4181 +4182 +4183 +4184 +4185 +4186 +4187 +4188 +4189 +4190 +4191 +4192 +4193 +4194 +4195 +4196 +4197 +4198 +4199 +4200 +4201 +4202 +4203 +4204 +4205 +4206 +4207 +4208 +4209 +4210 +4211 +4212 +4213 +4214 +4215 +4216 +4217 +4218 +4219 +4220 +4221 +4222 +4223 +4224 +4225 +4226 +4227 +4228 +4229 +4230 +4231 +4232 +4233 +4234 +4235 +4236 +4237 +4238 +4239 +4240 +4241 +4242 +4243 +4244 +4245 +4246 +4247 +4248 +4249 +4250 +4251 +4252 +4253 +4254 +4255 +4256 +4257 +4258 +4259 +4260 +4261 +4262 +4263 +4264 +4265 +4266 +4267 +4268 +4269 +4270 +4271 +4272 +4273 +4274 +4275 +4276 +4277 +4278 +4279 +4280 +4281 +4282 +4283 +4284 +4285 +4286 +4287 +4288 +4289 +4290 +4291 +4292 +4293 +4294 +4295 +4296 +4297 +4298 +4299 +4300 +4301 +4302 +4303 +4304 +4305 +4306 +4307 +4308 +4309 +4310 +4311 +4312 +4313 +4314 +4315 +4316 +4317 +4318 +4319 +4320 +4321 +4322 +4323 +4324 +4325 +4326 +4327 +4328 +4329 +4330 +4331 +4332 +4333 +4334 +4335 +4336 +4337 +4338 +4339 +4340 +4341 +4342 +4343 +4344 +4345 +4346 +4347 +4348 +4349 +4350 +4351 +4352 +4353 +4354 +4355 +4356 +4357 +4358 +4359 +4360 +4361 +4362 +4363 +4364 +4365 +4366 +4367 +4368 +4369 +4370 +4371 +4372 +4373 +4374 +4375 +4376 +4377 +4378 +4379 +4380 +4381 +4382 +4383 +4384 +4385 +4386 +4387 +4388 +4389 +4390 +4391 +4392 +4393 +4394 +4395 +4396 +4397 +4398 +4399 +4400 +4401 +4402 +4403 +4404 +4405 +4406 +4407 +4408 +4409 +4410 +4411 +4412 +4413 +4414 +4415 +4416 +4417 +4418 +4419 +4420 +4421 +4422 +4423 +4424 +4425 +4426 +4427 +4428 +4429 +4430 +4431 +4432 +4433 +4434 +4435 +4436 +4437 +4438 +4439 +4440 +4441 +4442 +4443 +4444 +4445 +4446 +4447 +4448 +4449 +4450 +4451 +4452 +4453 +4454 +4455 +4456 +4457 +4458 +4459 +4460 +4461 +4462 +4463 +4464 +4465 +4466 +4467 +4468 +4469 +4470 +4471 +4472 +4473 +4474 +4475 +4476 +4477 +4478 +4479 +4480 +4481 +4482 +4483 +4484 +4485 +4486 +4487 +4488 +4489 +4490 +4491 +4492 +4493 +4494 +4495 +4496 +4497 +4498 +4499 +4500 +4501 +4502 +4503 +4504 +4505 +4506 +4507 +4508 +4509 +4510 +4511 +4512 +4513 +4514 +4515 +4516 +4517 +4518 +4519 +4520 +4521 +4522 +4523 +4524 +4525 +4526 +4527 +4528 +4529 +4530 +4531 +4532 +4533 +4534 +4535 +4536 +4537 +4538 +4539 +4540 +4541 +4542 +4543 +4544 +4545 +4546 +4547 +4548 +4549 +4550 +4551 +4552 +4553 +4554 +4555 +4556 +4557 +4558 +4559 +4560 +4561 +4562 +4563 +4564 +4565 +4566 +4567 +4568 +4569 +4570 +4571 +4572 +4573 +4574 +4575 +4576 +4577 +4578 +4579 +4580 +4581 +4582 +4583 +4584 +4585 +4586 +4587 +4588 +4589 +4590 +4591 +4592 +4593 +4594 +4595 +4596 +4597 +4598 +4599 +4600 +4601 +4602 +4603 +4604 +4605 +4606 +4607 +4608 +4609 +4610 +4611 +4612 +4613 +4614 +4615 +4616 +4617 +4618 +4619 +4620 +4621 +4622 +4623 +4624 +4625 +4626 +4627 +4628 +4629 +4630 +4631 +4632 +4633 +4634 +4635 +4636 +4637 +4638 +4639 +4640 +4641 +4642 +4643 +4644 +4645 +4646 +4647 +4648 +4649 +4650 +4651 +4652 +4653 +4654 +4655 +4656 +4657 +4658 +4659 +4660 +4661 +4662 +4663 +4664 +4665 +4666 +4667 +4668 +4669 +4670 +4671 +4672 +4673 +4674 +4675 +4676 +4677 +4678 +4679 +4680 +4681 +4682 +4683 +4684 +4685 +4686 +4687 +4688 +4689 +4690 +4691 +4692 +4693 +4694 +4695 +4696 +4697 +4698 +4699 +4700 +4701 +4702 +4703 +4704 +4705 +4706 +4707 +4708 +4709 +4710 +4711 +4712 +4713 +4714 +4715 +4716 +4717 +4718 +4719 +4720 +4721 +4722 +4723 +4724 +4725 +4726 +4727 +4728 +4729 +4730 +4731 +4732 +4733 +4734 +4735 +4736 +4737 +4738 +4739 +4740 +4741 +4742 +4743 +4744 +4745 +4746 +4747 +4748 +4749 +4750 +4751 +4752 +4753 +4754 +4755 +4756 +4757 +4758 +4759 +4760 +4761 +4762 +4763 +4764 +4765 +4766 +4767 +4768 +4769 +4770 +4771 +4772 +4773 +4774 +4775 +4776 +4777 +4778 +4779 +4780 +4781 +4782 +4783 +4784 +4785 +4786 +4787 +4788 +4789 +4790 +4791 +4792 +4793 +4794 +4795 +4796 +4797 +4798 +4799 +4800 +4801 +4802 +4803 +4804 +4805 +4806 +4807 +4808 +4809 +4810 +4811 +4812 +4813 +4814 +4815 +4816 +4817 +4818 +4819 +4820 +4821 +4822 +4823 +4824 +4825 +4826 +4827 +4828 +4829 +4830 +4831 +4832 +4833 +4834 +4835 +4836 +4837 +4838 +4839 +4840 +4841 +4842 +4843 +4844 +4845 +4846 +4847 +4848 +4849 +4850 +4851 +4852 +4853 +4854 +4855 +4856 +4857 +4858 +4859 +4860 +4861 +4862 +4863 +4864 +4865 +4866 +4867 +4868 +4869 +4870 +4871 +4872 +4873 +4874 +4875 +4876 +4877 +4878 +4879 +4880 +4881 +4882 +4883 +4884 +4885 +4886 +4887 +4888 +4889 +4890 +4891 +4892 +4893 +4894 +4895 +4896 +4897 +4898 +4899 +4900 +4901 +4902 +4903 +4904 +4905 +4906 +4907 +4908 +4909 +4910 +4911 +4912 +4913 +4914 +4915 +4916 +4917 +4918 +4919 +4920 +4921 +4922 +4923 +4924 +4925 +4926 +4927 +4928 +4929 +4930 +4931 +4932 +4933 +4934 +4935 +4936 +4937 +4938 +4939 +4940 +4941 +4942 +4943 +4944 +4945 +4946 +4947 +4948 +4949 +4950 +4951 +4952 +4953 +4954 +4955 +4956 +4957 +4958 +4959 +4960 +4961 +4962 +4963 +4964 +4965 +4966 +4967 +4968 +4969 +4970 +4971 +4972 +4973 +4974 +4975 +4976 +4977 +4978 +4979 +4980 +4981 +4982 +4983 +4984 +4985 +4986 +4987 +4988 +4989 +4990 +4991 +4992 +4993 +4994 +4995 +4996 +4997 +4998 +4999 +5000 +5001 +5002 +5003 +5004 +5005 +5006 +5007 +5008 +5009 +5010 +5011 +5012 +5013 +5014 +5015 +5016 +5017 +5018 +5019 +5020 +5021 +5022 +5023 +5024 +5025 +5026 +5027 +5028 +5029 +5030 +5031 +5032 +5033 +5034 +5035 +5036 +5037 +5038 +5039 +5040 +5041 +5042 +5043 +5044 +5045 +5046 +5047 +5048 +5049 +5050 +5051 +5052 +5053 +5054 +5055 +5056 +5057 +5058 +5059 +5060 +5061 +5062 +5063 +5064 +5065 +5066 +5067 +5068 +5069 +5070 +5071 +5072 +5073 +5074 +5075 +5076 +5077 +5078 +5079 +5080 +5081 +5082 +5083 +5084 +5085 +5086 +5087 +5088 +5089 +5090 +5091 +5092 +5093 +5094 +5095 +5096 +5097 +5098 +5099 +5100 +5101 +5102 +5103 +5104 +5105 +5106 +5107 +5108 +5109 +5110 +5111 +5112 +5113 +5114 +5115 +5116 +5117 +5118 +5119 +5120 +5121 +5122 +5123 +5124 +5125 +5126 +5127 +5128 +5129 +5130 +5131 +5132 +5133 +5134 +5135 +5136 +5137 +5138 +5139 +5140 +5141 +5142 +5143 +5144 +5145 +5146 +5147 +5148 +5149 +5150 +5151 +5152 +5153 +5154 +5155 +5156 +5157 +5158 +5159 +5160 +5161 +5162 +5163 +5164 +5165 +5166 +5167 +5168 +5169 +5170 +5171 +5172 +5173 +5174 +5175 +5176 +5177 +5178 +5179 +5180 +5181 +5182 +5183 +5184 +5185 +5186 +5187 +5188 +5189 +5190 +5191 +5192 +5193 +5194 +5195 +5196 +5197 +5198 +5199 +5200 +5201 +5202 +5203 +5204 +5205 +5206 +5207 +5208 +5209 +5210 +5211 +5212 +5213 +5214 +5215 +5216 +5217 +5218 +5219 +5220 +5221 +5222 +5223 +5224 +5225 +5226 +5227 +5228 +5229 +5230 +5231 +5232 +5233 +5234 +5235 +5236 +5237 +5238 +5239 +5240 +5241 +5242 +5243 +5244 +5245 +5246 +5247 +5248 +5249 +5250 +5251 +5252 +5253 +5254 +5255 +5256 +5257 +5258 +5259 +5260 +5261 +5262 +5263 +5264 +5265 +5266 +5267 +5268 +5269 +5270 +5271 +5272 +5273 +5274 +5275 +5276 +5277 +5278 +5279 +5280 +5281 +5282 +5283 +5284 +5285 +5286 +5287 +5288 +5289 +5290 +5291 +5292 +5293 +5294 +5295 +5296 +5297 +5298 +5299 +5300 +5301 +5302 +5303 +5304 +5305 +5306 +5307 +5308 +5309 +5310 +5311 +5312 +5313 +5314 +5315 +5316 +5317 +5318 +5319 +5320 +5321 +5322 +5323 +5324 +5325 +5326 +5327 +5328 +5329 +5330 +5331 +5332 +5333 +5334 +5335 +5336 +5337 +5338 +5339 +5340 +5341 +5342 +5343 +5344 +5345 +5346 +5347 +5348 +5349 +5350 +5351 +5352 +5353 +5354 +5355 +5356 +5357 +5358 +5359 +5360 +5361 +5362 +5363 +5364 +5365 +5366 +5367 +5368 +5369 +5370 +5371 +5372 +5373 +5374 +5375 +5376 +5377 +5378 +5379 +5380 +5381 +5382 +5383 +5384 +5385 +5386 +5387 +5388 +5389 +5390 +5391 +5392 +5393 +5394 +5395 +5396 +5397 +5398 +5399 +5400 +5401 +5402 +5403 +5404 +5405 +5406 +5407 +5408 +5409 +5410 +5411 +5412 +5413 +5414 +5415 +5416 +5417 +5418 +5419 +5420 +5421 +5422 +5423 +5424 +5425 +5426 +5427 +5428 +5429 +5430 +5431 +5432 +5433 +5434 +5435 +5436 +5437 +5438 +5439 +5440 +5441 +5442 +5443 +5444 +5445 +5446 +5447 +5448 +5449 +5450 +5451 +5452 +5453 +5454 +5455 +5456 +5457 +5458 +5459 +5460 +5461 +5462 +5463 +5464 +5465 +5466 +5467 +5468 +5469 +5470 +5471 +5472 +5473 +5474 +5475 +5476 +5477 +5478 +5479 +5480 +5481 +5482 +5483 +5484 +5485 +5486 +5487 +5488 +5489 +5490 +5491 +5492 +5493 +5494 +5495 +5496 +5497 +5498 +5499 +5500 +5501 +5502 +5503 +5504 +5505 +5506 +5507 +5508 +5509 +5510 +5511 +5512 +5513 +5514 +5515 +5516 +5517 +5518 +5519 +5520 +5521 +5522 +5523 +5524 +5525 +5526 +5527 +5528 +5529 +5530 +5531 +5532 +5533 +5534 +5535 +5536 +5537 +5538 +5539 +5540 +5541 +5542 +5543 +5544 +5545 +5546 +5547 +5548 +5549 +5550 +5551 +5552 +5553 +5554 +5555 +5556 +5557 +5558 +5559 +5560 +5561 +5562 +5563 +5564 +5565 +5566 +5567 +5568 +5569 +5570 +5571 +5572 +5573 +5574 +5575 +5576 +5577 +5578 +5579 +5580 +5581 +5582 +5583 +5584 +5585 +5586 +5587 +5588 +5589 +5590 +5591 +5592 +5593 +5594 +5595 +5596 +5597 +5598 +5599 +5600 +5601 +5602 +5603 +5604 +5605 +5606 +5607 +5608 +5609 +5610 +5611 +5612 +5613 +5614 +5615 +5616 +5617 +5618 +5619 +5620 +5621 +5622 +5623 +5624 +5625 +5626 +5627 +5628 +5629 +5630 +5631 +5632 +5633 +5634 +5635 +5636 +5637 +5638 +5639 +5640 +5641 +5642 +5643 +5644 +5645 +5646 +5647 +5648 +5649 +5650 +5651 +5652 +5653 +5654 +5655 +5656 +5657 +5658 +5659 +5660 +5661 +5662 +5663 +5664 +5665 +5666 +5667 +5668 +5669 +5670 +5671 +5672 +5673 +5674 +5675 +5676 +5677 +5678 +5679 +5680 +5681 +5682 +5683 +5684 +5685 +5686 +5687 +5688 +5689 +5690 +5691 +5692 +5693 +5694 +5695 +5696 +5697 +5698 +5699 +5700 +5701 +5702 +5703 +5704 +5705 +5706 +5707 +5708 +5709 +5710 +5711 +5712 +5713 +5714 +5715 +5716 +5717 +5718 +5719 +5720 +5721 +5722 +5723 +5724 +5725 +5726 +5727 +5728 +5729 +5730 +5731 +5732 +5733 +5734 +5735 +5736 +5737 +5738 +5739 +5740 +5741 +5742 +5743 +5744 +5745 +5746 +5747 +5748 +5749 +5750 +5751 +5752 +5753 +5754 +5755 +5756 +5757 +5758 +5759 +5760 +5761 +5762 +5763 +5764 +5765 +5766 +5767 +5768 +5769 +5770 +5771 +5772 +5773 +5774 +5775 +5776 +5777 +5778 +5779 +5780 +5781 +5782 +5783 +5784 +5785 +5786 +5787 +5788 +5789 +5790 +5791 +5792 +5793 +5794 +5795 +5796 +5797 +5798 +5799 +5800 +5801 +5802 +5803 +5804 +5805 +5806 +5807 +5808 +5809 +5810 +5811 +5812 +5813 +5814 +5815 +5816 +5817 +5818 +5819 +5820 +5821 +5822 +5823 +5824 +5825 +5826 +5827 +5828 +5829 +5830 +5831 +5832 +5833 +5834 +5835 +5836 +5837 +5838 +5839 +5840 +5841 +5842 +5843 +5844 +5845 +5846 +5847 +5848 +5849 +5850 +5851 +5852 +5853 +5854 +5855 +5856 +5857 +5858 +5859 +5860 +5861 +5862 +5863 +5864 +5865 +5866 +5867 +5868 +5869 +5870 +5871 +5872 +5873 +5874 +5875 +5876 +5877 +5878 +5879 +5880 +5881 +5882 +5883 +5884 +5885 +5886 +5887 +5888 +5889 +5890 +5891 +5892 +5893 +5894 +5895 +5896 +5897 +5898 +5899 +5900 +5901 +5902 +5903 +5904 +5905 +5906 +5907 +5908 +5909 +5910 +5911 +5912 +5913 +5914 +5915 +5916 +5917 +5918 +5919 +5920 +5921 +5922 +5923 +5924 +5925 +5926 +5927 +5928 +5929 +5930 +5931 +5932 +5933 +5934 +5935 +5936 +5937 +5938 +5939 +5940 +5941 +5942 +5943 +5944 +5945 +5946 +5947 +5948 +5949 +5950 +5951 +5952 +5953 +5954 +5955 +5956 +5957 +5958 +5959 +5960 +5961 +5962 +5963 +5964 +5965 +5966 +5967 +5968 +5969 +5970 +5971 +5972 +5973 +5974 +5975 +5976 +5977 +5978 +5979 +5980 +5981 +5982 +5983 +5984 +5985 +5986 +5987 +5988 +5989 +5990 +5991 +5992 +5993 +5994 +5995 +5996 +5997 +5998 +5999 +6000 +6001 +6002 +6003 +6004 +6005 +6006 +6007 +6008 +6009 +6010 +6011 +6012 +6013 +6014 +6015 +6016 +6017 +6018 +6019 +6020 +6021 +6022 +6023 +6024 +6025 +6026 +6027 +6028 +6029 +6030 +6031 +6032 +6033 +6034 +6035 +6036 +6037 +6038 +6039 +6040 +6041 +6042 +6043 +6044 +6045 +6046 +6047 +6048 +6049 +6050 +6051 +6052 +6053 +6054 +6055 +6056 +6057 +6058 +6059 +6060 +6061 +6062 +6063 +6064 +6065 +6066 +6067 +6068 +6069 +6070 +6071 +6072 +6073 +6074 +6075 +6076 +6077 +6078 +6079 +6080 +6081 +6082 +6083 +6084 +6085 +6086 +6087 +6088 +6089 +6090 +6091 +6092 +6093 +6094 +6095 +6096 +6097 +6098 +6099 +6100 +6101 +6102 +6103 +6104 +6105 +6106 +6107 +6108 +6109 +6110 +6111 +6112 +6113 +6114 +6115 +6116 +6117 +6118 +6119 +6120 +6121 +6122 +6123 +6124 +6125 +6126 +6127 +6128 +6129 +6130 +6131 +6132 +6133 +6134 +6135 +6136 +6137 +6138 +6139 +6140 +6141 +6142 +6143 +6144 +6145 +6146 +6147 +6148 +6149 +6150 +6151 +6152 +6153 +6154 +6155 +6156 +6157 +6158 +6159 +6160 +6161 +6162 +6163 +6164 +6165 +6166 +6167 +6168 +6169 +6170 +6171 +6172 +6173 +6174 +6175 +6176 +6177 +6178 +6179 +6180 +6181 +6182 +6183 +6184 +6185 +6186 +6187 +6188 +6189 +6190 +6191 +6192 +6193 +6194 +6195 +6196 +6197 +6198 +6199 +6200 +6201 +6202 +6203 +6204 +6205 +6206 +6207 +6208 +6209 +6210 +6211 +6212 +6213 +6214 +6215 +6216 +6217 +6218 +6219 +6220 +6221 +6222 +6223 +6224 +6225 +6226 +6227 +6228 +6229 +6230 +6231 +6232 +6233 +6234 +6235 +6236 +6237 +6238 +6239 +6240 +6241 +6242 +6243 +6244 +6245 +6246 +6247 +6248 +6249 +6250 +6251 +6252 +6253 +6254 +6255 +6256 +6257 +6258 +6259 +6260 +6261 +6262 +6263 +6264 +6265 +6266 +6267 +6268 +6269 +6270 +6271 +6272 +6273 +6274 +6275 +6276 +6277 +6278 +6279 +6280 +6281 +6282 +6283 +6284 +6285 +6286 +6287 +6288 +6289 +6290 +6291 +6292 +6293 +6294 +6295 +6296 +6297 +6298 +6299 +6300 +6301 +6302 +6303 +6304 +6305 +6306 +6307 +6308 +6309 +6310 +6311 +6312 +6313 +6314 +6315 +6316 +6317 +6318 +6319 +6320 +6321 +6322 +6323 +6324 +6325 +6326 +6327 +6328 +6329 +6330 +6331 +6332 +6333 +6334 +6335 +6336 +6337 +6338 +6339 +6340 +6341 +6342 +6343 +6344 +6345 +6346 +6347 +6348 +6349 +6350 +6351 +6352 +6353 +6354 +6355 +6356 +6357 +6358 +6359 +6360 +6361 +6362 +6363 +6364 +6365 +6366 +6367 +6368 +6369 +6370 +6371 +6372 +6373 +6374 +6375 +6376 +6377 +6378 +6379 +6380 +6381 +6382 +6383 +6384 +6385 +6386 +6387 +6388 +6389 +6390 +6391 +6392 +6393 +6394 +6395 +6396 +6397 +6398 +6399 +6400 +6401 +6402 +6403 +6404 +6405 +6406 +6407 +6408 +6409 +6410 +6411 +6412 +6413 +6414 +6415 +6416 +6417 +6418 +6419 +6420 +6421 +6422 +6423 +6424 +6425 +6426 +6427 +6428 +6429 +6430 +6431 +6432 +6433 +6434 +6435 +6436 +6437 +6438 +6439 +6440 +6441 +6442 +6443 +6444 +6445 +6446 +6447 +6448 +6449 +6450 +6451 +6452 +6453 +6454 +6455 +6456 +6457 +6458 +6459 +6460 +6461 +6462 +6463 +6464 +6465 +6466 +6467 +6468 +6469 +6470 +6471 +6472 +6473 +6474 +6475 +6476 +6477 +6478 +6479 +6480 +6481 +6482 +6483 +6484 +6485 +6486 +6487 +6488 +6489 +6490 +6491 +6492 +6493 +6494 +6495 +6496 +6497 +6498 +6499 +6500 +6501 +6502 +6503 +6504 +6505 +6506 +6507 +6508 +6509 +6510 +6511 +6512 +6513 +6514 +6515 +6516 +6517 +6518 +6519 +6520 +6521 +6522 +6523 +6524 +6525 +6526 +6527 +6528 +6529 +6530 +6531 +6532 +6533 +6534 +6535 +6536 +6537 +6538 +6539 +6540 +6541 +6542 +6543 +6544 +6545 +6546 +6547 +6548 +6549 +6550 +6551 +6552 +6553 +6554 +6555 +6556 +6557 +6558 +6559 +6560 +6561 +6562 +6563 +6564 +6565 +6566 +6567 +6568 +6569 +6570 +6571 +6572 +6573 +6574 +6575 +6576 +6577 +6578 +6579 +6580 +6581 +6582 +6583 +6584 +6585 +6586 +6587 +6588 +6589 +6590 +6591 +6592 +6593 +6594 +6595 +6596 +6597 +6598 +6599 +6600 +6601 +6602 +6603 +6604 +6605 +6606 +6607 +6608 +6609 +6610 +6611 +6612 +6613 +6614 +6615 +6616 +6617 +6618 +6619 +6620 +6621 +6622 +6623 +6624 +6625 +6626 +6627 +6628 +6629 +6630 +6631 +6632 +6633 +6634 +6635 +6636 +6637 +6638 +6639 +6640 +6641 +6642 +6643 +6644 +6645 +6646 +6647 +6648 +6649 +6650 +6651 +6652 +6653 +6654 +6655 +6656 +6657 +6658 +6659 +6660 +6661 +6662 +6663 +6664 +6665 +6666 +6667 +6668 +6669 +6670 +6671 +6672 +6673 +6674 +6675 +6676 +6677 +6678 +6679 +6680 +6681 +6682 +6683 +6684 +6685 +6686 +6687 +6688 +6689 +6690 +6691 +6692 +6693 +6694 +6695 +6696 +6697 +6698 +6699 +6700 +6701 +6702 +6703 +6704 +6705 +6706 +6707 +6708 +6709 +6710 +6711 +6712 +6713 +6714 +6715 +6716 +6717 +6718 +6719 +6720 +6721 +6722 +6723 +6724 +6725 +6726 +6727 +6728 +6729 +6730 +6731 +6732 +6733 +6734 +6735 +6736 +6737 +6738 +6739 +6740 +6741 +6742 +6743 +6744 +6745 +6746 +6747 +6748 +6749 +6750 +6751 +6752 +6753 +6754 +6755 +6756 +6757 +6758 +6759 +6760 +6761 +6762 +6763 +6764 +6765 +6766 +6767 +6768 +6769 +6770 +6771 +6772 +6773 +6774 +6775 +6776 +6777 +6778 +6779 +6780 +6781 +6782 +6783 +6784 +6785 +6786 +6787 +6788 +6789 +6790 +6791 +6792 +6793 +6794 +6795 +6796 +6797 +6798 +6799 +6800 +6801 +6802 +6803 +6804 +6805 +6806 +6807 +6808 +6809 +6810 +6811 +6812 +6813 +6814 +6815 +6816 +6817 +6818 +6819 +6820 +6821 +6822 +6823 +6824 +6825 +6826 +6827 +6828 +6829 +6830 +6831 +6832 +6833 +6834 +6835 +6836 +6837 +6838 +6839 +6840 +6841 +6842 +6843 +6844 +6845 +6846 +6847 +6848 +6849 +6850 +6851 +6852 +6853 +6854 +6855 +6856 +6857 +6858 +6859 +6860 +6861 +6862 +6863 +6864 +6865 +6866 +6867 +6868 +6869 +6870 +6871 +6872 +6873 +6874 +6875 +6876 +6877 +6878 +6879 +6880 +6881 +6882 +6883 +6884 +6885 +6886 +6887 +6888 +6889 +6890 +6891 +6892 +6893 +6894 +6895 +6896 +6897 +6898 +6899 +6900 +6901 +6902 +6903 +6904 +6905 +6906 +6907 +6908 +6909 +6910 +6911 +6912 +6913 +6914 +6915 +6916 +6917 +6918 +6919 +6920 +6921 +6922 +6923 +6924 +6925 +6926 +6927 +6928 +6929 +6930 +6931 +6932 +6933 +6934 +6935 +6936 +6937 +6938 +6939 +6940 +6941 +6942 +6943 +6944 +6945 +6946 +6947 +6948 +6949 +6950 +6951 +6952 +6953 +6954 +6955 +6956 +6957 +6958 +6959 +6960 +6961 +6962 +6963 +6964 +6965 +6966 +6967 +6968 +6969 +6970 +6971 +6972 +6973 +6974 +6975 +6976 +6977 +6978 +6979 +6980 +6981 +6982 +6983 +6984 +6985 +6986 +6987 +6988 +6989 +6990 +6991 +6992 +6993 +6994 +6995 +6996 +6997 +6998 +6999 +7000 +7001 +7002 +7003 +7004 +7005 +7006 +7007 +7008 +7009 +7010 +7011 +7012 +7013 +7014 +7015 +7016 +7017 +7018 +7019 +7020 +7021 +7022 +7023 +7024 +7025 +7026 +7027 +7028 +7029 +7030 +7031 +7032 +7033 +7034 +7035 +7036 +7037 +7038 +7039 +7040 +7041 +7042 +7043 +7044 +7045 +7046 +7047 +7048 +7049 +7050 +7051 +7052 +7053 +7054 +7055 +7056 +7057 +7058 +7059 +7060 +7061 +7062 +7063 +7064 +7065 +7066 +7067 +7068 +7069 +7070 +7071 +7072 +7073 +7074 +7075 +7076 +7077 +7078 +7079 +7080 +7081 +7082 +7083 +7084 +7085 +7086 +7087 +7088 +7089 +7090 +7091 +7092 +7093 +7094 +7095 +7096 +7097 +7098 +7099 +7100 +7101 +7102 +7103 +7104 +7105 +7106 +7107 +7108 +7109 +7110 +7111 +7112 +7113 +7114 +7115 +7116 +7117 +7118 +7119 +7120 +7121 +7122 +7123 +7124 +7125 +7126 +7127 +7128 +7129 +7130 +7131 +7132 +7133 +7134 +7135 +7136 +7137 +7138 +7139 +7140 +7141 +7142 +7143 +7144 +7145 +7146 +7147 +7148 +7149 +7150 +7151 +7152 +7153 +7154 +7155 +7156 +7157 +7158 +7159 +7160 +7161 +7162 +7163 +7164 +7165 +7166 +7167 +7168 +7169 +7170 +7171 +7172 +7173 +7174 +7175 +7176 +7177 +7178 +7179 +7180 +7181 +7182 +7183 +7184 +7185 +7186 +7187 +7188 +7189 +7190 +7191 +7192 +7193 +7194 +7195 +7196 +7197 +7198 +7199 +7200 +7201 +7202 +7203 +7204 +7205 +7206 +7207 +7208 +7209 +7210 +7211 +7212 +7213 +7214 +7215 +7216 +7217 +7218 +7219 +7220 +7221 +7222 +7223 +7224 +7225 +7226 +7227 +7228 +7229 +7230 +7231 +7232 +7233 +7234 +7235 +7236 +7237 +7238 +7239 +7240 +7241 +7242 +7243 +7244 +7245 +7246 +7247 +7248 +7249 +7250 +7251 +7252 +7253 +7254 +7255 +7256 +7257 +7258 +7259 +7260 +7261 +7262 +7263 +7264 +7265 +7266 +7267 +7268 +7269 +7270 +7271 +7272 +7273 +7274 +7275 +7276 +7277 +7278 +7279 +7280 +7281 +7282 +7283 +7284 +7285 +7286 +7287 +7288 +7289 +7290 +7291 +7292 +7293 +7294 +7295 +7296 +7297 +7298 +7299 +7300 +7301 +7302 +7303 +7304 +7305 +7306 +7307 +7308 +7309 +7310 +7311 +7312 +7313 +7314 +7315 +7316 +7317 +7318 +7319 +7320 +7321 +7322 +7323 +7324 +7325 +7326 +7327 +7328 +7329 +7330 +7331 +7332 +7333 +7334 +7335 +7336 +7337 +7338 +7339 +7340 +7341 +7342 +7343 +7344 +7345 +7346 +7347 +7348 +7349 +7350 +7351 +7352 +7353 +7354 +7355 +7356 +7357 +7358 +7359 +7360 +7361 +7362 +7363 +7364 +7365 +7366 +7367 +7368 +7369 +7370 +7371 +7372 +7373 +7374 +7375 +7376 +7377 +7378 +7379 +7380 +7381 +7382 +7383 +7384 +7385 +7386 +7387 +7388 +7389 +7390 +7391 +7392 +7393 +7394 +7395 +7396 +7397 +7398 +7399 +7400 +7401 +7402 +7403 +7404 +7405 +7406 +7407 +7408 +7409 +7410 +7411 +7412 +7413 +7414 +7415 +7416 +7417 +7418 +7419 +7420 +7421 +7422 +7423 +7424 +7425 +7426 +7427 +7428 +7429 +7430 +7431 +7432 +7433 +7434 +7435 +7436 +7437 +7438 +7439 +7440 +7441 +7442 +7443 +7444 +7445 +7446 +7447 +7448 +7449 +7450 +7451 +7452 +7453 +7454 +7455 +7456 +7457 +7458 +7459 +7460 +7461 +7462 +7463 +7464 +7465 +7466 +7467 +7468 +7469 +7470 +7471 +7472 +7473 +7474 +7475 +7476 +7477 +7478 +7479 +7480 +7481 +7482 +7483 +7484 +7485 +7486 +7487 +7488 +7489 +7490 +7491 +7492 +7493 +7494 +7495 +7496 +7497 +7498 +7499 +7500 +7501 +7502 +7503 +7504 +7505 +7506 +7507 +7508 +7509 +7510 +7511 +7512 +7513 +7514 +7515 +7516 +7517 +7518 +7519 +7520 +7521 +7522 +7523 +7524 +7525 +7526 +7527 +7528 +7529 +7530 +7531 +7532 +7533 +7534 +7535 +7536 +7537 +7538 +7539 +7540 +7541 +7542 +7543 +7544 +7545 +7546 +7547 +7548 +7549 +7550 +7551 +7552 +7553 +7554 +7555 +7556 +7557 +7558 +7559 +7560 +7561 +7562 +7563 +7564 +7565 +7566 +7567 +7568 +7569 +7570 +7571 +7572 +7573 +7574 +7575 +7576 +7577 +7578 +7579 +7580 +7581 +7582 +7583 +7584 +7585 +7586 +7587 +7588 +7589 +7590 +7591 +7592 +7593 +7594 +7595 +7596 +7597 +7598 +7599 +7600 +7601 +7602 +7603 +7604 +7605 +7606 +7607 +7608 +7609 +7610 +7611 +7612 +7613 +7614 +7615 +7616 +7617 +7618 +7619 +7620 +7621 +7622 +7623 +7624 +7625 +7626 +7627 +7628 +7629 +7630 +7631 +7632 +7633 +7634 +7635 +7636 +7637 +7638 +7639 +7640 +7641 +7642 +7643 +7644 +7645 +7646 +7647 +7648 +7649 +7650 +7651 +7652 +7653 +7654 +7655 +7656 +7657 +7658 +7659 +7660 +7661 +7662 +7663 +7664 +7665 +7666 +7667 +7668 +7669 +7670 +7671 +7672 +7673 +7674 +7675 +7676 +7677 +7678 +7679 +7680 +7681 +7682 +7683 +7684 +7685 +7686 +7687 +7688 +7689 +7690 +7691 +7692 +7693 +7694 +7695 +7696 +7697 +7698 +7699 +7700 +7701 +7702 +7703 +7704 +7705 +7706 +7707 +7708 +7709 +7710 +7711 +7712 +7713 +7714 +7715 +7716 +7717 +7718 +7719 +7720 +7721 +7722 +7723 +7724 +7725 +7726 +7727 +7728 +7729 +7730 +7731 +7732 +7733 +7734 +7735 +7736 +7737 +7738 +7739 +7740 +7741 +7742 +7743 +7744 +7745 +7746 +7747 +7748 +7749 +7750 +7751 +7752 +7753 +7754 +7755 +7756 +7757 +7758 +7759 +7760 +7761 +7762 +7763 +7764 +7765 +7766 +7767 +7768 +7769 +7770 +7771 +7772 +7773 +7774 +7775 +7776 +7777 +7778 +7779 +7780 +7781 +7782 +7783 +7784 +7785 +7786 +7787 +7788 +7789 +7790 +7791 +7792 +7793 +7794 +7795 +7796 +7797 +7798 +7799 +7800 +7801 +7802 +7803 +7804 +7805 +7806 +7807 +7808 +7809 +7810 +7811 +7812 +7813 +7814 +7815 +7816 +7817 +7818 +7819 +7820 +7821 +7822 +7823 +7824 +7825 +7826 +7827 +7828 +7829 +7830 +7831 +7832 +7833 +7834 +7835 +7836 +7837 +7838 +7839 +7840 +7841 +7842 +7843 +7844 +7845 +7846 +7847 +7848 +7849 +7850 +7851 +7852 +7853 +7854 +7855 +7856 +7857 +7858 +7859 +7860 +7861 +7862 +7863 +7864 +7865 +7866 +7867 +7868 +7869 +7870 +7871 +7872 +7873 +7874 +7875 +7876 +7877 +7878 +7879 +7880 +7881 +7882 +7883 +7884 +7885 +7886 +7887 +7888 +7889 +7890 +7891 +7892 +7893 +7894 +7895 +7896 +7897 +7898 +7899 +7900 +7901 +7902 +7903 +7904 +7905 +7906 +7907 +7908 +7909 +7910 +7911 +7912 +7913 +7914 +7915 +7916 +7917 +7918 +7919 +7920 +7921 +7922 +7923 +7924 +7925 +7926 +7927 +7928 +7929 +7930 +7931 +7932 +7933 +7934 +7935 +7936 +7937 +7938 +7939 +7940 +7941 +7942 +7943 +7944 +7945 +7946 +7947 +7948 +7949 +7950 +7951 +7952 +7953 +7954 +7955 +7956 +7957 +7958 +7959 +7960 +7961 +7962 +7963 +7964 +7965 +7966 +7967 +7968 +7969 +7970 +7971 +7972 +7973 +7974 +7975 +7976 +7977 +7978 +7979 +7980 +7981 +7982 +7983 +7984 +7985 +7986 +7987 +7988 +7989 +7990 +7991 +7992 +7993 +7994 +7995 +7996 +7997 +7998 +7999 +8000 +8001 +8002 +8003 +8004 +8005 +8006 +8007 +8008 +8009 +8010 +8011 +8012 +8013 +8014 +8015 +8016 +8017 +8018 +8019 +8020 +8021 +8022 +8023 +8024 +8025 +8026 +8027 +8028 +8029 +8030 +8031 +8032 +8033 +8034 +8035 +8036 +8037 +8038 +8039 +8040 +8041 +8042 +8043 +8044 +8045 +8046 +8047 +8048 +8049 +8050 +8051 +8052 +8053 +8054 +8055 +8056 +8057 +8058 +8059 +8060 +8061 +8062 +8063 +8064 +8065 +8066 +8067 +8068 +8069 +8070 +8071 +8072 +8073 +8074 +8075 +8076 +8077 +8078 +8079 +8080 +8081 +8082 +8083 +8084 +8085 +8086 +8087 +8088 +8089 +8090 +8091 +8092 +8093 +8094 +8095 +8096 +8097 +8098 +8099 +8100 +8101 +8102 +8103 +8104 +8105 +8106 +8107 +8108 +8109 +8110 +8111 +8112 +8113 +8114 +8115 +8116 +8117 +8118 +8119 +8120 +8121 +8122 +8123 +8124 +8125 +8126 +8127 +8128 +8129 +8130 +8131 +8132 +8133 +8134 +8135 +8136 +8137 +8138 +8139 +8140 +8141 +8142 +8143 +8144 +8145 +8146 +8147 +8148 +8149 +8150 +8151 +8152 +8153 +8154 +8155 +8156 +8157 +8158 +8159 +8160 +8161 +8162 +8163 +8164 +8165 +8166 +8167 +8168 +8169 +8170 +8171 +8172 +8173 +8174 +8175 +8176 +8177 +8178 +8179 +8180 +8181 +8182 +8183 +8184 +8185 +8186 +8187 +8188 +8189 +8190 +8191 +8192 +8193 +8194 +8195 +8196 +8197 +8198 +8199 +8200 +8201 +8202 +8203 +8204 +8205 +8206 +8207 +8208 +8209 +8210 +8211 +8212 +8213 +8214 +8215 +8216 +8217 +8218 +8219 +8220 +8221 +8222 +8223 +8224 +8225 +8226 +8227 +8228 +8229 +8230 +8231 +8232 +8233 +8234 +8235 +8236 +8237 +8238 +8239 +8240 +8241 +8242 +8243 +8244 +8245 +8246 +8247 +8248 +8249 +8250 +8251 +8252 +8253 +8254 +8255 +8256 +8257 +8258 +8259 +8260 +8261 +8262 +8263 +8264 +8265 +8266 +8267 +8268 +8269 +8270 +8271 +8272 +8273 +8274 +8275 +8276 +8277 +8278 +8279 +8280 +8281 +8282 +8283 +8284 +8285 +8286 +8287 +8288 +8289 +8290 +8291 +8292 +8293 +8294 +8295 +8296 +8297 +8298 +8299 +8300 +8301 +8302 +8303 +8304 +8305 +8306 +8307 +8308 +8309 +8310 +8311 +8312 +8313 +8314 +8315 +8316 +8317 +8318 +8319 +8320 +8321 +8322 +8323 +8324 +8325 +8326 +8327 +8328 +8329 +8330 +8331 +8332 +8333 +8334 +8335 +8336 +8337 +8338 +8339 +8340 +8341 +8342 +8343 +8344 +8345 +8346 +8347 +8348 +8349 +8350 +8351 +8352 +8353 +8354 +8355 +8356 +8357 +8358 +8359 +8360 +8361 +8362 +8363 +8364 +8365 +8366 +8367 +8368 +8369 +8370 +8371 +8372 +8373 +8374 +8375 +8376 +8377 +8378 +8379 +8380 +8381 +8382 +8383 +8384 +8385 +8386 +8387 +8388 +8389 +8390 +8391 +8392 +8393 +8394 +8395 +8396 +8397 +8398 +8399 +8400 +8401 +8402 +8403 +8404 +8405 +8406 +8407 +8408 +8409 +8410 +8411 +8412 +8413 +8414 +8415 +8416 +8417 +8418 +8419 +8420 +8421 +8422 +8423 +8424 +8425 +8426 +8427 +8428 +8429 +8430 +8431 +8432 +8433 +8434 +8435 +8436 +8437 +8438 +8439 +8440 +8441 +8442 +8443 +8444 +8445 +8446 +8447 +8448 +8449 +8450 +8451 +8452 +8453 +8454 +8455 +8456 +8457 +8458 +8459 +8460 +8461 +8462 +8463 +8464 +8465 +8466 +8467 +8468 +8469 +8470 +8471 +8472 +8473 +8474 +8475 +8476 +8477 +8478 +8479 +8480 +8481 +8482 +8483 +8484 +8485 +8486 +8487 +8488 +8489 +8490 +8491 +8492 +8493 +8494 +8495 +8496 +8497 +8498 +8499 +8500 +8501 +8502 +8503 +8504 +8505 +8506 +8507 +8508 +8509 +8510 +8511 +8512 +8513 +8514 +8515 +8516 +8517 +8518 +8519 +8520 +8521 +8522 +8523 +8524 +8525 +8526 +8527 +8528 +8529 +8530 +8531 +8532 +8533 +8534 +8535 +8536 +8537 +8538 +8539 +8540 +8541 +8542 +8543 +8544 +8545 +8546 +8547 +8548 +8549 +8550 +8551 +8552 +8553 +8554 +8555 +8556 +8557 +8558 +8559 +8560 +8561 +8562 +8563 +8564 +8565 +8566 +8567 +8568 +8569 +8570 +8571 +8572 +8573 +8574 +8575 +8576 +8577 +8578 +8579 +8580 +8581 +8582 +8583 +8584 +8585 +8586 +8587 +8588 +8589 +8590 +8591 +8592 +8593 +8594 +8595 +8596 +8597 +8598 +8599 +8600 +8601 +8602 +8603 +8604 +8605 +8606 +8607 +8608 +8609 +8610 +8611 +8612 +8613 +8614 +8615 +8616 +8617 +8618 +8619 +8620 +8621 +8622 +8623 +8624 +8625 +8626 +8627 +8628 +8629 +8630 +8631 +8632 +8633 +8634 +8635 +8636 +8637 +8638 +8639 +8640 +8641 +8642 +8643 +8644 +8645 +8646 +8647 +8648 +8649 +8650 +8651 +8652 +8653 +8654 +8655 +8656 +8657 +8658 +8659 +8660 +8661 +8662 +8663 +8664 +8665 +8666 +8667 +8668 +8669 +8670 +8671 +8672 +8673 +8674 +8675 +8676 +8677 +8678 +8679 +8680 +8681 +8682 +8683 +8684 +8685 +8686 +8687 +8688 +8689 +8690 +8691 +8692 +8693 +8694 +8695 +8696 +8697 +8698 +8699 +8700 +8701 +8702 +8703 +8704 +8705 +8706 +8707 +8708 +8709 +8710 +8711 +8712 +8713 +8714 +8715 +8716 +8717 +8718 +8719 +8720 +8721 +8722 +8723 +8724 +8725 +8726 +8727 +8728 +8729 +8730 +8731 +8732 +8733 +8734 +8735 +8736 +8737 +8738 +8739 +8740 +8741 +8742 +8743 +8744 +8745 +8746 +8747 +8748 +8749 +8750 +8751 +8752 +8753 +8754 +8755 +8756 +8757 +8758 +8759 +8760 +8761 +8762 +8763 +8764 +8765 +8766 +8767 +8768 +8769 +8770 +8771 +8772 +8773 +8774 +8775 +8776 +8777 +8778 +8779 +8780 +8781 +8782 +8783 +8784 +8785 +8786 +8787 +8788 +8789 +8790 +8791 +8792 +8793 +8794 +8795 +8796 +8797 +8798 +8799 +8800 +8801 +8802 +8803 +8804 +8805 +8806 +8807 +8808 +8809 +8810 +8811 +8812 +8813 +8814 +8815 +8816 +8817 +8818 +8819 +8820 +8821 +8822 +8823 +8824 +8825 +8826 +8827 +8828 +8829 +8830 +8831 +8832 +8833 +8834 +8835 +8836 +8837 +8838 +8839 +8840 +8841 +8842 +8843 +8844 +8845 +8846 +8847 +8848 +8849 +8850 +8851 +8852 +8853 +8854 +8855 +8856 +8857 +8858 +8859 +8860 +8861 +8862 +8863 +8864 +8865 +8866 +8867 +8868 +8869 +8870 +8871 +8872 +8873 +8874 +8875 +8876 +8877 +8878 +8879 +8880 +8881 +8882 +8883 +8884 +8885 +8886 +8887 +8888 +8889 +8890 +8891 +8892 +8893 +8894 +8895 +8896 +8897 +8898 +8899 +8900 +8901 +8902 +8903 +8904 +8905 +8906 +8907 +8908 +8909 +8910 +8911 +8912 +8913 +8914 +8915 +8916 +8917 +8918 +8919 +8920 +8921 +8922 +8923 +8924 +8925 +8926 +8927 +8928 +8929 +8930 +8931 +8932 +8933 +8934 +8935 +8936 +8937 +8938 +8939 +8940 +8941 +8942 +8943 +8944 +8945 +8946 +8947 +8948 +8949 +8950 +8951 +8952 +8953 +8954 +8955 +8956 +8957 +8958 +8959 +8960 +8961 +8962 +8963 +8964 +8965 +8966 +8967 +8968 +8969 +8970 +8971 +8972 +8973 +8974 +8975 +8976 +8977 +8978 +8979 +8980 +8981 +8982 +8983 +8984 +8985 +8986 +8987 +8988 +8989 +8990 +8991 +8992 +8993 +8994 +8995 +8996 +8997 +8998 +8999 +9000 +9001 +9002 +9003 +9004 +9005 +9006 +9007 +9008 +9009 +9010 +9011 +9012 +9013 +9014 +9015 +9016 +9017 +9018 +9019 +9020 +9021 +9022 +9023 +9024 +9025 +9026 +9027 +9028 +9029 +9030 +9031 +9032 +9033 +9034 +9035 +9036 +9037 +9038 +9039 +9040 +9041 +9042 +9043 +9044 +9045 +9046 +9047 +9048 +9049 +9050 +9051 +9052 +9053 +9054 +9055 +9056 +9057 +9058 +9059 +9060 +9061 +9062 +9063 +9064 +9065 +9066 +9067 +9068 +9069 +9070 +9071 +9072 +9073 +9074 +9075 +9076 +9077 +9078 +9079 +9080 +9081 +9082 +9083 +9084 +9085 +9086 +9087 +9088 +9089 +9090 +9091 +9092 +9093 +9094 +9095 +9096 +9097 +9098 +9099 +9100 +9101 +9102 +9103 +9104 +9105 +9106 +9107 +9108 +9109 +9110 +9111 +9112 +9113 +9114 +9115 +9116 +9117 +9118 +9119 +9120 +9121 +9122 +9123 +9124 +9125 +9126 +9127 +9128 +9129 +9130 +9131 +9132 +9133 +9134 +9135 +9136 +9137 +9138 +9139 +9140 +9141 +9142 +9143 +9144 +9145 +9146 +9147 +9148 +9149 +9150 +9151 +9152 +9153 +9154 +9155 +9156 +9157 +9158 +9159 +9160 +9161 +9162 +9163 +9164 +9165 +9166 +9167 +9168 +9169 +9170 +9171 +9172 +9173 +9174 +9175 +9176 +9177 +9178 +9179 +9180 +9181 +9182 +9183 +9184 +9185 +9186 +9187 +9188 +9189 +9190 +9191 +9192 +9193 +9194 +9195 +9196 +9197 +9198 +9199 +9200 +9201 +9202 +9203 +9204 +9205 +9206 +9207 +9208 +9209 +9210 +9211 +9212 +9213 +9214 +9215 +9216 +9217 +9218 +9219 +9220 +9221 +9222 +9223 +9224 +9225 +9226 +9227 +9228 +9229 +9230 +9231 +9232 +9233 +9234 +9235 +9236 +9237 +9238 +9239 +9240 +9241 +9242 +9243 +9244 +9245 +9246 +9247 +9248 +9249 +9250 +9251 +9252 +9253 +9254 +9255 +9256 +9257 +9258 +9259 +9260 +9261 +9262 +9263 +9264 +9265 +9266 +9267 +9268 +9269 +9270 +9271 +9272 +9273 +9274 +9275 +9276 +9277 +9278 +9279 +9280 +9281 +9282 +9283 +9284 +9285 +9286 +9287 +9288 +9289 +9290 +9291 +9292 +9293 +9294 +9295 +9296 +9297 +9298 +9299 +9300 +9301 +9302 +9303 +9304 +9305 +9306 +9307 +9308 +9309 +9310 +9311 +9312 +9313 +9314 +9315 +9316 +9317 +9318 +9319 +9320 +9321 +9322 +9323 +9324 +9325 +9326 +9327 +9328 +9329 +9330 +9331 +9332 +9333 +9334 +9335 +9336 +9337 +9338 +9339 +9340 +9341 +9342 +9343 +9344 +9345 +9346 +9347 +9348 +9349 +9350 +9351 +9352 +9353 +9354 +9355 +9356 +9357 +9358 +9359 +9360 +9361 +9362 +9363 +9364 +9365 +9366 +9367 +9368 +9369 +9370 +9371 +9372 +9373 +9374 +9375 +9376 +9377 +9378 +9379 +9380 +9381 +9382 +9383 +9384 +9385 +9386 +9387 +9388 +9389 +9390 +9391 +9392 +9393 +9394 +9395 +9396 +9397 +9398 +9399 +9400 +9401 +9402 +9403 +9404 +9405 +9406 +9407 +9408 +9409 +9410 +9411 +9412 +9413 +9414 +9415 +9416 +9417 +9418 +9419 +9420 +9421 +9422 +9423 +9424 +9425 +9426 +9427 +9428 +9429 +9430 +9431 +9432 +9433 +9434 +9435 +9436 +9437 +9438 +9439 +9440 +9441 +9442 +9443 +9444 +9445 +9446 +9447 +9448 +9449 +9450 +9451 +9452 +9453 +9454 +9455 +9456 +9457 +9458 +9459 +9460 +9461 +9462 +9463 +9464 +9465 +9466 +9467 +9468 +9469 +9470 +9471 +9472 +9473 +9474 +9475 +9476 +9477 +9478 +9479 +9480 +9481 +9482 +9483 +9484 +9485 +9486 +9487 +9488 +9489 +9490 +9491 +9492 +9493 +9494 +9495 +9496 +9497 +9498 +9499 +9500 +9501 +9502 +9503 +9504 +9505 +9506 +9507 +9508 +9509 +9510 +9511 +9512 +9513 +9514 +9515 +9516 +9517 +9518 +9519 +9520 +9521 +9522 +9523 +9524 +9525 +9526 +9527 +9528 +9529 +9530 +9531 +9532 +9533 +9534 +9535 +9536 +9537 +9538 +9539 +9540 +9541 +9542 +9543 +9544 +9545 +9546 +9547 +9548 +9549 +9550 +9551 +9552 +9553 +9554 +9555 +9556 +9557 +9558 +9559 +9560 +9561 +9562 +9563 +9564 +9565 +9566 +9567 +9568 +9569 +9570 +9571 +9572 +9573 +9574 +9575 +9576 +9577 +9578 +9579 +9580 +9581 +9582 +9583 +9584 +9585 +9586 +9587 +9588 +9589 +9590 +9591 +9592 +9593 +9594 +9595 +9596 +9597 +9598 +9599 +9600 +9601 +9602 +9603 +9604 +9605 +9606 +9607 +9608 +9609 +9610 +9611 +9612 +9613 +9614 +9615 +9616 +9617 +9618 +9619 +9620 +9621 +9622 +9623 +9624 +9625 +9626 +9627 +9628 +9629 +9630 +9631 +9632 +9633 +9634 +9635 +9636 +9637 +9638 +9639 +9640 +9641 +9642 +9643 +9644 +9645 +9646 +9647 +9648 +9649 +9650 +9651 +9652 +9653 +9654 +9655 +9656 +9657 +9658 +9659 +9660 +9661 +9662 +9663 +9664 +9665 +9666 +9667 +9668 +9669 +9670 +9671 +9672 +9673 +9674 +9675 +9676 +9677 +9678 +9679 +9680 +9681 +9682 +9683 +9684 +9685 +9686 +9687 +9688 +9689 +9690 +9691 +9692 +9693 +9694 +9695 +9696 +9697 +9698 +9699 +9700 +9701 +9702 +9703 +9704 +9705 +9706 +9707 +9708 +9709 +9710 +9711 +9712 +9713 +9714 +9715 +9716 +9717 +9718 +9719 +9720 +9721 +9722 +9723 +9724 +9725 +9726 +9727 +9728 +9729 +9730 +9731 +9732 +9733 +9734 +9735 +9736 +9737 +9738 +9739 +9740 +9741 +9742 +9743 +9744 +9745 +9746 +9747 +9748 +9749 +9750 +9751 +9752 +9753 +9754 +9755 +9756 +9757 +9758 +9759 +9760 +9761 +9762 +9763 +9764 +9765 +9766 +9767 +9768 +9769 +9770 +9771 +9772 +9773 +9774 +9775 +9776 +9777 +9778 +9779 +9780 +9781 +9782 +9783 +9784 +9785 +9786 +9787 +9788 +9789 +9790 +9791 +9792 +9793 +9794 +9795 +9796 +9797 +9798 +9799 +9800 +9801 +9802 +9803 +9804 +9805 +9806 +9807 +9808 +9809 +9810 +9811 +9812 +9813 +9814 +9815 +9816 +9817 +9818 +9819 +9820 +9821 +9822 +9823 +9824 +9825 +9826 +9827 +9828 +9829 +9830 +9831 +9832 +9833 +9834 +9835 +9836 +9837 +9838 +9839 +9840 +9841 +9842 +9843 +9844 +9845 +9846 +9847 +9848 +9849 +9850 +9851 +9852 +9853 +9854 +9855 +9856 +9857 +9858 +9859 +9860 +9861 +9862 +9863 +9864 +9865 +9866 +9867 +9868 +9869 +9870 +9871 +9872 +9873 +9874 +9875 +9876 +9877 +9878 +9879 +9880 +9881 +9882 +9883 +9884 +9885 +9886 +9887 +9888 +9889 +9890 +9891 +9892 +9893 +9894 +9895 +9896 +9897 +9898 +9899 +9900 +9901 +9902 +9903 +9904 +9905 +9906 +9907 +9908 +9909 +9910 +9911 +9912 +9913 +9914 +9915 +9916 +9917 +9918 +9919 +9920 +9921 +9922 +9923 +9924 +9925 +9926 +9927 +9928 +9929 +9930 +9931 +9932 +9933 +9934 +9935 +9936 +9937 +9938 +9939 +9940 +9941 +9942 +9943 +9944 +9945 +9946 +9947 +9948 +9949 +9950 +9951 +9952 +9953 +9954 +9955 +9956 +9957 +9958 +9959 +9960 +9961 +9962 +9963 +9964 +9965 +9966 +9967 +9968 +9969 +9970 +9971 +9972 +9973 +9974 +9975 +9976 +9977 +9978 +9979 +9980 +9981 +9982 +9983 +9984 +9985 +9986 +9987 +9988 +9989 +9990 +9991 +9992 +9993 +9994 +9995 +9996 +9997 +9998 +9999 +10000 +10001 +10002 +10003 +10004 +10005 +10006 +10007 +10008 +10009 +10010 +10011 +10012 +10013 +10014 +10015 +10016 +10017 +10018 +10019 +10020 +10021 +10022 +10023 +10024 +10025 +10026 +10027 +10028 +10029 +10030 +10031 +10032 +10033 +10034 +10035 +10036 +10037 +10038 +10039 +10040 +10041 +10042 +10043 +10044 +10045 +10046 +10047 +10048 +10049 +10050 +10051 +10052 +10053 +10054 +10055 +10056 +10057 +10058 +10059 +10060 +10061 +10062 +10063 +10064 +10065 +10066 +10067 +10068 +10069 +10070 +10071 +10072 +10073 +10074 +10075 +10076 +10077 +10078 +10079 +10080 +10081 +10082 +10083 +10084 +10085 +10086 +10087 +10088 +10089 +10090 +10091 +10092 +10093 +10094 +10095 +10096 +10097 +10098 +10099 +10100 +10101 +10102 +10103 +10104 +10105 +10106 +10107 +10108 +10109 +10110 +10111 +10112 +10113 +10114 +10115 +10116 +10117 +10118 +10119 +10120 +10121 +10122 +10123 +10124 +10125 +10126 +10127 +10128 +10129 +10130 +10131 +10132 +10133 +10134 +10135 +10136 +10137 +10138 +10139 +10140 +10141 +10142 +10143 +10144 +10145 +10146 +10147 +10148 +10149 +10150 +10151 +10152 +10153 +10154 +10155 +10156 +10157 +10158 +10159 +10160 +10161 +10162 +10163 +10164 +10165 +10166 +10167 +10168 +10169 +10170 +10171 +10172 +10173 +10174 +10175 +10176 +10177 +10178 +10179 +10180 +10181 +10182 +10183 +10184 +10185 +10186 +10187 +10188 +10189 +10190 +10191 +10192 +10193 +10194 +10195 +10196 +10197 +10198 +10199 +10200 +10201 +10202 +10203 +10204 +10205 +10206 +10207 +10208 +10209 +10210 +10211 +10212 +10213 +10214 +10215 +10216 +10217 +10218 +10219 +10220 +10221 +10222 +10223 +10224 +10225 +10226 +10227 +10228 +10229 +10230 +10231 +10232 +10233 +10234 +10235 +10236 +10237 +10238 +10239 +10240 +10241 +10242 +10243 +10244 +10245 +10246 +10247 +10248 +10249 +10250 +10251 +10252 +10253 +10254 +10255 +10256 +10257 +10258 +10259 +10260 +10261 +10262 +10263 +10264 +10265 +10266 +10267 +10268 +10269 +10270 +10271 +10272 +10273 +10274 +10275 +10276 +10277 +10278 +10279 +10280 +10281 +10282 +10283 +10284 +10285 +10286 +10287 +10288 +10289 +10290 +10291 +10292 +10293 +10294 +10295 +10296 +10297 +10298 +10299 +10300 +10301 +10302 +10303 +10304 +10305 +10306 +10307 +10308 +10309 +10310 +10311 +10312 +10313 +10314 +10315 +10316 +10317 +10318 +10319 +10320 +10321 +10322 +10323 +10324 +10325 +10326 +10327 +10328 +10329 +10330 +10331 +10332 +10333 +10334 +10335 +10336 +10337 +10338 +10339 +10340 +10341 +10342 +10343 +10344 +10345 +10346 +10347 +10348 +10349 +10350 +10351 +10352 +10353 +10354 +10355 +10356 +10357 +10358 +10359 +10360 +10361 +10362 +10363 +10364 +10365 +10366 +10367 +10368 +10369 +10370 +10371 +10372 +10373 +10374 +10375 +10376 +10377 +10378 +10379 +10380 +10381 +10382 +10383 +10384 +10385 +10386 +10387 +10388 +10389 +10390 +10391 +10392 +10393 +10394 +10395 +10396 +10397 +10398 +10399 +10400 +10401 +10402 +10403 +10404 +10405 +10406 +10407 +10408 +10409 +10410 +10411 +10412 +10413 +10414 +10415 +10416 +10417 +10418 +10419 +10420 +10421 +10422 +10423 +10424 +10425 +10426 +10427 +10428 +10429 +10430 +10431 +10432 +10433 +10434 +10435 +10436 +10437 +10438 +10439 +10440 +10441 +10442 +10443 +10444 +10445 +10446 +10447 +10448 +10449 +10450 +10451 +10452 +10453 +10454 +10455 +10456 +10457 +10458 +10459 +10460 +10461 +10462 +10463 +10464 +10465 +10466 +10467 +10468 +10469 +10470 +10471 +10472 +10473 +10474 +10475 +10476 +10477 +10478 +10479 +10480 +10481 +10482 +10483 +10484 +10485 +10486 +10487 +10488 +10489 +10490 +10491 +10492 +10493 +10494 +10495 +10496 +10497 +10498 +10499 +10500 +10501 +10502 +10503 +10504 +10505 +10506 +10507 +10508 +10509 +10510 +10511 +10512 +10513 +10514 +10515 +10516 +10517 +10518 +10519 +10520 +10521 +10522 +10523 +10524 +10525 +10526 +10527 +10528 +10529 +10530 +10531 +10532 +10533 +10534 +10535 +10536 +10537 +10538 +10539 +10540 +10541 +10542 +10543 +10544 +10545 +10546 +10547 +10548 +10549 +10550 +10551 +10552 +10553 +10554 +10555 +10556 +10557 +10558 +10559 +10560 +10561 +10562 +10563 +10564 +10565 +10566 +10567 +10568 +10569 +10570 +10571 +10572 +10573 +10574 +10575 +10576 +10577 +10578 +10579 +10580 +10581 +10582 +10583 +10584 +10585 +10586 +10587 +10588 +10589 +10590 +10591 +10592 +10593 +10594 +10595 +10596 +10597 +10598 +10599 +10600 +10601 +10602 +10603 +10604 +10605 +10606 +10607 +10608 +10609 +10610 +10611 +10612 +10613 +10614 +10615 +10616 +10617 +10618 +10619 +10620 +10621 +10622 +10623 +10624 +10625 +10626 +10627 +10628 +10629 +10630 +10631 +10632 +10633 +10634 +10635 +10636 +10637 +10638 +10639 +10640 +10641 +10642 +10643 +10644 +10645 +10646 +10647 +10648 +10649 +10650 +10651 +10652 +10653 +10654 +10655 +10656 +10657 +10658 +10659 +10660 +10661 +10662 +10663 +10664 +10665 +10666 +10667 +10668 +10669 +10670 +10671 +10672 +10673 +10674 +10675 +10676 +10677 +10678 +10679 +10680 +10681 +10682 +10683 +10684 +10685 +10686 +10687 +10688 +10689 +10690 +10691 +10692 +10693 +10694 +10695 +10696 +10697 +10698 +10699 +10700 +10701 +10702 +10703 +10704 +10705 +10706 +10707 +10708 +10709 +10710 +10711 +10712 +10713 +10714 +10715 +10716 +10717 +10718 +10719 +10720 +10721 +10722 +10723 +10724 +10725 +10726 +10727 +10728 +10729 +10730 +10731 +10732 +10733 +10734 +10735 +10736 +10737 +10738 +10739 +10740 +10741 +10742 +10743 +10744 +10745 +10746 +10747 +10748 +10749 +10750 +10751 +10752 +10753 +10754 +10755 +10756 +10757 +10758 +10759 +10760 +10761 +10762 +10763 +10764 +10765 +10766 +10767 +10768 +10769 +10770 +10771 +10772 +10773 +10774 +10775 +10776 +10777 +10778 +10779 +10780 +10781 +10782 +10783 +10784 +10785 +10786 +10787 +10788 +10789 +10790 +10791 +10792 +10793 +10794 +10795 +10796 +10797 +10798 +10799 +10800 +10801 +10802 +10803 +10804 +10805 +10806 +10807 +10808 +10809 +10810 +10811 +10812 +10813 +10814 +10815 +10816 +10817 +10818 +10819 +10820 +10821 +10822 +10823 +10824 +10825 +10826 +10827 +10828 +10829 +10830 +10831 +10832 +10833 +10834 +10835 +10836 +10837 +10838 +10839 +10840 +10841 +10842 +10843 +10844 +10845 +10846 +10847 +10848 +10849 +10850 +10851 +10852 +10853 +10854 +10855 +10856 +10857 +10858 +10859 +10860 +10861 +10862 +10863 +10864 +10865 +10866 +10867 +10868 +10869 +10870 +10871 +10872 +10873 +10874 +10875 +10876 +10877 +10878 +10879 +10880 +10881 +10882 +10883 +10884 +10885 +10886 +10887 +10888 +10889 +10890 +10891 +10892 +10893 +10894 +10895 +10896 +10897 +10898 +10899 +10900 +10901 +10902 +10903 +10904 +10905 +10906 +10907 +10908 +10909 +10910 +10911 +10912 +10913 +10914 +10915 +10916 +10917 +10918 +10919 +10920 +10921 +10922 +10923 +10924 +10925 +10926 +10927 +10928 +10929 +10930 +10931 +10932 +10933 +10934 +10935 +10936 +10937 +10938 +10939 +10940 +10941 +10942 +10943 +10944 +10945 +10946 +10947 +10948 +10949 +10950 +10951 +10952 +10953 +10954 +10955 +10956 +10957 +10958 +10959 +10960 +10961 +10962 +10963 +10964 +10965 +10966 +10967 +10968 +10969 +10970 +10971 +10972 +10973 +10974 +10975 +10976 +10977 +10978 +10979 +10980 +10981 +10982 +10983 +10984 +10985 +10986 +10987 +10988 +10989 +10990 +10991 +10992 +10993 +10994 +10995 +10996 +10997 +10998 +10999 +11000 +11001 +11002 +11003 +11004 +11005 +11006 +11007 +11008 +11009 +11010 +11011 +11012 +11013 +11014 +11015 +11016 +11017 +11018 +11019 +11020 +11021 +11022 +11023 +11024 +11025 +11026 +11027 +11028 +11029 +11030 +11031 +11032 +11033 +11034 +11035 +11036 +11037 +11038 +11039 +11040 +11041 +11042 +11043 +11044 +11045 +11046 +11047 +11048 +11049 +11050 +11051 +11052 +11053 +11054 +11055 +11056 +11057 +11058 +11059 +11060 +11061 +11062 +11063 +11064 +11065 +11066 +11067 +11068 +11069 +11070 +11071 +11072 +11073 +11074 +11075 +11076 +11077 +11078 +11079 +11080 +11081 +11082 +11083 +11084 +11085 +11086 +11087 +11088 +11089 +11090 +11091 +11092 +11093 +11094 +11095 +11096 +11097 +11098 +11099 +11100 +11101 +11102 +11103 +11104 +11105 +11106 +11107 +11108 +11109 +11110 +11111 +11112 +11113 +11114 +11115 +11116 +11117 +11118 +11119 +11120 +11121 +11122 +11123 +11124 +11125 +11126 +11127 +11128 +11129 +11130 +11131 +11132 +11133 +11134 +11135 +11136 +11137 +11138 +11139 +11140 +11141 +11142 +11143 +11144 +11145 +11146 +11147 +11148 +11149 +11150 +11151 +11152 +11153 +11154 +11155 +11156 +11157 +11158 +11159 +11160 +11161 +11162 +11163 +11164 +11165 +11166 +11167 +11168 +11169 +11170 +11171 +11172 +11173 +11174 +11175 +11176 +11177 +11178 +11179 +11180 +11181 +11182 +11183 +11184 +11185 +11186 +11187 +11188 +11189 +11190 +11191 +11192 +11193 +11194 +11195 +11196 +11197 +11198 +11199 +11200 +11201 +11202 +11203 +11204 +11205 +11206 +11207 +11208 +11209 +11210 +11211 +11212 +11213 +11214 +11215 +11216 +11217 +11218 +11219 +11220 +11221 +11222 +11223 +11224 +11225 +11226 +11227 +11228 +11229 +11230 +11231 +11232 +11233 +11234 +11235 +11236 +11237 +11238 +11239 +11240 +11241 +11242 +11243 +11244 +11245 +11246 +11247 +11248 +11249 +11250 +11251 +11252 +11253 +11254 +11255 +11256 +11257 +11258 +11259 +11260 +11261 +11262 +11263 +11264 +11265 +11266 +11267 +11268 +11269 +11270 +11271 +11272 +11273 +11274 +11275 +11276 +11277 +11278 +11279 +11280 +11281 +11282 +11283 +11284 +11285 +11286 +11287 +11288 +11289 +11290 +11291 +11292 +11293 +11294 +11295 +11296 +11297 +11298 +11299 +11300 +11301 +11302 +11303 +11304 +11305 +11306 +11307 +11308 +11309 +11310 +11311 +11312 +11313 +11314 +11315 +11316 +11317 +11318 +11319 +11320 +11321 +11322 +11323 +11324 +11325 +11326 +11327 +11328 +11329 +11330 +11331 +11332 +11333 +11334 +11335 +11336 +11337 +11338 +11339 +11340 +11341 +11342 +11343 +11344 +11345 +11346 +11347 +11348 +11349 +11350 +11351 +11352 +11353 +11354 +11355 +11356 +11357 +11358 +11359 +11360 +11361 +11362 +11363 +11364 +11365 +11366 +11367 +11368 +11369 +11370 +11371 +11372 +11373 +11374 +11375 +11376 +11377 +11378 +11379 +11380 +11381 +11382 +11383 +11384 +11385 +11386 +11387 +11388 +11389 +11390 +11391 +11392 +11393 +11394 +11395 +11396 +11397 +11398 +11399 +11400 +11401 +11402 +11403 +11404 +11405 +11406 +11407 +11408 +11409 +11410 +11411 +11412 +11413 +11414 +11415 +11416 +11417 +11418 +11419 +11420 +11421 +11422 +11423 +11424 +11425 +11426 +11427 +11428 +11429 +11430 +11431 +11432 +11433 +11434 +11435 +11436 +11437 +11438 +11439 +11440 +11441 +11442 +11443 +11444 +11445 +11446 +11447 +11448 +11449 +11450 +11451 +11452 +11453 +11454 +11455 +11456 +11457 +11458 +11459 +11460 +11461 +11462 +11463 +11464 +11465 +11466 +11467 +11468 +11469 +11470 +11471 +11472 +11473 +11474 +11475 +11476 +11477 +11478 +11479 +11480 +11481 +11482 +11483 +11484 +11485 +11486 +11487 +11488 +11489 +11490 +11491 +11492 +11493 +11494 +11495 +11496 +11497 +11498 +11499 +11500 +11501 +11502 +11503 +11504 +11505 +11506 +11507 +11508 +11509 +11510 +11511 +11512 +11513 +11514 +11515 +11516 +11517 +11518 +11519 +11520 +11521 +11522 +11523 +11524 +11525 +11526 +11527 +11528 +11529 +11530 +11531 +11532 +11533 +11534 +11535 +11536 +11537 +11538 +11539 +11540 +11541 +11542 +11543 +11544 +11545 +11546 +11547 +11548 +11549 +11550 +11551 +11552 +11553 +11554 +11555 +11556 +11557 +11558 +11559 +11560 +11561 +11562 +11563 +11564 +11565 +11566 +11567 +11568 +11569 +11570 +11571 +11572 +11573 +11574 +11575 +11576 +11577 +11578 +11579 +11580 +11581 +11582 +11583 +11584 +11585 +11586 +11587 +11588 +11589 +11590 +11591 +11592 +11593 +11594 +11595 +11596 +11597 +11598 +11599 +11600 +11601 +11602 +11603 +11604 +11605 +11606 +11607 +11608 +11609 +11610 +11611 +11612 +11613 +11614 +11615 +11616 +11617 +11618 +11619 +11620 +11621 +11622 +11623 +11624 +11625 +11626 +11627 +11628 +11629 +11630 +11631 +11632 +11633 +11634 +11635 +11636 +11637 +11638 +11639 +11640 +11641 +11642 +11643 +11644 +11645 +11646 +11647 +11648 +11649 +11650 +11651 +11652 +11653 +11654 +11655 +11656 +11657 +11658 +11659 +11660 +11661 +11662 +11663 +11664 +11665 +11666 +11667 +11668 +11669 +11670 +11671 +11672 +11673 +11674 +11675 +11676 +11677 +11678 +11679 +11680 +11681 +11682 +11683 +11684 +11685 +11686 +11687 +11688 +11689 +11690 +11691 +11692 +11693 +11694 +11695 +11696 +11697 +11698 +11699 +11700 +11701 +11702 +11703 +11704 +11705 +11706 +11707 +11708 +11709 +11710 +11711 +11712 +11713 +11714 +11715 +11716 +11717 +11718 +11719 +11720 +11721 +11722 +11723 +11724 +11725 +11726 +11727 +11728 +11729 +11730 +11731 +11732 +11733 +11734 +11735 +11736 +11737 +11738 +11739 +11740 +11741 +11742 +11743 +11744 +11745 +11746 +11747 +11748 +11749 +11750 +11751 +11752 +11753 +11754 +11755 +11756 +11757 +11758 +11759 +11760 +11761 +11762 +11763 +11764 +11765 +11766 +11767 +11768 +11769 +11770 +11771 +11772 +11773 +11774 +11775 +11776 +11777 +11778 +11779 +11780 +11781 +11782 +11783 +11784 +11785 +11786 +11787 +11788 +11789 +11790 +11791 +11792 +11793 +11794 +11795 +11796 +11797 +11798 +11799 +11800 +11801 +11802 +11803 +11804 +11805 +11806 +11807 +11808 +11809 +11810 +11811 +11812 +11813 +11814 +11815 +11816 +11817 +11818 +11819 +11820 +11821 +11822 +11823 +11824 +11825 +11826 +11827 +11828 +11829 +11830 +11831 +11832 +11833 +11834 +11835 +11836 +11837 +11838 +11839 +11840 +11841 +11842 +11843 +11844 +11845 +11846 +11847 +11848 +11849 +11850 +11851 +11852 +11853 +11854 +11855 +11856 +11857 +11858 +11859 +11860 +11861 +11862 +11863 +11864 +11865 +11866 +11867 +11868 +11869 +11870 +11871 +11872 +11873 +11874 +11875 +11876 +11877 +11878 +11879 +11880 +11881 +11882 +11883 +11884 +11885 +11886 +11887 +11888 +11889 +11890 +11891 +11892 +11893 +11894 +11895 +11896 +11897 +11898 +11899 +11900 +11901 +11902 +11903 +11904 +11905 +11906 +11907 +11908 +11909 +11910 +11911 +11912 +11913 +11914 +11915 +11916 +11917 +11918 +11919 +11920 +11921 +11922 +11923 +11924 +11925 +11926 +11927 +11928 +11929 +11930 +11931 +11932 +11933 +11934 +11935 +11936 +11937 +11938 +11939 +11940 +11941 +11942 +11943 +11944 +11945 +11946 +11947 +11948 +11949 +11950 +11951 +11952 +11953 +11954 +11955 +11956 +11957 +11958 +11959 +11960 +11961 +11962 +11963 +11964 +11965 +11966 +11967 +11968 +11969 +11970 +11971 +11972 +11973 +11974 +11975 +11976 +11977 +11978 +11979 +11980 +11981 +11982 +11983 +11984 +11985 +11986 +11987 +11988 +11989 +11990 +11991 +11992 +11993 +11994 +11995 +11996 +11997 +11998 +11999 +12000 +12001 +12002 +12003 +12004 +12005 +12006 +12007 +12008 +12009 +12010 +12011 +12012 +12013 +12014 +12015 +12016 +12017 +12018 +12019 +12020 +12021 +12022 +12023 +12024 +12025 +12026 +12027 +12028 +12029 +12030 +12031 +12032 +12033 +12034 +12035 +12036 +12037 +12038 +12039 +12040 +12041 +12042 +12043 +12044 +12045 +12046 +12047 +12048 +12049 +12050 +12051 +12052 +12053 +12054 +12055 +12056 +12057 +12058 +12059 +12060 +12061 +12062 +12063 +12064 +12065 +12066 +12067 +12068 +12069 +12070 +12071 +12072 +12073 +12074 +12075 +12076 +12077 +12078 +12079 +12080 +12081 +12082 +12083 +12084 +12085 +12086 +12087 +12088 +12089 +12090 +12091 +12092 +12093 +12094 +12095 +12096 +12097 +12098 +12099 +12100 +12101 +12102 +12103 +12104 +12105 +12106 +12107 +12108 +12109 +12110 +12111 +12112 +12113 +12114 +12115 +12116 +12117 +12118 +12119 +12120 +12121 +12122 +12123 +12124 +12125 +12126 +12127 +12128 +12129 +12130 +12131 +12132 +12133 +12134 +12135 +12136 +12137 +12138 +12139 +12140 +12141 +12142 +12143 +12144 +12145 +12146 +12147 +12148 +12149 +12150 +12151 +12152 +12153 +12154 +12155 +12156 +12157 +12158 +12159 +12160 +12161 +12162 +12163 +12164 +12165 +12166 +12167 +12168 +12169 +12170 +12171 +12172 +12173 +12174 +12175 +12176 +12177 +12178 +12179 +12180 +12181 +12182 +12183 +12184 +12185 +12186 +12187 +12188 +12189 +12190 +12191 +12192 +12193 +12194 +12195 +12196 +12197 +12198 +12199 +12200 +12201 +12202 +12203 +12204 +12205 +12206 +12207 +12208 +12209 +12210 +12211 +12212 +12213 +12214 +12215 +12216 +12217 +12218 +12219 +12220 +12221 +12222 +12223 +12224 +12225 +12226 +12227 +12228 +12229 +12230 +12231 +12232 +12233 +12234 +12235 +12236 +12237 +12238 +12239 +12240 +12241 +12242 +12243 +12244 +12245 +12246 +12247 +12248 +12249 +12250 +12251 +12252 +12253 +12254 +12255 +12256 +12257 +12258 +12259 +12260 +12261 +12262 +12263 +12264 +12265 +12266 +12267 +12268 +12269 +12270 +12271 +12272 +12273 +12274 +12275 +12276 +12277 +12278 +12279 +12280 +12281 +12282 +12283 +12284 +12285 +12286 +12287 +12288 +12289 +12290 +12291 +12292 +12293 +12294 +12295 +12296 +12297 +12298 +12299 +12300 +12301 +12302 +12303 +12304 +12305 +12306 +12307 +12308 +12309 +12310 +12311 +12312 +12313 +12314 +12315 +12316 +12317 +12318 +12319 +12320 +12321 +12322 +12323 +12324 +12325 +12326 +12327 +12328 +12329 +12330 +12331 +12332 +12333 +12334 +12335 +12336 +12337 +12338 +12339 +12340 +12341 +12342 +12343 +12344 +12345 +12346 +12347 +12348 +12349 +12350 +12351 +12352 +12353 +12354 +12355 +12356 +12357 +12358 +12359 +12360 +12361 +12362 +12363 +12364 +12365 +12366 +12367 +12368 +12369 +12370 +12371 +12372 +12373 +12374 +12375 +12376 +12377 +12378 +12379 +12380 +12381 +12382 +12383 +12384 +12385 +12386 +12387 +12388 +12389 +12390 +12391 +12392 +12393 +12394 +12395 +12396 +12397 +12398 +12399 +12400 +12401 +12402 +12403 +12404 +12405 +12406 +12407 +12408 +12409 +12410 +12411 +12412 +12413 +12414 +12415 +12416 +12417 +12418 +12419 +12420 +12421 +12422 +12423 +12424 +12425 +12426 +12427 +12428 +12429 +12430 +12431 +12432 +12433 +12434 +12435 +12436 +12437 +12438 +12439 +12440 +12441 +12442 +12443 +12444 +12445 +12446 +12447 +12448 +12449 +12450 +12451 +12452 +12453 +12454 +12455 +12456 +12457 +12458 +12459 +12460 +12461 +12462 +12463 +12464 +12465 +12466 +12467 +12468 +12469 +12470 +12471 +12472 +12473 +12474 +12475 +12476 +12477 +12478 +12479 +12480 +12481 +12482 +12483 +12484 +12485 +12486 +12487 +12488 +12489 +12490 +12491 +12492 +12493 +12494 +12495 +12496 +12497 +12498 +12499 +12500 +12501 +12502 +12503 +12504 +12505 +12506 +12507 +12508 +12509 +12510 +12511 +12512 +12513 +12514 +12515 +12516 +12517 +12518 +12519 +12520 +12521 +12522 +12523 +12524 +12525 +12526 +12527 +12528 +12529 +12530 +12531 +12532 +12533 +12534 +12535 +12536 +12537 +12538 +12539 +12540 +12541 +12542 +12543 +12544 +12545 +12546 +12547 +12548 +12549 +12550 +12551 +12552 +12553 +12554 +12555 +12556 +12557 +12558 +12559 +12560 +12561 +12562 +12563 +12564 +12565 +12566 +12567 +12568 +12569 +12570 +12571 +12572 +12573 +12574 +12575 +12576 +12577 +12578 +12579 +12580 +12581 +12582 +12583 +12584 +12585 +12586 +12587 +12588 +12589 +12590 +12591 +12592 +12593 +12594 +12595 +12596 +12597 +12598 +12599 +12600 +12601 +12602 +12603 +12604 +12605 +12606 +12607 +12608 +12609 +12610 +12611 +12612 +12613 +12614 +12615 +12616 +12617 +12618 +12619 +12620 +12621 +12622 +12623 +12624 +12625 +12626 +12627 +12628 +12629 +12630 +12631 +12632 +12633 +12634 +12635 +12636 +12637 +12638 +12639 +12640 +12641 +12642 +12643 +12644 +12645 +12646 +12647 +12648 +12649 +12650 +12651 +12652 +12653 +12654 +12655 +12656 +12657 +12658 +12659 +12660 +12661 +12662 +12663 +12664 +12665 +12666 +12667 +12668 +12669 +12670 +12671 +12672 +12673 +12674 +12675 +12676 +12677 +12678 +12679 +12680 +12681 +12682 +12683 +12684 +12685 +12686 +12687 +12688 +12689 +12690 +12691 +12692 +12693 +12694 +12695 +12696 +12697 +12698 +12699 +12700 +12701 +12702 +12703 +12704 +12705 +12706 +12707 +12708 +12709 +12710 +12711 +12712 +12713 +12714 +12715 +12716 +12717 +12718 +12719 +12720 +12721 +12722 +12723 +12724 +12725 +12726 +12727 +12728 +12729 +12730 +12731 +12732 +12733 +12734 +12735 +12736 +12737 +12738 +12739 +12740 +12741 +12742 +12743 +12744 +12745 +12746 +12747 +12748 +12749 +12750 +12751 +12752 +12753 +12754 +12755 +12756 +12757 +12758 +12759 +12760 +12761 +12762 +12763 +12764 +12765 +12766 +12767 +12768 +12769 +12770 +12771 +12772 +12773 +12774 +12775 +12776 +12777 +12778 +12779 +12780 +12781 +12782 +12783 +12784 +12785 +12786 +12787 +12788 +12789 +12790 +12791 +12792 +12793 +12794 +12795 +12796 +12797 +12798 +12799 +12800 +12801 +12802 +12803 +12804 +12805 +12806 +12807 +12808 +12809 +12810 +12811 +12812 +12813 +12814 +12815 +12816 +12817 +12818 +12819 +12820 +12821 +12822 +12823 +12824 +12825 +12826 +12827 +12828 +12829 +12830 +12831 +12832 +12833 +12834 +12835 +12836 +12837 +12838 +12839 +12840 +12841 +12842 +12843 +12844 +12845 +12846 +12847 +12848 +12849 +12850 +12851 +12852 +12853 +12854 +12855 +12856 +12857 +12858 +12859 +12860 +12861 +12862 +12863 +12864 +12865 +12866 +12867 +12868 +12869 +12870 +12871 +12872 +12873 +12874 +12875 +12876 +12877 +12878 +12879 +12880 +12881 +12882 +12883 +12884 +12885 +12886 +12887 +12888 +12889 +12890 +12891 +12892 +12893 +12894 +12895 +12896 +12897 +12898 +12899 +12900 +12901 +12902 +12903 +12904 +12905 +12906 +12907 +12908 +12909 +12910 +12911 +12912 +12913 +12914 +12915 +12916 +12917 +12918 +12919 +12920 +12921 +12922 +12923 +12924 +12925 +12926 +12927 +12928 +12929 +12930 +12931 +12932 +12933 +12934 +12935 +12936 +12937 +12938 +12939 +12940 +12941 +12942 +12943 +12944 +12945 +12946 +12947 +12948 +12949 +12950 +12951 +12952 +12953 +12954 +12955 +12956 +12957 +12958 +12959 +12960 +12961 +12962 +12963 +12964 +12965 +12966 +12967 +12968 +12969 +12970 +12971 +12972 +12973 +12974 +12975 +12976 +12977 +12978 +12979 +12980 +12981 +12982 +12983 +12984 +12985 +12986 +12987 +12988 +12989 +12990 +12991 +12992 +12993 +12994 +12995 +12996 +12997 +12998 +12999 +13000 +13001 +13002 +13003 +13004 +13005 +13006 +13007 +13008 +13009 +13010 +13011 +13012 +13013 +13014 +13015 +13016 +13017 +13018 +13019 +13020 +13021 +13022 +13023 +13024 +13025 +13026 +13027 +13028 +13029 +13030 +13031 +13032 +13033 +13034 +13035 +13036 +13037 +13038 +13039 +13040 +13041 +13042 +13043 +13044 +13045 +13046 +13047 +13048 +13049 +13050 +13051 +13052 +13053 +13054 +13055 +13056 +13057 +13058 +13059 +13060 +13061 +13062 +13063 +13064 +13065 +13066 +13067 +13068 +13069 +13070 +13071 +13072 +13073 +13074 +13075 +13076 +13077 +13078 +13079 +13080 +13081 +13082 +13083 +13084 +13085 +13086 +13087 +13088 +13089 +13090 +13091 +13092 +13093 +13094 +13095 +13096 +13097 +13098 +13099 +13100 +13101 +13102 +13103 +13104 +13105 +13106 +13107 +13108 +13109 +13110 +13111 +13112 +13113 +13114 +13115 +13116 +13117 +13118 +13119 +13120 +13121 +13122 +13123 +13124 +13125 +13126 +13127 +13128 +13129 +13130 +13131 +13132 +13133 +13134 +13135 +13136 +13137 +13138 +13139 +13140 +13141 +13142 +13143 +13144 +13145 +13146 +13147 +13148 +13149 +13150 +13151 +13152 +13153 +13154 +13155 +13156 +13157 +13158 +13159 +13160 +13161 +13162 +13163 +13164 +13165 +13166 +13167 +13168 +13169 +13170 +13171 +13172 +13173 +13174 +13175 +13176 +13177 +13178 +13179 +13180 +13181 +13182 +13183 +13184 +13185 +13186 +13187 +13188 +13189 +13190 +13191 +13192 +13193 +13194 +13195 +13196 +13197 +13198 +13199 +13200 +13201 +13202 +13203 +13204 +13205 +13206 +13207 +13208 +13209 +13210 +13211 +13212 +13213 +13214 +13215 +13216 +13217 +13218 +13219 +13220 +13221 +13222 +13223 +13224 +13225 +13226 +13227 +13228 +13229 +13230 +13231 +13232 +13233 +13234 +13235 +13236 +13237 +13238 +13239 +13240 +13241 +13242 +13243 +13244 +13245 +13246 +13247 +13248 +13249 +13250 +13251 +13252 +13253 +13254 +13255 +13256 +13257 +13258 +13259 +13260 +13261 +13262 +13263 +13264 +13265 +13266 +13267 +13268 +13269 +13270 +13271 +13272 +13273 +13274 +13275 +13276 +13277 +13278 +13279 +13280 +13281 +13282 +13283 +13284 +13285 +13286 +13287 +13288 +13289 +13290 +13291 +13292 +13293 +13294 +13295 +13296 +13297 +13298 +13299 +13300 +13301 +13302 +13303 +13304 +13305 +13306 +13307 +13308 +13309 +13310 +13311 +13312 +13313 +13314 +13315 +13316 +13317 +13318 +13319 +13320 +13321 +13322 +13323 +13324 +13325 +13326 +13327 +13328 +13329 +13330 +13331 +13332 +13333 +13334 +13335 +13336 +13337 +13338 +13339 +13340 +13341 +13342 +13343 +13344 +13345 +13346 +13347 +13348 +13349 +13350 +13351 +13352 +13353 +13354 +13355 +13356 +13357 +13358 +13359 +13360 +13361 +13362 +13363 +13364 +13365 +13366 +13367 +13368 +13369 +13370 +13371 +13372 +13373 +13374 +13375 +13376 +13377 +13378 +13379 +13380 +13381 +13382 +13383 +13384 +13385 +13386 +13387 +13388 +13389 +13390 +13391 +13392 +13393 +13394 +13395 +13396 +13397 +13398 +13399 +13400 +13401 +13402 +13403 +13404 +13405 +13406 +13407 +13408 +13409 +13410 +13411 +13412 +13413 +13414 +13415 +13416 +13417 +13418 +13419 +13420 +13421 +13422 +13423 +13424 +13425 +13426 +13427 +13428 +13429 +13430 +13431 +13432 +13433 +13434 +13435 +13436 +13437 +13438 +13439 +13440 +13441 +13442 +13443 +13444 +13445 +13446 +13447 +13448 +13449 +13450 +13451 +13452 +13453 +13454 +13455 +13456 +13457 +13458 +13459 +13460 +13461 +13462 +13463 +13464 +13465 +13466 +13467 +13468 +13469 +13470 +13471 +13472 +13473 +13474 +13475 +13476 +13477 +13478 +13479 +13480 +13481 +13482 +13483 +13484 +13485 +13486 +13487 +13488 +13489 +13490 +13491 +13492 +13493 +13494 +13495 +13496 +13497 +13498 +13499 +13500 +13501 +13502 +13503 +13504 +13505 +13506 +13507 +13508 +13509 +13510 +13511 +13512 +13513 +13514 +13515 +13516 +13517 +13518 +13519 +13520 +13521 +13522 +13523 +13524 +13525 +13526 +13527 +13528 +13529 +13530 +13531 +13532 +13533 +13534 +13535 +13536 +13537 +13538 +13539 +13540 +13541 +13542 +13543 +13544 +13545 +13546 +13547 +13548 +13549 +13550 +13551 +13552 +13553 +13554 +13555 +13556 +13557 +13558 +13559 +13560 +13561 +13562 +13563 +13564 +13565 +13566 +13567 +13568 +13569 +13570 +13571 +13572 +13573 +13574 +13575 +13576 +13577 +13578 +13579 +13580 +13581 +13582 +13583 +13584 +13585 +13586 +13587 +13588 +13589 +13590 +13591 +13592 +13593 +13594 +13595 +13596 +13597 +13598 +13599 +13600 +13601 +13602 +13603 +13604 +13605 +13606 +13607 +13608 +13609 +13610 +13611 +13612 +13613 +13614 +13615 +13616 +13617 +13618 +13619 +13620 +13621 +13622 +13623 +13624 +13625 +13626 +13627 +13628 +13629 +13630 +13631 +13632 +13633 +13634 +13635 +13636 +13637 +13638 +13639 +13640 +13641 +13642 +13643 +13644 +13645 +13646 +13647 +13648 +13649 +13650 +13651 +13652 +13653 +13654 +13655 +13656 +13657 +13658 +13659 +13660 +13661 +13662 +13663 +13664 +13665 +13666 +13667 +13668 +13669 +13670 +13671 +13672 +13673 +13674 +13675 +13676 +13677 +13678 +13679 +13680 +13681 +13682 +13683 +13684 +13685 +13686 +13687 +13688 +13689 +13690 +13691 +13692 +13693 +13694 +13695 +13696 +13697 +13698 +13699 +13700 +13701 +13702 +13703 +13704 +13705 +13706 +13707 +13708 +13709 +13710 +13711 +13712 +13713 +13714 +13715 +13716 +13717 +13718 +13719 +13720 +13721 +13722 +13723 +13724 +13725 +13726 +13727 +13728 +13729 +13730 +13731 +13732 +13733 +13734 +13735 +13736 +13737 +13738 +13739 +13740 +13741 +13742 +13743 +13744 +13745 +13746 +13747 +13748 +13749 +13750 +13751 +13752 +13753 +13754 +13755 +13756 +13757 +13758 +13759 +13760 +13761 +13762 +13763 +13764 +13765 +13766 +13767 +13768 +13769 +13770 +13771 +13772 +13773 +13774 +13775 +13776 +13777 +13778 +13779 +13780 +13781 +13782 +13783 +13784 +13785 +13786 +13787 +13788 +13789 +13790 +13791 +13792 +13793 +13794 +13795 +13796 +13797 +13798 +13799 +13800 +13801 +13802 +13803 +13804 +13805 +13806 +13807 +13808 +13809 +13810 +13811 +13812 +13813 +13814 +13815 +13816 +13817 +13818 +13819 +13820 +13821 +13822 +13823 +13824 +13825 +13826 +13827 +13828 +13829 +13830 +13831 +13832 +13833 +13834 +13835 +13836 +13837 +13838 +13839 +13840 +13841 +13842 +13843 +13844 +13845 +13846 +13847 +13848 +13849 +13850 +13851 +13852 +13853 +13854 +13855 +13856 +13857 +13858 +13859 +13860 +13861 +13862 +13863 +13864 +13865 +13866 +13867 +13868 +13869 +13870 +13871 +13872 +13873 +13874 +13875 +13876 +13877 +13878 +13879 +13880 +13881 +13882 +13883 +13884 +13885 +13886 +13887 +13888 +13889 +13890 +13891 +13892 +13893 +13894 +13895 +13896 +13897 +13898 +13899 +13900 +13901 +13902 +13903 +13904 +13905 +13906 +13907 +13908 +13909 +13910 +13911 +13912 +13913 +13914 +13915 +13916 +13917 +13918 +13919 +13920 +13921 +13922 +13923 +13924 +13925 +13926 +13927 +13928 +13929 +13930 +13931 +13932 +13933 +13934 +13935 +13936 +13937 +13938 +13939 +13940 +13941 +13942 +13943 +13944 +13945 +13946 +13947 +13948 +13949 +13950 +13951 +13952 +13953 +13954 +13955 +13956 +13957 +13958 +13959 +13960 +13961 +13962 +13963 +13964 +13965 +13966 +13967 +13968 +13969 +13970 +13971 +13972 +13973 +13974 +13975 +13976 +13977 +13978 +13979 +13980 +13981 +13982 +13983 +13984 +13985 +13986 +13987 +13988 +13989 +13990 +13991 +13992 +13993 +13994 +13995 +13996 +13997 +13998 +13999 +14000 +14001 +14002 +14003 +14004 +14005 +14006 +14007 +14008 +14009 +14010 +14011 +14012 +14013 +14014 +14015 +14016 +14017 +14018 +14019 +14020 +14021 +14022 +14023 +14024 +14025 +14026 +14027 +14028 +14029 +14030 +14031 +14032 +14033 +14034 +14035 +14036 +14037 +14038 +14039 +14040 +14041 +14042 +14043 +14044 +14045 +14046 +14047 +14048 +14049 +14050 +14051 +14052 +14053 +14054 +14055 +14056 +14057 +14058 +14059 +14060 +14061 +14062 +14063 +14064 +14065 +14066 +14067 +14068 +14069 +14070 +14071 +14072 +14073 +14074 +14075 +14076 +14077 +14078 +14079 +14080 +14081 +14082 +14083 +14084 +14085 +14086 +14087 +14088 +14089 +14090 +14091 +14092 +14093 +14094 +14095 +14096 +14097 +14098 +14099 +14100 +14101 +14102 +14103 +14104 +14105 +14106 +14107 +14108 +14109 +14110 +14111 +14112 +14113 +14114 +14115 +14116 +14117 +14118 +14119 +14120 +14121 +14122 +14123 +14124 +14125 +14126 +14127 +14128 +14129 +14130 +14131 +14132 +14133 +14134 +14135 +14136 +14137 +14138 +14139 +14140 +14141 +14142 +14143 +14144 +14145 +14146 +14147 +14148 +14149 +14150 +14151 +14152 +14153 +14154 +14155 +14156 +14157 +14158 +14159 +14160 +14161 +14162 +14163 +14164 +14165 +14166 +14167 +14168 +14169 +14170 +14171 +14172 +14173 +14174 +14175 +14176 +14177 +14178 +14179 +14180 +14181 +14182 +14183 +14184 +14185 +14186 +14187 +14188 +14189 +14190 +14191 +14192 +14193 +14194 +14195 +14196 +14197 +14198 +14199 +14200 +14201 +14202 +14203 +14204 +14205 +14206 +14207 +14208 +14209 +14210 +14211 +14212 +14213 +14214 +14215 +14216 +14217 +14218 +14219 +14220 +14221 +14222 +14223 +14224 +14225 +14226 +14227 +14228 +14229 +14230 +14231 +14232 +14233 +14234 +14235 +14236 +14237 +14238 +14239 +14240 +14241 +14242 +14243 +14244 +14245 +14246 +14247 +14248 +14249 +14250 +14251 +14252 +14253 +14254 +14255 +14256 +14257 +14258 +14259 +14260 +14261 +14262 +14263 +14264 +14265 +14266 +14267 +14268 +14269 +14270 +14271 +14272 +14273 +14274 +14275 +14276 +14277 +14278 +14279 +14280 +14281 +14282 +14283 +14284 +14285 +14286 +14287 +14288 +14289 +14290 +14291 +14292 +14293 +14294 +14295 +14296 +14297 +14298 +14299 +14300 +14301 +14302 +14303 +14304 +14305 +14306 +14307 +14308 +14309 +14310 +14311 +14312 +14313 +14314 +14315 +14316 +14317 +14318 +14319 +14320 +14321 +14322 +14323 +14324 +14325 +14326 +14327 +14328 +14329 +14330 +14331 +14332 +14333 +14334 +14335 +14336 +14337 +14338 +14339 +14340 +14341 +14342 +14343 +14344 +14345 +14346 +14347 +14348 +14349 +14350 +14351 +14352 +14353 +14354 +14355 +14356 +14357 +14358 +14359 +14360 +14361 +14362 +14363 +14364 +14365 +14366 +14367 +14368 +14369 +14370 +14371 +14372 +14373 +14374 +14375 +14376 +14377 +14378 +14379 +14380 +14381 +14382 +14383 +14384 +14385 +14386 +14387 +14388 +14389 +14390 +14391 +14392 +14393 +14394 +14395 +14396 +14397 +14398 +14399 +14400 +14401 +14402 +14403 +14404 +14405 +14406 +14407 +14408 +14409 +14410 +14411 +14412 +14413 +14414 +14415 +14416 +14417 +14418 +14419 +14420 +14421 +14422 +14423 +14424 +14425 +14426 +14427 +14428 +14429 +14430 +14431 +14432 +14433 +14434 +14435 +14436 +14437 +14438 +14439 +14440 +14441 +14442 +14443 +14444 +14445 +14446 +14447 +14448 +14449 +14450 +14451 +14452 +14453 +14454 +14455 +14456 +14457 +14458 +14459 +14460 +14461 +14462 +14463 +14464 +14465 +14466 +14467 +14468 +14469 +14470 +14471 +14472 +14473 +14474 +14475 +14476 +14477 +14478 +14479 +14480 +14481 +14482 +14483 +14484 +14485 +14486 +14487 +14488 +14489 +14490 +14491 +14492 +14493 +14494 +14495 +14496 +14497 +14498 +14499 +14500 +14501 +14502 +14503 +14504 +14505 +14506 +14507 +14508 +14509 +14510 +14511 +14512 +14513 +14514 +14515 +14516 +14517 +14518 +14519 +14520 +14521 +14522 +14523 +14524 +14525 +14526 +14527 +14528 +14529 +14530 +14531 +14532 +14533 +14534 +14535 +14536 +14537 +14538 +14539 +14540 +14541 +14542 +14543 +14544 +14545 +14546 +14547 +14548 +14549 +14550 +14551 +14552 +14553 +14554 +14555 +14556 +14557 +14558 +14559 +14560 +14561 +14562 +14563 +14564 +14565 +14566 +14567 +14568 +14569 +14570 +14571 +14572 +14573 +14574 +14575 +14576 +14577 +14578 +14579 +14580 +14581 +14582 +14583 +14584 +14585 +14586 +14587 +14588 +14589 +14590 +14591 +14592 +14593 +14594 +14595 +14596 +14597 +14598 +14599 +14600 +14601 +14602 +14603 +14604 +14605 +14606 +14607 +14608 +14609 +14610 +14611 +14612 +14613 +14614 +14615 +14616 +14617 +14618 +14619 +14620 +14621 +14622 +14623 +14624 +14625 +14626 +14627 +14628 +14629 +14630 +14631 +14632 +14633 +14634 +14635 +14636 +14637 +14638 +14639 +14640 +14641 +14642 +14643 +14644 +14645 +14646 +14647 +14648 +14649 +14650 +14651 +14652 +14653 +14654 +14655 +14656 +14657 +14658 +14659 +14660 +14661 +14662 +14663 +14664 +14665 +14666 +14667 +14668 +14669 +14670 +14671 +14672 +14673 +14674 +14675 +14676 +14677 +14678 +14679 +14680 +14681 +14682 +14683 +14684 +14685 +14686 +14687 +14688 +14689 +14690 +14691 +14692 +14693 +14694 +14695 +14696 +14697 +14698 +14699 +14700 +14701 +14702 +14703 +14704 +14705 +14706 +14707 +14708 +14709 +14710 +14711 +14712 +14713 +14714 +14715 +14716 +14717 +14718 +14719 +14720 +14721 +14722 +14723 +14724 +14725 +14726 +14727 +14728 +14729 +14730 +14731 +14732 +14733 +14734 +14735 +14736 +14737 +14738 +14739 +14740 +14741 +14742 +14743 +14744 +14745 +14746 +14747 +14748 +14749 +14750 +14751 +14752 +14753 +14754 +14755 +14756 +14757 +14758 +14759 +14760 +14761 +14762 +14763 +14764 +14765 +14766 +14767 +14768 +14769 +14770 +14771 +14772 +14773 +14774 +14775 +14776 +14777 +14778 +14779 +14780 +14781 +14782 +14783 +14784 +14785 +14786 +14787 +14788 +14789 +14790 +14791 +14792 +14793 +14794 +14795 +14796 +14797 +14798 +14799 +14800 +14801 +14802 +14803 +14804 +14805 +14806 +14807 +14808 +14809 +14810 +14811 +14812 +14813 +14814 +14815 +14816 +14817 +14818 +14819 +14820 +14821 +14822 +14823 +14824 +14825 +14826 +14827 +14828 +14829 +14830 +14831 +14832 +14833 +14834 +14835 +14836 +14837 +14838 +14839 +14840 +14841 +14842 +14843 +14844 +14845 +14846 +14847 +14848 +14849 +14850 +14851 +14852 +14853 +14854 +14855 +14856 +14857 +14858 +14859 +14860 +14861 +14862 +14863 +14864 +14865 +14866 +14867 +14868 +14869 +14870 +14871 +14872 +14873 +14874 +14875 +14876 +14877 +14878 +14879 +14880 +14881 +14882 +14883 +14884 +14885 +14886 +14887 +14888 +14889 +14890 +14891 +14892 +14893 +14894 +14895 +14896 +14897 +14898 +14899 +14900 +14901 +14902 +14903 +14904 +14905 +14906 +14907 +14908 +14909 +14910 +14911 +14912 +14913 +14914 +14915 +14916 +14917 +14918 +14919 +14920 +14921 +14922 +14923 +14924 +14925 +14926 +14927 +14928 +14929 +14930 +14931 +14932 +14933 +14934 +14935 +14936 +14937 +14938 +14939 +14940 +14941 +14942 +14943 +14944 +14945 +14946 +14947 +14948 +14949 +14950 +14951 +14952 +14953 +14954 +14955 +14956 +14957 +14958 +14959 +14960 +14961 +14962 +14963 +14964 +14965 +14966 +14967 +14968 +14969 +14970 +14971 +14972 +14973 +14974 +14975 +14976 +14977 +14978 +14979 +14980 +14981 +14982 +14983 +14984 +14985 +14986 +14987 +14988 +14989 +14990 +14991 +14992 +14993 +14994 +14995 +14996 +14997 +14998 +14999 +15000 +15001 +15002 +15003 +15004 +15005 +15006 +15007 +15008 +15009 +15010 +15011 +15012 +15013 +15014 +15015 +15016 +15017 +15018 +15019 +15020 +15021 +15022 +15023 +15024 +15025 +15026 +15027 +15028 +15029 +15030 +15031 +15032 +15033 +15034 +15035 +15036 +15037 +15038 +15039 +15040 +15041 +15042 +15043 +15044 +15045 +15046 +15047 +15048 +15049 +15050 +15051 +15052 +15053 +15054 +15055 +15056 +15057 +15058 +15059 +15060 +15061 +15062 +15063 +15064 +15065 +15066 +15067 +15068 +15069 +15070 +15071 +15072 +15073 +15074 +15075 +15076 +15077 +15078 +15079 +15080 +15081 +15082 +15083 +15084 +15085 +15086 +15087 +15088 +15089 +15090 +15091 +15092 +15093 +15094 +15095 +15096 +15097 +15098 +15099 +15100 +15101 +15102 +15103 +15104 +15105 +15106 +15107 +15108 +15109 +15110 +15111 +15112 +15113 +15114 +15115 +15116 +15117 +15118 +15119 +15120 +15121 +15122 +15123 +15124 +15125 +15126 +15127 +15128 +15129 +15130 +15131 +15132 +15133 +15134 +15135 +15136 +15137 +15138 +15139 +15140 +15141 +15142 +15143 +15144 +15145 +15146 +15147 +15148 +15149 +15150 +15151 +15152 +15153 +15154 +15155 +15156 +15157 +15158 +15159 +15160 +15161 +15162 +15163 +15164 +15165 +15166 +15167 +15168 +15169 +15170 +15171 +15172 +15173 +15174 +15175 +15176 +15177 +15178 +15179 +15180 +15181 +15182 +15183 +15184 +15185 +15186 +15187 +15188 +15189 +15190 +15191 +15192 +15193 +15194 +15195 +15196 +15197 +15198 +15199 +15200 +15201 +15202 +15203 +15204 +15205 +15206 +15207 +15208 +15209 +15210 +15211 +15212 +15213 +15214 +15215 +15216 +15217 +15218 +15219 +15220 +15221 +15222 +15223 +15224 +15225 +15226 +15227 +15228 +15229 +15230 +15231 +15232 +15233 +15234 +15235 +15236 +15237 +15238 +15239 +15240 +15241 +15242 +15243 +15244 +15245 +15246 +15247 +15248 +15249 +15250 +15251 +15252 +15253 +15254 +15255 +15256 +15257 +15258 +15259 +15260 +15261 +15262 +15263 +15264 +15265 +15266 +15267 +15268 +15269 +15270 +15271 +15272 +15273 +15274 +15275 +15276 +15277 +15278 +15279 +15280 +15281 +15282 +15283 +15284 +15285 +15286 +15287 +15288 +15289 +15290 +15291 +15292 +15293 +15294 +15295 +15296 +15297 +15298 +15299 +15300 +15301 +15302 +15303 +15304 +15305 +15306 +15307 +15308 +15309 +15310 +15311 +15312 +15313 +15314 +15315 +15316 +15317 +15318 +15319 +15320 +15321 +15322 +15323 +15324 +15325 +15326 +15327 +15328 +15329 +15330 +15331 +15332 +15333 +15334 +15335 +15336 +15337 +15338 +15339 +15340 +15341 +15342 +15343 +15344 +15345 +15346 +15347 +15348 +15349 +15350 +15351 +15352 +15353 +15354 +15355 +15356 +15357 +15358 +15359 +15360 +15361 +15362 +15363 +15364 +15365 +15366 +15367 +15368 +15369 +15370 +15371 +15372 +15373 +15374 +15375 +15376 +15377 +15378 +15379 +15380 +15381 +15382 +15383 +15384 +15385 +15386 +15387 +15388 +15389 +15390 +15391 +15392 +15393 +15394 +15395 +15396 +15397 +15398 +15399 +15400 +15401 +15402 +15403 +15404 +15405 +15406 +15407 +15408 +15409 +15410 +15411 +15412 +15413 +15414 +15415 +15416 +15417 +15418 +15419 +15420 +15421 +15422 +15423 +15424 +15425 +15426 +15427 +15428 +15429 +15430 +15431 +15432 +15433 +15434 +15435 +15436 +15437 +15438 +15439 +15440 +15441 +15442 +15443 +15444 +15445 +15446 +15447 +15448 +15449 +15450 +15451 +15452 +15453 +15454 +15455 +15456 +15457 +15458 +15459 +15460 +15461 +15462 +15463 +15464 +15465 +15466 +15467 +15468 +15469 +15470 +15471 +15472 +15473 +15474 +15475 +15476 +15477 +15478 +15479 +15480 +15481 +15482 +15483 +15484 +15485 +15486 +15487 +15488 +15489 +15490 +15491 +15492 +15493 +15494 +15495 +15496 +15497 +15498 +15499 +15500 +15501 +15502 +15503 +15504 +15505 +15506 +15507 +15508 +15509 +15510 +15511 +15512 +15513 +15514 +15515 +15516 +15517 +15518 +15519 +15520 +15521 +15522 +15523 +15524 +15525 +15526 +15527 +15528 +15529 +15530 +15531 +15532 +15533 +15534 +15535 +15536 +15537 +15538 +15539 +15540 +15541 +15542 +15543 +15544 +15545 +15546 +15547 +15548 +15549 +15550 +15551 +15552 +15553 +15554 +15555 +15556 +15557 +15558 +15559 +15560 +15561 +15562 +15563 +15564 +15565 +15566 +15567 +15568 +15569 +15570 +15571 +15572 +15573 +15574 +15575 +15576 +15577 +15578 +15579 +15580 +15581 +15582 +15583 +15584 +15585 +15586 +15587 +15588 +15589 +15590 +15591 +15592 +15593 +15594 +15595 +15596 +15597 +15598 +15599 +15600 +15601 +15602 +15603 +15604 +15605 +15606 +15607 +15608 +15609 +15610 +15611 +15612 +15613 +15614 +15615 +15616 +15617 +15618 +15619 +15620 +15621 +15622 +15623 +15624 +15625 +15626 +15627 +15628 +15629 +15630 +15631 +15632 +15633 +15634 +15635 +15636 +15637 +15638 +15639 +15640 +15641 +15642 +15643 +15644 +15645 +15646 +15647 +15648 +15649 +15650 +15651 +15652 +15653 +15654 +15655 +15656 +15657 +15658 +15659 +15660 +15661 +15662 +15663 +15664 +15665 +15666 +15667 +15668 +15669 +15670 +15671 +15672 +15673 +15674 +15675 +15676 +15677 +15678 +15679 +15680 +15681 +15682 +15683 +15684 +15685 +15686 +15687 +15688 +15689 +15690 +15691 +15692 +15693 +15694 +15695 +15696 +15697 +15698 +15699 +15700 +15701 +15702 +15703 +15704 +15705 +15706 +15707 +15708 +15709 +15710 +15711 +15712 +15713 +15714 +15715 +15716 +15717 +15718 +15719 +15720 +15721 +15722 +15723 +15724 +15725 +15726 +15727 +15728 +15729 +15730 +15731 +15732 +15733 +15734 +15735 +15736 +15737 +15738 +15739 +15740 +15741 +15742 +15743 +15744 +15745 +15746 +15747 +15748 +15749 +15750 +15751 +15752 +15753 +15754 +15755 +15756 +15757 +15758 +15759 +15760 +15761 +15762 +15763 +15764 +15765 +15766 +15767 +15768 +15769 +15770 +15771 +15772 +15773 +15774 +15775 +15776 +15777 +15778 +15779 +15780 +15781 +15782 +15783 +15784 +15785 +15786 +15787 +15788 +15789 +15790 +15791 +15792 +15793 +15794 +15795 +15796 +15797 +15798 +15799 +15800 +15801 +15802 +15803 +15804 +15805 +15806 +15807 +15808 +15809 +15810 +15811 +15812 +15813 +15814 +15815 +15816 +15817 +15818 +15819 +15820 +15821 +15822 +15823 +15824 +15825 +15826 +15827 +15828 +15829 +15830 +15831 +15832 +15833 +15834 +15835 +15836 +15837 +15838 +15839 +15840 +15841 +15842 +15843 +15844 +15845 +15846 +15847 +15848 +15849 +15850 +15851 +15852 +15853 +15854 +15855 +15856 +15857 +15858 +15859 +15860 +15861 +15862 +15863 +15864 +15865 +15866 +15867 +15868 +15869 +15870 +15871 +15872 +15873 +15874 +15875 +15876 +15877 +15878 +15879 +15880 +15881 +15882 +15883 +15884 +15885 +15886 +15887 +15888 +15889 +15890 +15891 +15892 +15893 +15894 +15895 +15896 +15897 +15898 +15899 +15900 +15901 +15902 +15903 +15904 +15905 +15906 +15907 +15908 +15909 +15910 +15911 +15912 +15913 +15914 +15915 +15916 +15917 +15918 +15919 +15920 +15921 +15922 +15923 +15924 +15925 +15926 +15927 +15928 +15929 +15930 +15931 +15932 +15933 +15934 +15935 +15936 +15937 +15938 +15939 +15940 +15941 +15942 +15943 +15944 +15945 +15946 +15947 +15948 +15949 +15950 +15951 +15952 +15953 +15954 +15955 +15956 +15957 +15958 +15959 +15960 +15961 +15962 +15963 +15964 +15965 +15966 +15967 +15968 +15969 +15970 +15971 +15972 +15973 +15974 +15975 +15976 +15977 +15978 +15979 +15980 +15981 +15982 +15983 +15984 +15985 +15986 +15987 +15988 +15989 +15990 +15991 +15992 +15993 +15994 +15995 +15996 +15997 +15998 +15999 +16000 +16001 +16002 +16003 +16004 +16005 +16006 +16007 +16008 +16009 +16010 +16011 +16012 +16013 +16014 +16015 +16016 +16017 +16018 +16019 +16020 +16021 +16022 +16023 +16024 +16025 +16026 +16027 +16028 +16029 +16030 +16031 +16032 +16033 +16034 +16035 +16036 +16037 +16038 +16039 +16040 +16041 +16042 +16043 +16044 +16045 +16046 +16047 +16048 +16049 +16050 +16051 +16052 +16053 +16054 +16055 +16056 +16057 +16058 +16059 +16060 +16061 +16062 +16063 +16064 +16065 +16066 +16067 +16068 +16069 +16070 +16071 +16072 +16073 +16074 +16075 +16076 +16077 +16078 +16079 +16080 +16081 +16082 +16083 +16084 +16085 +16086 +16087 +16088 +16089 +16090 +16091 +16092 +16093 +16094 +16095 +16096 +16097 +16098 +16099 +16100 +16101 +16102 +16103 +16104 +16105 +16106 +16107 +16108 +16109 +16110 +16111 +16112 +16113 +16114 +16115 +16116 +16117 +16118 +16119 +16120 +16121 +16122 +16123 +16124 +16125 +16126 +16127 +16128 +16129 +16130 +16131 +16132 +16133 +16134 +16135 +16136 +16137 +16138 +16139 +16140 +16141 +16142 +16143 +16144 +16145 +16146 +16147 +16148 +16149 +16150 +16151 +16152 +16153 +16154 +16155 +16156 +16157 +16158 +16159 +16160 +16161 +16162 +16163 +16164 +16165 +16166 +16167 +16168 +16169 +16170 +16171 +16172 +16173 +16174 +16175 +16176 +16177 +16178 +16179 +16180 +16181 +16182 +16183 +16184 +16185 +16186 +16187 +16188 +16189 +16190 +16191 +16192 +16193 +16194 +16195 +16196 +16197 +16198 +16199 +16200 +16201 +16202 +16203 +16204 +16205 +16206 +16207 +16208 +16209 +16210 +16211 +16212 +16213 +16214 +16215 +16216 +16217 +16218 +16219 +16220 +16221 +16222 +16223 +16224 +16225 +16226 +16227 +16228 +16229 +16230 +16231 +16232 +16233 +16234 +16235 +16236 +16237 +16238 +16239 +16240 +16241 +16242 +16243 +16244 +16245 +16246 +16247 +16248 +16249 +16250 +16251 +16252 +16253 +16254 +16255 +16256 +16257 +16258 +16259 +16260 +16261 +16262 +16263 +16264 +16265 +16266 +16267 +16268 +16269 +16270 +16271 +16272 +16273 +16274 +16275 +16276 +16277 +16278 +16279 +16280 +16281 +16282 +16283 +16284 +16285 +16286 +16287 +16288 +16289 +16290 +16291 +16292 +16293 +16294 +16295 +16296 +16297 +16298 +16299 +16300 +16301 +16302 +16303 +16304 +16305 +16306 +16307 +16308 +16309 +16310 +16311 +16312 +16313 +16314 +16315 +16316 +16317 +16318 +16319 +16320 +16321 +16322 +16323 +16324 +16325 +16326 +16327 +16328 +16329 +16330 +16331 +16332 +16333 +16334 +16335 +16336 +16337 +16338 +16339 +16340 +16341 +16342 +16343 +16344 +16345 +16346 +16347 +16348 +16349 +16350 +16351 +16352 +16353 +16354 +16355 +16356 +16357 +16358 +16359 +16360 +16361 +16362 +16363 +16364 +16365 +16366 +16367 +16368 +16369 +16370 +16371 +16372 +16373 +16374 +16375 +16376 +16377 +16378 +16379 +16380 +16381 +16382 +16383 +16384 +16385 +16386 +16387 +16388 +16389 +16390 +16391 +16392 +16393 +16394 +16395 +16396 +16397 +16398 +16399 +16400 +16401 +16402 +16403 +16404 +16405 +16406 +16407 +16408 +16409 +16410 +16411 +16412 +16413 +16414 +16415 +16416 +16417 +16418 +16419 +16420 +16421 +16422 +16423 +16424 +16425 +16426 +16427 +16428 +16429 +16430 +16431 +16432 +16433 +16434 +16435 +16436 +16437 +16438 +16439 +16440 +16441 +16442 +16443 +16444 +16445 +16446 +16447 +16448 +16449 +16450 +16451 +16452 +16453 +16454 +16455 +16456 +16457 +16458 +16459 +16460 +16461 +16462 +16463 +16464 +16465 +16466 +16467 +16468 +16469 +16470 +16471 +16472 +16473 +16474 +16475 +16476 +16477 +16478 +16479 +16480 +16481 +16482 +16483 +16484 +16485 +16486 +16487 +16488 +16489 +16490 +16491 +16492 +16493 +16494 +16495 +16496 +16497 +16498 +16499 +16500 +16501 +16502 +16503 +16504 +16505 +16506 +16507 +16508 +16509 +16510 +16511 +16512 +16513 +16514 +16515 +16516 +16517 +16518 +16519 +16520 +16521 +16522 +16523 +16524 +16525 +16526 +16527 +16528 +16529 +16530 +16531 +16532 +16533 +16534 +16535 +16536 +16537 +16538 +16539 +16540 +16541 +16542 +16543 +16544 +16545 +16546 +16547 +16548 +16549 +16550 +16551 +16552 +16553 +16554 +16555 +16556 +16557 +16558 +16559 +16560 +16561 +16562 +16563 +16564 +16565 +16566 +16567 +16568 +16569 +16570 +16571 +16572 +16573 +16574 +16575 +16576 +16577 +16578 +16579 +16580 +16581 +16582 +16583 +16584 +16585 +16586 +16587 +16588 +16589 +16590 +16591 +16592 +16593 +16594 +16595 +16596 +16597 +16598 +16599 +16600 +16601 +16602 +16603 +16604 +16605 +16606 +16607 +16608 +16609 +16610 +16611 +16612 +16613 +16614 +16615 +16616 +16617 +16618 +16619 +16620 +16621 +16622 +16623 +16624 +16625 +16626 +16627 +16628 +16629 +16630 +16631 +16632 +16633 +16634 +16635 +16636 +16637 +16638 +16639 +16640 +16641 +16642 +16643 +16644 +16645 +16646 +16647 +16648 +16649 +16650 +16651 +16652 +16653 +16654 +16655 +16656 +16657 +16658 +16659 +16660 +16661 +16662 +16663 +16664 +16665 +16666 +16667 +16668 +16669 +16670 +16671 +16672 +16673 +16674 +16675 +16676 +16677 +16678 +16679 +16680 +16681 +16682 +16683 +16684 +16685 +16686 +16687 +16688 +16689 +16690 +16691 +16692 +16693 +16694 +16695 +16696 +16697 +16698 +16699 +16700 +16701 +16702 +16703 +16704 +16705 +16706 +16707 +16708 +16709 +16710 +16711 +16712 +16713 +16714 +16715 +16716 +16717 +16718 +16719 +16720 +16721 +16722 +16723 +16724 +16725 +16726 +16727 +16728 +16729 +16730 +16731 +16732 +16733 +16734 +16735 +16736 +16737 +16738 +16739 +16740 +16741 +16742 +16743 +16744 +16745 +16746 +16747 +16748 +16749 +16750 +16751 +16752 +16753 +16754 +16755 +16756 +16757 +16758 +16759 +16760 +16761 +16762 +16763 +16764 +16765 +16766 +16767 +16768 +16769 +16770 +16771 +16772 +16773 +16774 +16775 +16776 +16777 +16778 +16779 +16780 +16781 +16782 +16783 +16784 +16785 +16786 +16787 +16788 +16789 +16790 +16791 +16792 +16793 +16794 +16795 +16796 +16797 +16798 +16799 +16800 +16801 +16802 +16803 +16804 +16805 +16806 +16807 +16808 +16809 +16810 +16811 +16812 +16813 +16814 +16815 +16816 +16817 +16818 +16819 +16820 +16821 +16822 +16823 +16824 +16825 +16826 +16827 +16828 +16829 +16830 +16831 +16832 +16833 +16834 +16835 +16836 +16837 +16838 +16839 +16840 +16841 +16842 +16843 +16844 +16845 +16846 +16847 +16848 +16849 +16850 +16851 +16852 +16853 +16854 +16855 +16856 +16857 +16858 +16859 +16860 +16861 +16862 +16863 +16864 +16865 +16866 +16867 +16868 +16869 +16870 +16871 +16872 +16873 +16874 +16875 +16876 +16877 +16878 +16879 +16880 +16881 +16882 +16883 +16884 +16885 +16886 +16887 +16888 +16889 +16890 +16891 +16892 +16893 +16894 +16895 +16896 +16897 +16898 +16899 +16900 +16901 +16902 +16903 +16904 +16905 +16906 +16907 +16908 +16909 +16910 +16911 +16912 +16913 +16914 +16915 +16916 +16917 +16918 +16919 +16920 +16921 +16922 +16923 +16924 +16925 +16926 +16927 +16928 +16929 +16930 +16931 +16932 +16933 +16934 +16935 +16936 +16937 +16938 +16939 +16940 +16941 +16942 +16943 +16944 +16945 +16946 +16947 +16948 +16949 +16950 +16951 +16952 +16953 +16954 +16955 +16956 +16957 +16958 +16959 +16960 +16961 +16962 +16963 +16964 +16965 +16966 +16967 +16968 +16969 +16970 +16971 +16972 +16973 +16974 +16975 +16976 +16977 +16978 +16979 +16980 +16981 +16982 +16983 +16984 +16985 +16986 +16987 +16988 +16989 +16990 +16991 +16992 +16993 +16994 +16995 +16996 +16997 +16998 +16999 +17000 +17001 +17002 +17003 +17004 +17005 +17006 +17007 +17008 +17009 +17010 +17011 +17012 +17013 +17014 +17015 +17016 +17017 +17018 +17019 +17020 +17021 +17022 +17023 +17024 +17025 +17026 +17027 +17028 +17029 +17030 +17031 +17032 +17033 +17034 +17035 +17036 +17037 +17038 +17039 +17040 +17041 +17042 +17043 +17044 +17045 +17046 +17047 +17048 +17049 +17050 +17051 +17052 +17053 +17054 +17055 +17056 +17057 +17058 +17059 +17060 +17061 +17062 +17063 +17064 +17065 +17066 +17067 +17068 +17069 +17070 +17071 +17072 +17073 +17074 +17075 +17076 +17077 +17078 +17079 +17080 +17081 +17082 +17083 +17084 +17085 +17086 +17087 +17088 +17089 +17090 +17091 +17092 +17093 +17094 +17095 +17096 +17097 +17098 +17099 +17100 +17101 +17102 +17103 +17104 +17105 +17106 +17107 +17108 +17109 +17110 +17111 +17112 +17113 +17114 +17115 +17116 +17117 +17118 +17119 +17120 +17121 +17122 +17123 +17124 +17125 +17126 +17127 +17128 +17129 +17130 +17131 +17132 +17133 +17134 +17135 +17136 +17137 +17138 +17139 +17140 +17141 +17142 +17143 +17144 +17145 +17146 +17147 +17148 +17149 +17150 +17151 +17152 +17153 +17154 +17155 +17156 +17157 +17158 +17159 +17160 +17161 +17162 +17163 +17164 +17165 +17166 +17167 +17168 +17169 +17170 +17171 +17172 +17173 +17174 +17175 +17176 +17177 +17178 +17179 +17180 +17181 +17182 +17183 +17184 +17185 +17186 +17187 +17188 +17189 +17190 +17191 +17192 +17193 +17194 +17195 +17196 +17197 +17198 +17199 +17200 +17201 +17202 +17203 +17204 +17205 +17206 +17207 +17208 +17209 +17210 +17211 +17212 +17213 +17214 +17215 +17216 +17217 +17218 +17219 +17220 +17221 +17222 +17223 +17224 +17225 +17226 +17227 +17228 +17229 +17230 +17231 +17232 +17233 +17234 +17235 +17236 +17237 +17238 +17239 +17240 +17241 +17242 +17243 +17244 +17245 +17246 +17247 +17248 +17249 +17250 +17251 +17252 +17253 +17254 +17255 +17256 +17257 +17258 +17259 +17260 +17261 +17262 +17263 +17264 +17265 +17266 +17267 +17268 +17269 +17270 +17271 +17272 +17273 +17274 +17275 +17276 +17277 +17278 +17279 +17280 +17281 +17282 +17283 +17284 +17285 +17286 +17287 +17288 +17289 +17290 +17291 +17292 +17293 +17294 +17295 +17296 +17297 +17298 +17299 +17300 +17301 +17302 +17303 +17304 +17305 +17306 +17307 +17308 +17309 +17310 +17311 +17312 +17313 +17314 +17315 +17316 +17317 +17318 +17319 +17320 +17321 +17322 +17323 +17324 +17325 +17326 +17327 +17328 +17329 +17330 +17331 +17332 +17333 +17334 +17335 +17336 +17337 +17338 +17339 +17340 +17341 +17342 +17343 +17344 +17345 +17346 +17347 +17348 +17349 +17350 +17351 +17352 +17353 +17354 +17355 +17356 +17357 +17358 +17359 +17360 +17361 +17362 +17363 +17364 +17365 +17366 +17367 +17368 +17369 +17370 +17371 +17372 +17373 +17374 +17375 +17376 +17377 +17378 +17379 +17380 +17381 +17382 +17383 +17384 +17385 +17386 +17387 +17388 +17389 +17390 +17391 +17392 +17393 +17394 +17395 +17396 +17397 +17398 +17399 +17400 +17401 +17402 +17403 +17404 +17405 +17406 +17407 +17408 +17409 +17410 +17411 +17412 +17413 +17414 +17415 +17416 +17417 +17418 +17419 +17420 +17421 +17422 +17423 +17424 +17425 +17426 +17427 +17428 +17429 +17430 +17431 +17432 +17433 +17434 +17435 +17436 +17437 +17438 +17439 +17440 +17441 +17442 +17443 +17444 +17445 +17446 +17447 +17448 +17449 +17450 +17451 +17452 +17453 +17454 +17455 +17456 +17457 +17458 +17459 +17460 +17461 +17462 +17463 +17464 +17465 +17466 +17467 +17468 +17469 +17470 +17471 +17472 +17473 +17474 +17475 +17476 +17477 +17478 +17479 +17480 +17481 +17482 +17483 +17484 +17485 +17486 +17487 +17488 +17489 +17490 +17491 +17492 +17493 +17494 +17495 +17496 +17497 +17498 +17499 +17500 +17501 +17502 +17503 +17504 +17505 +17506 +17507 +17508 +17509 +17510 +17511 +17512 +17513 +17514 +17515 +17516 +17517 +17518 +17519 +17520 +17521 +17522 +17523 +17524 +17525 +17526 +17527 +17528 +17529 +17530 +17531 +17532 +17533 +17534 +17535 +17536 +17537 +17538 +17539 +17540 +17541 +17542 +17543 +17544 +17545 +17546 +17547 +17548 +17549 +17550 +17551 +17552 +17553 +17554 +17555 +17556 +17557 +17558 +17559 +17560 +17561 +17562 +17563 +17564 +17565 +17566 +17567 +17568 +17569 +17570 +17571 +17572 +17573 +17574 +17575 +17576 +17577 +17578 +17579 +17580 +17581 +17582 +17583 +17584 +17585 +17586 +17587 +17588 +17589 +17590 +17591 +17592 +17593 +17594 +17595 +17596 +17597 +17598 +17599 +17600 +17601 +17602 +17603 +17604 +17605 +17606 +17607 +17608 +17609 +17610 +17611 +17612 +17613 +17614 +17615 +17616 +17617 +17618 +17619 +17620 +17621 +17622 +17623 +17624 +17625 +17626 +17627 +17628 +17629 +17630 +17631 +17632 +17633 +17634 +17635 +17636 +17637 +17638 +17639 +17640 +17641 +17642 +17643 +17644 +17645 +17646 +17647 +17648 +17649 +17650 +17651 +17652 +17653 +17654 +17655 +17656 +17657 +17658 +17659 +17660 +17661 +17662 +17663 +17664 +17665 +17666 +17667 +17668 +17669 +17670 +17671 +17672 +17673 +17674 +17675 +17676 +17677 +17678 +17679 +17680 +17681 +17682 +17683 +17684 +17685 +17686 +17687 +17688 +17689 +17690 +17691 +17692 +17693 +17694 +17695 +17696 +17697 +17698 +17699 +17700 +17701 +17702 +17703 +17704 +17705 +17706 +17707 +17708 +17709 +17710 +17711 +17712 +17713 +17714 +17715 +17716 +17717 +17718 +17719 +17720 +17721 +17722 +17723 +17724 +17725 +17726 +17727 +17728 +17729 +17730 +17731 +17732 +17733 +17734 +17735 +17736 +17737 +17738 +17739 +17740 +17741 +17742 +17743 +17744 +17745 +17746 +17747 +17748 +17749 +17750 +17751 +17752 +17753 +17754 +17755 +17756 +17757 +17758 +17759 +17760 +17761 +17762 +17763 +17764 +17765 +17766 +17767 +17768 +17769 +17770 +17771 +17772 +17773 +17774 +17775 +17776 +17777 +17778 +17779 +17780 +17781 +17782 +17783 +17784 +17785 +17786 +17787 +17788 +17789 +17790 +17791 +17792 +17793 +17794 +17795 +17796 +17797 +17798 +17799 +17800 +17801 +17802 +17803 +17804 +17805 +17806 +17807 +17808 +17809 +17810 +17811 +17812 +17813 +17814 +17815 +17816 +17817 +17818 +17819 +17820 +17821 +17822 +17823 +17824 +17825 +17826 +17827 +17828 +17829 +17830 +17831 +17832 +17833 +17834 +17835 +17836 +17837 +17838 +17839 +17840 +17841 +17842 +17843 +17844 +17845 +17846 +17847 +17848 +17849 +17850 +17851 +17852 +17853 +17854 +17855 +17856 +17857 +17858 +17859 +17860 +17861 +17862 +17863 +17864 +17865 +17866 +17867 +17868 +17869 +17870 +17871 +17872 +17873 +17874 +17875 +17876 +17877 +17878 +17879 +17880 +17881 +17882 +17883 +17884 +17885 +17886 +17887 +17888 +17889 +17890 +17891 +17892 +17893 +17894 +17895 +17896 +17897 +17898 +17899 +17900 +17901 +17902 +17903 +17904 +17905 +17906 +17907 +17908 +17909 +17910 +17911 +17912 +17913 +17914 +17915 +17916 +17917 +17918 +17919 +17920 +17921 +17922 +17923 +17924 +17925 +17926 +17927 +17928 +17929 +17930 +17931 +17932 +17933 +17934 +17935 +17936 +17937 +17938 +17939 +17940 +17941 +17942 +17943 +17944 +17945 +17946 +17947 +17948 +17949 +17950 +17951 +17952 +17953 +17954 +17955 +17956 +17957 +17958 +17959 +17960 +17961 +17962 +17963 +17964 +17965 +17966 +17967 +17968 +17969 +17970 +17971 +17972 +17973 +17974 +17975 +17976 +17977 +17978 +17979 +17980 +17981 +17982 +17983 +17984 +17985 +17986 +17987 +17988 +17989 +17990 +17991 +17992 +17993 +17994 +17995 +17996 +17997 +17998 +17999 +18000 +18001 +18002 +18003 +18004 +18005 +18006 +18007 +18008 +18009 +18010 +18011 +18012 +18013 +18014 +18015 +18016 +18017 +18018 +18019 +18020 +18021 +18022 +18023 +18024 +18025 +18026 +18027 +18028 +18029 +18030 +18031 +18032 +18033 +18034 +18035 +18036 +18037 +18038 +18039 +18040 +18041 +18042 +18043 +18044 +18045 +18046 +18047 +18048 +18049 +18050 +18051 +18052 +18053 +18054 +18055 +18056 +18057 +18058 +18059 +18060 +18061 +18062 +18063 +18064 +18065 +18066 +18067 +18068 +18069 +18070 +18071 +18072 +18073 +18074 +18075 +18076 +18077 +18078 +18079 +18080 +18081 +18082 +18083 +18084 +18085 +18086 +18087 +18088 +18089 +18090 +18091 +18092 +18093 +18094 +18095 +18096 +18097 +18098 +18099 +18100 +18101 +18102 +18103 +18104 +18105 +18106 +18107 +18108 +18109 +18110 +18111 +18112 +18113 +18114 +18115 +18116 +18117 +18118 +18119 +18120 +18121 +18122 +18123 +18124 +18125 +18126 +18127 +18128 +18129 +18130 +18131 +18132 +18133 +18134 +18135 +18136 +18137 +18138 +18139 +18140 +18141 +18142 +18143 +18144 +18145 +18146 +18147 +18148 +18149 +18150 +18151 +18152 +18153 +18154 +18155 +18156 +18157 +18158 +18159 +18160 +18161 +18162 +18163 +18164 +18165 +18166 +18167 +18168 +18169 +18170 +18171 +18172 +18173 +18174 +18175 +18176 +18177 +18178 +18179 +18180 +18181 +18182 +18183 +18184 +18185 +18186 +18187 +18188 +18189 +18190 +18191 +18192 +18193 +18194 +18195 +18196 +18197 +18198 +18199 +18200 +18201 +18202 +18203 +18204 +18205 +18206 +18207 +18208 +18209 +18210 +18211 +18212 +18213 +18214 +18215 +18216 +18217 +18218 +18219 +18220 +18221 +18222 +18223 +18224 +18225 +18226 +18227 +18228 +18229 +18230 +18231 +18232 +18233 +18234 +18235 +18236 +18237 +18238 +18239 +18240 +18241 +18242 +18243 +18244 +18245 +18246 +18247 +18248 +18249 +18250 +18251 +18252 +18253 +18254 +18255 +18256 +18257 +18258 +18259 +18260 +18261 +18262 +18263 +18264 +18265 +18266 +18267 +18268 +18269 +18270 +18271 +18272 +18273 +18274 +18275 +18276 +18277 +18278 +18279 +18280 +18281 +18282 +18283 +18284 +18285 +18286 +18287 +18288 +18289 +18290 +18291 +18292 +18293 +18294 +18295 +18296 +18297 +18298 +18299 +18300 +18301 +18302 +18303 +18304 +18305 +18306 +18307 +18308 +18309 +18310 +18311 +18312 +18313 +18314 +18315 +18316 +18317 +18318 +18319 +18320 +18321 +18322 +18323 +18324 +18325 +18326 +18327 +18328 +18329 +18330 +18331 +18332 +18333 +18334 +18335 +18336 +18337 +18338 +18339 +18340 +18341 +18342 +18343 +18344 +18345 +18346 +18347 +18348 +18349 +18350 +18351 +18352 +18353 +18354 +18355 +18356 +18357 +18358 +18359 +18360 +18361 +18362 +18363 +18364 +18365 +18366 +18367 +18368 +18369 +18370 +18371 +18372 +18373 +18374 +18375 +18376 +18377 +18378 +18379 +18380 +18381 +18382 +18383 +18384 +18385 +18386 +18387 +18388 +18389 +18390 +18391 +18392 +18393 +18394 +18395 +18396 +18397 +18398 +18399 +18400 +18401 +18402 +18403 +18404 +18405 +18406 +18407 +18408 +18409 +18410 +18411 +18412 +18413 +18414 +18415 +18416 +18417 +18418 +18419 +18420 +18421 +18422 +18423 +18424 +18425 +18426 +18427 +18428 +18429 +18430 +18431 +18432 +18433 +18434 +18435 +18436 +18437 +18438 +18439 +18440 +18441 +18442 +18443 +18444 +18445 +18446 +18447 +18448 +18449 +18450 +18451 +18452 +18453 +18454 +18455 +18456 +18457 +18458 +18459 +18460 +18461 +18462 +18463 +18464 +18465 +18466 +18467 +18468 +18469 +18470 +18471 +18472 +18473 +18474 +18475 +18476 +18477 +18478 +18479 +18480 +18481 +18482 +18483 +18484 +18485 +18486 +18487 +18488 +18489 +18490 +18491 +18492 +18493 +18494 +18495 +18496 +18497 +18498 +18499 +18500 +18501 +18502 +18503 +18504 +18505 +18506 +18507 +18508 +18509 +18510 +18511 +18512 +18513 +18514 +18515 +18516 +18517 +18518 +18519 +18520 +18521 +18522 +18523 +18524 +18525 +18526 +18527 +18528 +18529 +18530 +18531 +18532 +18533 +18534 +18535 +18536 +18537 +18538 +18539 +18540 +18541 +18542 +18543 +18544 +18545 +18546 +18547 +18548 +18549 +18550 +18551 +18552 +18553 +18554 +18555 +18556 +18557 +18558 +18559 +18560 +18561 +18562 +18563 +18564 +18565 +18566 +18567 +18568 +18569 +18570 +18571 +18572 +18573 +18574 +18575 +18576 +18577 +18578 +18579 +18580 +18581 +18582 +18583 +18584 +18585 +18586 +18587 +18588 +18589 +18590 +18591 +18592 +18593 +18594 +18595 +18596 +18597 +18598 +18599 +18600 +18601 +18602 +18603 +18604 +18605 +18606 +18607 +18608 +18609 +18610 +18611 +18612 +18613 +18614 +18615 +18616 +18617 +18618 +18619 +18620 +18621 +18622 +18623 +18624 +18625 +18626 +18627 +18628 +18629 +18630 +18631 +18632 +18633 +18634 +18635 +18636 +18637 +18638 +18639 +18640 +18641 +18642 +18643 +18644 +18645 +18646 +18647 +18648 +18649 +18650 +18651 +18652 +18653 +18654 +18655 +18656 +18657 +18658 +18659 +18660 +18661 +18662 +18663 +18664 +18665 +18666 +18667 +18668 +18669 +18670 +18671 +18672 +18673 +18674 +18675 +18676 +18677 +18678 +18679 +18680 +18681 +18682 +18683 +18684 +18685 +18686 +18687 +18688 +18689 +18690 +18691 +18692 +18693 +18694 +18695 +18696 +18697 +18698 +18699 +18700 +18701 +18702 +18703 +18704 +18705 +18706 +18707 +18708 +18709 +18710 +18711 +18712 +18713 +18714 +18715 +18716 +18717 +18718 +18719 +18720 +18721 +18722 +18723 +18724 +18725 +18726 +18727 +18728 +18729 +18730 +18731 +18732 +18733 +18734 +18735 +18736 +18737 +18738 +18739 +18740 +18741 +18742 +18743 +18744 +18745 +18746 +18747 +18748 +18749 +18750 +18751 +18752 +18753 +18754 +18755 +18756 +18757 +18758 +18759 +18760 +18761 +18762 +18763 +18764 +18765 +18766 +18767 +18768 +18769 +18770 +18771 +18772 +18773 +18774 +18775 +18776 +18777 +18778 +18779 +18780 +18781 +18782 +18783 +18784 +18785 +18786 +18787 +18788 +18789 +18790 +18791 +18792 +18793 +18794 +18795 +18796 +18797 +18798 +18799 +18800 +18801 +18802 +18803 +18804 +18805 +18806 +18807 +18808 +18809 +18810 +18811 +18812 +18813 +18814 +18815 +18816 +18817 +18818 +18819 +18820 +18821 +18822 +18823 +18824 +18825 +18826 +18827 +18828 +18829 +18830 +18831 +18832 +18833 +18834 +18835 +18836 +18837 +18838 +18839 +18840 +18841 +18842 +18843 +18844 +18845 +18846 +18847 +18848 +18849 +18850 +18851 +18852 +18853 +18854 +18855 +18856 +18857 +18858 +18859 +18860 +18861 +18862 +18863 +18864 +18865 +18866 +18867 +18868 +18869 +18870 +18871 +18872 +18873 +18874 +18875 +18876 +18877 +18878 +18879 +18880 +18881 +18882 +18883 +18884 +18885 +18886 +18887 +18888 +18889 +18890 +18891 +18892 +18893 +18894 +18895 +18896 +18897 +18898 +18899 +18900 +18901 +18902 +18903 +18904 +18905 +18906 +18907 +18908 +18909 +18910 +18911 +18912 +18913 +18914 +18915 +18916 +18917 +18918 +18919 +18920 +18921 +18922 +18923 +18924 +18925 +18926 +18927 +18928 +18929 +18930 +18931 +18932 +18933 +18934 +18935 +18936 +18937 +18938 +18939 +18940 +18941 +18942 +18943 +18944 +18945 +18946 +18947 +18948 +18949 +18950 +18951 +18952 +18953 +18954 +18955 +18956 +18957 +18958 +18959 +18960 +18961 +18962 +18963 +18964 +18965 +18966 +18967 +18968 +18969 +18970 +18971 +18972 +18973 +18974 +18975 +18976 +18977 +18978 +18979 +18980 +18981 +18982 +18983 +18984 +18985 +18986 +18987 +18988 +18989 +18990 +18991 +18992 +18993 +18994 +18995 +18996 +18997 +18998 +18999 +19000 +19001 +19002 +19003 +19004 +19005 +19006 +19007 +19008 +19009 +19010 +19011 +19012 +19013 +19014 +19015 +19016 +19017 +19018 +19019 +19020 +19021 +19022 +19023 +19024 +19025 +19026 +19027 +19028 +19029 +19030 +19031 +19032 +19033 +19034 +19035 +19036 +19037 +19038 +19039 +19040 +19041 +19042 +19043 +19044 +19045 +19046 +19047 +19048 +19049 +19050 +19051 +19052 +19053 +19054 +19055 +19056 +19057 +19058 +19059 +19060 +19061 +19062 +19063 +19064 +19065 +19066 +19067 +19068 +19069 +19070 +19071 +19072 +19073 +19074 +19075 +19076 +19077 +19078 +19079 +19080 +19081 +19082 +19083 +19084 +19085 +19086 +19087 +19088 +19089 +19090 +19091 +19092 +19093 +19094 +19095 +19096 +19097 +19098 +19099 +19100 +19101 +19102 +19103 +19104 +19105 +19106 +19107 +19108 +19109 +19110 +19111 +19112 +19113 +19114 +19115 +19116 +19117 +19118 +19119 +19120 +19121 +19122 +19123 +19124 +19125 +19126 +19127 +19128 +19129 +19130 +19131 +19132 +19133 +19134 +19135 +19136 +19137 +19138 +19139 +19140 +19141 +19142 +19143 +19144 +19145 +19146 +19147 +19148 +19149 +19150 +19151 +19152 +19153 +19154 +19155 +19156 +19157 +19158 +19159 +19160 +19161 +19162 +19163 +19164 +19165 +19166 +19167 +19168 +19169 +19170 +19171 +19172 +19173 +19174 +19175 +19176 +19177 +19178 +19179 +19180 +19181 +19182 +19183 +19184 +19185 +19186 +19187 +19188 +19189 +19190 +19191 +19192 +19193 +19194 +19195 +19196 +19197 +19198 +19199 +19200 +19201 +19202 +19203 +19204 +19205 +19206 +19207 +19208 +19209 +19210 +19211 +19212 +19213 +19214 +19215 +19216 +19217 +19218 +19219 +19220 +19221 +19222 +19223 +19224 +19225 +19226 +19227 +19228 +19229 +19230 +19231 +19232 +19233 +19234 +19235 +19236 +19237 +19238 +19239 +19240 +19241 +19242 +19243 +19244 +19245 +19246 +19247 +19248 +19249 +19250 +19251 +19252 +19253 +19254 +19255 +19256 +19257 +19258 +19259 +19260 +19261 +19262 +19263 +19264 +19265 +19266 +19267 +19268 +19269 +19270 +19271 +19272 +19273 +19274 +19275 +19276 +19277 +19278 +19279 +19280 +19281 +19282 +19283 +19284 +19285 +19286 +19287 +19288 +19289 +19290 +19291 +19292 +19293 +19294 +19295 +19296 +19297 +19298 +19299 +19300 +19301 +19302 +19303 +19304 +19305 +19306 +19307 +19308 +19309 +19310 +19311 +19312 +19313 +19314 +19315 +19316 +19317 +19318 +19319 +19320 +19321 +19322 +19323 +19324 +19325 +19326 +19327 +19328 +19329 +19330 +19331 +19332 +19333 +19334 +19335 +19336 +19337 +19338 +19339 +19340 +19341 +19342 +19343 +19344 +19345 +19346 +19347 +19348 +19349 +19350 +19351 +19352 +19353 +19354 +19355 +19356 +19357 +19358 +19359 +19360 +19361 +19362 +19363 +19364 +19365 +19366 +19367 +19368 +19369 +19370 +19371 +19372 +19373 +19374 +19375 +19376 +19377 +19378 +19379 +19380 +19381 +19382 +19383 +19384 +19385 +19386 +19387 +19388 +19389 +19390 +19391 +19392 +19393 +19394 +19395 +19396 +19397 +19398 +19399 +19400 +19401 +19402 +19403 +19404 +19405 +19406 +19407 +19408 +19409 +19410 +19411 +19412 +19413 +19414 +19415 +19416 +19417 +19418 +19419 +19420 +19421 +19422 +19423 +19424 +19425 +19426 +19427 +19428 +19429 +19430 +19431 +19432 +19433 +19434 +19435 +19436 +19437 +19438 +19439 +19440 +19441 +19442 +19443 +19444 +19445 +19446 +19447 +19448 +19449 +19450 +19451 +19452 +19453 +19454 +19455 +19456 +19457 +19458 +19459 +19460 +19461 +19462 +19463 +19464 +19465 +19466 +19467 +19468 +19469 +19470 +19471 +19472 +19473 +19474 +19475 +19476 +19477 +19478 +19479 +19480 +19481 +19482 +19483 +19484 +19485 +19486 +19487 +19488 +19489 +19490 +19491 +19492 +19493 +19494 +19495 +19496 +19497 +19498 +19499 +19500 +19501 +19502 +19503 +19504 +19505 +19506 +19507 +19508 +19509 +19510 +19511 +19512 +19513 +19514 +19515 +19516 +19517 +19518 +19519 +19520 +19521 +19522 +19523 +19524 +19525 +19526 +19527 +19528 +19529 +19530 +19531 +19532 +19533 +19534 +19535 +19536 +19537 +19538 +19539 +19540 +19541 +19542 +19543 +19544 +19545 +19546 +19547 +19548 +19549 +19550 +19551 +19552 +19553 +19554 +19555 +19556 +19557 +19558 +19559 +19560 +19561 +19562 +19563 +19564 +19565 +19566 +19567 +19568 +19569 +19570 +19571 +19572 +19573 +19574 +19575 +19576 +19577 +19578 +19579 +19580 +19581 +19582 +19583 +19584 +19585 +19586 +19587 +19588 +19589 +19590 +19591 +19592 +19593 +19594 +19595 +19596 +19597 +19598 +19599 +19600 +19601 +19602 +19603 +19604 +19605 +19606 +19607 +19608 +19609 +19610 +19611 +19612 +19613 +19614 +19615 +19616 +19617 +19618 +19619 +19620 +19621 +19622 +19623 +19624 +19625 +19626 +19627 +19628 +19629 +19630 +19631 +19632 +19633 +19634 +19635 +19636 +19637 +19638 +19639 +19640 +19641 +19642 +19643 +19644 +19645 +19646 +19647 +19648 +19649 +19650 +19651 +19652 +19653 +19654 +19655 +19656 +19657 +19658 +19659 +19660 +19661 +19662 +19663 +19664 +19665 +19666 +19667 +19668 +19669 +19670 +19671 +19672 +19673 +19674 +19675 +19676 +19677 +19678 +19679 +19680 +19681 +19682 +19683 +19684 +19685 +19686 +19687 +19688 +19689 +19690 +19691 +19692 +19693 +19694 +19695 +19696 +19697 +19698 +19699 +19700 +19701 +19702 +19703 +19704 +19705 +19706 +19707 +19708 +19709 +19710 +19711 +19712 +19713 +19714 +19715 +19716 +19717 +19718 +19719 +19720 +19721 +19722 +19723 +19724 +19725 +19726 +19727 +19728 +19729 +19730 +19731 +19732 +19733 +19734 +19735 +19736 +19737 +19738 +19739 +19740 +19741 +19742 +19743 +19744 +19745 +19746 +19747 +19748 +19749 +19750 +19751 +19752 +19753 +19754 +19755 +19756 +19757 +19758 +19759 +19760 +19761 +19762 +19763 +19764 +19765 +19766 +19767 +19768 +19769 +19770 +19771 +19772 +19773 +19774 +19775 +19776 +19777 +19778 +19779 +19780 +19781 +19782 +19783 +19784 +19785 +19786 +19787 +19788 +19789 +19790 +19791 +19792 +19793 +19794 +19795 +19796 +19797 +19798 +19799 +19800 +19801 +19802 +19803 +19804 +19805 +19806 +19807 +19808 +19809 +19810 +19811 +19812 +19813 +19814 +19815 +19816 +19817 +19818 +19819 +19820 +19821 +19822 +19823 +19824 +19825 +19826 +19827 +19828 +19829 +19830 +19831 +19832 +19833 +19834 +19835 +19836 +19837 +19838 +19839 +19840 +19841 +19842 +19843 +19844 +19845 +19846 +19847 +19848 +19849 +19850 +19851 +19852 +19853 +19854 +19855 +19856 +19857 +19858 +19859 +19860 +19861 +19862 +19863 +19864 +19865 +19866 +19867 +19868 +19869 +19870 +19871 +19872 +19873 +19874 +19875 +19876 +19877 +19878 +19879 +19880 +19881 +19882 +19883 +19884 +19885 +19886 +19887 +19888 +19889 +19890 +19891 +19892 +19893 +19894 +19895 +19896 +19897 +19898 +19899 +19900 +19901 +19902 +19903 +19904 +19905 +19906 +19907 +19908 +19909 +19910 +19911 +19912 +19913 +19914 +19915 +19916 +19917 +19918 +19919 +19920 +19921 +19922 +19923 +19924 +19925 +19926 +19927 +19928 +19929 +19930 +19931 +19932 +19933 +19934 +19935 +19936 +19937 +19938 +19939 +19940 +19941 +19942 +19943 +19944 +19945 +19946 +19947 +19948 +19949 +19950 +19951 +19952 +19953 +19954 +19955 +19956 +19957 +19958 +19959 +19960 +19961 +19962 +19963 +19964 +19965 +19966 +19967 +19968 +19969 +19970 +19971 +19972 +19973 +19974 +19975 +19976 +19977 +19978 +19979 +19980 +19981 +19982 +19983 +19984 +19985 +19986 +19987 +19988 +19989 +19990 +19991 +19992 +19993 +19994 +19995 +19996 +19997 +19998 +19999 +20000 diff --git a/tests/fixtures/sort/ext_sort.txt b/tests/fixtures/sort/ext_sort.txt new file mode 100644 index 000000000..a409d67e1 --- /dev/null +++ b/tests/fixtures/sort/ext_sort.txt @@ -0,0 +1,20000 @@ +9155 +10575 +10442 +15874 +17013 +12130 +15558 +18263 +6574 +8957 +9851 +16606 +12331 +9865 +13795 +270 +6590 +11141 +4620 +5945 +10904 +8652 +8442 +8907 +1935 +13100 +3961 +7538 +4159 +11986 +4394 +9321 +15560 +5264 +5121 +11532 +6980 +2807 +19760 +8032 +5158 +13698 +4458 +9106 +3773 +1625 +9914 +8287 +5155 +14326 +18137 +19522 +9270 +6153 +1920 +12517 +13259 +17618 +9930 +3630 +15924 +4540 +263 +14212 +15620 +11328 +8704 +17848 +1614 +12587 +17970 +4542 +11976 +12885 +8743 +16323 +14582 +12101 +12472 +12620 +10713 +5148 +7522 +2417 +8602 +7860 +19596 +2892 +13359 +7731 +3707 +4628 +4710 +5642 +1610 +4784 +10128 +16341 +14168 +5829 +17901 +9447 +1041 +15193 +15260 +11224 +11723 +13368 +14011 +12200 +2001 +18479 +3965 +16642 +16680 +2384 +7557 +5539 +4305 +14588 +17386 +1359 +17721 +1142 +7287 +9946 +13139 +15022 +17237 +14454 +14358 +11297 +12485 +857 +19282 +117 +19179 +16040 +6978 +10743 +19161 +12308 +9509 +13233 +4666 +5850 +17040 +2473 +17323 +6728 +11500 +4401 +13887 +19944 +17601 +19731 +10715 +8327 +11196 +7944 +9068 +13253 +13913 +13419 +17649 +16894 +3333 +5747 +3000 +12724 +17772 +17341 +11854 +6042 +10362 +3438 +13828 +471 +17747 +13707 +17902 +8184 +3385 +19387 +46 +1848 +15848 +10768 +17481 +436 +17581 +4629 +13210 +5085 +19485 +44 +12549 +16407 +9646 +9884 +15802 +2461 +15134 +2936 +8156 +17411 +1228 +18200 +14616 +17443 +5512 +6017 +10137 +11424 +11940 +6655 +17669 +6147 +16570 +17281 +18915 +19689 +18013 +17895 +6925 +19766 +18634 +7195 +7001 +12335 +3908 +18754 +4833 +12486 +12892 +18879 +3691 +1693 +158 +8682 +1029 +3429 +644 +1664 +13972 +5352 +15422 +1928 +14561 +3322 +3570 +6298 +2251 +12216 +19823 +12658 +2081 +4177 +13843 +18454 +13755 +9340 +6373 +3290 +2893 +16274 +16610 +12782 +7269 +5681 +19372 +7843 +14844 +16236 +16004 +1136 +5759 +19347 +7684 +7435 +5892 +7305 +2504 +7064 +13264 +8781 +1327 +19943 +18122 +1803 +9999 +13695 +9742 +8274 +744 +2252 +10524 +1434 +4601 +6071 +10489 +19626 +10745 +18312 +872 +19166 +3417 +9272 +1433 +9431 +6486 +3532 +18452 +17830 +9835 +2495 +10475 +16725 +16019 +6594 +11355 +13055 +14782 +11924 +18838 +3563 +428 +12993 +14223 +6658 +2783 +1726 +6929 +13053 +19175 +8564 +4867 +19604 +17416 +9347 +2275 +16381 +9817 +11176 +14576 +6906 +9805 +14149 +2241 +11030 +453 +835 +15452 +2879 +4018 +17396 +16133 +1301 +3450 +10182 +2389 +19201 +4443 +14368 +2537 +7452 +1583 +13955 +3875 +7479 +17561 +3247 +16310 +5253 +8899 +6523 +10260 +13065 +11077 +15109 +7249 +12046 +5313 +8914 +19949 +2196 +3654 +7145 +12166 +18340 +17929 +12466 +7866 +3831 +15095 +2506 +17691 +12992 +6591 +9661 +19538 +2161 +3991 +6766 +18180 +182 +15952 +9709 +19601 +13427 +19071 +12698 +12157 +7963 +3485 +19327 +6029 +12948 +2261 +2844 +4864 +12148 +9187 +6695 +8171 +19771 +3782 +14122 +11658 +330 +10750 +6932 +4436 +15622 +5710 +18750 +5765 +10545 +10897 +16609 +9183 +802 +14708 +3423 +11557 +19098 +3641 +14490 +3249 +1355 +16886 +18500 +15309 +8010 +18543 +2342 +3813 +2135 +9055 +15148 +12720 +3253 +737 +11788 +253 +13352 +1521 +13949 +1957 +10884 +2273 +14730 +13979 +2401 +595 +12697 +9932 +11372 +11915 +760 +10930 +10659 +6472 +19706 +6488 +9730 +17705 +16085 +4134 +2070 +4852 +5122 +16359 +7044 +8510 +10868 +10172 +510 +11550 +260 +11181 +3018 +3668 +904 +10271 +17104 +12764 +3364 +1878 +2803 +14040 +1149 +15626 +12809 +11008 +2903 +8352 +12761 +13470 +11258 +1400 +8381 +12422 +8402 +3919 +7164 +17263 +18167 +4549 +7654 +6034 +8438 +19451 +12122 +5167 +19334 +9771 +1111 +2932 +18324 +4897 +12687 +1720 +2767 +7616 +6431 +16918 +579 +16504 +4559 +14384 +6337 +4008 +7937 +1086 +5314 +12489 +5211 +17500 +19641 +14815 +7967 +8140 +5239 +2571 +18601 +16197 +5142 +12714 +14895 +3432 +3995 +9206 +7668 +8703 +1661 +4315 +5941 +6849 +2505 +19547 +11736 +5319 +986 +7846 +16050 +9227 +13121 +1012 +18236 +4888 +3885 +11135 +17395 +4303 +3836 +18544 +9807 +15248 +10626 +13846 +17286 +5581 +14007 +2062 +4619 +14864 +13869 +2442 +17728 +11590 +16382 +19117 +19446 +6843 +8694 +14439 +3453 +2700 +9821 +8089 +9645 +14679 +4356 +11980 +5408 +2668 +8053 +1647 +19959 +17083 +14916 +8841 +2319 +11984 +12867 +4292 +4633 +1492 +10716 +12880 +8243 +3929 +2225 +2943 +17578 +12138 +5648 +9614 +15487 +18868 +10779 +12716 +403 +2908 +7040 +4772 +19912 +14823 +5045 +14250 +19733 +13073 +6947 +10387 +8021 +5201 +4488 +18161 +4100 +1422 +16865 +7646 +4370 +17271 +19121 +9808 +2613 +15130 +18893 +11654 +5903 +15058 +12954 +6480 +5764 +15830 +17813 +10224 +6324 +4412 +5607 +9497 +7849 +1291 +9401 +19126 +15067 +10197 +18480 +6258 +8590 +17216 +7437 +16511 +18807 +4267 +18809 +14488 +2345 +4395 +11054 +7624 +3708 +896 +18870 +19517 +2950 +7950 +19529 +155 +19786 +138 +7168 +2130 +10699 +19821 +19156 +11071 +8912 +9515 +17234 +10388 +195 +19909 +16687 +18628 +5870 +10436 +16939 +6562 +8748 +4929 +6282 +9147 +12262 +18067 +17029 +5593 +11043 +15042 +19516 +7618 +13353 +3793 +108 +8255 +8446 +9675 +6111 +5162 +17668 +11558 +17151 +4502 +4353 +19681 +9842 +9229 +13095 +6533 +5706 +14713 +130 +4435 +918 +5195 +4348 +13863 +1247 +13221 +11826 +14356 +7315 +19382 +14025 +10586 +13495 +2418 +13930 +17352 +10751 +5332 +19001 +148 +12921 +8219 +11851 +12210 +5136 +16621 +309 +11602 +3224 +2787 +831 +2423 +14749 +12053 +9389 +15413 +17125 +7143 +19332 +10719 +10433 +4229 +6003 +3725 +17978 +3086 +17007 +6993 +16758 +6015 +16832 +2292 +16344 +13161 +7474 +12363 +10615 +19599 +6856 +10583 +19326 +15872 +3318 +17397 +14798 +8994 +13566 +949 +8506 +17722 +14915 +16273 +14643 +12334 +6859 +3148 +16594 +1809 +16350 +10681 +5696 +19560 +11625 +12856 +14535 +12292 +10444 +14707 +19226 +15085 +17377 +10766 +1833 +14675 +6297 +11865 +9647 +1269 +11299 +18222 +12310 +5715 +3293 +5580 +16180 +3198 +5655 +14952 +4632 +18179 +14464 +18546 +19062 +14401 +10772 +11719 +12926 +6267 +9163 +7559 +6358 +6903 +12503 +842 +90 +11725 +5854 +2083 +9137 +3292 +2781 +10855 +13137 +1993 +6499 +1395 +4910 +9378 +445 +13443 +7039 +15416 +7434 +13093 +14981 +10377 +13571 +5652 +19404 +14335 +8636 +13404 +18715 +12722 +19189 +9989 +12956 +7993 +7848 +5771 +16660 +9063 +8452 +4845 +14997 +6883 +11982 +1931 +9618 +11593 +12712 +16973 +17452 +9993 +3728 +18598 +15326 +15360 +7612 +18837 +5048 +9659 +14572 +732 +10948 +8383 +15938 +9822 +15502 +231 +9438 +13629 +4987 +16527 +7250 +17364 +14600 +13817 +7983 +7154 +4103 +14313 +6931 +13983 +14009 +11778 +5478 +11543 +13446 +13037 +17142 +8307 +17676 +16495 +2274 +15324 +8828 +7999 +861 +6566 +17141 +9039 +694 +2882 +10144 +17051 +15743 +11263 +17156 +9122 +9916 +14398 +7063 +6237 +5638 +15763 +1781 +2049 +10105 +1246 +7266 +7500 +18846 +5535 +15135 +18616 +10987 +4354 +18659 +18721 +4950 +14666 +12702 +663 +11894 +11411 +19965 +3137 +5388 +7768 +5069 +7826 +19221 +1176 +18638 +3314 +36 +17709 +15578 +14710 +4791 +6413 +5461 +7776 +13204 +2302 +6382 +9622 +8769 +8967 +4208 +15083 +2464 +9639 +19391 +14833 +9760 +1577 +681 +236 +1985 +12792 +10147 +11477 +14536 +8012 +18444 +13183 +7810 +7717 +8593 +1654 +18958 +19769 +5659 +13596 +8469 +17760 +16629 +17402 +2140 +16696 +14869 +8103 +18250 +6429 +469 +7934 +16281 +16623 +7074 +4984 +9624 +16339 +7825 +19700 +6866 +15914 +19964 +19336 +13712 +11268 +3216 +10218 +12589 +4453 +14596 +16420 +1512 +18977 +11886 +11637 +12934 +496 +18503 +7326 +1082 +19257 +12682 +5177 +12065 +1500 +8097 +17636 +1973 +12448 +2209 +6165 +17875 +13036 +11911 +17546 +18476 +14284 +12114 +15674 +7720 +3484 +10471 +6089 +3441 +12887 +19772 +5168 +16222 +18075 +6793 +1074 +3428 +7593 +8465 +14048 +3463 +15554 +15329 +4352 +6135 +11756 +4268 +1482 +3523 +14390 +3681 +3090 +15748 +2656 +9255 +6536 +10528 +8574 +1926 +18022 +8625 +19593 +12288 +10632 +18212 +9782 +1875 +2082 +13643 +16171 +8385 +15465 +5751 +9420 +1004 +7771 +12499 +12525 +6097 +1513 +15921 +15484 +12663 +17072 +4693 +15491 +9584 +5864 +4977 +7841 +15412 +7923 +3536 +2540 +6911 +10031 +2206 +18931 +1856 +205 +8152 +12603 +4552 +19026 +9223 +10389 +11271 +16914 +16266 +9829 +8124 +3549 +11605 +16055 +5537 +19801 +11601 +3499 +7699 +735 +9037 +18773 +11078 +18295 +11935 +16267 +5072 +1822 +16710 +5097 +2812 +13191 +12077 +9819 +5524 +17767 +10587 +10513 +1994 +19862 +18907 +7968 +15272 +7789 +2409 +54 +19531 +8092 +3347 +673 +5449 +18599 +11457 +9023 +18216 +151 +3325 +7491 +12272 +1089 +17925 +12543 +4855 +910 +8895 +2662 +17435 +11455 +6263 +6049 +10308 +14696 +1120 +1857 +14658 +14709 +1827 +9133 +3732 +2308 +5021 +19895 +5130 +2321 +8478 +13751 +14668 +12758 +6368 +925 +6567 +13960 +4392 +17533 +11140 +8696 +4902 +19715 +19592 +19009 +6990 +7368 +2884 +1761 +9096 +5776 +19203 +12034 +13669 +14639 +8126 +11779 +16533 +1682 +208 +7340 +6351 +6564 +16168 +11449 +15859 +14482 +19057 +13581 +5965 +18130 +1427 +8670 +16155 +17607 +3754 +5050 +8369 +10157 +7623 +4580 +10289 +14147 +4613 +6316 +8441 +13630 +19850 +15986 +1160 +17770 +19266 +83 +6643 +4694 +10353 +4909 +4727 +15659 +5584 +2641 +3698 +3165 +13039 +13312 +4756 +3598 +8958 +1898 +16121 +18728 +6332 +6539 +12401 +18019 +13123 +15388 +1972 +3111 +13250 +13944 +15408 +9078 +452 +14346 +7560 +2306 +3883 +6312 +3541 +5518 +3377 +19440 +11416 +6459 +19730 +1018 +17717 +19070 +2979 +7628 +3294 +14038 +17208 +16535 +14850 +7 +16427 +18239 +5066 +9609 +9194 +11734 +14200 +4917 +13090 +2490 +3735 +3829 +13487 +7105 +4108 +450 +10527 +3391 +13080 +3884 +9246 +14599 +12759 +9940 +5528 +1425 +3209 +4 +11016 +14852 +17253 +15713 +4653 +5849 +4787 +16819 +12491 +19370 +12594 +3657 +10088 +3741 +9981 +3779 +18367 +4760 +8416 +16092 +18242 +12718 +18491 +13873 +10163 +11696 +4073 +1570 +18443 +8328 +3675 +4282 +7763 +6861 +17516 +18429 +7823 +11156 +9205 +18297 +13738 +7811 +3578 +8944 +2115 +16468 +3907 +15293 +10044 +6555 +2826 +9838 +6750 +15892 +4279 +6867 +7938 +9788 +1115 +13625 +2146 +11581 +1096 +18237 +10236 +9201 +17460 +13171 +9963 +7202 +3966 +4294 +5573 +10232 +13791 +19875 +9298 +11298 +18253 +10352 +14014 +10952 +16802 +17984 +3027 +11733 +3150 +3514 +5796 +16181 +16322 +15572 +9196 +9392 +6842 +13963 +7868 +4416 +5411 +4598 +12392 +8187 +8809 +1722 +14154 +7136 +10114 +806 +4506 +2210 +1234 +6487 +12601 +6345 +1222 +11032 +17837 +1436 +18510 +13192 +13409 +2916 +15236 +2171 +19849 +18365 +13536 +7186 +18356 +13562 +13042 +15819 +11301 +5777 +15869 +9462 +264 +6749 +6724 +19018 +3737 +4210 +13420 +16942 +8870 +14209 +19898 +882 +4021 +18094 +438 +15220 +12025 +19916 +8802 +16090 +7216 +13396 +19431 +15182 +11773 +2064 +2735 +4187 +14432 +6551 +14174 +4687 +14750 +19246 +5868 +8400 +16515 +3028 +1855 +15898 +12605 +2643 +9103 +7130 +10895 +9089 +2771 +19857 +10033 +19263 +9119 +14706 +14207 +18470 +11743 +18163 +859 +13245 +14698 +11764 +9748 +15584 +19089 +13388 +18928 +3289 +19660 +16732 +16194 +70 +19077 +2745 +11216 +5550 +15300 +7565 +1766 +9684 +18285 +3060 +14989 +5227 +2072 +8080 +14517 +12391 +13686 +7525 +14548 +11403 +8754 +16046 +10953 +7112 +5592 +6882 +9080 +4589 +13437 +16114 +5753 +6118 +16947 +4566 +9633 +7033 +13356 +9164 +13671 +9689 +11207 +18007 +2402 +15376 +16038 +6571 +4875 +3055 +16146 +18484 +19778 +12574 +966 +16007 +6908 +10248 +9118 +1820 +1830 +14591 +15893 +13881 +6987 +5794 +13255 +12003 +4537 +18485 +3567 +7203 +19079 +6338 +8671 +15590 +19654 +2552 +10446 +14189 +3207 +9582 +12209 +18993 +6941 +14448 +18639 +18694 +5814 +10292 +8377 +10796 +10680 +15 +870 +1777 +15404 +2044 +4232 +3917 +5371 +7725 +8974 +8227 +6073 +12404 +9084 +19466 +14267 +8223 +7381 +7682 +632 +12671 +1325 +11845 +11113 +8412 +19417 +6357 +17205 +380 +4919 +7842 +14100 +16317 +15235 +14613 +18211 +7461 +19872 +9913 +11784 +13436 +1859 +6597 +13750 +10136 +14029 +10842 +1795 +682 +11266 +16047 +5758 +1194 +16086 +7301 +6798 +10818 +3495 +17518 +298 +16767 +18903 +15113 +10358 +5676 +18567 +4812 +15165 +9477 +2283 +11622 +13722 +3073 +16187 +2544 +2482 +7534 +18691 +14260 +274 +14682 +3231 +16237 +6606 +16494 +12612 +17826 +18266 +17652 +11954 +19394 +16356 +15781 +6498 +7613 +18308 +9852 +12495 +11569 +6822 +15384 +18414 +16240 +17425 +3619 +2998 +4060 +281 +12126 +13552 +17956 +8648 +5199 +11470 +19559 +2184 +4127 +1782 +11302 +8272 +7227 +4378 +6617 +17001 +5565 +12212 +15110 +12717 +9177 +203 +15928 +14386 +18671 +3664 +5577 +5825 +18883 +11563 +7790 +16821 +19075 +11407 +4067 +481 +15007 +10607 +1437 +16173 +10793 +647 +3305 +2691 +15054 +1132 +8766 +14500 +14137 +11852 +14871 +765 +16596 +1727 +2747 +9784 +9337 +16309 +16810 +16508 +12105 +1127 +13997 +17502 +17305 +18799 +12701 +5281 +13678 +4044 +18969 +14380 +19526 +15873 +8501 +299 +1764 +18487 +19620 +4094 +9237 +12970 +4240 +14861 +11285 +1470 +3766 +9496 +9656 +5356 +7509 +9637 +15046 +19038 +1072 +13336 +784 +18523 +6996 +15991 +581 +14929 +16799 +4522 +8701 +9889 +5016 +7199 +19270 +15705 +2611 +10397 +19448 +17801 +11447 +16190 +16130 +3153 +12318 +5677 +14727 +13117 +9800 +15894 +15709 +9081 +5403 +15579 +6359 +5576 +552 +19272 +11427 +4343 +11192 +12732 +4424 +17024 +7715 +12633 +2562 +12400 +4330 +16677 +1150 +6402 +18957 +9338 +4726 +10064 +8644 +17968 +79 +14922 +12178 +7837 +11881 +18551 +2096 +7547 +6879 +16607 +17532 +17944 +10284 +10009 +9868 +2088 +7165 +17038 +14403 +11088 +9668 +13714 +9125 +13804 +13547 +200 +11058 +19642 +3016 +5375 +14376 +5202 +3268 +8476 +14820 +12021 +17213 +12957 +8549 +15190 +5397 +3339 +8084 +15262 +10297 +14127 +18950 +14402 +11073 +5657 +10318 +13866 +9180 +18302 +3183 +2397 +11747 +9357 +2022 +10447 +16582 +19247 +14261 +19923 +14503 +16422 +8778 +18439 +19673 +1679 +9156 +14756 +8836 +792 +14801 +14510 +4556 +12417 +6110 +15972 +1030 +2328 +525 +16238 +11164 +11570 +17610 +4118 +11897 +9444 +14758 +2978 +16124 +7333 +6201 +14646 +819 +16867 +758 +4095 +19080 +15720 +17338 +18410 +12800 +16679 +10495 +6063 +10001 +18512 +14521 +6137 +18160 +5900 +3606 +15776 +9127 +13491 +17690 +9173 +5013 +3745 +13371 +9315 +4604 +14737 +4625 +7850 +3071 +2681 +13915 +3716 +7617 +12597 +3512 +3565 +19435 +7564 +17592 +9035 +12394 +2941 +6473 +13995 +18469 +11981 +17680 +1932 +19172 +1959 +16466 +2043 +11677 +7471 +7635 +12870 +10337 +15199 +2517 +17905 +10239 +5615 +2269 +13794 +2664 +8883 +10087 +9073 +10617 +5548 +10940 +19822 +11659 +13147 +12171 +3164 +17034 +9484 +17682 +7142 +3559 +12980 +11388 +7572 +17292 +3311 +3561 +7590 +14998 +7454 +2874 +6168 +937 +14366 +8090 +8710 +12599 +8443 +8970 +18892 +329 +3254 +7781 +16904 +4896 +12343 +11478 +10553 +4132 +17450 +12864 +3510 +1402 +12055 +8183 +165 +9948 +3214 +6878 +5933 +228 +3230 +1281 +15215 +10404 +3367 +4014 +6632 +9043 +4818 +6661 +19398 +18517 +7085 +17011 +13682 +15769 +13317 +3843 +11294 +7302 +8179 +12539 +16626 +3607 +15203 +2254 +5182 +16659 +12406 +12573 +5917 +2373 +11062 +17231 +3916 +3105 +9085 +18613 +11408 +17161 +17366 +11591 +4238 +4660 +2848 +5891 +12804 +10288 +8174 +14239 +12514 +4654 +4250 +2852 +6314 +2368 +4331 +10102 +9215 +4154 +9775 +15534 +16486 +6072 +17897 +6804 +9025 +6688 +8484 +7362 +7728 +18465 +17285 +7308 +13520 +11839 +8577 +3723 +4068 +5628 +18978 +9294 +13440 +3112 +13821 +12027 +13670 +1564 +15275 +10179 +9740 +7109 +8716 +11499 +11306 +4092 +15096 +18461 +19703 +15349 +1079 +15249 +4831 +8609 +5402 +6252 +12462 +17598 +8256 +4873 +901 +1505 +10888 +13587 +16191 +1683 +13035 +13771 +4377 +17164 +4385 +9517 +18346 +10202 +807 +3176 +3393 +10311 +11856 +4420 +17807 +16514 +17296 +10185 +7689 +2121 +603 +19848 +14957 +6235 +3765 +6958 +16961 +16835 +11823 +15218 +3673 +14694 +9799 +10988 +11521 +16713 +2904 +6079 +3201 +18911 +4517 +5304 +6689 +3034 +17456 +14288 +3025 +9030 +10834 +72 +3640 +5419 +17997 +12664 +17332 +3392 +18034 +8415 +10580 +2582 +7067 +12922 +8116 +6069 +9456 +3945 +12121 +3205 +1471 +18203 +4563 +11758 +15828 +12696 +3029 +5878 +7584 +18021 +9781 +13367 +12159 +8708 +17930 +18482 +3810 +19468 +9992 +9466 +16650 +8319 +8075 +13026 +12750 +4248 +3756 +6904 +5987 +10300 +19513 +7835 +14553 +7997 +13118 +13895 +14201 +828 +19873 +14254 +14321 +6442 +7713 +18594 +9283 +3803 +18739 +5800 +8088 +11797 +12172 +17438 +8013 +6444 +2526 +19303 +7752 +5243 +10222 +14888 +1987 +12728 +2281 +14094 +13189 +18421 +232 +17792 +12315 +5112 +10252 +14472 +11282 +13205 +8666 +16375 +13298 +53 +16122 +15019 +18453 +11551 +17430 +10461 +11789 +5997 +2790 +18547 +12547 +6067 +19149 +2820 +18032 +10802 +10133 +18017 +7667 +13452 +16972 +4192 +2519 +15381 +12924 +10438 +19016 +4955 +3903 +10237 +15152 +2860 +19938 +5412 +14294 +2867 +15553 +8672 +13106 +11603 +408 +546 +6437 +7921 +7487 +11587 +14507 +4111 +15628 +13295 +8340 +18279 +7259 +14649 +19506 +14785 +10293 +14742 +19136 +6265 +1087 +12052 +15843 +18727 +5484 +845 +15185 +13976 +15646 +17664 +1068 +4335 +8722 +12020 +488 +2706 +282 +3534 +1294 +3043 +11397 +2713 +2975 +944 +10208 +100 +19744 +4924 +2107 +17519 +7385 +2507 +17006 +2763 +7137 +17314 +15094 +12296 +12237 +10544 +2758 +76 +12678 +10763 +3780 +17067 +8968 +975 +3659 +13505 +15863 +17766 +3363 +5423 +7463 +2178 +4126 +14612 +7382 +19859 +676 +12313 +9295 +8640 +11309 +10754 +13801 +12608 +13889 +18117 +16269 +3412 +10649 +12279 +3508 +7951 +13929 +12250 +17637 +8922 +18762 +18329 +14702 +9507 +19961 +850 +9597 +4414 +13247 +16822 +10422 +19205 +3713 +3436 +7248 +4243 +10902 +8762 +15545 +12653 +18681 +13455 +14691 +10967 +3489 +18920 +12677 +9470 +2134 +15958 +350 +19280 +17241 +19725 +3551 +7246 +19535 +7724 +18758 +1731 +3332 +17522 +467 +2625 +9608 +14969 +1323 +9233 +16160 +14099 +5302 +8554 +4449 +5333 +9273 +16185 +14522 +17604 +19605 +6303 +12330 +15146 +14008 +7440 +541 +11439 +1576 +16787 +16643 +3187 +1217 +9606 +833 +7777 +15549 +18991 +11612 +4806 +5366 +12275 +19215 +19449 +12385 +8947 +15472 +13739 +14947 +1225 +12670 +6053 +2155 +5435 +15931 +13807 +16673 +8413 +15099 +10069 +13744 +9676 +12002 +16917 +1192 +13262 +15795 +12097 +4419 +2704 +15031 +10581 +13753 +5473 +721 +8536 +15470 +12176 +11335 +3264 +1075 +3213 +12203 +1035 +18985 +621 +4571 +832 +18668 +1008 +6614 +10274 +7827 +18731 +2421 +10075 +15523 +2499 +3761 +13927 +7374 +2263 +4507 +209 +8779 +492 +9195 +18556 +10960 +16021 +10464 +5662 +18906 +13364 +13332 +13413 +8647 +2909 +6985 +16880 +16692 +17599 +788 +14233 +7122 +14248 +14319 +9678 +7149 +10526 +1587 +19510 +5975 +4104 +3319 +9437 +996 +4384 +6922 +5501 +17736 +3483 +7518 +8495 +368 +1461 +9559 +15729 +6638 +5407 +13111 +14491 +8824 +6615 +2284 +14186 +10279 +11785 +10097 +16919 +14273 +15533 +4079 +18344 +2175 +15635 +14883 +4928 +8034 +19930 +13460 +5421 +8072 +18176 +18157 +14272 +6271 +15237 +8601 +12886 +8145 +3390 +11900 +8524 +3615 +3893 +17727 +3817 +16812 +1177 +19385 +2759 +14657 +11853 +19444 +12660 +3987 +2960 +16110 +12808 +1706 +9939 +11800 +4441 +14638 +459 +13076 +18192 +10061 +18226 +8324 +19067 +17264 +14165 +19323 +3747 +9056 +4321 +9546 +8030 +2356 +18989 +16340 +11970 +16797 +14564 +5216 +359 +1881 +17087 +11333 +18725 +10957 +5118 +2959 +4838 +12425 +14879 +11620 +5585 +12994 +3695 +18873 +2286 +10737 +16869 +11498 +18970 +4309 +772 +4029 +18787 +8505 +4596 +2731 +12749 +1349 +16805 +7028 +14818 +5098 +7543 +6474 +8697 +4439 +5308 +12946 +18423 +13965 +11975 +2260 +7046 +17257 +15904 +1114 +7306 +5780 +2764 +8788 +19176 +15016 +7772 +5060 +10836 +9873 +11267 +10981 +8305 +5044 +5872 +19841 +7894 +8600 +19411 +5946 +13648 +255 +2447 +1558 +490 +17820 +17806 +15541 +893 +6841 +15371 +11170 +10039 +9423 +17294 +18620 +8311 +17065 +968 +3834 +545 +16969 +12174 +4056 +16630 +8260 +8432 +10238 +14779 +4390 +2883 +14841 +10338 +13475 +7354 +14736 +13167 +2772 +18162 +15228 +12305 +12719 +1644 +10361 +7441 +17815 +11553 +8711 +1066 +5487 +9175 +9275 +5210 +18973 +13240 +17780 +2550 +12982 +14832 +10927 +4661 +16513 +12471 +15925 +2872 +12541 +17750 +18498 +6578 +3611 +17994 +13313 +22 +18334 +2349 +1415 +16900 +13975 +3906 +7735 +9625 +11194 +18855 +11188 +16154 +10403 +3064 +15075 +1773 +5986 +8845 +12083 +920 +3050 +17827 +5658 +16020 +17909 +7881 +4933 +12873 +8433 +8631 +18760 +15821 +7722 +11460 +17342 +2034 +17490 +10780 +883 +14097 +15098 +14621 +6636 +5720 +1124 +16757 +10874 +15537 +1557 +10173 +17788 +1749 +8910 +13488 +11561 +18073 +15930 +12831 +14569 +2545 +11320 +11238 +19196 +3753 +12191 +1336 +17805 +8758 +8200 +7914 +2095 +8798 +6651 +11808 +2970 +19186 +15383 +19024 +8654 +14744 +12256 +1023 +963 +7280 +8548 +11983 +1423 +3704 +17529 +10627 +743 +3001 +16400 +5489 +5010 +180 +5853 +13238 +12358 +15963 +14717 +11350 +3159 +18665 +14449 +15660 +19809 +18975 +2655 +306 +4030 +7739 +8509 +14567 +8664 +9500 +13230 +16056 +567 +15875 +2716 +18559 +17496 +1212 +8394 +1828 +864 +16868 +16018 +4259 +2470 +10454 +14166 +5460 +4926 +10011 +3869 +1324 +13729 +5361 +11782 +9954 +10348 +16472 +11978 +10548 +2312 +14032 +4262 +4674 +1050 +855 +6933 +18283 +15984 +15960 +609 +5280 +7784 +3261 +10588 +13579 +19058 +13563 +15211 +17376 +18894 +13797 +14550 +15929 +11391 +19746 +2497 +2762 +5351 +3573 +7663 +13316 +5052 +18248 +10496 +9108 +17914 +1589 +10976 +12564 +5640 +7052 +3650 +19288 +17354 +5334 +1612 +8429 +19457 +12336 +844 +17372 +2722 +4020 +13935 +2141 +13269 +4597 +14880 +17706 +10707 +4160 +8588 +7049 +909 +17520 +17317 +18777 +10 +18364 +11199 +17916 +11227 +1696 +14325 +12214 +7281 +14539 +16857 +1591 +6780 +6432 +8874 +10189 +9146 +15350 +5802 +18704 +2868 +4437 +172 +4893 +14474 +13974 +13089 +5457 +10797 +13858 +6339 +821 +8035 +10046 +14123 +19109 +15420 +16257 +11615 +7462 +8867 +8253 +13737 +20 +107 +17031 +13078 +8634 +1974 +14051 +16800 +8299 +19040 +17896 +9109 +7124 +12631 +17931 +1890 +6823 +8000 +4767 +2295 +15732 +1915 +10664 +15103 +9049 +18741 +17887 +3320 +12120 +9574 +17724 +9563 +6734 +2316 +31 +3671 +4605 +1084 +9813 +6435 +520 +19309 +3978 +6141 +17935 +6068 +18886 +3372 +4828 +99 +14056 +13544 +17509 +853 +14034 +18028 +11904 +16706 +11293 +8434 +7642 +12996 +14371 +3298 +17073 +267 +18636 +6920 +4529 +4574 +8390 +11360 +5255 +5601 +12248 +10778 +13658 +5784 +5476 +7671 +19286 +18144 +1927 +14367 +6863 +3805 +17986 +16333 +3227 +18191 +3301 +18071 +7150 +8780 +13907 +12393 +16166 +11973 +15147 +9541 +14193 +7318 +3712 +13708 +11345 +10427 +4323 +12026 +10245 +19967 +1405 +388 +16958 +2546 +7439 +10000 +16496 +16774 +6023 +16728 +13478 +2087 +11657 +14383 +4916 +18463 +4677 +4421 +17658 +8330 +1958 +11352 +7005 +19148 +5629 +14120 +5343 +10312 +18412 +17808 +770 +13891 +7283 +1547 +19493 +8091 +13424 +303 +3252 +12888 +2924 +12908 +13878 +13442 +15359 +5838 +11929 +5483 +8948 +15000 +8852 +12754 +7103 +17378 +1990 +2635 +1314 +19376 +10616 +10319 +569 +16644 +18499 +6572 +7071 +8093 +2218 +7749 +8333 +3011 +6260 +3358 +13649 +3821 +11575 +17623 +8707 +19293 +9585 +16920 +16461 +15377 +19556 +8660 +11807 +9534 +12326 +6289 +16950 +12742 +7347 +339 +12876 +15013 +6976 +16105 +15043 +18193 +1348 +14931 +583 +19476 +8455 +7530 +13897 +13373 +13684 +13655 +5635 +9475 +377 +16225 +12223 +17025 +13706 +11763 +8756 +834 +10618 +19095 +11740 +15561 +7160 +11522 +8688 +7273 +4477 +14811 +9832 +12352 +14281 +7299 +8576 +1020 +2961 +12276 +1193 +16897 +3473 +1185 +1198 +1353 +12881 +4077 +15642 +5511 +12840 +9750 +13101 +8026 +2282 +14224 +5480 +10594 +9903 +16358 +458 +18927 +19045 +9355 +7312 +3094 +12584 +6116 +16287 +3091 +967 +19947 +5920 +5979 +4883 +11583 +15033 +2160 +3479 +15639 +1204 +16521 +2777 +13765 +3517 +18076 +16376 +4802 +1197 +11109 +11985 +7585 +11451 +19169 +10648 +18223 +9554 +18688 +16116 +19412 +19371 +17483 +10726 +13054 +15421 +15637 +5861 +2355 +6874 +2054 +8052 +4763 +5086 +17479 +16568 +286 +11314 +5630 +7638 +4785 +18259 +15063 +5927 +1902 +9487 +4430 +12127 +7984 +5323 +14082 +10574 +11798 +19408 +13315 +17400 +12810 +6405 +10885 +18982 +6347 +6107 +12879 +14257 +6212 +5437 +12789 +17322 +2320 +17370 +1352 +14275 +8316 +19375 +2163 +10911 +12257 +13001 +3599 +13911 +12429 +5992 +16178 +11690 +6844 +10925 +11040 +13829 +3140 +5848 +18252 +14050 +18210 +13620 +4801 +6090 +8264 +1200 +13511 +14581 +18087 +15366 +4711 +5058 +18509 +10826 +10217 +19119 +6825 +12066 +17167 +2869 +262 +14434 +2468 +11247 +4607 +16667 +4655 +4009 +19788 +11664 +15257 +3981 +11512 +18254 +241 +14508 +5385 +14884 +508 +1010 +3533 +9474 +12500 +476 +19878 +8245 +6221 +16128 +11381 +13202 +13770 +9372 +15750 +9753 +12263 +7979 +8317 +16030 +1428 +3304 +5890 +10040 +16840 +11006 +103 +15437 +1237 +11452 +6471 +14688 +815 +10416 +14624 +15082 +12329 +10168 +7885 +8055 +6173 +1700 +14259 +19945 +3396 +11197 +5867 +14058 +2610 +7808 +18272 +19800 +11895 +5748 +5678 +19439 +18288 +7690 +17950 +4670 +6855 +13832 +2375 +16247 +11035 +8411 +7119 +8172 +19577 +18407 +16033 +9886 +618 +6757 +8663 +7024 +4404 +3775 +5904 +3496 +11175 +1178 +18651 +540 +14839 +715 +14427 +19913 +11250 +10014 +18733 +1745 +8873 +19741 +17799 +19854 +17954 +1250 +10275 +9579 +1962 +7512 +15141 +4980 +7405 +8585 +10711 +16475 +11717 +18530 +7008 +17316 +2051 +17537 +13796 +1477 +7907 +6230 +8903 +15358 +17492 +12721 +12635 +9425 +7215 +4657 +15880 +5509 +9729 +5597 +15150 +928 +4194 +1885 +3352 +8450 +12802 +4699 +12373 +19727 +1007 +6365 +5531 +4505 +5181 +6139 +2523 +10598 +10730 +12987 +2547 +3516 +680 +18052 +19078 +4568 +18027 +2796 +1980 +19124 +7240 +10159 +19131 +17431 +8023 +2190 +13260 +5143 +7262 +5203 +1040 +509 +8107 +6132 +547 +7740 +865 +3225 +14348 +3 +17698 +4518 +14070 +8993 +3922 +15050 +7829 +15039 +9427 +18434 +2757 +6380 +6816 +19475 +4465 +1804 +19770 +10633 +6774 +768 +5538 +14069 +4741 +18234 +16102 +7251 +2454 +18843 +9332 +5262 +16198 +9344 +2407 +10856 +1814 +12693 +3466 +12384 +14777 +2629 +16280 +9697 +6262 +6032 +6644 +5723 +8028 +8690 +13169 +19321 +3191 +2749 +10658 +8676 +4347 +17068 +19545 +2317 +2813 +8048 +17365 +16087 +5632 +7524 +5071 +16539 +3634 +18685 +1946 +12445 +16760 +18307 +8191 +6206 +18602 +2410 +11873 +8244 +2398 +9473 +19936 +14607 +13920 +4149 +17223 +13809 +9226 +5991 +16764 +19141 +5709 +8294 +1017 +14026 +13389 +10963 +19174 +8850 +16622 +8344 +11248 +3721 +16117 +5731 +2810 +12726 +3596 +3072 +18576 +13369 +5425 +5430 +8846 +15783 +9879 +12443 +4728 +17085 +3188 +16256 +15425 +19267 +1227 +6170 +12137 +4440 +10004 +7949 +8129 +11707 +11220 +1256 +17421 +2007 +1174 +10396 +16049 +9773 +606 +2132 +9313 +5728 +4251 +14010 +10174 +16283 +3203 +11755 +2623 +2621 +15918 +18477 +14574 +6723 +5389 +14221 +7239 +2113 +16454 +16901 +6715 +4547 +12311 +19231 +15456 +18515 +5515 +245 +13456 +15386 +19927 +13823 +13702 +19978 +12766 +8962 +18392 +11673 +12983 +19551 +11223 +12740 +5505 +5675 +3331 +3480 +15799 +19170 +14468 +160 +19132 +6284 +19458 +16980 +1611 +15836 +2937 +10568 +14133 +7288 +13865 +13763 +19851 +16933 +12944 +10334 +9367 +8276 +11863 +9117 +2688 +16561 +13508 +14352 +13068 +4508 +14538 +13431 +5919 +17369 +12828 +13981 +2997 +16843 +4373 +8359 +15842 +12756 +2176 +13393 +811 +3988 +19814 +5265 +14033 +10860 +9549 +8273 +5788 +1121 +18359 +16169 +5434 +1772 +18744 +1245 +11874 +7131 +15168 +2703 +3079 +18947 +12397 +11053 +14900 +13163 +18433 +9651 +1265 +3100 +12452 +688 +18261 +19883 +14141 +4545 +16244 +2580 +9951 +16887 +9712 +2110 +17558 +13218 +5065 +4403 +2004 +18790 +17525 +285 +19661 +3891 +14106 +4975 +1769 +2406 +2606 +9744 +19775 +6918 +15410 +16248 +13083 +5247 +16733 +4649 +7420 +19254 +2432 +11139 +16608 +2 +11832 +7230 +1347 +16937 +15047 +3078 +9306 +6563 +10611 +5911 +7459 +634 +17381 +18323 +15443 +12902 +16385 +17239 +12229 +12747 +13786 +16923 +123 +11850 +17773 +12220 +14943 +4254 +3024 +6683 +9112 +9558 +16065 +9754 +6114 +10785 +9192 +15021 +4091 +10762 +3976 +13894 +7588 +13490 +2973 +3498 +6313 +14176 +12108 +3786 +17893 +5156 +18260 +7296 +4740 +15948 +10610 +12735 +5967 +2618 +7175 +558 +16931 +14886 +17757 +13469 +1182 +4252 +16241 +13638 +6514 +12370 +917 +18078 +16360 +8323 +8702 +7892 +1787 +9268 +12665 +16747 +8786 +10053 +4096 +4359 +9432 +12741 +4991 +9333 +12123 +1365 +1734 +8892 +804 +1002 +8888 +14001 +19777 +1742 +7191 +6492 +17321 +2068 +991 +15616 +18921 +2856 +8685 +8401 +19251 +7252 +16467 +4786 +1337 +7162 +12561 +660 +18128 +16329 +15805 +8765 +8106 +13931 +4253 +1899 +8547 +9874 +10070 +19855 +7469 +9369 +10993 +18299 +14560 +421 +11541 +17590 +11107 +17359 +8500 +18818 +17552 +3470 +8992 +2177 +9326 +16060 +1450 +8070 +6250 +9581 +5212 +12286 +10537 +16717 +17325 +16510 +11787 +9036 +16108 +16005 +15393 +15649 +12496 +1824 +561 +10873 +19807 +1411 +6834 +19425 +4272 +7146 +9611 +18896 +18294 +17823 +4757 +14002 +2660 +3994 +14277 +969 +5206 +6735 +16567 +4575 +13624 +9110 +798 +15233 +15876 +13539 +16505 +15269 +12232 +9980 +15998 +7732 +14228 +14795 +3918 +11534 +7952 +11627 +16205 +16946 +17793 +9019 +3471 +1285 +239 +17953 +15475 +5977 +12189 +13401 +10815 +6292 +19903 +7327 +6760 +6556 +16262 +12474 +3330 +12228 +2534 +19901 +5445 +6362 +3049 +1628 +6325 +16137 +15806 +3920 +19692 +1698 +8638 +10448 +7519 +2776 +2619 +13450 +19679 +12958 +18504 +7800 +15653 +19708 +13496 +11813 +3969 +1617 +5836 +14118 +3660 +3449 +959 +17861 +17043 +16370 +3242 +16253 +11202 +17489 +5862 +1627 +18955 +19988 +1843 +7603 +2440 +15520 +11045 +7795 +19496 +9489 +9346 +6272 +11126 +18224 +1203 +18554 +11653 +18772 +16097 +9587 +7388 +8880 +19014 +543 +14562 +12990 +3748 +5647 +8797 +14232 +11971 +19479 +7610 +10091 +1271 +7820 +1673 +17328 +2594 +7343 +11236 +874 +3089 +7018 +16476 +2543 +6482 +17442 +67 +8750 +16804 +12381 +5006 +10131 +14996 +19473 +8490 +2193 +16635 +1165 +7183 +814 +17197 +6759 +6047 +10512 +2091 +9638 +204 +12493 +4565 +15707 +8232 +6329 +12355 +5023 +17163 +729 +11060 +6342 +14723 +11649 +16541 +15807 +10782 +8629 +6041 +11896 +8801 +17349 +10470 +9858 +14075 +14626 +19697 +6045 +6171 +9956 +49 +12119 +3902 +14407 +15065 +15294 +6202 +11537 +16072 +17906 +2861 +7833 +16529 +7693 +8692 +614 +8952 +17057 +17227 +4899 +4345 +6184 +16556 +12150 +6706 +17543 +19292 +18274 +10212 +15172 +18316 +3349 +6396 +2695 +1666 +4209 +18277 +14509 +7526 +14587 +13711 +2701 +11318 +7359 +7451 +14937 +2357 +12236 +9354 +4396 +15724 +774 +9248 +8741 +13075 +13720 +1303 +8266 +297 +12084 +10243 +16373 +17437 +4478 +1064 +15761 +8887 +3265 +7413 +14851 +18791 +16852 +667 +6673 +251 +16703 +16756 +5197 +8570 +18065 +13676 +11280 +7581 +14199 +1681 +1094 +10998 +14419 +15655 +3625 +2520 +13185 +7110 +15500 +6580 +8159 +3202 +14387 +10684 +19307 +5348 +14265 +13122 +11848 +1550 +12552 +8395 +6506 +17169 +14684 +7286 +12039 +1476 +5620 +8775 +14177 +19511 +1005 +15419 +1601 +1675 +17138 +9162 +9172 +10298 +7258 +16748 +12974 +7620 +3694 +16357 +7943 +11426 +5682 +6565 +10333 +15589 +12567 +2227 +9777 +18432 +613 +839 +13344 +12205 +7941 +19245 +14968 +15595 +19147 +11613 +1695 +7502 +13653 +16324 +803 +4036 +14420 +2923 +18862 +11313 +10819 +8182 +15715 +6773 +12703 +6414 +17412 +2858 +17174 +7742 +9877 +11493 +38 +15556 +16962 +2829 +6205 +11902 +396 +11129 +5880 +14792 +12441 +17998 +69 +13664 +11580 +6084 +3525 +9990 +7069 +12692 +11726 +6145 +16715 +10095 +4293 +8728 +2823 +19998 +11276 +11329 +17646 +8009 +35 +5078 +10708 +7392 +11222 +4618 +12078 +1442 +14970 +15156 +6881 +3971 +2911 +7753 +4560 +14590 +4355 +10084 +6390 +8986 +7987 +7601 +2294 +17913 +7088 +15866 +15701 +5670 +14004 +8526 +17111 +14183 +14182 +6203 +18037 +4071 +18852 +10211 +7609 +15179 +15823 +10365 +13672 +19276 +15221 +11722 +6340 +16977 +9780 +14231 +11031 +719 +9797 +10705 +6775 +15435 +2592 +5224 +11256 +1386 +15251 +3125 +441 +6043 +16791 +19722 +16489 +15714 +2712 +7068 +4070 +16193 +7334 +8960 +1948 +9576 +13483 +11828 +18934 +7745 +13740 +16678 +718 +19145 +9998 +18233 +15327 +13971 +2756 +9602 +11095 +16348 +97 +10999 +8721 +13599 +4590 +11814 +8074 +16174 +8943 +12654 +12045 +15975 +3539 +10518 +15246 +15548 +14337 +16401 +468 +17409 +11063 +3783 +13608 +4621 +1536 +18990 +4994 +8020 +2780 +638 +11465 +14086 +4173 +14497 +6868 +316 +2151 +3672 +6934 +12739 +1026 +17584 +15290 +18151 +12861 +8203 +17444 +18532 +17967 +15313 +16661 +15814 +14410 +9567 +8268 +1418 +16936 +17695 +14013 +5707 +15870 +16975 +17117 +11635 +18866 +16530 +10301 +16424 +9982 +2076 +19111 +1867 +9856 +8551 +13097 +1984 +11011 +10725 +16015 +371 +17 +2327 +5102 +13302 +9442 +13025 +5669 +4622 +1660 +7876 +18531 +6832 +13570 +11001 +8166 +15467 +16666 +1251 +13377 +5770 +7265 +3851 +726 +18150 +18646 +10270 +3239 +871 +7779 +141 +11644 +879 +18105 +14687 +17158 +18605 +3895 +5298 +5081 +3272 +16441 +7632 +7404 +18597 +8138 +5721 +10678 +8186 +17795 +140 +16811 +3569 +6559 +5141 +7292 +15254 +325 +12348 +11977 +9511 +13403 +14563 +8578 +8341 +18473 +5754 +4098 +19989 +9179 +5426 +8502 +7425 +2617 +9323 +8332 +13509 +3338 +9921 +16739 +3402 +6214 +15692 +17999 +14914 +18267 +4713 +8558 +6464 +17779 +15722 +5367 +15661 +3244 +12322 +4212 +6552 +6885 +14614 +15927 +218 +14159 +10385 +12655 +10478 +1455 +16632 +8738 +19565 +1549 +14692 +17387 +17918 +17168 +4199 +19484 +16932 +5324 +5631 +4647 +10460 +10110 +17033 +13275 +12807 +19811 +5860 +2595 +16139 +10339 +11386 +17716 +15566 +822 +8953 +19795 +14760 +9985 +15775 +3328 +7022 +5666 +15704 +19926 +12575 +16347 +1313 +9941 +2840 +15093 +14148 +13627 +14344 +11941 +19970 +269 +1318 +14241 +3019 +8419 +19940 +10171 +4662 +5194 +4841 +4117 +14623 +19575 +14416 +824 +938 +7891 +6103 +15516 +10614 +5925 +16818 +18166 +13515 +95 +15406 +19134 +11628 +17979 +1319 +2744 +5070 +18099 +2359 +16881 +7317 +10696 +7630 +13391 +15771 +7346 +18313 +8844 +16699 +12388 +19591 +6455 +14269 +1646 +11540 +8579 +12195 +6517 +10214 +3041 +4329 +16465 +14135 +2266 +8262 +7932 +16970 +7365 +15173 +16220 +18402 +18717 +8235 +12535 +15352 +3006 +14791 +3232 +18218 +15011 +17642 +3547 +753 +5095 +17252 +3986 +3626 +4497 +1981 +9866 +1851 +2915 +633 +3008 +19073 +1672 +16067 +1304 +2770 +17594 +10531 +1316 +3147 +17340 +8314 +4191 +5851 +19306 +12734 +9571 +7472 +1162 +762 +12501 +14104 +3462 +12118 +19537 +10867 +16985 +17121 +10331 +7207 +19291 +14819 +19171 +16103 +1810 +11822 +10167 +5644 +2750 +11956 +2638 +13430 +8726 +15164 +16921 +14834 +3228 +13214 +12320 +9083 +7657 +9446 +14592 +14480 +11566 +17878 +625 +1444 +19721 +16743 +17076 +2512 +19734 +5115 +8468 +16031 +6970 +12674 +17941 +12439 +16286 +15833 +611 +8489 +15367 +1186 +12645 +19794 +12851 +15045 +5815 +13926 +7450 +5447 +5587 +10840 +1473 +19572 +10193 +4492 +1052 +13756 +13386 +14158 +15816 +17053 +19329 +19381 +4953 +8058 +4528 +12776 +18810 +2164 +9786 +16531 +7587 +17128 +6062 +15194 +8386 +15312 +4862 +10516 +18457 +15501 +8014 +5049 +18686 +9979 +13290 +15217 +8258 +11885 +4992 +4804 +1051 +6808 +8996 +11544 +11998 +15433 +2593 +3503 +4553 +11775 +11830 +11155 +19097 +2350 +16824 +3867 +16311 +4512 +886 +9208 +17629 +15605 +10366 +15288 +1553 +14342 +5401 +7079 +4521 +17777 +13521 +11149 +10379 +18112 +11283 +19934 +11485 +11910 +14617 +14283 +514 +19618 +13292 +9308 +19877 +1636 +17647 +13923 +370 +14766 +15962 +10177 +9713 +18321 +14160 +6218 +13667 +5873 +8849 +10158 +7221 +6839 +11160 +11390 +147 +5220 +6953 +934 +13510 +15121 +15338 +1278 +1170 +7464 +2101 +11571 +9134 +7423 +6336 +15471 +17458 +7918 +3378 +7319 +19483 +8734 +9613 +2720 +11265 +6765 +8372 +16232 +10871 +8774 +19504 +6028 +1021 +11576 +1953 +15631 +5944 +12261 +612 +6211 +3979 +2476 +10484 +9700 +12035 +6418 +4433 +12461 +1613 +9820 +10101 +13982 +11020 +6507 +14873 +12825 +848 +2488 +15477 +17672 +6393 +11936 +13241 +7177 +18271 +16063 +5349 +378 +19032 +2933 +3890 +15297 +14979 +1748 +1585 +19406 +16633 +9888 +14586 +8125 +5082 +12337 +16759 +19325 +7031 +19274 +17178 +16104 +12095 +11438 +9745 +3021 +19471 +6770 +685 +11585 +14793 +18847 +6305 +2910 +14485 +15512 +4915 +2846 +19600 +19826 +17586 +7415 +17362 +19755 +15594 +11122 +8146 +12596 +19407 +14661 +18918 +740 +10393 +10191 +8210 +19827 +13785 +5128 +8170 +12032 +11174 +18322 +10912 +9443 +9480 +17635 +11351 +17084 +1498 +19752 +6420 +16387 +2785 +10149 +9115 +16305 +15375 +5907 +16639 +11511 +12763 +14669 +19299 +18490 +18933 +6629 +16839 +13719 +15680 +7349 +17553 +14295 +18195 +18256 +10788 +9975 +6476 +10935 +10392 +389 +3844 +19319 +17549 +1842 +10006 +10265 +6475 +9405 +11574 +14731 +8437 +669 +2441 +8966 +7289 +17410 +1950 +4738 +12818 +4793 +15009 +9634 +4324 +18380 +9530 +9671 +17036 +6731 +13583 +7000 +9502 +12830 +2057 +15810 +19666 +2205 +4409 +18016 +410 +5606 +5739 +13569 +4962 +18270 +5416 +6407 +13061 +9050 +1272 +8997 +13365 +5845 +13713 +14425 +2265 +10491 +592 +18033 +6223 +16491 +15591 +738 +5190 +826 +5386 +2798 +293 +19242 +14475 +6215 +10246 +9257 +6672 +7032 +11375 +17202 +11877 +4074 +9239 +14305 +13632 +14683 +5833 +505 +3046 +14960 +11614 +3942 +14130 +5686 +16352 +10081 +8296 +13752 +8627 +1530 +338 +448 +13840 +18948 +8403 +9402 +5948 +19030 +4638 +176 +2649 +15559 +1741 +8406 +3346 +6269 +15673 +10151 +5292 +1710 +11436 +10951 +978 +12139 +6625 +1317 +8876 +5074 +16409 +4326 +3646 +2822 +10979 +11204 +4072 +3444 +16458 +4057 +16554 +1263 +3146 +5159 +15116 +6853 +2358 +18281 +8954 +1703 +3167 +8099 +12532 +7680 +19549 +5730 +6675 +10926 +13175 +915 +2866 +17992 +3420 +9885 +8557 +4295 +2335 +9846 +11275 +9523 +11905 +19419 +15062 +8896 +10465 +7295 +15543 +13428 +4676 +19146 +10621 +8863 +15911 +17798 +18672 +10390 +3336 +7783 +18747 +12730 +5523 +13064 +11019 +6104 +2153 +12998 +19804 +8382 +11757 +7257 +1593 +7521 +3356 +18181 +17710 +2027 +6584 +16875 +16215 +8757 +14496 +15645 +9207 +13318 +10850 +10286 +654 +6096 +16083 +6467 +17575 +4066 +16453 +9550 +6660 +7766 +19152 +18049 +10443 +41 +13514 +16334 +7436 +12473 +16583 +14053 +14297 +15656 +12490 +6886 +19208 +10432 +6377 +18863 +256 +10634 +2990 +7431 +19759 +6002 +2585 +9536 +3886 +6257 +16525 +15323 +1707 +16165 +15648 +5876 +1048 +4265 +15344 +307 +17066 +5471 +7759 +19561 +8494 +11599 +13033 +14924 +13999 +3749 +12344 +4163 +19128 +19181 +3887 +2925 +12744 +12087 +17291 +11311 +3662 +17814 +10228 +19105 +18335 +19362 +5667 +18221 +17856 +9600 +6035 +5779 +17796 +11086 +15926 +3731 +1908 +16463 +320 +3222 +1451 +14375 +14012 +939 +11594 +9718 +11737 +15853 +14296 +13639 +14856 +9824 +507 +4520 +15803 +16938 +15506 +16470 +11068 +17334 +585 +8791 +7489 +19713 +12283 +7707 +3277 +2922 +10703 +13287 +18629 +4452 +15291 +18096 +5059 +9210 +14525 +11264 +4363 +15985 +7696 +7087 +3120 +1823 +11117 +14340 +16978 +2399 +13609 +7387 +1223 +10276 +3259 +628 +10430 +13209 +1452 +14247 +5018 +7081 +1868 +14663 +11959 +3143 +1219 +9732 +14714 +13594 +1358 +17261 +12848 +9178 +3235 +7091 +4715 +16349 +3386 +4183 +2654 +15049 +11768 +6525 +1254 +19219 +17371 +2554 +19981 +14935 +19342 +3506 +1253 +6705 +5429 +12177 +8613 +16303 +15514 +1978 +4585 +8365 +10140 +11950 +10947 +10651 +16127 +104 +16307 +1472 +10463 +12915 +1869 +17835 +8275 +10313 +11693 +18844 +14498 +12745 +16452 +13059 +19867 +16929 +5899 +1169 +5028 +6875 +6076 +3645 +11112 +12965 +7086 +13105 +11584 +19634 +14686 +7704 +16408 +16825 +14870 +13901 +11735 +10240 +4206 +4372 +6818 +6966 +7073 +8078 +503 +10373 +19271 +7351 +1416 +9702 +14438 +4273 +16421 +10187 +17427 +17797 +19366 +2521 +19397 +12893 +18562 +14896 +7338 +17932 +14203 +5328 +14418 +1519 +1737 +13480 +16145 +9785 +8458 +14726 +6824 +3310 +5844 +16095 +6259 +7621 +407 +12332 +1768 +14428 +2949 +12868 +2459 +9959 +4235 +2453 +15633 +18381 +18265 +10798 +19553 +6570 +19683 +13912 +4956 +16701 +7492 +3388 +8057 +7060 +16726 +9445 +5902 +9935 +17300 +6714 +86 +9015 +6465 +12651 +13030 +6620 +7225 +10315 +7121 +9095 +13362 +14194 +16129 +5679 +13769 +5767 +13162 +14483 +5204 +1019 +3174 +1449 +2905 +6050 +16589 +17834 +13582 +6598 +12528 +6971 +13350 +6102 +16308 +17064 +12426 +10974 +8112 +1864 +5856 +10451 +17559 +12475 +10499 +8163 +13683 +3580 +7045 +18352 +7551 +3700 +10320 +12245 +10160 +9726 +14578 +2031 +5491 +10494 +15716 +15909 +9305 +4371 +1955 +2396 +14843 +607 +19224 +12076 +11346 +13781 +2080 +19571 +1340 +7270 +10090 +15693 +6521 +2337 +10535 +15053 +12504 +7303 +3973 +10345 +18965 +1756 +2566 +2982 +695 +11573 +12760 +19702 +17811 +18104 +11103 +8990 +3733 +13172 +3842 +7247 +16693 +19401 +432 +15256 +15841 +6010 +11327 +1286 +10485 +1971 +1866 +9683 +13271 +14751 +5999 +2766 +5272 +7797 +8620 +2299 +11316 +11133 +5782 +14115 +6175 +7272 +5107 +2945 +16915 +18776 +11021 +13335 +5957 +14566 +15760 +3989 +3800 +7457 +4890 +11228 +2531 +686 +6115 +15981 +14391 +13766 +17630 +17154 +9555 +13019 +10872 +11234 +5340 +1863 +1370 +14740 +4696 +5940 +16460 +13689 +16637 +8303 +12407 +5600 +9533 +19776 +18427 +17960 +4938 +10310 +4055 +12240 +11317 +548 +12440 +11530 +3898 +1574 +9605 +6099 +7442 +13387 +16315 +5396 +17035 +17877 +15302 +7410 +10299 +17225 +16548 +10487 +5377 +19773 +8735 +6194 +11480 +17802 +10625 +7793 +5671 +13685 +15966 +6278 +4336 +455 +15178 +11860 +16209 +7867 +8376 +3062 +12403 +12938 +8787 +17420 +9419 +4813 +5622 +13646 +10469 +2914 +8238 +5269 +13951 +6064 +6140 +18419 +11691 +14216 +14502 +15767 +16925 +10567 +6489 +14825 +2124 +11036 +19312 +6526 +1417 +19688 +15686 +1945 +8192 +250 +11190 +133 +14045 +1532 +8040 +6543 +9400 +3492 +19554 +2147 +19503 +13124 +3688 +4002 +14845 +8580 +18435 +14868 +5075 +15577 +354 +19876 +19144 +11075 +10962 +6633 +16722 +14885 +14299 +11838 +13305 +12772 +3932 +14951 +17939 +3031 +7323 +6950 +852 +13363 +14899 +2280 +16826 +3702 +18951 +1091 +6722 +11533 +13493 +10468 +11598 +12737 +6310 +577 +14609 +5214 +1762 +17122 +11048 +13327 +8569 +18535 +19894 +6281 +9934 +2634 +14894 +10866 +3475 +4038 +9783 +1273 +17957 +14467 +14236 +13904 +14214 +14541 +2074 +12175 +12103 +15535 +4486 +4398 +2964 +1949 +10382 +4874 +7688 +15407 +13482 +17181 +11261 +13127 +19277 +2023 +6077 +7275 +9377 +8527 +15550 +1333 +5219 +9526 +12349 +8185 +16890 +1711 +15551 +15787 +3093 +14372 +14809 +12968 +10799 +2962 +17273 +13548 +8261 +10261 +11642 +622 +1904 +2162 +17288 +15265 +17126 +12512 +5824 +11646 +11960 +17214 +19724 +9793 +14379 +2120 +16520 +16141 +8193 +12282 +15688 +10020 +4837 +7787 +10477 +15160 +10748 +705 +400 +460 +16391 +15749 +19480 +12273 +17088 +14699 +18840 +14936 +14023 +7279 +10559 +5689 +2224 +1153 +7903 +3552 +16959 +17667 +17120 +18425 +11482 +18264 +15253 +1657 +7214 +14136 +11004 +8188 +16316 +9540 +3864 +18474 +162 +18604 +902 +12929 +4256 +8560 +1027 +8281 +11085 +7595 +5993 +7698 +15978 +19090 +3045 +4970 +16614 +9643 +9131 +12238 +19655 +10226 +15959 +8282 +11286 +2984 +11394 +2133 +19586 +761 +4551 +18276 +13194 +7337 +14770 +19065 +15191 +17765 +18905 +11882 +12131 +10882 +18656 +19550 +596 +9725 +13297 +3693 +2428 +16485 +9569 +4201 +5363 +725 +5273 +17098 +8931 +362 +10770 +10340 +1940 +3013 +6516 +10542 +3308 +16371 +18478 +9044 +2307 +284 +1888 +2325 +18719 +9845 +423 +5781 +3273 +1467 +11749 +9641 +626 +7718 +13674 +10922 +15280 +6896 +7379 +10062 +9297 +17937 +11474 +9111 +4461 +19049 +8298 +14370 +1947 +5145 +18411 +19017 +12477 +11189 +16061 +1060 +15899 +5859 +19452 +16459 +11762 +742 +10520 +11469 +19933 +15974 +7395 +8820 +6119 +14287 +19360 +3181 +12085 +3968 +941 +11968 +11166 +1097 +18215 +14204 +16455 +2732 +13499 +6439 +1376 +18674 +14211 +13531 +2935 +4308 +791 +10316 +2696 +19330 +2037 +5054 +1723 +17714 +5760 +11347 +7117 +17910 +19498 +2365 +16898 +7394 +8668 +16335 +14940 +2094 +6481 +14309 +7661 +3493 +2715 +18742 +13598 +12327 +13445 +12533 +3927 +5610 +15112 +3957 +249 +4463 +16670 +776 +9071 +1894 +4716 +16708 +11464 +10753 +1725 +11680 +2220 +16285 +14743 +10295 +12075 +17333 +15529 +16010 +1641 +18549 +10728 +8515 +17018 +9765 +18745 +1754 +2877 +13622 +3889 +1753 +5032 +6425 +3998 +13268 +18086 +6124 +9672 +10994 +12976 +1493 +8039 +6802 +312 +11252 +18244 +19843 +18273 +17254 +7764 +2940 +16572 +8587 +11556 +18522 +3419 +11039 +14084 +3649 +15987 +7172 +14810 +7016 +17060 +13877 +1871 +11376 +5176 +4584 +12354 +10178 +18832 +18569 +14443 +219 +2150 +18328 +2311 +2370 +5488 +17743 +1970 +7738 +15562 +3845 +1146 +1100 +916 +1308 +1537 +19514 +9833 +3848 +16558 +8033 +1404 +6013 +6291 +1378 +19580 +7096 +17146 +3862 +17870 +846 +12736 +2855 +10034 +15604 +9230 +15270 +101 +440 +723 +2615 +13576 +3211 +19581 +17771 +11631 +3647 +1835 +8641 +4827 +8098 +13977 +10411 +17632 +16948 +2608 +373 +2233 +8980 +18729 +9277 +14417 +5691 +14108 +15746 +11056 +16425 +6320 +13618 +15906 +11572 +4595 +8773 +13120 +964 +15387 +15092 +9421 +7151 +17886 +4730 +16956 +16296 +3434 +10851 +9667 +4573 +10449 +6927 +16545 +12056 +11187 +892 +6889 +3017 +14949 +10702 +563 +17595 +17625 +12779 +713 +5529 +15189 +9512 +10591 +7277 +19636 +5160 +17784 +13013 +2258 +9892 +15846 +1049 +16321 +18912 +18534 +2541 +14494 +7645 +739 +593 +7652 +14119 +706 +4843 +248 +4645 +14126 +16547 +11262 +14393 +3967 +10667 +6900 +10923 +7138 +1350 +4868 +313 +19297 +18600 +11524 +4810 +5183 +11776 +2438 +2011 +15691 +6454 +1059 +13072 +1092 +6315 +16500 +17965 +6113 +12995 +17171 +19764 +14942 +2058 +16433 +2709 +159 +7077 +9580 +16157 +7733 +1964 +9762 +18158 +16611 +19454 +17005 +16738 +4569 +17220 +17232 +2063 +10749 +7924 +3763 +7563 +5801 +11663 +2951 +2760 +9996 +16059 +11545 +14519 +14320 +14530 +16587 +9330 +13952 +7913 +9424 +3939 +12379 +2805 +19612 +14863 +6327 +4216 +8927 +3457 +4161 +5192 +6276 +11930 +13811 +4947 +1551 +11051 +12770 +2603 +1568 +10025 +9815 +12170 +10886 +14733 +6125 +16147 +7647 +2089 +127 +5617 +4269 +9869 +211 +8821 +7182 +773 +3282 +2024 +18935 +18489 +9693 +12551 +2510 +4368 +15201 +11091 +13418 +8794 +16934 +8565 +7115 +14739 +12751 +9292 +11110 +797 +8362 +18954 +9219 +1305 +3852 +13234 +7947 +15610 +17274 +8364 +17507 +3799 +19316 +629 +5821 +5380 +9772 +8680 +2069 +9957 +19628 +14470 +1490 +6322 +9217 +10894 +15912 +19072 +7546 +18711 +9351 +17344 +16406 +6415 +3959 +11623 +9160 +16294 +7222 +10098 +18890 +19443 +734 +14258 +15864 +18055 +18246 +6952 +6609 +8740 +16001 +9927 +6227 +11079 +8645 +2831 +11816 +14363 +13110 +7886 +4339 +13742 +10878 +3590 +4367 +18580 +18164 +15478 +8747 +8293 +3047 +17462 +12161 +15668 +11724 +10645 +1356 +17465 +11186 +3727 +17337 +659 +2360 +17991 +19640 +18114 +4882 +8533 +10305 +10492 +1688 +3665 +10652 +19392 +11198 +10619 +8539 +6588 +202 +17699 +10700 +12293 +18008 +1095 +1288 +7094 +6729 +5572 +16779 +10148 +10890 +15373 +9518 +17190 +18618 +4302 +15469 +11796 +5261 +122 +17466 +19447 +3274 +9795 +11991 +9519 +5778 +9665 +1635 +18131 +15427 +17103 +8905 +18095 +11588 +261 +7822 +62 +11419 +10227 +10517 +7116 +16457 +16965 +18396 +8595 +15547 +3528 +7210 +9254 +11244 +11212 +19311 +4615 +8425 +18269 +18696 +13793 +5586 +13113 +5564 +17045 +2481 +6008 +2795 +4734 +18793 +17000 +1816 +10467 +9492 +15747 +3426 +9901 +17713 +18100 +17977 +18676 +4190 +6447 +7129 +19236 +3460 +7909 +4431 +19501 +18626 +5369 +12849 +6301 +10500 +4374 +4567 +17293 +6733 +2963 +17132 +605 +8854 +12211 +4789 +13052 +10774 +2017 +8015 +2614 +5858 +235 +12576 +14343 +4922 +10671 +11567 +15774 +14374 +4541 +19063 +19127 +7798 +8865 +12836 +2487 +7329 +1374 +17585 +15231 +7887 +178 +9238 +4853 +11334 +5582 +3938 +2466 +4554 +16792 +13012 +6969 +8270 +19735 +3772 +73 +5399 +12822 +2969 +2449 +11242 +16487 +10213 +2400 +16873 +16410 +858 +18653 +5307 +17497 +185 +13165 +6163 +4049 +13697 +3059 +4869 +1807 +17432 +16156 +10456 +17152 +12289 +2602 +8389 +19662 +15718 +5722 +11290 +10880 +9857 +887 +18643 +8479 +19928 +8683 +12984 +5602 +8661 +10905 +10283 +6754 +169 +14716 +9011 +8027 +14197 +6600 +14988 +12833 +14043 +14173 +4865 +15399 +16534 +18426 +18932 +7367 +8195 +19627 +3233 +11855 +10906 +1306 +3002 +12252 +15698 +3686 +8691 +7433 +6355 +515 +15365 +15792 +6835 +12959 +2492 +12167 +13079 +15476 +4448 +5609 +14565 +4766 +19833 +10251 +7996 +12524 +1900 +11099 +19864 +10577 +17485 +13293 +5513 +7649 +1258 +9091 +16369 +19542 +16597 +18165 +6074 +1919 +15933 +5830 +9029 +6037 +16183 +11732 +19318 +15450 +15849 +13164 +19983 +16278 +15728 +3899 +3546 +13134 +9193 +823 +5110 +2705 +17755 +17570 +17742 +324 +8350 +18757 +1701 +16686 +280 +5384 +18751 +14360 +4879 +12368 +1406 +15391 +16833 +18391 +11402 +5553 +12571 +19140 +6217 +12347 +17947 +19528 +17166 +2974 +18291 +6809 +6669 +17279 +19214 +3588 +16084 +9191 +495 +11090 +14771 +9669 +5983 +12523 +936 +10085 +4671 +16565 +18606 +9997 +3237 +4035 +14838 +14312 +19151 +10384 +3448 +2451 +17883 +15967 +11651 +17093 +10507 +19902 +10324 +17904 +19882 +19900 +14545 +9190 +3769 +12907 +1746 +3257 +11883 +6231 +11105 +8805 +8336 +5755 +645 +19052 +14412 +17748 +6387 +12985 +1393 +6764 +3877 +9361 +11440 +12346 +675 +12017 +4707 +13942 +10989 +10650 +12102 +11636 +14206 +19305 +2727 +15731 +9468 +6149 +14234 +12074 +16152 +7915 +5151 +12725 +8674 +4204 +19991 +13550 +14573 +17671 +17651 +27 +2640 +3554 +3361 +19783 +66 +2573 +12249 +14556 +5008 +61 +4264 +8263 +18409 +80 +6667 +3530 +9801 +7316 +7517 +17828 +52 +952 +5209 +5982 +3830 +7134 +15370 +11547 +13602 +6708 +16806 +19590 +5301 +5633 +8908 +9950 +841 +16730 +2109 +6060 +6915 +8353 +13086 +9952 +9301 +9449 +12165 +13024 +946 +19044 +30 +12837 +4968 +7857 +15117 +9839 +12898 +13051 +1341 +4535 +4982 +8334 +14171 +4635 +8435 +14079 +17272 +5774 +11843 +7989 +17933 +5953 +3467 +7520 +16231 +11182 +15613 +2789 +15163 +12458 +19614 +17393 +6277 +10314 +2354 +14161 +2824 +11909 +4770 +15581 +18891 +4826 +13497 +12040 +3540 +5560 +4277 +16318 +6738 +19472 +19344 +1475 +1705 +7973 +12852 +9735 +9016 +9592 +4391 +19209 +961 +7515 +14681 +7568 +2864 +17477 +8571 +9121 +3401 +14306 +8461 +14476 +10724 +4705 +15333 +4039 +1465 +2477 +2183 +17209 +18621 +17140 +8833 +18347 +19269 +17183 +19213 +13603 +18152 +6595 +15114 +11868 +17711 +2533 +591 +16742 +4052 +16053 +700 +8729 +3256 +19633 +18336 +8724 +6702 +1671 +19818 +382 +16 +16447 +5683 +5248 +4749 +6758 +11708 +752 +12797 +1494 +4703 +5157 +183 +19955 +12015 +9076 +15188 +15625 +19415 +7757 +11507 +15700 +19069 +18963 +14164 +11888 +19283 +17157 +394 +14840 +14513 +464 +11163 +15624 +4739 +18529 +12859 +2955 +3135 +3061 +4931 +6718 +10241 +17568 +17791 +19036 +4180 +11739 +15131 +14618 +17382 +242 +13273 +19837 +12625 +10363 +1344 +18788 +19028 +9907 +9261 +6656 +5113 +8095 +391 +3337 +16601 +1735 +6685 +10663 +913 +1721 +18056 +6468 +17737 +3098 +7917 +15449 +14897 +2475 +10296 +7658 +9244 +7393 +5544 +9486 +18857 +1685 +19229 +2170 +14208 +10582 +3690 +1221 +10675 +2753 +9972 +8881 +6155 +19762 +4474 +8736 +16992 +19671 +19979 +19110 +17617 +18592 +6479 +14134 +8375 +18015 +14678 +1071 +4820 +14020 +11147 +878 +10569 +6830 +6891 +439 +3795 +9936 +13331 +17982 +381 +3507 +6031 +12832 +15267 +6461 +6522 +2719 +8568 +3285 +4905 +15241 +1173 +11857 +10741 +15871 +5812 +4217 +15939 +11997 +273 +9654 +15536 +16036 +15105 +15708 +4665 +13862 +2954 +6634 +13320 +9861 +8301 +14575 +6778 +9339 +11272 +4880 +12945 +18349 +12218 +18024 +3129 +17170 +18168 +17759 +1360 +9435 +15989 +3431 +6851 +14891 +14738 +7321 +9336 +4558 +9461 +3548 +10630 +16000 +10483 +9918 +19210 +19569 +19896 +11083 +18936 +7653 +14225 +1514 +19748 +9034 +15258 +1516 +3770 +12785 +3781 +11315 +12424 +6892 +10414 +12314 +3157 +5096 +9166 +15303 +2189 +8838 +18492 +2680 +6426 +10697 +12333 +1503 +10769 +4426 +1744 +1667 +9736 +13034 +3518 +14252 +39 +19635 +7834 +19081 +8712 +6510 +2262 +18516 +16549 +18310 +1487 +6143 +3010 +8938 +8199 +19665 +17116 +12405 +9583 +9768 +14913 +7445 +7284 +1648 +17852 +16507 +19845 +8220 +7633 +11504 +16816 +12246 +9138 +19042 +2111 +2103 +8101 +4376 +19343 +17733 +9891 +11721 +14944 +13011 +7233 +13709 +7497 +8891 +18775 +10374 +9212 +9214 +18577 +8814 +11918 +3865 +3897 +8919 +18946 +18640 +12360 +17318 +8739 +383 +16762 +3873 +18292 +7537 +8677 +15824 +18232 +3194 +5787 +12028 +15332 +290 +12153 +1439 +5179 +16210 +19941 +13131 +11859 +11461 +17375 +14773 +146 +17014 +15061 +33 +9267 +16428 +9417 +12916 +9472 +1670 +19143 +16099 +5207 +8894 +11279 +16501 +361 +17180 +2569 +18449 +19718 +500 +19966 +3750 +4579 +16723 +8076 +4322 +18058 +17470 +4795 +13477 +5350 +6955 +5634 +14198 +3537 +13970 +17670 +6253 +15321 +10971 +328 +13640 +18502 +17659 +17541 +8991 +5567 +2298 +11490 +12821 +12527 +1208 +4152 +8764 +19745 +10821 +12727 +5492 +7025 +4223 +6156 +2073 +2799 +12353 +15820 +11932 +9629 +28 +8407 +9738 +11246 +13471 +12611 +11138 +6945 +6367 +7170 +7942 +13479 +4743 +8982 +8853 +6547 +12207 +19828 +3952 +8217 +538 +16993 +10727 +19123 +19118 +18574 +19974 +16464 +13631 +16828 +206 +13190 +11750 +658 +7879 +10083 +15459 +17922 +1443 +17613 +18045 +3329 +2714 +2587 +11538 +153 +10941 +11061 +2827 +2841 +15304 +13414 +3825 +4737 +1070 +4366 +15585 +7775 +2006 +19929 +1458 +7208 +15862 +9717 +7930 +10688 +18001 +9434 +4298 +1216 +7871 +15060 +15934 +9575 +12632 +549 +3870 +16910 +5007 +7226 +7174 +9203 +139 +4623 +12201 +15495 +18009 +3487 +8800 +13607 +4725 +1879 +8289 +10371 +19138 +16200 +3373 +6998 +16566 +15488 +837 +14529 +18170 +4815 +8308 +4611 +9564 +11694 +9410 +15106 +4664 +10041 +1510 +10835 +11841 +19533 +18327 +13441 +10486 +91 +4405 +9995 +1343 +17137 +13673 +19595 +10005 +14806 +18703 +14991 +17962 +3464 +11582 +13716 +14196 +7741 +8581 +1460 +18501 +5019 +10733 +1780 +4934 +9157 +19518 +7796 +15493 +13257 +10092 +1524 +9415 +7140 +18177 +8151 +4263 +7494 +3088 +10876 +19832 +16850 +6829 +2498 +18806 +4042 +15615 +19469 +4858 +18851 +13180 +11382 +13199 +533 +1464 +17678 +8929 +12911 +8209 +13900 +8388 +950 +11406 +11319 +1895 +9430 +199 +7061 +11799 +9794 +19258 +11861 +4923 +13227 +12434 +18900 +13917 +7992 +9379 +18004 +9398 +15494 +13617 +13277 +8486 +2229 +6800 +17394 +7196 +132 +17662 +8066 +11308 +18061 +7760 +2653 +19492 +4476 +11177 +17404 +1649 +12086 +5101 +16246 +15982 +16860 +2301 +17193 +14664 +15780 +3309 +85 +14415 +15586 +10800 +8965 +9384 +2047 +3118 +13551 +13157 +14022 +6192 +7371 +12258 +5589 +2697 +13140 +1495 +10028 +17589 +5970 +19410 +14039 +10096 +19607 +7758 +4702 +14821 +7755 +15005 +11592 +16602 +5062 +6178 +15634 +8306 +5969 +9557 +6840 +11698 +2913 +6519 +5613 +16986 +1618 +11728 +16964 +9827 +19768 +16351 +16081 +2041 +20000 +19840 +425 +16736 +5961 +9537 +7053 +7328 +18140 +17990 +5379 +2408 +16744 +10723 +13309 +18235 +532 +19810 +10423 +149 +5716 +10557 +8693 +6640 +16555 +4974 +16798 +11157 +7332 +17008 +9126 +4525 +6186 +15576 +8913 +8659 +11829 +4365 +1107 +1802 +9291 +197 +5368 +12778 +9264 +15612 +11287 +18333 +3699 +19486 +6968 +11494 +2145 +13340 +5803 +13996 +14826 +17842 +2556 +13613 +3740 +12562 +2313 +14665 +13324 +19985 +12914 +19182 +8045 +10325 +18876 +18386 +5056 +18655 +19922 +4245 +5120 +15460 +9364 +12080 +17101 +8511 +14332 +4612 +4782 +8532 +15298 +10424 +757 +8839 +5752 +16955 +2341 +3642 +5541 +5034 +4059 +12266 +18647 +8816 +781 +13267 +12622 +10514 +18828 +3037 +14938 +1907 +187 +17248 +16877 +5664 +18680 +16663 +15362 +10546 +8207 +771 +13824 +7488 +17846 +5690 +19954 +18339 +2900 +2687 +6356 +3583 +11656 +6225 +13465 +7291 +9296 +18139 +14052 +18149 +17484 +11145 +2560 +11009 +10813 +10828 +4193 +1624 +6162 +8175 +17588 +11955 +18029 +10115 +1322 +14889 +4515 +4691 +17524 +17787 +6618 +1481 +7508 +16484 +12415 +9174 +18111 +14062 +2897 +7417 +11700 +7743 +16106 +6174 +2279 +7390 +13408 +177 +4280 +14347 +12790 +9561 +16586 +14129 +16766 +9003 +14523 +10123 +12005 +15650 +310 +9924 +19436 +10417 +15540 +75 +8871 +10116 +15314 +15818 +14055 +16217 +7665 +728 +13464 +7945 +2752 +18395 +16814 +11817 +6977 +18240 +11923 +980 +15882 +17301 +19982 +15905 +14945 +13099 +7263 +14413 +6051 +7803 +4142 +2902 +2056 +2865 +799 +11741 +15907 +587 +14784 +10686 +336 +1854 +225 +142 +3592 +13961 +10503 +10488 +19160 +12375 +911 +2009 +2042 +17563 +8723 +17424 +4129 +11951 +5546 +13500 +11456 +14142 +13666 +9418 +18587 +15896 +9082 +5196 +18320 +19615 +17551 +9064 +10565 +4500 +14585 +16436 +12483 +1840 +17899 +9362 +9265 +5914 +11898 +11167 +9854 +4034 +5603 +8410 +3760 +19308 +17423 +16598 +15754 +8761 +6956 +3490 +3789 +12964 +13390 +10810 +12432 +3838 +3940 +12895 +15567 +15108 +7453 +8940 +5738 +11901 +6198 +3397 +14695 +16878 +5909 +13232 +17926 +3679 +3238 +7424 +15736 +5806 +19995 +7589 +88 +9062 +8669 +19248 +11074 +12419 +3215 +4120 +3170 +16863 +1817 +522 +4447 +13208 +13705 +6716 +6302 +10037 +6181 +17873 +6654 +16859 +6287 +19237 +16149 +1923 +891 +12891 +18735 +9451 +15936 +9271 +2738 +4239 +18558 +18238 +15856 +19092 +14689 +17996 +6589 +9790 +3509 +1147 +11270 +15614 +5257 +1000 +16135 +6852 +1573 +584 +126 +17694 +16945 +12143 +18584 +17415 +2443 +7664 +1929 +14887 +3007 +1571 +5508 +18113 +18537 +19310 +14948 +6219 +19055 +9327 +19233 +14977 +19158 +17198 +18438 +1297 +19463 +9834 +2185 +289 +2174 +3279 +18722 +3739 +5981 +18889 +8717 +6870 +12827 +16306 +6255 +15222 +3175 +10656 +8059 +5289 +6052 +10126 +3560 +19019 +19074 +12548 +5330 +15107 +18956 +5288 +4637 +6821 +11801 +5088 +5452 +2576 +2834 +4381 +13668 +11780 +11804 +5424 +14355 +6981 +2104 +16546 +8161 +10689 +18147 +15017 +12454 +18385 +2188 +343 +4839 +18811 +14270 +2967 +8460 +4386 +9252 +16823 +11793 +10022 +10653 +19374 +8698 +457 +894 +7594 +18736 +19646 +10901 +18689 +11811 +8414 +7155 +12829 +1658 +14408 +15804 +6374 +9964 +12155 +12140 +10759 +4932 +11621 +6410 +5931 +18136 +14831 +7458 +17869 +11119 +3141 +5364 +19699 +8658 +13235 +17915 +5036 +16390 +15583 +17150 +11454 +9910 +7687 +5442 +18189 +3206 +11422 +1501 +11769 +12845 +13812 +8449 +9623 +5164 +2168 +16268 +6984 +4464 +3909 +5980 +18325 +16419 +4709 +9107 +19421 +8760 +5287 +17942 +4958 +12387 +19304 +17419 +3734 +6524 +4895 +7821 +1716 +1546 +14829 +16990 +11678 +8834 +5479 +4444 +9386 +18126 +5303 +17539 +10729 +6092 +8165 +15001 +13300 +8236 +9150 +8047 +10551 +23 +3545 +1274 +11937 +8542 +7556 +10419 +10356 +17900 +17353 +9499 +3443 +1009 +19184 +2166 +3286 +4697 +17062 +8110 +18209 +10401 +4301 +1332 +10394 +6138 +12113 +15988 +518 +8851 +5053 +17620 +8265 +14409 +3035 +6495 +9881 +10823 +11887 +16272 +12427 +7411 +16009 +11610 +1774 +19133 +16576 +7034 +12846 +491 +3263 +10455 +12707 +6398 +18204 +11277 +18709 +7026 +1548 +1872 +4779 +10606 +10162 +14620 +9721 +11912 +2666 +9061 +15600 +13962 +3960 +17738 +10266 +18363 +296 +15379 +14978 +5068 +19585 +5063 +15742 +7960 +9703 +18496 +16483 +6962 +16024 +5847 +18880 +17082 +16627 +1158 +8713 +6611 +10861 +8002 +14392 +13153 +2005 +9893 +9373 +2981 +2404 +14315 +10758 +12193 +19139 +1109 +7555 +12242 +10900 +19676 +5433 +17606 +12966 +13381 +11096 +11559 +7201 +11098 +6936 +9796 +1639 +3491 +4075 +1847 +13108 +12556 +1138 +19437 +5810 +10578 +8128 +11076 +356 +14980 +16203 +17092 +6511 +11810 +2248 +7762 +2859 +19566 +15143 +16479 +7911 +334 +15087 +15355 +7859 +19225 +4031 +10309 +1850 +14217 +15213 +12197 +15837 +6239 +9542 +10685 +8347 +18355 +5353 +13973 +19705 +13486 +12640 +18286 +7935 +15308 +19663 +3828 +9048 +2102 +4413 +15773 +18959 +5736 +11906 +10121 +7106 +12519 +14813 +8283 +17995 +18245 +17528 +9664 +17514 +12975 +19180 +10776 +5813 +8248 +10809 +5714 +18275 +17511 +3266 +6741 +18541 +15913 +11962 +17903 +16954 +11969 +10747 +10817 +4768 +12361 +4644 +1078 +10225 +15292 +7541 +16364 +8121 +10849 +10508 +12672 +13805 +12359 +3415 +105 +12544 +2669 +6109 +8445 +10024 +1011 +13058 +12643 +25 +10913 +18623 +4593 +3931 +12 +2221 +3544 +15357 +193 +8483 +7874 +4218 +19784 +17358 +18553 +9388 +13395 +10285 +7980 +15753 +13612 +14110 +8226 +12962 +9413 +2444 +3839 +8799 +8120 +14653 +1806 +6353 +16080 +4093 +7975 +16968 +2983 +11979 +11746 +11862 +5064 +8423 +698 +10196 +18712 +5556 +17463 +16295 +14169 +6756 +4706 +6466 +12484 +6914 +5041 +444 +9153 +10742 +9094 +6229 +14835 +1788 +8358 +17297 +8194 +15854 +19056 +5225 +12367 +3178 +7933 +18853 +13392 +12610 +5908 +11284 +15829 +358 +8681 +243 +9363 +17255 +15461 +15770 +8428 +9848 +9961 +2207 +18578 +18187 +4603 +3604 +1631 +11597 +18360 +15034 +17912 +4234 +4361 +4811 +2907 +2663 +4064 +5274 +10457 +7662 +13062 +2525 +3350 +10254 +8331 +18062 +10376 +5816 +14534 +3204 +4854 +15587 +13195 +3990 +14365 +4017 +18262 +5611 +11794 +13077 +9691 +12285 +13835 +10349 +19198 +11448 +15544 +1689 +13986 +16431 +1164 +366 +19223 +9911 +14965 +3609 +9947 +1315 +19685 +18734 +11761 +6602 +511 +18486 +17360 +19869 +18089 +14054 +19378 +19515 +664 +13338 +12624 +19588 +13516 +15006 +19774 +717 +19102 +18654 +17433 +4752 +3812 +10509 +14495 +679 +5734 +13129 +12281 +1133 +3697 +7499 +18278 +15640 +10425 +15827 +8545 +18831 +13749 +17888 +10938 +6204 +18059 +5646 +11803 +13074 +10833 +14143 +11005 +9293 +12834 +1786 +4866 +19249 +9836 +16392 +9181 +13855 +13176 +9478 +701 +9132 +1542 +8862 +12341 +17309 +18661 +16443 +4640 +14857 +8290 +17283 +5496 +14242 +8793 +4576 +4679 +11889 +1438 +4925 +10355 +3819 +6376 +2532 +13526 +14322 +10347 +18854 +5956 +19423 +15665 +8915 +4663 +10692 +19644 +15832 +18590 +8621 +13148 +1924 +17794 +9825 +15755 +10445 +19190 +17758 +14146 +6411 +2590 +8168 +15901 +3581 +6440 +15382 +14036 +13349 +6535 +6592 +13203 +3161 +4546 +8444 +17303 +18984 +15002 +8550 +19625 +19884 +233 +7041 +19499 +18047 +4468 +17987 +13641 +10589 +17550 +7576 +7093 +19113 +1199 +1380 +9182 +12319 +19033 +1001 +17730 +13731 +7802 +19430 +6872 +8684 +6579 +8562 +6561 +11864 +6199 +15051 +15499 +11065 +18566 +5996 +13174 +4025 +7480 +15136 +17700 +3085 +5949 +7681 +9905 +11608 +13104 +17189 +7514 +3618 +3353 +17233 +8916 +15953 +18436 +13280 +5084 +7360 +5594 +6404 +6187 +10143 +3949 +14028 +4990 +2245 +13736 +17844 +11748 +15719 +17244 +876 +3124 +15721 +14763 +5663 +11000 +18467 +6098 +17920 +2939 +6864 +7719 +2765 +5726 +16995 +13325 +11705 +18849 +8292 +3368 +13861 +16438 +6196 +17304 +18376 +4872 +1275 +2509 +2557 +2340 +7021 +2650 +1794 +12043 +14059 +9408 +18205 +18720 +13010 +17627 +11010 +17859 +17921 +10917 +12656 +5336 +8553 +6975 +4383 +4116 +14693 +11771 +6093 +26 +9224 +14712 +17335 +17173 +9586 +17776 +1680 +10825 +4244 +15878 +8628 +17165 +3066 +818 +7383 +15126 +18393 +10612 +15174 +5763 +12617 +14167 +5003 +3096 +13585 +1448 +9831 +3218 +16882 +15123 +18705 +2600 +15032 +7241 +11132 +3297 +13040 +18608 +9974 +14192 +13958 +7070 +8843 +7418 +4296 +4012 +5566 +16074 +5409 +5514 +14423 +10210 +9240 +10558 +8792 +4174 +13021 +2508 +8744 +3624 +9826 +2099 +2450 +4997 +8300 +9202 +7290 +8354 +9455 +11114 +7824 +18422 +16705 +14690 +5329 +6739 +15794 +1497 +2426 +5643 +15341 +4695 +17307 +18641 +16288 +6546 +3326 +1076 +6025 +19048 +5454 +11089 +10899 +16578 +1260 +17090 +2870 +11028 +12158 +13954 +17078 +18718 +16446 +9290 +4775 +1233 +19424 +15685 +18182 +11836 +5741 +18378 +11354 +1724 +11609 +10093 +5968 +19296 +16590 +3108 +10896 +12243 +11 +14765 +11872 +12395 +11295 +17536 +18464 +5233 +995 +13449 +11846 +427 +4382 +11744 +12932 +18627 +1129 +7773 +1205 +15155 +12680 +10125 +16326 +6385 +13849 +11225 +3097 +16889 +399 +10042 +15394 +7503 +3511 +3026 +16831 +2012 +7969 +15158 +13916 +15538 +19165 +15629 +3383 +1615 +4608 +8345 +2181 +15602 +2985 +1206 +13910 +17242 +9573 +10789 +13366 +9324 +627 +10717 +18922 +2137 +6038 +8617 +14878 +1819 +12227 +16619 +7412 +15689 +13830 +14674 +15857 +18942 +8806 +3933 +5087 +17243 +17602 +4797 +9471 +12786 +6785 +15817 +12382 +5942 +13423 +657 +766 +12638 +15369 +2293 +4261 +4313 +19519 +13182 +13050 +294 +11471 +9368 +3217 +8225 +3714 +416 +12791 +19712 +11496 +10593 +1969 +1261 +9453 +5450 +2264 +1520 +17027 +14102 +8043 +16588 +17379 +16002 +7426 +4960 +1687 +12676 +17614 +7422 +2558 +10843 +16071 +16109 +11505 +9696 +2708 +15539 +15414 +560 +12428 +3582 +9599 +12300 +404 +5525 +7065 +19368 +15657 +14440 +15111 +13909 +3300 +10929 +13225 +17587 +4320 +2199 +5742 +11038 +4081 +7977 +12058 +3130 +1240 +13057 +11639 +5235 +8789 +2850 +5839 +19562 +8872 +17666 +18377 +10257 +17356 +18091 +7705 +215 +9917 +7102 +18268 +16976 +9009 +16032 +7962 +7666 +15885 +7128 +14114 +17499 +12351 +7184 +1280 +9320 +12328 +19482 +11432 +8508 +6719 +16981 +1659 +14253 +13553 +17390 +8635 +10945 +13402 +1201 +15144 +18331 +1181 +5335 +10864 +16844 +11055 +4745 +6403 +13747 +1579 +6133 +8077 +7402 +17330 +10048 +102 +838 +6401 +12303 +14218 +9804 +17107 +13621 +10206 +881 +11995 +17268 +15072 +12536 +9458 +18251 +8868 +13994 +13206 +15980 +17688 +13754 +1299 +17566 +15345 +6375 +3924 +17069 +5004 +14362 +9065 +18043 +714 +18225 +15089 +3084 +287 +11080 +7256 +7701 +18466 +15354 +11668 +3553 +14395 +19915 +18786 +825 +19835 +13575 +1831 +247 +2016 +4286 +8007 +12230 +1643 +3260 +1430 +19238 +16397 +11291 +17482 +18813 +12673 +11067 +1375 +13775 +16079 +7496 +6538 +8212 +10677 +12710 +15102 +1845 +10450 +11695 +3706 +8988 +16641 +3005 +5552 +11908 +6518 +18416 +18560 +14484 +10812 +311 +6700 +2489 +4814 +6725 +8462 +8875 +8512 +6328 +7243 +15055 +18698 +12542 +10775 +5152 +5131 +5549 +16658 +17703 +10351 +15186 +9407 +13696 +14357 +4714 +18871 +6300 +5477 +222 +5256 +14735 +9200 +16765 +4856 +13549 +1656 +18619 +13966 +2214 +5952 +796 +8537 +3193 +5094 +16830 +11210 +11692 +11994 +8379 +17603 +2092 +13879 +18172 +15026 +4179 +16301 +19341 +9136 +11273 +5930 +7936 +5398 +14274 +18913 +13555 +14098 +1330 +2296 +12950 +16616 +11661 +2529 +6732 +14431 +12913 +13222 +3720 +11359 +18399 +9565 +18706 +17075 +12089 +17130 +2672 +5208 +15159 +9660 +3923 +2693 +16745 +2934 +9287 +13990 +4122 +17963 +6070 +2628 +19739 +6648 +8719 +17515 +11774 +15489 +14652 +5338 +4892 +3433 +4484 +11632 +9010 +3033 +8230 +3200 +3977 +17847 +8202 +18675 +1119 +10056 +1413 +7573 +14341 +1036 +17108 +12098 +4137 +3651 +13379 +7904 +10641 +14976 +2180 +10944 +19356 +473 +16989 +8832 +15224 +6890 +2891 +2126 +4276 +11488 +12117 +6388 +4027 +8068 +409 +17687 +18778 +4822 +414 +18290 +3038 +6865 +10262 +14837 +10141 +9792 +13545 +18885 +4761 +4475 +3529 +19217 +19693 +3348 +7212 +18332 +7372 +12269 +3032 +11697 +16051 +13558 +2718 +19082 +6046 +11137 +6485 +9052 +14647 +13333 +5828 +4397 +7386 +8605 +5651 +6024 +5189 +16345 +15434 +14725 +4514 +11023 +13382 +7578 +13239 +4532 +15295 +11892 +9545 +2152 +14703 +18904 +8531 +15223 +18084 +4524 +74 +367 +3302 +15187 +17948 +5692 +6128 +6172 +862 +1800 +4684 +9414 +11033 +13573 +6000 +9615 +17476 +9059 +4805 +17054 +8582 +11549 +5650 +12626 +14308 +2238 +11714 +566 +5316 +2751 +4733 +970 +18769 +12843 +4658 +6209 +8830 +18171 +19497 +14780 +3730 +2661 +12284 +7012 +12277 +10008 +11933 +3142 +18428 +3667 +161 +12152 +12630 +18370 +7939 +2046 +3771 +16803 +13993 +2129 +14608 +18839 +12060 +16404 +11870 +18923 +10698 +6659 +2352 +1561 +4226 +14741 +17692 +9649 +5073 +15142 +19353 +6009 +3240 +5344 +10170 +4550 +17907 +11679 +7651 +6796 +397 +7148 +12621 +5558 +3054 +14049 +2090 +13856 +12317 +10660 +2514 +14338 +10482 +19202 +11648 +16403 +1335 +19574 +16665 +11989 +4482 +16313 +4481 +17290 +3742 +4407 +1528 +12901 +7516 +15834 +10231 +4945 +11337 +12609 +5516 +17039 +18026 +11509 +15831 +6085 +976 +18368 +2249 +17712 +16657 +2085 +1054 +1880 +6681 +8094 +9636 +18833 +14291 +7659 +11754 +19714 +17347 +1565 +18074 +7791 +6470 +2289 +10027 +1934 +12826 +19295 +17179 +6112 +15008 +17860 +9711 +12338 +18888 +9216 +17573 +15741 +6557 +11821 +3785 +13764 +14853 +5129 +15446 +1243 +2836 +11920 +4115 +19743 +1410 +16817 +18379 +3104 +5661 +13223 +4483 +2670 +945 +17124 +4863 +13476 +18169 +15448 +18006 +19349 +8378 +1572 +12920 +7204 +4230 +19243 +9426 +12260 +16377 +10194 +2825 +4908 +11368 +3711 +19583 +17367 +292 +12903 +16330 +5391 +13254 +494 +16445 +13690 +7236 +15348 +14251 +9734 +13249 +16374 +11516 +7995 +5557 +5923 +11866 +7832 +5799 +19500 +8329 +18652 +19034 +5186 +14753 +1061 +3947 +5497 +4861 +9169 +15018 +12213 +2179 +13884 +5766 +4358 +14866 +3880 +19470 +14598 +11652 +10155 +19732 +13138 +4287 +131 +16430 +7010 +4214 +12811 +1373 +9830 +13243 +3291 +12009 +14404 +3379 +12855 +1414 +13853 +14429 +4053 +3056 +4022 +9318 +7637 +3941 +5417 +16719 +8978 +16432 +19505 +12738 +1730 +16789 +18145 +18371 +3497 +8119 +7470 +17800 +13870 +18571 +6554 +11431 +14445 +7197 +1933 +15623 +12777 +7361 +13844 +143 +10883 +14593 +11806 +2645 +17512 +6887 +18030 +3128 +4333 +8911 +10198 +12129 +5486 +8823 +17547 +14551 +11753 +10950 +16379 +8214 +2067 +18622 +17927 +14904 +4844 +14790 +5246 +12162 +10631 +649 +15091 +14794 +11946 +6781 +17949 +15902 +6055 +8503 +9719 +7506 +15682 +4291 +15994 +13645 +9256 +4156 +12447 +7339 +3122 +3601 +19670 +15202 +14577 +17212 +6424 +6674 +4651 +2075 +8017 +8278 +12156 +8651 +5077 +1480 +3701 +4011 +9612 +17701 +12062 +19899 +15976 +12877 +14421 +18792 +6460 +12295 +13661 +3963 +3847 +12668 +5080 +16134 +2026 +12629 +10804 +10771 +12274 +214 +4299 +9503 +19905 +6019 +2035 +6059 +17521 +5218 +16809 +536 +6746 +12068 +9279 +19432 +15122 +10060 +10991 +6585 +1998 +10142 +3087 +11964 +1525 +1860 +11818 +2219 +14103 +13693 +5011 +7139 +13527 +5879 +7955 +9316 +16697 +8869 +11251 +1534 +4284 +733 +17527 +5569 +14351 +17418 +15542 +14860 +9767 +13284 +15301 +15678 +15219 +17311 +11024 +5699 +4445 +12438 +13540 +746 +6888 +19798 +6721 +1389 +145 +4078 +8049 +15621 +6921 +12862 +14073 +18173 +10683 +5789 +18085 +2374 +16355 +14745 +12662 +4894 +8104 +12685 +6399 +13724 +10841 +18069 +9887 +2652 +11241 +18298 +8535 +8474 +16926 +9249 +7268 +6697 +19167 +1891 +11305 +8575 +18527 +6213 +8178 +13619 +19999 +18898 +13321 +10640 +8731 +7009 +7686 +2565 +4069 +12508 +15261 +2480 +18716 +17238 +15868 +8197 +19619 +14934 +18585 +10536 +767 +13067 +8857 +18953 +16893 +13144 +19008 +4964 +9658 +4364 +9335 +8459 +379 +18910 +3409 +6979 +1409 +4906 +15490 +630 +2038 +2139 +5842 +6783 +696 +18035 +4543 +14226 +19690 +5147 +9021 +6036 +1128 +4325 +13201 +18119 +10323 +9701 +9494 +10550 +18311 +15527 +19917 +1122 +3407 +19589 +4884 +11907 +196 +19568 +6717 +13372 +13179 +16909 +14987 +6436 +14334 +5811 +15522 +1797 +3359 +15798 +8064 +7523 +11405 +15664 +8189 +14549 +19802 +2658 +3425 +14066 +15800 +11281 +16488 +9329 +8763 +10973 +3798 +5228 +3687 +13819 +9967 +3652 +8239 +8705 +8318 +10694 +7897 +9937 +11380 +17016 +10220 +12399 +17621 +1650 +17071 +14603 +15735 +7510 +3269 +17403 +4318 +3343 +2797 +3306 +3109 +5897 +3526 +9286 +14601 +10375 +16691 +10859 +16013 +14381 +1922 +8004 +7460 +19022 +10605 +14881 +8109 +16389 +9692 +435 +5 +1713 +7550 +12168 +4808 +9708 +9148 +4876 +16569 +6508 +13657 +17582 +1709 +1232 +16140 +4037 +17249 +14610 +1293 +8356 +7380 +8971 +14378 +19185 +16906 +15180 +14222 +3003 +8038 +17821 +11942 +18488 +10903 +11667 +608 +2157 +12806 +8649 +3983 +16528 +14 +15311 +17327 +13842 +19256 +16648 +184 +9485 +15858 +1309 +4362 +16655 +17745 +13184 +9441 +4408 +16967 +19195 +16827 +16671 +9188 +3824 +18471 +6317 +14144 +13056 +10402 +1108 +18707 +4121 +16297 +11827 +18002 +19301 +16290 +10822 +7114 +17389 +534 +2364 +1159 +17258 +18341 +6967 +13564 +2743 +6768 +8031 +18141 +363 +18456 +14654 +7884 +19790 +8115 +12111 +8521 +12506 +7756 +7607 +5973 +8925 +18952 +11686 +6895 +5100 +9731 +3107 +7847 +1580 +4143 +2344 +7721 +7342 +13237 +6268 +12144 +4032 +10943 +4063 +565 +15758 +18159 +1539 +14732 +8563 +18624 +7076 +9595 +13354 +4046 +7679 +5455 +14993 +13154 +4082 +2148 +10549 +12991 +5394 +4182 +12226 +16029 +19740 +16292 +4952 +19380 +10330 +10990 +17685 +6678 +6527 +18455 +17874 +9650 +18494 +3807 +2346 +6256 +11483 +1874 +14111 +10073 +10328 +692 +10003 +10563 +9710 +8137 +3685 +16689 +129 +6753 +5559 +12231 +1290 +4105 +8819 +5636 +14720 +5296 +11586 +16631 +7615 +11047 +14797 +7355 +1883 +14151 +8546 +15245 +11203 +1408 +11596 +1398 +4197 +14191 +7156 +16091 +19409 +1633 +5277 +4310 +6226 +454 +9288 +5453 +9412 +3163 +5238 +10146 +6151 +2424 +4145 +18612 +16892 +19907 +5693 +15343 +12492 +13020 +965 +4898 +17448 +4652 +10150 +17739 +16189 +4860 +4473 +8136 +8583 +7726 +1771 +2539 +8935 +12164 +12192 +11527 +5119 +14890 +9766 +2570 +16100 +9570 +14602 +16325 +7391 +6299 +14230 +8447 +5740 +6443 +14046 +17740 +10235 +19488 +13597 +2875 +17644 +16773 +1058 +12614 +13906 +16543 +16394 +14939 +14905 +11468 +18827 +18564 +19462 +13002 +14430 +13677 +9396 +5223 +16987 +11600 +8430 +6621 +13135 +12534 +4158 +10596 +14768 +3334 +16593 +7267 +82 +1042 +13700 +13928 +3593 +2728 +17783 +13616 +18860 +16477 +1884 +3341 +4455 +8523 +5360 +6744 +9787 +712 +12234 +64 +9539 +6601 +14071 +18366 +5169 +15012 +16284 +4748 +2977 +5519 +8456 +7158 +8475 +9258 +16579 +8251 +3106 +10428 +19736 +1630 +16367 +4317 +15059 +16195 +7278 +5500 +8624 +6245 +18284 +12479 +4221 +17256 +17119 +135 +9422 +8909 +7927 +10264 +13017 +7051 +12580 +4089 +192 +11988 +6610 +19422 +8392 +17224 +5795 +5322 +1995 +6348 +9236 +4495 +6127 +19207 +16255 +4836 +9538 +19629 +14271 +11400 +3575 +18824 +4141 +15209 +13699 +2686 +14671 +6450 +13634 +18974 +19253 +14865 +16388 +18247 +1431 +12762 +7066 +5608 +5924 +6989 +14656 +9274 +6333 +15028 +6261 +1608 +11467 +19389 +13533 +1491 +3458 +1015 +2794 +8610 +18369 +7108 +7727 +10071 +19320 +8491 +12090 +8934 +3015 +9067 +16834 +4963 +14605 +18596 +2405 +1991 +6503 +15378 +8231 +17919 +4285 +2496 +555 +793 +2366 +13341 +18687 +1202 +6599 +17973 +11949 +9640 +5875 +12414 +14414 +6094 +10920 +13905 +18533 +10406 +13899 +8976 +1188 +7873 +19188 +12857 +16770 +10304 +18077 +9698 +17593 +12390 +11536 +9862 +5744 +5033 +13998 +5743 +1031 +10481 +9928 +5362 +5057 +5149 +18682 +5295 +2131 +5474 +8808 +3726 +14455 +4422 +12459 +8650 +17260 +14754 +15993 +5910 +18194 +19914 +4904 +11235 +6712 +2430 +9566 +7643 +19651 +10145 +19816 +18051 +15056 +6195 +2502 +12838 +259 +8380 +13378 +5311 +5826 +19153 +13762 +14531 +12340 +19532 +4780 +15970 +5958 +17384 +15415 +11795 +9404 +7356 +11945 +8321 +10830 +321 +18044 +5786 +6319 +12251 +10016 +2739 +7976 +15319 +4319 +4911 +5599 +12753 +11303 +1210 +10440 +11546 +6635 +18617 +19729 +662 +18724 +16559 +17829 +8114 +19373 +14057 +16199 +5306 +2419 +3513 +17503 +3405 +1569 +15166 +3577 +15124 +9460 +3982 +12280 +18257 +5138 +15084 +5883 +3655 +18036 +18505 +11417 +7229 +11943 +19333 +7107 +19524 +4591 +754 +17184 +9066 +5834 +11322 +8985 +3984 +13421 +3023 +13334 +18132 +2854 +7330 +5410 +18118 +4630 +6441 +12951 +7407 +170 +12047 +5117 +683 +3403 +5236 +48 +14544 +18723 +2059 +816 +14524 +6826 +17732 +7325 +17945 +14759 +16490 +12132 +8464 +7878 +12376 +13459 +304 +11191 +13578 +3797 +16282 +3876 +14933 +9528 +3901 +16331 +429 +7880 +2484 +3398 +19582 +1596 +933 +9747 +18174 +2976 +12715 +1793 +8877 +2291 +2237 +6528 +16638 +6294 +279 +16974 +11660 +14995 +6694 +8041 +10029 +7527 +4754 +4013 +671 +7549 +18405 +12204 +9904 +11927 +11064 +7059 +14336 +4228 +15510 +1463 +1763 +17946 +1144 +14279 +15274 +9282 +16781 +17761 +14361 +4040 +9075 +19980 +4399 +13015 +8746 +17579 +17764 +18041 +7678 +3115 +14892 +13945 +4227 +1014 +5415 +570 +18354 +18808 +19142 +6619 +19507 +15353 +1381 +10597 +14597 +11939 +11383 +4369 +19836 +18420 +11034 +15451 +2912 +13181 +17693 +1844 +14101 +6400 +4602 +813 +17818 +14729 +13534 +10620 +18667 +3751 +15942 +9006 +10752 +11965 +13946 +2648 +11486 +19726 +7409 +11815 +15088 +1116 +5694 +1914 +433 +14816 +9631 +17106 +7899 +14328 +6912 +485 +16628 +11183 +17172 +7634 +10806 +5383 +16801 +14746 +19564 +19742 +13883 +13397 +15364 +1255 +2775 +12225 +7235 +19495 +3944 +17472 +1581 +19200 +7814 +3585 +19346 +14017 +899 +18850 +4157 +16396 +16035 +8732 +13932 +17177 +13345 +19379 +1145 +897 +17560 +4224 +16014 +16988 +4311 +13296 +1552 +10120 +13326 +5962 +16790 +19631 +10321 +10996 +4099 +17222 +7567 +18442 +19656 +6238 +19874 +16230 +12050 +2236 +11548 +7056 +14571 +1382 +1642 +14526 +14518 +16550 +6581 +19885 +223 +7449 +1605 +16119 +10624 +15328 +2097 +10058 +6965 +5217 +1196 +11506 +4668 +9397 +4270 +18060 +11229 +7898 +7554 +13048 +13155 +15733 +4900 +1715 +12112 +3515 +16874 +9746 +42 +13347 +11552 +1110 +3879 +19871 +974 +7765 +6836 +3355 +124 +13405 +1469 +13989 +11169 +14533 +1105 +3168 +15740 +18925 +9135 +736 +13177 +1101 +13116 +19539 +19803 +11259 +10571 +93 +4170 +2136 +2149 +8315 +5835 +5146 +16683 +14300 +8141 +14570 +16242 +10722 +6364 +11082 +13458 +8339 +7965 +6334 +16884 +12771 +14021 +550 +8998 +51 +17976 +19806 +703 +1339 +4380 +8285 +9915 +9806 +16158 +3052 +18125 +1999 +18684 +13119 +2395 +8639 +19154 +2367 +19891 +5733 +14450 +8069 +17660 +16498 +997 +1941 +7448 +8520 +14805 +6120 +11676 +14629 +186 +17567 +5106 +355 +8831 +8257 +18066 +19011 +17346 +17940 +17746 +3905 +11148 +14121 +16966 +9385 +13780 +6134 +13248 +17871 +19839 +8060 +2276 +19749 +2901 +15838 +16115 +7095 +8085 +16777 +1674 +10712 +15745 +3953 +3837 +8037 +10572 +9635 +14477 +11699 +827 +5470 +5852 +9543 +1751 +5889 +18669 +16258 +9054 +17331 +13029 +12408 +4429 +10307 +15826 +14301 +973 +16123 +276 +16012 +9945 +18403 +15923 +17262 +15662 +9810 +9923 +7320 +8457 +16911 +10992 +14162 +12969 +10473 +16845 +16935 +3251 +11115 +8087 +12731 +9823 +5242 +7432 +10216 +18202 +10939 +17401 +15813 +3446 +3081 +18924 +15029 +16668 +317 +3012 +19552 +11206 +6558 +6081 +3628 +9662 +6419 +15498 +13943 +15513 +7818 +990 +6923 +68 +15508 +15161 +5127 +4534 +9165 +3951 +8100 +14187 +16434 +18842 +10691 +1620 +14783 +7801 +3241 +2583 +10907 +14552 +19695 +3846 +13358 +2516 +6664 +13523 +1545 +11097 +17269 +19369 +14156 +17245 +17640 +14426 +780 +17131 +11392 +4758 +7819 +19694 +6701 +6 +13947 +17021 +17924 +7401 +4138 +322 +13588 +10490 +8715 +8267 +6898 +10476 +5051 +17392 +3042 +14317 +17980 +6122 +13792 +12560 +11510 +15968 +13481 +17974 +2988 +14875 +4936 +10290 +6408 +3543 +8371 +13400 +19824 +6448 +92 +5547 +6228 +15940 +19420 +2314 +14093 +19285 +16682 +17955 +18802 +7961 +15630 +16023 +11819 +13723 +10369 +3833 +9724 +14906 +18783 +8086 +12179 +6687 +19870 +18518 +4144 +16795 +4781 +14676 +9051 +16876 +6409 +5315 +12644 +1062 +2581 +14210 +14092 +18300 +7029 +15641 +9977 +12109 +13322 +1312 +7861 +8218 +17468 +156 +12623 +14235 +16161 +18642 +16952 +15766 +5871 +7614 +18929 +6142 +12679 +18408 +15070 +1377 +12570 +13385 +16243 +17250 +18081 +19255 +506 +3915 +571 +12497 +4080 +19023 +8920 +6752 +7676 +4499 +4480 +16328 +16656 +14090 +8466 +9488 +2876 +11340 +19962 +7599 +136 +11041 +1976 +13485 +15259 +6786 +16277 +17096 +6086 +1155 +1056 +7694 +19490 +14437 +7592 +19787 +5475 +17600 +2226 +18997 +9883 +12463 +12711 +6354 +2538 +13032 +13256 +5251 +9382 +15900 +342 +60 +14505 +10564 +16440 +18611 +12910 +4570 +5290 +6246 +12646 +12124 +11903 +4114 +5877 +14619 +16366 +17310 +8269 +8063 +12941 +5439 +4672 +13660 +19265 +6164 +691 +5819 +19567 +3586 +12884 +463 +3722 +9383 +15725 +13096 +18398 +16383 +2272 +12977 +14807 +9041 +1445 +4237 +6946 +15317 +1607 +11531 +11336 +16343 +4271 +19812 +6220 +2839 +8725 +13567 +3746 +7737 +8132 +5393 +1279 +19012 +9170 +12350 +7839 +19813 +840 +3313 +7600 +12378 +19107 +5762 +4650 +17686 +601 +13133 +8396 +3794 +19 +13838 +3387 +5441 +12389 +15696 +10875 +12803 +16761 +5972 +5866 +15504 +17399 +8488 +2958 +18573 +8886 +16413 +5205 +13433 +10655 +661 +6616 +15515 +7253 +8342 +2612 +3134 +4165 +4972 +782 +1829 +994 +12931 +12936 +4155 +13115 +4503 +15575 +12267 +17414 +16263 +6652 +15759 +8463 +2156 +4001 +17493 +17236 +10519 +15734 +9902 +2899 +12783 +11925 +19649 +18825 +15683 +18897 +18155 +278 +13790 +6180 +14615 +5616 +9942 +12801 +15687 +5249 +6727 +11421 +16176 +15891 +16112 +3219 +19367 +10367 +12593 +2889 +6144 +650 +12616 +7037 +8346 +808 +18834 +15385 +2616 +617 +14786 +12559 +19508 +17657 +9012 +19716 +4107 +8946 +956 +12154 +4215 +11869 +16151 +17287 +18666 +5318 +6745 +10410 +1067 +8018 +5305 +1983 +18588 +12684 +8572 +529 +13503 +5510 +6185 +14035 +10441 +1183 +7232 +9933 +12188 +18404 +3853 +11560 +15524 +789 +10959 +5000 +6490 +8541 +16202 +544 +19494 +8642 +4562 +4776 +19919 +13538 +18005 +9880 +8858 +13826 +16786 +4957 +16752 +4800 +15603 +9596 +16896 +2578 +12051 +7294 +17473 +3669 +11445 +18692 +6846 +10007 +4470 +5649 +16365 +5376 +13628 +13590 +5188 +2250 +2390 +14215 +18135 +420 +1652 +13217 +7493 +12689 +7716 +13398 +4297 +18088 +12986 +7571 +13886 +2045 +18737 +18243 +18971 +3610 +14397 +3579 +15336 +6321 +6391 +1719 +17319 +17572 +15230 +6030 +17246 +9619 +12294 +2268 +15325 +9604 +14781 +17879 +3826 +4181 +15004 +12981 +11931 +3501 +12309 +19467 +16188 +8 +5761 +5047 +7931 +9004 +17186 +14911 +2842 +1834 +19606 +12927 +12540 +17812 +13687 +17206 +9098 +16417 +11704 +486 +2431 +17720 +11230 +4778 +19738 +8234 +1102 +15532 +906 +10229 +4889 +16302 +10964 +9673 +4084 +9912 +3422 +7104 +14634 +10845 +10107 +11378 +14685 +2387 +18342 +15699 +3608 +13286 +12217 +5020 +16120 +8543 +12979 +15796 +6285 +16456 +4969 +18845 +751 +6159 +16228 +2015 +3849 +9102 +849 +13417 +1778 +2108 +810 +6833 +17100 +4136 +4526 +348 +17187 +272 +5831 +16304 +12874 +7566 +4659 +3616 +9359 +18645 +3395 +8105 +1424 +14024 +18314 +18123 +2361 +17857 +2684 +2114 +8646 +10010 +17429 +12024 +10773 +6044 +9399 +16045 +542 +15225 +7062 +17619 +4266 +9973 +17451 +11670 +749 +9490 +5913 +5705 +19084 +13556 +7908 +8753 +1939 +5448 +15643 +11219 +6994 +5668 +7353 +19668 +18092 +2999 +15511 +18207 +2458 +9269 +18782 +14041 +19358 +18175 +7113 +5123 +11606 +13263 +17892 +16218 +17449 +302 +8544 +15266 +19465 +15546 +10679 +13494 +6645 +18063 +12033 +8167 +4509 +13501 +258 +18154 +12290 +955 +13412 +12081 +7255 +3542 +11523 +5713 +16957 +10784 +19886 +6200 +12116 +10209 +10858 +18213 +4051 +5413 +3900 +5108 +16709 +17534 +19460 +8025 +8304 +7176 +9374 +3312 +4346 +8566 +19106 +6582 +14715 +12146 +18011 +1930 +353 +4631 +212 +7994 +9144 +18080 +12526 +18229 +5619 +6973 +19112 +9953 +5365 +7482 +3955 +19937 +7042 +13816 +17966 +2216 +9590 +17203 +8882 +4918 +5865 +17565 +10643 +6811 +12356 +3950 +3632 +5804 +2244 +15663 +19481 +19534 +14651 +15785 +152 +13732 +2563 +13773 +11820 +12989 +7313 +16704 +8337 +19352 +7817 +2633 +15432 +8955 +18497 +15417 +8848 +4148 +3764 +10395 +14673 +2832 +6877 +15756 +19707 +4682 +8989 +9450 +2535 +9723 +6006 +12912 +2255 +521 +7730 +277 +15079 +8893 +11751 +318 +15397 +6416 +4171 +12817 +12345 +11092 +19364 +18796 +19477 +5517 +5241 +14964 +10554 +16073 +5680 +9393 +12410 +305 +4274 +4973 +7369 +15226 +5568 +12591 +2721 +9655 +11535 +9032 +8160 +10585 +16016 +7561 +8812 +9828 +5266 +1351 +5358 +7389 +3806 +18586 +12487 +15436 +4986 +9498 +12180 +4337 +15483 +8271 +11957 +16279 +9859 +15845 +1502 +11066 +6412 +2620 +3718 +14954 +19976 +10790 +4471 +4189 +18102 +18519 +14333 +12339 +17361 +8204 +4937 +1295 +19094 +868 +4859 +19365 +3413 +1775 +13156 +5936 +5390 +11015 +2632 +11963 +7828 +6039 +3276 +5656 +17665 +7501 +1080 +9674 +11243 +7922 +11042 +6307 +13892 +13940 +9482 +8866 +15118 +6576 +1784 +17951 +1901 +8366 +17129 +10200 +16885 +19240 +16170 +3948 +3835 +7631 +12396 +19611 +17295 +9348 +8686 +12530 +3715 +3212 +9841 +8213 +1604 +11849 +1684 +465 +10127 +6136 +10256 +1758 +13323 +1538 +17436 +2032 +12036 +8338 +10050 +17148 +14112 +15592 +5090 +13384 +15492 +15339 +13173 +6208 +4736 +18764 +18690 +18124 +1396 +18789 +9741 +18713 +10086 +16093 +4799 +19020 +1485 +365 +17407 +15632 +3063 +5342 +13070 +1329 +8878 +11152 +13787 +15979 +4891 +16398 +7218 +11289 +18249 +5469 +11418 +10870 +1887 +16429 +8675 +7986 +11159 +5387 +58 +9168 +16846 +17467 +9452 +17447 +16503 +651 +5458 +6370 +10169 +10063 +18820 +406 +17339 +17417 +1384 +19709 +12480 +9303 +2448 +5043 +6791 +3077 +6666 +19340 +17611 +10865 +9900 +11742 +12695 +17002 +14767 +11634 +17841 +19678 +9097 +11650 +1808 +110 +1770 +10863 +17491 +14461 +3759 +5698 +12149 +19093 +17735 +5231 +2271 +14514 +12100 +13467 +2066 +2445 +15481 +5126 +3149 +16664 +6392 +10399 +65 +7855 +7970 +18525 +6126 +15844 +5768 +18805 +9621 +15101 +5300 +19530 +5312 +4151 +13860 +19004 +1266 +10777 +5150 +4816 +5172 +252 +702 +5823 +5863 +11111 +11508 +13339 +3729 +10030 +9843 +2624 +17380 +8679 +3709 +8051 +9589 +3365 +3280 +18010 +15057 +230 +12690 +8969 +11484 +19218 +13348 +17118 +2100 +14262 +10255 +594 +19852 +7830 +19461 +5345 +5502 +6363 +2256 +13852 +17012 +2494 +19958 +4995 +15409 +6789 +3974 +10122 +1511 +7786 +1248 +8127 +13084 +2500 +18524 +19013 +5258 +15961 +3004 +5337 +523 +19968 +6275 +8662 +19779 +10343 +1977 +15801 +12321 +16162 +7341 +9281 +14796 +9310 +19512 +19405 +19782 +14145 +13741 +19751 +150 +11990 +11568 +9552 +1184 +11165 +2873 +17804 +18743 +14394 +16041 +15676 +8228 +15025 +8795 +720 +5934 +349 +16651 +11366 +19021 +424 +14289 +2211 +8771 +5009 +18528 +17697 +19558 +3653 +11674 +14124 +6360 +18317 +13045 +16862 +17105 +14501 +10910 +18357 +13959 +17312 +11254 +6699 +1163 +14463 +17133 +1379 +3424 +19235 +16506 +13474 +2966 +750 +6251 +17774 +6665 +11172 +16449 +18591 +11218 +15077 +11681 +7650 +1566 +16690 +971 +5472 +19354 +623 +5621 +14700 +9018 +15048 +10975 +12805 +2052 +19103 +16048 +12467 +6146 +11128 +13798 +16299 +5624 +11716 +15569 +12681 +19003 +14089 +5005 +17643 +18054 +8507 +624 +9764 +430 +5139 +12955 +17633 +18795 +1088 +19129 +843 +19819 +14469 +15666 +4582 +9920 +13681 +10066 +8065 +9648 +2202 +96 +7484 +1267 +690 +16179 +3182 +5125 +10811 +5724 +15850 +2222 +9046 +6423 +13733 +15684 +15392 +17495 +12863 +498 +10164 +18966 +12418 +6222 +9976 +288 +16999 +15426 +13872 +14451 +9547 +10515 +7344 +854 +7902 +2768 +15997 +19294 +17308 +12595 +18887 +2689 +6909 +12091 +12844 +3926 +6542 +15474 +18227 +201 +5498 +17574 +4109 +9572 +4954 +6101 +7505 +16538 +16793 +17192 +17517 +351 +5133 +2050 +1282 +18186 +11233 +14645 +19337 +6158 +3351 +914 +5701 +3136 +5414 +1420 +11999 +11489 +7586 +442 +7805 +3809 +3138 +8291 +13592 +16618 +16338 +2127 +3972 +5562 +9028 +14912 +5653 +4166 +3743 +7872 +599 +6954 +10668 +2845 +19100 +16617 +154 +11374 +6779 +14547 +13415 +17097 +18994 +8608 +14527 +2486 +1154 +17689 +7869 +15346 +2994 +13851 +7350 +5431 +19834 +13357 +5989 +17009 +10533 +2351 +14369 +2285 +15677 +15380 +1910 +13132 +5639 +4735 +3009 +12004 +14330 +12835 +7845 +19647 +4479 +7473 +9394 +11296 +5279 +7863 +10458 +3954 +8373 +5988 +1220 +461 +2378 +14855 +5317 +10956 +1916 +4531 +4698 +15306 +11094 +12270 +13226 +8061 +14314 +9906 +8102 +11665 +3427 +962 +4411 +9899 +4033 +2513 +18110 +12481 +6737 +3661 +13591 +1504 +5545 +17726 +11208 +2362 +17204 +12377 +13014 +15207 +4708 +2123 +18387 +10018 +10180 +3360 +13529 +972 +12769 +6091 +11867 +2515 +17622 +7430 +18493 +19051 +18031 +221 +9493 +18830 +106 +12860 +6790 +1446 +1412 +3044 +4097 +9986 +3684 +9728 +656 +8351 +10291 +19880 +9679 +3629 +15564 +7370 +13046 +5887 +11953 +12133 +5966 +3892 +19597 +7750 +707 +5503 +1714 +9459 +12006 +1362 +12357 +14220 +5717 +18583 +1321 +15403 +19546 +3620 +890 +17508 +4586 +9158 +15310 +923 +17278 +6502 +9406 +1790 +1540 +16916 +14091 +13304 +4494 +10326 +2230 +56 +13219 +17320 +14202 +15503 +3861 +78 +10493 +4999 +1081 +17061 +11221 +10599 +12757 +8972 +1653 +15651 +9007 +3796 +5485 +14396 +13088 +4283 +5605 +13224 +12841 +4878 +9395 +10511 +11666 +4720 +5286 +9628 +18394 +3878 +16354 +4939 +8961 +14625 +19956 +1130 +227 +3913 +5466 +3840 +8302 +5604 +10791 +985 +7015 +210 +8742 +3455 +14814 +15884 +6188 +10504 +18972 +5749 +9758 +7990 +1103 +17428 +17696 +7485 +18153 +16044 +19587 +7929 +14339 +14636 +8643 +19199 +16971 +1486 +11765 +10794 +11709 +7038 +9211 +19761 +10590 +18417 +15283 +3850 +11144 +11415 +17838 +8117 +19322 +9644 +18451 +12386 +7331 +17077 +1241 +13242 +11125 +18440 +6857 +14276 +948 +13000 +13679 +18108 +14331 +14504 +9428 +15808 +15276 +1889 +15889 +7092 +4491 +9983 +5339 +14909 +2277 +18390 +8313 +19687 +2677 +15712 +4442 +8932 +17952 +9513 +9342 +16675 +14298 +11027 +2809 +12147 +16592 +1466 +9322 +17985 +1361 +15154 +6515 +15035 +3816 +7558 +11435 +19043 +6607 +13969 +4050 +19652 +17195 +16509 +18631 +13091 +121 +4472 +6568 +63 +12768 +10195 +16562 +13875 +19791 +1584 +7606 +4387 +15320 +11616 +711 +3083 +9262 +10710 +431 +15922 +17958 +4246 +513 +4971 +15273 +4172 +179 +3030 +3110 +17836 +3411 +7670 +12478 +2343 +11805 +5184 +18447 +4592 +12949 +16164 +8917 +14532 +10124 +14711 +18508 +5684 +2267 +15883 +5745 +19792 +5436 +3051 +8936 +8933 +11459 +14963 +7533 +14460 +16624 +19992 +10765 +10332 +14389 +13601 +10117 +19429 +7209 +5347 +2379 +4765 +12342 +17445 +13760 +6061 +13939 +3600 +4168 +17313 +11921 +7373 +2793 +4088 +10740 +9908 +1873 +13799 +11871 +6386 +17673 +18756 +6457 +9522 +14324 +7836 +19278 +19573 +14453 +710 +12582 +6241 +16363 +8485 +16552 +14762 +15601 +5534 +14245 +13043 +16439 +17385 +10985 +13933 +12906 +3602 +727 +18115 +3648 +17155 +10543 +8471 +13825 +10986 +5137 +9331 +15772 +18383 +11781 +10937 +10474 +3173 +13848 +10555 +15690 +7083 +3299 +12421 +5542 +9260 +14095 +9350 +14971 +6232 +7345 +77 +17822 +374 +912 +14680 +12700 +10161 +16652 +18815 +16724 +4907 +5555 +12470 +7205 +578 +7780 +851 +1865 +16522 +9008 +7293 +9463 +3192 +18536 +5030 +4959 +18579 +4587 +6512 +1024 +10980 +10898 +13636 +3095 +18779 +1733 +12699 +16512 +16480 +1179 +10921 +14594 +14388 +18748 +8898 +7486 +55 +17440 +9243 +1668 +8540 +13289 +9436 +17648 +346 +12871 +16749 +164 +12634 +19758 +8937 +15947 +1861 +17849 +4989 +12096 +16698 +11948 +8399 +12457 +15480 +12110 +11619 +16899 +11292 +9074 +5373 +14465 +15305 +10982 +6406 +112 +1284 +9356 +13890 +8959 +15879 +580 +7714 +5506 +3190 +17881 +14872 +4306 +18338 +9994 +17684 +17898 +87 +472 +6161 +4723 +3447 +18148 +3158 +18542 +4948 +3738 +5297 +19281 +14788 +15127 +13776 +13611 +10153 +7853 +12450 +10108 +14227 +19753 +6458 +1003 +19973 +15140 +6123 +16735 +6928 +4327 +10420 +16963 +940 +19622 +17196 +1925 +10566 +9358 +12819 +2030 +9681 +10077 +4334 +6690 +14318 +16043 +426 +1151 +8349 +4942 +5598 +2853 +19639 +11215 +4920 +13434 +9791 +2586 +5757 +5697 +14377 +16353 +18217 +8190 +10013 +18738 +19502 +18120 +9467 +9864 +16532 +11069 +8612 +1937 +1372 +15299 +16473 +5612 +12577 +15073 +716 +13517 +16768 +18633 +14902 +15125 +1093 +2678 +7539 +5928 +6696 +8923 +10954 +2918 +12820 +2851 +16694 +7692 +16254 +19650 +2386 +4220 +4701 +4004 +17718 +2989 +6924 +477 +5937 +9535 +4961 +16542 +12774 +1691 +10135 +14188 +17597 +15935 +14882 +4357 +13662 +18206 +8885 +5504 +7217 +5111 +5964 +11358 +3451 +8604 +8519 +15887 +12545 +982 +16497 +11323 +11385 +18188 +19645 +10984 +15886 +2551 +6679 +12606 +10824 +3956 +11180 +7574 +4028 +16212 +3914 +7677 +14076 +13885 +11514 +1767 +10012 +12423 +9778 +2821 +2811 +7956 +769 +14842 +19029 +13439 +18214 +2223 +3792 +10346 +9860 +517 +15205 +19674 +15361 +16625 +14219 +16820 +19101 +4351 +640 +18765 +11121 +4350 +16482 +6707 +6810 +14542 +2791 +8006 +12823 +689 +2929 +19232 +8752 +1342 +7597 +19672 +16838 +830 +14492 +16941 +14633 +3724 +989 +4184 +1453 +8029 +3327 +3677 +16206 +2457 +17398 +8335 +10118 +266 +5533 +4680 +11379 +17478 +9527 +19617 +1678 +10329 +2741 +18138 +2456 +16540 +12104 +11443 +1298 +2118 +17615 +5995 +6862 +3488 +15526 +11304 +4840 +8637 +15790 +775 +1137 +8983 +18397 +9798 +722 +5346 +15242 +12505 +15983 +19275 +15580 +13633 +13717 +11944 +12196 +10522 +13473 +2644 +10497 +17461 +17569 +6378 +8597 +16327 +1211 +4162 +6847 +4340 +19951 +1599 +7135 +15964 +5626 +14662 +11134 +5105 +12657 +17545 +3080 +18801 +11012 +16064 +4083 +2642 +18572 +977 +12963 +1483 +9630 +11837 +71 +10721 +3758 +18526 +10761 +8113 +4746 +9448 +3092 +16557 +17825 +18446 +8252 +392 +18106 +2957 +14830 +13937 +13308 +3804 +755 +7778 +17863 +8619 +13266 +17882 +16879 +19924 +11389 +11255 +14986 +15788 +1779 +7856 +19252 +11341 +805 +3380 +9491 +5805 +10094 +15694 +17089 +3040 +11579 +3307 +15278 +10400 +6058 +9593 +13908 +17052 +7700 +4979 +11938 +16412 +18864 +4819 +12537 +4342 +8687 +12683 +12049 +13008 +15497 +992 +6943 +19289 +12947 +1456 +14316 +8409 +16042 +13950 +13145 +14558 +14961 +10435 +15751 +2927 +15037 +13411 +13988 +16928 +12420 +14982 +3404 +15797 +14812 +19720 +11288 +1366 +4130 +9898 +998 +14385 +2657 +12093 +18980 +12937 +15151 +224 +10603 +2698 +3295 +6210 +10846 +11517 +11958 +7695 +9031 +2278 +17046 +15210 +7702 +11565 +2208 +877 +14359 +14139 +14411 +9053 +12569 +5575 +14752 +6876 +10816 +9560 +3562 +3894 +11237 +12842 +3335 +17299 +5688 +16983 +12775 +8516 +18919 +5076 +6027 +11966 +18406 +13103 +18220 +7896 +14930 +1302 +8829 +8453 +314 +10673 +4087 +7300 +19948 +800 +10413 +8825 +11842 +17749 +8810 +4490 +17681 +836 +12925 +11007 +9020 +5874 +9433 +7709 +8667 +4530 +1106 +9895 +17803 +16113 +8158 +1187 +19264 +6286 +19216 +16332 +2287 +19260 +15395 +17989 +17056 +4257 +6020 +12588 +11996 +9770 +6531 +5827 +1785 +12064 +10807 +10294 +19059 +4504 +15596 +6438 +4825 +7552 +9057 +18677 +8279 +17911 +19664 +4538 +17226 +19027 +9047 +17028 +14974 +14105 +2303 +11840 +9568 +10111 +3082 +10249 +13152 +5532 +14213 +16516 +18014 +19653 +8949 +10972 +14520 +16575 +3656 +14027 +15027 +9694 +12890 +10080 +18771 +16314 +10556 +12661 +19972 +18649 +699 +13948 +7751 +3131 +6784 +2676 +275 +2888 +16062 +7163 +19120 +12723 +17616 +18763 +10595 +15530 +2995 +783 +13107 +3416 +8081 +8176 +17959 +1728 +10932 +19737 +12468 +15440 +10682 +10281 +10498 +11967 +9314 +9189 +11332 +17661 +18196 +14557 +786 +17267 +8999 +4686 +1022 +7812 +18280 +456 +4312 +10302 +2906 +8606 +19544 +14775 +730 +16858 +19191 +6550 +13128 +17408 +18023 +9971 +19711 +11312 +4487 +4085 +15128 +14255 +8297 +18539 +787 +331 +6999 +12733 +10978 +14555 +16517 +15097 +8241 +3234 +15937 +13922 +17459 +1870 +17768 +14584 +19259 +5116 +5727 +931 +3767 +8005 +2607 +11446 +16883 +13893 +17149 +6018 +13261 +19066 +4685 +13725 +10893 +8622 +19603 +3692 +7888 +10635 +14670 +14441 +16672 +10622 +10074 +11786 +2699 +19206 +8367 +18976 +3421 +10434 +4451 +7403 +3857 +1799 +13049 +18178 +8514 +10714 +6771 +3152 +18337 +10109 +1083 +8326 +19805 +5950 +19847 +4527 +5855 +11501 +19808 +6397 +15479 +19244 +4186 +2528 +12598 +7043 +17510 +15752 +11162 +6982 +6216 +6264 +13484 +2039 +19015 +2433 +2694 +1544 +8215 +10538 +16695 +118 +16077 +11429 +1496 +11057 +13818 +14005 +12615 +5221 +12602 +3674 +301 +14175 +13343 +600 +14983 +524 +820 +15281 +11539 +4133 +4198 +19963 +5947 +10165 +15234 +11491 +4135 +4983 +1876 +7528 +7304 +1562 +15212 +1043 +19677 +4850 +16854 +8897 +18780 +14903 +3881 +5463 +5893 +15405 +16276 +1209 +13525 +6806 +10732 +7767 +13288 +15528 +6372 +12709 +6129 +12409 +9811 +18287 +2895 +15777 +401 +3278 +8573 +1554 +6500 +15252 +13647 +11399 +2242 +12502 +12507 +3477 +17207 +10341 +15525 +4823 +9161 +6308 +13294 +10629 +16245 +3296 +3538 +2801 +10584 +9403 +12498 +8714 +5198 +1338 +19990 +3574 +7314 +16620 +7569 +3494 +1 +14065 +3145 +17457 +9284 +7180 +10892 +7111 +8180 +1821 +2014 +16794 +19005 +12917 +8470 +17343 +1518 +7529 +6587 +11100 +1760 +16159 +6964 +19509 +8222 +11116 +15229 +13559 +6183 +709 +2098 +15239 +6169 +19667 +17363 +13213 +3144 +10767 +11387 +5134 +2003 +12185 +19682 +9113 +4577 +19384 +8926 +537 +11326 +11783 +16912 +4178 +16291 +10344 +17866 +5561 +2746 +10562 +11578 +5294 +14800 +19925 +12412 +15835 +11577 +9481 +14515 +17350 +14493 +7078 +6986 +18146 +9531 +16411 +5954 +2511 +5791 +11662 +13463 +14537 +6179 +2025 +4119 +6428 +7919 +12301 +741 +17003 +11520 +2322 +18545 +2816 +5994 +6105 +16107 +1073 +14622 +13342 +18050 +10078 +17345 +17554 +1543 +18 +7660 +5438 +9943 +3594 +3703 +5395 +11370 +16581 +15418 +3400 +10412 +14131 +13197 +13665 +12372 +18872 +12839 +2460 +16996 +12585 +13902 +15263 +9686 +16563 +1457 +13276 +947 +3589 +1135 +18197 +11713 +12163 +2204 +2919 +9626 +16423 +15582 +15949 +4205 +17938 +17413 +19576 +4993 +5283 +14579 +5309 +14546 +15726 +2849 +2142 +11410 +13810 +9479 +3820 +866 +9978 +16784 +11671 +6837 +16320 +11812 +12184 +8153 +6873 +7419 +7101 +3344 +19846 +9263 +1478 +10669 +12194 +4501 +10924 +7264 +13394 +18353 +1956 +1277 +12092 +12460 +5232 +19324 +2119 +16437 +9390 +11362 +7475 +2597 +15271 +10529 +6995 +19228 +4045 +4951 +8139 +4466 +18481 +4561 +16783 +10099 +6860 +17063 +927 +2033 +12648 +17781 +2898 +1320 +9871 +6326 +17469 +10601 +14705 +9870 +19192 +7219 +8847 +2792 +15438 +6422 +12590 +11420 +2627 +6361 +18901 +19204 +16903 +15181 +11050 +18231 +2536 +1986 +9228 +19402 +2165 +6001 +7311 +4519 +11158 +16208 +13691 +1942 +7375 +6005 +19039 +12972 +16462 +12515 +9276 +6880 +11200 +9931 +5623 +2862 +9716 +50 +9944 +8391 +12853 +11878 +7254 +15717 +14919 +19413 +7322 +4016 +2527 +16907 +2524 +5135 +17276 +10647 +13279 +10015 +9776 +12604 +3113 +16471 +14999 +11702 +19608 +10787 +8154 +5807 +13462 +604 +8939 +6273 +8979 +12619 +10386 +13069 +15727 +11689 +4536 +16075 +13938 +13580 +15599 +18962 +10735 +11802 +10383 +1399 +4410 +3535 +17480 +14985 +2814 +3123 +2724 +6224 +18865 +8240 +17731 +19163 +11893 +3245 +12224 +10103 +2013 +3435 +5017 +19932 +18568 +2339 +13 +3243 +17153 +10233 +4851 +2574 +17494 +10453 +8242 +9960 +372 +3410 +11084 +5357 +9627 +3896 +12304 +15424 +4673 +3841 +3832 +17147 +8123 +13614 +19935 +18746 +8343 +2887 +11414 +2347 +7245 +589 +13837 +5735 +18374 +5222 +2040 +10839 +15184 +16493 +1697 +8528 +3958 +15919 +14802 +14478 +12316 +47 +3814 +15941 +17556 +5025 +6505 +2599 +4807 +16573 +9026 +4753 +13330 +17961 +6951 +4176 +18581 +6280 +482 +7481 +847 +5703 +6686 +12430 +9343 +15955 +14406 +1063 +5293 +1944 +10734 +14286 +17833 +9802 +6627 +4307 +11310 +7206 +4848 +13644 +17175 +11330 +4675 +8977 +15247 +14724 +535 +16143 +3270 +4548 +6938 +6677 +9005 +7020 +9088 +15010 +17070 +704 +119 +12456 +15356 +13788 +9116 +7416 +237 +15198 +59 +13761 +10205 +9325 +10372 +1454 +12134 +17095 +13936 +11049 +502 +4606 +6182 +3863 +15307 +4583 +11554 +15812 +14138 +3258 +6628 +2885 +16888 +641 +11710 +5554 +14854 +9242 +16270 +11171 +19856 +18552 +15074 +17754 +2806 +7711 +4314 +19993 +3468 +12255 +6787 +15711 +7231 +4434 +10023 +9285 +5031 +19987 +13934 +12706 +5672 +9465 +7875 +10303 +19459 +4489 +6807 +6819 +11240 +5921 +12952 +3370 +9733 +10462 +12708 +4175 +5746 +5906 +4485 +10783 +12094 +9690 +18895 +10977 +880 +15847 +8134 +7030 +2154 +18109 +13728 +5571 +11363 +13663 +4131 +8656 +10532 +14433 +17810 +15439 +17251 +4456 +14559 +17505 +1586 +8790 +12115 +3177 +6671 +670 +8561 +17786 +18107 +16930 +14761 +1432 +5153 +6021 +111 +14955 +4624 +16076 +14237 +9844 +1270 +17917 +17015 +15227 +19331 +18072 +7003 +1960 +10914 +6799 +15138 +15068 +13651 +19053 +8900 +16740 +12291 +2503 +5685 +6639 +8718 +7792 +8309 +12079 +45 +84 +13028 +19830 +17453 +10848 +18701 +3321 +2212 +8817 +19290 +19602 +3811 +13789 +144 +7167 +7729 +2717 +6197 +13454 +13704 +14757 +17324 +15910 +9469 +14907 +4555 +708 +1123 +7625 +13782 +13126 +17596 +13957 +9220 +6709 +8019 +11503 +2173 +4388 +16776 +7399 +18430 +6831 +4496 +642 +7723 +5530 +19442 +3778 +2952 +11253 +8700 +5520 +4446 +12978 +1215 +7685 +9872 +15951 +3934 +9149 +1390 +2471 +12160 +14399 +2434 +18415 +1218 +32 +7982 +6812 +4124 +16855 +18941 +2465 +2734 +16235 +6157 +11791 +2737 +4717 +6371 +13109 +7912 +11730 +3555 +16654 +6456 +15368 +7580 +8096 +10407 +14311 +10043 +14424 +369 +12222 +930 +11154 +10068 +4544 +5456 +19536 +4857 +17200 +8804 +13532 +8733 +422 +1506 +18343 +14719 +14153 +3048 +10267 +14506 +5029 +19942 +5898 +2382 +3445 +9501 +18362 +15809 +12221 +17889 +1979 +2217 +16234 +5817 +10847 +16634 +18902 +1743 +4247 +8945 +19623 +10002 +4438 +12048 +6623 +9521 +13864 +17763 +9245 +17975 +11607 +1909 +17851 +10919 +18575 +9464 +10642 +6247 +2061 +18940 +6649 +2106 +14928 +9727 +5719 +8118 +11365 +19383 +4681 +1252 +5370 +9341 +932 +19183 +2420 +11824 +15570 +3993 +15431 +12494 +6548 +16249 +9922 +8387 +17677 +1629 +11720 +3636 +16336 +14087 +8133 +3755 +960 +3946 +16751 +8827 +4885 +11718 +17113 +2463 +17058 +2197 +11153 +17542 +13968 +1692 +9510 +1598 +17488 +19609 +3440 +173 +1849 +6383 +13880 +5226 +8374 +7870 +4086 +12667 +7468 +6736 +10201 +2125 +2589 +6608 +5270 +7683 +3717 +14243 +10644 +11638 +1189 +8767 +19540 +9812 +3980 +13301 +13319 +16386 +14660 +6190 +19137 +18090 +6845 +9849 +7178 +9816 +308 +9653 +11880 +4949 +1903 +7656 +2818 +15129 +13426 +14721 +12555 +7133 +9304 +1140 +5193 +17641 +19302 +2755 +9232 +2290 +12070 +14373 +18000 +6573 +1429 +18199 +12099 +9266 +19799 +19842 +14630 +15890 +5400 +1168 +1334 +678 +6820 +19767 +9867 +3627 +15482 +4219 +18098 +11759 +6569 +1522 +5971 +14975 +19122 +3102 +10832 +14152 +15486 +11430 +14481 +10335 +3613 +19350 +4041 +3053 +8884 +8173 +14611 +5180 +9204 +3476 +18133 +7054 +15400 +17218 +2182 +5252 +13778 +10306 +8472 +17474 +13635 +15264 +8964 +19173 +13839 +5596 +12642 +2008 +6478 +4278 +10186 +6869 +984 +4803 +3481 +18944 +14282 +13615 +15811 +19363 +11136 +7189 +15192 +1759 +3303 +7237 +13518 +11633 +14817 +14946 +16346 +5785 +4870 +8768 +4729 +14672 +13143 +12444 +7398 +14648 +16298 +8079 +14285 +7397 +14078 +13859 +4581 +14442 +16714 +9176 +8370 +188 +12186 +11185 +2192 +556 +6540 +17373 +7988 +7629 +8772 +15852 +1841 +7050 +3644 +1975 +16088 +10223 +3437 +5406 +398 +9409 +8221 +11022 +4599 +17923 +19212 +8525 +13827 +13178 +13063 +13568 +597 +8534 +12787 +9439 +12550 +17022 +7335 +4231 +14528 +17725 +4976 +14923 +15675 +12650 +747 +13745 +4043 +10501 +10969 +4941 +4153 +2195 +12187 +11124 +447 +15401 +18301 +10561 +6296 +1363 +3414 +12037 +4513 +9714 +4258 +4202 +1567 +9251 +3195 +2028 +13727 +10188 +17434 +5451 +393 +10472 +18208 +5378 +3288 +15950 +3389 +16984 +10052 +7082 +1509 +16150 +11193 +3482 +18241 +15206 +12694 +8589 +19453 +14117 +8083 +18296 +15671 +903 +16727 +14083 +19159 +10439 +493 +5493 +17086 +15611 +1575 +16574 +11052 +2315 +19831 +1676 +14627 +19279 +9199 +7674 +5230 +15390 +15977 +19765 +11356 +12465 +18800 +5462 +2300 +8322 +4146 +16519 +16998 +4393 +7958 +3184 +13159 +2890 +1996 +14181 +637 +13125 +13038 +3623 +3067 +11766 +12208 +5955 +12813 +16951 +8522 +3119 +15340 +19563 +19939 +4996 +19335 +1037 +18714 +17876 +18389 +13231 +15917 +7782 +14898 +18670 +11630 +17753 +8603 +3584 +10272 +18520 +19060 +15779 +6553 +2105 +3022 +6160 +11143 +15697 +13675 +220 +13874 +6529 +13783 +8706 +1262 +10317 +12012 +12435 +18774 +19300 +1419 +11201 +16096 +12869 +4769 +14310 +1364 +16991 +6117 +2631 +6040 +3103 +6942 +11453 +7901 +6972 +14364 +12145 +417 +9965 +12878 +2626 +17576 +19338 +15036 +13574 +12971 +12247 +13085 +2336 +19684 +5237 +5187 +11919 +562 +13007 +16523 +12939 +5250 +5588 +16600 +10405 +9663 +12558 +19723 +16362 +8135 +19763 +9391 +2427 +7476 +2029 +18293 +15895 +2385 +1489 +636 +981 +1156 +13282 +15115 +9598 +1213 +16544 +1296 +15737 +2784 +5932 +11104 +13888 +2530 +9706 +11081 +3524 +8956 +13166 +18557 +6065 +163 +6033 +516 +18459 +16866 +11518 +5428 +478 +11492 +10280 +7532 +7002 +14327 +3220 +14828 +7036 +16393 +13768 +2930 +1117 +6726 +2318 +13211 +4689 +3342 +10203 +12398 +16526 +8782 +4418 +8237 +3169 +19441 +10112 +18812 +13734 +4102 +17219 +5543 +1906 +14728 +19262 +15429 +7648 +7893 +17037 +4627 +16891 +11123 +5327 +6657 +2501 +1812 +13229 +3099 +3375 +5468 +3815 +4459 +860 +11151 +4140 +15652 +11792 +7192 +1686 +19348 +13925 +19637 +7427 +18068 +2010 +13216 +10431 +17501 +17030 +9687 +18018 +13730 +19817 +18679 +8473 +10827 +341 +4169 +1846 +9755 +14042 +1180 +13438 +7194 +15654 +9099 +15454 +12018 +19197 +1755 +4150 +15169 +10857 +6352 +7006 +10408 +13355 +19450 +15119 +7004 +257 +10915 +6684 +8840 +18930 +4641 +10877 +229 +7166 +9896 +5905 +7545 +344 +15920 +9152 +246 +9058 +19520 +4300 +4792 +19691 +3504 +817 +8737 +12905 +2415 +6907 +8860 +5027 +8024 +3888 +16163 +11647 +14006 +12023 +4877 +7644 +1563 +11462 +18219 +12019 +1989 +8497 +6763 +3996 +181 +11278 +11703 +554 +6004 +16785 +5024 +17144 +11675 +2857 +2485 +13659 +17741 +11130 +12704 +19747 +6166 +778 +6670 +19756 +8796 +19227 +385 +10731 +11961 +4047 +15990 +19669 +12521 +16944 +16474 +13432 +10829 +6960 +19887 +2559 +18752 +8361 +13833 +17824 +13186 +8008 +10746 +9302 +12298 +19491 +17194 +94 +2726 +9562 +17936 +14229 +17211 +1264 +2388 +7536 +9309 +1090 +4704 +2987 +16669 +1069 +5974 +666 +4110 +12960 +7011 +3430 +3658 +7957 +13867 +2305 +6814 +9642 +18184 +6066 +10263 +6331 +6583 +11401 +18710 +7761 +9120 +18732 +7057 +15086 +13461 +9607 +620 +357 +10244 +16750 +12518 +14047 +13311 +1637 +8493 +9688 +3472 +12299 +5998 +13924 +6504 +7669 +1921 +9307 +3126 +6080 +18350 +17884 +19096 +19377 +1765 +3605 +16444 +6057 +19150 +7336 +745 +12446 +18967 +17715 +954 +6207 +12627 +3154 +11384 +14172 +15881 +10026 +2786 +18142 +18848 +14487 +19946 +14489 +12259 +1326 +10541 +1739 +7035 +13278 +10706 +1226 +352 +7017 +19211 +1966 +5756 +19780 +18829 +34 +11245 +2462 +4457 +14180 +2692 +14910 +13246 +6710 +10638 +7946 +7282 +8727 +1368 +3519 +5185 +6794 +8042 +5645 +5808 +4835 +17102 +3921 +11209 +12136 +10628 +3576 +4998 +7242 +18183 +4817 +1796 +6850 +16380 +8288 +16177 +12374 +2774 +12953 +19135 +17368 +12202 +2671 +12030 +3502 +13272 +18318 +2947 +9429 +17981 +13291 +16647 +9353 +13506 +1345 +1606 +17865 +15331 +3223 +9213 +2329 +6693 +15916 +2748 +1597 +12141 +14140 +10183 +17864 +15681 +10661 +17526 +3179 +2682 +9129 +17455 +9142 +7890 +908 +4428 +1257 +6910 +4718 +19099 +15214 +168 +15250 +19414 +6957 +7013 +3617 +15080 +2637 +19908 +7213 +2778 +8424 +6742 +13447 +1388 +8942 +6449 +13283 +6520 +14973 +1632 +9919 +3172 +10166 +15706 +1954 +12442 +6048 +265 +884 +19234 +2575 +19868 +18708 +1191 +3020 +14077 +15453 +1936 +2761 +13577 +17654 +9508 +15423 +12865 +3808 +2055 +13652 +5522 +8046 +17315 +11752 +2304 +4058 +7626 +9317 +10968 +6605 +18609 +12029 +9514 +12933 +6311 +6106 +4719 +10381 +6532 +12583 +14195 +11685 +4255 +15557 +6704 +15840 +15208 +6497 +8632 +3696 +7840 +12973 +18856 +9969 +19613 +18563 +6743 +13422 +6575 +12637 +3962 +14827 +1112 +19268 +5240 +5901 +13009 +5481 +15268 +13265 +16451 +18319 +1837 +8355 +8598 +4207 +983 +12961 +13919 +14456 +1836 +1239 +3682 +2158 +15971 +12416 +17843 +12431 +5091 +2773 +11993 +10113 +10676 +17265 +115 +11344 +13027 +6813 +17885 +15398 +5191 +16829 +7964 +13565 +2469 +15284 +15334 +15636 +16577 +17943 +13522 +13595 +15555 +2598 +17872 +10530 +17790 +5792 +4328 +19037 +4015 +14635 +1783 +3928 +17277 +10138 +10764 +21 +7171 +5579 +2956 +15658 +4832 +9159 +12366 +2086 +1677 +1346 +13813 +14918 +19250 +3229 +5583 +15552 +17391 +19445 +19064 +19222 +8963 +10540 +14799 +9 +11515 +12578 +13606 +8198 +18794 +4379 +3132 +19960 +18979 +631 +5846 +12072 +15204 +5022 +7193 +12746 +8665 +4090 +8310 +4594 +11466 +15411 +13457 +5418 +16502 +10360 +13018 +1912 +2683 +19853 +2078 +3221 +17284 +6288 +14554 +7948 +16763 +3317 +3633 +3568 +6613 +16070 +17081 +15908 +12464 +8082 +13060 +2555 +3439 +8477 +12271 +5038 +19860 +4829 +11706 +7998 +8384 +1595 +1805 +1640 +474 +14984 +3614 +10814 +14329 +419 +4940 +10881 +9506 +13006 +10918 +8530 +17562 +5725 +17235 +1167 +17756 +462 +11525 +8492 +2843 +6761 +11361 +6935 +11226 +8856 +16721 +17026 +57 +5769 +14925 +9033 +10129 +2837 +8439 +1616 +6434 +11611 +14205 +6075 +11770 +5291 +2326 +7364 +586 +12935 +14640 +9955 +335 +18730 +1813 +11972 +4690 +672 +5793 +13220 +5178 +13492 +19396 +15145 +8657 +11858 +19994 +19162 +1033 +7147 +2330 +19757 +572 +643 +384 +9925 +1125 +16239 +1468 +14128 +11184 +17656 +19701 +15014 +2804 +19155 +18053 +16216 +4912 +17608 +12940 +9707 +16399 +9962 +1229 +2002 +9092 +4211 +14353 +15441 +18468 +9370 +16688 +987 +9588 +8286 +7260 +40 +2980 +12044 +3622 +16853 +6776 +1292 +11037 +14858 +11338 +3271 +6792 +5869 +17176 +4935 +9850 +3133 +530 +5284 +11481 +15789 +14037 +1792 +10600 +16448 +16402 +7271 +10259 +18759 +8559 +16204 +16052 +3246 +12904 +15531 +10970 +4450 +483 +12566 +15607 +588 +15992 +5443 +1447 +12752 +2411 +166 +19825 +16716 +6513 +18826 +12041 +10452 +16902 +829 +4188 +4493 +3208 +17099 +18648 +13847 +8111 +18607 +13743 +18881 +3827 +6130 +4139 +4965 +6177 +10051 +12253 +13041 +9234 +18908 +8614 +1776 +14967 +18358 +3366 +11589 +413 +18726 +18555 +17591 +2060 +8879 +3791 +18548 +2665 +7895 +15282 +19893 +2338 +14473 +11013 +207 +13584 +19911 +18401 +16144 +13453 +5700 +10181 +13519 +4557 +16640 +10933 +8755 +6884 +10786 +8921 +8348 +8360 +3935 +7072 +11688 +18657 +16435 +16612 +9620 +15485 +12302 +1287 +4750 +17816 +6462 +19313 +13429 +10803 +19658 +1811 +2333 +2788 +12509 +2391 +13374 +756 +10119 +526 +11502 +4846 +16478 +6897 +18228 +14718 +9334 +1484 +16094 +14722 +17019 +15695 +18441 +11231 +12369 +6240 +9002 +3631 +615 +7153 +4790 +10958 +17839 +10995 +9926 +6795 +12125 +1982 +4400 +9387 +1529 +5381 +18595 +17504 +2169 +4636 +2246 +18988 +17023 +11444 +16361 +13146 +17374 +14877 +18345 +300 +18462 +12824 +564 +134 +17523 +1134 +2452 +1038 +18878 +5092 +18926 +451 +11879 +15764 +13985 +5625 +8596 +12546 +12755 +10421 +3777 +10152 +11441 +19910 +12031 +16841 +7655 +10693 +5392 +18506 +12563 +18995 +15619 +11364 +14263 +13044 +12997 +13346 +13160 +11672 +17259 +2736 +319 +9151 +10928 +1832 +7854 +15517 +3459 +2878 +17775 +19969 +6304 +18289 +37 +7244 +13589 +3371 +8941 +13784 +7754 +5591 +89 +18899 +16011 +1249 +7622 +8592 +16098 +7570 +12850 +7579 +13637 +6854 +11655 +14479 +3180 +18981 +19456 +4523 +10036 +504 +8811 +12882 +14072 +4101 +602 +1818 +8398 +2965 +4771 +14349 +619 +3381 +9045 +17723 +11003 +551 +11987 +6641 +10576 +5382 +4609 +2232 +7400 +14606 +17782 +1882 +11952 +12883 +1013 +1045 +2239 +4588 +12565 +9769 +15195 +15723 +19314 +14132 +8295 +942 +5104 +16908 +10156 +4667 +13361 +13593 +17199 +17751 +15670 +16848 +4233 +7844 +13082 +18753 +16815 +5325 +9544 +18949 +15867 +18450 +1523 +13507 +3925 +9375 +8022 +16922 +19002 +18483 +6997 +9114 +869 +6463 +18983 +1099 +7611 +15944 +19025 +11257 +19088 +16057 +4747 +3210 +12362 +8623 +553 +7619 +8730 +13142 +12287 +17628 +5674 +2143 +2667 +19194 +14067 +14994 +5916 +6983 +11142 +18968 +9128 +234 +16008 +13918 +14901 +8770 +7161 +7706 +8783 +4742 +7058 +16184 +14926 +1098 +2953 +13416 +9591 +13168 +6290 +2187 +13489 +12669 +3316 +1603 +14778 +11423 +17530 +11102 +13092 +10690 +11992 +15793 +7483 +3486 +14589 +17624 +3801 +13150 +6451 +9171 +17302 +4744 +12516 +7190 +17853 +17486 +15132 +575 +16293 +10909 +19815 +7396 +16384 +18258 +4260 +9017 +1057 +418 +15588 +18699 +7408 +1669 +9855 +17928 +4332 +19007 +7179 +7097 +10636 +8254 +15571 +17880 +17858 +2467 +4824 +8630 +5507 +7748 +13207 +7708 +9601 +13215 +9756 +16026 +7734 +12007 +3985 +3975 +24 +8499 +19781 +16997 +19931 +7498 +18003 +898 +3774 +5267 +19904 +1141 +3236 +3997 +340 +8277 +10219 +19621 +9143 +17010 +11669 +12691 +8169 +9079 +14583 +14459 +12061 +11205 +14789 +3757 +4913 +4123 +1307 +687 +8143 +5783 +6087 +3116 +6893 +18700 +1126 +18939 +14849 +19168 +13694 +3354 +4732 +7220 +9715 +2729 +9476 +7883 +3283 +18448 +7298 +19525 +6913 +10908 +17048 +9894 +3151 +1736 +12383 +4842 +18693 +11914 +7090 +7865 +5521 +4669 +12482 +19952 +8529 +15462 +2518 +327 +10523 +1055 +13857 +19428 +11179 +2896 +15066 +11934 +935 +4289 +11899 +568 +1028 +3057 +1623 +12628 +9328 +9278 +19555 +8131 +10592 +16847 +11519 +4304 +18582 +5299 +2381 +2830 +3465 +14862 +2112 +3199 +15457 +9221 +15445 +6534 +10946 +1244 +4061 +14787 +19829 +10695 +19455 +5951 +3522 +14155 +18282 +4454 +13337 +16782 +9130 +8003 +1143 +6838 +6755 +16851 +6626 +15090 +5895 +18185 +9123 +19638 +11475 +1588 +5718 +8144 +12244 +7806 +9909 +13328 +12618 +16186 +14803 +3571 +1175 +6242 +13141 +4981 +16953 +15739 +15888 +15825 +8584 +12073 +12181 +6668 +13546 +17247 +7490 +5641 +18695 +17270 +19130 +15593 +9991 +8480 +19426 +17306 +3868 +2172 +4648 +16842 +7443 +12297 +16167 +16153 +8206 +17653 +16223 +18306 +8011 +13258 +8749 +11413 +17355 +18821 +2392 +7736 +1065 +3762 +11127 +13274 +14848 +7261 +11626 +14264 +10701 +9139 +6803 +7406 +16136 +15216 +18770 +8147 +10579 +5432 +1354 +10479 +8928 +13710 +2474 +11118 +13383 +15609 +5990 +19489 +15815 +8567 +16068 +2522 +3666 +11847 +16138 +7991 +12520 +15287 +18644 +4712 +9022 +14031 +1952 +10045 +2917 +13650 +2881 +19104 +3556 +5163 +6530 +16196 +3566 +9300 +5245 +2996 +18038 +2647 +3943 +13251 +13680 +17217 +1077 +6341 +15865 +1918 +437 +4834 +2572 +7862 +5711 +8408 +8924 +3418 +19594 +13314 +16731 +18513 +3075 +19643 +11476 +18781 +11249 +16940 +13425 +8467 +10608 +5912 +4692 +6496 +17159 +18817 +9774 +17707 +10887 +2646 +3101 +15565 +13814 +7910 +10234 +7672 +18593 +16125 +3872 +4688 +13502 +15285 +10258 +15956 +16674 +17513 +16734 +18127 +283 +16584 +3550 +2235 +19977 +4930 +2725 +2122 +13871 +5420 +13472 +5896 +17210 +9381 +2334 +15279 +7181 +3162 +10175 +2835 +6150 +13023 +1663 +5737 +5310 +2815 +7940 +12773 +16395 +11629 +15496 +2439 +17094 +5132 +3999 +17160 +10801 +3114 +4724 +1838 +4275 +19750 +10670 +7456 +12380 +15744 +14920 +4978 +5790 +9529 +8616 +12128 +4683 +6244 +1403 +3531 +360 +13158 +11178 +1997 +14972 +3992 +1034 +10672 +5935 +5578 +19888 +6243 +6653 +2371 +9222 +18521 +2413 +16275 +785 +3406 +16603 +9376 +4375 +12899 +17609 +8678 +13468 +16027 +14774 +14184 +3171 +2946 +15157 +6421 +18315 +18057 +13759 +14435 +17583 +11371 +4966 +15100 +1712 +8162 +13435 +7357 +11300 +17969 +16426 +13370 +6748 +10065 +6604 +5001 +9209 +3874 +14068 +5079 +14734 +434 +6630 +6747 +1394 +1085 +4425 +3478 +2053 +1367 +1025 +1560 +7981 +7309 +993 +15315 +9454 +7358 +11342 +7099 +7703 +12000 +4024 +14266 +9311 +2993 +15389 +19584 +18740 +8699 +11727 +6541 +11947 +3186 +7348 +13898 +693 +3189 +3074 +2425 +18658 +3065 +2567 +12010 +16450 +13757 +13022 +14769 +14444 +15466 +17832 +8016 +7075 +9185 +4847 +16771 +10268 +9578 +6919 +19624 +13031 +13380 +5124 +13554 +15078 +19046 +470 +3930 +655 +4019 +8440 +19527 +194 +9411 +9840 +7478 +6682 +4887 +4617 +17055 +759 +16034 +14466 +684 +16571 +2455 +16807 +6394 +5985 +15965 +10079 +2847 +13081 +7466 +15162 +17571 +13721 +6698 +11339 +14030 +14447 +10426 +13351 +8454 +18388 +4572 +13310 +13512 +6676 +2730 +18079 +15177 +895 +14003 +16172 +3572 +14307 +7807 +8842 +3323 +6491 +8751 +18445 +7376 +1592 +7774 +18987 +9532 +12636 +8777 +7540 +4054 +17548 +16481 +19598 +19357 +6078 +9000 +11767 +190 +2819 +17894 +3474 +4462 +13444 +8448 +15973 +10837 +13252 +12071 +15238 +5285 +7605 +7234 +7421 +8906 +11564 +1479 +14953 +19400 +5465 +15855 +2019 +16192 +10889 +8776 +15519 +6817 +345 +16653 +13688 +2403 +14018 +16537 +19797 +19997 +4634 +14400 +8655 +9483 +18683 +13841 +9504 +16741 +5014 +2577 +4225 +9013 +14064 +16518 +10623 +387 +17050 +6189 +999 +12600 +13726 +5888 +6007 +11479 +16718 +12795 +19897 +16182 +18458 +13772 +7673 +19890 +7047 +5618 +5959 +7185 +15330 +2138 +8591 +2605 +7691 +18431 +9186 +17634 +15342 +11687 +919 +8615 +10055 +2690 +11161 +2548 +10916 +8538 +5012 +1559 +5083 +8487 +2702 +18625 +9752 +6730 +11701 +10378 +7582 +5144 +16250 +17020 +18819 +17867 +2077 +10760 +6501 +16111 +5174 +1236 +8417 +15243 +15428 +4185 +17971 +11150 +2270 +4076 +10418 +9616 +14304 +9739 +14354 +11173 +9077 +2553 +17544 +16796 +7414 +5750 +16219 +11777 +3621 +12054 +6991 +4516 +3866 +13047 +17679 +2416 +13399 +337 +14655 +18382 +16054 +18064 +17422 +17215 +17498 +1750 +7126 +3127 +18565 +6762 +18960 +10966 +6662 +6082 +3070 +15563 +12371 +7905 +4700 +11434 +3014 +18514 +12815 +17114 +14966 +3384 +2723 +12173 +291 +1462 +3643 +17993 +1139 +7562 +8067 +8759 +8205 +14015 +3287 +1738 +10139 +1963 +15196 +7513 +5494 +15932 +17383 +6751 +7542 +5886 +15038 +3784 +2253 +7851 +2779 +12151 +7157 +19881 +11373 +17650 +174 +4010 +5259 +18803 +11562 +7188 +11876 +17734 +6949 +10287 +14157 +18143 +8517 +1622 +16646 +6088 +12780 +5103 +3603 +13777 +11604 +16943 +2542 +4967 +1369 +6433 +11825 +12008 +6494 +7531 +15518 +11926 +1104 +18507 +2332 +2257 +4511 +1230 +7978 +958 +10757 +4564 +15232 +5841 +6680 +10704 +17564 +15669 +5712 +2926 +3964 +3324 +15679 +15296 +5331 +3663 +1717 +17708 +5943 +11395 +16378 +5660 +4341 +1166 +17091 +1582 +6016 +216 +18784 +4639 +17240 +18603 +3597 +6350 +17348 +12607 +10364 +3058 +10709 +7744 +2871 +6905 +4195 +17230 +6343 +10021 +16126 +15597 +17983 +5405 +16319 +885 +15877 +14568 +3527 +7602 +13623 +1531 +14019 +12641 +157 +4128 +2733 +12364 +18822 +1283 +15255 +8284 +11428 +4062 +15606 +7132 +16755 +2863 +16252 +17191 +10100 +10459 +13758 +13200 +3710 +7159 +13800 +15040 +5271 +6711 +13654 +9837 +5173 +19220 +10368 +11398 +6330 +4006 +12476 +6586 +5797 +4242 +15703 +1665 +8427 +14178 +5244 +1968 +5818 +12107 +15505 +13285 +11529 +8822 +6603 +16260 +19339 +7627 +5654 +14824 +4389 +17580 +12135 +3680 +889 +10104 +15702 +13504 +1214 +7198 +19579 +15374 +12365 +12999 +11772 +14776 +9617 +6293 +9577 +13967 +18943 +16729 +7577 +14436 +19298 +6622 +10665 +8431 +19395 +19984 +10662 +14632 +16580 +16368 +12239 +6318 +13228 +8861 +7813 +6366 +1645 +13066 +2491 +11844 +15839 +12306 +14755 +19548 +18460 +2393 +5422 +364 +17185 +7575 +16636 +4921 +11833 +3376 +3818 +3752 +5026 +14107 +18861 +19157 +9505 +271 +17577 +2479 +9984 +2376 +15784 +14631 +6083 +957 +3039 +15020 +18999 +1508 +6772 +10931 +17855 +6992 +19287 +12666 +14170 +1740 +12923 +6858 +2309 +9440 +18070 +2886 +10054 +15402 +4626 +4196 +9897 +5702 +13410 +8233 +12649 +590 +19261 +238 +1938 +12592 +12402 +11487 +1732 +3452 +1752 +6939 +9524 +16769 +9060 +1911 +5708 +2742 +697 +13692 +17972 +10130 +12765 +6963 +1276 +7169 +9722 +3860 +9525 +6254 +5355 +8312 +12798 +8280 +1371 +18400 +15762 +1407 +4048 +9087 +15999 +2369 +6100 +7596 +1131 +19386 +3638 +1032 +12675 +18835 +812 +6274 +17032 +386 +2167 +3678 +10792 +13541 +10961 +7152 +18589 +11442 +7770 +2065 +9704 +5282 +6167 +16058 +5089 +18413 +6249 +8785 +1896 +171 +5035 +12241 +1190 +17145 +7144 +17135 +8142 +9241 +4830 +18909 +2636 +14302 +8987 +18964 +17752 +12531 +19686 +16553 +8709 +14063 +12538 +7511 +10082 +2968 +1893 +12781 +13845 +2048 +10552 +6937 +9259 +15372 +4901 +10380 +240 +19041 +17426 +9757 +244 +13914 +2372 +3036 +6899 +4460 +14836 +11513 +98 +2310 +12522 +7953 +531 +19399 +19557 +6452 +18372 +2159 +15351 +4288 +2639 +8950 +7120 +3454 +14580 +19091 +13984 +8855 +8837 +5926 +13956 +9366 +15757 +12812 +10755 +14921 +5929 +14512 +15133 +7920 +6593 +5687 +8889 +15860 +2928 +19630 +6427 +4721 +16681 +11324 +19844 +17817 +10370 +1708 +16101 +347 +10038 +8229 +315 +16837 +17819 +15710 +15957 +1594 +4849 +988 +14540 +14061 +466 +10409 +1590 +13376 +14016 +5551 +2128 +7123 +5960 +2971 +2894 +2673 +113 +18841 +19657 +943 +17769 +10736 +12748 +3823 +10505 +1441 +6012 +5093 +5732 +8689 +4642 +7535 +11738 +12190 +2754 +15430 +390 +6266 +12967 +3068 +18040 +14457 +19114 +17612 +1231 +14044 +17221 +6801 +6131 +763 +9072 +2323 +18702 +11260 +16132 +4616 +3505 +14452 +10756 +191 +8073 +479 +13987 +14278 +10273 +9516 +13779 +11450 +10853 +6560 +10506 +19086 +18039 +9299 +11353 +5320 +16870 +14867 +167 +4794 +17329 +14958 +10076 +17110 +6788 +18190 +16720 +8224 +795 +4646 +6493 +1161 +5263 +10666 +748 +10573 +9966 +6233 +17645 +6417 +16039 +10192 +17280 +6430 +18198 +8044 +4755 +7504 +2203 +6848 +16849 +7324 +7591 +5536 +2021 +18495 +17862 +3744 +11217 +7378 +9632 +10720 +11790 +7906 +8422 +16003 +9140 +11526 +7747 +1148 +17188 +15170 +14893 +2288 +1242 +1044 +15730 +2828 +17845 +15822 +8368 +18914 +3357 +16524 +3520 +7310 +8211 +9024 +6767 +9319 +7926 +7467 +8259 +2377 +2483 +15244 +4914 +17406 +8216 +17683 +19085 +1387 +6646 +14486 +10510 +18046 +11070 +13360 +16754 +15081 +9737 +3911 +4777 +10278 +15289 +14511 +17201 +7858 +18664 +12469 +18097 +6663 +10134 +3399 +3912 +10869 +3442 +17538 +17850 +17631 +2782 +326 +16022 +18134 +9553 +16702 +7882 +7788 +7816 +1877 +1951 +1047 +5321 +11269 +1555 +11555 +10739 +8981 +16342 +13822 +979 +17702 +9247 +921 +18937 +16591 +1535 +13921 +4600 +12206 +12042 +19793 +10602 +19418 +7187 +9416 +4614 +16415 +14096 +13803 +226 +16737 +19230 +13198 +18116 +10277 +14249 +17439 +19986 +13236 +17136 +12900 +5341 +7985 +2679 +5627 +9312 +10199 +16861 +2942 +1852 +10466 +7838 +11922 +8420 +15176 +2986 +17555 +5978 +7507 +4112 +1992 +1988 +6446 +10154 +6176 +16089 +9104 +11211 +18823 +18351 +8555 +11458 +10327 +15240 +3768 +1397 +16753 +1435 +19820 +2920 +17298 +14659 +9014 +16372 +7697 +17405 +11495 +14499 +7238 +2422 +3904 +13281 +17674 +10891 +2231 +16960 +7274 +12581 +14323 +16416 +15765 +724 +17605 +2601 +16006 +4423 +17675 +16772 +15137 +12001 +12449 +14088 +2348 +19239 +19610 +12057 +18615 +11643 +5915 +19006 +9876 +17123 +18082 +17785 +4026 +17663 +17042 +17964 +11624 +5976 +15444 +10059 +15667 +15786 +12511 +11528 +7769 +17282 +12557 +10398 +18996 +2584 +6022 +16775 +14244 +5590 +7363 +875 +6815 +15076 +14959 +557 +2437 +9090 +2020 +19675 +405 +18129 +12453 +18373 +8859 +16864 +17115 +14085 +17182 +11106 +12069 +12909 +7080 +11712 +16142 +217 +7297 +11393 +18678 +14908 +8633 +8695 +10844 +6283 +527 +17049 +8815 +18650 +18884 +13586 +15995 +19789 +4881 +7954 +19487 +12038 +2817 +19863 +9280 +8054 +19464 +13003 +3267 +8071 +16069 +10342 +6306 +11396 +6477 +8864 +5704 +2710 +12199 +19054 +8150 +18916 +598 +1798 +10862 +3564 +2493 +11425 +19355 +43 +2000 +6381 +7100 +11343 +863 +13642 +17638 +268 +13767 +4498 +5229 +3469 +11367 +14847 +4946 +11731 +13604 +11640 +402 +15347 +19050 +10879 +2674 +13005 +15778 +10391 +11884 +3160 +7852 +14628 +18986 +1357 +10049 +15644 +12059 +17044 +10057 +11641 +5467 +19892 +11377 +9988 +4316 +12799 +18538 +1474 +13114 +14950 +5039 +16025 +9250 +10657 +7118 +4222 +19918 +14667 +15052 +16492 +5938 +900 +7900 +7710 +5822 +18875 +8196 +18882 +2880 +1152 +12659 +5037 +10089 +10221 +4065 +13978 +926 +16585 +18992 +12586 +2191 +9141 +528 +19659 +7864 +12705 +19187 +17454 +5459 +794 +2685 +3822 +14642 +12897 +12235 +18761 +7972 +18561 +15638 +3558 +3281 +11239 +12014 +81 +14644 +6095 +7307 +19241 +11026 +19273 +4402 +9027 +17908 +13087 +9145 +5881 +13560 +12142 +15568 +7465 +5444 +16213 +19698 +2972 +6944 +17487 +19328 +2036 +9863 +13626 +18917 +11146 +9070 +19393 +7971 +11890 +5695 +635 +10250 +295 +15996 +17229 +9818 +17134 +15200 +3936 +1634 +12688 +3340 +7352 +18614 +16175 +12743 +12930 +17127 +15322 +11875 +7639 +13703 +17626 +17535 +19031 +6930 +14697 +1825 +16979 +3705 +18768 +8208 +16300 +4000 +11325 +16131 +15139 +12729 +13528 +332 +18635 +16676 +10965 +15507 +7223 +639 +13513 +856 +8973 +9929 +9743 +19521 +19061 +11018 +3185 +11891 +16895 +2198 +19403 +3970 +10820 +9093 +4773 +15782 +10687 +12854 +5884 +11595 +15030 +2711 +5526 +12793 +6369 +6740 +14772 +18938 +3802 +19193 +6108 +4678 +907 +3461 +16201 +5374 +11025 +539 +11369 +2622 +12082 +11433 +9720 +11321 +12455 +2353 +3790 +6902 +449 +7641 +5161 +19164 +14956 +8586 +2591 +16662 +19906 +2380 +12652 +9882 +14462 +779 +8482 +2800 +16037 +15024 +11349 +12814 +9198 +4722 +2446 +1556 +12784 +8673 +16469 +415 +7447 +11195 +10674 +1046 +12767 +18816 +14060 +6056 +4578 +10502 +12510 +2802 +10838 +3637 +1690 +3156 +8481 +1662 +7583 +6152 +1862 +9289 +7438 +7598 +5326 +13903 +16604 +17475 +9371 +3069 +4759 +19035 +16499 +11168 +2194 +10852 +8599 +8552 +4281 +18637 +18012 +375 +15003 +5165 +5574 +16872 +12433 +10637 +5673 +653 +10539 +10521 +8807 +12451 +19728 +10072 +5563 +13953 +8904 +15337 +16685 +19478 +7023 +9759 +616 +15171 +2579 +2117 +10525 +3776 +8050 +12265 +2659 +10955 +4871 +8826 +5215 +8556 +7636 +5354 +9040 +16536 +2478 +4610 +7428 +1310 +14804 +15627 +5729 +13802 +4533 +7916 +17655 +9218 +9878 +8901 +14109 +15473 +18424 +14516 +17854 +922 +9809 +777 +15617 +1328 +6959 +16227 +11101 +16684 +1801 +5166 +3937 +8975 +19858 +5359 +4985 +11760 +5918 +16780 +10560 +15954 +7804 +3155 +6148 +12639 +6777 +120 +15463 +11542 +3639 +1391 +19390 +8181 +7014 +10253 +3250 +15768 +1224 +3635 +17809 +1016 +18230 +8803 +11834 +14932 +9345 +8653 +9225 +17041 +213 +1541 +13991 +16261 +12413 +19838 +8918 +809 +13016 +5260 +5055 +10934 +10983 +19317 +3855 +18375 +13094 +17275 +3345 +582 +8155 +15791 +2259 +9749 +3612 +13735 +1619 +18673 +10429 +7055 +3676 +3787 +11307 +8421 +1385 +5837 +11412 +8363 +9380 +5042 +8496 +10106 +6121 +4167 +18201 +13748 +12307 +109 +6346 +13306 +10480 +12215 +17004 +14747 +13535 +16264 +1172 +14846 +5114 +19359 +11684 +10032 +8835 +12411 +4147 +19345 +2363 +10354 +9495 +9197 +15041 +1943 +19543 +13605 +2240 +7746 +4005 +15943 +2549 +1421 +13992 +15064 +12013 +5570 +18797 +16442 +13196 +6916 +9235 +137 +7200 +5527 +6624 +16927 +13187 +17080 +12312 +5464 +8951 +6445 +9958 +12928 +1917 +14677 +13004 +2429 +4643 +15183 +12254 +19921 +6191 +11831 +13834 +16233 +19879 +4656 +14240 +5820 +13572 +5939 +13868 +4798 +9814 +10744 +4417 +15897 +11917 +12437 +3197 +14604 +646 +17778 +6926 +7007 +18540 +4762 +11729 +6453 +16615 +15672 +8745 +8164 +1053 +10646 +18766 +7477 +14917 +19578 +4236 +6537 +10230 +18156 +10047 +16229 +497 +18798 +9853 +2838 +1259 +8518 +9677 +10997 +18749 +19570 +13151 +13964 +9652 +14081 +2596 +8611 +10570 +10854 +5200 +2944 +951 +12686 +16778 +2324 +17719 +8357 +489 +18662 +18101 +9890 +8036 +1729 +443 +1289 +3196 +12816 +12016 +559 +13561 +5773 +2018 +12529 +19632 +2992 +7877 +8451 +2213 +10654 +1527 +11087 +18384 +9763 +6650 +11809 +1609 +4467 +10204 +1488 +15738 +14701 +15455 +2079 +3456 +11029 +15574 +7377 +9987 +2948 +5175 +14345 +7366 +5213 +7608 +19866 +10247 +3374 +11014 +5775 +8122 +2564 +11404 +10184 +12264 +7048 +18945 +19704 +8325 +18305 +13815 +10132 +6797 +10936 +1702 +10350 +3315 +1039 +19438 +7141 +499 +4415 +17139 +12106 +15573 +13098 +9349 +2740 +6011 +17074 +14704 +13188 +12325 +5268 +128 +3117 +17471 +7712 +19416 +6805 +5840 +18755 +1747 +12198 +2297 +6940 +7928 +3557 +16605 +9100 +3284 +929 +2991 +5171 +9105 +6612 +8201 +17441 +10795 +7211 +9938 +4213 +9610 +15608 +6395 +14637 +18330 +11331 +13876 +9594 +2243 +13102 +12866 +13537 +8418 +15277 +16949 +11213 +19616 +8513 +15023 +14446 +6948 +8498 +10269 +9670 +14458 +6901 +11357 +19957 +10534 +16712 +18348 +1383 +5275 +16251 +333 +2412 +14927 +7276 +1858 +4349 +3275 +648 +5278 +9666 +6384 +7228 +17464 +4764 +16289 +2921 +19010 +7815 +3736 +11913 +19719 +16259 +8890 +18025 +1886 +18121 +4821 +7384 +5276 +11473 +6379 +12858 +13407 +2561 +19861 +7675 +15363 +16265 +10215 +15396 +17059 +14382 +9101 +13831 +17112 +1118 +19648 +12896 +15509 +1621 +18998 +17789 +14808 +2200 +17934 +9253 +16813 +8397 +9695 +17162 +12788 +15149 +4886 +9657 +17540 +5440 +6871 +446 +7966 +3719 +18020 +8594 +19427 +4106 +1655 +11974 +17266 +18550 +5482 +4944 +17868 +8149 +13808 +1459 +677 +4943 +3369 +13600 +12436 +4788 +16414 +13820 +12613 +17079 +9685 +1791 +19696 +11232 +8813 +6279 +13149 +4003 +1331 +4751 +13718 +17326 +10718 +4988 +8720 +13244 +12894 +4469 +19523 +4164 +574 +3262 +3121 +15197 +12488 +14422 +3394 +15618 +12647 +5404 +8148 +18660 +6270 +6769 +12942 +16017 +4344 +14650 +2435 +4241 +18303 +9680 +15286 +13701 +16994 +11131 +7553 +2568 +9968 +6309 +11711 +8818 +14293 +13980 +1157 +6691 +17351 +801 +17557 +1268 +10067 +18697 +15903 +11645 +7544 +7831 +10738 +18610 +19076 +10609 +7455 +12919 +412 +4731 +15175 +9352 +4903 +3856 +12088 +7429 +16924 +5427 +15464 +10176 +11120 +19541 +1626 +17762 +17228 +3076 +17289 +7974 +15069 +17047 +11409 +7799 +2707 +7794 +15153 +16613 +3139 +14179 +12875 +17143 +9761 +12067 +6544 +4249 +6828 +11108 +17891 +13329 +6349 +1526 +14859 +3882 +14876 +13375 +1311 +512 +19351 +1517 +10942 +19710 +12323 +3382 +16148 +9603 +15167 +7444 +1961 +17744 +18475 +6961 +11835 +12011 +13212 +19177 +15521 +16905 +8607 +13854 +905 +4023 +19920 +1113 +665 +888 +16595 +10604 +10613 +6549 +4809 +12713 +6988 +7495 +4539 +1238 +9551 +14471 +13112 +18767 +17729 +10282 +14074 +9360 +12943 +116 +10781 +18042 +8436 +14543 +5234 +5963 +14405 +19971 +1195 +1694 +19717 +16271 +9803 +2931 +3670 +5140 +12918 +9154 +15316 +4203 +5170 +13130 +12889 +18632 +12169 +5109 +4927 +13882 +1892 +9167 +5772 +11017 +7604 +8626 +254 +17357 +519 +11928 +610 +19953 +8246 +1815 +18859 +19000 +11059 +13451 +12572 +7127 +5540 +2675 +12233 +11916 +19785 +5499 +18869 +13170 +14185 +7098 +17890 +7125 +3362 +4796 +12872 +13299 +18437 +1515 +16028 +924 +15969 +13406 +6335 +19083 +19680 +8405 +6974 +14150 +18472 +175 +17704 +6026 +10359 +125 +9949 +323 +16066 +8426 +9705 +17840 +11618 +16405 +17831 +5495 +7925 +5446 +13136 +16856 +501 +5798 +5046 +18804 +2436 +15071 +1789 +3595 +9365 +573 +14080 +6014 +1401 +10190 +7089 +1300 +15946 +5040 +3788 +7285 +10547 +8250 +13270 +19474 +5254 +18304 +3166 +8157 +14246 +1905 +18877 +1826 +14292 +2116 +14290 +14303 +19315 +3500 +1440 +17336 +4125 +5832 +13656 +7446 +1578 +18255 +13466 +2394 +10357 +10322 +16599 +484 +14238 +16871 +576 +19975 +13303 +3587 +11715 +3858 +19108 +13193 +6484 +16913 +13746 +3689 +7785 +11274 +3226 +867 +3521 +9875 +7548 +11683 +2938 +2808 +10639 +5637 +12182 +14113 +8393 +19388 +14595 +2186 +13448 +16746 +4338 +14350 +6545 +15318 +11072 +12553 +189 +5154 +19178 +14990 +7640 +16551 +114 +1718 +17988 +16207 +18663 +8784 +19889 +15104 +14822 +10831 +1235 +3859 +6637 +8056 +15442 +3255 +12219 +1651 +13557 +2588 +674 +4427 +1533 +790 +4406 +19996 +6344 +6631 +2247 +5894 +5984 +9042 +18361 +16707 +1207 +10035 +2604 +9086 +9038 +2093 +9184 +12278 +14256 +475 +18083 +376 +16078 +17109 +16982 +6483 +14280 +18418 +18093 +16337 +12183 +11093 +11437 +16118 +14962 +13543 +11745 +4113 +5099 +13806 +19115 +15015 +16645 +10805 +16214 +19047 +12324 +16211 +18511 +16564 +14116 +7889 +1392 +16836 +764 +5843 +6642 +10019 +652 +9520 +12063 +12796 +5614 +3854 +13715 +1967 +6234 +19116 +17506 +5372 +1757 +9779 +1602 +17388 +1426 +10242 +15945 +15458 +16226 +3591 +1600 +8249 +19284 +11497 +19087 +19865 +1171 +13498 +9789 +11682 +10949 +1897 +16649 +6389 +17446 +4783 +6917 +7019 +16224 +11046 +6236 +15851 +1965 +6323 +15120 +13774 +1913 +668 +6193 +11617 +18867 +1839 +1507 +19433 +18326 +5922 +15468 +14764 +19434 +15915 +17531 +2201 +9970 +8108 +6647 +3871 +15044 +198 +13071 +13836 +2234 +3248 +7027 +18630 +6894 +8504 +14268 +13542 +12579 +4510 +14641 +11348 +10437 +411 +9682 +13850 +12554 +2215 +4432 +19754 +6577 +6692 +5885 +13896 +13530 +8995 +8984 +6713 +1638 +13610 +12847 +8177 +17639 +5061 +7959 +16560 +5002 +5882 +10017 +7224 +2383 +395 +10415 +14874 +10808 +19361 +1853 +5595 +2833 +2630 +4200 +9069 +953 +1704 +2651 +5490 +15447 +6469 +18785 +15647 +8618 +18836 +8001 +6054 +12794 +8130 +11472 +14941 +12022 +5015 +14748 +19796 +10336 +16788 +9751 +8247 +16711 +5665 +480 +9231 +19950 +9124 +5067 +12568 +8320 +16221 +12513 +4007 +11214 +7084 +18858 +15861 +5809 +3408 +12988 +18103 +2228 +2414 +11002 +11463 +487 +2084 +873 +1499 +6827 +8902 +19125 +1699 +6154 +29 +14125 +9699 +16418 +3683 +6248 +7809 +2144 +9001 +8404 +8930 +6509 +10207 +2609 +14163 +15598 +5857 +731 +6295 +16312 +13307 +8062 +18874 +6720 +14190 +9457 +18814 +18570 +4360 +18309 +6782 +9548 +14992 +17017 +16082 +2331 +6703 +13941 +16808 +6596 +18048 +12268 +2472 +11044 +19068 +18961 +3910 +14000 +9847 +2769 +4774 +15335 +2071 +7173 +13524 +16700 +1006 +4290 +9556 From 795d89f11df13d3efe5241e2666c72a888640299 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 21 Apr 2021 11:08:40 +0200 Subject: [PATCH 0390/1135] ls: don't escape backslash in shell style quoting --- src/uu/ls/src/quoting_style.rs | 21 +++++++++++++++++++-- tests/by-util/test_ls.rs | 22 ++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/uu/ls/src/quoting_style.rs b/src/uu/ls/src/quoting_style.rs index ceb54466c..173831ac1 100644 --- a/src/uu/ls/src/quoting_style.rs +++ b/src/uu/ls/src/quoting_style.rs @@ -1,6 +1,6 @@ use std::char::from_digit; -const SPECIAL_SHELL_CHARS: &str = "~`#$&*()\\|[]{};'\"<>?! "; +const SPECIAL_SHELL_CHARS: &str = "~`#$&*()|[]{};'\"<>?! "; pub(super) enum QuotingStyle { Shell { @@ -135,7 +135,6 @@ impl EscapedChar { '\x0B' => Backslash('v'), '\x0C' => Backslash('f'), '\r' => Backslash('r'), - '\\' => Backslash('\\'), '\x00'..='\x1F' | '\x7F' => Octal(EscapeOctal::from(c)), '\'' => match quotes { Quotes::Single => Backslash('\''), @@ -627,4 +626,22 @@ mod tests { ], ); } + + #[test] + fn test_backslash() { + // Escaped in C-style, but not in Shell-style escaping + check_names( + "one\\two", + vec![ + ("one\\two", "literal"), + ("one\\two", "literal-show"), + ("one\\\\two", "escape"), + ("\"one\\\\two\"", "c"), + ("one\\two", "shell"), + ("\'one\\two\'", "shell-always"), + ("one\\two", "shell-escape"), + ("'one\\two'", "shell-escape-always"), + ], + ); + } } diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index f0db7ca9c..75f50b640 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1049,6 +1049,7 @@ fn test_ls_quoting_style() { at.touch("one two"); at.touch("one"); + at.touch("one\\two"); // It seems that windows doesn't allow \n in filenames. #[cfg(unix)] @@ -1168,6 +1169,27 @@ fn test_ls_quoting_style() { .succeeds() .stdout_only(format!("{}\n", correct)); } + + for (arg, correct) in &[ + ("--quoting-style=literal", "one\\two"), + ("-N", "one\\two"), + ("--quoting-style=c", "\"one\\\\two\""), + ("-Q", "\"one\\\\two\""), + ("--quote-name", "\"one\\\\two\""), + ("--quoting-style=escape", "one\\\\two"), + ("-b", "one\\\\two"), + ("--quoting-style=shell-escape", "one\\two"), + ("--quoting-style=shell-escape-always", "'one\\two'"), + ("--quoting-style=shell", "one\\two"), + ("--quoting-style=shell-always", "'one\\two'"), + ] { + scene + .ucmd() + .arg(arg) + .arg("one\\two") + .succeeds() + .stdout_only(format!("{}\n", correct)); + } } #[test] From f84f23ddfefcef4e71c6ada5f7f35383ee0f613f Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 21 Apr 2021 11:22:10 +0200 Subject: [PATCH 0391/1135] tests/ls: add coverage for special shell character after escaped char --- src/uu/ls/src/quoting_style.rs | 21 +++++++++++++++++---- tests/by-util/test_ls.rs | 15 +++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/uu/ls/src/quoting_style.rs b/src/uu/ls/src/quoting_style.rs index 173831ac1..fd5cab57e 100644 --- a/src/uu/ls/src/quoting_style.rs +++ b/src/uu/ls/src/quoting_style.rs @@ -27,12 +27,10 @@ pub(super) enum Quotes { // This implementation is heavily inspired by the std::char::EscapeDefault implementation // in the Rust standard library. This custom implementation is needed because the // characters \a, \b, \e, \f & \v are not recognized by Rust. -#[derive(Clone, Debug)] struct EscapedChar { state: EscapeState, } -#[derive(Clone, Debug)] enum EscapeState { Done, Char(char), @@ -41,14 +39,12 @@ enum EscapeState { Octal(EscapeOctal), } -#[derive(Clone, Debug)] struct EscapeOctal { c: char, state: EscapeOctalState, idx: usize, } -#[derive(Clone, Debug)] enum EscapeOctalState { Done, Backslash, @@ -510,6 +506,23 @@ mod tests { ], ); + // A control character followed by a special shell character + check_names( + "one\n&two", + vec![ + ("one?&two", "literal"), + ("one\n&two", "literal-show"), + ("one\\n&two", "escape"), + ("\"one\\n&two\"", "c"), + ("'one?&two'", "shell"), + ("'one\n&two'", "shell-show"), + ("'one?&two'", "shell-always"), + ("'one\n&two'", "shell-always-show"), + ("'one'$'\\n''&two'", "shell-escape"), + ("'one'$'\\n''&two'", "shell-escape-always"), + ], + ); + // The first 16 control characters. NUL is also included, even though it is of // no importance for file names. check_names( diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 75f50b640..001a97d1a 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1190,6 +1190,21 @@ fn test_ls_quoting_style() { .succeeds() .stdout_only(format!("{}\n", correct)); } + + // Tests for a character that forces quotation in shell-style escaping + // after a character in a dollar expression + at.touch("one\n&two"); + for (arg, correct) in &[ + ("--quoting-style=shell-escape", "'one'$'\\n''&two'"), + ("--quoting-style=shell-escape-always", "'one'$'\\n''&two'"), + ] { + scene + .ucmd() + .arg(arg) + .arg("one\n&two") + .succeeds() + .stdout_only(format!("{}\n", correct)); + } } #[test] From bee9156764b8a57845948c2c7adca498945b049f Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 21 Apr 2021 12:03:48 +0200 Subject: [PATCH 0392/1135] tests/ls: improve code cov --- tests/by-util/test_ls.rs | 149 +++++++++++++++++++++++++++++++++------ 1 file changed, 127 insertions(+), 22 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 001a97d1a..7546a606c 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -102,6 +102,12 @@ fn test_ls_width() { .succeeds() .stdout_only("test-width-1\ntest-width-2\ntest-width-3\ntest-width-4\n"); } + + scene + .ucmd() + .arg("-w=bad") + .fails() + .stderr_contains("invalid line width"); } #[test] @@ -435,6 +441,39 @@ fn test_ls_deref() { assert!(!re.is_match(result.stdout_str().trim())); } +#[test] +fn test_ls_sort_none() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.touch("test-3"); + at.touch("test-1"); + at.touch("test-2"); + + // Order is not specified so we just check that it doesn't + // give any errors. + scene.ucmd().arg("--sort=none").succeeds(); + scene.ucmd().arg("-U").succeeds(); +} + +#[test] +fn test_ls_sort_name() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.touch("test-3"); + at.touch("test-1"); + at.touch("test-2"); + + let sep = if cfg!(unix) { "\n" } else { " " }; + + scene + .ucmd() + .arg("--sort=name") + .succeeds() + .stdout_is(["test-1", "test-2", "test-3\n"].join(sep)); +} + #[test] fn test_ls_order_size() { let scene = TestScenario::new(util_name!()); @@ -463,6 +502,18 @@ fn test_ls_order_size() { result.stdout_only("test-1\ntest-2\ntest-3\ntest-4\n"); #[cfg(windows)] result.stdout_only("test-1 test-2 test-3 test-4\n"); + + let result = scene.ucmd().arg("--sort=size").succeeds(); + #[cfg(not(windows))] + result.stdout_only("test-4\ntest-3\ntest-2\ntest-1\n"); + #[cfg(windows)] + result.stdout_only("test-4 test-3 test-2 test-1\n"); + + let result = scene.ucmd().arg("--sort=size").arg("-r").succeeds(); + #[cfg(not(windows))] + result.stdout_only("test-1\ntest-2\ntest-3\ntest-4\n"); + #[cfg(windows)] + result.stdout_only("test-1 test-2 test-3 test-4\n"); } #[test] @@ -471,13 +522,16 @@ fn test_ls_long_ctime() { let at = &scene.fixtures; at.touch("test-long-ctime-1"); - let result = scene.ucmd().arg("-lc").succeeds(); - // Should show the time on Unix, but question marks on windows. - #[cfg(unix)] - result.stdout_contains(":"); - #[cfg(not(unix))] - result.stdout_contains("???"); + for arg in &["-c", "--time=ctime", "--time=status"] { + let result = scene.ucmd().arg("-l").arg(arg).succeeds(); + + // Should show the time on Unix, but question marks on windows. + #[cfg(unix)] + result.stdout_contains(":"); + #[cfg(not(unix))] + result.stdout_contains("???"); + } } #[test] @@ -518,32 +572,46 @@ fn test_ls_order_time() { #[cfg(windows)] result.stdout_only("test-4 test-3 test-2 test-1\n"); + let result = scene.ucmd().arg("--sort=time").succeeds(); + #[cfg(not(windows))] + result.stdout_only("test-4\ntest-3\ntest-2\ntest-1\n"); + #[cfg(windows)] + result.stdout_only("test-4 test-3 test-2 test-1\n"); + let result = scene.ucmd().arg("-tr").succeeds(); #[cfg(not(windows))] result.stdout_only("test-1\ntest-2\ntest-3\ntest-4\n"); #[cfg(windows)] result.stdout_only("test-1 test-2 test-3 test-4\n"); + let result = scene.ucmd().arg("--sort=time").arg("-r").succeeds(); + #[cfg(not(windows))] + result.stdout_only("test-1\ntest-2\ntest-3\ntest-4\n"); + #[cfg(windows)] + result.stdout_only("test-1 test-2 test-3 test-4\n"); + // 3 was accessed last in the read // So the order should be 2 3 4 1 - let result = scene.ucmd().arg("-tu").succeeds(); - let file3_access = at.open("test-3").metadata().unwrap().accessed().unwrap(); - let file4_access = at.open("test-4").metadata().unwrap().accessed().unwrap(); + for arg in &["-u", "--time=atime", "--time=access", "--time=use"] { + let result = scene.ucmd().arg("-t").arg(arg).succeeds(); + let file3_access = at.open("test-3").metadata().unwrap().accessed().unwrap(); + let file4_access = at.open("test-4").metadata().unwrap().accessed().unwrap(); - // It seems to be dependent on the platform whether the access time is actually set - if file3_access > file4_access { - if cfg!(not(windows)) { - result.stdout_only("test-3\ntest-4\ntest-2\ntest-1\n"); + // It seems to be dependent on the platform whether the access time is actually set + if file3_access > file4_access { + if cfg!(not(windows)) { + result.stdout_only("test-3\ntest-4\ntest-2\ntest-1\n"); + } else { + result.stdout_only("test-3 test-4 test-2 test-1\n"); + } } else { - result.stdout_only("test-3 test-4 test-2 test-1\n"); - } - } else { - // Access time does not seem to be set on Windows and some other - // systems so the order is 4 3 2 1 - if cfg!(not(windows)) { - result.stdout_only("test-4\ntest-3\ntest-2\ntest-1\n"); - } else { - result.stdout_only("test-4 test-3 test-2 test-1\n"); + // Access time does not seem to be set on Windows and some other + // systems so the order is 4 3 2 1 + if cfg!(not(windows)) { + result.stdout_only("test-4\ntest-3\ntest-2\ntest-1\n"); + } else { + result.stdout_only("test-4 test-3 test-2 test-1\n"); + } } } @@ -1351,3 +1419,40 @@ fn test_ls_ignore_hide() { .stderr_contains(&"Invalid pattern") .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); } + +#[test] +fn test_ls_ignore_backups() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.touch("somefile"); + at.touch("somebackup~"); + at.touch(".somehiddenfile"); + at.touch(".somehiddenbackup~"); + + scene.ucmd().arg("-B").succeeds().stdout_is("somefile\n"); + scene + .ucmd() + .arg("--ignore-backups") + .succeeds() + .stdout_is("somefile\n"); + + scene + .ucmd() + .arg("-aB") + .succeeds() + .stdout_contains(".somehiddenfile") + .stdout_contains("somefile") + .stdout_does_not_contain("somebackup") + .stdout_does_not_contain(".somehiddenbackup~"); + + scene + .ucmd() + .arg("-a") + .arg("--ignore-backups") + .succeeds() + .stdout_contains(".somehiddenfile") + .stdout_contains("somefile") + .stdout_does_not_contain("somebackup") + .stdout_does_not_contain(".somehiddenbackup~"); +} From 387227087f1b755068cc92f36fe823d07cf9a269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81rni=20Dagur?= Date: Wed, 21 Apr 2021 10:21:31 +0000 Subject: [PATCH 0393/1135] cat: Put splice code in separate file, handle more failures (#2067) * cat: Refactor splice code, handle more failures * cat: Add tests for stdout redirected to files --- src/uu/cat/src/cat.rs | 85 +++--------------------------------- src/uu/cat/src/splice.rs | 91 +++++++++++++++++++++++++++++++++++++++ tests/by-util/test_cat.rs | 72 ++++++++++++++++++++++++++++++- tests/common/util.rs | 39 +++++++++++++---- 4 files changed, 199 insertions(+), 88 deletions(-) create mode 100644 src/uu/cat/src/splice.rs diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index 7d56a7485..e507c5acd 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -22,6 +22,12 @@ use std::io::{self, Read, Write}; use thiserror::Error; use uucore::fs::is_stdin_interactive; +/// Linux splice support +#[cfg(any(target_os = "linux", target_os = "android"))] +mod splice; +#[cfg(any(target_os = "linux", target_os = "android"))] +use std::os::unix::io::{AsRawFd, RawFd}; + /// Unix domain socket support #[cfg(unix)] use std::net::Shutdown; @@ -30,14 +36,6 @@ use std::os::unix::fs::FileTypeExt; #[cfg(unix)] use unix_socket::UnixStream; -/// Linux splice support -#[cfg(any(target_os = "linux", target_os = "android"))] -use nix::fcntl::{splice, SpliceFFlags}; -#[cfg(any(target_os = "linux", target_os = "android"))] -use nix::unistd::pipe; -#[cfg(any(target_os = "linux", target_os = "android"))] -use std::os::unix::io::{AsRawFd, RawFd}; - static NAME: &str = "cat"; static VERSION: &str = env!("CARGO_PKG_VERSION"); static SYNTAX: &str = "[OPTION]... [FILE]..."; @@ -395,7 +393,7 @@ fn write_fast(handle: &mut InputHandle) -> CatResult<()> { { // If we're on Linux or Android, try to use the splice() system call // for faster writing. If it works, we're done. - if !write_fast_using_splice(handle, stdout_lock.as_raw_fd())? { + if !splice::write_fast_using_splice(handle, stdout_lock.as_raw_fd())? { return Ok(()); } } @@ -411,75 +409,6 @@ fn write_fast(handle: &mut InputHandle) -> CatResult<()> { Ok(()) } -/// This function is called from `write_fast()` on Linux and Android. The -/// function `splice()` is used to move data between two file descriptors -/// without copying between kernel- and userspace. This results in a large -/// speedup. -/// -/// The `bool` in the result value indicates if we need to fall back to normal -/// copying or not. False means we don't have to. -#[cfg(any(target_os = "linux", target_os = "android"))] -#[inline] -fn write_fast_using_splice(handle: &mut InputHandle, writer: RawFd) -> CatResult { - const BUF_SIZE: usize = 1024 * 16; - - let (pipe_rd, pipe_wr) = pipe()?; - - // We only fall back if splice fails on the first call. - match splice( - handle.file_descriptor, - None, - pipe_wr, - None, - BUF_SIZE, - SpliceFFlags::empty(), - ) { - Ok(n) => { - if n == 0 { - return Ok(false); - } - splice_exact(pipe_rd, writer, n)?; - } - Err(_) => { - return Ok(true); - } - } - - loop { - let n = splice( - handle.file_descriptor, - None, - pipe_wr, - None, - BUF_SIZE, - SpliceFFlags::empty(), - )?; - if n == 0 { - // We read 0 bytes from the input, - // which means we're done copying. - break; - } - splice_exact(pipe_rd, writer, n)?; - } - - Ok(false) -} - -/// Splice wrapper which handles short writes -#[cfg(any(target_os = "linux", target_os = "android"))] -#[inline] -fn splice_exact(read_fd: RawFd, write_fd: RawFd, num_bytes: usize) -> nix::Result<()> { - let mut left = num_bytes; - loop { - let written = splice(read_fd, None, write_fd, None, left, SpliceFFlags::empty())?; - left -= written; - if left == 0 { - break; - } - } - Ok(()) -} - /// Outputs file contents to stdout in a line-by-line fashion, /// propagating any errors that might occur. fn write_lines( diff --git a/src/uu/cat/src/splice.rs b/src/uu/cat/src/splice.rs new file mode 100644 index 000000000..ccc625467 --- /dev/null +++ b/src/uu/cat/src/splice.rs @@ -0,0 +1,91 @@ +use super::{CatResult, InputHandle}; + +use nix::fcntl::{splice, SpliceFFlags}; +use nix::unistd::{self, pipe}; +use std::io::Read; +use std::os::unix::io::RawFd; + +const BUF_SIZE: usize = 1024 * 16; + +/// This function is called from `write_fast()` on Linux and Android. The +/// function `splice()` is used to move data between two file descriptors +/// without copying between kernel- and userspace. This results in a large +/// speedup. +/// +/// The `bool` in the result value indicates if we need to fall back to normal +/// copying or not. False means we don't have to. +#[inline] +pub(super) fn write_fast_using_splice( + handle: &mut InputHandle, + write_fd: RawFd, +) -> CatResult { + let (pipe_rd, pipe_wr) = match pipe() { + Ok(r) => r, + Err(_) => { + // It is very rare that creating a pipe fails, but it can happen. + return Ok(true); + } + }; + + loop { + match splice( + handle.file_descriptor, + None, + pipe_wr, + None, + BUF_SIZE, + SpliceFFlags::empty(), + ) { + Ok(n) => { + if n == 0 { + return Ok(false); + } + if splice_exact(pipe_rd, write_fd, n).is_err() { + // If the first splice manages to copy to the intermediate + // pipe, but the second splice to stdout fails for some reason + // we can recover by copying the data that we have from the + // intermediate pipe to stdout using normal read/write. Then + // we tell the caller to fall back. + copy_exact(pipe_rd, write_fd, n)?; + return Ok(true); + } + } + Err(_) => { + return Ok(true); + } + } + } +} + +/// Splice wrapper which handles short writes. +#[inline] +fn splice_exact(read_fd: RawFd, write_fd: RawFd, num_bytes: usize) -> nix::Result<()> { + let mut left = num_bytes; + loop { + let written = splice(read_fd, None, write_fd, None, left, SpliceFFlags::empty())?; + left -= written; + if left == 0 { + break; + } + } + Ok(()) +} + +/// Caller must ensure that `num_bytes <= BUF_SIZE`, otherwise this function +/// will panic. The way we use this function in `write_fast_using_splice` +/// above is safe because `splice` is set to write at most `BUF_SIZE` to the +/// pipe. +#[inline] +fn copy_exact(read_fd: RawFd, write_fd: RawFd, num_bytes: usize) -> nix::Result<()> { + let mut left = num_bytes; + let mut buf = [0; BUF_SIZE]; + loop { + let read = unistd::read(read_fd, &mut buf[..left])?; + let written = unistd::write(write_fd, &mut buf[..read])?; + left -= written; + if left == 0 { + break; + } + } + Ok(()) +} diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index 389269395..d7c3eec6b 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -1,4 +1,7 @@ use crate::common::util::*; +#[cfg(unix)] +use std::fs::OpenOptions; +#[cfg(unix)] use std::io::Read; #[test] @@ -54,7 +57,6 @@ fn test_no_options_big_input() { #[test] #[cfg(unix)] fn test_fifo_symlink() { - use std::fs::OpenOptions; use std::io::Write; use std::thread; @@ -85,6 +87,74 @@ fn test_fifo_symlink() { thread.join().unwrap(); } +#[test] +#[cfg(unix)] +fn test_piped_to_regular_file() { + use std::fs::read_to_string; + + for &append in &[true, false] { + let s = TestScenario::new(util_name!()); + let file_path = s.fixtures.plus("file.txt"); + + { + let file = OpenOptions::new() + .create_new(true) + .write(true) + .append(append) + .open(&file_path) + .unwrap(); + + s.ucmd() + .set_stdout(file) + .pipe_in_fixture("alpha.txt") + .succeeds(); + } + let contents = read_to_string(&file_path).unwrap(); + assert_eq!(contents, "abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); + } +} + +#[test] +#[cfg(unix)] +fn test_piped_to_dev_null() { + for &append in &[true, false] { + let s = TestScenario::new(util_name!()); + { + let dev_null = OpenOptions::new() + .write(true) + .append(append) + .open("/dev/null") + .unwrap(); + + s.ucmd() + .set_stdout(dev_null) + .pipe_in_fixture("alpha.txt") + .succeeds(); + } + } +} + +#[test] +#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))] +fn test_piped_to_dev_full() { + for &append in &[true, false] { + let s = TestScenario::new(util_name!()); + { + let dev_full = OpenOptions::new() + .write(true) + .append(append) + .open("/dev/full") + .unwrap(); + + s.ucmd() + .set_stdout(dev_full) + .pipe_in_fixture("alpha.txt") + .fails() + .stderr_contains(&"No space left on device".to_owned()); + } + } +} + #[test] fn test_directory() { let s = TestScenario::new(util_name!()); diff --git a/tests/common/util.rs b/tests/common/util.rs index 55e121737..95a30d47e 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -696,8 +696,11 @@ pub struct UCommand { comm_string: String, tmpd: Option>, has_run: bool, - stdin: Option>, ignore_stdin_write_error: bool, + stdin: Option, + stdout: Option, + stderr: Option, + bytes_into_stdin: Option>, } impl UCommand { @@ -726,8 +729,11 @@ impl UCommand { cmd }, comm_string: String::from(arg.as_ref().to_str().unwrap()), - stdin: None, ignore_stdin_write_error: false, + bytes_into_stdin: None, + stdin: None, + stdout: None, + stderr: None, } } @@ -738,6 +744,21 @@ impl UCommand { ucmd } + pub fn set_stdin>(&mut self, stdin: T) -> &mut UCommand { + self.stdin = Some(stdin.into()); + self + } + + pub fn set_stdout>(&mut self, stdout: T) -> &mut UCommand { + self.stdout = Some(stdout.into()); + self + } + + pub fn set_stderr>(&mut self, stderr: T) -> &mut UCommand { + self.stderr = Some(stderr.into()); + self + } + /// Add a parameter to the invocation. Path arguments are treated relative /// to the test environment directory. pub fn arg>(&mut self, arg: S) -> &mut UCommand { @@ -767,10 +788,10 @@ impl UCommand { /// provides stdinput to feed in to the command when spawned pub fn pipe_in>>(&mut self, input: T) -> &mut UCommand { - if self.stdin.is_some() { + if self.bytes_into_stdin.is_some() { panic!("{}", MULTIPLE_STDIN_MEANINGLESS); } - self.stdin = Some(input.into()); + self.bytes_into_stdin = Some(input.into()); self } @@ -784,7 +805,7 @@ impl UCommand { /// This is typically useful to test non-standard workflows /// like feeding something to a command that does not read it pub fn ignore_stdin_write_error(&mut self) -> &mut UCommand { - if self.stdin.is_none() { + if self.bytes_into_stdin.is_none() { panic!("{}", NO_STDIN_MEANINGLESS); } self.ignore_stdin_write_error = true; @@ -813,13 +834,13 @@ impl UCommand { log_info("run", &self.comm_string); let mut child = self .raw - .stdin(Stdio::piped()) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) + .stdin(self.stdin.take().unwrap_or_else(|| Stdio::piped())) + .stdout(self.stdout.take().unwrap_or_else(|| Stdio::piped())) + .stderr(self.stderr.take().unwrap_or_else(|| Stdio::piped())) .spawn() .unwrap(); - if let Some(ref input) = self.stdin { + if let Some(ref input) = self.bytes_into_stdin { let write_result = child .stdin .take() From f34c992932d11864f1b7412458f549e9f2191898 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 21 Apr 2021 12:45:21 +0200 Subject: [PATCH 0394/1135] ls: always quote backslash in shell style --- src/uu/ls/src/quoting_style.rs | 2 +- tests/by-util/test_ls.rs | 75 +++++++++++++++++----------------- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/src/uu/ls/src/quoting_style.rs b/src/uu/ls/src/quoting_style.rs index fd5cab57e..c4c8200a4 100644 --- a/src/uu/ls/src/quoting_style.rs +++ b/src/uu/ls/src/quoting_style.rs @@ -1,6 +1,6 @@ use std::char::from_digit; -const SPECIAL_SHELL_CHARS: &str = "~`#$&*()|[]{};'\"<>?! "; +const SPECIAL_SHELL_CHARS: &str = "~`#$&*()|[]{};\\'\"<>?! "; pub(super) enum QuotingStyle { Shell { diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index d44074821..718e1db1c 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1118,12 +1118,13 @@ fn test_ls_quoting_style() { at.touch("one two"); at.touch("one"); - at.touch("one\\two"); // It seems that windows doesn't allow \n in filenames. + // And it also doesn't like \, of course. #[cfg(unix)] { at.touch("one\ntwo"); + at.touch("one\\two"); // Default is shell-escape scene .ucmd() @@ -1185,6 +1186,42 @@ fn test_ls_quoting_style() { .succeeds() .stdout_only(format!("{}\n", correct)); } + + for (arg, correct) in &[ + ("--quoting-style=literal", "one\\two"), + ("-N", "one\\two"), + ("--quoting-style=c", "\"one\\\\two\""), + ("-Q", "\"one\\\\two\""), + ("--quote-name", "\"one\\\\two\""), + ("--quoting-style=escape", "one\\\\two"), + ("-b", "one\\\\two"), + ("--quoting-style=shell-escape", "'one\\two'"), + ("--quoting-style=shell-escape-always", "'one\\two'"), + ("--quoting-style=shell", "'one\\two'"), + ("--quoting-style=shell-always", "'one\\two'"), + ] { + scene + .ucmd() + .arg(arg) + .arg("one\\two") + .succeeds() + .stdout_only(format!("{}\n", correct)); + } + + // Tests for a character that forces quotation in shell-style escaping + // after a character in a dollar expression + at.touch("one\n&two"); + for (arg, correct) in &[ + ("--quoting-style=shell-escape", "'one'$'\\n''&two'"), + ("--quoting-style=shell-escape-always", "'one'$'\\n''&two'"), + ] { + scene + .ucmd() + .arg(arg) + .arg("one\n&two") + .succeeds() + .stdout_only(format!("{}\n", correct)); + } } scene @@ -1238,42 +1275,6 @@ fn test_ls_quoting_style() { .succeeds() .stdout_only(format!("{}\n", correct)); } - - for (arg, correct) in &[ - ("--quoting-style=literal", "one\\two"), - ("-N", "one\\two"), - ("--quoting-style=c", "\"one\\\\two\""), - ("-Q", "\"one\\\\two\""), - ("--quote-name", "\"one\\\\two\""), - ("--quoting-style=escape", "one\\\\two"), - ("-b", "one\\\\two"), - ("--quoting-style=shell-escape", "one\\two"), - ("--quoting-style=shell-escape-always", "'one\\two'"), - ("--quoting-style=shell", "one\\two"), - ("--quoting-style=shell-always", "'one\\two'"), - ] { - scene - .ucmd() - .arg(arg) - .arg("one\\two") - .succeeds() - .stdout_only(format!("{}\n", correct)); - } - - // Tests for a character that forces quotation in shell-style escaping - // after a character in a dollar expression - at.touch("one\n&two"); - for (arg, correct) in &[ - ("--quoting-style=shell-escape", "'one'$'\\n''&two'"), - ("--quoting-style=shell-escape-always", "'one'$'\\n''&two'"), - ] { - scene - .ucmd() - .arg(arg) - .arg("one\n&two") - .succeeds() - .stdout_only(format!("{}\n", correct)); - } } #[test] From 29b5b6b27686cc87a4bdb538604c3821dcc4ea24 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 21 Apr 2021 13:03:31 +0200 Subject: [PATCH 0395/1135] ls: fix unit tests to match last change --- src/uu/ls/src/quoting_style.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/ls/src/quoting_style.rs b/src/uu/ls/src/quoting_style.rs index c4c8200a4..49456fc22 100644 --- a/src/uu/ls/src/quoting_style.rs +++ b/src/uu/ls/src/quoting_style.rs @@ -650,9 +650,9 @@ mod tests { ("one\\two", "literal-show"), ("one\\\\two", "escape"), ("\"one\\\\two\"", "c"), - ("one\\two", "shell"), + ("'one\\two'", "shell"), ("\'one\\two\'", "shell-always"), - ("one\\two", "shell-escape"), + ("'one\\two'", "shell-escape"), ("'one\\two'", "shell-escape-always"), ], ); From fb2ae04b8f45e99b1e1217a08c40adfdd9673d78 Mon Sep 17 00:00:00 2001 From: jaggededgedjustice Date: Wed, 21 Apr 2021 13:22:05 +0100 Subject: [PATCH 0396/1135] Remove broken GNU test for printf (#2095) --- .github/workflows/GNU.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 35efccbe5..a68f0a083 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -80,6 +80,9 @@ jobs: -e '/tests\/misc\/help-version-getopt.sh/ D' \ Makefile + # printf doesn't limit the values used in its arg, so this produced ~2GB of output + sed -i '/INT_OFLOW/ D' tests/misc/printf.sh + # Use the system coreutils where the test fails due to error in a util that is not the one being tested sed -i 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh sed -i 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh tests/du/8gb.sh From 34a824af71705279e6f3a213668c495e0e6bd396 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 21 Apr 2021 16:58:37 +0200 Subject: [PATCH 0397/1135] ls: use lscolors crate --- src/uu/ls/Cargo.toml | 5 +- src/uu/ls/src/ls.rs | 253 ++++++++++++++++----------------------- tests/by-util/test_ls.rs | 27 ++--- 3 files changed, 116 insertions(+), 169 deletions(-) diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index dacdc7cd9..addca6fbb 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -16,17 +16,14 @@ path = "src/ls.rs" [dependencies] clap = "2.33" -lazy_static = "1.0.1" number_prefix = "0.4" term_grid = "0.1.5" termsize = "0.1.6" time = "0.1.40" -unicode-width = "0.1.5" globset = "0.4.6" +lscolors = { version="0.7.1", features=["ansi_term"] } uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } - -[target.'cfg(unix)'.dependencies] atty = "0.2" [[bin]] diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 514539809..c08e604f9 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 -#[cfg(unix)] -#[macro_use] -extern crate lazy_static; #[macro_use] extern crate uucore; @@ -18,10 +15,9 @@ mod version_cmp; use clap::{App, Arg}; use globset::{self, Glob, GlobSet, GlobSetBuilder}; +use lscolors::LsColors; use number_prefix::NumberPrefix; use quoting_style::{escape_name, QuotingStyle}; -#[cfg(unix)] -use std::collections::HashMap; use std::fs; use std::fs::{DirEntry, FileType, Metadata}; #[cfg(unix)] @@ -41,7 +37,7 @@ use time::{strftime, Timespec}; #[cfg(unix)] use unicode_width::UnicodeWidthStr; #[cfg(unix)] -use uucore::libc::{mode_t, S_ISGID, S_ISUID, S_ISVTX, S_IWOTH, S_IXGRP, S_IXOTH, S_IXUSR}; +use uucore::libc::{mode_t, S_IXGRP, S_IXOTH, S_IXUSR}; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = " @@ -54,30 +50,6 @@ fn get_usage() -> String { format!("{0} [OPTION]... [FILE]...", executable!()) } -#[cfg(unix)] -static DEFAULT_COLORS: &str = "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:"; - -#[cfg(unix)] -lazy_static! { - static ref LS_COLORS: String = - std::env::var("LS_COLORS").unwrap_or_else(|_| DEFAULT_COLORS.to_string()); - static ref COLOR_MAP: HashMap<&'static str, &'static str> = { - let codes = LS_COLORS.split(':'); - let mut map = HashMap::new(); - for c in codes { - let p: Vec<_> = c.splitn(2, '=').collect(); - if p.len() == 2 { - map.insert(p[0], p[1]); - } - } - map - }; - static ref RESET_CODE: &'static str = COLOR_MAP.get("rs").unwrap_or(&"0"); - static ref LEFT_CODE: &'static str = COLOR_MAP.get("lc").unwrap_or(&"\x1b["); - static ref RIGHT_CODE: &'static str = COLOR_MAP.get("rc").unwrap_or(&"m"); - static ref END_CODE: &'static str = COLOR_MAP.get("ec").unwrap_or(&""); -} - pub mod options { pub mod format { pub static ONELINE: &str = "1"; @@ -212,8 +184,7 @@ struct Config { time: Time, #[cfg(unix)] inode: bool, - #[cfg(unix)] - color: bool, + color: Option, long: LongFormat, width: Option, quoting_style: QuotingStyle, @@ -337,8 +308,7 @@ impl Config { Time::Modification }; - #[cfg(unix)] - let color = match options.value_of(options::COLOR) { + let needs_color = match options.value_of(options::COLOR) { None => options.is_present(options::COLOR), Some(val) => match val { "" | "always" | "yes" | "force" => true, @@ -347,6 +317,12 @@ impl Config { }, }; + let color = if needs_color { + Some(LsColors::from_env().unwrap_or_default()) + } else { + None + }; + let size_format = if options.is_present(options::size::HUMAN_READABLE) { SizeFormat::Binary } else if options.is_present(options::size::SI) { @@ -520,7 +496,6 @@ impl Config { size_format, directory: options.is_present(options::DIRECTORY), time, - #[cfg(unix)] color, #[cfg(unix)] inode: options.is_present(options::INODE), @@ -1470,64 +1445,44 @@ fn get_file_name(name: &Path, strip: Option<&Path>) -> String { name.to_string_lossy().into_owned() } -#[cfg(not(unix))] -fn display_file_name( - path: &Path, - strip: Option<&Path>, - metadata: &Metadata, - config: &Config, -) -> Cell { - let mut name = escape_name(get_file_name(path, strip), &config.quoting_style); - let file_type = metadata.file_type(); +// #[cfg(not(unix))] +// fn display_file_name( +// path: &Path, +// strip: Option<&Path>, +// metadata: &Metadata, +// config: &Config, +// ) -> Cell { +// let mut name = escape_name(get_file_name(path, strip), &config.quoting_style); +// let file_type = metadata.file_type(); - match config.indicator_style { - IndicatorStyle::Classify | IndicatorStyle::FileType => { - if file_type.is_dir() { - name.push('/'); - } - if file_type.is_symlink() { - name.push('@'); - } - } - IndicatorStyle::Slash => { - if file_type.is_dir() { - name.push('/'); - } - } - _ => (), - }; +// match config.indicator_style { +// IndicatorStyle::Classify | IndicatorStyle::FileType => { +// if file_type.is_dir() { +// name.push('/'); +// } +// if file_type.is_symlink() { +// name.push('@'); +// } +// } +// IndicatorStyle::Slash => { +// if file_type.is_dir() { +// name.push('/'); +// } +// } +// _ => (), +// }; - if config.format == Format::Long && metadata.file_type().is_symlink() { - if let Ok(target) = path.read_link() { - // We don't bother updating width here because it's not used for long listings - let target_name = target.to_string_lossy().to_string(); - name.push_str(" -> "); - name.push_str(&target_name); - } - } +// if config.format == Format::Long && metadata.file_type().is_symlink() { +// if let Ok(target) = path.read_link() { +// // We don't bother updating width here because it's not used for long listings +// let target_name = target.to_string_lossy().to_string(); +// name.push_str(" -> "); +// name.push_str(&target_name); +// } +// } - name.into() -} - -#[cfg(unix)] -fn color_name(name: String, typ: &str) -> String { - let mut typ = typ; - if !COLOR_MAP.contains_key(typ) { - if typ == "or" { - typ = "ln"; - } else if typ == "mi" { - typ = "fi"; - } - }; - if let Some(code) = COLOR_MAP.get(typ) { - format!( - "{}{}{}{}{}{}{}{}", - *LEFT_CODE, code, *RIGHT_CODE, name, *END_CODE, *LEFT_CODE, *RESET_CODE, *RIGHT_CODE, - ) - } else { - name - } -} +// name.into() +// } #[cfg(unix)] macro_rules! has { @@ -1537,6 +1492,40 @@ macro_rules! has { } #[cfg(unix)] +fn classify_file(md: &Metadata) -> Option { + let file_type = md.file_type(); + if file_type.is_dir() { + Some('/') + } else if file_type.is_symlink() { + Some('@') + } else if file_type.is_socket() { + Some('=') + } else if file_type.is_fifo() { + Some('|') + } else if file_type.is_file() { + let mode = md.mode() as mode_t; + if has!(mode, S_IXUSR | S_IXGRP | S_IXOTH) { + Some('*') + } else { + None + } + } else { + None + } +} + +#[cfg(not(unix))] +fn classify_file(md: &Metadata) -> Option { + let file_type = md.file_type(); + if file_type.is_dir() { + Some('/') + } else if file_type.is_symlink() { + Some('@') + } else { + None + } +} + #[allow(clippy::cognitive_complexity)] fn display_file_name( path: &Path, @@ -1545,65 +1534,18 @@ fn display_file_name( config: &Config, ) -> Cell { let mut name = escape_name(get_file_name(path, strip), &config.quoting_style); + + #[cfg(unix)] if config.format != Format::Long && config.inode { name = get_inode(metadata) + " " + &name; } - let mut width = UnicodeWidthStr::width(&*name); - let ext; - if config.color || config.indicator_style != IndicatorStyle::None { - let file_type = metadata.file_type(); + if let Some(ls_colors) = &config.color { + name = color_name(&ls_colors, path, name, metadata).to_string(); + } - let (code, sym) = if file_type.is_dir() { - ("di", Some('/')) - } else if file_type.is_symlink() { - if path.exists() { - ("ln", Some('@')) - } else { - ("or", Some('@')) - } - } else if file_type.is_socket() { - ("so", Some('=')) - } else if file_type.is_fifo() { - ("pi", Some('|')) - } else if file_type.is_block_device() { - ("bd", None) - } else if file_type.is_char_device() { - ("cd", None) - } else if file_type.is_file() { - let mode = metadata.mode() as mode_t; - let sym = if has!(mode, S_IXUSR | S_IXGRP | S_IXOTH) { - Some('*') - } else { - None - }; - if has!(mode, S_ISUID) { - ("su", sym) - } else if has!(mode, S_ISGID) { - ("sg", sym) - } else if has!(mode, S_ISVTX) && has!(mode, S_IWOTH) { - ("tw", sym) - } else if has!(mode, S_ISVTX) { - ("st", sym) - } else if has!(mode, S_IWOTH) { - ("ow", sym) - } else if has!(mode, S_IXUSR | S_IXGRP | S_IXOTH) { - ("ex", sym) - } else if metadata.nlink() > 1 { - ("mh", sym) - } else if let Some(e) = path.extension() { - ext = format!("*.{}", e.to_string_lossy()); - (ext.as_str(), None) - } else { - ("fi", None) - } - } else { - ("", None) - }; - - if config.color { - name = color_name(name, code); - } + if config.indicator_style != IndicatorStyle::None { + let sym = classify_file(metadata); let char_opt = match config.indicator_style { IndicatorStyle::Classify => sym, @@ -1626,23 +1568,32 @@ fn display_file_name( if let Some(c) = char_opt { name.push(c); - width += 1; } } if config.format == Format::Long && metadata.file_type().is_symlink() { if let Ok(target) = path.read_link() { - // We don't bother updating width here because it's not used for long listings - let code = if target.exists() { "fi" } else { "mi" }; - let target_name = color_name(target.to_string_lossy().to_string(), code); + // We don't bother updating width here because it's not used for long + let mut target_name = target.to_string_lossy().to_string(); + if let Some(ls_colors) = &config.color { + target_name = color_name(&ls_colors, &target, target_name, metadata); + } name.push_str(" -> "); + name.push_str(&target_name); } } - Cell { - contents: name, - width, + name.into() +} + +fn color_name(ls_colors: &LsColors, path: &Path, name: String, md: &Metadata) -> String { + match ls_colors.style_for_path_with_metadata(path, Some(&md)) { + Some(style) => { + dbg!(style); + style.to_ansi_term_style().paint(name).to_string() + } + None => dbg!(name), } } diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index d810cdc29..ed95c3034 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -621,20 +621,27 @@ fn test_ls_recursive() { result.stdout_contains(&"a\\b:\nb"); } -#[cfg(unix)] #[test] fn test_ls_ls_color() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.mkdir("a"); - at.mkdir("a/nested_dir"); + let nested_dir = Path::new("a") + .join("nested_dir") + .to_string_lossy() + .to_string(); + at.mkdir(&nested_dir); at.mkdir("z"); - at.touch(&at.plus_as_string("a/nested_file")); + let nested_file = Path::new("a") + .join("nested_file") + .to_string_lossy() + .to_string(); + at.touch(&nested_file); at.touch("test-color"); - let a_with_colors = "\x1b[01;34ma\x1b[0m"; - let z_with_colors = "\x1b[01;34mz\x1b[0m"; - let nested_dir_with_colors = "\x1b[01;34mnested_dir\x1b[0m"; + let a_with_colors = "\x1b[1;34ma\x1b[0m"; + let z_with_colors = "\x1b[1;34mz\x1b[0m"; + let nested_dir_with_colors = "\x1b[1;34mnested_dir\x1b[0m"; // Color is disabled by default let result = scene.ucmd().succeeds(); @@ -670,14 +677,6 @@ fn test_ls_ls_color() { .succeeds() .stdout_contains(nested_dir_with_colors); - // Color has no effect - scene - .ucmd() - .arg("--color=always") - .arg("a/nested_file") - .succeeds() - .stdout_contains("a/nested_file\n"); - // No output scene .ucmd() From e382f7fa830a59e1b6832987db2f0f8a9835ef9a Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 21 Apr 2021 17:43:57 +0200 Subject: [PATCH 0398/1135] ls: fix test warnings on Windows --- tests/by-util/test_ls.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index ed95c3034..c53091c94 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -816,7 +816,7 @@ fn test_ls_indicator_style() { let options = vec!["classify", "file-type", "slash"]; for opt in options { // Verify that classify and file-type both contain indicators for symlinks. - let result = scene + scene .ucmd() .arg(format!("--indicator-style={}", opt)) .succeeds() @@ -826,7 +826,7 @@ fn test_ls_indicator_style() { // Same test as above, but with the alternate flags. let options = vec!["--classify", "--file-type", "-p"]; for opt in options { - let result = scene + scene .ucmd() .arg(format!("{}", opt)) .succeeds() @@ -837,7 +837,7 @@ fn test_ls_indicator_style() { let options = vec!["classify", "file-type"]; for opt in options { // Verify that classify and file-type both contain indicators for symlinks. - let result = scene + scene .ucmd() .arg(format!("--indicator-style={}", opt)) .succeeds() @@ -961,7 +961,7 @@ fn test_ls_hidden_windows() { let result = scene.ucmd().succeeds(); assert!(!result.stdout_str().contains(file)); - let result = scene.ucmd().arg("-a").succeeds().stdout_contains(file); + scene.ucmd().arg("-a").succeeds().stdout_contains(file); } #[test] From 4a305b32c6e77af76e1af3a42b72eeeac4855d23 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 21 Apr 2021 17:49:40 +0200 Subject: [PATCH 0399/1135] sort: disallow certain flags with -d and -i GNU sort disallows these combinations, presumably because they are likely not what the user really wants. Ignoring characters would cause things to be put together that aren't together in the input. For example, -dn would cause "0.12" or "0,12" to be parsed as "12" which is highly unexpected and confusing. --- src/uu/sort/src/sort.rs | 34 +++++++++++++++++++++++++++++----- tests/by-util/test_sort.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 07b852921..7090a98ed 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -84,7 +84,7 @@ static THOUSANDS_SEP: char = ','; static NEGATIVE: char = '-'; static POSITIVE: char = '+'; -#[derive(Eq, Ord, PartialEq, PartialOrd, Clone)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy)] enum SortMode { Numeric, HumanNumeric, @@ -153,7 +153,7 @@ struct KeySettings { impl From<&GlobalSettings> for KeySettings { fn from(settings: &GlobalSettings) -> Self { Self { - mode: settings.mode.clone(), + mode: settings.mode, ignore_blanks: settings.ignore_blanks, ignore_case: settings.ignore_case, ignore_non_printing: settings.ignore_non_printing, @@ -407,6 +407,28 @@ impl KeyPosition { crash!(1, "invalid option for key: `{}`", c) } } + // All numeric sorts and month sort conflict with dictionary_order and ignore_non_printing. + // Instad of reporting an error, let them overwrite each other. + + // FIXME: This should only override if the overridden flag is a global flag. + // If conflicting flags are attached to the key, GNU sort crashes and we should probably too. + match option { + 'h' | 'n' | 'g' | 'M' => { + settings.dictionary_order = false; + settings.ignore_non_printing = false; + } + 'd' | 'i' => { + settings.mode = match settings.mode { + SortMode::Numeric + | SortMode::HumanNumeric + | SortMode::GeneralNumeric + | SortMode::Month => SortMode::Default, + // Only SortMode::Default and SortMode::Version work with dictionary_order and ignore_non_printing + m @ (SortMode::Default | SortMode::Version) => m, + } + } + _ => {} + } } // Strip away option characters from the original value so we can parse it later *value_with_options = &value_with_options[..options_start]; @@ -651,7 +673,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(OPT_DICTIONARY_ORDER) .short("d") .long(OPT_DICTIONARY_ORDER) - .help("consider only blanks and alphanumeric characters"), + .help("consider only blanks and alphanumeric characters") + .conflicts_with_all(&[OPT_NUMERIC_SORT, OPT_GENERAL_NUMERIC_SORT, OPT_HUMAN_NUMERIC_SORT, OPT_MONTH_SORT]), ) .arg( Arg::with_name(OPT_MERGE) @@ -679,9 +702,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) .arg( Arg::with_name(OPT_IGNORE_NONPRINTING) - .short("-i") + .short("i") .long(OPT_IGNORE_NONPRINTING) - .help("ignore nonprinting characters"), + .help("ignore nonprinting characters") + .conflicts_with_all(&[OPT_NUMERIC_SORT, OPT_GENERAL_NUMERIC_SORT, OPT_HUMAN_NUMERIC_SORT, OPT_MONTH_SORT]), ) .arg( Arg::with_name(OPT_IGNORE_BLANKS) diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index a4a9a383c..4ee8826e3 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -581,3 +581,30 @@ fn test_check_silent() { .fails() .stdout_is(""); } + +#[test] +fn test_dictionary_and_nonprinting_conflicts() { + let conflicting_args = ["n", "h", "g", "M"]; + for restricted_arg in &["d", "i"] { + for conflicting_arg in &conflicting_args { + new_ucmd!() + .arg(&format!("-{}{}", restricted_arg, conflicting_arg)) + .fails(); + } + for conflicting_arg in &conflicting_args { + new_ucmd!() + .args(&[ + format!("-{}", restricted_arg).as_str(), + "-k", + &format!("1,1{}", conflicting_arg), + ]) + .succeeds(); + } + for conflicting_arg in &conflicting_args { + // FIXME: this should ideally fail. + new_ucmd!() + .args(&["-k", &format!("1{},1{}", restricted_arg, conflicting_arg)]) + .succeeds(); + } + } +} From b08f92cfa5cec53ff99a902ea3e4b5689b1bd922 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 21 Apr 2021 17:50:22 +0200 Subject: [PATCH 0400/1135] remove unneeded 'static --- tests/by-util/test_sort.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 4ee8826e3..0e6ac2e62 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -63,7 +63,7 @@ fn test_check_zero_terminated_success() { #[test] fn test_random_shuffle_len() { // check whether output is the same length as the input - const FILE: &'static str = "default_unsorted_ints.expected"; + const FILE: &str = "default_unsorted_ints.expected"; let (at, _ucmd) = at_and_ucmd!(); let result = new_ucmd!().arg("-R").arg(FILE).run().stdout_move_str(); let expected = at.read(FILE); @@ -75,7 +75,7 @@ fn test_random_shuffle_len() { #[test] fn test_random_shuffle_contains_all_lines() { // check whether lines of input are all in output - const FILE: &'static str = "default_unsorted_ints.expected"; + const FILE: &str = "default_unsorted_ints.expected"; let (at, _ucmd) = at_and_ucmd!(); let result = new_ucmd!().arg("-R").arg(FILE).run().stdout_move_str(); let expected = at.read(FILE); @@ -90,7 +90,7 @@ fn test_random_shuffle_two_runs_not_the_same() { // check to verify that two random shuffles are not equal; this has the // potential to fail in the very unlikely event that the random order is the same // as the starting order, or if both random sorts end up having the same order. - const FILE: &'static str = "default_unsorted_ints.expected"; + const FILE: &str = "default_unsorted_ints.expected"; let (at, _ucmd) = at_and_ucmd!(); let result = new_ucmd!().arg("-R").arg(FILE).run().stdout_move_str(); let expected = at.read(FILE); @@ -105,7 +105,7 @@ fn test_random_shuffle_contains_two_runs_not_the_same() { // check to verify that two random shuffles are not equal; this has the // potential to fail in the unlikely event that random order is the same // as the starting order, or if both random sorts end up having the same order. - const FILE: &'static str = "default_unsorted_ints.expected"; + const FILE: &str = "default_unsorted_ints.expected"; let (at, _ucmd) = at_and_ucmd!(); let result = new_ucmd!().arg("-R").arg(FILE).run().stdout_move_str(); let expected = at.read(FILE); From 8b906b954789acb42b0b1b2a43e8b679c93821b3 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 21 Apr 2021 18:00:01 +0200 Subject: [PATCH 0401/1135] remove feature use stabilized in 1.51 --- src/uu/sort/src/sort.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 7090a98ed..7d9808c1b 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -424,7 +424,7 @@ impl KeyPosition { | SortMode::GeneralNumeric | SortMode::Month => SortMode::Default, // Only SortMode::Default and SortMode::Version work with dictionary_order and ignore_non_printing - m @ (SortMode::Default | SortMode::Version) => m, + m @ SortMode::Default | m @ SortMode::Version => m, } } _ => {} From ff3953837515257a32426e22d9f3bab75c984d5b Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 21 Apr 2021 17:57:17 +0200 Subject: [PATCH 0402/1135] ls: further refactor --color and classification --- src/uu/ls/src/ls.rs | 90 ++++++++-------------------------------- tests/by-util/test_ls.rs | 2 +- 2 files changed, 19 insertions(+), 73 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index c08e604f9..9f0c56245 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -35,8 +35,6 @@ use std::{cmp::Reverse, process::exit}; use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use time::{strftime, Timespec}; #[cfg(unix)] -use unicode_width::UnicodeWidthStr; -#[cfg(unix)] use uucore::libc::{mode_t, S_IXGRP, S_IXOTH, S_IXUSR}; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -1445,45 +1443,6 @@ fn get_file_name(name: &Path, strip: Option<&Path>) -> String { name.to_string_lossy().into_owned() } -// #[cfg(not(unix))] -// fn display_file_name( -// path: &Path, -// strip: Option<&Path>, -// metadata: &Metadata, -// config: &Config, -// ) -> Cell { -// let mut name = escape_name(get_file_name(path, strip), &config.quoting_style); -// let file_type = metadata.file_type(); - -// match config.indicator_style { -// IndicatorStyle::Classify | IndicatorStyle::FileType => { -// if file_type.is_dir() { -// name.push('/'); -// } -// if file_type.is_symlink() { -// name.push('@'); -// } -// } -// IndicatorStyle::Slash => { -// if file_type.is_dir() { -// name.push('/'); -// } -// } -// _ => (), -// }; - -// if config.format == Format::Long && metadata.file_type().is_symlink() { -// if let Ok(target) = path.read_link() { -// // We don't bother updating width here because it's not used for long listings -// let target_name = target.to_string_lossy().to_string(); -// name.push_str(" -> "); -// name.push_str(&target_name); -// } -// } - -// name.into() -// } - #[cfg(unix)] macro_rules! has { ($mode:expr, $perm:expr) => { @@ -1491,42 +1450,32 @@ macro_rules! has { }; } -#[cfg(unix)] fn classify_file(md: &Metadata) -> Option { let file_type = md.file_type(); + + #[allow(clippy::clippy::collapsible_else_if)] if file_type.is_dir() { Some('/') } else if file_type.is_symlink() { Some('@') - } else if file_type.is_socket() { - Some('=') - } else if file_type.is_fifo() { - Some('|') - } else if file_type.is_file() { - let mode = md.mode() as mode_t; - if has!(mode, S_IXUSR | S_IXGRP | S_IXOTH) { - Some('*') - } else { - None + } else { + #[cfg(unix)] + { + if file_type.is_socket() { + Some('=') + } else if file_type.is_fifo() { + Some('|') + } else if file_type.is_file() || has!(md.mode(), S_IXUSR | S_IXGRP | S_IXOTH) { + Some('*') + } else { + None + } } - } else { + #[cfg(not(unix))] None } } -#[cfg(not(unix))] -fn classify_file(md: &Metadata) -> Option { - let file_type = md.file_type(); - if file_type.is_dir() { - Some('/') - } else if file_type.is_symlink() { - Some('@') - } else { - None - } -} - -#[allow(clippy::cognitive_complexity)] fn display_file_name( path: &Path, strip: Option<&Path>, @@ -1541,7 +1490,7 @@ fn display_file_name( } if let Some(ls_colors) = &config.color { - name = color_name(&ls_colors, path, name, metadata).to_string(); + name = color_name(&ls_colors, path, name, metadata); } if config.indicator_style != IndicatorStyle::None { @@ -1589,11 +1538,8 @@ fn display_file_name( fn color_name(ls_colors: &LsColors, path: &Path, name: String, md: &Metadata) -> String { match ls_colors.style_for_path_with_metadata(path, Some(&md)) { - Some(style) => { - dbg!(style); - style.to_ansi_term_style().paint(name).to_string() - } - None => dbg!(name), + Some(style) => style.to_ansi_term_style().paint(name).to_string(), + None => name, } } diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index c53091c94..5538864ca 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -622,7 +622,7 @@ fn test_ls_recursive() { } #[test] -fn test_ls_ls_color() { +fn test_ls_color() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.mkdir("a"); From 3fc8d2e42270d9ef08521346ca2e754f63f6c9b8 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 21 Apr 2021 18:05:02 +0200 Subject: [PATCH 0403/1135] ls: make compatible with Rust 1.40 again --- Cargo.lock | 41 +++++++++++++++++++++++++++++------------ src/uu/ls/src/ls.rs | 8 +++++--- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 461716b1b..5370c50e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,6 +28,15 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "arrayvec" version = "0.4.12" @@ -127,9 +136,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cast" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" +checksum = "cc38c385bfd7e444464011bb24820f40dd1c76bcdfa1b78611cb7c2e5cafab75" dependencies = [ "rustc_version", ] @@ -169,7 +178,7 @@ version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ - "ansi_term", + "ansi_term 0.11.0", "atty", "bitflags", "strsim", @@ -452,9 +461,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" +checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -580,7 +589,7 @@ checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.5", + "redox_syscall 0.2.6", "winapi 0.3.9", ] @@ -783,6 +792,15 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "lscolors" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24b894c45c9da468621cdd615a5a79ee5e5523dd4f75c76ebc03d458940c16e" +dependencies = [ + "ansi_term 0.12.1", +] + [[package]] name = "match_cfg" version = "0.1.0" @@ -1176,9 +1194,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" +checksum = "8270314b5ccceb518e7e578952f0b72b88222d02e8f77f5ecf7abbb673539041" dependencies = [ "bitflags", ] @@ -1189,7 +1207,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" dependencies = [ - "redox_syscall 0.2.5", + "redox_syscall 0.2.6", ] [[package]] @@ -1454,7 +1472,7 @@ checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ "libc", "numtoa", - "redox_syscall 0.2.5", + "redox_syscall 0.2.6", "redox_termios", ] @@ -1989,12 +2007,11 @@ dependencies = [ "atty", "clap", "globset", - "lazy_static", + "lscolors", "number_prefix", "term_grid", "termsize", "time", - "unicode-width", "uucore", "uucore_procs", ] diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 9f0c56245..07147ae4b 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1450,10 +1450,10 @@ macro_rules! has { }; } +#[allow(clippy::clippy::collapsible_else_if)] fn classify_file(md: &Metadata) -> Option { let file_type = md.file_type(); - #[allow(clippy::clippy::collapsible_else_if)] if file_type.is_dir() { Some('/') } else if file_type.is_symlink() { @@ -1485,8 +1485,10 @@ fn display_file_name( let mut name = escape_name(get_file_name(path, strip), &config.quoting_style); #[cfg(unix)] - if config.format != Format::Long && config.inode { - name = get_inode(metadata) + " " + &name; + { + if config.format != Format::Long && config.inode { + name = get_inode(metadata) + " " + &name; + } } if let Some(ls_colors) = &config.color { From 8a05148d7be9949d2da93126c21ad2606d53cb2d Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 21 Apr 2021 17:56:59 +0200 Subject: [PATCH 0404/1135] sort: fix tokenization for trailing separators Trailing separators were included at the end of the last token, but they should not be. This changes tokenize_with_separator as suggested by @cbjadwani. --- src/uu/sort/src/sort.rs | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 07b852921..7515ca1c9 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -351,20 +351,18 @@ fn tokenize_default(line: &str) -> Vec { /// Split between separators. These separators are not included in fields. fn tokenize_with_separator(line: &str, separator: char) -> Vec { - let mut tokens = vec![0..0]; - let mut previous_was_separator = false; - for (idx, char) in line.char_indices() { - if previous_was_separator { - tokens.push(idx..0); - } - if char == separator { - tokens.last_mut().unwrap().end = idx; - previous_was_separator = true; - } else { - previous_was_separator = false; - } + let mut tokens = vec![]; + let separator_indices = + line.char_indices() + .filter_map(|(i, c)| if c == separator { Some(i) } else { None }); + let mut start = 0; + for sep_idx in separator_indices { + tokens.push(start..sep_idx); + start = sep_idx + 1; + } + if start < line.len() { + tokens.push(start..line.len()); } - tokens.last_mut().unwrap().end = line.len(); tokens } @@ -1383,4 +1381,14 @@ mod tests { vec![0..0, 1..1, 2..2, 3..9, 10..18,] ); } + + #[test] + fn test_tokenize_fields_trailing_custom_separator() { + let line = "a"; + assert_eq!(tokenize(line, Some('a')), vec![0..0]); + let line = "aa"; + assert_eq!(tokenize(line, Some('a')), vec![0..0, 1..1]); + let line = "..a..a"; + assert_eq!(tokenize(line, Some('a')), vec![0..2, 3..5]); + } } From 8914fd0a579a0e0da51ea94319fdca96f13dcc18 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 21 Apr 2021 19:26:17 +0200 Subject: [PATCH 0405/1135] add an integration test --- tests/by-util/test_sort.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index a4a9a383c..72d4f67fc 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -581,3 +581,12 @@ fn test_check_silent() { .fails() .stdout_is(""); } + +#[test] +fn test_trailing_separator() { + new_ucmd!() + .args(&["-t", "x", "-k", "1,1"]) + .pipe_in("aax\naaa\n") + .succeeds() + .stdout_is("aax\naaa\n"); +} \ No newline at end of file From 1d7e206d722b884bd65d59f267f2337351bdd5eb Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 21 Apr 2021 20:04:52 +0200 Subject: [PATCH 0406/1135] ls: fix mac build --- src/uu/ls/src/ls.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 07147ae4b..8c8033744 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -35,7 +35,7 @@ use std::{cmp::Reverse, process::exit}; use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use time::{strftime, Timespec}; #[cfg(unix)] -use uucore::libc::{mode_t, S_IXGRP, S_IXOTH, S_IXUSR}; +use uucore::libc::{S_IXGRP, S_IXOTH, S_IXUSR}; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = " @@ -1444,10 +1444,13 @@ fn get_file_name(name: &Path, strip: Option<&Path>) -> String { } #[cfg(unix)] -macro_rules! has { - ($mode:expr, $perm:expr) => { - $mode & ($perm as mode_t) != 0 - }; +fn file_is_executable(md: &Metadata) -> bool { + // Mode always returns u32, but the flags might not be, based on the platform + // e.g. linux has u32, mac has u16. + // S_IXUSR -> user has execute permission + // S_IXGRP -> group has execute persmission + // S_IXOTH -> other users have execute permission + md.mode() & ((S_IXUSR | S_IXGRP | S_IXOTH) as u32) != 0 } #[allow(clippy::clippy::collapsible_else_if)] @@ -1465,7 +1468,7 @@ fn classify_file(md: &Metadata) -> Option { Some('=') } else if file_type.is_fifo() { Some('|') - } else if file_type.is_file() || has!(md.mode(), S_IXUSR | S_IXGRP | S_IXOTH) { + } else if file_type.is_file() && file_is_executable(&md) { Some('*') } else { None From b756b987a43070d133e449a4a8d3f5a59deb09e8 Mon Sep 17 00:00:00 2001 From: rethab Date: Thu, 22 Apr 2021 08:42:56 +0200 Subject: [PATCH 0407/1135] cat: make tests stable (#2100) --- tests/by-util/test_cat.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index d7c3eec6b..9f7ebdd37 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -400,22 +400,29 @@ fn test_domain_socket() { use std::thread; use tempdir::TempDir; use unix_socket::UnixListener; + use std::sync::{Barrier, Arc}; let dir = TempDir::new("unix_socket").expect("failed to create dir"); let socket_path = dir.path().join("sock"); let listener = UnixListener::bind(&socket_path).expect("failed to create socket"); + // use a barrier to ensure we don't run cat before the listener is setup + let barrier = Arc::new(Barrier::new(2)); + let barrier2 = Arc::clone(&barrier); + let thread = thread::spawn(move || { let mut stream = listener.accept().expect("failed to accept connection").0; + barrier2.wait(); stream .write_all(b"a\tb") .expect("failed to write test data"); }); - new_ucmd!() - .args(&[socket_path]) - .succeeds() - .stdout_only("a\tb"); + let child = new_ucmd!().args(&[socket_path]).run_no_wait(); + barrier.wait(); + let stdout = &child.wait_with_output().unwrap().stdout.clone(); + let output = String::from_utf8_lossy(&stdout); + assert_eq!("a\tb", output); thread.join().unwrap(); } From 8554cdf35be3cc4e8b7998d4db0d4b7b34abd9a8 Mon Sep 17 00:00:00 2001 From: Anup Mahindre Date: Thu, 22 Apr 2021 12:49:17 +0530 Subject: [PATCH 0408/1135] Optimize recursive ls (#2083) * ls: Remove allocations by eliminating collect/clones * ls: Introduce PathData structure - PathData will hold Path related metadata / strings that are required frequently in subsequent functions - All data is precomputed and cached and subsequent functions just use cached data * ls: Cache more data related to paths - Cache filename and sort by filename instead of full path - Cache uid->usr and gid->grp mappings https://github.com/uutils/coreutils/pull/2099/files * ls: Add BENCHMARKING.md * ls: Document PathData structure * tests/ls: Add testcase for error paths with width option * ls: Fix unused import warning cached will be only used for unix currently as current use of caching gid/uid mappings is only relevant on unix * ls: Suggest checking syscall count in BENCHMARKING.md * ls: Remove mentions of sort in BENCHMARKING.md * ls: Remove dependency on cached Implement caching using HashMap and lazy_static * ls: Fix MSRV error related to map_or Rust 1.40 did not support map_or for result types --- src/uu/ls/BENCHMARKING.md | 34 ++++++ src/uu/ls/src/ls.rs | 212 +++++++++++++++++++++++++------------- tests/by-util/test_ls.rs | 8 ++ 3 files changed, 181 insertions(+), 73 deletions(-) create mode 100644 src/uu/ls/BENCHMARKING.md diff --git a/src/uu/ls/BENCHMARKING.md b/src/uu/ls/BENCHMARKING.md new file mode 100644 index 000000000..84a0c3d84 --- /dev/null +++ b/src/uu/ls/BENCHMARKING.md @@ -0,0 +1,34 @@ +# Benchmarking ls + +ls majorly involves fetching a lot of details (depending upon what details are requested, eg. time/date, inode details, etc) for each path using system calls. Ideally, any system call should be done only once for each of the paths - not adhering to this principle leads to a lot of system call overhead multiplying and bubbling up, especially for recursive ls, therefore it is important to always benchmark multiple scenarios. +This is an overwiew over what was benchmarked, and if you make changes to `ls`, you are encouraged to check +how performance was affected for the workloads listed below. Feel free to add other workloads to the +list that we should improve / make sure not to regress. + +Run `cargo build --release` before benchmarking after you make a change! + +## Simple recursive ls + +- Get a large tree, for example linux kernel source tree. +- Benchmark simple recursive ls with hyperfine: `hyperfine --warmup 2 "target/release/coreutils ls -R tree > /dev/null"`. + +## Recursive ls with all and long options + +- Same tree as above +- Benchmark recursive ls with -al -R options with hyperfine: `hyperfine --warmup 2 "target/release/coreutils ls -al -R tree > /dev/null"`. + +## Comparing with GNU ls + +Hyperfine accepts multiple commands to run and will compare them. To compare performance with GNU ls +duplicate the string you passed to hyperfine but remove the `target/release/coreutils` bit from it. + +Example: `hyperfine --warmup 2 "target/release/coreutils ls -al -R tree > /dev/null"` becomes +`hyperfine --warmup 2 "target/release/coreutils ls -al -R tree > /dev/null" "ls -al -R tree > /dev/null"` +(This assumes GNU ls is installed as `ls`) + +This can also be used to compare with version of ls built before your changes to ensure your change does not regress this + +## Checking system call count + +- Another thing to look at would be system calls count using strace (on linux) or equivalent on other operating systems. +- Example: `strace -c target/release/coreutils ls -al -R tree` diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 514539809..e0aa3ec4b 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1038,12 +1038,43 @@ pub fn uumain(args: impl uucore::Args) -> i32 { list(locs, Config::from(matches)) } +/// Represents a Path along with it's associated data +/// Any data that will be reused several times makes sense to be added to this structure +/// Caching data here helps eliminate redundant syscalls to fetch same information +struct PathData { + // Result got from symlink_metadata() or metadata() based on config + md: std::io::Result, + // String formed from get_lossy_string() for the path + lossy_string: String, + // Name of the file - will be empty for . or .. + file_name: String, + // PathBuf that all above data corresponds to + p_buf: PathBuf, +} + +impl PathData { + fn new(p_buf: PathBuf, config: &Config, command_line: bool) -> Self { + let md = get_metadata(&p_buf, config, command_line); + let lossy_string = p_buf.to_string_lossy().into_owned(); + let name = p_buf + .file_name() + .map_or(String::new(), |s| s.to_string_lossy().into_owned()); + Self { + md, + lossy_string, + file_name: name, + p_buf, + } + } +} + fn list(locs: Vec, config: Config) -> i32 { let number_of_locs = locs.len(); - let mut files = Vec::::new(); - let mut dirs = Vec::::new(); + let mut files = Vec::::new(); + let mut dirs = Vec::::new(); let mut has_failed = false; + for loc in locs { let p = PathBuf::from(&loc); if !p.exists() { @@ -1054,36 +1085,28 @@ fn list(locs: Vec, config: Config) -> i32 { continue; } - let show_dir_contents = if !config.directory { - match config.dereference { - Dereference::None => { - if let Ok(md) = p.symlink_metadata() { - md.is_dir() - } else { - show_error!("'{}': {}", &loc, "No such file or directory"); - has_failed = true; - continue; - } - } - _ => p.is_dir(), - } + let path_data = PathData::new(p, &config, true); + + let show_dir_contents = if let Ok(md) = path_data.md.as_ref() { + !config.directory && md.is_dir() } else { + has_failed = true; false }; if show_dir_contents { - dirs.push(p); + dirs.push(path_data); } else { - files.push(p); + files.push(path_data); } } sort_entries(&mut files, &config); - display_items(&files, None, &config, true); + display_items(&files, None, &config); sort_entries(&mut dirs, &config); for dir in dirs { if number_of_locs > 1 { - println!("\n{}:", dir.to_string_lossy()); + println!("\n{}:", dir.lossy_string); } enter_directory(&dir, &config); } @@ -1094,22 +1117,22 @@ fn list(locs: Vec, config: Config) -> i32 { } } -fn sort_entries(entries: &mut Vec, config: &Config) { +fn sort_entries(entries: &mut Vec, config: &Config) { match config.sort { Sort::Time => entries.sort_by_key(|k| { Reverse( - get_metadata(k, false) + k.md.as_ref() .ok() .and_then(|md| get_system_time(&md, config)) .unwrap_or(UNIX_EPOCH), ) }), Sort::Size => { - entries.sort_by_key(|k| Reverse(get_metadata(k, false).map(|md| md.len()).unwrap_or(0))) + entries.sort_by_key(|k| Reverse(k.md.as_ref().map(|md| md.len()).unwrap_or(0))) } // The default sort in GNU ls is case insensitive - Sort::Name => entries.sort_by_key(|k| k.to_string_lossy().to_lowercase()), - Sort::Version => entries.sort_by(|a, b| version_cmp::version_cmp(a, b)), + Sort::Name => entries.sort_by_key(|k| k.file_name.to_lowercase()), + Sort::Version => entries.sort_by(|k, j| version_cmp::version_cmp(&k.p_buf, &j.p_buf)), Sort::None => {} } @@ -1143,32 +1166,57 @@ fn should_display(entry: &DirEntry, config: &Config) -> bool { true } -fn enter_directory(dir: &Path, config: &Config) { - let mut entries: Vec<_> = safe_unwrap!(fs::read_dir(dir).and_then(Iterator::collect)); - - entries.retain(|e| should_display(e, config)); - - let mut entries: Vec<_> = entries.iter().map(DirEntry::path).collect(); - sort_entries(&mut entries, config); - - if config.files == Files::All { - let mut display_entries = entries.clone(); - display_entries.insert(0, dir.join("..")); - display_entries.insert(0, dir.join(".")); - display_items(&display_entries, Some(dir), config, false); +fn enter_directory(dir: &PathData, config: &Config) { + let mut entries: Vec<_> = if config.files == Files::All { + vec![ + PathData::new(dir.p_buf.join("."), config, false), + PathData::new(dir.p_buf.join(".."), config, false), + ] } else { - display_items(&entries, Some(dir), config, false); - } + vec![] + }; + + let mut temp: Vec<_> = safe_unwrap!(fs::read_dir(&dir.p_buf)) + .map(|res| safe_unwrap!(res)) + .filter(|e| should_display(e, config)) + .map(|e| PathData::new(DirEntry::path(&e), config, false)) + .collect(); + + sort_entries(&mut temp, config); + + entries.append(&mut temp); + + display_items(&entries, Some(&dir.p_buf), config); if config.recursive { - for e in entries.iter().filter(|p| p.is_dir()) { - println!("\n{}:", e.to_string_lossy()); + for e in entries + .iter() + .skip(if config.files == Files::All { 2 } else { 0 }) + .filter(|p| p.md.as_ref().map(|md| md.is_dir()).unwrap_or(false)) + { + println!("\n{}:", e.lossy_string); enter_directory(&e, config); } } } -fn get_metadata(entry: &Path, dereference: bool) -> std::io::Result { +fn get_metadata(entry: &Path, config: &Config, command_line: bool) -> std::io::Result { + let dereference = match &config.dereference { + Dereference::All => true, + Dereference::Args => command_line, + Dereference::DirArgs => { + if command_line { + if let Ok(md) = entry.metadata() { + md.is_dir() + } else { + false + } + } else { + false + } + } + Dereference::None => false, + }; if dereference { entry.metadata().or_else(|_| entry.symlink_metadata()) } else { @@ -1176,8 +1224,8 @@ fn get_metadata(entry: &Path, dereference: bool) -> std::io::Result { } } -fn display_dir_entry_size(entry: &Path, config: &Config) -> (usize, usize) { - if let Ok(md) = get_metadata(entry, false) { +fn display_dir_entry_size(entry: &PathData, config: &Config) -> (usize, usize) { + if let Ok(md) = entry.md.as_ref() { ( display_symlink_count(&md).len(), display_file_size(&md, config).len(), @@ -1191,7 +1239,7 @@ fn pad_left(string: String, count: usize) -> String { format!("{:>width$}", string, width = count) } -fn display_items(items: &[PathBuf], strip: Option<&Path>, config: &Config, command_line: bool) { +fn display_items(items: &[PathData], strip: Option<&Path>, config: &Config) { if config.format == Format::Long { let (mut max_links, mut max_size) = (1, 1); for item in items { @@ -1200,18 +1248,18 @@ fn display_items(items: &[PathBuf], strip: Option<&Path>, config: &Config, comma max_size = size.max(max_size); } for item in items { - display_item_long(item, strip, max_links, max_size, config, command_line); + display_item_long(item, strip, max_links, max_size, config); } } else { let names = items.iter().filter_map(|i| { - let md = get_metadata(i, false); + let md = i.md.as_ref(); match md { Err(e) => { - let filename = get_file_name(i, strip); + let filename = get_file_name(&i.p_buf, strip); show_error!("'{}': {}", filename, e); None } - Ok(md) => Some(display_file_name(&i, strip, &md, config)), + Ok(md) => Some(display_file_name(&i.p_buf, strip, &md, config)), } }); @@ -1271,33 +1319,15 @@ fn display_grid(names: impl Iterator, width: u16, direction: Direct use uucore::fs::display_permissions; fn display_item_long( - item: &Path, + item: &PathData, strip: Option<&Path>, max_links: usize, max_size: usize, config: &Config, - command_line: bool, ) { - let dereference = match &config.dereference { - Dereference::All => true, - Dereference::Args => command_line, - Dereference::DirArgs => { - if command_line { - if let Ok(md) = item.metadata() { - md.is_dir() - } else { - false - } - } else { - false - } - } - Dereference::None => false, - }; - - let md = match get_metadata(item, dereference) { + let md = match &item.md { Err(e) => { - let filename = get_file_name(&item, strip); + let filename = get_file_name(&item.p_buf, strip); show_error!("{}: {}", filename, e); return; } @@ -1336,7 +1366,7 @@ fn display_item_long( " {} {} {}", pad_left(display_file_size(&md, config), max_size), display_date(&md, config), - display_file_name(&item, strip, &md, config).contents, + display_file_name(&item.p_buf, strip, &md, config).contents, ); } @@ -1348,14 +1378,50 @@ fn get_inode(metadata: &Metadata) -> String { // Currently getpwuid is `linux` target only. If it's broken out into // a posix-compliant attribute this can be updated... #[cfg(unix)] +use std::sync::Mutex; +#[cfg(unix)] use uucore::entries; +#[cfg(unix)] +fn cached_uid2usr(uid: u32) -> String { + lazy_static! { + static ref UID_CACHE: Mutex> = Mutex::new(HashMap::new()); + } + + let mut uid_cache = UID_CACHE.lock().unwrap(); + match uid_cache.get(&uid) { + Some(usr) => usr.clone(), + None => { + let usr = entries::uid2usr(uid).unwrap_or_else(|_| uid.to_string()); + uid_cache.insert(uid, usr.clone()); + usr + } + } +} + #[cfg(unix)] fn display_uname(metadata: &Metadata, config: &Config) -> String { if config.long.numeric_uid_gid { metadata.uid().to_string() } else { - entries::uid2usr(metadata.uid()).unwrap_or_else(|_| metadata.uid().to_string()) + cached_uid2usr(metadata.uid()) + } +} + +#[cfg(unix)] +fn cached_gid2grp(gid: u32) -> String { + lazy_static! { + static ref GID_CACHE: Mutex> = Mutex::new(HashMap::new()); + } + + let mut gid_cache = GID_CACHE.lock().unwrap(); + match gid_cache.get(&gid) { + Some(grp) => grp.clone(), + None => { + let grp = entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string()); + gid_cache.insert(gid, grp.clone()); + grp + } } } @@ -1364,7 +1430,7 @@ fn display_group(metadata: &Metadata, config: &Config) -> String { if config.long.numeric_uid_gid { metadata.gid().to_string() } else { - entries::gid2grp(metadata.gid()).unwrap_or_else(|_| metadata.gid().to_string()) + cached_gid2grp(metadata.gid()) } } diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index d810cdc29..5583dbaca 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -103,6 +103,14 @@ fn test_ls_width() { .succeeds() .stdout_only("test-width-1\ntest-width-2\ntest-width-3\ntest-width-4\n"); } + + for option in &["-w 1a", "-w=1a", "--width=1a", "--width 1a"] { + scene + .ucmd() + .args(&option.split(" ").collect::>()) + .fails() + .stderr_only("ls: error: invalid line width: ‘1a’"); + } } #[test] From 4e4c3aba0066d3fbc27f44acab668cffe4959ee5 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 22 Apr 2021 11:16:33 +0200 Subject: [PATCH 0409/1135] ls: don't color symlink target --- src/uu/ls/src/ls.rs | 7 +------ tests/by-util/test_ls.rs | 11 +++++++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 8c8033744..88f26e604 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1528,13 +1528,8 @@ fn display_file_name( if config.format == Format::Long && metadata.file_type().is_symlink() { if let Ok(target) = path.read_link() { // We don't bother updating width here because it's not used for long - let mut target_name = target.to_string_lossy().to_string(); - if let Some(ls_colors) = &config.color { - target_name = color_name(&ls_colors, &target, target_name, metadata); - } name.push_str(" -> "); - - name.push_str(&target_name); + name.push_str(&target.to_string_lossy()); } } diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 5538864ca..f74443877 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -639,14 +639,18 @@ fn test_ls_color() { at.touch(&nested_file); at.touch("test-color"); + at.symlink_file(&nested_file, "link"); + let a_with_colors = "\x1b[1;34ma\x1b[0m"; let z_with_colors = "\x1b[1;34mz\x1b[0m"; let nested_dir_with_colors = "\x1b[1;34mnested_dir\x1b[0m"; + let link_with_color = "\x1b[1;36mlink\x1b[0m"; // Color is disabled by default let result = scene.ucmd().succeeds(); assert!(!result.stdout_str().contains(a_with_colors)); assert!(!result.stdout_str().contains(z_with_colors)); + assert!(!result.stdout_str().contains(link_with_color)); // Color should be enabled scene @@ -654,7 +658,8 @@ fn test_ls_color() { .arg("--color") .succeeds() .stdout_contains(a_with_colors) - .stdout_contains(z_with_colors); + .stdout_contains(z_with_colors) + .stdout_contains(link_with_color); // Color should be enabled scene @@ -662,12 +667,14 @@ fn test_ls_color() { .arg("--color=always") .succeeds() .stdout_contains(a_with_colors) - .stdout_contains(z_with_colors); + .stdout_contains(z_with_colors) + .stdout_contains(link_with_color); // Color should be disabled let result = scene.ucmd().arg("--color=never").succeeds(); assert!(!result.stdout_str().contains(a_with_colors)); assert!(!result.stdout_str().contains(z_with_colors)); + assert!(!result.stdout_str().contains(link_with_color)); // Nested dir should be shown and colored scene From b9f4964a96a45cfbff4ff7c6277c5357892093a6 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 22 Apr 2021 11:39:08 +0200 Subject: [PATCH 0410/1135] ls: bring up to date with recent changes --- Cargo.lock | 5 +++-- src/uu/ls/Cargo.toml | 3 +++ src/uu/ls/src/ls.rs | 10 ++++++---- tests/by-util/test_ls.rs | 11 ++--------- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5370c50e6..7ae0d078f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1412,9 +1412,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.69" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48fe99c6bd8b1cc636890bcc071842de909d902c81ac7dab53ba33c421ab8ffb" +checksum = "b9505f307c872bab8eb46f77ae357c8eba1fdacead58ee5a850116b1d7f82883" dependencies = [ "proc-macro2", "quote 1.0.9", @@ -2007,6 +2007,7 @@ dependencies = [ "atty", "clap", "globset", + "lazy_static", "lscolors", "number_prefix", "term_grid", diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index addca6fbb..9fa06c6a6 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -26,6 +26,9 @@ uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=[" uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } atty = "0.2" +[target.'cfg(unix)'.dependencies] +lazy_static = "1.4.0" + [[bin]] name = "ls" path = "src/main.rs" diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 99c41bdb8..3feee0f07 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -9,6 +9,9 @@ #[macro_use] extern crate uucore; +#[cfg(unix)] +#[macro_use] +extern crate lazy_static; mod quoting_style; mod version_cmp; @@ -18,12 +21,11 @@ use globset::{self, Glob, GlobSet, GlobSetBuilder}; use lscolors::LsColors; use number_prefix::NumberPrefix; use quoting_style::{escape_name, QuotingStyle}; -use std::fs; -use std::fs::{DirEntry, FileType, Metadata}; #[cfg(unix)] -use std::os::unix::fs::FileTypeExt; +use std::collections::HashMap; +use std::fs::{self, DirEntry, FileType, Metadata}; #[cfg(any(unix, target_os = "redox"))] -use std::os::unix::fs::MetadataExt; +use std::os::unix::fs::{FileTypeExt, MetadataExt}; #[cfg(windows)] use std::os::windows::fs::MetadataExt; use std::path::{Path, PathBuf}; diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 4282bcfc0..f87e64688 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -647,18 +647,14 @@ fn test_ls_color() { at.touch(&nested_file); at.touch("test-color"); - at.symlink_file(&nested_file, "link"); - let a_with_colors = "\x1b[1;34ma\x1b[0m"; let z_with_colors = "\x1b[1;34mz\x1b[0m"; let nested_dir_with_colors = "\x1b[1;34mnested_dir\x1b[0m"; - let link_with_color = "\x1b[1;36mlink\x1b[0m"; // Color is disabled by default let result = scene.ucmd().succeeds(); assert!(!result.stdout_str().contains(a_with_colors)); assert!(!result.stdout_str().contains(z_with_colors)); - assert!(!result.stdout_str().contains(link_with_color)); // Color should be enabled scene @@ -666,8 +662,7 @@ fn test_ls_color() { .arg("--color") .succeeds() .stdout_contains(a_with_colors) - .stdout_contains(z_with_colors) - .stdout_contains(link_with_color); + .stdout_contains(z_with_colors); // Color should be enabled scene @@ -675,14 +670,12 @@ fn test_ls_color() { .arg("--color=always") .succeeds() .stdout_contains(a_with_colors) - .stdout_contains(z_with_colors) - .stdout_contains(link_with_color); + .stdout_contains(z_with_colors); // Color should be disabled let result = scene.ucmd().arg("--color=never").succeeds(); assert!(!result.stdout_str().contains(a_with_colors)); assert!(!result.stdout_str().contains(z_with_colors)); - assert!(!result.stdout_str().contains(link_with_color)); // Nested dir should be shown and colored scene From 3678777539b0f99a4545446fab119262ae7493e0 Mon Sep 17 00:00:00 2001 From: James Robson Date: Thu, 22 Apr 2021 16:10:08 +0100 Subject: [PATCH 0411/1135] tail --sleep-interval takes a value --- src/uu/tail/src/tail.rs | 1 + tests/by-util/test_tail.rs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index ffe27e26c..fec88e841 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -117,6 +117,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg( Arg::with_name(options::SLEEP_INT) .short("s") + .takes_value(true) .long(options::SLEEP_INT) .help("Number or seconds to sleep between polling the file when running with -f"), ) diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 6e9eb4a17..1f74a3a98 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -343,3 +343,12 @@ fn test_negative_indexing() { assert_eq!(positive_lines_index.stdout(), negative_lines_index.stdout()); assert_eq!(positive_bytes_index.stdout(), negative_bytes_index.stdout()); } + +#[test] +fn test_sleep_interval() { + new_ucmd!() + .arg("-s") + .arg("10") + .arg(FOOBAR_TXT) + .succeeds(); +} From e241f3ad69c9895330c0555963b8be9d7f96edb8 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 22 Apr 2021 22:45:24 +0200 Subject: [PATCH 0412/1135] ls: skip reading metadata --- src/uu/ls/src/ls.rs | 176 +++++++++++++++++++++++--------------------- 1 file changed, 93 insertions(+), 83 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index e0aa3ec4b..d744e2914 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -19,11 +19,11 @@ mod version_cmp; use clap::{App, Arg}; use globset::{self, Glob, GlobSet, GlobSetBuilder}; use number_prefix::NumberPrefix; +use once_cell::unsync::OnceCell; use quoting_style::{escape_name, QuotingStyle}; #[cfg(unix)] use std::collections::HashMap; -use std::fs; -use std::fs::{DirEntry, FileType, Metadata}; +use std::fs::{self, DirEntry, FileType, Metadata}; #[cfg(unix)] use std::os::unix::fs::FileTypeExt; #[cfg(any(unix, target_os = "redox"))] @@ -492,6 +492,10 @@ impl Config { } } + if files != Files::Normal { + ignore_patterns.add(Glob::new(".*").unwrap()); + } + let ignore_patterns = ignore_patterns.build().unwrap(); let dereference = if options.is_present(options::dereference::ALL) { @@ -1043,29 +1047,66 @@ pub fn uumain(args: impl uucore::Args) -> i32 { /// Caching data here helps eliminate redundant syscalls to fetch same information struct PathData { // Result got from symlink_metadata() or metadata() based on config - md: std::io::Result, - // String formed from get_lossy_string() for the path - lossy_string: String, + md: OnceCell>, + ft: OnceCell>, // Name of the file - will be empty for . or .. file_name: String, // PathBuf that all above data corresponds to p_buf: PathBuf, + must_dereference: bool, } impl PathData { - fn new(p_buf: PathBuf, config: &Config, command_line: bool) -> Self { - let md = get_metadata(&p_buf, config, command_line); - let lossy_string = p_buf.to_string_lossy().into_owned(); + fn new( + p_buf: PathBuf, + file_type: Option>, + config: &Config, + command_line: bool, + ) -> Self { let name = p_buf .file_name() .map_or(String::new(), |s| s.to_string_lossy().into_owned()); + let must_dereference = match &config.dereference { + Dereference::All => true, + Dereference::Args => command_line, + Dereference::DirArgs => { + if command_line { + if let Ok(md) = p_buf.metadata() { + md.is_dir() + } else { + false + } + } else { + false + } + } + Dereference::None => false, + }; + let ft = match file_type { + Some(ft) => OnceCell::from(ft.ok()), + None => OnceCell::new(), + }; + Self { - md, - lossy_string, + md: OnceCell::new(), + ft, file_name: name, p_buf, + must_dereference, } } + + fn md(&self) -> Option<&Metadata> { + self.md + .get_or_init(|| get_metadata(&self.p_buf, self.must_dereference).ok()) + .as_ref() + } + + fn file_type(&self) -> Option<&FileType> { + self.ft + .get_or_init(|| self.md().map(|md| md.file_type())) + .as_ref() + } } fn list(locs: Vec, config: Config) -> i32 { @@ -1085,10 +1126,10 @@ fn list(locs: Vec, config: Config) -> i32 { continue; } - let path_data = PathData::new(p, &config, true); + let path_data = PathData::new(p, None, &config, true); - let show_dir_contents = if let Ok(md) = path_data.md.as_ref() { - !config.directory && md.is_dir() + let show_dir_contents = if let Some(ft) = path_data.file_type() { + !config.directory && ft.is_dir() } else { has_failed = true; false @@ -1106,7 +1147,7 @@ fn list(locs: Vec, config: Config) -> i32 { sort_entries(&mut dirs, &config); for dir in dirs { if number_of_locs > 1 { - println!("\n{}:", dir.lossy_string); + println!("\n{}:", dir.p_buf.display()); } enter_directory(&dir, &config); } @@ -1121,17 +1162,16 @@ fn sort_entries(entries: &mut Vec, config: &Config) { match config.sort { Sort::Time => entries.sort_by_key(|k| { Reverse( - k.md.as_ref() - .ok() + k.md() .and_then(|md| get_system_time(&md, config)) .unwrap_or(UNIX_EPOCH), ) }), Sort::Size => { - entries.sort_by_key(|k| Reverse(k.md.as_ref().map(|md| md.len()).unwrap_or(0))) + entries.sort_by_key(|k| Reverse(k.md().as_ref().map(|md| md.len()).unwrap_or(0))) } // The default sort in GNU ls is case insensitive - Sort::Name => entries.sort_by_key(|k| k.file_name.to_lowercase()), + Sort::Name => entries.sort_by_key(|k| k.file_name.to_ascii_lowercase()), Sort::Version => entries.sort_by(|k, j| version_cmp::version_cmp(&k.p_buf, &j.p_buf)), Sort::None => {} } @@ -1169,8 +1209,8 @@ fn should_display(entry: &DirEntry, config: &Config) -> bool { fn enter_directory(dir: &PathData, config: &Config) { let mut entries: Vec<_> = if config.files == Files::All { vec![ - PathData::new(dir.p_buf.join("."), config, false), - PathData::new(dir.p_buf.join(".."), config, false), + PathData::new(dir.p_buf.join("."), None, config, false), + PathData::new(dir.p_buf.join(".."), None, config, false), ] } else { vec![] @@ -1179,7 +1219,7 @@ fn enter_directory(dir: &PathData, config: &Config) { let mut temp: Vec<_> = safe_unwrap!(fs::read_dir(&dir.p_buf)) .map(|res| safe_unwrap!(res)) .filter(|e| should_display(e, config)) - .map(|e| PathData::new(DirEntry::path(&e), config, false)) + .map(|e| PathData::new(DirEntry::path(&e), Some(e.file_type()), config, false)) .collect(); sort_entries(&mut temp, config); @@ -1192,31 +1232,15 @@ fn enter_directory(dir: &PathData, config: &Config) { for e in entries .iter() .skip(if config.files == Files::All { 2 } else { 0 }) - .filter(|p| p.md.as_ref().map(|md| md.is_dir()).unwrap_or(false)) + .filter(|p| p.file_type().map(|ft| ft.is_dir()).unwrap_or(false)) { - println!("\n{}:", e.lossy_string); + println!("\n{}:", e.p_buf.display()); enter_directory(&e, config); } } } -fn get_metadata(entry: &Path, config: &Config, command_line: bool) -> std::io::Result { - let dereference = match &config.dereference { - Dereference::All => true, - Dereference::Args => command_line, - Dereference::DirArgs => { - if command_line { - if let Ok(md) = entry.metadata() { - md.is_dir() - } else { - false - } - } else { - false - } - } - Dereference::None => false, - }; +fn get_metadata(entry: &Path, dereference: bool) -> std::io::Result { if dereference { entry.metadata().or_else(|_| entry.symlink_metadata()) } else { @@ -1225,7 +1249,7 @@ fn get_metadata(entry: &Path, config: &Config, command_line: bool) -> std::io::R } fn display_dir_entry_size(entry: &PathData, config: &Config) -> (usize, usize) { - if let Ok(md) = entry.md.as_ref() { + if let Some(md) = entry.md() { ( display_symlink_count(&md).len(), display_file_size(&md, config).len(), @@ -1251,17 +1275,9 @@ fn display_items(items: &[PathData], strip: Option<&Path>, config: &Config) { display_item_long(item, strip, max_links, max_size, config); } } else { - let names = items.iter().filter_map(|i| { - let md = i.md.as_ref(); - match md { - Err(e) => { - let filename = get_file_name(&i.p_buf, strip); - show_error!("'{}': {}", filename, e); - None - } - Ok(md) => Some(display_file_name(&i.p_buf, strip, &md, config)), - } - }); + let names = items + .iter() + .filter_map(|i| display_file_name(&i, strip, config)); match (&config.format, config.width) { (Format::Columns, Some(width)) => display_grid(names, width, Direction::TopToBottom), @@ -1325,13 +1341,13 @@ fn display_item_long( max_size: usize, config: &Config, ) { - let md = match &item.md { - Err(e) => { + let md = match item.md() { + None => { let filename = get_file_name(&item.p_buf, strip); - show_error!("{}: {}", filename, e); + show_error!("could not show file: {}", filename); return; } - Ok(md) => md, + Some(md) => md, }; #[cfg(unix)] @@ -1366,7 +1382,10 @@ fn display_item_long( " {} {} {}", pad_left(display_file_size(&md, config), max_size), display_date(&md, config), - display_file_name(&item.p_buf, strip, &md, config).contents, + // unwrap is fine because it fails when metadata is not available + // but we already know that it is because it's checked at the + // start of the function. + display_file_name(&item, strip, config).unwrap().contents, ); } @@ -1537,14 +1556,9 @@ fn get_file_name(name: &Path, strip: Option<&Path>) -> String { } #[cfg(not(unix))] -fn display_file_name( - path: &Path, - strip: Option<&Path>, - metadata: &Metadata, - config: &Config, -) -> Cell { - let mut name = escape_name(get_file_name(path, strip), &config.quoting_style); - let file_type = metadata.file_type(); +fn display_file_name(path: &PathData, strip: Option<&Path>, config: &Config) -> Option { + let mut name = escape_name(get_file_name(&path.p_buf, strip), &config.quoting_style); + let file_type = path.file_type()?; match config.indicator_style { IndicatorStyle::Classify | IndicatorStyle::FileType => { @@ -1563,8 +1577,8 @@ fn display_file_name( _ => (), }; - if config.format == Format::Long && metadata.file_type().is_symlink() { - if let Ok(target) = path.read_link() { + if config.format == Format::Long && path.file_type()?.is_symlink() { + if let Ok(target) = path.p_buf.read_link() { // We don't bother updating width here because it's not used for long listings let target_name = target.to_string_lossy().to_string(); name.push_str(" -> "); @@ -1572,7 +1586,7 @@ fn display_file_name( } } - name.into() + Some(name.into()) } #[cfg(unix)] @@ -1604,26 +1618,22 @@ macro_rules! has { #[cfg(unix)] #[allow(clippy::cognitive_complexity)] -fn display_file_name( - path: &Path, - strip: Option<&Path>, - metadata: &Metadata, - config: &Config, -) -> Cell { - let mut name = escape_name(get_file_name(path, strip), &config.quoting_style); +fn display_file_name(path: &PathData, strip: Option<&Path>, config: &Config) -> Option { + let mut name = escape_name(get_file_name(&path.p_buf, strip), &config.quoting_style); if config.format != Format::Long && config.inode { - name = get_inode(metadata) + " " + &name; + name = get_inode(path.md()?) + " " + &name; } let mut width = UnicodeWidthStr::width(&*name); let ext; if config.color || config.indicator_style != IndicatorStyle::None { - let file_type = metadata.file_type(); + let metadata = path.md()?; + let file_type = path.file_type()?; let (code, sym) = if file_type.is_dir() { ("di", Some('/')) } else if file_type.is_symlink() { - if path.exists() { + if path.p_buf.exists() { ("ln", Some('@')) } else { ("or", Some('@')) @@ -1657,7 +1667,7 @@ fn display_file_name( ("ex", sym) } else if metadata.nlink() > 1 { ("mh", sym) - } else if let Some(e) = path.extension() { + } else if let Some(e) = path.p_buf.extension() { ext = format!("*.{}", e.to_string_lossy()); (ext.as_str(), None) } else { @@ -1696,8 +1706,8 @@ fn display_file_name( } } - if config.format == Format::Long && metadata.file_type().is_symlink() { - if let Ok(target) = path.read_link() { + if config.format == Format::Long && path.file_type()?.is_symlink() { + if let Ok(target) = path.p_buf.read_link() { // We don't bother updating width here because it's not used for long listings let code = if target.exists() { "fi" } else { "mi" }; let target_name = color_name(target.to_string_lossy().to_string(), code); @@ -1706,10 +1716,10 @@ fn display_file_name( } } - Cell { + Some(Cell { contents: name, width, - } + }) } #[cfg(not(unix))] From a114f855f08426ab33a36ac81d062fca23d5e2ba Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 22 Apr 2021 23:43:00 +0200 Subject: [PATCH 0413/1135] ls: revert to_ascii_lowercase --- src/uu/ls/src/ls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index d744e2914..f820ffffe 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1171,7 +1171,7 @@ fn sort_entries(entries: &mut Vec, config: &Config) { entries.sort_by_key(|k| Reverse(k.md().as_ref().map(|md| md.len()).unwrap_or(0))) } // The default sort in GNU ls is case insensitive - Sort::Name => entries.sort_by_key(|k| k.file_name.to_ascii_lowercase()), + Sort::Name => entries.sort_by_key(|k| k.file_name.to_lowercase()), Sort::Version => entries.sort_by(|k, j| version_cmp::version_cmp(&k.p_buf, &j.p_buf)), Sort::None => {} } From 3874a2445744a853608ef9854a3db5d44289f549 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 23 Apr 2021 00:35:45 +0200 Subject: [PATCH 0414/1135] ls: add once_cell to Cargo.toml --- src/uu/ls/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index dacdc7cd9..292a8b9d5 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -25,6 +25,7 @@ unicode-width = "0.1.5" globset = "0.4.6" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +once_cell = "1.7.2" [target.'cfg(unix)'.dependencies] atty = "0.2" From 72bf7afe5b048e50dfe45558ceaa7e39e6345d2c Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 23 Apr 2021 00:49:05 +0200 Subject: [PATCH 0415/1135] ls: also update Cargo.lock --- Cargo.lock | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 461716b1b..0a07b83b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -897,6 +897,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" +[[package]] +name = "once_cell" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" + [[package]] name = "onig" version = "4.3.3" @@ -1991,6 +1997,7 @@ dependencies = [ "globset", "lazy_static", "number_prefix", + "once_cell", "term_grid", "termsize", "time", From 646c6cacbc546d6f15435b4bb45458541c2d04d2 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Thu, 22 Apr 2021 22:37:44 +0200 Subject: [PATCH 0416/1135] refactor tests (#1982) --- src/uu/tac/src/tac.rs | 13 +- tests/by-util/test_chmod.rs | 2 +- tests/by-util/test_chroot.rs | 35 ++--- tests/by-util/test_cp.rs | 277 +++++++++++----------------------- tests/by-util/test_date.rs | 150 ++++++++---------- tests/by-util/test_df.rs | 16 +- tests/by-util/test_du.rs | 30 ++-- tests/by-util/test_env.rs | 7 +- tests/by-util/test_fmt.rs | 2 +- tests/by-util/test_groups.rs | 10 +- tests/by-util/test_head.rs | 12 +- tests/by-util/test_install.rs | 42 ++---- tests/by-util/test_ln.rs | 18 ++- tests/by-util/test_ls.rs | 8 + tests/by-util/test_mkfifo.rs | 3 +- tests/by-util/test_more.rs | 13 +- tests/by-util/test_mv.rs | 27 ++-- tests/by-util/test_nice.rs | 2 +- tests/by-util/test_shuf.rs | 107 ++++++------- tests/by-util/test_stat.rs | 2 +- tests/by-util/test_tac.rs | 23 +-- tests/by-util/test_tr.rs | 12 +- tests/by-util/test_tsort.rs | 30 ++-- tests/by-util/test_who.rs | 4 +- tests/common/util.rs | 49 ++++-- 25 files changed, 373 insertions(+), 521 deletions(-) diff --git a/src/uu/tac/src/tac.rs b/src/uu/tac/src/tac.rs index 666ba3384..1fb6489da 100644 --- a/src/uu/tac/src/tac.rs +++ b/src/uu/tac/src/tac.rs @@ -91,10 +91,15 @@ fn tac(filenames: Vec, before: bool, _: bool, separator: &str) -> i32 { } else { let path = Path::new(filename); if path.is_dir() || path.metadata().is_err() { - show_error!( - "failed to open '{}' for reading: No such file or directory", - filename - ); + if path.is_dir() { + show_error!("dir: read error: Invalid argument"); + } else { + show_error!( + "failed to open '{}' for reading: No such file or directory", + filename + ); + } + exit_code = 1; continue; } match File::open(path) { diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index 9eda769f1..3958c0a36 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -47,7 +47,7 @@ fn run_single_test(test: &TestCase, at: AtPath, mut ucmd: UCommand) { ucmd.arg(arg); } let r = ucmd.run(); - if !r.success { + if !r.succeeded() { println!("{}", r.stderr_str()); panic!("{:?}: failed", ucmd.raw); } diff --git a/tests/by-util/test_chroot.rs b/tests/by-util/test_chroot.rs index 05efd23ae..e2e355e14 100644 --- a/tests/by-util/test_chroot.rs +++ b/tests/by-util/test_chroot.rs @@ -4,14 +4,11 @@ use crate::common::util::*; fn test_missing_operand() { let result = new_ucmd!().run(); - assert_eq!( - true, - result - .stderr - .starts_with("error: The following required arguments were not provided") - ); + assert!(result + .stderr_str() + .starts_with("error: The following required arguments were not provided")); - assert_eq!(true, result.stderr.contains("")); + assert!(result.stderr_str().contains("")); } #[test] @@ -20,14 +17,11 @@ fn test_enter_chroot_fails() { at.mkdir("jail"); - let result = ucmd.arg("jail").run(); + let result = ucmd.arg("jail").fails(); - assert_eq!( - true, - result.stderr.starts_with( - "chroot: error: cannot chroot to jail: Operation not permitted (os error 1)" - ) - ) + assert!(result + .stderr_str() + .starts_with("chroot: error: cannot chroot to jail: Operation not permitted (os error 1)")); } #[test] @@ -47,19 +41,18 @@ fn test_invalid_user_spec() { at.mkdir("a"); - let result = ucmd.arg("a").arg("--userspec=ARABA:").run(); + let result = ucmd.arg("a").arg("--userspec=ARABA:").fails(); - assert_eq!( - true, - result.stderr.starts_with("chroot: error: invalid userspec") - ); + assert!(result + .stderr_str() + .starts_with("chroot: error: invalid userspec")); } #[test] fn test_preference_of_userspec() { let scene = TestScenario::new(util_name!()); let result = scene.cmd("whoami").run(); - if is_ci() && result.stderr.contains("No such user/group") { + if is_ci() && result.stderr_str().contains("No such user/group") { // In the CI, some server are failing to return whoami. // As seems to be a configuration issue, ignoring it return; @@ -73,7 +66,7 @@ fn test_preference_of_userspec() { println!("result.stdout = {}", result.stdout_str()); println!("result.stderr = {}", result.stderr_str()); - if is_ci() && result.stderr.contains("cannot find name for user ID") { + if is_ci() && result.stderr_str().contains("cannot find name for user ID") { // In the CI, some server are failing to return id. // As seems to be a configuration issue, ignoring it return; diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index f4aabff3e..2d8a54c18 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -42,13 +42,9 @@ static TEST_MOUNT_OTHER_FILESYSTEM_FILE: &str = "mount/DO_NOT_copy_me.txt"; fn test_cp_cp() { let (at, mut ucmd) = at_and_ucmd!(); // Invoke our binary to make the copy. - let result = ucmd - .arg(TEST_HELLO_WORLD_SOURCE) + ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_HELLO_WORLD_DEST) - .run(); - - // Check that the exit code represents a successful copy. - assert!(result.success); + .succeeds(); // Check the content of the destination file that was copied. assert_eq!(at.read(TEST_HELLO_WORLD_DEST), "Hello, World!\n"); @@ -57,12 +53,9 @@ fn test_cp_cp() { #[test] fn test_cp_existing_target() { let (at, mut ucmd) = at_and_ucmd!(); - let result = ucmd - .arg(TEST_HELLO_WORLD_SOURCE) + ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_EXISTING_FILE) - .run(); - - assert!(result.success); + .succeeds(); // Check the content of the destination file assert_eq!(at.read(TEST_EXISTING_FILE), "Hello, World!\n"); @@ -74,52 +67,41 @@ fn test_cp_existing_target() { #[test] fn test_cp_duplicate_files() { let (at, mut ucmd) = at_and_ucmd!(); - let result = ucmd - .arg(TEST_HELLO_WORLD_SOURCE) + ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_COPY_TO_FOLDER) - .run(); - - assert!(result.success); - assert!(result.stderr.contains("specified more than once")); + .succeeds() + .stderr_contains("specified more than once"); assert_eq!(at.read(TEST_COPY_TO_FOLDER_FILE), "Hello, World!\n"); } #[test] fn test_cp_multiple_files_target_is_file() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd + new_ucmd!() .arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_EXISTING_FILE) - .run(); - - assert!(!result.success); - assert!(result.stderr.contains("not a directory")); + .fails() + .stderr_contains("not a directory"); } #[test] fn test_cp_directory_not_recursive() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd + new_ucmd!() .arg(TEST_COPY_TO_FOLDER) .arg(TEST_HELLO_WORLD_DEST) - .run(); - - assert!(!result.success); - assert!(result.stderr.contains("omitting directory")); + .fails() + .stderr_contains("omitting directory"); } #[test] fn test_cp_multiple_files() { let (at, mut ucmd) = at_and_ucmd!(); - let result = ucmd - .arg(TEST_HELLO_WORLD_SOURCE) + ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_HOW_ARE_YOU_SOURCE) .arg(TEST_COPY_TO_FOLDER) - .run(); + .succeeds(); - assert!(result.success); assert_eq!(at.read(TEST_COPY_TO_FOLDER_FILE), "Hello, World!\n"); assert_eq!(at.read(TEST_HOW_ARE_YOU_DEST), "How are you?\n"); } @@ -129,14 +111,11 @@ fn test_cp_multiple_files() { #[cfg(not(macos))] fn test_cp_recurse() { let (at, mut ucmd) = at_and_ucmd!(); - - let result = ucmd - .arg("-r") + ucmd.arg("-r") .arg(TEST_COPY_FROM_FOLDER) .arg(TEST_COPY_TO_FOLDER_NEW) - .run(); + .succeeds(); - assert!(result.success); // Check the content of the destination file that was copied. assert_eq!(at.read(TEST_COPY_TO_FOLDER_NEW_FILE), "Hello, World!\n"); } @@ -144,14 +123,10 @@ fn test_cp_recurse() { #[test] fn test_cp_with_dirs_t() { let (at, mut ucmd) = at_and_ucmd!(); - - //using -t option - let result_to_dir_t = ucmd - .arg("-t") + ucmd.arg("-t") .arg(TEST_COPY_TO_FOLDER) .arg(TEST_HELLO_WORLD_SOURCE) - .run(); - assert!(result_to_dir_t.success); + .succeeds(); assert_eq!(at.read(TEST_COPY_TO_FOLDER_FILE), "Hello, World!\n"); } @@ -162,63 +137,52 @@ fn test_cp_with_dirs() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; - //using -t option - let result_to_dir = scene + scene .ucmd() .arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_COPY_TO_FOLDER) - .run(); - assert!(result_to_dir.success); + .succeeds(); assert_eq!(at.read(TEST_COPY_TO_FOLDER_FILE), "Hello, World!\n"); - let result_from_dir = scene + scene .ucmd() .arg(TEST_COPY_FROM_FOLDER_FILE) .arg(TEST_HELLO_WORLD_DEST) - .run(); - assert!(result_from_dir.success); + .succeeds(); assert_eq!(at.read(TEST_HELLO_WORLD_DEST), "Hello, World!\n"); } #[test] fn test_cp_arg_target_directory() { let (at, mut ucmd) = at_and_ucmd!(); - let result = ucmd - .arg(TEST_HELLO_WORLD_SOURCE) + ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg("-t") .arg(TEST_COPY_TO_FOLDER) - .run(); + .succeeds(); - assert!(result.success); assert_eq!(at.read(TEST_COPY_TO_FOLDER_FILE), "Hello, World!\n"); } #[test] fn test_cp_arg_no_target_directory() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd + new_ucmd!() .arg(TEST_HELLO_WORLD_SOURCE) .arg("-v") .arg("-T") .arg(TEST_COPY_TO_FOLDER) - .run(); - - assert!(!result.success); - assert!(result.stderr.contains("cannot overwrite directory")); + .fails() + .stderr_contains("cannot overwrite directory"); } #[test] fn test_cp_arg_interactive() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd + new_ucmd!() .arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_HOW_ARE_YOU_SOURCE) .arg("-i") .pipe_in("N\n") - .run(); - - assert!(result.success); - assert!(result.stderr.contains("Not overwriting")); + .succeeds() + .stderr_contains("Not overwriting"); } #[test] @@ -227,39 +191,33 @@ fn test_cp_arg_link() { use std::os::linux::fs::MetadataExt; let (at, mut ucmd) = at_and_ucmd!(); - let result = ucmd - .arg(TEST_HELLO_WORLD_SOURCE) + ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg("--link") .arg(TEST_HELLO_WORLD_DEST) - .run(); + .succeeds(); - assert!(result.success); assert_eq!(at.metadata(TEST_HELLO_WORLD_SOURCE).st_nlink(), 2); } #[test] fn test_cp_arg_symlink() { let (at, mut ucmd) = at_and_ucmd!(); - let result = ucmd - .arg(TEST_HELLO_WORLD_SOURCE) + ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg("--symbolic-link") .arg(TEST_HELLO_WORLD_DEST) - .run(); + .succeeds(); - assert!(result.success); assert!(at.is_symlink(TEST_HELLO_WORLD_DEST)); } #[test] fn test_cp_arg_no_clobber() { let (at, mut ucmd) = at_and_ucmd!(); - let result = ucmd - .arg(TEST_HELLO_WORLD_SOURCE) + ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg("--no-clobber") .arg(TEST_HOW_ARE_YOU_SOURCE) - .run(); + .succeeds(); - assert!(result.success); assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "How are you?\n"); } @@ -267,34 +225,31 @@ fn test_cp_arg_no_clobber() { fn test_cp_arg_no_clobber_twice() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; + at.touch("source.txt"); - let result = scene + scene .ucmd() .arg("--no-clobber") .arg("source.txt") .arg("dest.txt") - .run(); + .succeeds() + .no_stderr(); - println!("stderr = {:?}", result.stderr_str()); - println!("stdout = {:?}", result.stdout_str()); - assert!(result.success); - assert!(result.stderr.is_empty()); assert_eq!(at.read("source.txt"), ""); at.append("source.txt", "some-content"); - let result = scene + scene .ucmd() .arg("--no-clobber") .arg("source.txt") .arg("dest.txt") - .run(); + .succeeds() + .stdout_does_not_contain("Not overwriting"); - assert!(result.success); assert_eq!(at.read("source.txt"), "some-content"); // Should be empty as the "no-clobber" should keep // the previous version assert_eq!(at.read("dest.txt"), ""); - assert!(!result.stderr.contains("Not overwriting")); } #[test] @@ -311,16 +266,11 @@ fn test_cp_arg_force() { permissions.set_readonly(true); set_permissions(at.plus(TEST_HELLO_WORLD_DEST), permissions).unwrap(); - let result = ucmd - .arg(TEST_HELLO_WORLD_SOURCE) + ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg("--force") .arg(TEST_HELLO_WORLD_DEST) - .run(); + .succeeds(); - println!("{:?}", result.stderr_str()); - println!("{:?}", result.stdout_str()); - - assert!(result.success); assert_eq!(at.read(TEST_HELLO_WORLD_DEST), "Hello, World!\n"); } @@ -342,13 +292,11 @@ fn test_cp_arg_remove_destination() { permissions.set_readonly(true); set_permissions(at.plus(TEST_HELLO_WORLD_DEST), permissions).unwrap(); - let result = ucmd - .arg(TEST_HELLO_WORLD_SOURCE) + ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg("--remove-destination") .arg(TEST_HELLO_WORLD_DEST) - .run(); + .succeeds(); - assert!(result.success); assert_eq!(at.read(TEST_HELLO_WORLD_DEST), "Hello, World!\n"); } @@ -356,13 +304,11 @@ fn test_cp_arg_remove_destination() { fn test_cp_arg_backup() { let (at, mut ucmd) = at_and_ucmd!(); - let result = ucmd - .arg(TEST_HELLO_WORLD_SOURCE) + ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg("--backup") .arg(TEST_HOW_ARE_YOU_SOURCE) - .run(); + .succeeds(); - assert!(result.success); assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); assert_eq!( at.read(&*format!("{}~", TEST_HOW_ARE_YOU_SOURCE)), @@ -374,14 +320,12 @@ fn test_cp_arg_backup() { fn test_cp_arg_suffix() { let (at, mut ucmd) = at_and_ucmd!(); - let result = ucmd - .arg(TEST_HELLO_WORLD_SOURCE) + ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg("--suffix") .arg(".bak") .arg(TEST_HOW_ARE_YOU_SOURCE) - .run(); + .succeeds(); - assert!(result.success); assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); assert_eq!( at.read(&*format!("{}.bak", TEST_HOW_ARE_YOU_SOURCE)), @@ -391,9 +335,8 @@ fn test_cp_arg_suffix() { #[test] fn test_cp_deref_conflicting_options() { - let (_at, mut ucmd) = at_and_ucmd!(); - - ucmd.arg("-LP") + new_ucmd!() + .arg("-LP") .arg(TEST_COPY_TO_FOLDER) .arg(TEST_HELLO_WORLD_SOURCE) .fails(); @@ -401,8 +344,7 @@ fn test_cp_deref_conflicting_options() { #[test] fn test_cp_deref() { - let scene = TestScenario::new(util_name!()); - let at = &scene.fixtures; + let (at, mut ucmd) = at_and_ucmd!(); #[cfg(not(windows))] let _r = fs::symlink( @@ -415,16 +357,12 @@ fn test_cp_deref() { at.subdir.join(TEST_HELLO_WORLD_SOURCE_SYMLINK), ); //using -L option - let result = scene - .ucmd() - .arg("-L") + ucmd.arg("-L") .arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_HELLO_WORLD_SOURCE_SYMLINK) .arg(TEST_COPY_TO_FOLDER) - .run(); + .succeeds(); - // Check that the exit code represents a successful copy. - assert!(result.success); let path_to_new_symlink = at .subdir .join(TEST_COPY_TO_FOLDER) @@ -444,8 +382,7 @@ fn test_cp_deref() { } #[test] fn test_cp_no_deref() { - let scene = TestScenario::new(util_name!()); - let at = &scene.fixtures; + let (at, mut ucmd) = at_and_ucmd!(); #[cfg(not(windows))] let _r = fs::symlink( @@ -458,16 +395,12 @@ fn test_cp_no_deref() { at.subdir.join(TEST_HELLO_WORLD_SOURCE_SYMLINK), ); //using -P option - let result = scene - .ucmd() - .arg("-P") + ucmd.arg("-P") .arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_HELLO_WORLD_SOURCE_SYMLINK) .arg(TEST_COPY_TO_FOLDER) - .run(); + .succeeds(); - // Check that the exit code represents a successful copy. - assert!(result.success); let path_to_new_symlink = at .subdir .join(TEST_COPY_TO_FOLDER) @@ -490,14 +423,10 @@ fn test_cp_strip_trailing_slashes() { let (at, mut ucmd) = at_and_ucmd!(); //using --strip-trailing-slashes option - let result = ucmd - .arg("--strip-trailing-slashes") + ucmd.arg("--strip-trailing-slashes") .arg(format!("{}/", TEST_HELLO_WORLD_SOURCE)) .arg(TEST_HELLO_WORLD_DEST) - .run(); - - // Check that the exit code represents a successful copy. - assert!(result.success); + .succeeds(); // Check the content of the destination file that was copied. assert_eq!(at.read(TEST_HELLO_WORLD_DEST), "Hello, World!\n"); @@ -507,14 +436,11 @@ fn test_cp_strip_trailing_slashes() { fn test_cp_parents() { let (at, mut ucmd) = at_and_ucmd!(); - let result = ucmd - .arg("--parents") + ucmd.arg("--parents") .arg(TEST_COPY_FROM_FOLDER_FILE) .arg(TEST_COPY_TO_FOLDER) - .run(); + .succeeds(); - assert!(result.success); - // Check the content of the destination file that was copied. assert_eq!( at.read(&format!( "{}/{}", @@ -528,14 +454,12 @@ fn test_cp_parents() { fn test_cp_parents_multiple_files() { let (at, mut ucmd) = at_and_ucmd!(); - let result = ucmd - .arg("--parents") + ucmd.arg("--parents") .arg(TEST_COPY_FROM_FOLDER_FILE) .arg(TEST_HOW_ARE_YOU_SOURCE) .arg(TEST_COPY_TO_FOLDER) - .run(); + .succeeds(); - assert!(result.success); assert_eq!( at.read(&format!( "{}/{}", @@ -554,20 +478,12 @@ fn test_cp_parents_multiple_files() { #[test] fn test_cp_parents_dest_not_directory() { - let (_, mut ucmd) = at_and_ucmd!(); - - let result = ucmd + new_ucmd!() .arg("--parents") .arg(TEST_COPY_FROM_FOLDER_FILE) .arg(TEST_HELLO_WORLD_DEST) - .run(); - println!("{:?}", result); - - // Check that we did not succeed in copying. - assert!(!result.success); - assert!(result - .stderr - .contains("with --parents, the destination must be a directory")); + .fails() + .stderr_contains("with --parents, the destination must be a directory"); } #[test] @@ -594,18 +510,14 @@ fn test_cp_deref_folder_to_folder() { assert!(env::set_current_dir(&cwd).is_ok()); //using -P -R option - let result = scene + scene .ucmd() .arg("-L") .arg("-R") .arg("-v") .arg(TEST_COPY_FROM_FOLDER) .arg(TEST_COPY_TO_FOLDER_NEW) - .run(); - println!("cp output {}", result.stdout_str()); - - // Check that the exit code represents a successful copy. - assert!(result.success); + .succeeds(); #[cfg(not(windows))] { @@ -698,18 +610,14 @@ fn test_cp_no_deref_folder_to_folder() { assert!(env::set_current_dir(&cwd).is_ok()); //using -P -R option - let result = scene + scene .ucmd() .arg("-P") .arg("-R") .arg("-v") .arg(TEST_COPY_FROM_FOLDER) .arg(TEST_COPY_TO_FOLDER_NEW) - .run(); - println!("cp output {}", result.stdout_str()); - - // Check that the exit code represents a successful copy. - assert!(result.success); + .succeeds(); #[cfg(not(windows))] { @@ -791,13 +699,11 @@ fn test_cp_archive() { previous, ) .unwrap(); - let result = ucmd - .arg(TEST_HELLO_WORLD_SOURCE) + ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg("--archive") .arg(TEST_HOW_ARE_YOU_SOURCE) - .run(); + .succeeds(); - assert!(result.success); assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); let metadata = std_fs::metadata(at.subdir.join(TEST_HELLO_WORLD_SOURCE)).unwrap(); @@ -807,11 +713,10 @@ fn test_cp_archive() { let creation2 = metadata2.modified().unwrap(); let scene2 = TestScenario::new("ls"); - let result = scene2.cmd("ls").arg("-al").arg(at.subdir).run(); + let result = scene2.cmd("ls").arg("-al").arg(at.subdir).succeeds(); println!("ls dest {}", result.stdout_str()); assert_eq!(creation, creation2); - assert!(result.success); } #[test] @@ -850,11 +755,10 @@ fn test_cp_archive_recursive() { // Back to the initial cwd (breaks the other tests) assert!(env::set_current_dir(&cwd).is_ok()); - let resultg = ucmd - .arg("--archive") + ucmd.arg("--archive") .arg(TEST_COPY_TO_FOLDER) .arg(TEST_COPY_TO_FOLDER_NEW) - .run(); + .fails(); // fails for now let scene2 = TestScenario::new("ls"); let result = scene2 @@ -865,7 +769,6 @@ fn test_cp_archive_recursive() { println!("ls dest {}", result.stdout_str()); - let scene2 = TestScenario::new("ls"); let result = scene2 .cmd("ls") .arg("-al") @@ -910,9 +813,6 @@ fn test_cp_archive_recursive() { .join("2.link") .to_string_lossy() )); - - // fails for now - assert!(resultg.success); } #[test] @@ -928,13 +828,11 @@ fn test_cp_preserve_timestamps() { previous, ) .unwrap(); - let result = ucmd - .arg(TEST_HELLO_WORLD_SOURCE) + ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg("--preserve=timestamps") .arg(TEST_HOW_ARE_YOU_SOURCE) - .run(); + .succeeds(); - assert!(result.success); assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); let metadata = std_fs::metadata(at.subdir.join(TEST_HELLO_WORLD_SOURCE)).unwrap(); @@ -948,7 +846,6 @@ fn test_cp_preserve_timestamps() { println!("ls dest {}", result.stdout_str()); assert_eq!(creation, creation2); - assert!(result.success); } #[test] @@ -966,13 +863,11 @@ fn test_cp_dont_preserve_timestamps() { .unwrap(); sleep(Duration::from_secs(3)); - let result = ucmd - .arg(TEST_HELLO_WORLD_SOURCE) + ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg("--no-preserve=timestamps") .arg(TEST_HOW_ARE_YOU_SOURCE) - .run(); + .succeeds(); - assert!(result.success); assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); let metadata = std_fs::metadata(at.subdir.join(TEST_HELLO_WORLD_SOURCE)).unwrap(); @@ -992,7 +887,6 @@ fn test_cp_dont_preserve_timestamps() { // Some margins with time check assert!(res.as_secs() > 3595); assert!(res.as_secs() < 3605); - assert!(result.success); } #[test] @@ -1017,7 +911,7 @@ fn test_cp_one_file_system() { let scene = TestScenario::new(util_name!()); // Test must be run as root (or with `sudo -E`) - if scene.cmd("whoami").run().stdout != "root\n" { + if scene.cmd("whoami").run().stdout_str() != "root\n" { return; } @@ -1042,17 +936,16 @@ fn test_cp_one_file_system() { at_src.touch(TEST_MOUNT_OTHER_FILESYSTEM_FILE); // Begin testing -x flag - let result = scene + scene .ucmd() .arg("-rx") .arg(TEST_MOUNT_COPY_FROM_FOLDER) .arg(TEST_COPY_TO_FOLDER_NEW) - .run(); + .succeeds(); // Ditch the mount before the asserts scene.cmd("umount").arg(mountpoint_path).succeeds(); - assert!(result.success); assert!(!at_dst.file_exists(TEST_MOUNT_OTHER_FILESYSTEM_FILE)); // Check if the other files were copied from the source folder hirerarchy for entry in WalkDir::new(at_src.as_string()) { diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 1933fdba3..0c66c563e 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -7,174 +7,147 @@ use rust_users::*; #[test] fn test_date_email() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("--rfc-email").run(); - assert!(result.success); + new_ucmd!().arg("--rfc-email").succeeds(); } #[test] fn test_date_email2() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("-R").run(); - assert!(result.success); + new_ucmd!().arg("-R").succeeds(); } #[test] fn test_date_rfc_3339() { let scene = TestScenario::new(util_name!()); - let mut result = scene.ucmd().arg("--rfc-3339=ns").succeeds(); + let rfc_regexp = concat!( + r#"(\d+)-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])\s([01]\d|2[0-3]):"#, + r#"([0-5]\d):([0-5]\d|60)(\.\d+)?(([Zz])|([\+|\-]([01]\d|2[0-3])))"# + ); + let re = Regex::new(rfc_regexp).unwrap(); // Check that the output matches the regexp - let rfc_regexp = r"(\d+)-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])\s([01]\d|2[0-3]):([0-5]\d):([0-5]\d|60)(\.\d+)?(([Zz])|([\+|\-]([01]\d|2[0-3])))"; - let re = Regex::new(rfc_regexp).unwrap(); - assert!(re.is_match(&result.stdout_str().trim())); + scene + .ucmd() + .arg("--rfc-3339=ns") + .succeeds() + .stdout_matches(&re); - result = scene.ucmd().arg("--rfc-3339=seconds").succeeds(); - - // Check that the output matches the regexp - let re = Regex::new(rfc_regexp).unwrap(); - assert!(re.is_match(&result.stdout_str().trim())); + scene + .ucmd() + .arg("--rfc-3339=seconds") + .succeeds() + .stdout_matches(&re); } #[test] fn test_date_rfc_8601() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("--iso-8601=ns").run(); - assert!(result.success); + new_ucmd!().arg("--iso-8601=ns").succeeds(); } #[test] fn test_date_rfc_8601_second() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("--iso-8601=second").run(); - assert!(result.success); + new_ucmd!().arg("--iso-8601=second").succeeds(); } #[test] fn test_date_utc() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("--utc").run(); - assert!(result.success); + new_ucmd!().arg("--utc").succeeds(); } #[test] fn test_date_universal() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("--universal").run(); - assert!(result.success); + new_ucmd!().arg("--universal").succeeds(); } #[test] fn test_date_format_y() { let scene = TestScenario::new(util_name!()); - let mut result = scene.ucmd().arg("+%Y").succeeds(); - - assert!(result.success); let mut re = Regex::new(r"^\d{4}$").unwrap(); - assert!(re.is_match(&result.stdout_str().trim())); + scene.ucmd().arg("+%Y").succeeds().stdout_matches(&re); - result = scene.ucmd().arg("+%y").succeeds(); - - assert!(result.success); re = Regex::new(r"^\d{2}$").unwrap(); - assert!(re.is_match(&result.stdout_str().trim())); + scene.ucmd().arg("+%y").succeeds().stdout_matches(&re); } #[test] fn test_date_format_m() { let scene = TestScenario::new(util_name!()); - let mut result = scene.ucmd().arg("+%b").succeeds(); - - assert!(result.success); let mut re = Regex::new(r"\S+").unwrap(); - assert!(re.is_match(&result.stdout_str().trim())); + scene.ucmd().arg("+%b").succeeds().stdout_matches(&re); - result = scene.ucmd().arg("+%m").succeeds(); - - assert!(result.success); re = Regex::new(r"^\d{2}$").unwrap(); - assert!(re.is_match(&result.stdout_str().trim())); + scene.ucmd().arg("+%m").succeeds().stdout_matches(&re); } #[test] fn test_date_format_day() { let scene = TestScenario::new(util_name!()); - let mut result = scene.ucmd().arg("+%a").succeeds(); - - assert!(result.success); let mut re = Regex::new(r"\S+").unwrap(); - assert!(re.is_match(&result.stdout_str().trim())); - - result = scene.ucmd().arg("+%A").succeeds(); - - assert!(result.success); + scene.ucmd().arg("+%a").succeeds().stdout_matches(&re); re = Regex::new(r"\S+").unwrap(); - assert!(re.is_match(&result.stdout_str().trim())); + scene.ucmd().arg("+%A").succeeds().stdout_matches(&re); - result = scene.ucmd().arg("+%u").succeeds(); - - assert!(result.success); re = Regex::new(r"^\d{1}$").unwrap(); - assert!(re.is_match(&result.stdout_str().trim())); + scene.ucmd().arg("+%u").succeeds().stdout_matches(&re); } #[test] fn test_date_format_full_day() { - let scene = TestScenario::new(util_name!()); - - let result = scene.ucmd().arg("+'%a %Y-%m-%d'").succeeds(); - - assert!(result.success); let re = Regex::new(r"\S+ \d{4}-\d{2}-\d{2}").unwrap(); - assert!(re.is_match(&result.stdout_str().trim())); + new_ucmd!() + .arg("+'%a %Y-%m-%d'") + .succeeds() + .stdout_matches(&re); } #[test] #[cfg(all(unix, not(target_os = "macos")))] fn test_date_set_valid() { if get_effective_uid() == 0 { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd + new_ucmd!() .arg("--set") .arg("2020-03-12 13:30:00+08:00") - .succeeds(); - result.no_stdout().no_stderr(); + .succeeds() + .no_stdout() + .no_stderr(); } } #[test] #[cfg(any(windows, all(unix, not(target_os = "macos"))))] fn test_date_set_invalid() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("--set").arg("123abcd").fails(); - let result = result.no_stdout(); - assert!(result.stderr.starts_with("date: invalid date ")); + let result = new_ucmd!().arg("--set").arg("123abcd").fails(); + result.no_stdout(); + assert!(result.stderr_str().starts_with("date: invalid date ")); } #[test] #[cfg(all(unix, not(target_os = "macos")))] fn test_date_set_permissions_error() { if !(get_effective_uid() == 0 || is_wsl()) { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("--set").arg("2020-03-11 21:45:00+08:00").fails(); - let result = result.no_stdout(); - assert!(result.stderr.starts_with("date: cannot set date: ")); + let result = new_ucmd!() + .arg("--set") + .arg("2020-03-11 21:45:00+08:00") + .fails(); + result.no_stdout(); + assert!(result.stderr_str().starts_with("date: cannot set date: ")); } } #[test] #[cfg(target_os = "macos")] fn test_date_set_mac_unavailable() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("--set").arg("2020-03-11 21:45:00+08:00").fails(); - let result = result.no_stdout(); + let result = new_ucmd!() + .arg("--set") + .arg("2020-03-11 21:45:00+08:00") + .fails(); + result.no_stdout(); assert!(result - .stderr + .stderr_str() .starts_with("date: setting the date is not supported by macOS")); } @@ -183,13 +156,12 @@ fn test_date_set_mac_unavailable() { /// TODO: expected to fail currently; change to succeeds() when required. fn test_date_set_valid_2() { if get_effective_uid() == 0 { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd + let result = new_ucmd!() .arg("--set") .arg("Sat 20 Mar 2021 14:53:01 AWST") .fails(); - let result = result.no_stdout(); - assert!(result.stderr.starts_with("date: invalid date ")); + result.no_stdout(); + assert!(result.stderr_str().starts_with("date: invalid date ")); } } @@ -198,13 +170,12 @@ fn test_date_set_valid_2() { /// TODO: expected to fail currently; change to succeeds() when required. fn test_date_set_valid_3() { if get_effective_uid() == 0 { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd + let result = new_ucmd!() .arg("--set") .arg("Sat 20 Mar 2021 14:53:01") // Local timezone .fails(); - let result = result.no_stdout(); - assert!(result.stderr.starts_with("date: invalid date ")); + result.no_stdout(); + assert!(result.stderr_str().starts_with("date: invalid date ")); } } @@ -213,12 +184,11 @@ fn test_date_set_valid_3() { /// TODO: expected to fail currently; change to succeeds() when required. fn test_date_set_valid_4() { if get_effective_uid() == 0 { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd + let result = new_ucmd!() .arg("--set") .arg("2020-03-11 21:45:00") // Local timezone .fails(); - let result = result.no_stdout(); - assert!(result.stderr.starts_with("date: invalid date ")); + result.no_stdout(); + assert!(result.stderr_str().starts_with("date: invalid date ")); } } diff --git a/tests/by-util/test_df.rs b/tests/by-util/test_df.rs index f79d1beb5..0ae8d2339 100644 --- a/tests/by-util/test_df.rs +++ b/tests/by-util/test_df.rs @@ -2,30 +2,22 @@ use crate::common::util::*; #[test] fn test_df_compatible_no_size_arg() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("-a").run(); - assert!(result.success); + new_ucmd!().arg("-a").succeeds(); } #[test] fn test_df_compatible() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("-ah").run(); - assert!(result.success); + new_ucmd!().arg("-ah").succeeds(); } #[test] fn test_df_compatible_type() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("-aT").run(); - assert!(result.success); + new_ucmd!().arg("-aT").succeeds(); } #[test] fn test_df_compatible_si() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("-aH").run(); - assert!(result.success); + new_ucmd!().arg("-aH").succeeds(); } // ToDO: more tests... diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index 16adcb974..45704eb41 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -220,26 +220,36 @@ fn test_du_time() { .arg("date_test") .succeeds() .stdout_only("0\t2015-05-15 00:00\tdate_test\n"); - - // cleanup by removing test file - scene.cmd("rm").arg("date_test").succeeds(); // TODO: is this necessary? } #[cfg(not(target_os = "windows"))] #[cfg(feature = "chmod")] #[test] fn test_du_no_permission() { - let ts = TestScenario::new(util_name!()); + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; - let _chmod = ts.ccmd("chmod").arg("-r").arg(SUB_DIR_LINKS).succeeds(); - let result = ts.ucmd().arg(SUB_DIR_LINKS).succeeds(); + at.mkdir_all(SUB_DIR_LINKS); - ts.ccmd("chmod").arg("+r").arg(SUB_DIR_LINKS).run(); + scene.ccmd("chmod").arg("-r").arg(SUB_DIR_LINKS).succeeds(); - assert_eq!( - result.stderr_str(), - "du: cannot read directory ‘subdir/links‘: Permission denied (os error 13)\n" + let result = scene.ucmd().arg(SUB_DIR_LINKS).run(); // TODO: replace with ".fails()" once `du` is fixed + result.stderr_contains( + "du: cannot read directory ‘subdir/links‘: Permission denied (os error 13)", ); + + #[cfg(target_os = "linux")] + { + let result_reference = scene.cmd("du").arg(SUB_DIR_LINKS).fails(); + if result_reference + .stderr_str() + .contains("du: cannot read directory 'subdir/links': Permission denied") + { + assert_eq!(result.stdout_str(), result_reference.stdout_str()); + return; + } + } + _du_no_permission(result.stdout_str()); } diff --git a/tests/by-util/test_env.rs b/tests/by-util/test_env.rs index 39baf473b..e86a41783 100644 --- a/tests/by-util/test_env.rs +++ b/tests/by-util/test_env.rs @@ -140,8 +140,11 @@ fn test_unset_variable() { #[test] fn test_fail_null_with_program() { - let out = new_ucmd!().arg("--null").arg("cd").fails().stderr; - assert!(out.contains("cannot specify --null (-0) with command")); + new_ucmd!() + .arg("--null") + .arg("cd") + .fails() + .stderr_contains("cannot specify --null (-0) with command"); } #[cfg(not(windows))] diff --git a/tests/by-util/test_fmt.rs b/tests/by-util/test_fmt.rs index f962a9137..21a5f3396 100644 --- a/tests/by-util/test_fmt.rs +++ b/tests/by-util/test_fmt.rs @@ -29,7 +29,7 @@ fn test_fmt_w_too_big() { .run(); //.stdout_is_fixture("call_graph.expected"); assert_eq!( - result.stderr.trim(), + result.stderr_str().trim(), "fmt: error: invalid width: '2501': Numerical result out of range" ); } diff --git a/tests/by-util/test_groups.rs b/tests/by-util/test_groups.rs index 32a16cc1a..cee13bdc3 100644 --- a/tests/by-util/test_groups.rs +++ b/tests/by-util/test_groups.rs @@ -10,7 +10,7 @@ fn test_groups() { // As seems to be a configuration issue, ignoring it return; } - assert!(result.success); + result.success(); assert!(!result.stdout_str().trim().is_empty()); } @@ -30,16 +30,12 @@ fn test_groups_arg() { println!("result.stdout = {}", result.stdout_str()); println!("result.stderr = {}", result.stderr_str()); - assert!(result.success); + result.success(); assert!(!result.stdout_str().is_empty()); let username = result.stdout_str().trim(); // call groups with the user name to check that we // are getting something - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg(username).run(); - println!("result.stdout = {}", result.stdout_str()); - println!("result.stderr = {}", result.stderr_str()); - assert!(result.success); + new_ucmd!().arg(username).succeeds(); assert!(!result.stdout_str().is_empty()); } diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index d91cc1289..4f009c800 100755 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -156,14 +156,10 @@ fn test_negative_zero_bytes() { } #[test] fn test_no_such_file_or_directory() { - let result = new_ucmd!().arg("no_such_file.toml").run(); - - assert_eq!( - true, - result - .stderr - .contains("cannot open 'no_such_file.toml' for reading: No such file or directory") - ) + new_ucmd!() + .arg("no_such_file.toml") + .fails() + .stderr_contains("cannot open 'no_such_file.toml' for reading: No such file or directory"); } // there was a bug not caught by previous tests diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index fa23de745..fc4459072 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -11,12 +11,10 @@ use std::thread::sleep; fn test_install_help() { let (_, mut ucmd) = at_and_ucmd!(); - assert!(ucmd - .arg("--help") + ucmd.arg("--help") .succeeds() .no_stderr() - .stdout - .contains("FLAGS:")); + .stdout_contains("FLAGS:"); } #[test] @@ -59,13 +57,11 @@ fn test_install_failing_not_dir() { at.touch(file1); at.touch(file2); at.touch(file3); - assert!(ucmd - .arg(file1) + ucmd.arg(file1) .arg(file2) .arg(file3) .fails() - .stderr - .contains("not a directory")); + .stderr_contains("not a directory"); } #[test] @@ -77,13 +73,11 @@ fn test_install_unimplemented_arg() { at.touch(file); at.mkdir(dir); - assert!(ucmd - .arg(context_arg) + ucmd.arg(context_arg) .arg(file) .arg(dir) .fails() - .stderr - .contains("Unimplemented")); + .stderr_contains("Unimplemented"); assert!(!at.file_exists(&format!("{}/{}", dir, file))); } @@ -231,13 +225,11 @@ fn test_install_mode_failing() { at.touch(file); at.mkdir(dir); - assert!(ucmd - .arg(file) + ucmd.arg(file) .arg(dir) .arg(mode_arg) .fails() - .stderr - .contains("Invalid mode string: invalid digit found in string")); + .stderr_contains("Invalid mode string: invalid digit found in string"); let dest_file = &format!("{}/{}", dir, file); assert!(at.file_exists(file)); @@ -336,7 +328,7 @@ fn test_install_target_new_file_with_owner() { .arg(format!("{}/{}", dir, file)) .run(); - if is_ci() && result.stderr.contains("error: no such user:") { + if is_ci() && result.stderr_str().contains("error: no such user:") { // In the CI, some server are failing to return the user id. // As seems to be a configuration issue, ignoring it return; @@ -619,35 +611,27 @@ fn test_install_and_strip_with_program() { #[test] #[cfg(not(windows))] fn test_install_and_strip_with_invalid_program() { - let scene = TestScenario::new(util_name!()); - - let stderr = scene - .ucmd() + new_ucmd!() .arg("-s") .arg("--strip-program") .arg("/bin/date") .arg(strip_source_file()) .arg(STRIP_TARGET_FILE) .fails() - .stderr; - assert!(stderr.contains("strip program failed")); + .stderr_contains("strip program failed"); } #[test] #[cfg(not(windows))] fn test_install_and_strip_with_non_existent_program() { - let scene = TestScenario::new(util_name!()); - - let stderr = scene - .ucmd() + new_ucmd!() .arg("-s") .arg("--strip-program") .arg("/usr/bin/non_existent_program") .arg(strip_source_file()) .arg(STRIP_TARGET_FILE) .fails() - .stderr; - assert!(stderr.contains("No such file or directory")); + .stderr_contains("No such file or directory"); } #[test] diff --git a/tests/by-util/test_ln.rs b/tests/by-util/test_ln.rs index d7a13b0d4..646091b09 100644 --- a/tests/by-util/test_ln.rs +++ b/tests/by-util/test_ln.rs @@ -299,13 +299,11 @@ fn test_symlink_overwrite_dir_fail() { at.touch(path_a); at.mkdir(path_b); - assert!( - ucmd.args(&["-s", "-T", path_a, path_b]) - .fails() - .stderr - .len() - > 0 - ); + assert!(!ucmd + .args(&["-s", "-T", path_a, path_b]) + .fails() + .stderr_str() + .is_empty()); } #[test] @@ -358,7 +356,11 @@ fn test_symlink_target_only() { at.mkdir(dir); - assert!(ucmd.args(&["-s", "-t", dir]).fails().stderr.len() > 0); + assert!(!ucmd + .args(&["-s", "-t", dir]) + .fails() + .stderr_str() + .is_empty()); } #[test] diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index d810cdc29..5583dbaca 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -103,6 +103,14 @@ fn test_ls_width() { .succeeds() .stdout_only("test-width-1\ntest-width-2\ntest-width-3\ntest-width-4\n"); } + + for option in &["-w 1a", "-w=1a", "--width=1a", "--width 1a"] { + scene + .ucmd() + .args(&option.split(" ").collect::>()) + .fails() + .stderr_only("ls: error: invalid line width: ‘1a’"); + } } #[test] diff --git a/tests/by-util/test_mkfifo.rs b/tests/by-util/test_mkfifo.rs index f60c0a4b8..23108d976 100644 --- a/tests/by-util/test_mkfifo.rs +++ b/tests/by-util/test_mkfifo.rs @@ -19,8 +19,7 @@ fn test_create_one_fifo_with_invalid_mode() { .arg("-m") .arg("invalid") .fails() - .stderr - .contains("invalid mode"); + .stderr_contains("invalid mode"); } #[test] diff --git a/tests/by-util/test_more.rs b/tests/by-util/test_more.rs index 736fb6956..9245733ca 100644 --- a/tests/by-util/test_more.rs +++ b/tests/by-util/test_more.rs @@ -2,18 +2,15 @@ use crate::common::util::*; #[test] fn test_more_no_arg() { - let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.run(); - assert!(!result.success); + // stderr = more: Reading from stdin isn't supported yet. + new_ucmd!().fails(); } #[test] fn test_more_dir_arg() { - let (_, mut ucmd) = at_and_ucmd!(); - ucmd.arg("."); - let result = ucmd.run(); - assert!(!result.success); + let result = new_ucmd!().arg(".").run(); + result.failure(); const EXPECTED_ERROR_MESSAGE: &str = "more: '.' is a directory.\nTry 'more --help' for more information."; - assert_eq!(result.stderr.trim(), EXPECTED_ERROR_MESSAGE); + assert_eq!(result.stderr_str().trim(), EXPECTED_ERROR_MESSAGE); } diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index 0caeb1ef1..e8ba43282 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -476,16 +476,9 @@ fn test_mv_overwrite_nonempty_dir() { // GNU: "mv: cannot move ‘a’ to ‘b’: Directory not empty" // Verbose output for the move should not be shown on failure - assert!( - ucmd.arg("-vT") - .arg(dir_a) - .arg(dir_b) - .fails() - .no_stdout() - .stderr - .len() - > 0 - ); + let result = ucmd.arg("-vT").arg(dir_a).arg(dir_b).fails(); + result.no_stdout(); + assert!(!result.stderr_str().is_empty()); assert!(at.dir_exists(dir_a)); assert!(at.dir_exists(dir_b)); @@ -526,15 +519,15 @@ fn test_mv_errors() { // $ mv -T -t a b // mv: cannot combine --target-directory (-t) and --no-target-directory (-T) - let result = scene + scene .ucmd() .arg("-T") .arg("-t") .arg(dir) .arg(file_a) .arg(file_b) - .fails(); - assert!(result.stderr.contains("cannot be used with")); + .fails() + .stderr_contains("cannot be used with"); // $ at.touch file && at.mkdir dir // $ mv -T file dir @@ -553,7 +546,13 @@ fn test_mv_errors() { // $ at.mkdir dir && at.touch file // $ mv dir file // err == mv: cannot overwrite non-directory ‘file’ with directory ‘dir’ - assert!(scene.ucmd().arg(dir).arg(file_a).fails().stderr.len() > 0); + assert!(!scene + .ucmd() + .arg(dir) + .arg(file_a) + .fails() + .stderr_str() + .is_empty()); } #[test] diff --git a/tests/by-util/test_nice.rs b/tests/by-util/test_nice.rs index 7e704fc00..d3457c686 100644 --- a/tests/by-util/test_nice.rs +++ b/tests/by-util/test_nice.rs @@ -16,7 +16,7 @@ fn test_negative_adjustment() { let res = new_ucmd!().args(&["-n", "-1", "true"]).run(); assert!(res - .stderr + .stderr_str() .starts_with("nice: warning: setpriority: Permission denied")); } diff --git a/tests/by-util/test_shuf.rs b/tests/by-util/test_shuf.rs index 717971bd4..f925f8357 100644 --- a/tests/by-util/test_shuf.rs +++ b/tests/by-util/test_shuf.rs @@ -9,35 +9,28 @@ fn test_output_is_random_permutation() { .collect::>() .join("\n"); - let result = new_ucmd!() - .pipe_in(input.as_bytes()) - .succeeds() - .no_stderr() - .stdout - .clone(); + let result = new_ucmd!().pipe_in(input.as_bytes()).succeeds(); + result.no_stderr(); let mut result_seq: Vec = result + .stdout_str() .split("\n") .filter(|x| !x.is_empty()) .map(|x| x.parse().unwrap()) .collect(); result_seq.sort(); - assert_ne!(result, input, "Output is not randomised"); + assert_ne!(result.stdout_str(), input, "Output is not randomised"); assert_eq!(result_seq, input_seq, "Output is not a permutation"); } #[test] fn test_zero_termination() { let input_seq = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; - let result = new_ucmd!() - .arg("-z") - .arg("-i1-10") - .succeeds() - .no_stderr() - .stdout - .clone(); + let result = new_ucmd!().arg("-z").arg("-i1-10").succeeds(); + result.no_stderr(); let mut result_seq: Vec = result + .stdout_str() .split("\0") .filter(|x| !x.is_empty()) .map(|x| x.parse().unwrap()) @@ -57,12 +50,11 @@ fn test_echo() { .map(|x| x.to_string()) .collect::>(), ) - .succeeds() - .no_stderr() - .stdout - .clone(); + .succeeds(); + result.no_stderr(); let mut result_seq: Vec = result + .stdout_str() .split("\n") .filter(|x| !x.is_empty()) .map(|x| x.parse().unwrap()) @@ -84,12 +76,11 @@ fn test_head_count() { let result = new_ucmd!() .args(&["-n", &repeat_limit.to_string()]) .pipe_in(input.as_bytes()) - .succeeds() - .no_stderr() - .stdout - .clone(); + .succeeds(); + result.no_stderr(); let mut result_seq: Vec = result + .stdout_str() .split("\n") .filter(|x| !x.is_empty()) .map(|x| x.parse().unwrap()) @@ -99,7 +90,7 @@ fn test_head_count() { assert!( result_seq.iter().all(|x| input_seq.contains(x)), "Output includes element not from input: {}", - result + result.stdout_str() ) } @@ -117,12 +108,11 @@ fn test_repeat() { .arg("-r") .args(&["-n", &repeat_limit.to_string()]) .pipe_in(input.as_bytes()) - .succeeds() - .no_stderr() - .stdout - .clone(); + .succeeds(); + result.no_stderr(); let result_seq: Vec = result + .stdout_str() .split("\n") .filter(|x| !x.is_empty()) .map(|x| x.parse().unwrap()) @@ -146,14 +136,11 @@ fn test_repeat() { fn test_file_input() { let expected_seq = vec![11, 12, 13, 14, 15, 16, 17, 18, 19, 20]; - let result = new_ucmd!() - .arg("file_input.txt") - .succeeds() - .no_stderr() - .stdout - .clone(); + let result = new_ucmd!().arg("file_input.txt").succeeds(); + result.no_stderr(); let mut result_seq: Vec = result + .stdout_str() .split("\n") .filter(|x| !x.is_empty()) .map(|x| x.parse().unwrap()) @@ -164,52 +151,50 @@ fn test_file_input() { #[test] fn test_shuf_echo_and_input_range_not_allowed() { - let result = new_ucmd!().args(&["-e", "0", "-i", "0-2"]).run(); - - assert!(!result.success); - assert!(result - .stderr - .contains("The argument '--input-range ' cannot be used with '--echo ...'")); + new_ucmd!() + .args(&["-e", "0", "-i", "0-2"]) + .fails() + .stderr_contains( + "The argument '--input-range ' cannot be used with '--echo ...'", + ); } #[test] fn test_shuf_input_range_and_file_not_allowed() { - let result = new_ucmd!().args(&["-i", "0-9", "file"]).run(); - - assert!(!result.success); - assert!(result - .stderr - .contains("The argument '' cannot be used with '--input-range '")); + new_ucmd!() + .args(&["-i", "0-9", "file"]) + .fails() + .stderr_contains("The argument '' cannot be used with '--input-range '"); } #[test] fn test_shuf_invalid_input_range_one() { - let result = new_ucmd!().args(&["-i", "0"]).run(); - - assert!(!result.success); - assert!(result.stderr.contains("invalid input range")); + new_ucmd!() + .args(&["-i", "0"]) + .fails() + .stderr_contains("invalid input range"); } #[test] fn test_shuf_invalid_input_range_two() { - let result = new_ucmd!().args(&["-i", "a-9"]).run(); - - assert!(!result.success); - assert!(result.stderr.contains("invalid input range: 'a'")); + new_ucmd!() + .args(&["-i", "a-9"]) + .fails() + .stderr_contains("invalid input range: 'a'"); } #[test] fn test_shuf_invalid_input_range_three() { - let result = new_ucmd!().args(&["-i", "0-b"]).run(); - - assert!(!result.success); - assert!(result.stderr.contains("invalid input range: 'b'")); + new_ucmd!() + .args(&["-i", "0-b"]) + .fails() + .stderr_contains("invalid input range: 'b'"); } #[test] fn test_shuf_invalid_input_line_count() { - let result = new_ucmd!().args(&["-n", "a"]).run(); - - assert!(!result.success); - assert!(result.stderr.contains("invalid line count: 'a'")); + new_ucmd!() + .args(&["-n", "a"]) + .fails() + .stderr_contains("invalid line count: 'a'"); } diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 376b3db51..60d735c51 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -337,5 +337,5 @@ fn expected_result(args: &[&str]) -> String { .env("LANGUAGE", "C") .args(args) .run() - .stdout + .stdout_move_str() } diff --git a/tests/by-util/test_tac.rs b/tests/by-util/test_tac.rs index 3733adbec..a8adbb28e 100644 --- a/tests/by-util/test_tac.rs +++ b/tests/by-util/test_tac.rs @@ -52,18 +52,19 @@ fn test_single_non_newline_separator_before() { #[test] fn test_invalid_input() { - let (_, mut ucmd) = at_and_ucmd!(); + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; - ucmd.arg("b") - .run() - .stderr - .contains("tac: error: failed to open 'b' for reading"); - - let (at, mut ucmd) = at_and_ucmd!(); + scene + .ucmd() + .arg("b") + .fails() + .stderr_contains("failed to open 'b' for reading: No such file or directory"); at.mkdir("a"); - ucmd.arg("a") - .run() - .stderr - .contains("tac: error: failed to read 'a'"); + scene + .ucmd() + .arg("a") + .fails() + .stderr_contains("dir: read error: Invalid argument"); } diff --git a/tests/by-util/test_tr.rs b/tests/by-util/test_tr.rs index a1500bcf6..630c305c6 100644 --- a/tests/by-util/test_tr.rs +++ b/tests/by-util/test_tr.rs @@ -120,19 +120,15 @@ fn test_truncate_with_set1_shorter_than_set2() { #[test] fn missing_args_fails() { let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.run(); - - assert!(!result.success); - assert!(result.stderr.contains("missing operand")); + ucmd.fails().stderr_contains("missing operand"); } #[test] fn missing_required_second_arg_fails() { let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.args(&["foo"]).run(); - - assert!(!result.success); - assert!(result.stderr.contains("missing operand after")); + ucmd.args(&["foo"]) + .fails() + .stderr_contains("missing operand after"); } #[test] diff --git a/tests/by-util/test_tsort.rs b/tests/by-util/test_tsort.rs index 0ea6de281..0da6f44e4 100644 --- a/tests/by-util/test_tsort.rs +++ b/tests/by-util/test_tsort.rs @@ -18,33 +18,35 @@ fn test_sort_self_loop() { #[test] fn test_no_such_file() { - let result = new_ucmd!().arg("invalid_file_txt").run(); - - assert_eq!(true, result.stderr.contains("No such file or directory")); + new_ucmd!() + .arg("invalid_file_txt") + .fails() + .stderr_contains("No such file or directory"); } #[test] fn test_version_flag() { - let version_short = new_ucmd!().arg("-V").run(); - let version_long = new_ucmd!().arg("--version").run(); + let version_short = new_ucmd!().arg("-V").succeeds(); + let version_long = new_ucmd!().arg("--version").succeeds(); - assert_eq!(version_short.stdout(), version_long.stdout()); + assert_eq!(version_short.stdout_str(), version_long.stdout_str()); } #[test] fn test_help_flag() { - let help_short = new_ucmd!().arg("-h").run(); - let help_long = new_ucmd!().arg("--help").run(); + let help_short = new_ucmd!().arg("-h").succeeds(); + let help_long = new_ucmd!().arg("--help").succeeds(); - assert_eq!(help_short.stdout(), help_long.stdout()); + assert_eq!(help_short.stdout_str(), help_long.stdout_str()); } #[test] fn test_multiple_arguments() { - let result = new_ucmd!() + new_ucmd!() .arg("call_graph.txt") - .arg("invalid_file.txt") - .run(); - - assert_eq!(true, result.stderr.contains("error: Found argument 'invalid_file.txt' which wasn't expected, or isn't valid in this context")) + .arg("invalid_file") + .fails() + .stderr_contains( + "Found argument 'invalid_file' which wasn't expected, or isn't valid in this context", + ); } diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index 89b7cec93..32d2427e0 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -23,7 +23,7 @@ fn test_heading() { for opt in vec!["-H"] { // allow whitespace variation // * minor whitespace differences occur between platform built-in outputs; specifically number of TABs between "TIME" and "COMMENT" may be variant - let actual = new_ucmd!().arg(opt).run().stdout; + let actual = new_ucmd!().arg(opt).run().stdout_move_str(); let expect = expected_result(opt); println!("actual: {:?}", actual); println!("expect: {:?}", expect); @@ -80,5 +80,5 @@ fn expected_result(arg: &str) -> String { .env("LANGUAGE", "C") .args(&[arg]) .run() - .stdout + .stdout_move_str() } diff --git a/tests/common/util.rs b/tests/common/util.rs index 55e121737..af3b6f1eb 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -74,11 +74,11 @@ pub struct CmdResult { code: Option, /// zero-exit from running the Command? /// see [`success`] - pub success: bool, + success: bool, /// captured standard output after running the Command - pub stdout: String, + stdout: String, /// captured standard error after running the Command - pub stderr: String, + stderr: String, } impl CmdResult { @@ -329,14 +329,14 @@ impl CmdResult { } pub fn stdout_matches(&self, regex: ®ex::Regex) -> &CmdResult { - if !regex.is_match(self.stdout_str()) { + if !regex.is_match(self.stdout_str().trim()) { panic!("Stdout does not match regex:\n{}", self.stdout_str()) } self } pub fn stdout_does_not_match(&self, regex: ®ex::Regex) -> &CmdResult { - if regex.is_match(self.stdout_str()) { + if regex.is_match(self.stdout_str().trim()) { panic!("Stdout matches regex:\n{}", self.stdout_str()) } self @@ -696,8 +696,11 @@ pub struct UCommand { comm_string: String, tmpd: Option>, has_run: bool, - stdin: Option>, ignore_stdin_write_error: bool, + stdin: Option, + stdout: Option, + stderr: Option, + bytes_into_stdin: Option>, } impl UCommand { @@ -726,8 +729,11 @@ impl UCommand { cmd }, comm_string: String::from(arg.as_ref().to_str().unwrap()), - stdin: None, ignore_stdin_write_error: false, + bytes_into_stdin: None, + stdin: None, + stdout: None, + stderr: None, } } @@ -738,6 +744,21 @@ impl UCommand { ucmd } + pub fn set_stdin>(&mut self, stdin: T) -> &mut UCommand { + self.stdin = Some(stdin.into()); + self + } + + pub fn set_stdout>(&mut self, stdout: T) -> &mut UCommand { + self.stdout = Some(stdout.into()); + self + } + + pub fn set_stderr>(&mut self, stderr: T) -> &mut UCommand { + self.stderr = Some(stderr.into()); + self + } + /// Add a parameter to the invocation. Path arguments are treated relative /// to the test environment directory. pub fn arg>(&mut self, arg: S) -> &mut UCommand { @@ -767,10 +788,10 @@ impl UCommand { /// provides stdinput to feed in to the command when spawned pub fn pipe_in>>(&mut self, input: T) -> &mut UCommand { - if self.stdin.is_some() { + if self.bytes_into_stdin.is_some() { panic!("{}", MULTIPLE_STDIN_MEANINGLESS); } - self.stdin = Some(input.into()); + self.bytes_into_stdin = Some(input.into()); self } @@ -784,7 +805,7 @@ impl UCommand { /// This is typically useful to test non-standard workflows /// like feeding something to a command that does not read it pub fn ignore_stdin_write_error(&mut self) -> &mut UCommand { - if self.stdin.is_none() { + if self.bytes_into_stdin.is_none() { panic!("{}", NO_STDIN_MEANINGLESS); } self.ignore_stdin_write_error = true; @@ -813,13 +834,13 @@ impl UCommand { log_info("run", &self.comm_string); let mut child = self .raw - .stdin(Stdio::piped()) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) + .stdin(self.stdin.take().unwrap_or_else(|| Stdio::piped())) + .stdout(self.stdout.take().unwrap_or_else(|| Stdio::piped())) + .stderr(self.stderr.take().unwrap_or_else(|| Stdio::piped())) .spawn() .unwrap(); - if let Some(ref input) = self.stdin { + if let Some(ref input) = self.bytes_into_stdin { let write_result = child .stdin .take() From 1c5f47efaff48b301b23d39215dd1e1ba6a7568c Mon Sep 17 00:00:00 2001 From: Nicolas Thery Date: Fri, 23 Apr 2021 07:24:47 +0200 Subject: [PATCH 0417/1135] use `CmdResult` methods rather than fields --- tests/by-util/test_cp.rs | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index c90dff061..931811d91 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1095,13 +1095,10 @@ fn test_cp_reflink_always() { #[cfg(target_os = "linux")] fn test_cp_reflink_auto() { let (at, mut ucmd) = at_and_ucmd!(); - let result = ucmd - .arg("--reflink=auto") + ucmd.arg("--reflink=auto") .arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_EXISTING_FILE) - .run(); - - assert!(result.success); + .succeeds(); // Check the content of the destination file assert_eq!(at.read(TEST_EXISTING_FILE), "Hello, World!\n"); @@ -1111,13 +1108,10 @@ fn test_cp_reflink_auto() { #[cfg(target_os = "linux")] fn test_cp_reflink_never() { let (at, mut ucmd) = at_and_ucmd!(); - let result = ucmd - .arg("--reflink=never") + ucmd.arg("--reflink=never") .arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_EXISTING_FILE) - .run(); - - assert!(result.success); + .succeeds(); // Check the content of the destination file assert_eq!(at.read(TEST_EXISTING_FILE), "Hello, World!\n"); @@ -1131,8 +1125,6 @@ fn test_cp_reflink_bad() { .arg("--reflink=bad") .arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_EXISTING_FILE) - .run(); - - assert!(!result.success); - assert!(result.stderr.contains("invalid argument")); + .fails() + .stderr_contains("invalid argument"); } From eccb86c9edc1b36d6733de66c4e37d305090d26d Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 23 Apr 2021 08:26:20 +0200 Subject: [PATCH 0418/1135] ls: fix -a test --- src/uu/ls/src/ls.rs | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index f820ffffe..19097edda 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -492,7 +492,7 @@ impl Config { } } - if files != Files::Normal { + if files == Files::Normal { ignore_patterns.add(Glob::new(".*").unwrap()); } @@ -1185,25 +1185,21 @@ fn sort_entries(entries: &mut Vec, config: &Config) { fn is_hidden(file_path: &DirEntry) -> bool { let metadata = fs::metadata(file_path.path()).unwrap(); let attr = metadata.file_attributes(); - ((attr & 0x2) > 0) || file_path.file_name().to_string_lossy().starts_with('.') -} - -#[cfg(unix)] -fn is_hidden(file_path: &DirEntry) -> bool { - file_path.file_name().to_string_lossy().starts_with('.') + ((attr & 0x2) > 0) } fn should_display(entry: &DirEntry, config: &Config) -> bool { let ffi_name = entry.file_name(); - if config.files == Files::Normal && is_hidden(entry) { - return false; + // For unix, the hidden files are already included in the ignore pattern + #[cfg(windows)] + { + if config.files == Files::Normal && is_hidden(entry) { + return false; + } } - if config.ignore_patterns.is_match(&ffi_name) { - return false; - } - true + !config.ignore_patterns.is_match(&ffi_name) } fn enter_directory(dir: &PathData, config: &Config) { From b68ecf1269d9dcf11e5ed526d042bdb18a9722b1 Mon Sep 17 00:00:00 2001 From: James Robson Date: Fri, 23 Apr 2021 16:36:46 +0100 Subject: [PATCH 0419/1135] Allow space in truncate --size --- src/uu/truncate/src/truncate.rs | 15 ++++++++------- tests/by-util/test_truncate.rs | 11 +++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 9cd5865b7..2c232a3d1 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -192,7 +192,8 @@ fn truncate( } fn parse_size(size: &str) -> (u64, TruncateMode) { - let mode = match size.chars().next().unwrap() { + let clean_size = size.replace(" ", ""); + let mode = match clean_size.chars().next().unwrap() { '+' => TruncateMode::Extend, '-' => TruncateMode::Reduce, '<' => TruncateMode::AtMost, @@ -203,9 +204,9 @@ fn parse_size(size: &str) -> (u64, TruncateMode) { }; let bytes = { let mut slice = if mode == TruncateMode::Reference { - size + &clean_size } else { - &size[1..] + &clean_size[1..] }; if slice.chars().last().unwrap().is_alphabetic() { slice = &slice[..slice.len() - 1]; @@ -220,11 +221,11 @@ fn parse_size(size: &str) -> (u64, TruncateMode) { Ok(num) => num, Err(e) => crash!(1, "'{}' is not a valid number: {}", size, e), }; - if size.chars().last().unwrap().is_alphabetic() { - number *= match size.chars().last().unwrap().to_ascii_uppercase() { - 'B' => match size + if clean_size.chars().last().unwrap().is_alphabetic() { + number *= match clean_size.chars().last().unwrap().to_ascii_uppercase() { + 'B' => match clean_size .chars() - .nth(size.len() - 2) + .nth(clean_size.len() - 2) .unwrap() .to_ascii_uppercase() { diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index ce7964d57..2a1f4429b 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -53,6 +53,16 @@ fn test_decrease_file_size() { assert!(file.seek(SeekFrom::Current(0)).unwrap() == 6); } +#[test] +fn test_space_in_size() { + let (at, mut ucmd) = at_and_ucmd!(); + let mut file = at.make_file(TFILE2); + file.write_all(b"1234567890").unwrap(); + ucmd.args(&["--size", " 4", TFILE2]).succeeds(); + file.seek(SeekFrom::End(0)).unwrap(); + assert!(file.seek(SeekFrom::Current(0)).unwrap() == 4); +} + #[test] fn test_failed() { new_ucmd!().fails(); @@ -69,3 +79,4 @@ fn test_failed_incorrect_arg() { let (_at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["-s", "+5A", TFILE1]).fails(); } + From e6f6b109a59d0db800f682396d6a1f04599e80cd Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 21 Apr 2021 19:03:36 +0200 Subject: [PATCH 0420/1135] sort: implement --debug This adds a --debug flag, which, when activated, will draw lines below the characters that are actually used for comparisons. This is not a complete implementation of --debug. It should, quoting the man page for GNU sort: "annotate the part of the line used to sort, and warn about questionable usage to stderr". Warning about "questionable usage" is not part of this patch. This change required some adjustments to be able to get the range that is actually used for comparisons. Most notably, general numeric comparisons were rewritten, fixing some bugs along the lines. Testing is mostly done by adding fixtures for the expected debug output of existing tests. --- Cargo.lock | 1 + src/uu/sort/Cargo.toml | 1 + src/uu/sort/src/numeric_str_cmp.rs | 10 +- src/uu/sort/src/sort.rs | 467 +++++++++++------- tests/by-util/test_sort.rs | 80 +-- .../sort/default_unsorted_ints.expected.debug | 200 ++++++++ .../sort/dictionary_order.expected.debug | 9 + .../exponents-positive-numeric.expected.debug | 36 ++ .../fixtures/sort/exponents_general.expected | 19 + .../sort/exponents_general.expected.debug | 57 +++ tests/fixtures/sort/exponents_general.txt | 19 + .../human-numeric-whitespace.expected.debug | 33 ++ .../sort/human_block_sizes.expected.debug | 33 ++ .../fixtures/sort/ignore_case.expected.debug | 21 + .../fixtures/sort/keys_closed_range.expected | 6 + .../sort/keys_closed_range.expected.debug | 18 + tests/fixtures/sort/keys_closed_range.txt | 6 + .../sort/keys_custom_separator.expected | 3 + .../sort/keys_custom_separator.expected.debug | 9 + tests/fixtures/sort/keys_custom_separator.txt | 3 + .../sort/keys_multiple_ranges.expected | 6 + .../sort/keys_multiple_ranges.expected.debug | 24 + tests/fixtures/sort/keys_multiple_ranges.txt | 6 + .../fixtures/sort/keys_no_char_match.expected | 3 + .../sort/keys_no_char_match.expected.debug | 9 + tests/fixtures/sort/keys_no_char_match.txt | 3 + .../sort/keys_no_field_match.expected | 6 + .../sort/keys_no_field_match.expected.debug | 18 + tests/fixtures/sort/keys_no_field_match.txt | 6 + tests/fixtures/sort/keys_open_ended.expected | 6 + .../sort/keys_open_ended.expected.debug | 18 + tests/fixtures/sort/keys_open_ended.txt | 6 + ...d_floats_ints_chars_numeric.expected.debug | 90 ++++ ...s_ints_chars_numeric_stable.expected.debug | 60 +++ ...s_ints_chars_numeric_unique.expected.debug | 40 ++ ...hars_numeric_unique_reverse.expected.debug | 40 ++ .../sort/month_default.expected.debug | 30 ++ .../fixtures/sort/month_stable.expected.debug | 20 + .../fixtures/sort/months-dedup.expected.debug | 12 + .../sort/months-whitespace.expected.debug | 24 + .../sort/multiple_decimals_general.expected | 37 ++ .../multiple_decimals_general.expected.debug | 111 +++++ .../sort/multiple_decimals_general.txt | 4 +- .../multiple_decimals_numeric.expected.debug | 105 ++++ .../numeric-floats-with-nan2.expected.debug | 69 +++ .../sort/numeric_fixed_floats.expected.debug | 6 + .../sort/numeric_floats.expected.debug | 6 + .../numeric_floats_and_ints.expected.debug | 6 + .../numeric_floats_with_nan.expected.debug | 9 + .../numeric_unfixed_floats.expected.debug | 6 + .../sort/numeric_unique.expected.debug | 4 + .../sort/numeric_unsorted_ints.expected.debug | 300 +++++++++++ ...umeric_unsorted_ints_unique.expected.debug | 8 + tests/fixtures/sort/version.expected.debug | 12 + .../fixtures/sort/words_unique.expected.debug | 6 + .../sort/zero-terminated.expected.debug | 84 ++++ 56 files changed, 2010 insertions(+), 221 deletions(-) create mode 100644 tests/fixtures/sort/default_unsorted_ints.expected.debug create mode 100644 tests/fixtures/sort/dictionary_order.expected.debug create mode 100644 tests/fixtures/sort/exponents-positive-numeric.expected.debug create mode 100644 tests/fixtures/sort/exponents_general.expected create mode 100644 tests/fixtures/sort/exponents_general.expected.debug create mode 100644 tests/fixtures/sort/exponents_general.txt create mode 100644 tests/fixtures/sort/human-numeric-whitespace.expected.debug create mode 100644 tests/fixtures/sort/human_block_sizes.expected.debug create mode 100644 tests/fixtures/sort/ignore_case.expected.debug create mode 100644 tests/fixtures/sort/keys_closed_range.expected create mode 100644 tests/fixtures/sort/keys_closed_range.expected.debug create mode 100644 tests/fixtures/sort/keys_closed_range.txt create mode 100644 tests/fixtures/sort/keys_custom_separator.expected create mode 100644 tests/fixtures/sort/keys_custom_separator.expected.debug create mode 100644 tests/fixtures/sort/keys_custom_separator.txt create mode 100644 tests/fixtures/sort/keys_multiple_ranges.expected create mode 100644 tests/fixtures/sort/keys_multiple_ranges.expected.debug create mode 100644 tests/fixtures/sort/keys_multiple_ranges.txt create mode 100644 tests/fixtures/sort/keys_no_char_match.expected create mode 100644 tests/fixtures/sort/keys_no_char_match.expected.debug create mode 100644 tests/fixtures/sort/keys_no_char_match.txt create mode 100644 tests/fixtures/sort/keys_no_field_match.expected create mode 100644 tests/fixtures/sort/keys_no_field_match.expected.debug create mode 100644 tests/fixtures/sort/keys_no_field_match.txt create mode 100644 tests/fixtures/sort/keys_open_ended.expected create mode 100644 tests/fixtures/sort/keys_open_ended.expected.debug create mode 100644 tests/fixtures/sort/keys_open_ended.txt create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric.expected.debug create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.expected.debug create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.expected.debug create mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.expected.debug create mode 100644 tests/fixtures/sort/month_default.expected.debug create mode 100644 tests/fixtures/sort/month_stable.expected.debug create mode 100644 tests/fixtures/sort/months-dedup.expected.debug create mode 100644 tests/fixtures/sort/months-whitespace.expected.debug create mode 100644 tests/fixtures/sort/multiple_decimals_general.expected create mode 100644 tests/fixtures/sort/multiple_decimals_general.expected.debug create mode 100644 tests/fixtures/sort/multiple_decimals_numeric.expected.debug create mode 100644 tests/fixtures/sort/numeric-floats-with-nan2.expected.debug create mode 100644 tests/fixtures/sort/numeric_fixed_floats.expected.debug create mode 100644 tests/fixtures/sort/numeric_floats.expected.debug create mode 100644 tests/fixtures/sort/numeric_floats_and_ints.expected.debug create mode 100644 tests/fixtures/sort/numeric_floats_with_nan.expected.debug create mode 100644 tests/fixtures/sort/numeric_unfixed_floats.expected.debug create mode 100644 tests/fixtures/sort/numeric_unique.expected.debug create mode 100644 tests/fixtures/sort/numeric_unsorted_ints.expected.debug create mode 100644 tests/fixtures/sort/numeric_unsorted_ints_unique.expected.debug create mode 100644 tests/fixtures/sort/version.expected.debug create mode 100644 tests/fixtures/sort/words_unique.expected.debug create mode 100644 tests/fixtures/sort/zero-terminated.expected.debug diff --git a/Cargo.lock b/Cargo.lock index 461716b1b..4f8cef859 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2297,6 +2297,7 @@ dependencies = [ "rayon", "semver", "smallvec 1.6.1", + "unicode-width", "uucore", "uucore_procs", ] diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 6a9976278..464207a2c 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -22,6 +22,7 @@ fnv = "1.0.7" itertools = "0.10.0" semver = "0.9.0" smallvec = "1.6.1" +unicode-width = "0.1.8" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/sort/src/numeric_str_cmp.rs b/src/uu/sort/src/numeric_str_cmp.rs index a50734ebd..314b4c595 100644 --- a/src/uu/sort/src/numeric_str_cmp.rs +++ b/src/uu/sort/src/numeric_str_cmp.rs @@ -137,7 +137,15 @@ impl NumInfo { sign: if had_digit { sign } else { Sign::Positive }, exponent: 0, }, - 0..0, + if had_digit { + // In this case there were only zeroes. + // For debug output to work properly, we have to claim to match the end of the number. + num.len()..num.len() + } else { + // This was no number at all. + // For debug output to work properly, we have to claim to match the start of the number. + 0..0 + }, ) } } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 07b852921..d9a639b3c 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -26,7 +26,6 @@ use rand::{thread_rng, Rng}; use rayon::prelude::*; use semver::Version; use smallvec::SmallVec; -use std::borrow::Cow; use std::cmp::Ordering; use std::collections::BinaryHeap; use std::env; @@ -34,8 +33,9 @@ use std::fs::File; use std::hash::{Hash, Hasher}; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Lines, Read, Write}; use std::mem::replace; -use std::ops::{Range, RangeInclusive}; +use std::ops::Range; use std::path::Path; +use unicode_width::UnicodeWidthStr; use uucore::fs::is_stdin_interactive; // for Iterator::dedup() static NAME: &str = "sort"; @@ -62,6 +62,7 @@ static OPT_DICTIONARY_ORDER: &str = "dictionary-order"; static OPT_MERGE: &str = "merge"; static OPT_CHECK: &str = "check"; static OPT_CHECK_SILENT: &str = "check-silent"; +static OPT_DEBUG: &str = "debug"; static OPT_IGNORE_CASE: &str = "ignore-case"; static OPT_IGNORE_BLANKS: &str = "ignore-blanks"; static OPT_IGNORE_NONPRINTING: &str = "ignore-nonprinting"; @@ -96,6 +97,7 @@ enum SortMode { struct GlobalSettings { mode: SortMode, + debug: bool, ignore_blanks: bool, ignore_case: bool, dictionary_order: bool, @@ -119,6 +121,7 @@ impl Default for GlobalSettings { fn default() -> GlobalSettings { GlobalSettings { mode: SortMode::Default, + debug: true, ignore_blanks: false, ignore_case: false, dictionary_order: false, @@ -196,13 +199,13 @@ impl SelectionRange { } enum NumCache { - AsF64(f64), + AsF64(GeneralF64ParseResult), WithInfo(NumInfo), None, } impl NumCache { - fn as_f64(&self) -> f64 { + fn as_f64(&self) -> GeneralF64ParseResult { match self { NumCache::AsF64(n) => *n, _ => unreachable!(), @@ -253,19 +256,14 @@ impl Line { .selectors .iter() .map(|selector| { - let mut range = - if let Some(range) = selector.get_selection(&line, fields.as_deref()) { - if let Some(transformed) = - transform(&line[range.to_owned()], &selector.settings) - { - SelectionRange::String(transformed) - } else { - SelectionRange::ByIndex(range.start().to_owned()..range.end() + 1) - } - } else { - // If there is no match, match the empty string. - SelectionRange::ByIndex(0..0) - }; + let range = selector.get_selection(&line, fields.as_deref()); + let mut range = if let Some(transformed) = + transform(&line[range.to_owned()], &selector.settings) + { + SelectionRange::String(transformed) + } else { + SelectionRange::ByIndex(range) + }; let num_cache = if selector.settings.mode == SortMode::Numeric || selector.settings.mode == SortMode::HumanNumeric { @@ -280,7 +278,8 @@ impl Line { range.shorten(num_range); NumCache::WithInfo(info) } else if selector.settings.mode == SortMode::GeneralNumeric { - NumCache::AsF64(permissive_f64_parse(get_leading_gen(range.get_str(&line)))) + let str = range.get_str(&line); + NumCache::AsF64(general_f64_parse(&str[get_leading_gen(str)])) } else { NumCache::None }; @@ -289,6 +288,129 @@ impl Line { .collect(); Self { line, selections } } + + /// Writes indicators for the selections this line matched. The original line content is NOT expected + /// to be already printed. + fn print_debug( + &self, + settings: &GlobalSettings, + writer: &mut dyn Write, + ) -> std::io::Result<()> { + // We do not consider this function performance critical, as debug output is only useful for small files, + // which are not a performance problem in any case. Therefore there aren't any special performance + // optimizations here. + + let line = self.line.replace('\t', ">"); + writeln!(writer, "{}", line)?; + + let fields = tokenize(&self.line, settings.separator); + for selector in settings.selectors.iter() { + let mut selection = selector.get_selection(&self.line, Some(&fields)); + match selector.settings.mode { + SortMode::Numeric | SortMode::HumanNumeric => { + // find out which range is used for numeric comparisons + let (_, num_range) = NumInfo::parse( + &self.line[selection.clone()], + NumInfoParseSettings { + accept_si_units: selector.settings.mode == SortMode::HumanNumeric, + thousands_separator: Some(THOUSANDS_SEP), + decimal_pt: Some(DECIMAL_PT), + }, + ); + let initial_selection = selection.clone(); + + // Shorten selection to num_range. + selection.start += num_range.start; + selection.end = selection.start + num_range.len(); + + // include a trailing si unit + if selector.settings.mode == SortMode::HumanNumeric + && self.line[selection.end..initial_selection.end] + .starts_with(&['k', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'][..]) + { + selection.end += 1; + } + + // include leading zeroes, a leading minus or a leading decimal point + while self.line[initial_selection.start..selection.start] + .ends_with(&['-', '0', '.'][..]) + { + selection.start -= 1; + } + } + SortMode::GeneralNumeric => { + let initial_selection = &self.line[selection.clone()]; + + let leading = get_leading_gen(initial_selection); + + // Shorten selection to leading. + selection.start += leading.start; + selection.end = selection.start + leading.len(); + } + SortMode::Month => { + let initial_selection = &self.line[selection.clone()]; + + let month = if month_parse(initial_selection) == Month::Unknown { + // We failed to parse a month, which is equivalent to matching nothing. + 0..0 + } else { + // We parsed a month. Match the three first non-whitespace characters, which must be the month we parsed. + let mut chars = initial_selection + .char_indices() + .skip_while(|(_, c)| c.is_whitespace()); + chars.next().unwrap().0 + ..chars.nth(2).map_or(initial_selection.len(), |(idx, _)| idx) + }; + + // Shorten selection to month. + selection.start += month.start; + selection.end = selection.start + month.len(); + } + _ => {} + } + + write!( + writer, + "{}", + " ".repeat(UnicodeWidthStr::width(&line[..selection.start])) + )?; + + // TODO: Once our minimum supported rust version is at least 1.47, use selection.is_empty() instead. + #[allow(clippy::len_zero)] + { + if selection.len() == 0 { + writeln!(writer, "^ no match for key")?; + } else { + writeln!( + writer, + "{}", + "_".repeat(UnicodeWidthStr::width(&line[selection])) + )?; + } + } + } + if !(settings.random + || settings.stable + || settings.unique + || !(settings.dictionary_order + || settings.ignore_blanks + || settings.ignore_case + || settings.ignore_non_printing + || settings.mode != SortMode::Default)) + { + // A last resort comparator is in use, underline the whole line. + if self.line.is_empty() { + writeln!(writer, "^ no match for key")?; + } else { + writeln!( + writer, + "{}", + "_".repeat(UnicodeWidthStr::width(line.as_str())) + )?; + } + } + Ok(()) + } } /// Transform this line. Returns None if there's no need to transform. @@ -449,13 +571,16 @@ impl FieldSelector { /// Look up the slice that corresponds to this selector for the given line. /// If needs_fields returned false, fields may be None. - fn get_selection<'a>( - &self, - line: &'a str, - tokens: Option<&[Field]>, - ) -> Option> { - enum ResolutionErr { + fn get_selection<'a>(&self, line: &'a str, tokens: Option<&[Field]>) -> Range { + enum Resolution { + // The start index of the resolved character, inclusive + StartOfChar(usize), + // The end index of the resolved character, exclusive. + // This is only returned if the character index is 0. + EndOfChar(usize), + // The resolved character would be in front of the first character TooLow, + // The resolved character would be after the last character TooHigh, } @@ -464,15 +589,15 @@ impl FieldSelector { line: &str, tokens: Option<&[Field]>, position: &KeyPosition, - ) -> Result { + ) -> Resolution { if tokens.map_or(false, |fields| fields.len() < position.field) { - Err(ResolutionErr::TooHigh) + Resolution::TooHigh } else if position.char == 0 { let end = tokens.unwrap()[position.field - 1].end; if end == 0 { - Err(ResolutionErr::TooLow) + Resolution::TooLow } else { - Ok(end - 1) + Resolution::EndOfChar(end) } } else { let mut idx = if position.field == 1 { @@ -481,38 +606,52 @@ impl FieldSelector { 0 } else { tokens.unwrap()[position.field - 1].start - } + position.char - - 1; + }; + idx += line[idx..] + .char_indices() + .nth(position.char - 1) + .map_or(line.len(), |(idx, _)| idx); if idx >= line.len() { - Err(ResolutionErr::TooHigh) + Resolution::TooHigh } else { if position.ignore_blanks { - if let Some(not_whitespace) = - line[idx..].chars().position(|c| !c.is_whitespace()) + if let Some((not_whitespace, _)) = + line[idx..].char_indices().find(|(_, c)| !c.is_whitespace()) { idx += not_whitespace; } else { - return Err(ResolutionErr::TooHigh); + return Resolution::TooHigh; } } - Ok(idx) + Resolution::StartOfChar(idx) } } } - if let Ok(from) = resolve_index(line, tokens, &self.from) { - let to = self.to.as_ref().map(|to| resolve_index(line, tokens, &to)); - match to { - Some(Ok(to)) => Some(from..=to), - // If `to` was not given or the match would be after the end of the line, - // match everything until the end of the line. - None | Some(Err(ResolutionErr::TooHigh)) => Some(from..=line.len() - 1), - // If `to` is before the start of the line, report no match. - // This can happen if the line starts with a separator. - Some(Err(ResolutionErr::TooLow)) => None, + match resolve_index(line, tokens, &self.from) { + Resolution::StartOfChar(from) => { + let to = self.to.as_ref().map(|to| resolve_index(line, tokens, &to)); + + match to { + Some(Resolution::StartOfChar(mut to)) => { + to += line[to..].chars().next().map_or(1, |c| c.len_utf8()); + from..to + } + Some(Resolution::EndOfChar(to)) => from..to, + // If `to` was not given or the match would be after the end of the line, + // match everything until the end of the line. + None | Some(Resolution::TooHigh) => from..line.len(), + // If `to` is before the start of the line, report no match. + // This can happen if the line starts with a separator. + Some(Resolution::TooLow) => 0..0, + } } - } else { - None + Resolution::TooLow | Resolution::EndOfChar(_) => { + unreachable!("This should only happen if the field start index is 0, but that should already have caused an error.") + } + // While for comparisons it's only important that this is an empty slice, + // to produce accurate debug output we need to match an empty slice at the end of the line. + Resolution::TooHigh => line.len()..line.len(), } } } @@ -540,7 +679,7 @@ impl<'a> PartialOrd for MergeableFile<'a> { impl<'a> PartialEq for MergeableFile<'a> { fn eq(&self, other: &MergeableFile) -> bool { - Ordering::Equal == compare_by(&self.current_line, &other.current_line, self.settings) + Ordering::Equal == self.cmp(other) } } @@ -571,8 +710,8 @@ impl<'a> FileMerger<'a> { } impl<'a> Iterator for FileMerger<'a> { - type Item = String; - fn next(&mut self) -> Option { + type Item = Line; + fn next(&mut self) -> Option { match self.heap.pop() { Some(mut current) => { match current.lines.next() { @@ -582,12 +721,12 @@ impl<'a> Iterator for FileMerger<'a> { Line::new(next_line, &self.settings), ); self.heap.push(current); - Some(ret.line) + Some(ret) } _ => { // Don't put it back in the heap (it's empty/erroring) // but its first line is still valid. - Some(current.current_line.line) + Some(current.current_line) } } } @@ -756,9 +895,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .value_name("NUL_FILES") .multiple(true), ) + .arg( + Arg::with_name(OPT_DEBUG) + .long(OPT_DEBUG) + .help("underline the parts of the line that are actually used for sorting"), + ) .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) .get_matches_from(args); + settings.debug = matches.is_present(OPT_DEBUG); + // check whether user specified a zero terminated list of files for input, otherwise read files from args let mut files: Vec = if matches.is_present(OPT_FILES0_FROM) { let files0_from: Vec = matches @@ -862,6 +1008,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 1, &mut key_settings, ); + if from.char == 0 { + crash!( + 1, + "invalid character index 0 in `{}` for the start position of a field", + key + ) + } let to = from_to .next() .map(|to| KeyPosition::parse(to, 0, &mut key_settings)); @@ -933,7 +1086,10 @@ fn exec(files: Vec, settings: &GlobalSettings) -> i32 { if settings.merge { if settings.unique { - print_sorted(file_merger.dedup(), &settings) + print_sorted( + file_merger.dedup_by(|a, b| compare_by(a, b, settings) == Ordering::Equal), + &settings, + ) } else { print_sorted(file_merger, &settings) } @@ -941,12 +1097,11 @@ fn exec(files: Vec, settings: &GlobalSettings) -> i32 { print_sorted( lines .into_iter() - .dedup_by(|a, b| compare_by(a, b, settings) == Ordering::Equal) - .map(|line| line.line), + .dedup_by(|a, b| compare_by(a, b, settings) == Ordering::Equal), &settings, ) } else { - print_sorted(lines.into_iter().map(|line| line.line), &settings) + print_sorted(lines.into_iter(), &settings) } 0 @@ -1043,107 +1198,80 @@ fn default_compare(a: &str, b: &str) -> Ordering { a.cmp(b) } -// This function does the initial detection of numeric lines. -// Lines starting with a number or positive or negative sign. -// It also strips the string of any thing that could never -// be a number for the purposes of any type of numeric comparison. -#[inline(always)] -fn leading_num_common(a: &str) -> &str { - let mut s = ""; - - // check whether char is numeric, whitespace or decimal point or thousand separator - for (idx, c) in a.char_indices() { - if !c.is_numeric() - && !c.is_whitespace() - && !c.eq(&THOUSANDS_SEP) - && !c.eq(&DECIMAL_PT) - // check for e notation - && !c.eq(&'e') - && !c.eq(&'E') - // check whether first char is + or - - && !a.chars().next().unwrap_or('\0').eq(&POSITIVE) - && !a.chars().next().unwrap_or('\0').eq(&NEGATIVE) - { - // Strip string of non-numeric trailing chars - s = &a[..idx]; - break; - } - // If line is not a number line, return the line as is - s = &a; - } - s -} - // This function cleans up the initial comparison done by leading_num_common for a general numeric compare. // In contrast to numeric compare, GNU general numeric/FP sort *should* recognize positive signs and // scientific notation, so we strip those lines only after the end of the following numeric string. // For example, 5e10KFD would be 5e10 or 5x10^10 and +10000HFKJFK would become 10000. -fn get_leading_gen(a: &str) -> &str { - // Make this iter peekable to see if next char is numeric - let raw_leading_num = leading_num_common(a); - let mut p_iter = raw_leading_num.chars().peekable(); - let mut result = ""; - // Cleanup raw stripped strings - for c in p_iter.to_owned() { - let next_char_numeric = p_iter.peek().unwrap_or(&'\0').is_numeric(); - // Only general numeric recognizes e notation and, see block below, the '+' sign - // Only GNU (non-general) numeric recognize thousands seperators, takes only leading # - if (c.eq(&'e') || c.eq(&'E')) && !next_char_numeric || c.eq(&THOUSANDS_SEP) { - result = a.split(c).next().unwrap_or(""); - break; - // If positive sign and next char is not numeric, split at postive sign at keep trailing numbers - // There is a more elegant way to do this in Rust 1.45, std::str::strip_prefix - } else if c.eq(&POSITIVE) && !next_char_numeric { - result = a.trim().trim_start_matches('+'); - break; +fn get_leading_gen(input: &str) -> Range { + let trimmed = input.trim_start(); + let leading_whitespace_len = input.len() - trimmed.len(); + for allowed_prefix in &["inf", "-inf", "nan"] { + if trimmed.is_char_boundary(allowed_prefix.len()) + && trimmed[..allowed_prefix.len()].eq_ignore_ascii_case(allowed_prefix) + { + return leading_whitespace_len..(leading_whitespace_len + allowed_prefix.len()); } - // If no further processing needed to be done, return the line as-is to be sorted - result = a; } - result + // Make this iter peekable to see if next char is numeric + let mut char_indices = trimmed.char_indices().peekable(); + + let first = char_indices.peek(); + + if first.map_or(false, |&(_, c)| c == NEGATIVE || c == POSITIVE) { + char_indices.next(); + } + + let mut had_e_notation = false; + let mut had_decimal_pt = false; + while let Some((idx, c)) = char_indices.next() { + if c.is_ascii_digit() { + continue; + } + if c == DECIMAL_PT && !had_decimal_pt { + had_decimal_pt = true; + continue; + } + let next_char_numeric = char_indices + .peek() + .map_or(false, |(_, c)| c.is_ascii_digit()); + if (c == 'e' || c == 'E') && !had_e_notation && next_char_numeric { + had_e_notation = true; + continue; + } + return leading_whitespace_len..(leading_whitespace_len + idx); + } + leading_whitespace_len..input.len() } -#[inline(always)] -fn remove_trailing_dec<'a, S: Into>>(input: S) -> Cow<'a, str> { - let input = input.into(); - if let Some(s) = input.find(DECIMAL_PT) { - let (leading, trailing) = input.split_at(s); - let output = [leading, ".", trailing.replace(DECIMAL_PT, "").as_str()].concat(); - Cow::Owned(output) - } else { - input - } +#[derive(Copy, Clone, PartialEq, PartialOrd)] +enum GeneralF64ParseResult { + Invalid, + NaN, + NegInfinity, + Number(f64), + Infinity, } /// Parse the beginning string into an f64, returning -inf instead of NaN on errors. #[inline(always)] -fn permissive_f64_parse(a: &str) -> f64 { - // GNU sort treats "NaN" as non-number in numeric, so it needs special care. - // *Keep this trim before parse* despite what POSIX may say about -b and -n - // because GNU and BSD both seem to require it to match their behavior - // - // Remove any trailing decimals, ie 4568..890... becomes 4568.890 - // Then, we trim whitespace and parse - match remove_trailing_dec(a).trim().parse::() { - Ok(a) if a.is_nan() => std::f64::NEG_INFINITY, - Ok(a) => a, - Err(_) => std::f64::NEG_INFINITY, +fn general_f64_parse(a: &str) -> GeneralF64ParseResult { + // The actual behavior here relies on Rust's implementation of parsing floating points. + // For example "nan", "inf" (ignoring the case) and "infinity" are only parsed to floats starting from 1.53. + // TODO: Once our minimum supported Rust version is 1.53 or above, we should add tests for those cases. + match a.parse::() { + Ok(a) if a.is_nan() => GeneralF64ParseResult::NaN, + Ok(a) if a == std::f64::NEG_INFINITY => GeneralF64ParseResult::NegInfinity, + Ok(a) if a == std::f64::INFINITY => GeneralF64ParseResult::Infinity, + Ok(a) => GeneralF64ParseResult::Number(a), + Err(_) => GeneralF64ParseResult::Invalid, } } /// Compares two floats, with errors and non-numerics assumed to be -inf. /// Stops coercing at the first non-numeric char. /// We explicitly need to convert to f64 in this case. -fn general_numeric_compare(a: f64, b: f64) -> Ordering { - #![allow(clippy::comparison_chain)] - // f64::cmp isn't implemented (due to NaN issues); implement directly instead - if a > b { - Ordering::Greater - } else if a < b { - Ordering::Less - } else { - Ordering::Equal - } +fn general_numeric_compare(a: GeneralF64ParseResult, b: GeneralF64ParseResult) -> Ordering { + a.partial_cmp(&b).unwrap() } fn get_rand_string() -> String { @@ -1170,7 +1298,7 @@ fn random_shuffle(a: &str, b: &str, x: String) -> Ordering { da.cmp(&db) } -#[derive(Eq, Ord, PartialEq, PartialOrd)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy)] enum Month { Unknown, January, @@ -1189,29 +1317,32 @@ enum Month { /// Parse the beginning string into a Month, returning Month::Unknown on errors. fn month_parse(line: &str) -> Month { - // GNU splits at any 3 letter match "JUNNNN" is JUN - let pattern = if line.trim().len().ge(&3) { - // Split a 3 and get first element of tuple ".0" - line.trim().split_at(3).0 - } else { - "" - }; + let line = line.trim(); - match pattern.to_uppercase().as_ref() { - "JAN" => Month::January, - "FEB" => Month::February, - "MAR" => Month::March, - "APR" => Month::April, - "MAY" => Month::May, - "JUN" => Month::June, - "JUL" => Month::July, - "AUG" => Month::August, - "SEP" => Month::September, - "OCT" => Month::October, - "NOV" => Month::November, - "DEC" => Month::December, - _ => Month::Unknown, + const MONTHS: [(&str, Month); 12] = [ + ("JAN", Month::January), + ("FEB", Month::February), + ("MAR", Month::March), + ("APR", Month::April), + ("MAY", Month::May), + ("JUN", Month::June), + ("JUL", Month::July), + ("AUG", Month::August), + ("SEP", Month::September), + ("OCT", Month::October), + ("NOV", Month::November), + ("DEC", Month::December), + ]; + + for (month_str, month) in &MONTHS { + if line.is_char_boundary(month_str.len()) + && line[..month_str.len()].eq_ignore_ascii_case(month_str) + { + return *month; + } } + + Month::Unknown } fn month_compare(a: &str, b: &str) -> Ordering { @@ -1269,7 +1400,7 @@ fn remove_nonprinting_chars(s: &str) -> String { .collect::() } -fn print_sorted>(iter: T, settings: &GlobalSettings) { +fn print_sorted>(iter: T, settings: &GlobalSettings) { let mut file: Box = match settings.outfile { Some(ref filename) => match File::create(Path::new(&filename)) { Ok(f) => Box::new(BufWriter::new(f)) as Box, @@ -1280,15 +1411,19 @@ fn print_sorted>(iter: T, settings: &GlobalSettings) }, None => Box::new(BufWriter::new(stdout())) as Box, }; - if settings.zero_terminated { + if settings.zero_terminated && !settings.debug { for line in iter { - crash_if_err!(1, file.write_all(line.as_bytes())); + crash_if_err!(1, file.write_all(line.line.as_bytes())); crash_if_err!(1, file.write_all("\0".as_bytes())); } } else { for line in iter { - crash_if_err!(1, file.write_all(line.as_bytes())); - crash_if_err!(1, file.write_all("\n".as_bytes())); + if !settings.debug { + crash_if_err!(1, file.write_all(line.line.as_bytes())); + crash_if_err!(1, file.write_all("\n".as_bytes())); + } else { + crash_if_err!(1, line.print_debug(settings, &mut file)); + } } } crash_if_err!(1, file.flush()); diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index a4a9a383c..c68fa3dcf 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -2,10 +2,17 @@ use crate::common::util::*; fn test_helper(file_name: &str, args: &str) { new_ucmd!() - .arg(args) .arg(format!("{}.txt", file_name)) + .args(&args.split(' ').collect::>()) .succeeds() .stdout_is_fixture(format!("{}.expected", file_name)); + + new_ucmd!() + .arg(format!("{}.txt", file_name)) + .arg("--debug") + .args(&args.split(' ').collect::>()) + .succeeds() + .stdout_is_fixture(format!("{}.expected.debug", file_name)); } #[test] @@ -29,11 +36,7 @@ fn test_human_numeric_whitespace() { #[test] fn test_multiple_decimals_general() { - new_ucmd!() - .arg("-g") - .arg("multiple_decimals_general.txt") - .succeeds() - .stdout_is("\n\n\n\n\n\n\n\nCARAvan\n-2028789030\n-896689\n-8.90880\n-1\n-.05\n000\n00000001\n1\n1.040000000\n1.444\n1.58590\n8.013\n45\n46.89\n576,446.88800000\n576,446.890\n 4567.\n4567.1\n4567.34\n\t\t\t\t\t\t\t\t\t\t4567..457\n\t\t\t\t37800\n\t\t\t\t\t\t45670.89079.098\n\t\t\t\t\t\t45670.89079.1\n4798908.340000000000\n4798908.45\n4798908.8909800\n"); + test_helper("multiple_decimals_general", "-g") } #[test] @@ -63,7 +66,7 @@ fn test_check_zero_terminated_success() { #[test] fn test_random_shuffle_len() { // check whether output is the same length as the input - const FILE: &'static str = "default_unsorted_ints.expected"; + const FILE: &str = "default_unsorted_ints.expected"; let (at, _ucmd) = at_and_ucmd!(); let result = new_ucmd!().arg("-R").arg(FILE).run().stdout_move_str(); let expected = at.read(FILE); @@ -75,7 +78,7 @@ fn test_random_shuffle_len() { #[test] fn test_random_shuffle_contains_all_lines() { // check whether lines of input are all in output - const FILE: &'static str = "default_unsorted_ints.expected"; + const FILE: &str = "default_unsorted_ints.expected"; let (at, _ucmd) = at_and_ucmd!(); let result = new_ucmd!().arg("-R").arg(FILE).run().stdout_move_str(); let expected = at.read(FILE); @@ -90,7 +93,7 @@ fn test_random_shuffle_two_runs_not_the_same() { // check to verify that two random shuffles are not equal; this has the // potential to fail in the very unlikely event that the random order is the same // as the starting order, or if both random sorts end up having the same order. - const FILE: &'static str = "default_unsorted_ints.expected"; + const FILE: &str = "default_unsorted_ints.expected"; let (at, _ucmd) = at_and_ucmd!(); let result = new_ucmd!().arg("-R").arg(FILE).run().stdout_move_str(); let expected = at.read(FILE); @@ -105,7 +108,7 @@ fn test_random_shuffle_contains_two_runs_not_the_same() { // check to verify that two random shuffles are not equal; this has the // potential to fail in the unlikely event that random order is the same // as the starting order, or if both random sorts end up having the same order. - const FILE: &'static str = "default_unsorted_ints.expected"; + const FILE: &str = "default_unsorted_ints.expected"; let (at, _ucmd) = at_and_ucmd!(); let result = new_ucmd!().arg("-R").arg(FILE).run().stdout_move_str(); let expected = at.read(FILE); @@ -209,13 +212,7 @@ fn test_non_printing_chars() { #[test] fn test_exponents_positive_general_fixed() { - for exponents_positive_general_param in vec!["-g"] { - new_ucmd!() - .pipe_in("100E6\n\n50e10\n+100000\n\n10000K78\n10E\n\n\n1000EDKLD\n\n\n100E6\n\n50e10\n+100000\n\n") - .arg(exponents_positive_general_param) - .succeeds() - .stdout_only("\n\n\n\n\n\n\n\n10000K78\n1000EDKLD\n10E\n+100000\n+100000\n100E6\n100E6\n50e10\n50e10\n"); - } + test_helper("exponents_general", "-g"); } #[test] @@ -334,62 +331,32 @@ fn test_numeric_unique_ints2() { #[test] fn test_keys_open_ended() { - let input = "aa bb cc\ndd aa ff\ngg aa cc\n"; - new_ucmd!() - .args(&["-k", "2.2"]) - .pipe_in(input) - .succeeds() - .stdout_only("gg aa cc\ndd aa ff\naa bb cc\n"); + test_helper("keys_open_ended", "-k 2.3"); } #[test] fn test_keys_closed_range() { - let input = "aa bb cc\ndd aa ff\ngg aa cc\n"; - new_ucmd!() - .args(&["-k", "2.2,2.2"]) - .pipe_in(input) - .succeeds() - .stdout_only("dd aa ff\ngg aa cc\naa bb cc\n"); + test_helper("keys_closed_range", "-k 2.2,2.2"); } #[test] fn test_keys_multiple_ranges() { - let input = "aa bb cc\ndd aa ff\ngg aa cc\n"; - new_ucmd!() - .args(&["-k", "2,2", "-k", "3,3"]) - .pipe_in(input) - .succeeds() - .stdout_only("gg aa cc\ndd aa ff\naa bb cc\n"); + test_helper("keys_multiple_ranges", "-k 2,2 -k 3,3"); } #[test] fn test_keys_no_field_match() { - let input = "aa aa aa aa\naa bb cc\ndd aa ff\n"; - new_ucmd!() - .args(&["-k", "4,4"]) - .pipe_in(input) - .succeeds() - .stdout_only("aa bb cc\ndd aa ff\naa aa aa aa\n"); + test_helper("keys_no_field_match", "-k 4,4"); } #[test] fn test_keys_no_char_match() { - let input = "aaa\nba\nc\n"; - new_ucmd!() - .args(&["-k", "1.2"]) - .pipe_in(input) - .succeeds() - .stdout_only("c\nba\naaa\n"); + test_helper("keys_no_char_match", "-k 1.2"); } #[test] fn test_keys_custom_separator() { - let input = "aaxbbxcc\nddxaaxff\nggxaaxcc\n"; - new_ucmd!() - .args(&["-k", "2.2,2.2", "-t", "x"]) - .pipe_in(input) - .succeeds() - .stdout_only("ddxaaxff\nggxaaxcc\naaxbbxcc\n"); + test_helper("keys_custom_separator", "-k 2.2,2.2 -t x"); } #[test] @@ -416,6 +383,13 @@ fn test_keys_invalid_field_zero() { .stderr_only("sort: error: field index was 0"); } +#[test] +fn test_keys_invalid_char_zero() { + new_ucmd!().args(&["-k", "1.0"]).fails().stderr_only( + "sort: error: invalid character index 0 in `1.0` for the start position of a field", + ); +} + #[test] fn test_keys_with_options() { let input = "aa 3 cc\ndd 1 ff\ngg 2 cc\n"; diff --git a/tests/fixtures/sort/default_unsorted_ints.expected.debug b/tests/fixtures/sort/default_unsorted_ints.expected.debug new file mode 100644 index 000000000..2bf082d3b --- /dev/null +++ b/tests/fixtures/sort/default_unsorted_ints.expected.debug @@ -0,0 +1,200 @@ +1 +_ +10 +__ +100 +___ +11 +__ +12 +__ +13 +__ +14 +__ +15 +__ +16 +__ +17 +__ +18 +__ +19 +__ +2 +_ +20 +__ +21 +__ +22 +__ +23 +__ +24 +__ +25 +__ +26 +__ +27 +__ +28 +__ +29 +__ +3 +_ +30 +__ +31 +__ +32 +__ +33 +__ +34 +__ +35 +__ +36 +__ +37 +__ +38 +__ +39 +__ +4 +_ +40 +__ +41 +__ +42 +__ +43 +__ +44 +__ +45 +__ +46 +__ +47 +__ +48 +__ +49 +__ +5 +_ +50 +__ +51 +__ +52 +__ +53 +__ +54 +__ +55 +__ +56 +__ +57 +__ +58 +__ +59 +__ +6 +_ +60 +__ +61 +__ +62 +__ +63 +__ +64 +__ +65 +__ +66 +__ +67 +__ +68 +__ +69 +__ +7 +_ +70 +__ +71 +__ +72 +__ +73 +__ +74 +__ +75 +__ +76 +__ +77 +__ +78 +__ +79 +__ +8 +_ +80 +__ +81 +__ +82 +__ +83 +__ +84 +__ +85 +__ +86 +__ +87 +__ +88 +__ +89 +__ +9 +_ +90 +__ +91 +__ +92 +__ +93 +__ +94 +__ +95 +__ +96 +__ +97 +__ +98 +__ +99 +__ diff --git a/tests/fixtures/sort/dictionary_order.expected.debug b/tests/fixtures/sort/dictionary_order.expected.debug new file mode 100644 index 000000000..f4a2d17db --- /dev/null +++ b/tests/fixtures/sort/dictionary_order.expected.debug @@ -0,0 +1,9 @@ +bbb +___ +___ +./bbc +_____ +_____ +bbd +___ +___ diff --git a/tests/fixtures/sort/exponents-positive-numeric.expected.debug b/tests/fixtures/sort/exponents-positive-numeric.expected.debug new file mode 100644 index 000000000..f5a32bad1 --- /dev/null +++ b/tests/fixtures/sort/exponents-positive-numeric.expected.debug @@ -0,0 +1,36 @@ + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key ++100000 +^ no match for key +_______ +10E +__ +___ +50e10 +__ +_____ +100E6 +___ +_____ +1000EDKLD +____ +_________ +10000K78 +_____ +________ diff --git a/tests/fixtures/sort/exponents_general.expected b/tests/fixtures/sort/exponents_general.expected new file mode 100644 index 000000000..524b6e67f --- /dev/null +++ b/tests/fixtures/sort/exponents_general.expected @@ -0,0 +1,19 @@ + + + + + + + + +5.5.5.5 +10E +1000EDKLD +10000K78 ++100000 ++100000 +100E6 +100E6 +10e10e10e10 +50e10 +50e10 diff --git a/tests/fixtures/sort/exponents_general.expected.debug b/tests/fixtures/sort/exponents_general.expected.debug new file mode 100644 index 000000000..4dea45c39 --- /dev/null +++ b/tests/fixtures/sort/exponents_general.expected.debug @@ -0,0 +1,57 @@ + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key +5.5.5.5 +___ +_______ +10E +__ +___ +1000EDKLD +____ +_________ +10000K78 +_____ +________ ++100000 +_______ +_______ ++100000 +_______ +_______ +100E6 +_____ +_____ +100E6 +_____ +_____ +10e10e10e10 +_____ +___________ +50e10 +_____ +_____ +50e10 +_____ +_____ diff --git a/tests/fixtures/sort/exponents_general.txt b/tests/fixtures/sort/exponents_general.txt new file mode 100644 index 000000000..de2a6c31b --- /dev/null +++ b/tests/fixtures/sort/exponents_general.txt @@ -0,0 +1,19 @@ +100E6 + +50e10 ++100000 + +10000K78 +10E + + +1000EDKLD + + +100E6 + +50e10 ++100000 + +10e10e10e10 +5.5.5.5 diff --git a/tests/fixtures/sort/human-numeric-whitespace.expected.debug b/tests/fixtures/sort/human-numeric-whitespace.expected.debug new file mode 100644 index 000000000..66afcda66 --- /dev/null +++ b/tests/fixtures/sort/human-numeric-whitespace.expected.debug @@ -0,0 +1,33 @@ + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key +456K +____ +____ +4568K +_____ +_____ +>>>456M + ____ +_______ + 6.2G + ____ +__________________ diff --git a/tests/fixtures/sort/human_block_sizes.expected.debug b/tests/fixtures/sort/human_block_sizes.expected.debug new file mode 100644 index 000000000..5f4860a85 --- /dev/null +++ b/tests/fixtures/sort/human_block_sizes.expected.debug @@ -0,0 +1,33 @@ +844K +____ +____ +981K +____ +____ +11M +___ +___ +13M +___ +___ +14M +___ +___ +16M +___ +___ +18M +___ +___ +19M +___ +___ +20M +___ +___ +981T +____ +____ +20P +___ +___ diff --git a/tests/fixtures/sort/ignore_case.expected.debug b/tests/fixtures/sort/ignore_case.expected.debug new file mode 100644 index 000000000..08f0abb8d --- /dev/null +++ b/tests/fixtures/sort/ignore_case.expected.debug @@ -0,0 +1,21 @@ +aaa +___ +___ +BBB +___ +___ +ccc +___ +___ +DDD +___ +___ +eee +___ +___ +FFF +___ +___ +ggg +___ +___ diff --git a/tests/fixtures/sort/keys_closed_range.expected b/tests/fixtures/sort/keys_closed_range.expected new file mode 100644 index 000000000..45005621b --- /dev/null +++ b/tests/fixtures/sort/keys_closed_range.expected @@ -0,0 +1,6 @@ +dd aa ff +gg aa cc +aa bb cc +èè éé èè +👩‍🔬 👩‍🔬 👩‍🔬 +💣💣 💣💣 💣💣 diff --git a/tests/fixtures/sort/keys_closed_range.expected.debug b/tests/fixtures/sort/keys_closed_range.expected.debug new file mode 100644 index 000000000..b78db4af1 --- /dev/null +++ b/tests/fixtures/sort/keys_closed_range.expected.debug @@ -0,0 +1,18 @@ +dd aa ff + _ +________ +gg aa cc + _ +________ +aa bb cc + _ +________ +èè éé èè + _ +________ +👩‍🔬 👩‍🔬 👩‍🔬 + __ +______________ +💣💣 💣💣 💣💣 + __ +______________ diff --git a/tests/fixtures/sort/keys_closed_range.txt b/tests/fixtures/sort/keys_closed_range.txt new file mode 100644 index 000000000..d6bf40785 --- /dev/null +++ b/tests/fixtures/sort/keys_closed_range.txt @@ -0,0 +1,6 @@ +aa bb cc +dd aa ff +gg aa cc +èè éé èè +💣💣 💣💣 💣💣 +👩‍🔬 👩‍🔬 👩‍🔬 \ No newline at end of file diff --git a/tests/fixtures/sort/keys_custom_separator.expected b/tests/fixtures/sort/keys_custom_separator.expected new file mode 100644 index 000000000..2aba42033 --- /dev/null +++ b/tests/fixtures/sort/keys_custom_separator.expected @@ -0,0 +1,3 @@ +ddxaaxff +ggxaaxcc +aaxbbxcc diff --git a/tests/fixtures/sort/keys_custom_separator.expected.debug b/tests/fixtures/sort/keys_custom_separator.expected.debug new file mode 100644 index 000000000..5d4dbc776 --- /dev/null +++ b/tests/fixtures/sort/keys_custom_separator.expected.debug @@ -0,0 +1,9 @@ +ddxaaxff + _ +________ +ggxaaxcc + _ +________ +aaxbbxcc + _ +________ diff --git a/tests/fixtures/sort/keys_custom_separator.txt b/tests/fixtures/sort/keys_custom_separator.txt new file mode 100644 index 000000000..a8f473061 --- /dev/null +++ b/tests/fixtures/sort/keys_custom_separator.txt @@ -0,0 +1,3 @@ +aaxbbxcc +ddxaaxff +ggxaaxcc diff --git a/tests/fixtures/sort/keys_multiple_ranges.expected b/tests/fixtures/sort/keys_multiple_ranges.expected new file mode 100644 index 000000000..09e4e8729 --- /dev/null +++ b/tests/fixtures/sort/keys_multiple_ranges.expected @@ -0,0 +1,6 @@ +gg aa cc +dd aa ff +aa bb cc +èè éé èè +👩‍🔬 👩‍🔬 👩‍🔬 +💣💣 💣💣 💣💣 diff --git a/tests/fixtures/sort/keys_multiple_ranges.expected.debug b/tests/fixtures/sort/keys_multiple_ranges.expected.debug new file mode 100644 index 000000000..830e9afd0 --- /dev/null +++ b/tests/fixtures/sort/keys_multiple_ranges.expected.debug @@ -0,0 +1,24 @@ +gg aa cc + ___ + ___ +________ +dd aa ff + ___ + ___ +________ +aa bb cc + ___ + ___ +________ +èè éé èè + ___ + ___ +________ +👩‍🔬 👩‍🔬 👩‍🔬 + _____ + _____ +______________ +💣💣 💣💣 💣💣 + _____ + _____ +______________ diff --git a/tests/fixtures/sort/keys_multiple_ranges.txt b/tests/fixtures/sort/keys_multiple_ranges.txt new file mode 100644 index 000000000..d6bf40785 --- /dev/null +++ b/tests/fixtures/sort/keys_multiple_ranges.txt @@ -0,0 +1,6 @@ +aa bb cc +dd aa ff +gg aa cc +èè éé èè +💣💣 💣💣 💣💣 +👩‍🔬 👩‍🔬 👩‍🔬 \ No newline at end of file diff --git a/tests/fixtures/sort/keys_no_char_match.expected b/tests/fixtures/sort/keys_no_char_match.expected new file mode 100644 index 000000000..dcb361837 --- /dev/null +++ b/tests/fixtures/sort/keys_no_char_match.expected @@ -0,0 +1,3 @@ +c +ba +aaa diff --git a/tests/fixtures/sort/keys_no_char_match.expected.debug b/tests/fixtures/sort/keys_no_char_match.expected.debug new file mode 100644 index 000000000..5287a0de9 --- /dev/null +++ b/tests/fixtures/sort/keys_no_char_match.expected.debug @@ -0,0 +1,9 @@ +c + ^ no match for key +_ +ba + _ +__ +aaa + __ +___ diff --git a/tests/fixtures/sort/keys_no_char_match.txt b/tests/fixtures/sort/keys_no_char_match.txt new file mode 100644 index 000000000..1c952a6b8 --- /dev/null +++ b/tests/fixtures/sort/keys_no_char_match.txt @@ -0,0 +1,3 @@ +aaa +ba +c diff --git a/tests/fixtures/sort/keys_no_field_match.expected b/tests/fixtures/sort/keys_no_field_match.expected new file mode 100644 index 000000000..e2f183e13 --- /dev/null +++ b/tests/fixtures/sort/keys_no_field_match.expected @@ -0,0 +1,6 @@ +aa bb cc +dd aa ff +gg aa cc +èè éé èè +👩‍🔬 👩‍🔬 👩‍🔬 +💣💣 💣💣 💣💣 diff --git a/tests/fixtures/sort/keys_no_field_match.expected.debug b/tests/fixtures/sort/keys_no_field_match.expected.debug new file mode 100644 index 000000000..60197b1de --- /dev/null +++ b/tests/fixtures/sort/keys_no_field_match.expected.debug @@ -0,0 +1,18 @@ +aa bb cc + ^ no match for key +________ +dd aa ff + ^ no match for key +________ +gg aa cc + ^ no match for key +________ +èè éé èè + ^ no match for key +________ +👩‍🔬 👩‍🔬 👩‍🔬 + ^ no match for key +______________ +💣💣 💣💣 💣💣 + ^ no match for key +______________ diff --git a/tests/fixtures/sort/keys_no_field_match.txt b/tests/fixtures/sort/keys_no_field_match.txt new file mode 100644 index 000000000..d6bf40785 --- /dev/null +++ b/tests/fixtures/sort/keys_no_field_match.txt @@ -0,0 +1,6 @@ +aa bb cc +dd aa ff +gg aa cc +èè éé èè +💣💣 💣💣 💣💣 +👩‍🔬 👩‍🔬 👩‍🔬 \ No newline at end of file diff --git a/tests/fixtures/sort/keys_open_ended.expected b/tests/fixtures/sort/keys_open_ended.expected new file mode 100644 index 000000000..09e4e8729 --- /dev/null +++ b/tests/fixtures/sort/keys_open_ended.expected @@ -0,0 +1,6 @@ +gg aa cc +dd aa ff +aa bb cc +èè éé èè +👩‍🔬 👩‍🔬 👩‍🔬 +💣💣 💣💣 💣💣 diff --git a/tests/fixtures/sort/keys_open_ended.expected.debug b/tests/fixtures/sort/keys_open_ended.expected.debug new file mode 100644 index 000000000..d3a56ffd6 --- /dev/null +++ b/tests/fixtures/sort/keys_open_ended.expected.debug @@ -0,0 +1,18 @@ +gg aa cc + ____ +________ +dd aa ff + ____ +________ +aa bb cc + ____ +________ +èè éé èè + ____ +________ +👩‍🔬 👩‍🔬 👩‍🔬 + _______ +______________ +💣💣 💣💣 💣💣 + _______ +______________ diff --git a/tests/fixtures/sort/keys_open_ended.txt b/tests/fixtures/sort/keys_open_ended.txt new file mode 100644 index 000000000..d6bf40785 --- /dev/null +++ b/tests/fixtures/sort/keys_open_ended.txt @@ -0,0 +1,6 @@ +aa bb cc +dd aa ff +gg aa cc +èè éé èè +💣💣 💣💣 💣💣 +👩‍🔬 👩‍🔬 👩‍🔬 \ No newline at end of file diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric.expected.debug b/tests/fixtures/sort/mixed_floats_ints_chars_numeric.expected.debug new file mode 100644 index 000000000..dbe295a1c --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric.expected.debug @@ -0,0 +1,90 @@ +-2028789030 +___________ +___________ +-896689 +_______ +_______ +-8.90880 +________ +________ +-1 +__ +__ +-.05 +____ +____ + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key +000 +___ +___ +CARAvan +^ no match for key +_______ +00000001 +________ +________ +1 +_ +_ +1.040000000 +___________ +___________ +1.444 +_____ +_____ +1.58590 +_______ +_______ +8.013 +_____ +_____ +45 +__ +__ +46.89 +_____ +_____ + 4567. + _____ +____________________ +>>>>37800 + _____ +_________ +576,446.88800000 +________________ +________________ +576,446.890 +___________ +___________ +4798908.340000000000 +____________________ +____________________ +4798908.45 +__________ +__________ +4798908.8909800 +_______________ +_______________ diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.expected.debug b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.expected.debug new file mode 100644 index 000000000..b2782d93d --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.expected.debug @@ -0,0 +1,60 @@ +-2028789030 +___________ +-896689 +_______ +-8.90880 +________ +-1 +__ +-.05 +____ + +^ no match for key + +^ no match for key + +^ no match for key + +^ no match for key + +^ no match for key +CARAvan +^ no match for key + +^ no match for key + +^ no match for key + +^ no match for key +000 +___ +1 +_ +00000001 +________ +1.040000000 +___________ +1.444 +_____ +1.58590 +_______ +8.013 +_____ +45 +__ +46.89 +_____ + 4567. + _____ +>>>>37800 + _____ +576,446.88800000 +________________ +576,446.890 +___________ +4798908.340000000000 +____________________ +4798908.45 +__________ +4798908.8909800 +_______________ diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.expected.debug b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.expected.debug new file mode 100644 index 000000000..782a77724 --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.expected.debug @@ -0,0 +1,40 @@ +-2028789030 +___________ +-896689 +_______ +-8.90880 +________ +-1 +__ +-.05 +____ + +^ no match for key +1 +_ +1.040000000 +___________ +1.444 +_____ +1.58590 +_______ +8.013 +_____ +45 +__ +46.89 +_____ + 4567. + _____ +>>>>37800 + _____ +576,446.88800000 +________________ +576,446.890 +___________ +4798908.340000000000 +____________________ +4798908.45 +__________ +4798908.8909800 +_______________ diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.expected.debug b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.expected.debug new file mode 100644 index 000000000..e0389c1d5 --- /dev/null +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.expected.debug @@ -0,0 +1,40 @@ +4798908.8909800 +_______________ +4798908.45 +__________ +4798908.340000000000 +____________________ +576,446.890 +___________ +576,446.88800000 +________________ +>>>>37800 + _____ + 4567. + _____ +46.89 +_____ +45 +__ +8.013 +_____ +1.58590 +_______ +1.444 +_____ +1.040000000 +___________ +1 +_ + +^ no match for key +-.05 +____ +-1 +__ +-8.90880 +________ +-896689 +_______ +-2028789030 +___________ diff --git a/tests/fixtures/sort/month_default.expected.debug b/tests/fixtures/sort/month_default.expected.debug new file mode 100644 index 000000000..2c55a0e2a --- /dev/null +++ b/tests/fixtures/sort/month_default.expected.debug @@ -0,0 +1,30 @@ +N/A Ut enim ad minim veniam, quis +^ no match for key +_________________________________ +Jan Lorem ipsum dolor sit amet +___ +______________________________ +mar laboris nisi ut aliquip ex ea +___ +_________________________________ +May sed do eiusmod tempor incididunt +___ +____________________________________ +JUN nostrud exercitation ullamco +___ +________________________________ +Jul 1 should remain 2,1,3 +___ +_________________________ +Jul 2 these three lines +___ +_______________________ +Jul 3 if --stable is provided +___ +_____________________________ +Oct ut labore et dolore magna aliqua +___ +____________________________________ +Dec consectetur adipiscing elit +___ +_______________________________ diff --git a/tests/fixtures/sort/month_stable.expected.debug b/tests/fixtures/sort/month_stable.expected.debug new file mode 100644 index 000000000..4163ba39a --- /dev/null +++ b/tests/fixtures/sort/month_stable.expected.debug @@ -0,0 +1,20 @@ +N/A Ut enim ad minim veniam, quis +^ no match for key +Jan Lorem ipsum dolor sit amet +___ +mar laboris nisi ut aliquip ex ea +___ +May sed do eiusmod tempor incididunt +___ +JUN nostrud exercitation ullamco +___ +Jul 2 these three lines +___ +Jul 1 should remain 2,1,3 +___ +Jul 3 if --stable is provided +___ +Oct ut labore et dolore magna aliqua +___ +Dec consectetur adipiscing elit +___ diff --git a/tests/fixtures/sort/months-dedup.expected.debug b/tests/fixtures/sort/months-dedup.expected.debug new file mode 100644 index 000000000..aded4b951 --- /dev/null +++ b/tests/fixtures/sort/months-dedup.expected.debug @@ -0,0 +1,12 @@ + +^ no match for key +JAN +___ +apr +___ +MAY +___ +JUNNNN +___ +AUG +___ diff --git a/tests/fixtures/sort/months-whitespace.expected.debug b/tests/fixtures/sort/months-whitespace.expected.debug new file mode 100644 index 000000000..ef626f505 --- /dev/null +++ b/tests/fixtures/sort/months-whitespace.expected.debug @@ -0,0 +1,24 @@ + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key +JAN +___ +___ + FEb + ___ +_____ + apr + ___ +____ + apr + ___ +____ +>>>JUNNNN + ___ +_________ +AUG +___ +____ diff --git a/tests/fixtures/sort/multiple_decimals_general.expected b/tests/fixtures/sort/multiple_decimals_general.expected new file mode 100644 index 000000000..b08ada324 --- /dev/null +++ b/tests/fixtures/sort/multiple_decimals_general.expected @@ -0,0 +1,37 @@ + + + + + + + +CARAvan + NaN + -inf +-2028789030 +-896689 +-8.90880 +-1 +-.05 +000 +00000001 +1 +1.040000000 +1.444 +1.58590 +8.013 +45 +46.89 +576,446.88800000 +576,446.890 + 4567..457 + 4567. +4567.1 +4567.34 + 37800 + 45670.89079.098 + 45670.89079.1 +4798908.340000000000 +4798908.45 +4798908.8909800 +inf diff --git a/tests/fixtures/sort/multiple_decimals_general.expected.debug b/tests/fixtures/sort/multiple_decimals_general.expected.debug new file mode 100644 index 000000000..1bf5d2669 --- /dev/null +++ b/tests/fixtures/sort/multiple_decimals_general.expected.debug @@ -0,0 +1,111 @@ + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key +CARAvan +^ no match for key +_______ + NaN + ___ +_____ +>-inf + ____ +_____ +-2028789030 +___________ +___________ +-896689 +_______ +_______ +-8.90880 +________ +________ +-1 +__ +__ +-.05 +____ +____ +000 +___ +___ +00000001 +________ +________ +1 +_ +_ +1.040000000 +___________ +___________ +1.444 +_____ +_____ +1.58590 +_______ +_______ +8.013 +_____ +_____ +45 +__ +__ +46.89 +_____ +_____ +576,446.88800000 +___ +________________ +576,446.890 +___ +___________ +>>>>>>>>>>4567..457 + _____ +___________________ + 4567. + _____ +____________________ +4567.1 +______ +______ +4567.34 +_______ +_______ +>>>>37800 + _____ +_________ +>>>>>>45670.89079.098 + ___________ +_____________________ +>>>>>>45670.89079.1 + ___________ +___________________ +4798908.340000000000 +____________________ +____________________ +4798908.45 +__________ +__________ +4798908.8909800 +_______________ +_______________ +inf +___ +___ diff --git a/tests/fixtures/sort/multiple_decimals_general.txt b/tests/fixtures/sort/multiple_decimals_general.txt index 4e65ecfda..0feb0ce7f 100644 --- a/tests/fixtures/sort/multiple_decimals_general.txt +++ b/tests/fixtures/sort/multiple_decimals_general.txt @@ -32,4 +32,6 @@ CARAvan 8.013 000 - + NaN +inf + -inf diff --git a/tests/fixtures/sort/multiple_decimals_numeric.expected.debug b/tests/fixtures/sort/multiple_decimals_numeric.expected.debug new file mode 100644 index 000000000..f40ade9aa --- /dev/null +++ b/tests/fixtures/sort/multiple_decimals_numeric.expected.debug @@ -0,0 +1,105 @@ +-2028789030 +___________ +___________ +-896689 +_______ +_______ +-8.90880 +________ +________ +-1 +__ +__ +-.05 +____ +____ + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key +000 +___ +___ +CARAvan +^ no match for key +_______ +00000001 +________ +________ +1 +_ +_ +1.040000000 +___________ +___________ +1.444 +_____ +_____ +1.58590 +_______ +_______ +8.013 +_____ +_____ +45 +__ +__ +46.89 +_____ +_____ +>>>>>>>>>>4567..457 + _____ +___________________ + 4567. + _____ +____________________ +4567.1 +______ +______ +4567.34 +_______ +_______ +>>>>37800 + _____ +_________ +>>>>>>45670.89079.098 + ___________ +_____________________ +>>>>>>45670.89079.1 + ___________ +___________________ +576,446.88800000 +________________ +________________ +576,446.890 +___________ +___________ +4798908.340000000000 +____________________ +____________________ +4798908.45 +__________ +__________ +4798908.8909800 +_______________ +_______________ diff --git a/tests/fixtures/sort/numeric-floats-with-nan2.expected.debug b/tests/fixtures/sort/numeric-floats-with-nan2.expected.debug new file mode 100644 index 000000000..b5a2c2f64 --- /dev/null +++ b/tests/fixtures/sort/numeric-floats-with-nan2.expected.debug @@ -0,0 +1,69 @@ +-8.90880 +________ +________ +-.05 +____ +____ + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key + +^ no match for key +^ no match for key +Karma +^ no match for key +_____ +1 +_ +_ +1.0/0.0 +___ +_______ +1.040000000 +___________ +___________ +1.2 +___ +___ +1.444 +_____ +_____ +1.58590 +_______ +_______ diff --git a/tests/fixtures/sort/numeric_fixed_floats.expected.debug b/tests/fixtures/sort/numeric_fixed_floats.expected.debug new file mode 100644 index 000000000..fa8a909c5 --- /dev/null +++ b/tests/fixtures/sort/numeric_fixed_floats.expected.debug @@ -0,0 +1,6 @@ +.00 +___ +___ +.01 +___ +___ diff --git a/tests/fixtures/sort/numeric_floats.expected.debug b/tests/fixtures/sort/numeric_floats.expected.debug new file mode 100644 index 000000000..e24056376 --- /dev/null +++ b/tests/fixtures/sort/numeric_floats.expected.debug @@ -0,0 +1,6 @@ +.02 +___ +___ +.03 +___ +___ diff --git a/tests/fixtures/sort/numeric_floats_and_ints.expected.debug b/tests/fixtures/sort/numeric_floats_and_ints.expected.debug new file mode 100644 index 000000000..c43d6bfb6 --- /dev/null +++ b/tests/fixtures/sort/numeric_floats_and_ints.expected.debug @@ -0,0 +1,6 @@ +0 +_ +_ +.02 +___ +___ diff --git a/tests/fixtures/sort/numeric_floats_with_nan.expected.debug b/tests/fixtures/sort/numeric_floats_with_nan.expected.debug new file mode 100644 index 000000000..07e72db53 --- /dev/null +++ b/tests/fixtures/sort/numeric_floats_with_nan.expected.debug @@ -0,0 +1,9 @@ +NaN +^ no match for key +___ +.02 +___ +___ +.03 +___ +___ diff --git a/tests/fixtures/sort/numeric_unfixed_floats.expected.debug b/tests/fixtures/sort/numeric_unfixed_floats.expected.debug new file mode 100644 index 000000000..a60daf623 --- /dev/null +++ b/tests/fixtures/sort/numeric_unfixed_floats.expected.debug @@ -0,0 +1,6 @@ +.000 +____ +____ +.01 +___ +___ diff --git a/tests/fixtures/sort/numeric_unique.expected.debug b/tests/fixtures/sort/numeric_unique.expected.debug new file mode 100644 index 000000000..79ec70364 --- /dev/null +++ b/tests/fixtures/sort/numeric_unique.expected.debug @@ -0,0 +1,4 @@ +-10 bb +___ +aa +^ no match for key diff --git a/tests/fixtures/sort/numeric_unsorted_ints.expected.debug b/tests/fixtures/sort/numeric_unsorted_ints.expected.debug new file mode 100644 index 000000000..b16931f5e --- /dev/null +++ b/tests/fixtures/sort/numeric_unsorted_ints.expected.debug @@ -0,0 +1,300 @@ +1 +_ +_ +2 +_ +_ +3 +_ +_ +4 +_ +_ +5 +_ +_ +6 +_ +_ +7 +_ +_ +8 +_ +_ +9 +_ +_ +10 +__ +__ +11 +__ +__ +12 +__ +__ +13 +__ +__ +14 +__ +__ +15 +__ +__ +16 +__ +__ +17 +__ +__ +18 +__ +__ +19 +__ +__ +20 +__ +__ +21 +__ +__ +22 +__ +__ +23 +__ +__ +24 +__ +__ +25 +__ +__ +26 +__ +__ +27 +__ +__ +28 +__ +__ +29 +__ +__ +30 +__ +__ +31 +__ +__ +32 +__ +__ +33 +__ +__ +34 +__ +__ +35 +__ +__ +36 +__ +__ +37 +__ +__ +38 +__ +__ +39 +__ +__ +40 +__ +__ +41 +__ +__ +42 +__ +__ +43 +__ +__ +44 +__ +__ +45 +__ +__ +46 +__ +__ +47 +__ +__ +48 +__ +__ +49 +__ +__ +50 +__ +__ +51 +__ +__ +52 +__ +__ +53 +__ +__ +54 +__ +__ +55 +__ +__ +56 +__ +__ +57 +__ +__ +58 +__ +__ +59 +__ +__ +60 +__ +__ +61 +__ +__ +62 +__ +__ +63 +__ +__ +64 +__ +__ +65 +__ +__ +66 +__ +__ +67 +__ +__ +68 +__ +__ +69 +__ +__ +70 +__ +__ +71 +__ +__ +72 +__ +__ +73 +__ +__ +74 +__ +__ +75 +__ +__ +76 +__ +__ +77 +__ +__ +78 +__ +__ +79 +__ +__ +80 +__ +__ +81 +__ +__ +82 +__ +__ +83 +__ +__ +84 +__ +__ +85 +__ +__ +86 +__ +__ +87 +__ +__ +88 +__ +__ +89 +__ +__ +90 +__ +__ +91 +__ +__ +92 +__ +__ +93 +__ +__ +94 +__ +__ +95 +__ +__ +96 +__ +__ +97 +__ +__ +98 +__ +__ +99 +__ +__ +100 +___ +___ diff --git a/tests/fixtures/sort/numeric_unsorted_ints_unique.expected.debug b/tests/fixtures/sort/numeric_unsorted_ints_unique.expected.debug new file mode 100644 index 000000000..072a57ccf --- /dev/null +++ b/tests/fixtures/sort/numeric_unsorted_ints_unique.expected.debug @@ -0,0 +1,8 @@ +1 +_ +2 +_ +3 +_ +4 +_ diff --git a/tests/fixtures/sort/version.expected.debug b/tests/fixtures/sort/version.expected.debug new file mode 100644 index 000000000..2d922b5c0 --- /dev/null +++ b/tests/fixtures/sort/version.expected.debug @@ -0,0 +1,12 @@ +1.2.3-alpha +___________ +___________ +1.2.3-alpha2 +____________ +____________ +1.12.4 +______ +______ +11.2.3 +______ +______ diff --git a/tests/fixtures/sort/words_unique.expected.debug b/tests/fixtures/sort/words_unique.expected.debug new file mode 100644 index 000000000..0c32daf74 --- /dev/null +++ b/tests/fixtures/sort/words_unique.expected.debug @@ -0,0 +1,6 @@ +aaa +___ +bbb +___ +zzz +___ diff --git a/tests/fixtures/sort/zero-terminated.expected.debug b/tests/fixtures/sort/zero-terminated.expected.debug new file mode 100644 index 000000000..fbef272b0 --- /dev/null +++ b/tests/fixtures/sort/zero-terminated.expected.debug @@ -0,0 +1,84 @@ +../.. +_____ +../../by-util +_____________ +../../common +____________ +../../fixtures +______________ +../../fixtures/cat +__________________ +../../fixtures/cksum +____________________ +../../fixtures/comm +___________________ +../../fixtures/cp +_________________ +../../fixtures/cp/dir_with_mount +________________________________ +../../fixtures/cp/dir_with_mount/copy_me +________________________________________ +../../fixtures/cp/hello_dir +___________________________ +../../fixtures/cp/hello_dir_with_file +_____________________________________ +../../fixtures/csplit +_____________________ +../../fixtures/cut +__________________ +../../fixtures/cut/sequences +____________________________ +../../fixtures/dircolors +________________________ +../../fixtures/du +_________________ +../../fixtures/du/subdir +________________________ +../../fixtures/du/subdir/deeper +_______________________________ +../../fixtures/du/subdir/links +______________________________ +../../fixtures/env +__________________ +../../fixtures/expand +_____________________ +../../fixtures/fmt +__________________ +../../fixtures/fold +___________________ +../../fixtures/hashsum +______________________ +../../fixtures/head +___________________ +../../fixtures/join +___________________ +../../fixtures/mv +_________________ +../../fixtures/nl +_________________ +../../fixtures/numfmt +_____________________ +../../fixtures/od +_________________ +../../fixtures/paste +____________________ +../../fixtures/ptx +__________________ +../../fixtures/shuf +___________________ +../../fixtures/sort +___________________ +../../fixtures/sum +__________________ +../../fixtures/tac +__________________ +../../fixtures/tail +___________________ +../../fixtures/tsort +____________________ +../../fixtures/unexpand +_______________________ +../../fixtures/uniq +___________________ +../../fixtures/wc +_________________ From 9f79db287bb6323de4b0eec7d670ffb6aa9da674 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 24 Apr 2021 09:55:24 +0200 Subject: [PATCH 0421/1135] Update src/uu/ls/src/ls.rs Co-authored-by: Sylvestre Ledru --- src/uu/ls/src/ls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 19097edda..11d8b261f 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1185,7 +1185,7 @@ fn sort_entries(entries: &mut Vec, config: &Config) { fn is_hidden(file_path: &DirEntry) -> bool { let metadata = fs::metadata(file_path.path()).unwrap(); let attr = metadata.file_attributes(); - ((attr & 0x2) > 0) + (attr & 0x2) > 0 } fn should_display(entry: &DirEntry, config: &Config) -> bool { From 728f0bd61d792a6263375b809567d92f50e291ce Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 24 Apr 2021 10:47:36 +0200 Subject: [PATCH 0422/1135] ls: remove redundant parentheses --- src/uu/ls/src/ls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 1129d55c4..31e3de31c 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1161,7 +1161,7 @@ fn sort_entries(entries: &mut Vec, config: &Config) { fn is_hidden(file_path: &DirEntry) -> bool { let metadata = fs::metadata(file_path.path()).unwrap(); let attr = metadata.file_attributes(); - ((attr & 0x2) > 0) + (attr & 0x2) > 0 } fn should_display(entry: &DirEntry, config: &Config) -> bool { From 5dcfb5111027dad087639e2f9003d1b9c7bd3fc8 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 24 Apr 2021 10:52:40 +0200 Subject: [PATCH 0423/1135] flip default for debug to the effective default --- src/uu/sort/src/sort.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index d9a639b3c..0630ec97a 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -121,7 +121,7 @@ impl Default for GlobalSettings { fn default() -> GlobalSettings { GlobalSettings { mode: SortMode::Default, - debug: true, + debug: false, ignore_blanks: false, ignore_case: false, dictionary_order: false, From 5f61848a3812d18bae3d9dbfa672c11f43b1d526 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 24 Apr 2021 12:45:55 +0200 Subject: [PATCH 0424/1135] fix a build failure with success() --- tests/by-util/test_cp.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index bf5f9919d..53c16e677 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -976,7 +976,7 @@ fn test_cp_reflink_always() { .arg(TEST_EXISTING_FILE) .run(); - if result.success { + if result.succeeded() { // Check the content of the destination file assert_eq!(at.read(TEST_EXISTING_FILE), "Hello, World!\n"); } else { @@ -1014,7 +1014,7 @@ fn test_cp_reflink_never() { #[cfg(target_os = "linux")] fn test_cp_reflink_bad() { let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd + let _result = ucmd .arg("--reflink=bad") .arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_EXISTING_FILE) From 3ac481e4d39717bfad5b57ca7df36ae5c55a593b Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 24 Apr 2021 12:46:06 +0200 Subject: [PATCH 0425/1135] rustfmt the recent change --- tests/by-util/test_cat.rs | 2 +- tests/by-util/test_sort.rs | 10 +++++----- tests/by-util/test_tail.rs | 6 +----- tests/by-util/test_truncate.rs | 1 - 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index 9f7ebdd37..c8ae29a9d 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -397,10 +397,10 @@ fn test_dev_full_show_all() { #[cfg(unix)] fn test_domain_socket() { use std::io::prelude::*; + use std::sync::{Arc, Barrier}; use std::thread; use tempdir::TempDir; use unix_socket::UnixListener; - use std::sync::{Barrier, Arc}; let dir = TempDir::new("unix_socket").expect("failed to create dir"); let socket_path = dir.path().join("sock"); diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 72d4f67fc..9825f1eb5 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -585,8 +585,8 @@ fn test_check_silent() { #[test] fn test_trailing_separator() { new_ucmd!() - .args(&["-t", "x", "-k", "1,1"]) - .pipe_in("aax\naaa\n") - .succeeds() - .stdout_is("aax\naaa\n"); -} \ No newline at end of file + .args(&["-t", "x", "-k", "1,1"]) + .pipe_in("aax\naaa\n") + .succeeds() + .stdout_is("aax\naaa\n"); +} diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 1f74a3a98..1c025cf4c 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -346,9 +346,5 @@ fn test_negative_indexing() { #[test] fn test_sleep_interval() { - new_ucmd!() - .arg("-s") - .arg("10") - .arg(FOOBAR_TXT) - .succeeds(); + new_ucmd!().arg("-s").arg("10").arg(FOOBAR_TXT).succeeds(); } diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index 2a1f4429b..64573f2c0 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -79,4 +79,3 @@ fn test_failed_incorrect_arg() { let (_at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["-s", "+5A", TFILE1]).fails(); } - From 99840b909933553dd110efbd6802a821eb26ff0a Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 24 Apr 2021 13:15:59 +0200 Subject: [PATCH 0426/1135] refresh cargo.lock with recent updates --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7ae0d078f..2ac0de37a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1212,9 +1212,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.5" +version = "1.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" +checksum = "2a26af418b574bd56588335b3a3659a65725d4e636eb1016c2f9e3b38c7cc759" dependencies = [ "aho-corasick", "memchr 2.3.4", From 1328d1887884eabb45fce7612f08f0fac817ae46 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 24 Apr 2021 13:19:50 +0200 Subject: [PATCH 0427/1135] ls: remove outdated comment --- src/uu/ls/src/ls.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 31e3de31c..2baf93193 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1606,7 +1606,6 @@ fn display_file_name(path: &PathData, strip: Option<&Path>, config: &Config) -> if config.format == Format::Long && path.file_type()?.is_symlink() { if let Ok(target) = path.p_buf.read_link() { - // We don't bother updating width here because it's not used for long listings name.push_str(" -> "); name.push_str(&target.to_string_lossy()); } From e9e3d4100886943722a3bbebe3519bb881f9d0d3 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sat, 24 Apr 2021 15:25:14 +0100 Subject: [PATCH 0428/1135] Expand tests for truncate --- tests/by-util/test_truncate.rs | 60 ++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index 64573f2c0..b033385de 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -79,3 +79,63 @@ fn test_failed_incorrect_arg() { let (_at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["-s", "+5A", TFILE1]).fails(); } + +#[test] +fn test_at_most_shrinks() { + let (at, mut ucmd) = at_and_ucmd!(); + let mut file = at.make_file(TFILE2); + file.write_all(b"1234567890").unwrap(); + ucmd.args(&["--size", "<4", TFILE2]).succeeds(); + file.seek(SeekFrom::End(0)).unwrap(); + assert!(file.seek(SeekFrom::Current(0)).unwrap() == 4); +} + +#[test] +fn test_at_most_no_change() { + let (at, mut ucmd) = at_and_ucmd!(); + let mut file = at.make_file(TFILE2); + file.write_all(b"1234567890").unwrap(); + ucmd.args(&["--size", "<40", TFILE2]).succeeds(); + file.seek(SeekFrom::End(0)).unwrap(); + assert!(file.seek(SeekFrom::Current(0)).unwrap() == 10); +} + +#[test] +fn test_at_least_grows() { + let (at, mut ucmd) = at_and_ucmd!(); + let mut file = at.make_file(TFILE2); + file.write_all(b"1234567890").unwrap(); + ucmd.args(&["--size", ">15", TFILE2]).succeeds(); + file.seek(SeekFrom::End(0)).unwrap(); + assert!(file.seek(SeekFrom::Current(0)).unwrap() == 15); +} + +#[test] +fn test_at_least_no_change() { + let (at, mut ucmd) = at_and_ucmd!(); + let mut file = at.make_file(TFILE2); + file.write_all(b"1234567890").unwrap(); + ucmd.args(&["--size", ">4", TFILE2]).succeeds(); + file.seek(SeekFrom::End(0)).unwrap(); + assert!(file.seek(SeekFrom::Current(0)).unwrap() == 10); +} + +#[test] +fn test_round_down() { + let (at, mut ucmd) = at_and_ucmd!(); + let mut file = at.make_file(TFILE2); + file.write_all(b"1234567890").unwrap(); + ucmd.args(&["--size", "/4", TFILE2]).succeeds(); + file.seek(SeekFrom::End(0)).unwrap(); + assert!(file.seek(SeekFrom::Current(0)).unwrap() == 8); +} + +#[test] +fn test_round_up() { + let (at, mut ucmd) = at_and_ucmd!(); + let mut file = at.make_file(TFILE2); + file.write_all(b"1234567890").unwrap(); + ucmd.args(&["--size", "*4", TFILE2]).succeeds(); + file.seek(SeekFrom::End(0)).unwrap(); + assert!(file.seek(SeekFrom::Current(0)).unwrap() == 12); +} From 2084c3ddf373261ab5d40999c33351eff6e905fe Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 24 Apr 2021 16:43:13 +0200 Subject: [PATCH 0429/1135] tests: show pretty diffs for assertion failures - All assert_eq in tests/common/util.rs now print a pretty diff on test failures. - {stdout, stderr}_is_fixture now compare the expected output and the fixture as Strings, which leads to more usable diffs. --- Cargo.lock | 38 ++++++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + tests/common/util.rs | 7 ++++--- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2ac0de37a..1651259ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -221,6 +221,7 @@ dependencies = [ "lazy_static", "libc", "nix 0.20.0", + "pretty_assertions", "rand 0.7.3", "regex", "sha1", @@ -526,6 +527,16 @@ dependencies = [ "memchr 2.3.4", ] +[[package]] +name = "ctor" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e98e2ad1a782e33928b96fc3948e7c355e5af34ba4de7670fe8bac2a3b2006d" +dependencies = [ + "quote 1.0.9", + "syn", +] + [[package]] name = "custom_derive" version = "0.1.7" @@ -538,6 +549,12 @@ version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" +[[package]] +name = "diff" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499" + [[package]] name = "digest" version = "0.6.2" @@ -943,6 +960,15 @@ version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +[[package]] +name = "output_vt100" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "paste" version = "0.1.18" @@ -1012,6 +1038,18 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +[[package]] +name = "pretty_assertions" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cab0e7c02cf376875e9335e0ba1da535775beb5450d21e1dffca068818ed98b" +dependencies = [ + "ansi_term 0.12.1", + "ctor", + "diff", + "output_vt100", +] + [[package]] name = "proc-macro-hack" version = "0.5.19" diff --git a/Cargo.toml b/Cargo.toml index 7e3fb9139..7c1a771fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -335,6 +335,7 @@ 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" sha1 = { version="0.6", features=["std"] } diff --git a/tests/common/util.rs b/tests/common/util.rs index 29b8a4633..93bbccc24 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -2,6 +2,7 @@ #[cfg(not(windows))] use libc; +use pretty_assertions::assert_eq; use std::env; #[cfg(not(windows))] use std::ffi::CString; @@ -221,7 +222,7 @@ impl CmdResult { /// like stdout_is(...), but expects the contents of the file at the provided relative path pub fn stdout_is_fixture>(&self, file_rel_path: T) -> &CmdResult { let contents = read_scenario_fixture(&self.tmpd, file_rel_path); - self.stdout_is_bytes(contents) + self.stdout_is(String::from_utf8(contents).unwrap()) } /// asserts that the command resulted in stderr stream output that equals the @@ -245,7 +246,7 @@ impl CmdResult { /// Like stdout_is_fixture, but for stderr pub fn stderr_is_fixture>(&self, file_rel_path: T) -> &CmdResult { let contents = read_scenario_fixture(&self.tmpd, file_rel_path); - self.stderr_is_bytes(contents) + self.stderr_is(String::from_utf8(contents).unwrap()) } /// asserts that @@ -619,7 +620,7 @@ impl TestScenario { }, util_name: String::from(util_name), fixtures: AtPath::new(tmpd.as_ref().path()), - tmpd: tmpd, + tmpd, }; let mut fixture_path_builder = env::current_dir().unwrap(); fixture_path_builder.push(TESTS_DIR); From 2c1459cbfc4c060ffdbf0bd8c21ecd63504424e9 Mon Sep 17 00:00:00 2001 From: Chirag Jadwani Date: Sat, 24 Apr 2021 21:34:42 +0530 Subject: [PATCH 0430/1135] cut: optimizations * Use buffered stdout to reduce write sys calls. This simple change yielded the biggest performace gain. * Use `for_byte_record_with_terminator` from the `bstr` crate. This is to minimize the per line copying needed by `BufReader::read_until`. The `cut_fields` and `cut_fields_delimiter` functions used `read_until` to iterate over lines. That required copying each input line to the line buffer. With `for_byte_record_with_terminator` copying is minimized as it calls our closure with a reference to BufReader's buffer most of the time. It needs to copy (internally) only to process any incomplete lines at the end of the buffer. * Re-write `Searcher` to use `memchr`. Switch from the naive implementation to one that uses `memchr`. * Rewrite `cut_bytes` almost entirely. This was already well optimized. The performance gain in this case is not from avoiding copying. In fact, it needed zero copying whereas new implementation introduces some copying similar to `cut_fields` described above. But the occassional copying cost is more than offset by the use of the very fast `memchr` inside `for_byte_record_with_terminator`. This change also simplifies the code significantly. Removed the `buffer` module. --- Cargo.lock | 2 + src/uu/cut/Cargo.toml | 2 + src/uu/cut/src/buffer.rs | 152 --------------------------- src/uu/cut/src/cut.rs | 208 ++++++++++++++----------------------- src/uu/cut/src/searcher.rs | 95 +++++++++++++---- 5 files changed, 157 insertions(+), 302 deletions(-) delete mode 100644 src/uu/cut/src/buffer.rs diff --git a/Cargo.lock b/Cargo.lock index 321f41d89..9df4994c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1777,7 +1777,9 @@ dependencies = [ name = "uu_cut" version = "0.0.6" dependencies = [ + "bstr", "clap", + "memchr 2.3.4", "uucore", "uucore_procs", ] diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index d892ddeb5..c863c1772 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -18,6 +18,8 @@ path = "src/cut.rs" clap = "2.33" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +memchr = "2" +bstr = "0.2" [[bin]] name = "cut" diff --git a/src/uu/cut/src/buffer.rs b/src/uu/cut/src/buffer.rs deleted file mode 100644 index 6c3238be1..000000000 --- a/src/uu/cut/src/buffer.rs +++ /dev/null @@ -1,152 +0,0 @@ -// This file is part of the uutils coreutils package. -// -// (c) Rolf Morel -// (c) kwantam -// * substantial rewrite to use the `std::io::BufReader` trait -// -// For the full copyright and license information, please view the LICENSE -// file that was distributed with this source code. - -// spell-checker:ignore (ToDO) SRes Newl - -use std::io::Result as IoResult; -use std::io::{BufRead, BufReader, Read, Write}; - -#[allow(non_snake_case)] -pub mod Bytes { - use std::io::Write; - - pub trait Select { - fn select(&mut self, bytes: usize, out: Option<&mut W>) -> Selected; - } - - #[derive(PartialEq, Eq, Debug)] - pub enum Selected { - NewlineFound, - Complete(usize), - Partial(usize), - EndOfFile, - } -} - -#[derive(Debug)] -pub struct ByteReader -where - R: Read, -{ - inner: BufReader, - newline_char: u8, -} - -impl ByteReader { - pub fn new(read: R, newline_char: u8) -> ByteReader { - ByteReader { - inner: BufReader::with_capacity(4096, read), - newline_char, - } - } -} - -impl Read for ByteReader { - fn read(&mut self, buf: &mut [u8]) -> IoResult { - self.inner.read(buf) - } -} - -impl BufRead for ByteReader { - fn fill_buf(&mut self) -> IoResult<&[u8]> { - self.inner.fill_buf() - } - - fn consume(&mut self, amt: usize) { - self.inner.consume(amt) - } -} - -impl ByteReader { - pub fn consume_line(&mut self) -> usize { - let mut bytes_consumed = 0; - let mut consume_val; - let newline_char = self.newline_char; - - loop { - { - // need filled_buf to go out of scope - let filled_buf = match self.fill_buf() { - Ok(b) => { - if b.is_empty() { - return bytes_consumed; - } else { - b - } - } - Err(e) => crash!(1, "read error: {}", e), - }; - - if let Some(idx) = filled_buf.iter().position(|byte| *byte == newline_char) { - consume_val = idx + 1; - bytes_consumed += consume_val; - break; - } - - consume_val = filled_buf.len(); - } - - bytes_consumed += consume_val; - self.consume(consume_val); - } - - self.consume(consume_val); - bytes_consumed - } -} - -impl self::Bytes::Select for ByteReader { - fn select(&mut self, bytes: usize, out: Option<&mut W>) -> Bytes::Selected { - enum SRes { - Comp, - Part, - Newl, - } - - use self::Bytes::Selected::*; - - let newline_char = self.newline_char; - let (res, consume_val) = { - let buffer = match self.fill_buf() { - Err(e) => crash!(1, "read error: {}", e), - Ok(b) => b, - }; - - let (res, consume_val) = match buffer.len() { - 0 => return EndOfFile, - buf_used if bytes < buf_used => { - // because the output delimiter should only be placed between - // segments check if the byte after bytes is a newline - let buf_slice = &buffer[0..=bytes]; - - match buf_slice.iter().position(|byte| *byte == newline_char) { - Some(idx) => (SRes::Newl, idx + 1), - None => (SRes::Comp, bytes), - } - } - _ => match buffer.iter().position(|byte| *byte == newline_char) { - Some(idx) => (SRes::Newl, idx + 1), - None => (SRes::Part, buffer.len()), - }, - }; - - if let Some(out) = out { - crash_if_err!(1, out.write_all(&buffer[0..consume_val])); - } - (res, consume_val) - }; - - self.consume(consume_val); - match res { - SRes::Comp => Complete(consume_val), - SRes::Part => Partial(consume_val), - SRes::Newl => NewlineFound, - } - } -} diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index 5bf310daa..91dc17e52 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -10,15 +10,16 @@ #[macro_use] extern crate uucore; +use bstr::io::BufReadExt; use clap::{App, Arg}; use std::fs::File; -use std::io::{stdin, stdout, BufRead, BufReader, Read, Stdout, Write}; +use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write}; use std::path::Path; use self::searcher::Searcher; +use uucore::fs::is_stdout_interactive; use uucore::ranges::Range; -mod buffer; mod searcher; static NAME: &str = "cut"; @@ -125,6 +126,14 @@ enum Mode { Fields(Vec, FieldOptions), } +fn stdout_writer() -> Box { + if is_stdout_interactive() { + Box::new(stdout()) + } else { + Box::new(BufWriter::new(stdout())) as Box + } +} + fn list_to_ranges(list: &str, complement: bool) -> Result, String> { if complement { Range::from_list(list).map(|r| uucore::ranges::complement(&r)) @@ -134,72 +143,35 @@ fn list_to_ranges(list: &str, complement: bool) -> Result, String> { } fn cut_bytes(reader: R, ranges: &[Range], opts: &Options) -> i32 { - use self::buffer::Bytes::Select; - use self::buffer::Bytes::Selected::*; - let newline_char = if opts.zero_terminated { b'\0' } else { b'\n' }; - let mut buf_read = buffer::ByteReader::new(reader, newline_char); - let mut out = stdout(); + let buf_in = BufReader::new(reader); + let mut out = stdout_writer(); + let delim = opts + .out_delim + .as_ref() + .map_or("", String::as_str) + .as_bytes(); - 'newline: loop { - let mut cur_pos = 1; + let res = buf_in.for_byte_record(newline_char, |line| { let mut print_delim = false; - - for &Range { low, high } in ranges.iter() { - // skip up to low - let orig_pos = cur_pos; - loop { - match buf_read.select(low - cur_pos, None::<&mut Stdout>) { - NewlineFound => { - crash_if_err!(1, out.write_all(&[newline_char])); - continue 'newline; - } - Complete(len) => { - cur_pos += len; - break; - } - Partial(len) => cur_pos += len, - EndOfFile => { - if orig_pos != cur_pos { - crash_if_err!(1, out.write_all(&[newline_char])); - } - - break 'newline; - } - } + for &Range { low, high } in ranges { + if low > line.len() { + break; } - - if let Some(ref delim) = opts.out_delim { - if print_delim { - crash_if_err!(1, out.write_all(delim.as_bytes())); - } + if print_delim { + out.write_all(delim)?; + } else if opts.out_delim.is_some() { print_delim = true; } - - // write out from low to high - loop { - match buf_read.select(high - cur_pos + 1, Some(&mut out)) { - NewlineFound => continue 'newline, - Partial(len) => cur_pos += len, - Complete(_) => { - cur_pos = high + 1; - break; - } - EndOfFile => { - if cur_pos != low || low == high { - crash_if_err!(1, out.write_all(&[newline_char])); - } - - break 'newline; - } - } - } + // change `low` from 1-indexed value to 0-index value + let low = low - 1; + let high = high.min(line.len()); + out.write_all(&line[low..high])?; } - - buf_read.consume_line(); - crash_if_err!(1, out.write_all(&[newline_char])); - } - + out.write_all(&[newline_char])?; + Ok(true) + }); + crash_if_err!(1, res); 0 } @@ -212,23 +184,11 @@ fn cut_fields_delimiter( newline_char: u8, out_delim: &str, ) -> i32 { - let mut buf_in = BufReader::new(reader); - let mut out = stdout(); - let mut buffer = Vec::new(); + let buf_in = BufReader::new(reader); + let mut out = stdout_writer(); + let input_delim_len = delim.len(); - 'newline: loop { - buffer.clear(); - match buf_in.read_until(newline_char, &mut buffer) { - Ok(n) if n == 0 => break, - Err(e) => { - if buffer.is_empty() { - crash!(1, "read error: {}", e); - } - } - _ => (), - } - - let line = &buffer[..]; + let result = buf_in.for_byte_record_with_terminator(newline_char, |line| { let mut fields_pos = 1; let mut low_idx = 0; let mut delim_search = Searcher::new(line, delim.as_bytes()).peekable(); @@ -236,46 +196,46 @@ fn cut_fields_delimiter( if delim_search.peek().is_none() { if !only_delimited { - crash_if_err!(1, out.write_all(line)); + out.write_all(line)?; if line[line.len() - 1] != newline_char { - crash_if_err!(1, out.write_all(&[newline_char])); + out.write_all(&[newline_char])?; } } - continue; + return Ok(true); } for &Range { low, high } in ranges.iter() { if low - fields_pos > 0 { low_idx = match delim_search.nth(low - fields_pos - 1) { - Some((_, beyond_delim)) => beyond_delim, + Some(index) => index + input_delim_len, None => break, }; } for _ in 0..=high - low { if print_delim { - crash_if_err!(1, out.write_all(out_delim.as_bytes())); + out.write_all(out_delim.as_bytes())?; + } else { + print_delim = true; } match delim_search.next() { - Some((high_idx, next_low_idx)) => { + Some(high_idx) => { let segment = &line[low_idx..high_idx]; - crash_if_err!(1, out.write_all(segment)); + out.write_all(segment)?; - print_delim = true; - - low_idx = next_low_idx; + low_idx = high_idx + input_delim_len; fields_pos = high + 1; } None => { let segment = &line[low_idx..]; - crash_if_err!(1, out.write_all(segment)); + out.write_all(segment)?; if line[line.len() - 1] == newline_char { - continue 'newline; + return Ok(true); } break; } @@ -283,9 +243,10 @@ fn cut_fields_delimiter( } } - crash_if_err!(1, out.write_all(&[newline_char])); - } - + out.write_all(&[newline_char])?; + Ok(true) + }); + crash_if_err!(1, result); 0 } @@ -303,23 +264,11 @@ fn cut_fields(reader: R, ranges: &[Range], opts: &FieldOptions) -> i32 ); } - let mut buf_in = BufReader::new(reader); - let mut out = stdout(); - let mut buffer = Vec::new(); + let buf_in = BufReader::new(reader); + let mut out = stdout_writer(); + let delim_len = opts.delimiter.len(); - 'newline: loop { - buffer.clear(); - match buf_in.read_until(newline_char, &mut buffer) { - Ok(n) if n == 0 => break, - Err(e) => { - if buffer.is_empty() { - crash!(1, "read error: {}", e); - } - } - _ => (), - } - - let line = &buffer[..]; + let result = buf_in.for_byte_record_with_terminator(newline_char, |line| { let mut fields_pos = 1; let mut low_idx = 0; let mut delim_search = Searcher::new(line, opts.delimiter.as_bytes()).peekable(); @@ -327,53 +276,54 @@ fn cut_fields(reader: R, ranges: &[Range], opts: &FieldOptions) -> i32 if delim_search.peek().is_none() { if !opts.only_delimited { - crash_if_err!(1, out.write_all(line)); + out.write_all(line)?; if line[line.len() - 1] != newline_char { - crash_if_err!(1, out.write_all(&[newline_char])); + out.write_all(&[newline_char])?; } } - continue; + return Ok(true); } - for &Range { low, high } in ranges.iter() { + for &Range { low, high } in ranges { if low - fields_pos > 0 { - low_idx = match delim_search.nth(low - fields_pos - 1) { - Some((_, beyond_delim)) => beyond_delim, - None => break, - }; - } - - if print_delim && low_idx >= opts.delimiter.as_bytes().len() { - low_idx -= opts.delimiter.as_bytes().len(); + if let Some(delim_pos) = delim_search.nth(low - fields_pos - 1) { + low_idx = if print_delim { + delim_pos + } else { + delim_pos + delim_len + } + } else { + break; + } } match delim_search.nth(high - low) { - Some((high_idx, next_low_idx)) => { + Some(high_idx) => { let segment = &line[low_idx..high_idx]; - crash_if_err!(1, out.write_all(segment)); + out.write_all(segment)?; print_delim = true; - low_idx = next_low_idx; + low_idx = high_idx; fields_pos = high + 1; } None => { let segment = &line[low_idx..line.len()]; - crash_if_err!(1, out.write_all(segment)); + out.write_all(segment)?; if line[line.len() - 1] == newline_char { - continue 'newline; + return Ok(true); } break; } } } - - crash_if_err!(1, out.write_all(&[newline_char])); - } - + out.write_all(&[newline_char])?; + Ok(true) + }); + crash_if_err!(1, result); 0 } diff --git a/src/uu/cut/src/searcher.rs b/src/uu/cut/src/searcher.rs index f0821ff3a..5e3c076df 100644 --- a/src/uu/cut/src/searcher.rs +++ b/src/uu/cut/src/searcher.rs @@ -5,7 +5,8 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -#[derive(Clone)] +use memchr::memchr; + pub struct Searcher<'a> { haystack: &'a [u8], needle: &'a [u8], @@ -14,6 +15,7 @@ pub struct Searcher<'a> { impl<'a> Searcher<'a> { pub fn new(haystack: &'a [u8], needle: &'a [u8]) -> Searcher<'a> { + assert!(!needle.is_empty()); Searcher { haystack, needle, @@ -23,30 +25,81 @@ impl<'a> Searcher<'a> { } impl<'a> Iterator for Searcher<'a> { - type Item = (usize, usize); + type Item = usize; - fn next(&mut self) -> Option<(usize, usize)> { - if self.needle.len() == 1 { - for offset in self.position..self.haystack.len() { - if self.haystack[offset] == self.needle[0] { - self.position = offset + 1; - return Some((offset, offset + 1)); + fn next(&mut self) -> Option { + loop { + if let Some(match_idx) = memchr(self.needle[0], self.haystack) { + if self.needle.len() == 1 + || self.haystack[match_idx + 1..].starts_with(&self.needle[1..]) + { + let skip = match_idx + self.needle.len(); + self.haystack = &self.haystack[skip..]; + let match_pos = self.position + match_idx; + self.position += skip; + return Some(match_pos); + } else { + let skip = match_idx + 1; + self.haystack = &self.haystack[skip..]; + self.position += skip; + // continue } - } - - self.position = self.haystack.len(); - return None; - } - - while self.position + self.needle.len() <= self.haystack.len() { - if &self.haystack[self.position..self.position + self.needle.len()] == self.needle { - let match_pos = self.position; - self.position += self.needle.len(); - return Some((match_pos, match_pos + self.needle.len())); } else { - self.position += 1; + return None; } } - None + } +} + +#[cfg(test)] +mod tests { + + use super::*; + + const NEEDLE: &[u8] = "ab".as_bytes(); + + #[test] + fn test_normal() { + let iter = Searcher::new("a.a.a".as_bytes(), "a".as_bytes()); + let items: Vec = iter.collect(); + assert_eq!(vec![0, 2, 4], items); + } + + #[test] + fn test_empty() { + let iter = Searcher::new("".as_bytes(), "a".as_bytes()); + let items: Vec = iter.collect(); + assert_eq!(vec![] as Vec, items); + } + + fn test_multibyte(line: &[u8], expected: Vec) { + let iter = Searcher::new(line, NEEDLE); + let items: Vec = iter.collect(); + assert_eq!(expected, items); + } + + #[test] + fn test_multibyte_normal() { + test_multibyte("...ab...ab...".as_bytes(), vec![3, 8]); + } + + #[test] + fn test_multibyte_needle_head_at_end() { + test_multibyte("a".as_bytes(), vec![]); + } + + #[test] + fn test_multibyte_starting_needle() { + test_multibyte("ab...ab...".as_bytes(), vec![0, 5]); + } + + #[test] + fn test_multibyte_trailing_needle() { + test_multibyte("...ab...ab".as_bytes(), vec![3, 8]); + } + + #[test] + fn test_multibyte_first_byte_false_match() { + test_multibyte("aA..aCaC..ab..aD".as_bytes(), vec![10]); } } From b8e23c20c213a34a2e13056f4330f747e5e47ecf Mon Sep 17 00:00:00 2001 From: Nicolas Thery Date: Sat, 24 Apr 2021 17:45:28 +0200 Subject: [PATCH 0431/1135] cp: extract linux COW logic into function --- src/uu/cp/src/cp.rs | 77 +++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 34 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index da8c9037e..519590e85 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -155,7 +155,8 @@ pub enum OverwriteMode { NoClobber, } -#[derive(Clone, Eq, PartialEq)] +/// Possible arguments for `--reflink`. +#[derive(Copy, Clone, Eq, PartialEq)] pub enum ReflinkMode { Always, Auto, @@ -1200,39 +1201,7 @@ fn copy_helper(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> return Err("--reflink is only supported on linux".to_string().into()); #[cfg(target_os = "linux")] - { - let src_file = File::open(source).unwrap().into_raw_fd(); - let dst_file = OpenOptions::new() - .write(true) - .truncate(false) - .create(true) - .open(dest) - .unwrap() - .into_raw_fd(); - match options.reflink_mode { - ReflinkMode::Always => unsafe { - let result = ficlone(dst_file, src_file as *const i32); - if result != 0 { - return Err(format!( - "failed to clone {:?} from {:?}: {}", - source, - dest, - std::io::Error::last_os_error() - ) - .into()); - } else { - return Ok(()); - } - }, - ReflinkMode::Auto => unsafe { - let result = ficlone(dst_file, src_file as *const i32); - if result != 0 { - fs::copy(source, dest).context(&*context_for(source, dest))?; - } - }, - ReflinkMode::Never => {} - } - } + copy_on_write_linux(source, dest, options.reflink_mode)?; } else if options.no_dereference && fs::symlink_metadata(&source)?.file_type().is_symlink() { // Here, we will copy the symlink itself (actually, just recreate it) let link = fs::read_link(&source)?; @@ -1265,6 +1234,46 @@ fn copy_helper(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> Ok(()) } +/// Copies `source` to `dest` using copy-on-write if possible. +#[cfg(target_os = "linux")] +fn copy_on_write_linux(source: &Path, dest: &Path, mode: ReflinkMode) -> CopyResult<()> { + debug_assert!(mode != ReflinkMode::Never); + + let src_file = File::open(source).unwrap().into_raw_fd(); + let dst_file = OpenOptions::new() + .write(true) + .truncate(false) + .create(true) + .open(dest) + .unwrap() + .into_raw_fd(); + match mode { + ReflinkMode::Always => unsafe { + let result = ficlone(dst_file, src_file as *const i32); + if result != 0 { + return Err(format!( + "failed to clone {:?} from {:?}: {}", + source, + dest, + std::io::Error::last_os_error() + ) + .into()); + } else { + return Ok(()); + } + }, + ReflinkMode::Auto => unsafe { + let result = ficlone(dst_file, src_file as *const i32); + if result != 0 { + fs::copy(source, dest).context(&*context_for(source, dest))?; + } + }, + ReflinkMode::Never => unreachable!(), + } + + Ok(()) +} + /// Generate an error message if `target` is not the correct `target_type` pub fn verify_target_type(target: &Path, target_type: &TargetType) -> CopyResult<()> { match (target_type, target.is_dir()) { From 4bf33e98a8153891bb3b745b700e96bee0901506 Mon Sep 17 00:00:00 2001 From: Nicolas Thery Date: Sat, 24 Apr 2021 19:20:31 +0200 Subject: [PATCH 0432/1135] cp: add --reflink support for macOS Fixes #1773 --- src/uu/cp/src/cp.rs | 68 +++++++++++++++++++++++++++++++++++++--- tests/by-util/test_cp.rs | 8 ++--- 2 files changed, 68 insertions(+), 8 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 519590e85..ca564e37c 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1193,12 +1193,17 @@ fn copy_file(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> { Ok(()) } -///Copy the file from `source` to `dest` either using the normal `fs::copy` or the -///`FICLONE` ioctl if --reflink is specified and the filesystem supports it. +/// Copy the file from `source` to `dest` either using the normal `fs::copy` or a +/// copy-on-write scheme if --reflink is specified and the filesystem supports it. fn copy_helper(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> { if options.reflink_mode != ReflinkMode::Never { - #[cfg(not(target_os = "linux"))] - return Err("--reflink is only supported on linux".to_string().into()); + #[cfg(not(any(target_os = "linux", target_os = "macos")))] + return Err("--reflink is only supported on linux and macOS" + .to_string() + .into()); + + #[cfg(target_os = "macos")] + copy_on_write_macos(source, dest, options.reflink_mode)?; #[cfg(target_os = "linux")] copy_on_write_linux(source, dest, options.reflink_mode)?; @@ -1274,6 +1279,61 @@ fn copy_on_write_linux(source: &Path, dest: &Path, mode: ReflinkMode) -> CopyRes Ok(()) } +/// Copies `source` to `dest` using copy-on-write if possible. +#[cfg(target_os = "macos")] +fn copy_on_write_macos(source: &Path, dest: &Path, mode: ReflinkMode) -> CopyResult<()> { + debug_assert!(mode != ReflinkMode::Never); + + // Extract paths in a form suitable to be passed to a syscall. + // The unwrap() is safe because they come from the command-line and so contain non nul + // character. + use std::os::unix::ffi::OsStrExt; + let src = CString::new(source.as_os_str().as_bytes()).unwrap(); + let dst = CString::new(dest.as_os_str().as_bytes()).unwrap(); + + // clonefile(2) was introduced in macOS 10.12 so we cannot statically link against it + // for backward compatibility. + let clonefile = CString::new("clonefile").unwrap(); + let raw_pfn = unsafe { libc::dlsym(libc::RTLD_NEXT, clonefile.as_ptr()) }; + + let mut error = 0; + if !raw_pfn.is_null() { + // Call clonefile(2). + // Safety: Casting a C function pointer to a rust function value is one of the few + // blessed uses of `transmute()`. + unsafe { + let pfn: extern "C" fn( + src: *const libc::c_char, + dst: *const libc::c_char, + flags: u32, + ) -> libc::c_int = std::mem::transmute(raw_pfn); + error = pfn(src.as_ptr(), dst.as_ptr(), 0); + if std::io::Error::last_os_error().kind() == std::io::ErrorKind::AlreadyExists { + // clonefile(2) fails if the destination exists. Remove it and try again. Do not + // bother to check if removal worked because we're going to try to clone again. + let _ = fs::remove_file(dest); + error = pfn(src.as_ptr(), dst.as_ptr(), 0); + } + } + } + + if raw_pfn.is_null() || error != 0 { + // clonefile(2) is not supported or it error'ed out (possibly because the FS does not + // support COW). + match mode { + ReflinkMode::Always => { + return Err( + format!("failed to clone {:?} from {:?}: {}", source, dest, error).into(), + ) + } + ReflinkMode::Auto => fs::copy(source, dest).context(&*context_for(source, dest))?, + ReflinkMode::Never => unreachable!(), + }; + } + + Ok(()) +} + /// Generate an error message if `target` is not the correct `target_type` pub fn verify_target_type(target: &Path, target_type: &TargetType) -> CopyResult<()> { match (target_type, target.is_dir()) { diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 53c16e677..1e99da0fb 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -967,7 +967,7 @@ fn test_cp_one_file_system() { } #[test] -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "macos"))] fn test_cp_reflink_always() { let (at, mut ucmd) = at_and_ucmd!(); let result = ucmd @@ -985,7 +985,7 @@ fn test_cp_reflink_always() { } #[test] -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "macos"))] fn test_cp_reflink_auto() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.arg("--reflink=auto") @@ -998,7 +998,7 @@ fn test_cp_reflink_auto() { } #[test] -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "macos"))] fn test_cp_reflink_never() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.arg("--reflink=never") @@ -1011,7 +1011,7 @@ fn test_cp_reflink_never() { } #[test] -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "macos"))] fn test_cp_reflink_bad() { let (_, mut ucmd) = at_and_ucmd!(); let _result = ucmd From ce04f8a759641250b7d13987cb8caeffb5f78254 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 24 Apr 2021 23:46:19 +0200 Subject: [PATCH 0433/1135] ls: use bufwriter to write stdout --- src/uu/ls/src/ls.rs | 85 ++++++++++++++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 28 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 2baf93193..eff7fbb77 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -24,16 +24,22 @@ use once_cell::unsync::OnceCell; use quoting_style::{escape_name, QuotingStyle}; #[cfg(unix)] use std::collections::HashMap; -use std::fs::{self, DirEntry, FileType, Metadata}; #[cfg(any(unix, target_os = "redox"))] use std::os::unix::fs::{FileTypeExt, MetadataExt}; #[cfg(windows)] use std::os::windows::fs::MetadataExt; -use std::path::{Path, PathBuf}; #[cfg(unix)] use std::time::Duration; -use std::time::{SystemTime, UNIX_EPOCH}; use std::{cmp::Reverse, process::exit}; +use std::{ + fs::{self, DirEntry, FileType, Metadata}, + io::{stdout, BufWriter, Write}, + path::{Path, PathBuf}, +}; +use std::{ + io::Stdout, + time::{SystemTime, UNIX_EPOCH}, +}; use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use time::{strftime, Timespec}; @@ -1092,6 +1098,8 @@ fn list(locs: Vec, config: Config) -> i32 { let mut dirs = Vec::::new(); let mut has_failed = false; + let mut out = BufWriter::new(stdout()); + for loc in locs { let p = PathBuf::from(&loc); if !p.exists() { @@ -1118,14 +1126,14 @@ fn list(locs: Vec, config: Config) -> i32 { } } sort_entries(&mut files, &config); - display_items(&files, None, &config); + display_items(&files, None, &config, &mut out); sort_entries(&mut dirs, &config); for dir in dirs { if number_of_locs > 1 { - println!("\n{}:", dir.p_buf.display()); + let _ = writeln!(out, "\n{}:", dir.p_buf.display()); } - enter_directory(&dir, &config); + enter_directory(&dir, &config, &mut out); } if has_failed { 1 @@ -1178,7 +1186,7 @@ fn should_display(entry: &DirEntry, config: &Config) -> bool { !config.ignore_patterns.is_match(&ffi_name) } -fn enter_directory(dir: &PathData, config: &Config) { +fn enter_directory(dir: &PathData, config: &Config, out: &mut BufWriter) { let mut entries: Vec<_> = if config.files == Files::All { vec![ PathData::new(dir.p_buf.join("."), None, config, false), @@ -1198,7 +1206,7 @@ fn enter_directory(dir: &PathData, config: &Config) { entries.append(&mut temp); - display_items(&entries, Some(&dir.p_buf), config); + display_items(&entries, Some(&dir.p_buf), config, out); if config.recursive { for e in entries @@ -1206,8 +1214,8 @@ fn enter_directory(dir: &PathData, config: &Config) { .skip(if config.files == Files::All { 2 } else { 0 }) .filter(|p| p.file_type().map(|ft| ft.is_dir()).unwrap_or(false)) { - println!("\n{}:", e.p_buf.display()); - enter_directory(&e, config); + let _ = writeln!(out, "\n{}:", e.p_buf.display()); + enter_directory(&e, config, out); } } } @@ -1235,7 +1243,12 @@ fn pad_left(string: String, count: usize) -> String { format!("{:>width$}", string, width = count) } -fn display_items(items: &[PathData], strip: Option<&Path>, config: &Config) { +fn display_items( + items: &[PathData], + strip: Option<&Path>, + config: &Config, + out: &mut BufWriter, +) { if config.format == Format::Long { let (mut max_links, mut max_size) = (1, 1); for item in items { @@ -1244,7 +1257,7 @@ fn display_items(items: &[PathData], strip: Option<&Path>, config: &Config) { max_size = size.max(max_size); } for item in items { - display_item_long(item, strip, max_links, max_size, config); + display_item_long(item, strip, max_links, max_size, config, out); } } else { let names = items @@ -1252,42 +1265,51 @@ fn display_items(items: &[PathData], strip: Option<&Path>, config: &Config) { .filter_map(|i| display_file_name(&i, strip, config)); match (&config.format, config.width) { - (Format::Columns, Some(width)) => display_grid(names, width, Direction::TopToBottom), - (Format::Across, Some(width)) => display_grid(names, width, Direction::LeftToRight), + (Format::Columns, Some(width)) => { + display_grid(names, width, Direction::TopToBottom, out) + } + (Format::Across, Some(width)) => { + display_grid(names, width, Direction::LeftToRight, out) + } (Format::Commas, width_opt) => { let term_width = width_opt.unwrap_or(1); let mut current_col = 0; let mut names = names; if let Some(name) = names.next() { - print!("{}", name.contents); + let _ = write!(out, "{}", name.contents); current_col = name.width as u16 + 2; } for name in names { let name_width = name.width as u16; if current_col + name_width + 1 > term_width { current_col = name_width + 2; - print!(",\n{}", name.contents); + let _ = write!(out, ",\n{}", name.contents); } else { current_col += name_width + 2; - print!(", {}", name.contents); + let _ = write!(out, ", {}", name.contents); } } // Current col is never zero again if names have been printed. // So we print a newline. if current_col > 0 { - println!(); + let _ = writeln!(out,); } } _ => { for name in names { - println!("{}", name.contents); + let _ = writeln!(out, "{}", name.contents); } } } } } -fn display_grid(names: impl Iterator, width: u16, direction: Direction) { +fn display_grid( + names: impl Iterator, + width: u16, + direction: Direction, + out: &mut BufWriter, +) { let mut grid = Grid::new(GridOptions { filling: Filling::Spaces(2), direction, @@ -1298,9 +1320,13 @@ fn display_grid(names: impl Iterator, width: u16, direction: Direct } match grid.fit_into_width(width as usize) { - Some(output) => print!("{}", output), + Some(output) => { + let _ = write!(out, "{}", output); + } // Width is too small for the grid, so we fit it in one column - None => print!("{}", grid.fit_into_columns(1)), + None => { + let _ = write!(out, "{}", grid.fit_into_columns(1)); + } } } @@ -1312,6 +1338,7 @@ fn display_item_long( max_links: usize, max_size: usize, config: &Config, + out: &mut BufWriter, ) { let md = match item.md() { None => { @@ -1325,11 +1352,12 @@ fn display_item_long( #[cfg(unix)] { if config.inode { - print!("{} ", get_inode(&md)); + let _ = write!(out, "{} ", get_inode(&md)); } } - print!( + let _ = write!( + out, "{}{} {}", display_file_type(md.file_type()), display_permissions(&md), @@ -1337,20 +1365,21 @@ fn display_item_long( ); if config.long.owner { - print!(" {}", display_uname(&md, config)); + let _ = write!(out, " {}", display_uname(&md, config)); } if config.long.group { - print!(" {}", display_group(&md, config)); + let _ = write!(out, " {}", display_group(&md, config)); } // Author is only different from owner on GNU/Hurd, so we reuse // the owner, since GNU/Hurd is not currently supported by Rust. if config.long.author { - print!(" {}", display_uname(&md, config)); + let _ = write!(out, " {}", display_uname(&md, config)); } - println!( + let _ = writeln!( + out, " {} {} {}", pad_left(display_file_size(&md, config), max_size), display_date(&md, config), From e995eea5799c7cb87cefa6baeb8af00e03876108 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 25 Apr 2021 00:23:14 +0200 Subject: [PATCH 0434/1135] ls: general cleanup --- src/uu/ls/src/ls.rs | 90 +++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 56 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index eff7fbb77..6abaaa0b9 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -92,10 +92,8 @@ pub mod options { pub static C: &str = "quote-name"; } pub static QUOTING_STYLE: &str = "quoting-style"; - pub mod indicator_style { - pub static NONE: &str = "none"; - pub static SLASH: &str = "slash"; + pub static SLASH: &str = "p"; pub static FILE_TYPE: &str = "file-type"; pub static CLASSIFY: &str = "classify"; } @@ -114,9 +112,6 @@ pub mod options { pub static TIME: &str = "time"; pub static IGNORE_BACKUPS: &str = "ignore-backups"; pub static DIRECTORY: &str = "directory"; - pub static CLASSIFY: &str = "classify"; - pub static FILE_TYPE: &str = "file-type"; - pub static SLASH: &str = "p"; pub static INODE: &str = "inode"; pub static REVERSE: &str = "reverse"; pub static RECURSIVE: &str = "recursive"; @@ -431,19 +426,11 @@ impl Config { "slash" => IndicatorStyle::Slash, &_ => IndicatorStyle::None, } - } else if options.is_present(options::indicator_style::NONE) { - IndicatorStyle::None - } else if options.is_present(options::indicator_style::CLASSIFY) - || options.is_present(options::CLASSIFY) - { + } else if options.is_present(options::indicator_style::CLASSIFY) { IndicatorStyle::Classify - } else if options.is_present(options::indicator_style::SLASH) - || options.is_present(options::SLASH) - { + } else if options.is_present(options::indicator_style::SLASH) { IndicatorStyle::Slash - } else if options.is_present(options::indicator_style::FILE_TYPE) - || options.is_present(options::FILE_TYPE) - { + } else if options.is_present(options::indicator_style::FILE_TYPE) { IndicatorStyle::FileType } else { IndicatorStyle::None @@ -969,45 +956,45 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .possible_values(&["none", "slash", "file-type", "classify"]) .overrides_with_all(&[ - options::FILE_TYPE, - options::SLASH, - options::CLASSIFY, + options::indicator_style::FILE_TYPE, + options::indicator_style::SLASH, + options::indicator_style::CLASSIFY, options::INDICATOR_STYLE, ])) .arg( - Arg::with_name(options::CLASSIFY) + Arg::with_name(options::indicator_style::CLASSIFY) .short("F") - .long(options::CLASSIFY) + .long(options::indicator_style::CLASSIFY) .help("Append a character to each file name indicating the file type. Also, for \ regular files that are executable, append '*'. The file type indicators are \ '/' for directories, '@' for symbolic links, '|' for FIFOs, '=' for sockets, \ '>' for doors, and nothing for regular files.") .overrides_with_all(&[ - options::FILE_TYPE, - options::SLASH, - options::CLASSIFY, + options::indicator_style::FILE_TYPE, + options::indicator_style::SLASH, + options::indicator_style::CLASSIFY, options::INDICATOR_STYLE, ]) ) .arg( - Arg::with_name(options::FILE_TYPE) - .long(options::FILE_TYPE) + Arg::with_name(options::indicator_style::FILE_TYPE) + .long(options::indicator_style::FILE_TYPE) .help("Same as --classify, but do not append '*'") .overrides_with_all(&[ - options::FILE_TYPE, - options::SLASH, - options::CLASSIFY, + options::indicator_style::FILE_TYPE, + options::indicator_style::SLASH, + options::indicator_style::CLASSIFY, options::INDICATOR_STYLE, ])) .arg( - Arg::with_name(options::SLASH) - .short(options::SLASH) + Arg::with_name(options::indicator_style::SLASH) + .short(options::indicator_style::SLASH) .help("Append / indicator to directories." ) .overrides_with_all(&[ - options::FILE_TYPE, - options::SLASH, - options::CLASSIFY, + options::indicator_style::FILE_TYPE, + options::indicator_style::SLASH, + options::indicator_style::CLASSIFY, options::INDICATOR_STYLE, ])) @@ -1409,14 +1396,10 @@ fn cached_uid2usr(uid: u32) -> String { } let mut uid_cache = UID_CACHE.lock().unwrap(); - match uid_cache.get(&uid) { - Some(usr) => usr.clone(), - None => { - let usr = entries::uid2usr(uid).unwrap_or_else(|_| uid.to_string()); - uid_cache.insert(uid, usr.clone()); - usr - } - } + uid_cache + .entry(uid) + .or_insert_with(|| entries::uid2usr(uid).unwrap_or_else(|_| uid.to_string())) + .clone() } #[cfg(unix)] @@ -1435,14 +1418,10 @@ fn cached_gid2grp(gid: u32) -> String { } let mut gid_cache = GID_CACHE.lock().unwrap(); - match gid_cache.get(&gid) { - Some(grp) => grp.clone(), - None => { - let grp = entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string()); - gid_cache.insert(gid, grp.clone()); - grp - } - } + gid_cache + .entry(gid) + .or_insert_with(|| entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string())) + .clone() } #[cfg(unix)] @@ -1460,7 +1439,6 @@ fn display_uname(_metadata: &Metadata, _config: &Config) -> String { } #[cfg(not(unix))] -#[allow(unused_variables)] fn display_group(_metadata: &Metadata, _config: &Config) -> String { "somegroup".to_string() } @@ -1535,13 +1513,13 @@ fn display_file_size(metadata: &Metadata, config: &Config) -> String { } } -fn display_file_type(file_type: FileType) -> String { +fn display_file_type(file_type: FileType) -> char { if file_type.is_dir() { - "d".to_string() + 'd' } else if file_type.is_symlink() { - "l".to_string() + 'l' } else { - "-".to_string() + '-' } } From 2b8a6e98eeed5d86a5af8a0a87df2d04dca55a0a Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 00:20:56 -0500 Subject: [PATCH 0435/1135] Working ExtSort --- Cargo.lock | 2 +- src/uu/sort/Cargo.toml | 2 +- src/uu/sort/src/ext_sorter/LICENSE | 202 --------------------- src/uu/sort/src/ext_sorter/NOTICE | 9 - src/uu/sort/src/ext_sorter/mod.rs | 277 ----------------------------- src/uu/sort/src/sort.rs | 108 +++++------ 6 files changed, 47 insertions(+), 553 deletions(-) delete mode 100644 src/uu/sort/src/ext_sorter/LICENSE delete mode 100644 src/uu/sort/src/ext_sorter/NOTICE delete mode 100644 src/uu/sort/src/ext_sorter/mod.rs diff --git a/Cargo.lock b/Cargo.lock index eb99af34b..d5dbf3508 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2305,7 +2305,7 @@ dependencies = [ "serde", "serde_json", "smallvec 1.6.1", - "tempfile", + "tempdir", "uucore", "uucore_procs", ] diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index f29df6ab8..12c685e23 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -26,7 +26,7 @@ semver = "0.9.0" smallvec = { version = "1.6.1", features = ["serde"] } uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } -tempfile = "3.1.0" +tempdir = "0.3.7" [[bin]] name = "sort" diff --git a/src/uu/sort/src/ext_sorter/LICENSE b/src/uu/sort/src/ext_sorter/LICENSE deleted file mode 100644 index fe647bd7f..000000000 --- a/src/uu/sort/src/ext_sorter/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. \ No newline at end of file diff --git a/src/uu/sort/src/ext_sorter/NOTICE b/src/uu/sort/src/ext_sorter/NOTICE deleted file mode 100644 index fdfc6f04f..000000000 --- a/src/uu/sort/src/ext_sorter/NOTICE +++ /dev/null @@ -1,9 +0,0 @@ -ext_sorter -Copyright 2018 Andre-Philippe Paquet -Modifications copyright 2021 Robert Swinford - -This ext_sorter module includes software developed by Andre-Philippe Paquet as extsort. - -The sorter.rs file was copied and modified for use in the uutils' coreutils subproject, sort. - -sort is licensed according to the term of the LICENSE file found in root directory of the uutils' coreutils project. \ No newline at end of file diff --git a/src/uu/sort/src/ext_sorter/mod.rs b/src/uu/sort/src/ext_sorter/mod.rs deleted file mode 100644 index a90be6bb0..000000000 --- a/src/uu/sort/src/ext_sorter/mod.rs +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright 2018 Andre-Philippe Paquet -// Modifications copyright 2021 Robert Swinford -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// This file has been modified for use in the uutils' coreutils subproject, sort. - -use rayon::prelude::*; -use std::{ - cmp::Ordering, - collections::VecDeque, - fs::{File, OpenOptions}, - io::{BufReader, BufWriter, Error, Read, Seek, SeekFrom, Write}, - path::{Path, PathBuf}, -}; - -/// Exposes external sorting (i.e. on disk sorting) capability on arbitrarily -/// sized iterator, even if the generated content of the iterator doesn't fit in -/// memory. -/// -/// It uses an in-memory buffer sorted and flushed to disk in segment files when -/// full. Once sorted, it returns a new sorted iterator with all items. In order -/// to remain efficient for all implementations, the crate doesn't handle -/// serialization, but leaves that to the user. -pub struct ExternalSorter { - segment_size: usize, - sort_dir: Option, - parallel: bool, -} - -impl ExternalSorter { - pub fn new() -> ExternalSorter { - ExternalSorter { - // Default is 16G - But we never use it, - // because we always set or ignore - segment_size: 16000000000, - sort_dir: None, - parallel: false, - } - } - - /// Sets the maximum size of each segment in number of sorted items. - /// - /// This number of items needs to fit in memory. While sorting, a - /// in-memory buffer is used to collect the items to be sorted. Once - /// it reaches the maximum size, it is sorted and then written to disk. - /// - /// Using a higher segment size makes sorting faster by leveraging - /// faster in-memory operations. - pub fn with_segment_size(mut self, size: usize) -> Self { - self.segment_size = size; - self - } - - /// Sets directory in which sorted segments will be written (if it doesn't - /// fit in memory). - pub fn with_sort_dir(mut self, path: PathBuf) -> Self { - self.sort_dir = Some(path); - self - } - - /// Uses Rayon to sort the in-memory buffer. - /// - /// This may not be needed if the buffer isn't big enough for parallelism to - /// be gainful over the overhead of multithreading. - pub fn with_parallel_sort(mut self) -> Self { - self.parallel = true; - self - } - - /// Sorts a given iterator with a comparator function, returning a new iterator with items - pub fn sort_by(&self, iterator: I, cmp: F) -> Result, Error> - where - T: Sortable, - I: Iterator, - F: Fn(&T, &T) -> Ordering + Send + Sync, - { - let mut tempdir: Option = None; - let mut sort_dir: Option = None; - - let mut count = 0; - let mut segments_file: Vec = Vec::new(); - - let size_of_items = std::mem::size_of::(); - // Get size of iterator - let (_, upper_bound) = iterator.size_hint(); - // Buffer size specified + minimum overhead of struct / size of items - let initial_capacity = (self.segment_size + (upper_bound.unwrap() * size_of_items)) / size_of_items; - let mut buffer: Vec = Vec::with_capacity(initial_capacity); - - for next_item in iterator { - count += 1; - buffer.push(next_item); - // if after push, number of elements in vector > initial capacity - if buffer.len() > initial_capacity { - let sort_dir = self.lazy_create_dir(&mut tempdir, &mut sort_dir)?; - self.sort_and_write_segment(sort_dir, &mut segments_file, &mut buffer, &cmp)?; - // Truncate buffer back to initial capacity - buffer.truncate(initial_capacity); - } - } - - // Write any items left in buffer, but only if we had at least 1 segment - // written. Otherwise we use the buffer itself to iterate from memory - let pass_through_queue = if !buffer.is_empty() && !segments_file.is_empty() { - let sort_dir = self.lazy_create_dir(&mut tempdir, &mut sort_dir)?; - self.sort_and_write_segment(sort_dir, &mut segments_file, &mut buffer, &cmp)?; - None - } else { - buffer.sort_by(&cmp); - Some(VecDeque::from(buffer)) - }; - - SortedIterator::new(tempdir, pass_through_queue, segments_file, count, cmp) - } - - /// We only want to create directory if it's needed (i.e. if the dataset - /// doesn't fit in memory) to prevent filesystem latency - fn lazy_create_dir<'a>( - &self, - tempdir: &mut Option, - sort_dir: &'a mut Option, - ) -> Result<&'a Path, Error> { - if let Some(sort_dir) = sort_dir { - return Ok(sort_dir); - } - - *sort_dir = if let Some(ref sort_dir) = self.sort_dir { - Some(sort_dir.to_path_buf()) - } else { - *tempdir = Some(tempfile::TempDir::new()?); - Some(tempdir.as_ref().unwrap().path().to_path_buf()) - }; - - Ok(sort_dir.as_ref().unwrap()) - } - - fn sort_and_write_segment( - &self, - sort_dir: &Path, - segments: &mut Vec, - buffer: &mut Vec, - cmp: F, - ) -> Result<(), Error> - where - T: Sortable, - F: Fn(&T, &T) -> Ordering + Send + Sync, - { - if self.parallel { - buffer.par_sort_by(|a, b| cmp(a, b)); - } else { - buffer.sort_by(|a, b| cmp(a, b)); - } - - let segment_path = sort_dir.join(format!("{}", segments.len())); - let segment_file = OpenOptions::new() - .create(true) - .truncate(true) - .read(true) - .write(true) - .open(&segment_path)?; - let mut buf_writer = BufWriter::new(segment_file); - - // Possible panic here. - // Why use drain here, if we want to dump the entire buffer? - // Was "buffer.drain(0..)" - for item in buffer { - item.encode(&mut buf_writer); - } - - let file = buf_writer.into_inner()?; - segments.push(file); - - Ok(()) - } -} - -impl Default for ExternalSorter { - fn default() -> Self { - ExternalSorter::new() - } -} - -pub trait Sortable: Sized + Send { - fn encode(&self, writer: &mut W); - fn decode(reader: &mut R) -> Option; -} - -pub struct SortedIterator { - _tempdir: Option, - pass_through_queue: Option>, - segments_file: Vec>, - next_values: Vec>, - count: u64, - cmp: F, -} - -impl Ordering + Send + Sync> SortedIterator { - fn new( - tempdir: Option, - pass_through_queue: Option>, - mut segments_file: Vec, - count: u64, - cmp: F, - ) -> Result, Error> { - for segment in &mut segments_file { - segment.seek(SeekFrom::Start(0))?; - } - - let next_values = segments_file - .iter_mut() - .map(|file| T::decode(file)) - .collect(); - - let segments_file_buffered = segments_file.into_iter().map(BufReader::new).collect(); - - Ok(SortedIterator { - _tempdir: tempdir, - pass_through_queue, - segments_file: segments_file_buffered, - next_values, - count, - cmp, - }) - } - - pub fn sorted_count(&self) -> u64 { - self.count - } -} - -impl Ordering> Iterator for SortedIterator { - type Item = T; - - fn next(&mut self) -> Option { - // if we have a pass through, we dequeue from it directly - if let Some(ptb) = self.pass_through_queue.as_mut() { - return ptb.pop_front(); - } - - // otherwise, we iter from segments on disk - let mut smallest_idx: Option = None; - { - let mut smallest: Option<&T> = None; - for idx in 0..self.segments_file.len() { - let next_value = self.next_values[idx].as_ref(); - if next_value.is_none() { - continue; - } - - if smallest.is_none() - || (self.cmp)(next_value.unwrap(), smallest.unwrap()) == Ordering::Less - { - smallest = Some(next_value.unwrap()); - smallest_idx = Some(idx); - } - } - } - - smallest_idx.map(|idx| { - let file = &mut self.segments_file[idx]; - let value = self.next_values[idx].take().unwrap(); - self.next_values[idx] = T::decode(file); - value - }) - } -} diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 571541fc6..8c3a0cf7f 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -15,11 +15,11 @@ #[macro_use] extern crate uucore; -mod ext_sorter; mod numeric_str_cmp; +mod external_sort; +use external_sort::{ExternalSorter, ExternallySortable}; use clap::{App, Arg}; -use ext_sorter::{ExternalSorter, Sortable}; use fnv::FnvHasher; use itertools::Itertools; use numeric_str_cmp::{numeric_str_cmp, NumInfo, NumInfoParseSettings}; @@ -27,7 +27,7 @@ use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; use rayon::prelude::*; use semver::Version; -use serde::{Deserialize, Serialize}; +use serde::{Deserializer, Deserialize, Serialize}; use smallvec::SmallVec; use std::borrow::Cow; use std::cmp::Ordering; @@ -103,7 +103,7 @@ enum SortMode { Version, Default, } - +#[derive(Clone)] struct GlobalSettings { mode: SortMode, ignore_blanks: bool, @@ -176,7 +176,7 @@ impl Default for GlobalSettings { } } } - +#[derive(Clone)] struct KeySettings { mode: SortMode, ignore_blanks: bool, @@ -201,7 +201,7 @@ impl From<&GlobalSettings> for KeySettings { } } -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] +#[derive(Debug, Serialize, Deserialize, Clone)] /// Represents the string selected by a FieldSelector. enum SelectionRange { /// If we had to transform this selection, we have to store a new string. @@ -232,13 +232,23 @@ impl SelectionRange { } } } -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] + +#[derive(Debug, Serialize, Deserialize, Clone)] enum NumCache { + #[serde(deserialize_with="bailout_parse_f64")] AsF64(f64), WithInfo(NumInfo), None, } +// Only used when serde can't parse a null value +fn bailout_parse_f64<'de, D>(d: D) -> Result where D: Deserializer<'de> { + Deserialize::deserialize(d) + .map(|x: Option<_>| { + x.unwrap_or(0f64) + }) +} + impl NumCache { fn as_f64(&self) -> f64 { match self { @@ -253,7 +263,7 @@ impl NumCache { } } } -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] +#[derive(Debug, Serialize, Deserialize, Clone)] struct Selection { range: SelectionRange, num_cache: NumCache, @@ -267,56 +277,29 @@ impl Selection { } type Field = Range; -#[derive(Debug, Serialize, Deserialize)] + +#[derive(Serialize, Deserialize, Clone)] struct Line { line: String, // The common case is not to specify fields. Let's make this fast. selections: SmallVec<[Selection; 1]>, } -impl Sortable for Line { - fn encode(&self, write: &mut W) { - let line = Line { - line: self.line.to_owned(), - selections: self.selections.to_owned(), - }; - let serialized = serde_json::to_string(&line).unwrap(); - // Each instance of valid JSON needs to be seperated by something, so here we use a newline - write - .write_all(format!("{}{}", serialized, "\n").as_bytes()) - .unwrap(); - } - - // This crate asks us to write one Line struct at a time, but then returns multiple Lines to us at once. - // We concatanate them and return them as one big Line here. - fn decode(read: &mut R) -> Option { - let buf_reader = BufReader::new(read); - let result = { - let mut line_joined = String::new(); - // Return an empty vec for selections - let selections_joined = SmallVec::new(); - let mut p_iter = buf_reader.lines().peekable(); - while let Some(line) = p_iter.next() { - let deserialized_line: Line = - serde_json::from_str(&line.as_ref().unwrap()).unwrap(); - if let Some(_next_line) = p_iter.peek() { - line_joined = format!("{}\n{}\n", line_joined, deserialized_line.line) - } else { - line_joined = format!("{}\n{}", line_joined, deserialized_line.line) - } - // I think we've done our sorting already and these selctions are irrelevant? - // @miDeb what's your sense? Could we just return an empty vec? - //selections_joined.append(&mut deserialized_line.selections); - } - Some(Line { - line: line_joined, - selections: selections_joined, - }) - }; - result +impl ExternallySortable for Line { + fn get_size(&self) -> u64 { + // Currently 96 bytes, but that could change, so we get that size here + std::mem::size_of::() as u64 } } +impl PartialEq for Line { + fn eq(&self, other: &Self) -> bool { + self.line == other.line + } +} + +impl Eq for Line {} + impl Line { fn new(line: String, settings: &GlobalSettings) -> Self { let fields = if settings @@ -449,6 +432,7 @@ fn tokenize_with_separator(line: &str, separator: char) -> Vec { tokens } +#[derive(Clone)] struct KeyPosition { /// 1-indexed, 0 is invalid. field: usize, @@ -516,7 +500,7 @@ impl KeyPosition { } } } - +#[derive(Clone)] struct FieldSelector { from: KeyPosition, to: Option, @@ -1014,10 +998,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }); } - exec(files, &settings) + exec(files, settings) } -fn exec(files: Vec, settings: &GlobalSettings) -> i32 { +fn exec(files: Vec, settings: GlobalSettings) -> i32 { let mut lines = Vec::new(); let mut file_merger = FileMerger::new(&settings); @@ -1059,7 +1043,7 @@ fn exec(files: Vec, settings: &GlobalSettings) -> i32 { // Probably faster that we don't create // an owned value each run if settings.buffer_size != DEFAULT_BUF_SIZE { - lines = ext_sort_by(lines, &settings); + lines = ext_sort_by(lines, settings.clone()); } else { sort_by(&mut lines, &settings); } @@ -1074,7 +1058,7 @@ fn exec(files: Vec, settings: &GlobalSettings) -> i32 { print_sorted( lines .into_iter() - .dedup_by(|a, b| compare_by(a, b, settings) == Ordering::Equal) + .dedup_by(|a, b| compare_by(a, b, &settings) == Ordering::Equal) .map(|line| line.line), &settings, ) @@ -1117,15 +1101,13 @@ fn exec_check_file(unwrapped_lines: &[Line], settings: &GlobalSettings) -> i32 { } } -fn ext_sort_by(lines: Vec, settings: &GlobalSettings) -> Vec { - let sorter = ExternalSorter::new() - .with_segment_size(settings.buffer_size) - .with_sort_dir(settings.tmp_dir.clone()) - .with_parallel_sort(); - sorter - .sort_by(lines.into_iter(), |a, b| compare_by(a, b, &settings)) - .unwrap() - .collect() +fn ext_sort_by(unsorted: Vec, settings: GlobalSettings) -> Vec { + let external_sorter = ExternalSorter::new(settings.buffer_size as u64, Some(settings.tmp_dir.clone()), settings.clone()); + let iter = external_sorter.sort_by(unsorted.into_iter(), settings.clone()).unwrap(); + let vec = iter.filter(|x| x.is_ok() ) + .map(|x| x.unwrap()) + .collect::>(); + vec } fn sort_by(lines: &mut Vec, settings: &GlobalSettings) { From 7e06316ece2606d89bf6f1bef50fff8a11b63e8f Mon Sep 17 00:00:00 2001 From: Anup Mahindre Date: Sun, 25 Apr 2021 13:37:07 +0530 Subject: [PATCH 0436/1135] ls: Use sort_by_cached_key --- src/uu/ls/src/ls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 2baf93193..e3728d2a4 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1147,7 +1147,7 @@ fn sort_entries(entries: &mut Vec, config: &Config) { entries.sort_by_key(|k| Reverse(k.md().as_ref().map(|md| md.len()).unwrap_or(0))) } // The default sort in GNU ls is case insensitive - Sort::Name => entries.sort_by_key(|k| k.file_name.to_lowercase()), + Sort::Name => entries.sort_by_cached_key(|k| k.file_name.to_lowercase()), Sort::Version => entries.sort_by(|k, j| version_cmp::version_cmp(&k.p_buf, &j.p_buf)), Sort::None => {} } From fc6c7a279ea17145476fc1b7af0b22c21b3cd47d Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 25 Apr 2021 10:46:51 +0200 Subject: [PATCH 0437/1135] ls: clean up imports --- src/uu/ls/src/ls.rs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 6abaaa0b9..73f350f45 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -22,25 +22,22 @@ use lscolors::LsColors; use number_prefix::NumberPrefix; use once_cell::unsync::OnceCell; use quoting_style::{escape_name, QuotingStyle}; -#[cfg(unix)] -use std::collections::HashMap; -#[cfg(any(unix, target_os = "redox"))] -use std::os::unix::fs::{FileTypeExt, MetadataExt}; #[cfg(windows)] use std::os::windows::fs::MetadataExt; -#[cfg(unix)] -use std::time::Duration; -use std::{cmp::Reverse, process::exit}; use std::{ + cmp::Reverse, fs::{self, DirEntry, FileType, Metadata}, - io::{stdout, BufWriter, Write}, + io::{stdout, BufWriter, Stdout, Write}, path::{Path, PathBuf}, -}; -use std::{ - io::Stdout, + process::exit, time::{SystemTime, UNIX_EPOCH}, }; - +#[cfg(unix)] +use std::{ + collections::HashMap, + os::unix::fs::{FileTypeExt, MetadataExt}, + time::Duration, +}; use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use time::{strftime, Timespec}; #[cfg(unix)] From 9f6a8815923157674bfb812ef9982ffdf0f69c2d Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 25 Apr 2021 13:46:57 +0100 Subject: [PATCH 0438/1135] improve assert error messages --- tests/by-util/test_truncate.rs | 44 +++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index b033385de..d0a93f871 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -6,26 +6,31 @@ static TFILE2: &'static str = "truncate_test_2"; #[test] fn test_increase_file_size() { + let expected = 5 * 1024; let (at, mut ucmd) = at_and_ucmd!(); let mut file = at.make_file(TFILE1); ucmd.args(&["-s", "+5K", TFILE1]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); - assert!(file.seek(SeekFrom::Current(0)).unwrap() == 5 * 1024); + let actual = file.seek(SeekFrom::Current(0)).unwrap(); + assert!(expected == actual, "expected '{}' got '{}'", expected, actual); } #[test] fn test_increase_file_size_kb() { + let expected = 5 * 1000; let (at, mut ucmd) = at_and_ucmd!(); let mut file = at.make_file(TFILE1); ucmd.args(&["-s", "+5KB", TFILE1]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); - assert!(file.seek(SeekFrom::Current(0)).unwrap() == 5 * 1000); + let actual = file.seek(SeekFrom::Current(0)).unwrap(); + assert!(expected == actual, "expected '{}' got '{}'", expected, actual); } #[test] fn test_reference() { + let expected = 5 * 1000; let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; let mut file = at.make_file(TFILE2); @@ -40,27 +45,32 @@ fn test_reference() { .run(); file.seek(SeekFrom::End(0)).unwrap(); - assert!(file.seek(SeekFrom::Current(0)).unwrap() == 5 * 1000); + let actual = file.seek(SeekFrom::Current(0)).unwrap(); + assert!(expected == actual, "expected '{}' got '{}'", expected, actual); } #[test] fn test_decrease_file_size() { + let expected = 6; let (at, mut ucmd) = at_and_ucmd!(); let mut file = at.make_file(TFILE2); file.write_all(b"1234567890").unwrap(); ucmd.args(&["--size=-4", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); - assert!(file.seek(SeekFrom::Current(0)).unwrap() == 6); + let actual = file.seek(SeekFrom::Current(0)).unwrap(); + assert!(expected == actual, "expected '{}' got '{}'", expected, actual); } #[test] fn test_space_in_size() { + let expected = 4; let (at, mut ucmd) = at_and_ucmd!(); let mut file = at.make_file(TFILE2); file.write_all(b"1234567890").unwrap(); ucmd.args(&["--size", " 4", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); - assert!(file.seek(SeekFrom::Current(0)).unwrap() == 4); + let actual = file.seek(SeekFrom::Current(0)).unwrap(); + assert!(expected == actual, "expected '{}' got '{}'", expected, actual); } #[test] @@ -82,60 +92,72 @@ fn test_failed_incorrect_arg() { #[test] fn test_at_most_shrinks() { + let expected = 4; let (at, mut ucmd) = at_and_ucmd!(); let mut file = at.make_file(TFILE2); file.write_all(b"1234567890").unwrap(); ucmd.args(&["--size", "<4", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); - assert!(file.seek(SeekFrom::Current(0)).unwrap() == 4); + let actual = file.seek(SeekFrom::Current(0)).unwrap(); + assert!(expected == actual, "expected '{}' got '{}'", expected, actual); } #[test] fn test_at_most_no_change() { + let expected = 10; let (at, mut ucmd) = at_and_ucmd!(); let mut file = at.make_file(TFILE2); file.write_all(b"1234567890").unwrap(); ucmd.args(&["--size", "<40", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); - assert!(file.seek(SeekFrom::Current(0)).unwrap() == 10); + let actual = file.seek(SeekFrom::Current(0)).unwrap(); + assert!(expected == actual, "expected '{}' got '{}'", expected, actual); } #[test] fn test_at_least_grows() { + let expected = 15; let (at, mut ucmd) = at_and_ucmd!(); let mut file = at.make_file(TFILE2); file.write_all(b"1234567890").unwrap(); ucmd.args(&["--size", ">15", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); - assert!(file.seek(SeekFrom::Current(0)).unwrap() == 15); + let actual = file.seek(SeekFrom::Current(0)).unwrap(); + assert!(expected == actual, "expected '{}' got '{}'", expected, actual); } #[test] fn test_at_least_no_change() { + let expected = 10; let (at, mut ucmd) = at_and_ucmd!(); let mut file = at.make_file(TFILE2); file.write_all(b"1234567890").unwrap(); ucmd.args(&["--size", ">4", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); - assert!(file.seek(SeekFrom::Current(0)).unwrap() == 10); + let actual = file.seek(SeekFrom::Current(0)).unwrap(); + assert!(expected == actual, "expected '{}' got '{}'", expected, actual); } #[test] fn test_round_down() { + let expected = 8; let (at, mut ucmd) = at_and_ucmd!(); let mut file = at.make_file(TFILE2); file.write_all(b"1234567890").unwrap(); ucmd.args(&["--size", "/4", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); - assert!(file.seek(SeekFrom::Current(0)).unwrap() == 8); + let actual = file.seek(SeekFrom::Current(0)).unwrap(); + assert!(expected == actual, "expected '{}' got '{}'", expected, actual); } #[test] fn test_round_up() { + let expected = 12; let (at, mut ucmd) = at_and_ucmd!(); let mut file = at.make_file(TFILE2); file.write_all(b"1234567890").unwrap(); ucmd.args(&["--size", "*4", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); - assert!(file.seek(SeekFrom::Current(0)).unwrap() == 12); + let actual = file.seek(SeekFrom::Current(0)).unwrap(); + assert!(expected == actual, "expected '{}' got '{}'", expected, actual); } From 26fc8e57c7746305901f1933c9c14f53b4d32e32 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 10:03:29 -0500 Subject: [PATCH 0439/1135] Fix NumCache and Serde JSON conflict by disabling NumCache during extsort general numeric compares --- src/uu/sort/src/external_sort/LICENSE | 19 ++ src/uu/sort/src/external_sort/mod.rs | 246 ++++++++++++++++++++++++++ src/uu/sort/src/sort.rs | 36 ++-- tests/by-util/test_sort.rs | 12 ++ 4 files changed, 294 insertions(+), 19 deletions(-) create mode 100644 src/uu/sort/src/external_sort/LICENSE create mode 100644 src/uu/sort/src/external_sort/mod.rs diff --git a/src/uu/sort/src/external_sort/LICENSE b/src/uu/sort/src/external_sort/LICENSE new file mode 100644 index 000000000..e26c89c9f --- /dev/null +++ b/src/uu/sort/src/external_sort/LICENSE @@ -0,0 +1,19 @@ +Copyright 2018 Battelle Memorial Institute + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/src/uu/sort/src/external_sort/mod.rs b/src/uu/sort/src/external_sort/mod.rs new file mode 100644 index 000000000..9fcaadcc3 --- /dev/null +++ b/src/uu/sort/src/external_sort/mod.rs @@ -0,0 +1,246 @@ +use std::{clone::Clone}; +use std::cmp::Ordering::Less; +use std::collections::VecDeque; +use std::error::Error; +use std::fs::{File, OpenOptions}; +use std::io::SeekFrom::Start; +use std::io::{BufRead, BufReader, Seek, Write}; +use std::marker::PhantomData; +use std::path::PathBuf; + +use serde::de::DeserializeOwned; +use serde::Serialize; +use serde_json; +use tempdir::TempDir; + +use super::{GlobalSettings, Line}; + +/// Trait for types that can be used by +/// [ExternalSorter](struct.ExternalSorter.html). Must be sortable, cloneable, +/// serializeable, and able to report on it's size +pub trait ExternallySortable: Clone + Serialize + DeserializeOwned { + /// Get the size, in bytes, of this object (used to constrain the buffer + /// used in the external sort). + fn get_size(&self) -> u64; +} + +/// Iterator that provides sorted `T`s +pub struct ExtSortedIterator { + buffers: Vec>, + chunk_offsets: Vec, + max_per_chunk: u64, + chunks: u64, + tmp_dir: TempDir, + settings: GlobalSettings, + failed: bool, +} + +impl Iterator for ExtSortedIterator +where + Line: ExternallySortable, +{ + type Item = Result>; + + /// # Errors + /// + /// This method can fail due to issues reading intermediate sorted chunks + /// from disk, or due to serde deserialization issues + fn next(&mut self) -> Option { + if self.failed { + return None; + } + // fill up any empty buffers + let mut empty = true; + for chunk_num in 0..self.chunks { + if self.buffers[chunk_num as usize].is_empty() { + let mut f = match File::open(self.tmp_dir.path().join(chunk_num.to_string())) { + Ok(f) => f, + Err(e) => { + self.failed = true; + return Some(Err(Box::new(e))); + } + }; + match f.seek(Start(self.chunk_offsets[chunk_num as usize])) { + Ok(_) => (), + Err(e) => { + self.failed = true; + return Some(Err(Box::new(e))); + } + } + let bytes_read = + match fill_buff(&mut self.buffers[chunk_num as usize], f, self.max_per_chunk) { + Ok(bytes_read) => bytes_read, + Err(e) => { + self.failed = true; + return Some(Err(e)); + } + }; + self.chunk_offsets[chunk_num as usize] += bytes_read; + if !self.buffers[chunk_num as usize].is_empty() { + empty = false; + } + } else { + empty = false; + } + } + if empty { + return None; + } + + // find the next record to write + // check is_empty() before unwrap()ing + let mut idx = 0; + for chunk_num in 0..self.chunks as usize { + if !self.buffers[chunk_num].is_empty() { + if self.buffers[idx].is_empty() || (super::compare_by)( + self.buffers[chunk_num].front().unwrap(), + self.buffers[idx].front().unwrap(), + &self.settings + ) == Less + { + idx = chunk_num; + } + } + } + + // unwrap due to checks above + let r = self.buffers[idx].pop_front().unwrap(); + Some(Ok(r)) + } +} + +/// Perform an external sort on an unsorted stream of incoming data +pub struct ExternalSorter +where + Line: ExternallySortable, +{ + tmp_dir: Option, + buffer_bytes: u64, + phantom: PhantomData, + settings: GlobalSettings, +} + +impl ExternalSorter +where + Line: ExternallySortable, +{ + /// Create a new `ExternalSorter` with a specified memory buffer and + /// temporary directory + pub fn new(buffer_bytes: u64, tmp_dir: Option, settings: GlobalSettings) -> ExternalSorter { + ExternalSorter { + buffer_bytes, + tmp_dir, + phantom: PhantomData, + settings, + } + } + + /// Sort (based on `compare`) the `T`s provided by `unsorted` and return an + /// iterator + /// + /// # Errors + /// + /// This method can fail due to issues writing intermediate sorted chunks + /// to disk, or due to serde serialization issues + pub fn sort_by(&self, unsorted: I, settings: GlobalSettings) -> Result, Box> + where + I: Iterator, + { + let tmp_dir = match self.tmp_dir { + Some(ref p) => TempDir::new_in(p, "uutils_sort")?, + None => TempDir::new("uutils_sort")?, + }; + // creating the thing we need to return first due to the face that we need to + // borrow tmp_dir and move it out + let mut iter = ExtSortedIterator { + buffers: Vec::new(), + chunk_offsets: Vec::new(), + max_per_chunk: 0, + chunks: 0, + tmp_dir, + settings, + failed: false, + }; + + { + let mut total_read = 0; + let mut chunk = Vec::new(); + + // make the initial chunks on disk + for seq in unsorted { + total_read += seq.get_size(); + chunk.push(seq); + + if total_read >= self.buffer_bytes { + super::sort_by(&mut chunk, &self.settings); + self.write_chunk( + &iter.tmp_dir.path().join(iter.chunks.to_string()), + &mut chunk, + )?; + chunk.clear(); + total_read = 0; + iter.chunks += 1; + } + } + // write the last chunk + if chunk.len() > 0 { + super::sort_by(&mut chunk, &self.settings); + self.write_chunk( + &iter.tmp_dir.path().join(iter.chunks.to_string()), + &mut chunk, + )?; + iter.chunks += 1; + } + + // initialize buffers for each chunk + iter.max_per_chunk = self.buffer_bytes.checked_div(iter.chunks).unwrap_or(self.buffer_bytes); + iter.buffers = vec![VecDeque::new(); iter.chunks as usize]; + iter.chunk_offsets = vec![0 as u64; iter.chunks as usize]; + for chunk_num in 0..iter.chunks { + let offset = fill_buff( + &mut iter.buffers[chunk_num as usize], + File::open(iter.tmp_dir.path().join(chunk_num.to_string()))?, + iter.max_per_chunk, + )?; + iter.chunk_offsets[chunk_num as usize] = offset; + } + } + + Ok(iter) + } + + fn write_chunk(&self, file: &PathBuf, chunk: &mut Vec) -> Result<(), Box> { + let mut new_file = OpenOptions::new().create(true).append(true).open(file)?; + for s in chunk { + let mut serialized = serde_json::to_string(&s).expect("JSON write error: "); + serialized.push_str("\n"); + new_file.write_all(serialized.as_bytes())?; + } + + Ok(()) + } +} + +fn fill_buff(vec: &mut VecDeque, file: File, max_bytes: u64) -> Result> +where + Line: ExternallySortable, +{ + let mut total_read = 0; + let mut bytes_read = 0; + for line in BufReader::new(file).lines() { + let line_s = line?; + bytes_read += line_s.len() + 1; + // This is where the bad stuff happens usually + let deserialized: Line = match serde_json::from_str(&line_s) { + Ok(x) => x, + Err(err) => panic!("JSON read error: {}", err), + }; + total_read += deserialized.get_size(); + vec.push_back(deserialized); + if total_read > max_bytes { + break; + } + } + + Ok(bytes_read as u64) +} diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 8c3a0cf7f..e77271557 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -91,7 +91,7 @@ static NEGATIVE: char = '-'; static POSITIVE: char = '+'; static DEFAULT_TMPDIR: &str = r"/tmp"; -// 16GB buffer for Vec before we dump to disk +// 16GB buffer for Vec before we dump to disk, never used static DEFAULT_BUF_SIZE: usize = 16000000000; #[derive(Eq, Ord, PartialEq, PartialOrd, Clone)] @@ -292,14 +292,6 @@ impl ExternallySortable for Line { } } -impl PartialEq for Line { - fn eq(&self, other: &Self) -> bool { - self.line == other.line - } -} - -impl Eq for Line {} - impl Line { fn new(line: String, settings: &GlobalSettings) -> Self { let fields = if settings @@ -343,7 +335,7 @@ impl Line { ); range.shorten(num_range); NumCache::WithInfo(info) - } else if selector.settings.mode == SortMode::GeneralNumeric { + } else if selector.settings.mode == SortMode::GeneralNumeric && settings.buffer_size == DEFAULT_BUF_SIZE { NumCache::AsF64(permissive_f64_parse(get_leading_gen(range.get_str(&line)))) } else { NumCache::None @@ -1103,11 +1095,12 @@ fn exec_check_file(unwrapped_lines: &[Line], settings: &GlobalSettings) -> i32 { fn ext_sort_by(unsorted: Vec, settings: GlobalSettings) -> Vec { let external_sorter = ExternalSorter::new(settings.buffer_size as u64, Some(settings.tmp_dir.clone()), settings.clone()); - let iter = external_sorter.sort_by(unsorted.into_iter(), settings.clone()).unwrap(); - let vec = iter.filter(|x| x.is_ok() ) - .map(|x| x.unwrap()) - .collect::>(); - vec + let iter = external_sorter + .sort_by(unsorted.into_iter(), settings.clone()) + .unwrap() + .map(|x| x.unwrap()) + .collect::>(); + iter } fn sort_by(lines: &mut Vec, settings: &GlobalSettings) { @@ -1130,10 +1123,15 @@ fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering (a_str, a_selection.num_cache.as_num_info()), (b_str, b_selection.num_cache.as_num_info()), ), - SortMode::GeneralNumeric => general_numeric_compare( - a_selection.num_cache.as_f64(), - b_selection.num_cache.as_f64(), - ), + // serde JSON has issues with f64 null values, so caching them won't work for us with ext sort + SortMode::GeneralNumeric => + if global_settings.buffer_size == DEFAULT_BUF_SIZE { + general_numeric_compare(a_selection.num_cache.as_f64(), + b_selection.num_cache.as_f64()) + } else { + general_numeric_compare(permissive_f64_parse(get_leading_gen(a_str)), + permissive_f64_parse(get_leading_gen(b_str))) + }, SortMode::Month => month_compare(a_str, b_str), SortMode::Version => version_compare(a_str, b_str), SortMode::Default => default_compare(a_str, b_str), diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index c76ab219a..63883cd63 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -51,6 +51,18 @@ fn test_human_numeric_whitespace() { test_helper("human-numeric-whitespace", "-h"); } +// This doesn't test the ext sort feature as such, just this codepath where +// ext sort can fail when reading back JSON if it finds a null value +#[test] +fn test_extsort_as64_bailout() { + new_ucmd!() + .arg("-g") + .arg("-S 10K") + .arg("multiple_decimals_general.txt") + .succeeds() + .stdout_is("\n\n\n\n\n\n\n\nCARAvan\n-2028789030\n-896689\n-8.90880\n-1\n-.05\n000\n00000001\n1\n1.040000000\n1.444\n1.58590\n8.013\n45\n46.89\n576,446.88800000\n576,446.890\n 4567.\n4567.1\n4567.34\n\t\t\t\t\t\t\t\t\t\t4567..457\n\t\t\t\t37800\n\t\t\t\t\t\t45670.89079.098\n\t\t\t\t\t\t45670.89079.1\n4798908.340000000000\n4798908.45\n4798908.8909800\n"); +} + #[test] fn test_multiple_decimals_general() { new_ucmd!() From cb0c667da5bdaa396921cb7c894dcae6b6be6a98 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 10:12:03 -0500 Subject: [PATCH 0440/1135] Ran Rustfmt --- Cargo.lock | 3 --- 1 file changed, 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d4aefd98c..fab7d57d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1432,9 +1432,6 @@ name = "smallvec" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" -dependencies = [ - "serde", -] [[package]] name = "strsim" From 094d9a9e476882d6a437f3889681b3bda5ec9867 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 12:27:11 -0500 Subject: [PATCH 0441/1135] Fix bug in human_numeric convert --- Cargo.lock | 3 ++ src/uu/sort/Cargo.toml | 2 +- src/uu/sort/src/sort.rs | 60 +++++++++++++++++--------------------- tests/by-util/test_sort.rs | 4 +-- 4 files changed, 33 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fab7d57d1..d4aefd98c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1432,6 +1432,9 @@ name = "smallvec" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" +dependencies = [ + "serde", +] [[package]] name = "strsim" diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 02ab385da..80ffc92c9 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -23,7 +23,7 @@ clap = "2.33" fnv = "1.0.7" itertools = "0.10.0" semver = "0.9.0" -smallvec = "1.6.1" +smallvec = { version="1.6.1", features=["serde"] } unicode-width = "0.1.8" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 049c09970..8d513b837 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -27,7 +27,7 @@ use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; use rayon::prelude::*; use semver::Version; -use serde::{Deserializer, Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; use smallvec::SmallVec; use std::cmp::Ordering; use std::collections::BinaryHeap; @@ -41,6 +41,7 @@ use std::ops::Range; use std::path::Path; use unicode_width::UnicodeWidthStr; use uucore::fs::is_stdin_interactive; // for Iterator::dedup() +use std::path::PathBuf; static NAME: &str = "sort"; static ABOUT: &str = "Display sorted concatenation of all FILE(s)."; @@ -133,22 +134,20 @@ impl GlobalSettings { // It's back to do conversions for command line opts! // Probably want to do through numstrcmp somehow now? fn human_numeric_convert(a: &str) -> usize { - let num_part = leading_num_common(a); - let (_, s) = a.split_at(num_part.len()); - let num_part = permissive_f64_parse(num_part); - let suffix = match s.parse().unwrap_or('\0') { + let num_str = &a[get_leading_gen(a)]; + let (_, suf_str) = a.split_at(num_str.len()); + let num_usize = num_str.parse::().expect("Error parsing buffer size: "); + let suf_usize: usize = match suf_str.to_uppercase().as_str() { // SI Units - 'K' | 'k' => 1E3, - 'M' => 1E6, - 'G' => 1E9, - 'T' => 1E12, - 'P' => 1E15, - 'E' => 1E18, - 'Z' => 1E21, - 'Y' => 1E24, - _ => 1f64, + "K" => 1000usize, + "M" => 1000000usize, + "G" => 1000000000usize, + "T" => 1000000000000usize, + "P" => 1000000000000000usize, + "E" => 1000000000000000000usize, + _ => 1usize, }; - num_part as usize * suffix as usize + num_usize * suf_usize } } @@ -236,22 +235,13 @@ impl SelectionRange { } } -#[derive(Debug, Serialize, Deserialize, Clone)] +#[derive(Serialize, Deserialize, Clone)] enum NumCache { - #[serde(deserialize_with="bailout_parse_f64")] AsF64(GeneralF64ParseResult), WithInfo(NumInfo), None, } -// Only used when serde can't parse a null value -fn bailout_parse_f64<'de, D>(d: D) -> Result where D: Deserializer<'de> { - Deserialize::deserialize(d) - .map(|x: Option<_>| { - x.unwrap_or(0f64) - }) -} - impl NumCache { fn as_f64(&self) -> GeneralF64ParseResult { match self { @@ -266,7 +256,7 @@ impl NumCache { } } } -#[derive(Debug, Serialize, Deserialize, Clone)] +#[derive(Serialize, Deserialize, Clone)] struct Selection { range: SelectionRange, num_cache: NumCache, @@ -1218,7 +1208,7 @@ fn exec(files: Vec, settings: GlobalSettings) -> i32 { if settings.merge { if settings.unique { print_sorted( - file_merger.dedup_by(|a, b| compare_by(a, b, settings) == Ordering::Equal), + file_merger.dedup_by(|a, b| compare_by(a, b, &settings) == Ordering::Equal), &settings, ) } else { @@ -1228,7 +1218,7 @@ fn exec(files: Vec, settings: GlobalSettings) -> i32 { print_sorted( lines .into_iter() - .dedup_by(|a, b| compare_by(a, b, settings) == Ordering::Equal), + .dedup_by(|a, b| compare_by(a, b, &settings) == Ordering::Equal), &settings, ) } else { @@ -1303,11 +1293,15 @@ fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering // serde JSON has issues with f64 null values, so caching them won't work for us with ext sort SortMode::GeneralNumeric => if global_settings.buffer_size == DEFAULT_BUF_SIZE { - general_numeric_compare(a_selection.num_cache.as_f64(), - b_selection.num_cache.as_f64()) + general_numeric_compare( + a_selection.num_cache.as_f64(), + b_selection.num_cache.as_f64() + ) } else { - general_numeric_compare(permissive_f64_parse(get_leading_gen(a_str)), - permissive_f64_parse(get_leading_gen(b_str))) + general_numeric_compare( + general_f64_parse(&a_str[get_leading_gen(a_str)]), + general_f64_parse(&b_str[get_leading_gen(b_str)]) + ) }, SortMode::Month => month_compare(a_str, b_str), SortMode::Version => version_compare(a_str, b_str), @@ -1385,7 +1379,7 @@ fn get_leading_gen(input: &str) -> Range { leading_whitespace_len..input.len() } -#[derive(Copy, Clone, PartialEq, PartialOrd)] +#[derive(Serialize, Deserialize, Copy, Clone, PartialEq, PartialOrd)] enum GeneralF64ParseResult { Invalid, NaN, diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 894626c55..c5b63205f 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -33,7 +33,7 @@ fn test_helper(file_name: &str, args: &str) { fn test_larger_than_specified_segment() { new_ucmd!() .arg("-n") - .arg("-S 50K") + .arg("-S 50M") .arg("ext_sort.txt") .succeeds() .stdout_is_fixture(format!("{}", "ext_sort.expected")); @@ -67,7 +67,7 @@ fn test_extsort_as64_bailout() { .arg("-S 10K") .arg("multiple_decimals_general.txt") .succeeds() - .stdout_is("\n\n\n\n\n\n\n\nCARAvan\n-2028789030\n-896689\n-8.90880\n-1\n-.05\n000\n00000001\n1\n1.040000000\n1.444\n1.58590\n8.013\n45\n46.89\n576,446.88800000\n576,446.890\n 4567.\n4567.1\n4567.34\n\t\t\t\t\t\t\t\t\t\t4567..457\n\t\t\t\t37800\n\t\t\t\t\t\t45670.89079.098\n\t\t\t\t\t\t45670.89079.1\n4798908.340000000000\n4798908.45\n4798908.8909800\n"); + .stdout_is_fixture("multiple_decimals_general.expected"); } #[test] From f0a473f40e26a1dcd684244305e3a214c5e0552f Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 12:38:43 -0500 Subject: [PATCH 0442/1135] Fix tests --- src/uu/sort/src/external_sort/mod.rs | 32 ++++++++++++++++++------ src/uu/sort/src/sort.rs | 37 +++++++++++++++++----------- tests/by-util/test_sort.rs | 3 ++- 3 files changed, 49 insertions(+), 23 deletions(-) diff --git a/src/uu/sort/src/external_sort/mod.rs b/src/uu/sort/src/external_sort/mod.rs index 9fcaadcc3..e2595fc78 100644 --- a/src/uu/sort/src/external_sort/mod.rs +++ b/src/uu/sort/src/external_sort/mod.rs @@ -1,4 +1,4 @@ -use std::{clone::Clone}; +use std::clone::Clone; use std::cmp::Ordering::Less; use std::collections::VecDeque; use std::error::Error; @@ -92,10 +92,11 @@ where let mut idx = 0; for chunk_num in 0..self.chunks as usize { if !self.buffers[chunk_num].is_empty() { - if self.buffers[idx].is_empty() || (super::compare_by)( + if self.buffers[idx].is_empty() + || (super::compare_by)( self.buffers[chunk_num].front().unwrap(), self.buffers[idx].front().unwrap(), - &self.settings + &self.settings, ) == Less { idx = chunk_num; @@ -106,7 +107,7 @@ where // unwrap due to checks above let r = self.buffers[idx].pop_front().unwrap(); Some(Ok(r)) - } + } } /// Perform an external sort on an unsorted stream of incoming data @@ -126,7 +127,11 @@ where { /// Create a new `ExternalSorter` with a specified memory buffer and /// temporary directory - pub fn new(buffer_bytes: u64, tmp_dir: Option, settings: GlobalSettings) -> ExternalSorter { + pub fn new( + buffer_bytes: u64, + tmp_dir: Option, + settings: GlobalSettings, + ) -> ExternalSorter { ExternalSorter { buffer_bytes, tmp_dir, @@ -142,7 +147,11 @@ where /// /// This method can fail due to issues writing intermediate sorted chunks /// to disk, or due to serde serialization issues - pub fn sort_by(&self, unsorted: I, settings: GlobalSettings) -> Result, Box> + pub fn sort_by( + &self, + unsorted: I, + settings: GlobalSettings, + ) -> Result, Box> where I: Iterator, { @@ -193,7 +202,10 @@ where } // initialize buffers for each chunk - iter.max_per_chunk = self.buffer_bytes.checked_div(iter.chunks).unwrap_or(self.buffer_bytes); + iter.max_per_chunk = self + .buffer_bytes + .checked_div(iter.chunks) + .unwrap_or(self.buffer_bytes); iter.buffers = vec![VecDeque::new(); iter.chunks as usize]; iter.chunk_offsets = vec![0 as u64; iter.chunks as usize]; for chunk_num in 0..iter.chunks { @@ -221,7 +233,11 @@ where } } -fn fill_buff(vec: &mut VecDeque, file: File, max_bytes: u64) -> Result> +fn fill_buff( + vec: &mut VecDeque, + file: File, + max_bytes: u64, +) -> Result> where Line: ExternallySortable, { diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 8d513b837..a519bece5 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -15,11 +15,11 @@ #[macro_use] extern crate uucore; -mod numeric_str_cmp; mod external_sort; +mod numeric_str_cmp; -use external_sort::{ExternalSorter, ExternallySortable}; use clap::{App, Arg}; +use external_sort::{ExternalSorter, ExternallySortable}; use fnv::FnvHasher; use itertools::Itertools; use numeric_str_cmp::{numeric_str_cmp, NumInfo, NumInfoParseSettings}; @@ -39,9 +39,9 @@ use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Lines, Read, Write}; use std::mem::replace; use std::ops::Range; use std::path::Path; +use std::path::PathBuf; use unicode_width::UnicodeWidthStr; use uucore::fs::is_stdin_interactive; // for Iterator::dedup() -use std::path::PathBuf; static NAME: &str = "sort"; static ABOUT: &str = "Display sorted concatenation of all FILE(s)."; @@ -136,7 +136,9 @@ impl GlobalSettings { fn human_numeric_convert(a: &str) -> usize { let num_str = &a[get_leading_gen(a)]; let (_, suf_str) = a.split_at(num_str.len()); - let num_usize = num_str.parse::().expect("Error parsing buffer size: "); + let num_usize = num_str + .parse::() + .expect("Error parsing buffer size: "); let suf_usize: usize = match suf_str.to_uppercase().as_str() { // SI Units "K" => 1000usize, @@ -323,7 +325,9 @@ impl Line { ); range.shorten(num_range); NumCache::WithInfo(info) - } else if selector.settings.mode == SortMode::GeneralNumeric && settings.buffer_size == DEFAULT_BUF_SIZE { + } else if selector.settings.mode == SortMode::GeneralNumeric + && settings.buffer_size == DEFAULT_BUF_SIZE + { let str = range.get_str(&line); NumCache::AsF64(general_f64_parse(&str[get_leading_gen(str)])) } else { @@ -1050,7 +1054,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .value_of(OPT_BUF_SIZE) .map(String::from) .unwrap_or(format!("{}", DEFAULT_BUF_SIZE)); - + GlobalSettings::human_numeric_convert(&input) } } @@ -1261,13 +1265,17 @@ fn exec_check_file(unwrapped_lines: &[Line], settings: &GlobalSettings) -> i32 { } fn ext_sort_by(unsorted: Vec, settings: GlobalSettings) -> Vec { - let external_sorter = ExternalSorter::new(settings.buffer_size as u64, Some(settings.tmp_dir.clone()), settings.clone()); + let external_sorter = ExternalSorter::new( + settings.buffer_size as u64, + Some(settings.tmp_dir.clone()), + settings.clone(), + ); let iter = external_sorter .sort_by(unsorted.into_iter(), settings.clone()) .unwrap() .map(|x| x.unwrap()) .collect::>(); - iter + iter } fn sort_by(lines: &mut Vec, settings: &GlobalSettings) { @@ -1291,18 +1299,19 @@ fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering (b_str, b_selection.num_cache.as_num_info()), ), // serde JSON has issues with f64 null values, so caching them won't work for us with ext sort - SortMode::GeneralNumeric => + SortMode::GeneralNumeric => { if global_settings.buffer_size == DEFAULT_BUF_SIZE { general_numeric_compare( a_selection.num_cache.as_f64(), - b_selection.num_cache.as_f64() - ) + b_selection.num_cache.as_f64(), + ) } else { general_numeric_compare( general_f64_parse(&a_str[get_leading_gen(a_str)]), - general_f64_parse(&b_str[get_leading_gen(b_str)]) - ) - }, + general_f64_parse(&b_str[get_leading_gen(b_str)]), + ) + } + } SortMode::Month => month_compare(a_str, b_str), SortMode::Version => version_compare(a_str, b_str), SortMode::Default => default_compare(a_str, b_str), diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index c5b63205f..86951c1a4 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -33,7 +33,8 @@ fn test_helper(file_name: &str, args: &str) { fn test_larger_than_specified_segment() { new_ucmd!() .arg("-n") - .arg("-S 50M") + .arg("-S") + .arg("50K") .arg("ext_sort.txt") .succeeds() .stdout_is_fixture(format!("{}", "ext_sort.expected")); From bbcca3eefd98c06984cd22b016513dd6c10435e7 Mon Sep 17 00:00:00 2001 From: Alessandro Stoltenberg Date: Mon, 29 Mar 2021 22:26:55 +0200 Subject: [PATCH 0443/1135] ls: Implements https://github.com/uutils/coreutils/issues/1880 extension sorting. --- src/uu/ls/src/ls.rs | 32 ++++++++++++++++++++++-- tests/by-util/test_ls.rs | 54 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 2 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 0351227eb..9f2c2d993 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -74,6 +74,7 @@ pub mod options { pub static TIME: &str = "t"; pub static NONE: &str = "U"; pub static VERSION: &str = "v"; + pub static EXTENSION: &str = "X"; } pub mod time { pub static ACCESS: &str = "u"; @@ -134,6 +135,7 @@ enum Sort { Size, Time, Version, + Extension, } enum SizeFormat { @@ -277,6 +279,7 @@ impl Config { "time" => Sort::Time, "size" => Sort::Size, "version" => Sort::Version, + "extension" => Sort::Extension, // below should never happen as clap already restricts the values. _ => unreachable!("Invalid field for --sort"), } @@ -288,6 +291,8 @@ impl Config { Sort::None } else if options.is_present(options::sort::VERSION) { Sort::Version + } else if options.is_present(options::sort::EXTENSION) { + Sort::Extension } else { Sort::Name }; @@ -752,10 +757,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg( Arg::with_name(options::SORT) .long(options::SORT) - .help("Sort by : name, none (-U), time (-t) or size (-S)") + .help("Sort by : name, none (-U), time (-t), size (-S) or extension (-X)") .value_name("field") .takes_value(true) - .possible_values(&["name", "none", "time", "size", "version"]) + .possible_values(&["name", "none", "time", "size", "version", "extension"]) .require_equals(true) .overrides_with_all(&[ options::SORT, @@ -763,6 +768,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::sort::TIME, options::sort::NONE, options::sort::VERSION, + options::sort::EXTENSION, ]) ) .arg( @@ -775,6 +781,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::sort::TIME, options::sort::NONE, options::sort::VERSION, + options::sort::EXTENSION, ]) ) .arg( @@ -787,6 +794,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::sort::TIME, options::sort::NONE, options::sort::VERSION, + options::sort::EXTENSION, ]) ) .arg( @@ -799,6 +807,20 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::sort::TIME, options::sort::NONE, options::sort::VERSION, + options::sort::EXTENSION, + ]) + ) + .arg( + Arg::with_name(options::sort::EXTENSION) + .short(options::sort::EXTENSION) + .help("Sort alphabetically by entry extension.") + .overrides_with_all(&[ + options::SORT, + options::sort::SIZE, + options::sort::TIME, + options::sort::NONE, + options::sort::VERSION, + options::sort::EXTENSION, ]) ) .arg( @@ -813,6 +835,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::sort::TIME, options::sort::NONE, options::sort::VERSION, + options::sort::EXTENSION, ]) ) @@ -1141,6 +1164,11 @@ fn sort_entries(entries: &mut Vec, config: &Config) { // The default sort in GNU ls is case insensitive Sort::Name => entries.sort_by_cached_key(|k| k.file_name.to_lowercase()), Sort::Version => entries.sort_by(|k, j| version_cmp::version_cmp(&k.p_buf, &j.p_buf)), + Sort::Extension => entries.sort_by(|a, b| { + a.extension() + .cmp(&b.extension()) + .then(a.to_string_lossy().cmp(&b.to_string_lossy())) + }), Sort::None => {} } diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 09e02f264..364a71d47 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1681,3 +1681,57 @@ fn test_ls_deref_command_line_dir() { assert!(!result.stdout_str().ends_with("sym_dir")); } + +#[test] +fn test_ls_sort_extension() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + for filename in &[ + "file1", + "file2", + "anotherFile", + ".hidden", + ".file.1", + ".file.2", + "file.1", + "file.2", + "anotherFile.1", + "anotherFile.2", + "file.ext", + "file.debug", + "anotherFile.ext", + "anotherFile.debug", + ] { + at.touch(filename); + } + + let expected = vec![ + ".", + "..", + ".hidden", + "anotherFile", + "file1", + "file2", + ".file.1", + "anotherFile.1", + "file.1", + ".file.2", + "anotherFile.2", + "file.2", + "anotherFile.debug", + "file.debug", + "anotherFile.ext", + "file.ext", + "", // because of '\n' at the end of the output + ]; + + let result = scene.ucmd().arg("-1aX").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!(result.stdout.split('\n').collect::>(), expected,); + + let result = scene.ucmd().arg("-1a").arg("--sort=extension").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!(result.stdout.split('\n').collect::>(), expected,); +} \ No newline at end of file From 9c221148a86ff7b2003c1913aaebcb1a6be7007c Mon Sep 17 00:00:00 2001 From: Alessandro Stoltenberg Date: Tue, 30 Mar 2021 22:54:06 +0200 Subject: [PATCH 0444/1135] ls: Extension sorting, use file_stem() instead of to_string_lossy() --- src/uu/ls/src/ls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 9f2c2d993..145ed0428 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1167,7 +1167,7 @@ fn sort_entries(entries: &mut Vec, config: &Config) { Sort::Extension => entries.sort_by(|a, b| { a.extension() .cmp(&b.extension()) - .then(a.to_string_lossy().cmp(&b.to_string_lossy())) + .then(a.file_stem().cmp(&b.file_stem())) }), Sort::None => {} } From 2f37b85426d12ff07828d063257515653fb90cf5 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 12:58:04 -0500 Subject: [PATCH 0445/1135] unwrap_or_else can be an unwrap_or --- src/uu/sort/src/sort.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index a519bece5..bf138e0c0 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1063,7 +1063,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let result = matches .value_of(OPT_TMP_DIR) .map(String::from) - .unwrap_or_else(|| DEFAULT_TMPDIR.to_owned()); + .unwrap_or(DEFAULT_TMPDIR.to_owned()); settings.tmp_dir = PathBuf::from(result); } else { for (key, value) in env::vars_os() { From ab594b7b4c8e0b103b336120076303d7da8fb8fa Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 13:08:55 -0500 Subject: [PATCH 0446/1135] Fix test comment --- tests/by-util/test_sort.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 86951c1a4..865e2be21 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -59,8 +59,8 @@ fn test_human_numeric_whitespace() { test_helper("human-numeric-whitespace", "-h"); } -// This doesn't test the ext sort feature as such, just this codepath where -// ext sort can fail when reading back JSON if it finds a null value +// This tests the ext sort feature, but it also tests where +// serde might fail when reading back JSON if it finds a null value #[test] fn test_extsort_as64_bailout() { new_ucmd!() From 43f3f7e01c0707d6617ec5239f683d2f6790a498 Mon Sep 17 00:00:00 2001 From: Alessandro Stoltenberg Date: Sun, 25 Apr 2021 20:13:42 +0200 Subject: [PATCH 0447/1135] feat2: Rebased on current master and incorporated changes done to the filetype handling. --- src/uu/ls/src/ls.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 145ed0428..3cd1e037d 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1165,9 +1165,10 @@ fn sort_entries(entries: &mut Vec, config: &Config) { Sort::Name => entries.sort_by_cached_key(|k| k.file_name.to_lowercase()), Sort::Version => entries.sort_by(|k, j| version_cmp::version_cmp(&k.p_buf, &j.p_buf)), Sort::Extension => entries.sort_by(|a, b| { - a.extension() - .cmp(&b.extension()) - .then(a.file_stem().cmp(&b.file_stem())) + a.p_buf + .extension() + .cmp(&b.p_buf.extension()) + .then(a.p_buf.file_stem().cmp(&b.p_buf.file_stem())) }), Sort::None => {} } From c3d7358df632f8ea3e6a82f3ab74a79a7d17d12b Mon Sep 17 00:00:00 2001 From: Ricardo Iglesias Date: Sun, 25 Apr 2021 12:08:05 -0700 Subject: [PATCH 0448/1135] ls: ignore leading period when sorting by name (#2112) * ls: ignore leading period when sorting by name ls now behaves like GNU ls with respect to sorting files by ignoring leading periods when sorting by main. Added tests to ensure "touch a .a b .b ; ls" returns ".a a .b b" * Replaced clone/collect calls. --- src/uu/ls/src/ls.rs | 8 +++++++- tests/by-util/test_ls.rs | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 0351227eb..6317c1975 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1139,7 +1139,13 @@ fn sort_entries(entries: &mut Vec, config: &Config) { entries.sort_by_key(|k| Reverse(k.md().as_ref().map(|md| md.len()).unwrap_or(0))) } // The default sort in GNU ls is case insensitive - Sort::Name => entries.sort_by_cached_key(|k| k.file_name.to_lowercase()), + Sort::Name => entries.sort_by_cached_key(|k| { + let has_dot: bool = k.file_name.starts_with('.'); + let filename_nodot: &str = &k.file_name[if has_dot { 1 } else { 0 }..]; + // We want hidden files to appear before regular files of the same + // name, so we need to negate the "has_dot" variable. + (filename_nodot.to_lowercase(), !has_dot) + }), Sort::Version => entries.sort_by(|k, j| version_cmp::version_cmp(&k.p_buf, &j.p_buf)), Sort::None => {} } diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 09e02f264..da45934e9 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -481,6 +481,21 @@ fn test_ls_sort_name() { .arg("--sort=name") .succeeds() .stdout_is(["test-1", "test-2", "test-3\n"].join(sep)); + + // Order of a named sort ignores leading dots. + let scene_dot = TestScenario::new(util_name!()); + let at = &scene_dot.fixtures; + at.touch(".a"); + at.touch("a"); + at.touch(".b"); + at.touch("b"); + + scene_dot + .ucmd() + .arg("--sort=name") + .arg("-A") + .succeeds() + .stdout_is([".a", "a", ".b", "b\n"].join(sep)); } #[test] From 733949b2e7f4d1672fdcf8e0521d8b25b8ffab5a Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 15:13:27 -0500 Subject: [PATCH 0449/1135] Add dynamic buffer adjustment, fix test comment --- src/uu/sort/src/external_sort/mod.rs | 19 +++++++++++++------ src/uu/sort/src/sort.rs | 13 ++++++------- tests/by-util/test_sort.rs | 6 +++--- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/uu/sort/src/external_sort/mod.rs b/src/uu/sort/src/external_sort/mod.rs index e2595fc78..f5a3a03af 100644 --- a/src/uu/sort/src/external_sort/mod.rs +++ b/src/uu/sort/src/external_sort/mod.rs @@ -174,13 +174,23 @@ where { let mut total_read = 0; let mut chunk = Vec::new(); + // Initial buffer is specified by user + let mut adjusted_buffer_size = self.buffer_bytes; // make the initial chunks on disk for seq in unsorted { - total_read += seq.get_size(); + let seq_size = seq.get_size(); + total_read += seq_size; + // Grow buffer size for a Line larger than buffer + adjusted_buffer_size = + if adjusted_buffer_size < seq_size { + seq_size + } else { + adjusted_buffer_size + }; chunk.push(seq); - if total_read >= self.buffer_bytes { + if total_read >= adjusted_buffer_size { super::sort_by(&mut chunk, &self.settings); self.write_chunk( &iter.tmp_dir.path().join(iter.chunks.to_string()), @@ -247,10 +257,7 @@ where let line_s = line?; bytes_read += line_s.len() + 1; // This is where the bad stuff happens usually - let deserialized: Line = match serde_json::from_str(&line_s) { - Ok(x) => x, - Err(err) => panic!("JSON read error: {}", err), - }; + let deserialized: Line = serde_json::from_str(&line_s).expect("JSON read error: "); total_read += deserialized.get_size(); vec.push_back(deserialized); if total_read > max_bytes { diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index bf138e0c0..0be91eef6 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -141,13 +141,12 @@ impl GlobalSettings { .expect("Error parsing buffer size: "); let suf_usize: usize = match suf_str.to_uppercase().as_str() { // SI Units - "K" => 1000usize, - "M" => 1000000usize, - "G" => 1000000000usize, - "T" => 1000000000000usize, - "P" => 1000000000000000usize, - "E" => 1000000000000000000usize, - _ => 1usize, + "K" => 1024usize, + "M" => 1024000usize, + "G" => 1024000000usize, + "T" => 1024000000000usize, + // GNU regards empty human numeric value as 1024 bytes + _ => 1024usize, }; num_usize * suf_usize } diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 865e2be21..cd3a3a496 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -59,13 +59,13 @@ fn test_human_numeric_whitespace() { test_helper("human-numeric-whitespace", "-h"); } -// This tests the ext sort feature, but it also tests where -// serde might fail when reading back JSON if it finds a null value +// This tests where serde often fails when reading back JSON +// if it finds a null value #[test] fn test_extsort_as64_bailout() { new_ucmd!() .arg("-g") - .arg("-S 10K") + .arg("-S 5K") .arg("multiple_decimals_general.txt") .succeeds() .stdout_is_fixture("multiple_decimals_general.expected"); From 5fb7014c2b37cfbd4f617ddf0ba6c892770ddcd7 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 15:42:36 -0500 Subject: [PATCH 0450/1135] Add a BufWriter for writes out to temp files --- src/uu/sort/src/external_sort/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/uu/sort/src/external_sort/mod.rs b/src/uu/sort/src/external_sort/mod.rs index f5a3a03af..222da5b58 100644 --- a/src/uu/sort/src/external_sort/mod.rs +++ b/src/uu/sort/src/external_sort/mod.rs @@ -4,7 +4,7 @@ use std::collections::VecDeque; use std::error::Error; use std::fs::{File, OpenOptions}; use std::io::SeekFrom::Start; -use std::io::{BufRead, BufReader, Seek, Write}; +use std::io::{BufRead, BufReader, BufWriter, Seek, Write}; use std::marker::PhantomData; use std::path::PathBuf; @@ -232,12 +232,14 @@ where } fn write_chunk(&self, file: &PathBuf, chunk: &mut Vec) -> Result<(), Box> { - let mut new_file = OpenOptions::new().create(true).append(true).open(file)?; + let new_file = OpenOptions::new().create(true).append(true).open(file)?; + let mut buf_write = Box::new(BufWriter::new(new_file)) as Box; for s in chunk { let mut serialized = serde_json::to_string(&s).expect("JSON write error: "); serialized.push_str("\n"); - new_file.write_all(serialized.as_bytes())?; + buf_write.write(serialized.as_bytes())?; } + buf_write.flush()?; Ok(()) } From dbdac2226220c8182b51928f1b5e92fe63bdd5ec Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 15:48:20 -0500 Subject: [PATCH 0451/1135] Add back unstable sort --- src/uu/sort/src/sort.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 0be91eef6..cbd02c18a 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1278,7 +1278,11 @@ fn ext_sort_by(unsorted: Vec, settings: GlobalSettings) -> Vec { } fn sort_by(lines: &mut Vec, settings: &GlobalSettings) { - lines.par_sort_by(|a, b| compare_by(a, b, &settings)) + if settings.stable || settings.unique { + lines.par_sort_by(|a, b| compare_by(a, b, &settings)) + } else { + lines.par_sort_unstable_by(|a, b| compare_by(a, b, &settings)) + } } fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering { From 6f82cd4f15f56029bd524b0e962a95553caf5a6c Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 16:27:36 -0500 Subject: [PATCH 0452/1135] Fix errors for usize on 32bit platforms --- src/uu/sort/src/sort.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index cbd02c18a..c24d930dc 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -93,8 +93,8 @@ static NEGATIVE: char = '-'; static POSITIVE: char = '+'; static DEFAULT_TMPDIR: &str = r"/tmp"; -// 16GB buffer for Vec before we dump to disk, never used -static DEFAULT_BUF_SIZE: usize = 16000000000; +// 4GB buffer for Vec before we dump to disk, never used +static DEFAULT_BUF_SIZE: usize = 4000000000; #[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy)] enum SortMode { @@ -141,10 +141,10 @@ impl GlobalSettings { .expect("Error parsing buffer size: "); let suf_usize: usize = match suf_str.to_uppercase().as_str() { // SI Units + "B" => 1usize, "K" => 1024usize, "M" => 1024000usize, "G" => 1024000000usize, - "T" => 1024000000000usize, // GNU regards empty human numeric value as 1024 bytes _ => 1024usize, }; @@ -1046,8 +1046,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } if matches.is_present(OPT_BUF_SIZE) { - // 16G is the default in memory buffer. - // Although the "default" is never used settings.buffer_size = { let input = matches .value_of(OPT_BUF_SIZE) @@ -1277,11 +1275,11 @@ fn ext_sort_by(unsorted: Vec, settings: GlobalSettings) -> Vec { iter } -fn sort_by(lines: &mut Vec, settings: &GlobalSettings) { +fn sort_by(unsorted: &mut Vec, settings: &GlobalSettings) { if settings.stable || settings.unique { - lines.par_sort_by(|a, b| compare_by(a, b, &settings)) + unsorted.par_sort_by(|a, b| compare_by(a, b, &settings)) } else { - lines.par_sort_unstable_by(|a, b| compare_by(a, b, &settings)) + unsorted.par_sort_unstable_by(|a, b| compare_by(a, b, &settings)) } } From 368e984fac148aa10b898fea9927d7680ad63723 Mon Sep 17 00:00:00 2001 From: Christopher Regali <60792386+ChrisRega@users.noreply.github.com> Date: Sun, 25 Apr 2021 23:28:42 +0200 Subject: [PATCH 0453/1135] Change unchecked unwrapping to unwrap_or_default for Args-trait (#1845) (#1852) * Change unchecked unwrapping to unwrap_or_default for argument parsing (resolving #1845) * Added unit-testing for the collect_str function on invalid utf8 OsStrs * Added a warning-message for identification purpose to the collect_str method. * - Add removal of wrongly encoded empty strings to basename - Add testing of broken encoding to basename - Changed UCommand to use collect_str in args method to allow for integration testing of that method - Change UCommand to use unwarp_or_default in arg method to match the behaviour of collect_str * Trying out a new pattern for convert_str for getting a feeling of how the API feels with more control * Adding convenience API for compact calls * Add new API to everywhere, fix test for basename * Added unit-testing for the conversion options * Added unit-testing for the conversion options for windows * fixed compilation and some merge hiccups * Remove windows tests in order to make merge request build * Fix formatting to match rustfmt for the merged file * Improve documentation of the collect_str method and the unit-tests * Fix compilation problems with test Co-authored-by: Christopher Regali Co-authored-by: Sylvestre Ledru --- src/uu/arch/src/arch.rs | 6 +- src/uu/base32/src/base32.rs | 4 +- src/uu/base64/src/base64.rs | 4 +- src/uu/basename/src/basename.rs | 6 +- src/uu/cat/src/cat.rs | 5 +- src/uu/chgrp/src/chgrp.rs | 5 +- src/uu/chmod/src/chmod.rs | 5 +- src/uu/chown/src/chown.rs | 5 +- src/uu/chroot/src/chroot.rs | 6 +- src/uu/cksum/src/cksum.rs | 5 +- src/uu/comm/src/comm.rs | 4 + src/uu/csplit/src/csplit.rs | 5 +- src/uu/cut/src/cut.rs | 5 +- src/uu/dircolors/src/dircolors.rs | 6 +- src/uu/dirname/src/dirname.rs | 5 +- src/uu/du/src/du.rs | 5 +- src/uu/echo/src/echo.rs | 4 + src/uu/expr/src/expr.rs | 6 +- src/uu/factor/src/cli.rs | 6 +- src/uu/fold/src/fold.rs | 5 +- src/uu/hostid/src/hostid.rs | 6 +- src/uu/kill/src/kill.rs | 5 +- src/uu/link/src/link.rs | 6 +- src/uu/logname/src/logname.rs | 6 +- src/uu/ls/src/ls.rs | 5 +- src/uu/mkfifo/src/mkfifo.rs | 5 +- src/uu/mknod/src/mknod.rs | 5 +- src/uu/more/src/more.rs | 4 + src/uu/nl/src/nl.rs | 5 +- src/uu/nohup/src/nohup.rs | 4 + src/uu/od/src/od.rs | 5 +- src/uu/pathchk/src/pathchk.rs | 4 + src/uu/pinky/src/pinky.rs | 3 +- src/uu/printf/src/printf.rs | 6 +- src/uu/ptx/src/ptx.rs | 5 +- src/uu/relpath/src/relpath.rs | 5 +- src/uu/shred/src/shred.rs | 5 +- src/uu/shuf/src/shuf.rs | 17 +-- src/uu/sort/src/sort.rs | 5 +- src/uu/stdbuf/src/stdbuf.rs | 4 + src/uu/sum/src/sum.rs | 5 +- src/uu/tac/src/tac.rs | 5 +- src/uu/timeout/src/timeout.rs | 6 +- src/uu/tr/src/tr.rs | 4 + src/uu/tsort/src/tsort.rs | 5 +- src/uu/tty/src/tty.rs | 5 +- src/uu/unexpand/src/unexpand.rs | 5 +- src/uu/unlink/src/unlink.rs | 5 +- src/uu/who/src/who.rs | 5 +- src/uucore/src/lib/lib.rs | 170 +++++++++++++++++++++++++++++- tests/by-util/test_basename.rs | 16 +++ tests/common/util.rs | 14 ++- 52 files changed, 402 insertions(+), 55 deletions(-) diff --git a/src/uu/arch/src/arch.rs b/src/uu/arch/src/arch.rs index 20392b11f..a4c57e282 100644 --- a/src/uu/arch/src/arch.rs +++ b/src/uu/arch/src/arch.rs @@ -10,13 +10,17 @@ extern crate uucore; use platform_info::*; +use uucore::InvalidEncodingHandling; static SYNTAX: &str = "Display machine architecture"; static SUMMARY: &str = "Determine architecture name for current machine."; static LONG_HELP: &str = ""; pub fn uumain(args: impl uucore::Args) -> i32 { - app!(SYNTAX, SUMMARY, LONG_HELP).parse(args.collect_str()); + app!(SYNTAX, SUMMARY, LONG_HELP).parse( + args.collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(), + ); let uts = return_if_err!(1, PlatformInfo::new()); println!("{}", uts.machine().trim()); 0 diff --git a/src/uu/base32/src/base32.rs b/src/uu/base32/src/base32.rs index b47f4d4cc..b5f346f48 100644 --- a/src/uu/base32/src/base32.rs +++ b/src/uu/base32/src/base32.rs @@ -8,6 +8,7 @@ #[macro_use] extern crate uucore; use uucore::encoding::Format; +use uucore::InvalidEncodingHandling; mod base_common; @@ -25,7 +26,8 @@ static LONG_HELP: &str = " pub fn uumain(args: impl uucore::Args) -> i32 { base_common::execute( - args.collect_str(), + args.collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(), SYNTAX, SUMMARY, LONG_HELP, diff --git a/src/uu/base64/src/base64.rs b/src/uu/base64/src/base64.rs index ee60f3de5..61a8dc5cb 100644 --- a/src/uu/base64/src/base64.rs +++ b/src/uu/base64/src/base64.rs @@ -9,6 +9,7 @@ #[macro_use] extern crate uucore; use uucore::encoding::Format; +use uucore::InvalidEncodingHandling; mod base_common; @@ -26,7 +27,8 @@ static LONG_HELP: &str = " pub fn uumain(args: impl uucore::Args) -> i32 { base_common::execute( - args.collect_str(), + args.collect_str(InvalidEncodingHandling::Ignore) + .accept_any(), SYNTAX, SUMMARY, LONG_HELP, diff --git a/src/uu/basename/src/basename.rs b/src/uu/basename/src/basename.rs index 7b02a7a83..68b705d53 100644 --- a/src/uu/basename/src/basename.rs +++ b/src/uu/basename/src/basename.rs @@ -11,6 +11,7 @@ extern crate uucore; use std::path::{is_separator, PathBuf}; +use uucore::InvalidEncodingHandling; static NAME: &str = "basename"; static SYNTAX: &str = "NAME [SUFFIX]"; @@ -19,8 +20,9 @@ static SUMMARY: &str = "Print NAME with any leading directory components removed static LONG_HELP: &str = ""; pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); - + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); // // Argument parsing // diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index e507c5acd..8dea096be 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -35,6 +35,7 @@ use std::net::Shutdown; use std::os::unix::fs::FileTypeExt; #[cfg(unix)] use unix_socket::UnixStream; +use uucore::InvalidEncodingHandling; static NAME: &str = "cat"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -166,7 +167,9 @@ mod options { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let matches = App::new(executable!()) .name(NAME) diff --git a/src/uu/chgrp/src/chgrp.rs b/src/uu/chgrp/src/chgrp.rs index 592a0a905..2afef7de0 100644 --- a/src/uu/chgrp/src/chgrp.rs +++ b/src/uu/chgrp/src/chgrp.rs @@ -22,6 +22,7 @@ use std::fs::Metadata; use std::os::unix::fs::MetadataExt; use std::path::Path; +use uucore::InvalidEncodingHandling; static SYNTAX: &str = "chgrp [OPTION]... GROUP FILE...\n or : chgrp [OPTION]... --reference=RFILE FILE..."; @@ -32,7 +33,9 @@ const FTS_PHYSICAL: u8 = 1 << 1; const FTS_LOGICAL: u8 = 1 << 2; pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); let mut opts = app!(SYNTAX, SUMMARY, ""); opts.optflag("c", diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index dc11be7b8..d01f0316e 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -17,6 +17,7 @@ use std::path::Path; use uucore::fs::display_permissions_unix; #[cfg(not(windows))] use uucore::mode; +use uucore::InvalidEncodingHandling; use walkdir::WalkDir; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -49,7 +50,9 @@ fn get_long_usage() -> String { } pub fn uumain(args: impl uucore::Args) -> i32 { - let mut args = args.collect_str(); + let mut args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); // Before we can parse 'args' with clap (and previously getopts), // a possible MODE prefix '-' needs to be removed (e.g. "chmod -x FILE"). diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index 23fb030ba..ff9c42dd0 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -23,6 +23,7 @@ use std::os::unix::fs::MetadataExt; use std::convert::AsRef; use std::path::Path; +use uucore::InvalidEncodingHandling; static ABOUT: &str = "change file owner and group"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -67,7 +68,9 @@ fn get_usage() -> String { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let usage = get_usage(); diff --git a/src/uu/chroot/src/chroot.rs b/src/uu/chroot/src/chroot.rs index 7e672da1e..9480830e5 100644 --- a/src/uu/chroot/src/chroot.rs +++ b/src/uu/chroot/src/chroot.rs @@ -15,8 +15,8 @@ use std::ffi::CString; use std::io::Error; use std::path::Path; use std::process::Command; -use uucore::entries; use uucore::libc::{self, chroot, setgid, setgroups, setuid}; +use uucore::{entries, InvalidEncodingHandling}; static VERSION: &str = env!("CARGO_PKG_VERSION"); static NAME: &str = "chroot"; @@ -32,7 +32,9 @@ mod options { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); let matches = App::new(executable!()) .version(VERSION) diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index b6436de87..1d45c1332 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -14,6 +14,7 @@ use clap::{App, Arg}; use std::fs::File; use std::io::{self, stdin, BufReader, Read}; use std::path::Path; +use uucore::InvalidEncodingHandling; // NOTE: CRC_TABLE_LEN *must* be <= 256 as we cast 0..CRC_TABLE_LEN to u8 const CRC_TABLE_LEN: usize = 256; @@ -180,7 +181,9 @@ mod options { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let matches = App::new(executable!()) .name(NAME) diff --git a/src/uu/comm/src/comm.rs b/src/uu/comm/src/comm.rs index 34b4330c9..d1d07461c 100644 --- a/src/uu/comm/src/comm.rs +++ b/src/uu/comm/src/comm.rs @@ -14,6 +14,7 @@ use std::cmp::Ordering; use std::fs::File; use std::io::{self, stdin, BufRead, BufReader, Stdin}; use std::path::Path; +use uucore::InvalidEncodingHandling; use clap::{App, Arg, ArgMatches}; @@ -134,6 +135,9 @@ fn open_file(name: &str) -> io::Result { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); let matches = App::new(executable!()) .version(VERSION) diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index ce11ba49a..9d2f81f43 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -17,6 +17,7 @@ mod splitname; use crate::csplit_error::CsplitError; use crate::splitname::SplitName; +use uucore::InvalidEncodingHandling; static VERSION: &str = env!("CARGO_PKG_VERSION"); static SUMMARY: &str = "split a file into sections determined by context lines"; @@ -711,7 +712,9 @@ mod tests { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let matches = App::new(executable!()) .version(VERSION) diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index 5bf310daa..71c52601e 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -17,6 +17,7 @@ use std::path::Path; use self::searcher::Searcher; use uucore::ranges::Range; +use uucore::InvalidEncodingHandling; mod buffer; mod searcher; @@ -443,7 +444,9 @@ mod options { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let matches = App::new(executable!()) .name(NAME) diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index 6cb5f9e1b..a2d819620 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -53,7 +53,9 @@ pub fn guess_syntax() -> OutputFmt { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let matches = app!(SYNTAX, SUMMARY, LONG_HELP) .optflag("b", "sh", "output Bourne shell code to set LS_COLORS") @@ -202,6 +204,8 @@ enum ParseState { Pass, } use std::collections::HashMap; +use uucore::InvalidEncodingHandling; + fn parse(lines: T, fmt: OutputFmt, fp: &str) -> Result where T: IntoIterator, diff --git a/src/uu/dirname/src/dirname.rs b/src/uu/dirname/src/dirname.rs index 1cf35d0c4..5937f16ca 100644 --- a/src/uu/dirname/src/dirname.rs +++ b/src/uu/dirname/src/dirname.rs @@ -10,6 +10,7 @@ extern crate uucore; use clap::{App, Arg}; use std::path::Path; +use uucore::InvalidEncodingHandling; static NAME: &str = "dirname"; static SYNTAX: &str = "[OPTION] NAME..."; @@ -27,7 +28,9 @@ mod options { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); let matches = App::new(executable!()) .name(NAME) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index fa3b3c80a..89dd3f739 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -25,6 +25,7 @@ use std::os::windows::fs::MetadataExt; use std::os::windows::io::AsRawHandle; use std::path::PathBuf; use std::time::{Duration, UNIX_EPOCH}; +use uucore::InvalidEncodingHandling; #[cfg(windows)] use winapi::shared::minwindef::{DWORD, LPVOID}; #[cfg(windows)] @@ -362,7 +363,9 @@ fn convert_size_other(size: u64, _multiplier: u64, block_size: u64) -> String { #[allow(clippy::cognitive_complexity)] pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let syntax = format!( "[OPTION]... [FILE]... diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index 4d38d7748..56cd967f4 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -13,6 +13,7 @@ use clap::{crate_version, App, Arg}; use std::io::{self, Write}; use std::iter::Peekable; use std::str::Chars; +use uucore::InvalidEncodingHandling; const NAME: &str = "echo"; const SUMMARY: &str = "display a line of text"; @@ -113,6 +114,9 @@ fn print_escaped(input: &str, mut output: impl Write) -> io::Result { } pub fn uumain(args: impl uucore::Args) -> i32 { + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); let matches = App::new(executable!()) .name(NAME) // TrailingVarArg specifies the final positional argument is a VarArg diff --git a/src/uu/expr/src/expr.rs b/src/uu/expr/src/expr.rs index 4a13812d3..5d63bed80 100644 --- a/src/uu/expr/src/expr.rs +++ b/src/uu/expr/src/expr.rs @@ -8,6 +8,8 @@ #[macro_use] extern crate uucore; +use uucore::InvalidEncodingHandling; + mod syntax_tree; mod tokens; @@ -15,7 +17,9 @@ static NAME: &str = "expr"; static VERSION: &str = env!("CARGO_PKG_VERSION"); pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); // For expr utility we do not want getopts. // The following usage should work without escaping hyphens: `expr -15 = 1 + 2 \* \( 3 - -4 \)` diff --git a/src/uu/factor/src/cli.rs b/src/uu/factor/src/cli.rs index 34bcf6a2d..fb7b3f192 100644 --- a/src/uu/factor/src/cli.rs +++ b/src/uu/factor/src/cli.rs @@ -14,6 +14,7 @@ use std::io::{self, stdin, stdout, BufRead, Write}; mod factor; pub(crate) use factor::*; +use uucore::InvalidEncodingHandling; mod miller_rabin; pub mod numeric; @@ -33,7 +34,10 @@ fn print_factors_str(num_str: &str, w: &mut impl io::Write) -> Result<(), Box i32 { - let matches = app!(SYNTAX, SUMMARY, LONG_HELP).parse(args.collect_str()); + let matches = app!(SYNTAX, SUMMARY, LONG_HELP).parse( + args.collect_str(InvalidEncodingHandling::Ignore) + .accept_any(), + ); let stdout = stdout(); let mut w = io::BufWriter::new(stdout.lock()); diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index fa703eade..1f52748f1 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -14,6 +14,7 @@ use clap::{App, Arg}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; use std::path::Path; +use uucore::InvalidEncodingHandling; const TAB_WIDTH: usize = 8; @@ -31,7 +32,9 @@ mod options { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); let (args, obs_width) = handle_obsolete(&args[..]); let matches = App::new(executable!()) diff --git a/src/uu/hostid/src/hostid.rs b/src/uu/hostid/src/hostid.rs index 5a4909c62..551866521 100644 --- a/src/uu/hostid/src/hostid.rs +++ b/src/uu/hostid/src/hostid.rs @@ -11,6 +11,7 @@ extern crate uucore; use libc::c_long; +use uucore::InvalidEncodingHandling; static SYNTAX: &str = "[options]"; static SUMMARY: &str = ""; @@ -22,7 +23,10 @@ extern "C" { } pub fn uumain(args: impl uucore::Args) -> i32 { - app!(SYNTAX, SUMMARY, LONG_HELP).parse(args.collect_str()); + app!(SYNTAX, SUMMARY, LONG_HELP).parse( + args.collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(), + ); hostid(); 0 } diff --git a/src/uu/kill/src/kill.rs b/src/uu/kill/src/kill.rs index 9af9c74f7..916c13cc3 100644 --- a/src/uu/kill/src/kill.rs +++ b/src/uu/kill/src/kill.rs @@ -13,6 +13,7 @@ extern crate uucore; use libc::{c_int, pid_t}; use std::io::Error; use uucore::signals::ALL_SIGNALS; +use uucore::InvalidEncodingHandling; static SYNTAX: &str = "[options] [...]"; static SUMMARY: &str = ""; @@ -29,7 +30,9 @@ pub enum Mode { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let (args, obs_signal) = handle_obsolete(args); let matches = app!(SYNTAX, SUMMARY, LONG_HELP) diff --git a/src/uu/link/src/link.rs b/src/uu/link/src/link.rs index 51c7acb5f..b82d7cfac 100644 --- a/src/uu/link/src/link.rs +++ b/src/uu/link/src/link.rs @@ -11,6 +11,7 @@ extern crate uucore; use std::fs::hard_link; use std::io::Error; use std::path::Path; +use uucore::InvalidEncodingHandling; static SYNTAX: &str = "[OPTIONS] FILE1 FILE2"; static SUMMARY: &str = "Create a link named FILE2 to FILE1"; @@ -24,7 +25,10 @@ pub fn normalize_error_message(e: Error) -> String { } pub fn uumain(args: impl uucore::Args) -> i32 { - let matches = app!(SYNTAX, SUMMARY, LONG_HELP).parse(args.collect_str()); + let matches = app!(SYNTAX, SUMMARY, LONG_HELP).parse( + args.collect_str(InvalidEncodingHandling::Ignore) + .accept_any(), + ); if matches.free.len() != 2 { crash!(1, "{}", msg_wrong_number_of_arguments!(2)); } diff --git a/src/uu/logname/src/logname.rs b/src/uu/logname/src/logname.rs index c1f0c31aa..8c6a946f5 100644 --- a/src/uu/logname/src/logname.rs +++ b/src/uu/logname/src/logname.rs @@ -13,6 +13,7 @@ extern crate uucore; use std::ffi::CStr; +use uucore::InvalidEncodingHandling; extern "C" { // POSIX requires using getlogin (or equivalent code) @@ -35,7 +36,10 @@ static SUMMARY: &str = "Print user's login name"; static LONG_HELP: &str = ""; pub fn uumain(args: impl uucore::Args) -> i32 { - app!(SYNTAX, SUMMARY, LONG_HELP).parse(args.collect_str()); + app!(SYNTAX, SUMMARY, LONG_HELP).parse( + args.collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(), + ); match get_userlogin() { Some(userlogin) => println!("{}", userlogin), diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 6317c1975..9a3b98e66 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -503,7 +503,9 @@ impl Config { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let usage = get_usage(); @@ -1391,6 +1393,7 @@ fn get_inode(metadata: &Metadata) -> String { use std::sync::Mutex; #[cfg(unix)] use uucore::entries; +use uucore::InvalidEncodingHandling; #[cfg(unix)] fn cached_uid2usr(uid: u32) -> String { diff --git a/src/uu/mkfifo/src/mkfifo.rs b/src/uu/mkfifo/src/mkfifo.rs index 14701af4d..2fdd4abec 100644 --- a/src/uu/mkfifo/src/mkfifo.rs +++ b/src/uu/mkfifo/src/mkfifo.rs @@ -11,6 +11,7 @@ extern crate uucore; use clap::{App, Arg}; use libc::mkfifo; use std::ffi::CString; +use uucore::InvalidEncodingHandling; static NAME: &str = "mkfifo"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -25,7 +26,9 @@ mod options { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let matches = App::new(executable!()) .name(NAME) diff --git a/src/uu/mknod/src/mknod.rs b/src/uu/mknod/src/mknod.rs index 98404f89f..fc6fb0870 100644 --- a/src/uu/mknod/src/mknod.rs +++ b/src/uu/mknod/src/mknod.rs @@ -16,6 +16,7 @@ use libc::{S_IFBLK, S_IFCHR, S_IFIFO, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOT use getopts::Options; use std::ffi::CString; +use uucore::InvalidEncodingHandling; static NAME: &str = "mknod"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -40,7 +41,9 @@ fn _makenod(path: CString, mode: mode_t, dev: dev_t) -> i32 { #[allow(clippy::cognitive_complexity)] pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let mut opts = Options::new(); diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 59e7d0faa..eabdbee85 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -17,6 +17,7 @@ use std::io::{stdin, stdout, BufRead, BufReader, Read, Write}; extern crate nix; #[cfg(all(unix, not(target_os = "fuchsia")))] use nix::sys::termios::{self, LocalFlags, SetArg}; +use uucore::InvalidEncodingHandling; #[cfg(target_os = "redox")] extern crate redox_termios; @@ -38,6 +39,9 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); let matches = App::new(executable!()) .version(VERSION) diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 3b5b5a2e8..7c5f01811 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -16,6 +16,7 @@ use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; use std::iter::repeat; use std::path::Path; +use uucore::InvalidEncodingHandling; mod helper; @@ -84,7 +85,9 @@ pub mod options { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); let matches = App::new(executable!()) .name(NAME) diff --git a/src/uu/nohup/src/nohup.rs b/src/uu/nohup/src/nohup.rs index afbf2541b..83153ad37 100644 --- a/src/uu/nohup/src/nohup.rs +++ b/src/uu/nohup/src/nohup.rs @@ -20,6 +20,7 @@ use std::io::Error; use std::os::unix::prelude::*; use std::path::{Path, PathBuf}; use uucore::fs::{is_stderr_interactive, is_stdin_interactive, is_stdout_interactive}; +use uucore::InvalidEncodingHandling; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Run COMMAND ignoring hangup signals."; @@ -42,6 +43,9 @@ mod options { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); let matches = App::new(executable!()) .version(VERSION) diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 36eae66ab..571ca543d 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -42,6 +42,7 @@ use crate::partialreader::*; use crate::peekreader::*; use crate::prn_char::format_ascii_dump; use clap::{self, AppSettings, Arg, ArgMatches}; +use uucore::InvalidEncodingHandling; static VERSION: &str = env!("CARGO_PKG_VERSION"); const PEEK_BUFFER_SIZE: usize = 4; // utf-8 can be 4 bytes @@ -221,7 +222,9 @@ impl OdOptions { /// parses and validates command line parameters, prepares data structures, /// opens the input and calls `odfunc` to process the input. pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let clap_opts = clap::App::new(executable!()) .version(VERSION) diff --git a/src/uu/pathchk/src/pathchk.rs b/src/uu/pathchk/src/pathchk.rs index c27e52513..5606c4d6a 100644 --- a/src/uu/pathchk/src/pathchk.rs +++ b/src/uu/pathchk/src/pathchk.rs @@ -15,6 +15,7 @@ extern crate uucore; use clap::{App, Arg}; use std::fs; use std::io::{ErrorKind, Write}; +use uucore::InvalidEncodingHandling; // operating mode enum Mode { @@ -45,6 +46,9 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); let matches = App::new(executable!()) .version(VERSION) diff --git a/src/uu/pinky/src/pinky.rs b/src/uu/pinky/src/pinky.rs index 851a3cd42..3392c9a79 100644 --- a/src/uu/pinky/src/pinky.rs +++ b/src/uu/pinky/src/pinky.rs @@ -20,6 +20,7 @@ use std::fs::File; use std::os::unix::fs::MetadataExt; use std::path::PathBuf; +use uucore::InvalidEncodingHandling; static SYNTAX: &str = "[OPTION]... [USER]..."; static SUMMARY: &str = "A lightweight 'finger' program; print user information."; @@ -27,7 +28,7 @@ static SUMMARY: &str = "A lightweight 'finger' program; print user information. const BUFSIZE: usize = 1024; pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args.collect_str(InvalidEncodingHandling::Ignore).accept_any(); let long_help = &format!( " diff --git a/src/uu/printf/src/printf.rs b/src/uu/printf/src/printf.rs index d947a7d83..88d18838d 100644 --- a/src/uu/printf/src/printf.rs +++ b/src/uu/printf/src/printf.rs @@ -2,6 +2,8 @@ // spell-checker:ignore (change!) each's // spell-checker:ignore (ToDO) LONGHELP FORMATSTRING templating parameterizing formatstr +use uucore::InvalidEncodingHandling; + mod cli; mod memo; mod tokenize; @@ -271,7 +273,9 @@ COPYRIGHT : "; pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let location = &args[0]; if args.len() <= 1 { diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index 69b3f7aa1..d2aa619b4 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -17,6 +17,7 @@ use std::collections::{BTreeSet, HashMap, HashSet}; use std::default::Default; use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; +use uucore::InvalidEncodingHandling; static NAME: &str = "ptx"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -630,7 +631,9 @@ mod options { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); // let mut opts = Options::new(); let matches = App::new(executable!()) diff --git a/src/uu/relpath/src/relpath.rs b/src/uu/relpath/src/relpath.rs index 82779107a..f1b2c9a43 100644 --- a/src/uu/relpath/src/relpath.rs +++ b/src/uu/relpath/src/relpath.rs @@ -14,6 +14,7 @@ use clap::{App, Arg}; use std::env; use std::path::{Path, PathBuf}; use uucore::fs::{canonicalize, CanonicalizeMode}; +use uucore::InvalidEncodingHandling; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Convert TO destination to the relative path from the FROM dir. @@ -30,7 +31,9 @@ fn get_usage() -> String { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); let usage = get_usage(); let matches = App::new(executable!()) diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index b89d48a10..15a4eff26 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -17,6 +17,7 @@ use std::io; use std::io::prelude::*; use std::io::SeekFrom; use std::path::{Path, PathBuf}; +use uucore::InvalidEncodingHandling; #[macro_use] extern crate uucore; @@ -270,7 +271,9 @@ pub mod options { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let usage = get_usage(); diff --git a/src/uu/shuf/src/shuf.rs b/src/uu/shuf/src/shuf.rs index f7af05214..9c735673c 100644 --- a/src/uu/shuf/src/shuf.rs +++ b/src/uu/shuf/src/shuf.rs @@ -14,6 +14,13 @@ use clap::{App, Arg}; use rand::Rng; use std::fs::File; use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write}; +use uucore::InvalidEncodingHandling; + +enum Mode { + Default(String), + Echo(Vec), + InputRange((usize, usize)), +} static NAME: &str = "shuf"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -34,12 +41,6 @@ struct Options { sep: u8, } -enum Mode { - Default(String), - Echo(Vec), - InputRange((usize, usize)), -} - mod options { pub static ECHO: &str = "echo"; pub static INPUT_RANGE: &str = "input-range"; @@ -52,6 +53,10 @@ mod options { } pub fn uumain(args: impl uucore::Args) -> i32 { + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); + let matches = App::new(executable!()) .name(NAME) .version(VERSION) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 5fd7ddcce..de19d0a5c 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -37,6 +37,7 @@ use std::ops::Range; use std::path::Path; use unicode_width::UnicodeWidthStr; use uucore::fs::is_stdin_interactive; // for Iterator::dedup() +use uucore::InvalidEncodingHandling; static NAME: &str = "sort"; static ABOUT: &str = "Display sorted concatenation of all FILE(s)."; @@ -768,7 +769,9 @@ With no FILE, or when FILE is -, read standard input.", } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let usage = get_usage(); let mut settings: GlobalSettings = Default::default(); diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index ddbd76133..77f6d9dad 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -19,6 +19,7 @@ use std::path::PathBuf; use std::process::Command; use tempfile::tempdir; use tempfile::TempDir; +use uucore::InvalidEncodingHandling; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = @@ -186,6 +187,9 @@ fn get_preload_env(tmp_dir: &mut TempDir) -> io::Result<(String, PathBuf)> { } pub fn uumain(args: impl uucore::Args) -> i32 { + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let usage = get_usage(); let matches = App::new(executable!()) diff --git a/src/uu/sum/src/sum.rs b/src/uu/sum/src/sum.rs index d0fbc7c0d..ea833c0d2 100644 --- a/src/uu/sum/src/sum.rs +++ b/src/uu/sum/src/sum.rs @@ -14,6 +14,7 @@ use clap::{App, Arg}; use std::fs::File; use std::io::{stdin, Read, Result}; use std::path::Path; +use uucore::InvalidEncodingHandling; static NAME: &str = "sum"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -94,7 +95,9 @@ mod options { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); let matches = App::new(executable!()) .name(NAME) diff --git a/src/uu/tac/src/tac.rs b/src/uu/tac/src/tac.rs index 1fb6489da..a638d578d 100644 --- a/src/uu/tac/src/tac.rs +++ b/src/uu/tac/src/tac.rs @@ -13,6 +13,7 @@ extern crate uucore; use clap::{App, Arg}; use std::io::{stdin, stdout, BufReader, Read, Stdout, Write}; use std::{fs::File, path::Path}; +use uucore::InvalidEncodingHandling; static NAME: &str = "tac"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -27,7 +28,9 @@ mod options { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); let matches = App::new(executable!()) .name(NAME) diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index 23e2ec842..7d557f1ce 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -18,6 +18,7 @@ use std::process::{Command, Stdio}; use std::time::Duration; use uucore::process::ChildExt; use uucore::signals::signal_by_name_or_value; +use uucore::InvalidEncodingHandling; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Start COMMAND, and kill it if still running after DURATION."; @@ -98,7 +99,10 @@ impl Config { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); + let usage = get_usage(); let app = App::new("timeout") diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index b94b11b9d..6c1c0746a 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -21,6 +21,7 @@ use fnv::FnvHashMap; use std::io::{stdin, stdout, BufRead, BufWriter, Write}; use crate::expand::ExpandSet; +use uucore::InvalidEncodingHandling; static NAME: &str = "tr"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -187,6 +188,9 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); let matches = App::new(executable!()) .version(VERSION) diff --git a/src/uu/tsort/src/tsort.rs b/src/uu/tsort/src/tsort.rs index 967a9514a..c96939b20 100644 --- a/src/uu/tsort/src/tsort.rs +++ b/src/uu/tsort/src/tsort.rs @@ -14,6 +14,7 @@ use std::collections::{HashMap, HashSet}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; use std::path::Path; +use uucore::InvalidEncodingHandling; static VERSION: &str = env!("CARGO_PKG_VERSION"); static SUMMARY: &str = "Topological sort the strings in FILE. @@ -26,7 +27,9 @@ mod options { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); let matches = App::new(executable!()) .version(VERSION) diff --git a/src/uu/tty/src/tty.rs b/src/uu/tty/src/tty.rs index 815c6f96b..ef2d848e9 100644 --- a/src/uu/tty/src/tty.rs +++ b/src/uu/tty/src/tty.rs @@ -15,6 +15,7 @@ extern crate uucore; use clap::{App, Arg}; use std::ffi::CStr; use uucore::fs::is_stdin_interactive; +use uucore::InvalidEncodingHandling; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Print the file name of the terminal connected to standard input."; @@ -28,8 +29,10 @@ fn get_usage() -> String { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); let usage = get_usage(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); let matches = App::new(executable!()) .version(VERSION) diff --git a/src/uu/unexpand/src/unexpand.rs b/src/uu/unexpand/src/unexpand.rs index a811d3b66..22b6b807a 100644 --- a/src/uu/unexpand/src/unexpand.rs +++ b/src/uu/unexpand/src/unexpand.rs @@ -16,6 +16,7 @@ use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Stdout, Write}; use std::str::from_utf8; use unicode_width::UnicodeWidthChar; +use uucore::InvalidEncodingHandling; static NAME: &str = "unexpand"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -90,7 +91,9 @@ impl Options { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let matches = App::new(executable!()) .name(NAME) diff --git a/src/uu/unlink/src/unlink.rs b/src/uu/unlink/src/unlink.rs index 26460e59c..9d9d6385b 100644 --- a/src/uu/unlink/src/unlink.rs +++ b/src/uu/unlink/src/unlink.rs @@ -17,6 +17,7 @@ use libc::{lstat, stat, unlink}; use libc::{S_IFLNK, S_IFMT, S_IFREG}; use std::ffi::CString; use std::io::{Error, ErrorKind}; +use uucore::InvalidEncodingHandling; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Unlink the file at [FILE]."; @@ -27,7 +28,9 @@ fn get_usage() -> String { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); let usage = get_usage(); diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index 9444985dc..e979d2d46 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -16,6 +16,7 @@ use std::borrow::Cow; use std::ffi::CStr; use std::os::unix::fs::MetadataExt; use std::path::PathBuf; +use uucore::InvalidEncodingHandling; static SYNTAX: &str = "[OPTION]... [ FILE | ARG1 ARG2 ]"; static SUMMARY: &str = "Print information about users who are currently logged in."; @@ -44,7 +45,9 @@ If ARG1 ARG2 given, -m presumed: 'am i' or 'mom likes' are usual. "; pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let mut opts = app!(SYNTAX, SUMMARY, LONG_HELP); opts.optflag("a", "all", "same as -b -d --login -p -r -t -T -u"); diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 208e9536c..6dddf8696 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -68,10 +68,94 @@ pub use crate::features::wide; use std::ffi::OsString; +pub enum InvalidEncodingHandling { + Ignore, + ConvertLossy, + Panic, +} + +#[must_use] +pub enum ConversionResult { + Complete(Vec), + Lossy(Vec), +} + +impl ConversionResult { + pub fn accept_any(self) -> Vec { + match self { + Self::Complete(result) => result, + Self::Lossy(result) => result, + } + } + + pub fn expect_lossy(self, msg: &str) -> Vec { + match self { + Self::Lossy(result) => result, + Self::Complete(_) => { + panic!("{}", msg); + } + } + } + + pub fn expect_complete(self, msg: &str) -> Vec { + match self { + Self::Complete(result) => result, + Self::Lossy(_) => { + panic!("{}", msg); + } + } + } +} + pub trait Args: Iterator + Sized { - fn collect_str(self) -> Vec { - // FIXME: avoid unwrap() - self.map(|s| s.into_string().unwrap()).collect() + /// Converts each iterator item to a String and collects these into a vector + /// On invalid encoding, the result will depend on the argument. This method allows to either drop entries with illegal encoding + /// completely (```InvalidEncodingHandling::Ignore```), convert them using lossy-conversion (```InvalidEncodingHandling::Lossy```) which will + /// result in strange strings or can chosen to panic (```InvalidEncodingHandling::Panic```). + /// # Arguments + /// * `handling` - This switch allows to switch the behavior, when invalid encoding is encountered + /// # Panics + /// * Occurs, when invalid encoding is encountered and handling is set to ```InvalidEncodingHandling::Panic``` + fn collect_str(self, handling: InvalidEncodingHandling) -> ConversionResult { + let mut full_conversion = true; + let result_vector: Vec = self + .map(|s| match s.into_string() { + Ok(string) => Ok(string), + Err(s_ret) => { + full_conversion = false; + let lossy_conversion = s_ret.to_string_lossy(); + eprintln!( + "Input with broken encoding occured! (s = '{}') ", + &lossy_conversion + ); + match handling { + InvalidEncodingHandling::Ignore => Err(String::new()), + InvalidEncodingHandling::ConvertLossy => Err(lossy_conversion.to_string()), + InvalidEncodingHandling::Panic => { + panic!("Broken encoding found but caller cannot handle it") + } + } + } + }) + .filter(|s| match handling { + InvalidEncodingHandling::Ignore => s.is_ok(), + _ => true, + }) + .map(|s| match s.is_ok() { + true => s.unwrap(), + false => s.unwrap_err(), + }) + .collect(); + + match full_conversion { + true => ConversionResult::Complete(result_vector), + false => ConversionResult::Lossy(result_vector), + } + } + + /// convience function for a more slim interface + fn collect_str_lossy(self) -> ConversionResult { + self.collect_str(InvalidEncodingHandling::ConvertLossy) } } @@ -85,3 +169,83 @@ pub fn args() -> impl Iterator { pub fn args_os() -> impl Iterator { wild::args_os() } + +#[cfg(test)] +mod tests { + use super::*; + use std::ffi::OsStr; + + fn make_os_vec(os_str: &OsStr) -> Vec { + vec![ + OsString::from("test"), + OsString::from("สวัสดี"), + os_str.to_os_string(), + ] + } + + fn collect_os_str(vec: Vec, handling: InvalidEncodingHandling) -> ConversionResult { + vec.into_iter().collect_str(handling) + } + + fn test_invalid_utf8_args_lossy(os_str: &OsStr) { + //assert our string is invalid utf8 + assert!(os_str.to_os_string().into_string().is_err()); + let test_vec = make_os_vec(os_str); + let collected_to_str = + collect_os_str(test_vec.clone(), InvalidEncodingHandling::ConvertLossy) + .expect_lossy("Lossy conversion expected in this test: bad encoding entries should be converted as good as possible"); + //conservation of length - when accepting lossy conversion no arguments may be dropped + assert_eq!(collected_to_str.len(), test_vec.len()); + //first indices identical + for index in 0..2 { + assert_eq!( + collected_to_str.get(index).unwrap(), + test_vec.get(index).unwrap().to_str().unwrap() + ); + } + //lossy conversion for string with illegal encoding is done + assert_eq!( + *collected_to_str.get(2).unwrap(), + os_str.to_os_string().to_string_lossy() + ); + } + + fn test_invalid_utf8_args_ignore(os_str: &OsStr) { + //assert our string is invalid utf8 + assert!(os_str.to_os_string().into_string().is_err()); + let test_vec = make_os_vec(os_str); + let collected_to_str = collect_os_str(test_vec.clone(), InvalidEncodingHandling::Ignore) + .expect_lossy( + "Lossy conversion expected in this test: bad encoding entries should be filtered", + ); + //assert that the broken entry is filtered out + assert_eq!(collected_to_str.len(), test_vec.len() - 1); + //assert that the unbroken indices are converted as expected + for index in 0..2 { + assert_eq!( + collected_to_str.get(index).unwrap(), + test_vec.get(index).unwrap().to_str().unwrap() + ); + } + } + + #[test] + fn valid_utf8_encoding_args() { + //create a vector containing only correct encoding + let test_vec = make_os_vec(&OsString::from("test2")); + //expect complete conversion without losses, even when lossy conversion is accepted + let _ = collect_os_str(test_vec.clone(), InvalidEncodingHandling::ConvertLossy) + .expect_complete("Lossy conversion not expected in this test"); + } + + #[cfg(any(unix, target_os = "redox"))] + #[test] + fn invalid_utf8_args_unix() { + use std::os::unix::ffi::OsStrExt; + + let source = [0x66, 0x6f, 0x80, 0x6f]; + let os_str = OsStr::from_bytes(&source[..]); + test_invalid_utf8_args_lossy(os_str); + test_invalid_utf8_args_ignore(os_str); + } +} diff --git a/tests/by-util/test_basename.rs b/tests/by-util/test_basename.rs index 3483e800c..8d32b4008 100644 --- a/tests/by-util/test_basename.rs +++ b/tests/by-util/test_basename.rs @@ -1,4 +1,5 @@ use crate::common::util::*; +use std::ffi::OsStr; #[test] fn test_directory() { @@ -84,3 +85,18 @@ fn test_no_args() { fn test_too_many_args() { expect_error(vec!["a", "b", "c"]); } + +fn test_invalid_utf8_args(os_str: &OsStr) { + let test_vec = vec![os_str.to_os_string()]; + new_ucmd!().args(&test_vec).succeeds().stdout_is("fo�o\n"); +} + +#[cfg(any(unix, target_os = "redox"))] +#[test] +fn invalid_utf8_args_unix() { + use std::os::unix::ffi::OsStrExt; + + let source = [0x66, 0x6f, 0x80, 0x6f]; + let os_str = OsStr::from_bytes(&source[..]); + test_invalid_utf8_args(os_str); +} diff --git a/tests/common/util.rs b/tests/common/util.rs index 93bbccc24..1ade70127 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -20,6 +20,7 @@ use std::str::from_utf8; use std::thread::sleep; use std::time::Duration; use tempfile::TempDir; +use uucore::{Args, InvalidEncodingHandling}; #[cfg(windows)] static PROGNAME: &str = concat!(env!("CARGO_PKG_NAME"), ".exe"); @@ -751,7 +752,8 @@ impl UCommand { panic!("{}", ALREADY_RUN); } self.comm_string.push_str(" "); - self.comm_string.push_str(arg.as_ref().to_str().unwrap()); + self.comm_string + .push_str(arg.as_ref().to_str().unwrap_or_default()); self.raw.arg(arg.as_ref()); self } @@ -762,9 +764,15 @@ impl UCommand { if self.has_run { panic!("{}", MULTIPLE_STDIN_MEANINGLESS); } - for s in args { + let strings = args + .iter() + .map(|s| s.as_ref().to_os_string()) + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); + + for s in strings { self.comm_string.push_str(" "); - self.comm_string.push_str(s.as_ref().to_str().unwrap()); + self.comm_string.push_str(&s); } self.raw.args(args.as_ref()); From 0f707cdb25792d003d0cabb9df20428ebc34548d Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 16:33:12 -0500 Subject: [PATCH 0454/1135] Adjust max buffer size for read back as well --- src/uu/sort/src/external_sort/mod.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/uu/sort/src/external_sort/mod.rs b/src/uu/sort/src/external_sort/mod.rs index 222da5b58..fae00fb72 100644 --- a/src/uu/sort/src/external_sort/mod.rs +++ b/src/uu/sort/src/external_sort/mod.rs @@ -181,7 +181,7 @@ where for seq in unsorted { let seq_size = seq.get_size(); total_read += seq_size; - // Grow buffer size for a Line larger than buffer + // Grow buffer size for a struct/Line larger than buffer adjusted_buffer_size = if adjusted_buffer_size < seq_size { seq_size @@ -212,10 +212,9 @@ where } // initialize buffers for each chunk - iter.max_per_chunk = self - .buffer_bytes + iter.max_per_chunk = adjusted_buffer_size .checked_div(iter.chunks) - .unwrap_or(self.buffer_bytes); + .unwrap_or(adjusted_buffer_size); iter.buffers = vec![VecDeque::new(); iter.chunks as usize]; iter.chunk_offsets = vec![0 as u64; iter.chunks as usize]; for chunk_num in 0..iter.chunks { From f8e7fe4c27b9f9c74218fe02ab24d5ecc5b7a8f2 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 25 Apr 2021 23:33:19 +0200 Subject: [PATCH 0455/1135] Update to use stdout_str() --- tests/by-util/test_ls.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 364a71d47..b819ef159 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1726,12 +1726,8 @@ fn test_ls_sort_extension() { ]; let result = scene.ucmd().arg("-1aX").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert_eq!(result.stdout.split('\n').collect::>(), expected,); + assert_eq!(result.stdout_str().split('\n').collect::>(), expected,); let result = scene.ucmd().arg("-1a").arg("--sort=extension").run(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - assert_eq!(result.stdout.split('\n').collect::>(), expected,); -} \ No newline at end of file + assert_eq!(result.stdout_str().split('\n').collect::>(), expected,); +} From 32222c1ee7a1efe778624ddbe55577d604f045b0 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 17:52:20 -0500 Subject: [PATCH 0456/1135] Remove unneeded condition for use of NumCache --- src/uu/sort/src/external_sort/mod.rs | 10 +++++++--- src/uu/sort/src/sort.rs | 15 +++------------ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/uu/sort/src/external_sort/mod.rs b/src/uu/sort/src/external_sort/mod.rs index fae00fb72..9f3eb3776 100644 --- a/src/uu/sort/src/external_sort/mod.rs +++ b/src/uu/sort/src/external_sort/mod.rs @@ -212,9 +212,13 @@ where } // initialize buffers for each chunk - iter.max_per_chunk = adjusted_buffer_size - .checked_div(iter.chunks) - .unwrap_or(adjusted_buffer_size); + // iter.max_per_chunk = adjusted_buffer_size + // .checked_div(iter.chunks) + // .unwrap_or(adjusted_buffer_size); + // + // + // + iter.max_per_chunk = adjusted_buffer_size; iter.buffers = vec![VecDeque::new(); iter.chunks as usize]; iter.chunk_offsets = vec![0 as u64; iter.chunks as usize]; for chunk_num in 0..iter.chunks { diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index c24d930dc..ea7d36bae 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1299,19 +1299,10 @@ fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering (a_str, a_selection.num_cache.as_num_info()), (b_str, b_selection.num_cache.as_num_info()), ), - // serde JSON has issues with f64 null values, so caching them won't work for us with ext sort SortMode::GeneralNumeric => { - if global_settings.buffer_size == DEFAULT_BUF_SIZE { - general_numeric_compare( - a_selection.num_cache.as_f64(), - b_selection.num_cache.as_f64(), - ) - } else { - general_numeric_compare( - general_f64_parse(&a_str[get_leading_gen(a_str)]), - general_f64_parse(&b_str[get_leading_gen(b_str)]), - ) - } + general_numeric_compare( + general_f64_parse(&a_str[get_leading_gen(a_str)]), + general_f64_parse(&b_str[get_leading_gen(b_str)]),) } SortMode::Month => month_compare(a_str, b_str), SortMode::Version => version_compare(a_str, b_str), From fc899ffe7a7a0698db414cb642cfcfee562fe1db Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 19:07:24 -0500 Subject: [PATCH 0457/1135] Implement a minimum readback buffer --- src/uu/sort/src/external_sort/mod.rs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/uu/sort/src/external_sort/mod.rs b/src/uu/sort/src/external_sort/mod.rs index 9f3eb3776..628911fe7 100644 --- a/src/uu/sort/src/external_sort/mod.rs +++ b/src/uu/sort/src/external_sort/mod.rs @@ -212,13 +212,22 @@ where } // initialize buffers for each chunk - // iter.max_per_chunk = adjusted_buffer_size - // .checked_div(iter.chunks) - // .unwrap_or(adjusted_buffer_size); // - // + // Having a right sized buffer for each chunk for smallish values seems silly to me? // - iter.max_per_chunk = adjusted_buffer_size; + // We will have to have the entire iter in memory sometime right? + // Set minimum to the size of the writer buffer, ~8K + // + const MINIMUM_READBACK_BUFFER: u64 = 8200; + let right_sized_buffer = adjusted_buffer_size + .checked_div(iter.chunks) + .unwrap_or(adjusted_buffer_size); + iter.max_per_chunk = + if right_sized_buffer > MINIMUM_READBACK_BUFFER { + right_sized_buffer + } else { + MINIMUM_READBACK_BUFFER + }; iter.buffers = vec![VecDeque::new(); iter.chunks as usize]; iter.chunk_offsets = vec![0 as u64; iter.chunks as usize]; for chunk_num in 0..iter.chunks { From 8e258075f600b7b6891487ecae4a154ab8ee1573 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 19:21:19 -0500 Subject: [PATCH 0458/1135] Potential fix to tests on Windows --- src/uu/sort/src/sort.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index ea7d36bae..aa2e1bfe7 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1064,7 +1064,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.tmp_dir = PathBuf::from(result); } else { for (key, value) in env::vars_os() { - if key == OsString::from("TMPDIR") { + if key == OsString::from("TMPDIR") + || key == OsString::from("TEMP") + || key == OsString::from("TMP") + { settings.tmp_dir = PathBuf::from(value); break; } From 1a407c2328ba479b11e0a9af1e50c607958ebede Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 21:17:56 -0500 Subject: [PATCH 0459/1135] Set a dynamic minimum buffer size --- src/uu/sort/src/external_sort/mod.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/uu/sort/src/external_sort/mod.rs b/src/uu/sort/src/external_sort/mod.rs index 628911fe7..81455eb18 100644 --- a/src/uu/sort/src/external_sort/mod.rs +++ b/src/uu/sort/src/external_sort/mod.rs @@ -176,15 +176,28 @@ where let mut chunk = Vec::new(); // Initial buffer is specified by user let mut adjusted_buffer_size = self.buffer_bytes; + let (iter_size, _) = unsorted.size_hint(); // make the initial chunks on disk for seq in unsorted { let seq_size = seq.get_size(); total_read += seq_size; - // Grow buffer size for a struct/Line larger than buffer + + // GNU minimum is 16 * (sizeof struct + 2), but GNU uses about + // 1/10 the memory that we do. And GNU even says in the code it may + // not work on small buffer sizes. + // + // The following seems to work pretty well, and has about the same max + // RSS as lower minimum values. + // + let minimum_buffer_size: u64 = iter_size as u64 * seq_size / 8; + adjusted_buffer_size = + // Grow buffer size for a struct/Line larger than buffer if adjusted_buffer_size < seq_size { seq_size + } else if adjusted_buffer_size < minimum_buffer_size { + minimum_buffer_size } else { adjusted_buffer_size }; From e5c19734c8a3d7f3b94a25887149b261ccffd1a8 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 21:38:22 -0500 Subject: [PATCH 0460/1135] Change Default Buffer to usize::MAX --- src/uu/sort/src/sort.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index aa2e1bfe7..55362d4ad 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -93,8 +93,7 @@ static NEGATIVE: char = '-'; static POSITIVE: char = '+'; static DEFAULT_TMPDIR: &str = r"/tmp"; -// 4GB buffer for Vec before we dump to disk, never used -static DEFAULT_BUF_SIZE: usize = 4000000000; +static DEFAULT_BUF_SIZE: usize = usize::MAX; #[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy)] enum SortMode { @@ -142,11 +141,11 @@ impl GlobalSettings { let suf_usize: usize = match suf_str.to_uppercase().as_str() { // SI Units "B" => 1usize, - "K" => 1024usize, - "M" => 1024000usize, - "G" => 1024000000usize, - // GNU regards empty human numeric value as 1024 bytes - _ => 1024usize, + "K" => 1000usize, + "M" => 1000000usize, + "G" => 1000000000usize, + // GNU regards empty human numeric values as K by default + _ => 1000usize, }; num_usize * suf_usize } From 6654519c7d91bfd22b14787106a4700977813020 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 22:39:17 -0500 Subject: [PATCH 0461/1135] Specify a default tempdir for Windows --- src/uu/sort/src/sort.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 55362d4ad..53f9a356a 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -92,7 +92,17 @@ static THOUSANDS_SEP: char = ','; static NEGATIVE: char = '-'; static POSITIVE: char = '+'; +#[cfg(any( + target_os = "windows", +))] +static DEFAULT_TMPDIR: &str = r"%USERPROFILE%\AppData\Local\Temp"; + +#[cfg(not(any( + target_os = "windows", +)))] static DEFAULT_TMPDIR: &str = r"/tmp"; + + static DEFAULT_BUF_SIZE: usize = usize::MAX; #[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy)] From c01c6a7d78427d766c71dc3f1fc2753c863cc1cb Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Sun, 25 Apr 2021 22:41:11 -0500 Subject: [PATCH 0462/1135] Ran rustfmt --- src/uu/sort/src/external_sort/mod.rs | 29 ++++++++++++++-------------- src/uu/sort/src/sort.rs | 24 +++++++++-------------- 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/src/uu/sort/src/external_sort/mod.rs b/src/uu/sort/src/external_sort/mod.rs index 81455eb18..fd942d4a7 100644 --- a/src/uu/sort/src/external_sort/mod.rs +++ b/src/uu/sort/src/external_sort/mod.rs @@ -183,16 +183,16 @@ where let seq_size = seq.get_size(); total_read += seq_size; - // GNU minimum is 16 * (sizeof struct + 2), but GNU uses about - // 1/10 the memory that we do. And GNU even says in the code it may + // GNU minimum is 16 * (sizeof struct + 2), but GNU uses about + // 1/10 the memory that we do. And GNU even says in the code it may // not work on small buffer sizes. - // - // The following seems to work pretty well, and has about the same max + // + // The following seems to work pretty well, and has about the same max // RSS as lower minimum values. - // + // let minimum_buffer_size: u64 = iter_size as u64 * seq_size / 8; - - adjusted_buffer_size = + + adjusted_buffer_size = // Grow buffer size for a struct/Line larger than buffer if adjusted_buffer_size < seq_size { seq_size @@ -233,14 +233,13 @@ where // const MINIMUM_READBACK_BUFFER: u64 = 8200; let right_sized_buffer = adjusted_buffer_size - .checked_div(iter.chunks) - .unwrap_or(adjusted_buffer_size); - iter.max_per_chunk = - if right_sized_buffer > MINIMUM_READBACK_BUFFER { - right_sized_buffer - } else { - MINIMUM_READBACK_BUFFER - }; + .checked_div(iter.chunks) + .unwrap_or(adjusted_buffer_size); + iter.max_per_chunk = if right_sized_buffer > MINIMUM_READBACK_BUFFER { + right_sized_buffer + } else { + MINIMUM_READBACK_BUFFER + }; iter.buffers = vec![VecDeque::new(); iter.chunks as usize]; iter.chunk_offsets = vec![0 as u64; iter.chunks as usize]; for chunk_num in 0..iter.chunks { diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 53f9a356a..c9e797579 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -92,17 +92,12 @@ static THOUSANDS_SEP: char = ','; static NEGATIVE: char = '-'; static POSITIVE: char = '+'; -#[cfg(any( - target_os = "windows", -))] +#[cfg(any(target_os = "windows",))] static DEFAULT_TMPDIR: &str = r"%USERPROFILE%\AppData\Local\Temp"; -#[cfg(not(any( - target_os = "windows", -)))] +#[cfg(not(any(target_os = "windows",)))] static DEFAULT_TMPDIR: &str = r"/tmp"; - static DEFAULT_BUF_SIZE: usize = usize::MAX; #[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy)] @@ -1073,9 +1068,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.tmp_dir = PathBuf::from(result); } else { for (key, value) in env::vars_os() { - if key == OsString::from("TMPDIR") - || key == OsString::from("TEMP") - || key == OsString::from("TMP") + if key == OsString::from("TMPDIR") + || key == OsString::from("TEMP") + || key == OsString::from("TMP") { settings.tmp_dir = PathBuf::from(value); break; @@ -1311,11 +1306,10 @@ fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering (a_str, a_selection.num_cache.as_num_info()), (b_str, b_selection.num_cache.as_num_info()), ), - SortMode::GeneralNumeric => { - general_numeric_compare( - general_f64_parse(&a_str[get_leading_gen(a_str)]), - general_f64_parse(&b_str[get_leading_gen(b_str)]),) - } + SortMode::GeneralNumeric => general_numeric_compare( + general_f64_parse(&a_str[get_leading_gen(a_str)]), + general_f64_parse(&b_str[get_leading_gen(b_str)]), + ), SortMode::Month => month_compare(a_str, b_str), SortMode::Version => version_compare(a_str, b_str), SortMode::Default => default_compare(a_str, b_str), From 5578ba6eed000249122627099303cbb6c7db52d2 Mon Sep 17 00:00:00 2001 From: Ricardo Iglesias Date: Sun, 25 Apr 2021 22:24:55 -0700 Subject: [PATCH 0463/1135] base32: move from getopts to clap Note, I needed to change the error messages in one of the tests because getopt and clap have different error messages when not providing a default value --- Cargo.lock | 3 + src/uu/base32/Cargo.toml | 1 + src/uu/base32/src/base32.rs | 9 +- src/uu/base32/src/base_common.rs | 204 ++++++++++++++++++++++++------- tests/by-util/test_base32.rs | 21 +++- 5 files changed, 182 insertions(+), 56 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 321f41d89..aea4956e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "advapi32-sys" version = "0.2.0" @@ -1653,6 +1655,7 @@ dependencies = [ name = "uu_base32" version = "0.0.6" dependencies = [ + "clap", "uucore", "uucore_procs", ] diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index a1d7ba17e..1b448af0a 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/base32.rs" [dependencies] +clap = "2.33" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features = ["encoding"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/base32/src/base32.rs b/src/uu/base32/src/base32.rs index b47f4d4cc..b11b02da7 100644 --- a/src/uu/base32/src/base32.rs +++ b/src/uu/base32/src/base32.rs @@ -11,7 +11,6 @@ use uucore::encoding::Format; mod base_common; -static SYNTAX: &str = "[OPTION]... [FILE]"; static SUMMARY: &str = "Base32 encode or decode FILE, or standard input, to standard output."; static LONG_HELP: &str = " With no FILE, or when FILE is -, read standard input. @@ -24,11 +23,5 @@ static LONG_HELP: &str = " "; pub fn uumain(args: impl uucore::Args) -> i32 { - base_common::execute( - args.collect_str(), - SYNTAX, - SUMMARY, - LONG_HELP, - Format::Base32, - ) + base_common::execute(args.collect_str(), SUMMARY, LONG_HELP, Format::Base32) } diff --git a/src/uu/base32/src/base_common.rs b/src/uu/base32/src/base_common.rs index 3f1436fb2..136a54425 100644 --- a/src/uu/base32/src/base_common.rs +++ b/src/uu/base32/src/base_common.rs @@ -11,60 +11,172 @@ use std::fs::File; use std::io::{stdin, stdout, BufReader, Read, Write}; use std::path::Path; +use clap::{App, Arg}; use uucore::encoding::{wrap_print, Data, Format}; -pub fn execute( - args: Vec, - syntax: &str, - summary: &str, - long_help: &str, - format: Format, -) -> i32 { - let matches = app!(syntax, summary, long_help) - .optflag("d", "decode", "decode data") - .optflag( - "i", - "ignore-garbage", - "when decoding, ignore non-alphabetic characters", - ) - .optopt( - "w", - "wrap", - "wrap encoded lines after COLS character (default 76, 0 to disable wrapping)", - "COLS", - ) - .parse(args); +static VERSION: &str = env!("CARGO_PKG_VERSION"); - let line_wrap = matches.opt_str("wrap").map(|s| match s.parse() { - Ok(n) => n, - Err(e) => { - crash!(1, "invalid wrap size: ‘{}’: {}", s, e); +pub mod options { + pub static DECODE: &str = "decode"; + pub static WRAP: &str = "wrap"; + pub static IGNORE_GARBAGE: &str = "ignore-garbage"; + pub static FILE: &str = "file"; +} + +struct Config { + decode: bool, + ignore_garbage: bool, + wrap_cols: Option, + to_read: Option, +} + +impl Config { + fn from(options: clap::ArgMatches) -> Config { + let file: Option = match options.values_of(options::FILE) { + Some(mut values) => { + if values.len() != 1 { + crash!(3, "extra operand ‘{}’", values.nth(0).unwrap()) + } + let name = values.nth(0).unwrap(); + if !Path::exists(Path::new(name)) { + crash!(2, "{}: No such file or directory", name); + } + + if name == "-" { + None // stdin + } else { + Some(name.to_owned()) + } + } + None => None, + }; + + let cols = match options.value_of(options::WRAP) { + Some(num) => match num.parse::() { + Ok(n) => Some(n), + Err(e) => { + crash!(1, "invalid wrap size: ‘{}’: {}", num, e); + } + }, + None => None, + }; + + Config { + decode: options.is_present(options::DECODE), + ignore_garbage: options.is_present(options::IGNORE_GARBAGE), + wrap_cols: cols, + to_read: file, } - }); - let ignore_garbage = matches.opt_present("ignore-garbage"); - let decode = matches.opt_present("decode"); - - if matches.free.len() > 1 { - show_usage_error!("extra operand ‘{}’", matches.free[0]); - return 1; } +} - if matches.free.is_empty() || &matches.free[0][..] == "-" { - let stdin_raw = stdin(); - handle_input( - &mut stdin_raw.lock(), - format, - line_wrap, - ignore_garbage, - decode, - ); - } else { - let path = Path::new(matches.free[0].as_str()); - let file_buf = safe_unwrap!(File::open(&path)); - let mut input = BufReader::new(file_buf); - handle_input(&mut input, format, line_wrap, ignore_garbage, decode); +fn get_usage() -> String { + format!("{0} [OPTION]... [FILE]", executable!()) +} + +pub fn execute(args: Vec, _summary: &str, long_help: &str, format: Format) -> i32 { + let usage = get_usage(); + let app = App::new(executable!()) + .version(VERSION) + .usage(&usage[..]) + .about(long_help) + // Format arguments. + .arg( + Arg::with_name(options::DECODE) + .short("d") + .long(options::DECODE) + .help("decode data"), + ) + .arg( + Arg::with_name(options::IGNORE_GARBAGE) + .short("i") + .long(options::IGNORE_GARBAGE) + .help("when decoding, ignore non-alphabetic characters"), + ) + .arg( + Arg::with_name(options::WRAP) + .short("w") + .long(options::WRAP) + .takes_value(true) + .help( + "wrap encoded lines after COLS character (default 76, 0 to disable wrapping)", + ), + ) + // "multiple" arguments are used to check whether there is more than one + // file passed in. + .arg(Arg::with_name(options::FILE).index(1).multiple(true)); + + let config: Config = Config::from(app.get_matches_from(args)); + match config.to_read { + // Read from file. + Some(name) => { + let file_buf = safe_unwrap!(File::open(Path::new(&name))); + let mut input = BufReader::new(file_buf); + handle_input( + &mut input, + format, + config.wrap_cols, + config.ignore_garbage, + config.decode, + ); + } + // stdin + None => { + handle_input( + &mut stdin().lock(), + format, + config.wrap_cols, + config.ignore_garbage, + config.decode, + ); + } }; + // let matches = app!(syntax, summary, long_help) + // .optflag("d", "decode", "decode data") + // .optflag( + // "i", + // "ignore-garbage", + // "when decoding, ignore non-alphabetic characters", + // ) + // .optopt( + // "w", + // "wrap", + // "wrap encoded lines after COLS character (default 76, 0 to disable wrapping)", + // "COLS", + // ) + // .parse(args); + + // let line_wrap = matches.opt_str("wrap").map(|s| match s.parse() { + // Ok(n) => n, + // Err(e) => { + // crash!(1, "invalid wrap size: ‘{}’: {}", s, e); + // } + // }); + // let ignore_garbage = matches.opt_present("ignore-garbage"); + // let decode = matches.opt_present("decode"); + + // if matches.free.len() > 1 { + // show_usage_error!("extra operand ‘{}’", matches.free[0]); + // return 1; + // } + + // if matches.free.is_empty() || &matches.free[0][..] == "-" { + // let stdin_raw = stdin(); + // handle_input( + // &mut stdin_raw.lock(), + // format, + // line_wrap, + // ignore_garbage, + // decode, + // ); + // } else { + // let path = Path::new(matches.free[0].as_str()); + // let file_buf = safe_unwrap!(File::open(&path)); + // let mut input = BufReader::new(file_buf); + // + // }; + 0 } diff --git a/tests/by-util/test_base32.rs b/tests/by-util/test_base32.rs index d3527d26a..68e6b5050 100644 --- a/tests/by-util/test_base32.rs +++ b/tests/by-util/test_base32.rs @@ -71,8 +71,7 @@ fn test_wrap() { fn test_wrap_no_arg() { for wrap_param in vec!["-w", "--wrap"] { new_ucmd!().arg(wrap_param).fails().stderr_only(format!( - "base32: error: Argument to option '{}' missing\n", - if wrap_param == "-w" { "w" } else { "wrap" } + "error: The argument '--wrap \' requires a value but none was supplied\n\nUSAGE:\n base32 [OPTION]... [FILE]\n\nFor more information try --help" )); } } @@ -87,3 +86,21 @@ fn test_wrap_bad_arg() { .stderr_only("base32: error: invalid wrap size: ‘b’: invalid digit found in string\n"); } } + +#[test] +fn test_base32_extra_operand() { + // Expect a failure when multiple files are specified. + new_ucmd!() + .arg("a.txt") + .arg("a.txt") + .fails() + .stderr_only("base32: error: extra operand ‘a.txt’"); +} + +#[test] +fn test_base32_file_not_found() { + new_ucmd!() + .arg("a.txt") + .fails() + .stderr_only("base32: error: a.txt: No such file or directory"); +} From 322478d9a238cee3292131840bfd5e7cdd617f41 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 26 Apr 2021 09:35:31 +0200 Subject: [PATCH 0464/1135] ls: document flamegraph --- src/uu/ls/BENCHMARKING.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/uu/ls/BENCHMARKING.md b/src/uu/ls/BENCHMARKING.md index 84a0c3d84..c6568f879 100644 --- a/src/uu/ls/BENCHMARKING.md +++ b/src/uu/ls/BENCHMARKING.md @@ -32,3 +32,19 @@ This can also be used to compare with version of ls built before your changes to - Another thing to look at would be system calls count using strace (on linux) or equivalent on other operating systems. - Example: `strace -c target/release/coreutils ls -al -R tree` + +## Cargo Flamegraph + +With Cargo Flamegraph you can easily make a flamegraph of `ls`: +```bash +cargo flamegraph --cmd coreutils -- ls [additional parameters] +``` + +However, if the `-R` option is given, the output becomes pretty much useless due to recursion. We can fix this by merging all the direct recursive calls with `uniq`, below is a `bash` script that does this. +```bash +#!/bin/bash + +cargo build --release --no-default-features --features ls +perf record target/release/coreutils ls "$@" +perf script | uniq | inferno-collapse-perf | inferno-flamegraph > flamegraph.svg +``` \ No newline at end of file From e4c006949394ae9d98388f3b77bd00e2e6e089ba Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 26 Apr 2021 09:53:13 +0200 Subject: [PATCH 0465/1135] ls: remove path strip --- src/uu/ls/src/ls.rs | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 44c644849..b5e76b7d3 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1135,7 +1135,7 @@ fn list(locs: Vec, config: Config) -> i32 { } } sort_entries(&mut files, &config); - display_items(&files, None, &config, &mut out); + display_items(&files, &config, &mut out); sort_entries(&mut dirs, &config); for dir in dirs { @@ -1227,7 +1227,7 @@ fn enter_directory(dir: &PathData, config: &Config, out: &mut BufWriter) entries.append(&mut temp); - display_items(&entries, Some(&dir.p_buf), config, out); + display_items(&entries, config, out); if config.recursive { for e in entries @@ -1264,12 +1264,7 @@ fn pad_left(string: String, count: usize) -> String { format!("{:>width$}", string, width = count) } -fn display_items( - items: &[PathData], - strip: Option<&Path>, - config: &Config, - out: &mut BufWriter, -) { +fn display_items(items: &[PathData], config: &Config, out: &mut BufWriter) { if config.format == Format::Long { let (mut max_links, mut max_size) = (1, 1); for item in items { @@ -1278,12 +1273,10 @@ fn display_items( max_size = size.max(max_size); } for item in items { - display_item_long(item, strip, max_links, max_size, config, out); + display_item_long(item, max_links, max_size, config, out); } } else { - let names = items - .iter() - .filter_map(|i| display_file_name(&i, strip, config)); + let names = items.iter().filter_map(|i| display_file_name(&i, config)); match (&config.format, config.width) { (Format::Columns, Some(width)) => { @@ -1355,7 +1348,6 @@ use uucore::fs::display_permissions; fn display_item_long( item: &PathData, - strip: Option<&Path>, max_links: usize, max_size: usize, config: &Config, @@ -1363,7 +1355,7 @@ fn display_item_long( ) { let md = match item.md() { None => { - let filename = get_file_name(&item.p_buf, strip); + let filename = get_file_name(&item.p_buf); show_error!("could not show file: {}", filename); return; } @@ -1407,7 +1399,7 @@ fn display_item_long( // unwrap is fine because it fails when metadata is not available // but we already know that it is because it's checked at the // start of the function. - display_file_name(&item, strip, config).unwrap().contents, + display_file_name(&item, config).unwrap().contents, ); } @@ -1558,15 +1550,11 @@ fn display_file_type(file_type: FileType) -> char { } } -fn get_file_name(name: &Path, strip: Option<&Path>) -> String { - let mut name = match strip { - Some(prefix) => name.strip_prefix(prefix).unwrap_or(name), - None => name, - }; - if name.as_os_str().is_empty() { - name = Path::new("."); - } - name.to_string_lossy().into_owned() +fn get_file_name(name: &Path) -> String { + name.file_name() + .unwrap_or(name.iter().last().unwrap()) + .to_string_lossy() + .into() } #[cfg(unix)] @@ -1605,8 +1593,8 @@ fn classify_file(path: &PathData) -> Option { } } -fn display_file_name(path: &PathData, strip: Option<&Path>, config: &Config) -> Option { - let mut name = escape_name(get_file_name(&path.p_buf, strip), &config.quoting_style); +fn display_file_name(path: &PathData, config: &Config) -> Option { + let mut name = escape_name(get_file_name(&path.p_buf), &config.quoting_style); #[cfg(unix)] { From cfc11b47a575011630c8755e61adec82a5e61bd1 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 26 Apr 2021 14:41:41 +0200 Subject: [PATCH 0466/1135] ls: fix grid alignment with --color --- src/uu/ls/src/ls.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 44c644849..b5d8162cd 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1615,6 +1615,10 @@ fn display_file_name(path: &PathData, strip: Option<&Path>, config: &Config) -> } } + // We need to keep track of the width ourselfs instead of letting term_grid + // infer it because the color codes mess up term_grid's width calculation. + let mut width = name.len(); + if let Some(ls_colors) = &config.color { name = color_name(&ls_colors, &path.p_buf, name, path.md()?); } @@ -1643,6 +1647,7 @@ fn display_file_name(path: &PathData, strip: Option<&Path>, config: &Config) -> if let Some(c) = char_opt { name.push(c); + width += 1; } } @@ -1653,7 +1658,10 @@ fn display_file_name(path: &PathData, strip: Option<&Path>, config: &Config) -> } } - Some(name.into()) + Some(Cell { + contents: name, + width, + }) } fn color_name(ls_colors: &LsColors, path: &Path, name: String, md: &Metadata) -> String { From a0eb4a0283046a20acd3b9cde674015f8d573caf Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 26 Apr 2021 14:42:42 +0200 Subject: [PATCH 0467/1135] ls: add test for color grid alignment --- tests/by-util/test_ls.rs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 6a1c7764b..1a3bdf78a 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -775,6 +775,18 @@ fn test_ls_color() { .arg("z") .succeeds() .stdout_only(""); + + // The colors must not mess up the grid layout + at.touch("b"); + scene + .ucmd() + .arg("--color") + .arg("-w=15") + .succeeds() + .stdout_only(format!( + "{} test-color\nb {}\n", + a_with_colors, z_with_colors + )); } #[cfg(unix)] @@ -1723,7 +1735,7 @@ fn test_ls_sort_extension() { let expected = vec![ ".", "..", - ".hidden", + ".hidden", "anotherFile", "file1", "file2", @@ -1741,8 +1753,14 @@ fn test_ls_sort_extension() { ]; let result = scene.ucmd().arg("-1aX").run(); - assert_eq!(result.stdout_str().split('\n').collect::>(), expected,); + assert_eq!( + result.stdout_str().split('\n').collect::>(), + expected, + ); let result = scene.ucmd().arg("-1a").arg("--sort=extension").run(); - assert_eq!(result.stdout_str().split('\n').collect::>(), expected,); + assert_eq!( + result.stdout_str().split('\n').collect::>(), + expected, + ); } From 58fd61b3e83b1c7de6f0429893b60e7069002725 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 26 Apr 2021 15:00:39 +0200 Subject: [PATCH 0468/1135] ls: fix grid alignment for unicode --- src/uu/ls/src/ls.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index b5d8162cd..6b87a21c4 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -40,6 +40,7 @@ use std::{ }; use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use time::{strftime, Timespec}; +use unicode_width::UnicodeWidthStr; #[cfg(unix)] use uucore::libc::{S_IXGRP, S_IXOTH, S_IXUSR}; @@ -1617,7 +1618,7 @@ fn display_file_name(path: &PathData, strip: Option<&Path>, config: &Config) -> // We need to keep track of the width ourselfs instead of letting term_grid // infer it because the color codes mess up term_grid's width calculation. - let mut width = name.len(); + let mut width = name.width(); if let Some(ls_colors) = &config.color { name = color_name(&ls_colors, &path.p_buf, name, path.md()?); From c69b72c84036bc23013cb51941ce352f2a6c6fd3 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 26 Apr 2021 15:04:55 +0200 Subject: [PATCH 0469/1135] ls: forgot to commit Cargo.{toml, lock} --- Cargo.lock | 1 + src/uu/ls/Cargo.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 321f41d89..e35bcc68c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2058,6 +2058,7 @@ dependencies = [ "term_grid", "termsize", "time", + "unicode-width", "uucore", "uucore_procs", ] diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index 3787d3562..d479a57f4 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -16,6 +16,7 @@ path = "src/ls.rs" [dependencies] clap = "2.33" +unicode-width = "0.1.8" number_prefix = "0.4" term_grid = "0.1.5" termsize = "0.1.6" From f3ed5a100fdc301dbf05d94e5042bdc17d39d32c Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Mon, 26 Apr 2021 08:54:40 -0500 Subject: [PATCH 0470/1135] Possible fix to Windows issues, ext_sort bool setting --- src/uu/sort/src/sort.rs | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index c9e797579..b6610be64 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -32,7 +32,6 @@ use smallvec::SmallVec; use std::cmp::Ordering; use std::collections::BinaryHeap; use std::env; -use std::ffi::OsString; use std::fs::File; use std::hash::{Hash, Hasher}; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Lines, Read, Write}; @@ -98,7 +97,7 @@ static DEFAULT_TMPDIR: &str = r"%USERPROFILE%\AppData\Local\Temp"; #[cfg(not(any(target_os = "windows",)))] static DEFAULT_TMPDIR: &str = r"/tmp"; -static DEFAULT_BUF_SIZE: usize = usize::MAX; +static DEFAULT_BUF_SIZE: usize = std::usize::MAX; #[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy)] enum SortMode { @@ -132,6 +131,7 @@ struct GlobalSettings { zero_terminated: bool, buffer_size: usize, tmp_dir: PathBuf, + ext_sort: bool, } impl GlobalSettings { @@ -180,6 +180,7 @@ impl Default for GlobalSettings { zero_terminated: false, buffer_size: DEFAULT_BUF_SIZE, tmp_dir: PathBuf::from(DEFAULT_TMPDIR), + ext_sort: false, } } } @@ -328,9 +329,7 @@ impl Line { ); range.shorten(num_range); NumCache::WithInfo(info) - } else if selector.settings.mode == SortMode::GeneralNumeric - && settings.buffer_size == DEFAULT_BUF_SIZE - { + } else if selector.settings.mode == SortMode::GeneralNumeric { let str = range.get_str(&line); NumCache::AsF64(general_f64_parse(&str[get_leading_gen(str)])) } else { @@ -1057,7 +1056,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .unwrap_or(format!("{}", DEFAULT_BUF_SIZE)); GlobalSettings::human_numeric_convert(&input) - } + }; + settings.ext_sort = true; } if matches.is_present(OPT_TMP_DIR) { @@ -1066,17 +1066,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .map(String::from) .unwrap_or(DEFAULT_TMPDIR.to_owned()); settings.tmp_dir = PathBuf::from(result); + settings.ext_sort = true; } else { - for (key, value) in env::vars_os() { - if key == OsString::from("TMPDIR") - || key == OsString::from("TEMP") - || key == OsString::from("TMP") - { - settings.tmp_dir = PathBuf::from(value); - break; - } - settings.tmp_dir = PathBuf::from(DEFAULT_TMPDIR); - } + settings.tmp_dir = env::temp_dir(); } settings.zero_terminated = matches.is_present(OPT_ZERO_TERMINATED); @@ -1207,7 +1199,7 @@ fn exec(files: Vec, settings: GlobalSettings) -> i32 { // Only use ext_sorter when we need to. // Probably faster that we don't create // an owned value each run - if settings.buffer_size != DEFAULT_BUF_SIZE { + if settings.ext_sort { lines = ext_sort_by(lines, settings.clone()); } else { sort_by(&mut lines, &settings); From d56462a4b3141479ccd2ed0981abdac3f4481c9f Mon Sep 17 00:00:00 2001 From: Ricardo Iglesias Date: Mon, 26 Apr 2021 08:00:55 -0700 Subject: [PATCH 0471/1135] base32: Fixed style violations. Added tests Tests now cover using "-" as standard input and reading from a file. --- src/uu/base32/src/base32.rs | 5 ++ src/uu/base32/src/base_common.rs | 68 ++++---------------------- tests/by-util/test_base32.rs | 15 ++++++ tests/fixtures/base32/input-simple.txt | 1 + 4 files changed, 30 insertions(+), 59 deletions(-) create mode 100644 tests/fixtures/base32/input-simple.txt diff --git a/src/uu/base32/src/base32.rs b/src/uu/base32/src/base32.rs index 7eb1f67a8..86109d4ae 100644 --- a/src/uu/base32/src/base32.rs +++ b/src/uu/base32/src/base32.rs @@ -23,12 +23,17 @@ static LONG_HELP: &str = " encoded stream. "; +fn get_usage() -> String { + format!("{0} [OPTION]... [FILE]", executable!()) +} + pub fn uumain(args: impl uucore::Args) -> i32 { base_common::execute( args.collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(), SUMMARY, LONG_HELP, + &get_usage(), Format::Base32, ) } diff --git a/src/uu/base32/src/base_common.rs b/src/uu/base32/src/base_common.rs index 136a54425..5c7dde4df 100644 --- a/src/uu/base32/src/base_common.rs +++ b/src/uu/base32/src/base_common.rs @@ -34,17 +34,17 @@ impl Config { fn from(options: clap::ArgMatches) -> Config { let file: Option = match options.values_of(options::FILE) { Some(mut values) => { - if values.len() != 1 { - crash!(3, "extra operand ‘{}’", values.nth(0).unwrap()) - } - let name = values.nth(0).unwrap(); - if !Path::exists(Path::new(name)) { - crash!(2, "{}: No such file or directory", name); + let name = values.next().unwrap(); + if values.len() != 0 { + crash!(3, "extra operand ‘{}’", name); } if name == "-" { - None // stdin + None } else { + if !Path::exists(Path::new(name)) { + crash!(2, "{}: No such file or directory", name); + } Some(name.to_owned()) } } @@ -70,15 +70,10 @@ impl Config { } } -fn get_usage() -> String { - format!("{0} [OPTION]... [FILE]", executable!()) -} - -pub fn execute(args: Vec, _summary: &str, long_help: &str, format: Format) -> i32 { - let usage = get_usage(); +pub fn execute(args: Vec, _summary: &str, long_help: &str, usage: &str, format: Format) -> i32 { let app = App::new(executable!()) .version(VERSION) - .usage(&usage[..]) + .usage(usage) .about(long_help) // Format arguments. .arg( @@ -132,51 +127,6 @@ pub fn execute(args: Vec, _summary: &str, long_help: &str, format: Forma } }; - // let matches = app!(syntax, summary, long_help) - // .optflag("d", "decode", "decode data") - // .optflag( - // "i", - // "ignore-garbage", - // "when decoding, ignore non-alphabetic characters", - // ) - // .optopt( - // "w", - // "wrap", - // "wrap encoded lines after COLS character (default 76, 0 to disable wrapping)", - // "COLS", - // ) - // .parse(args); - - // let line_wrap = matches.opt_str("wrap").map(|s| match s.parse() { - // Ok(n) => n, - // Err(e) => { - // crash!(1, "invalid wrap size: ‘{}’: {}", s, e); - // } - // }); - // let ignore_garbage = matches.opt_present("ignore-garbage"); - // let decode = matches.opt_present("decode"); - - // if matches.free.len() > 1 { - // show_usage_error!("extra operand ‘{}’", matches.free[0]); - // return 1; - // } - - // if matches.free.is_empty() || &matches.free[0][..] == "-" { - // let stdin_raw = stdin(); - // handle_input( - // &mut stdin_raw.lock(), - // format, - // line_wrap, - // ignore_garbage, - // decode, - // ); - // } else { - // let path = Path::new(matches.free[0].as_str()); - // let file_buf = safe_unwrap!(File::open(&path)); - // let mut input = BufReader::new(file_buf); - // - // }; - 0 } diff --git a/tests/by-util/test_base32.rs b/tests/by-util/test_base32.rs index 68e6b5050..157503d83 100644 --- a/tests/by-util/test_base32.rs +++ b/tests/by-util/test_base32.rs @@ -15,6 +15,21 @@ fn test_encode() { .pipe_in(input) .succeeds() .stdout_only("JBSWY3DPFQQFO33SNRSCC===\n"); + + // Using '-' as our file + new_ucmd!() + .arg("-") + .pipe_in(input) + .succeeds() + .stdout_only("JBSWY3DPFQQFO33SNRSCC===\n"); +} + +#[test] +fn test_base32_encode_file() { + new_ucmd!() + .arg("input-simple.txt") + .succeeds() + .stdout_only("JBSWY3DPFQQFO33SNRSCCCQ=\n"); } #[test] diff --git a/tests/fixtures/base32/input-simple.txt b/tests/fixtures/base32/input-simple.txt new file mode 100644 index 000000000..8ab686eaf --- /dev/null +++ b/tests/fixtures/base32/input-simple.txt @@ -0,0 +1 @@ +Hello, World! From 11d0565f0e328b4c3ed8a6f1e822f3c1da5bc2ec Mon Sep 17 00:00:00 2001 From: Ricardo Iglesias Date: Mon, 26 Apr 2021 08:22:41 -0700 Subject: [PATCH 0472/1135] base32: Moved clap argument parsing to base32.rs Now, all base_common.rs has is the handle_input function. --- src/uu/base32/src/base32.rs | 123 ++++++++++++++++++++++++++++++- src/uu/base32/src/base_common.rs | 123 +------------------------------ 2 files changed, 124 insertions(+), 122 deletions(-) diff --git a/src/uu/base32/src/base32.rs b/src/uu/base32/src/base32.rs index 86109d4ae..821ebd9e8 100644 --- a/src/uu/base32/src/base32.rs +++ b/src/uu/base32/src/base32.rs @@ -10,6 +10,12 @@ extern crate uucore; use uucore::encoding::Format; use uucore::InvalidEncodingHandling; +use std::fs::File; +use std::io::{stdin, BufReader}; +use std::path::Path; + +use clap::{App, Arg}; + mod base_common; static SUMMARY: &str = "Base32 encode or decode FILE, or standard input, to standard output."; @@ -22,13 +28,68 @@ static LONG_HELP: &str = " to attempt to recover from any other non-alphabet bytes in the encoded stream. "; +static VERSION: &str = env!("CARGO_PKG_VERSION"); fn get_usage() -> String { format!("{0} [OPTION]... [FILE]", executable!()) } +pub mod options { + pub static DECODE: &str = "decode"; + pub static WRAP: &str = "wrap"; + pub static IGNORE_GARBAGE: &str = "ignore-garbage"; + pub static FILE: &str = "file"; +} + +struct Config { + decode: bool, + ignore_garbage: bool, + wrap_cols: Option, + to_read: Option, +} + +impl Config { + fn from(options: clap::ArgMatches) -> Config { + let file: Option = match options.values_of(options::FILE) { + Some(mut values) => { + let name = values.next().unwrap(); + if values.len() != 0 { + crash!(3, "extra operand ‘{}’", name); + } + + if name == "-" { + None + } else { + if !Path::exists(Path::new(name)) { + crash!(2, "{}: No such file or directory", name); + } + Some(name.to_owned()) + } + } + None => None, + }; + + let cols = match options.value_of(options::WRAP) { + Some(num) => match num.parse::() { + Ok(n) => Some(n), + Err(e) => { + crash!(1, "invalid wrap size: ‘{}’: {}", num, e); + } + }, + None => None, + }; + + Config { + decode: options.is_present(options::DECODE), + ignore_garbage: options.is_present(options::IGNORE_GARBAGE), + wrap_cols: cols, + to_read: file, + } + } +} + pub fn uumain(args: impl uucore::Args) -> i32 { - base_common::execute( + execute( args.collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(), SUMMARY, @@ -37,3 +98,63 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Format::Base32, ) } + +fn execute(args: Vec, _summary: &str, long_help: &str, usage: &str, format: Format) -> i32 { + let app = App::new(executable!()) + .version(VERSION) + .usage(usage) + .about(long_help) + // Format arguments. + .arg( + Arg::with_name(options::DECODE) + .short("d") + .long(options::DECODE) + .help("decode data"), + ) + .arg( + Arg::with_name(options::IGNORE_GARBAGE) + .short("i") + .long(options::IGNORE_GARBAGE) + .help("when decoding, ignore non-alphabetic characters"), + ) + .arg( + Arg::with_name(options::WRAP) + .short("w") + .long(options::WRAP) + .takes_value(true) + .help( + "wrap encoded lines after COLS character (default 76, 0 to disable wrapping)", + ), + ) + // "multiple" arguments are used to check whether there is more than one + // file passed in. + .arg(Arg::with_name(options::FILE).index(1).multiple(true)); + + let config: Config = Config::from(app.get_matches_from(args)); + match config.to_read { + // Read from file. + Some(name) => { + let file_buf = safe_unwrap!(File::open(Path::new(&name))); + let mut input = BufReader::new(file_buf); + base_common::handle_input( + &mut input, + format, + config.wrap_cols, + config.ignore_garbage, + config.decode, + ); + } + // stdin + None => { + base_common::handle_input( + &mut stdin().lock(), + format, + config.wrap_cols, + config.ignore_garbage, + config.decode, + ); + } + }; + + 0 +} diff --git a/src/uu/base32/src/base_common.rs b/src/uu/base32/src/base_common.rs index 5c7dde4df..a4b49e499 100644 --- a/src/uu/base32/src/base_common.rs +++ b/src/uu/base32/src/base_common.rs @@ -7,130 +7,11 @@ // For the full copyright and license information, please view the LICENSE file // that was distributed with this source code. -use std::fs::File; -use std::io::{stdin, stdout, BufReader, Read, Write}; -use std::path::Path; +use std::io::{stdout, Read, Write}; -use clap::{App, Arg}; use uucore::encoding::{wrap_print, Data, Format}; -static VERSION: &str = env!("CARGO_PKG_VERSION"); - -pub mod options { - pub static DECODE: &str = "decode"; - pub static WRAP: &str = "wrap"; - pub static IGNORE_GARBAGE: &str = "ignore-garbage"; - pub static FILE: &str = "file"; -} - -struct Config { - decode: bool, - ignore_garbage: bool, - wrap_cols: Option, - to_read: Option, -} - -impl Config { - fn from(options: clap::ArgMatches) -> Config { - let file: Option = match options.values_of(options::FILE) { - Some(mut values) => { - let name = values.next().unwrap(); - if values.len() != 0 { - crash!(3, "extra operand ‘{}’", name); - } - - if name == "-" { - None - } else { - if !Path::exists(Path::new(name)) { - crash!(2, "{}: No such file or directory", name); - } - Some(name.to_owned()) - } - } - None => None, - }; - - let cols = match options.value_of(options::WRAP) { - Some(num) => match num.parse::() { - Ok(n) => Some(n), - Err(e) => { - crash!(1, "invalid wrap size: ‘{}’: {}", num, e); - } - }, - None => None, - }; - - Config { - decode: options.is_present(options::DECODE), - ignore_garbage: options.is_present(options::IGNORE_GARBAGE), - wrap_cols: cols, - to_read: file, - } - } -} - -pub fn execute(args: Vec, _summary: &str, long_help: &str, usage: &str, format: Format) -> i32 { - let app = App::new(executable!()) - .version(VERSION) - .usage(usage) - .about(long_help) - // Format arguments. - .arg( - Arg::with_name(options::DECODE) - .short("d") - .long(options::DECODE) - .help("decode data"), - ) - .arg( - Arg::with_name(options::IGNORE_GARBAGE) - .short("i") - .long(options::IGNORE_GARBAGE) - .help("when decoding, ignore non-alphabetic characters"), - ) - .arg( - Arg::with_name(options::WRAP) - .short("w") - .long(options::WRAP) - .takes_value(true) - .help( - "wrap encoded lines after COLS character (default 76, 0 to disable wrapping)", - ), - ) - // "multiple" arguments are used to check whether there is more than one - // file passed in. - .arg(Arg::with_name(options::FILE).index(1).multiple(true)); - - let config: Config = Config::from(app.get_matches_from(args)); - match config.to_read { - // Read from file. - Some(name) => { - let file_buf = safe_unwrap!(File::open(Path::new(&name))); - let mut input = BufReader::new(file_buf); - handle_input( - &mut input, - format, - config.wrap_cols, - config.ignore_garbage, - config.decode, - ); - } - // stdin - None => { - handle_input( - &mut stdin().lock(), - format, - config.wrap_cols, - config.ignore_garbage, - config.decode, - ); - } - }; - - 0 -} - -fn handle_input( +pub fn handle_input( input: &mut R, format: Format, line_wrap: Option, From 4023e40174485fe7e5bf514c761774d484f8acc2 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 26 Apr 2021 18:03:56 +0200 Subject: [PATCH 0473/1135] ls: further reduce OsStr -> String conversions --- src/uu/ls/src/ls.rs | 16 +++++----------- src/uu/ls/src/quoting_style.rs | 10 +++++----- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index b5e76b7d3..1cebeb38a 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1056,7 +1056,9 @@ impl PathData { ) -> Self { let name = p_buf .file_name() - .map_or(String::new(), |s| s.to_string_lossy().into_owned()); + .unwrap_or_else(|| p_buf.iter().next_back().unwrap()) + .to_string_lossy() + .into_owned(); let must_dereference = match &config.dereference { Dereference::All => true, Dereference::Args => command_line, @@ -1355,8 +1357,7 @@ fn display_item_long( ) { let md = match item.md() { None => { - let filename = get_file_name(&item.p_buf); - show_error!("could not show file: {}", filename); + show_error!("could not show file: {}", &item.p_buf.display()); return; } Some(md) => md, @@ -1550,13 +1551,6 @@ fn display_file_type(file_type: FileType) -> char { } } -fn get_file_name(name: &Path) -> String { - name.file_name() - .unwrap_or(name.iter().last().unwrap()) - .to_string_lossy() - .into() -} - #[cfg(unix)] fn file_is_executable(md: &Metadata) -> bool { // Mode always returns u32, but the flags might not be, based on the platform @@ -1594,7 +1588,7 @@ fn classify_file(path: &PathData) -> Option { } fn display_file_name(path: &PathData, config: &Config) -> Option { - let mut name = escape_name(get_file_name(&path.p_buf), &config.quoting_style); + let mut name = escape_name(&path.file_name, &config.quoting_style); #[cfg(unix)] { diff --git a/src/uu/ls/src/quoting_style.rs b/src/uu/ls/src/quoting_style.rs index 49456fc22..01bffa7ec 100644 --- a/src/uu/ls/src/quoting_style.rs +++ b/src/uu/ls/src/quoting_style.rs @@ -171,7 +171,7 @@ impl Iterator for EscapedChar { } } -fn shell_without_escape(name: String, quotes: Quotes, show_control_chars: bool) -> (String, bool) { +fn shell_without_escape(name: &str, quotes: Quotes, show_control_chars: bool) -> (String, bool) { let mut must_quote = false; let mut escaped_str = String::with_capacity(name.len()); @@ -201,7 +201,7 @@ fn shell_without_escape(name: String, quotes: Quotes, show_control_chars: bool) (escaped_str, must_quote) } -fn shell_with_escape(name: String, quotes: Quotes) -> (String, bool) { +fn shell_with_escape(name: &str, quotes: Quotes) -> (String, bool) { // We need to keep track of whether we are in a dollar expression // because e.g. \b\n is escaped as $'\b\n' and not like $'b'$'n' let mut in_dollar = false; @@ -249,7 +249,7 @@ fn shell_with_escape(name: String, quotes: Quotes) -> (String, bool) { (escaped_str, must_quote) } -pub(super) fn escape_name(name: String, style: &QuotingStyle) -> String { +pub(super) fn escape_name(name: &str, style: &QuotingStyle) -> String { match style { QuotingStyle::Literal { show_control } => { if !show_control { @@ -257,7 +257,7 @@ pub(super) fn escape_name(name: String, style: &QuotingStyle) -> String { .flat_map(|c| EscapedChar::new_literal(c).hide_control()) .collect() } else { - name + name.into() } } QuotingStyle::C { quotes } => { @@ -354,7 +354,7 @@ mod tests { fn check_names(name: &str, map: Vec<(&str, &str)>) { assert_eq!( map.iter() - .map(|(_, style)| escape_name(name.to_string(), &get_style(style))) + .map(|(_, style)| escape_name(name, &get_style(style))) .collect::>(), map.iter() .map(|(correct, _)| correct.to_string()) From 35838dc8a9f6f1e8d2dfb65932f92d3b57f2158b Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 26 Apr 2021 18:36:15 +0200 Subject: [PATCH 0474/1135] ls: document hyperfine script --- src/uu/ls/BENCHMARKING.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/uu/ls/BENCHMARKING.md b/src/uu/ls/BENCHMARKING.md index c6568f879..852220496 100644 --- a/src/uu/ls/BENCHMARKING.md +++ b/src/uu/ls/BENCHMARKING.md @@ -26,7 +26,15 @@ Example: `hyperfine --warmup 2 "target/release/coreutils ls -al -R tree > /dev/n `hyperfine --warmup 2 "target/release/coreutils ls -al -R tree > /dev/null" "ls -al -R tree > /dev/null"` (This assumes GNU ls is installed as `ls`) -This can also be used to compare with version of ls built before your changes to ensure your change does not regress this +This can also be used to compare with version of ls built before your changes to ensure your change does not regress this. + +Here is a `bash` script for doing this comparison: +```bash +#!/bin/bash +cargo build --no-default-features --features ls --release +args="$@" +hyperfine "ls $args" "target/release/coreutils ls $args" +``` ## Checking system call count @@ -43,7 +51,6 @@ cargo flamegraph --cmd coreutils -- ls [additional parameters] However, if the `-R` option is given, the output becomes pretty much useless due to recursion. We can fix this by merging all the direct recursive calls with `uniq`, below is a `bash` script that does this. ```bash #!/bin/bash - cargo build --release --no-default-features --features ls perf record target/release/coreutils ls "$@" perf script | uniq | inferno-collapse-perf | inferno-flamegraph > flamegraph.svg From a7037b1ca925f3858ec7ce5ff80c9bc288ba633b Mon Sep 17 00:00:00 2001 From: James Robson Date: Mon, 26 Apr 2021 18:39:32 +0100 Subject: [PATCH 0475/1135] Allow truncate to take --size and --reference --- src/uu/truncate/src/truncate.rs | 61 +++++++++++++++++++++------------ tests/by-util/test_truncate.rs | 13 +++++++ 2 files changed, 52 insertions(+), 22 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 2c232a3d1..91f705bd1 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -16,6 +16,7 @@ use std::path::Path; #[derive(Eq, PartialEq)] enum TruncateMode { + Absolute, Reference, Extend, Reduce, @@ -131,18 +132,30 @@ fn truncate( size: Option, filenames: Vec, ) { - let (refsize, mode) = match reference { - Some(rfilename) => { - let _ = match File::open(Path::new(&rfilename)) { + let (modsize, mode) = match size { + Some(size_string) => parse_size(&size_string), + None => (0, TruncateMode::Reference), + }; + + let refsize = match reference { + Some(ref rfilename) => { + match mode { + // Only Some modes work with a reference + TruncateMode::Reference => (), //No --size was given + TruncateMode::Extend => (), + TruncateMode::Reduce => (), + _ => crash!(1, "you must specify a relative ‘--size’ with ‘--reference’"), + }; + let _ = match File::open(Path::new(rfilename)) { Ok(m) => m, Err(f) => crash!(1, "{}", f.to_string()), }; match metadata(rfilename) { - Ok(meta) => (meta.len(), TruncateMode::Reference), + Ok(meta) => meta.len(), Err(f) => crash!(1, "{}", f.to_string()), } } - None => parse_size(size.unwrap().as_ref()), + None => 0, }; for filename in &filenames { let path = Path::new(filename); @@ -153,33 +166,37 @@ fn truncate( .open(path) { Ok(file) => { - let fsize = match metadata(filename) { - Ok(meta) => meta.len(), - Err(f) => { - show_warning!("{}", f.to_string()); - continue; - } + let fsize = match reference { + Some(_) => refsize, + None => match metadata(filename) { + Ok(meta) => meta.len(), + Err(f) => { + show_warning!("{}", f.to_string()); + continue; + } + }, }; let tsize: u64 = match mode { - TruncateMode::Reference => refsize, - TruncateMode::Extend => fsize + refsize, - TruncateMode::Reduce => fsize - refsize, + TruncateMode::Absolute => modsize, + TruncateMode::Reference => fsize, + TruncateMode::Extend => fsize + modsize, + TruncateMode::Reduce => fsize - modsize, TruncateMode::AtMost => { - if fsize > refsize { - refsize + if fsize > modsize { + modsize } else { fsize } } TruncateMode::AtLeast => { - if fsize < refsize { - refsize + if fsize < modsize { + modsize } else { fsize } } - TruncateMode::RoundDown => fsize - fsize % refsize, - TruncateMode::RoundUp => fsize + fsize % refsize, + TruncateMode::RoundDown => fsize - fsize % modsize, + TruncateMode::RoundUp => fsize + fsize % modsize, }; match file.set_len(tsize) { Ok(_) => {} @@ -200,10 +217,10 @@ fn parse_size(size: &str) -> (u64, TruncateMode) { '>' => TruncateMode::AtLeast, '/' => TruncateMode::RoundDown, '*' => TruncateMode::RoundUp, - _ => TruncateMode::Reference, /* assume that the size is just a number */ + _ => TruncateMode::Absolute, /* assume that the size is just a number */ }; let bytes = { - let mut slice = if mode == TruncateMode::Reference { + let mut slice = if mode == TruncateMode::Absolute { &clean_size } else { &clean_size[1..] diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index d0a93f871..304ff820c 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -161,3 +161,16 @@ fn test_round_up() { let actual = file.seek(SeekFrom::Current(0)).unwrap(); assert!(expected == actual, "expected '{}' got '{}'", expected, actual); } + +#[test] +fn test_size_and_reference() { + let expected = 15; + let (at, mut ucmd) = at_and_ucmd!(); + let mut file1 = at.make_file(TFILE1); + let mut file2 = at.make_file(TFILE2); + file1.write_all(b"1234567890").unwrap(); + ucmd.args(&["--reference", TFILE1, "--size", "+5", TFILE2]).succeeds(); + file2.seek(SeekFrom::End(0)).unwrap(); + let actual = file2.seek(SeekFrom::Current(0)).unwrap(); + assert!(expected == actual, "expected '{}' got '{}'", expected, actual); +} From ece5e14b0d62a52607973aaa363e3a024afd8258 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 26 Apr 2021 22:51:02 +0200 Subject: [PATCH 0476/1135] fix a typo --- src/uu/ls/src/ls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 6b87a21c4..3903baba9 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1616,7 +1616,7 @@ fn display_file_name(path: &PathData, strip: Option<&Path>, config: &Config) -> } } - // We need to keep track of the width ourselfs instead of letting term_grid + // We need to keep track of the width ourselves instead of letting term_grid // infer it because the color codes mess up term_grid's width calculation. let mut width = name.width(); From ae0cabc60a67a3f989afd961c470db3a8d9fde2b Mon Sep 17 00:00:00 2001 From: Ricardo Iglesias Date: Mon, 26 Apr 2021 20:14:11 -0700 Subject: [PATCH 0477/1135] Moved argument parsing to uumain. --- src/uu/base32/src/base32.rs | 23 ++++------ src/uu/pinky/src/pinky.rs | 4 +- tests/by-util/test_truncate.rs | 77 +++++++++++++++++++++++++++++----- 3 files changed, 78 insertions(+), 26 deletions(-) diff --git a/src/uu/base32/src/base32.rs b/src/uu/base32/src/base32.rs index 821ebd9e8..6d9f7f08f 100644 --- a/src/uu/base32/src/base32.rs +++ b/src/uu/base32/src/base32.rs @@ -89,21 +89,13 @@ impl Config { } pub fn uumain(args: impl uucore::Args) -> i32 { - execute( - args.collect_str(InvalidEncodingHandling::ConvertLossy) - .accept_any(), - SUMMARY, - LONG_HELP, - &get_usage(), - Format::Base32, - ) -} - -fn execute(args: Vec, _summary: &str, long_help: &str, usage: &str, format: Format) -> i32 { + let format = Format::Base32; + let usage = get_usage(); let app = App::new(executable!()) .version(VERSION) - .usage(usage) - .about(long_help) + .about(SUMMARY) + .usage(&usage[..]) + .about(LONG_HELP) // Format arguments. .arg( Arg::with_name(options::DECODE) @@ -130,7 +122,10 @@ fn execute(args: Vec, _summary: &str, long_help: &str, usage: &str, form // file passed in. .arg(Arg::with_name(options::FILE).index(1).multiple(true)); - let config: Config = Config::from(app.get_matches_from(args)); + let arg_list = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); + let config: Config = Config::from(app.get_matches_from(arg_list)); match config.to_read { // Read from file. Some(name) => { diff --git a/src/uu/pinky/src/pinky.rs b/src/uu/pinky/src/pinky.rs index 3392c9a79..a02096bc8 100644 --- a/src/uu/pinky/src/pinky.rs +++ b/src/uu/pinky/src/pinky.rs @@ -28,7 +28,9 @@ static SUMMARY: &str = "A lightweight 'finger' program; print user information. const BUFSIZE: usize = 1024; pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(InvalidEncodingHandling::Ignore).accept_any(); + let args = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); let long_help = &format!( " diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index d0a93f871..187b9a1ba 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -13,7 +13,12 @@ fn test_increase_file_size() { file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); - assert!(expected == actual, "expected '{}' got '{}'", expected, actual); + assert!( + expected == actual, + "expected '{}' got '{}'", + expected, + actual + ); } #[test] @@ -25,7 +30,12 @@ fn test_increase_file_size_kb() { file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); - assert!(expected == actual, "expected '{}' got '{}'", expected, actual); + assert!( + expected == actual, + "expected '{}' got '{}'", + expected, + actual + ); } #[test] @@ -46,7 +56,12 @@ fn test_reference() { file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); - assert!(expected == actual, "expected '{}' got '{}'", expected, actual); + assert!( + expected == actual, + "expected '{}' got '{}'", + expected, + actual + ); } #[test] @@ -58,7 +73,12 @@ fn test_decrease_file_size() { ucmd.args(&["--size=-4", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); - assert!(expected == actual, "expected '{}' got '{}'", expected, actual); + assert!( + expected == actual, + "expected '{}' got '{}'", + expected, + actual + ); } #[test] @@ -70,7 +90,12 @@ fn test_space_in_size() { ucmd.args(&["--size", " 4", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); - assert!(expected == actual, "expected '{}' got '{}'", expected, actual); + assert!( + expected == actual, + "expected '{}' got '{}'", + expected, + actual + ); } #[test] @@ -99,7 +124,12 @@ fn test_at_most_shrinks() { ucmd.args(&["--size", "<4", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); - assert!(expected == actual, "expected '{}' got '{}'", expected, actual); + assert!( + expected == actual, + "expected '{}' got '{}'", + expected, + actual + ); } #[test] @@ -111,7 +141,12 @@ fn test_at_most_no_change() { ucmd.args(&["--size", "<40", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); - assert!(expected == actual, "expected '{}' got '{}'", expected, actual); + assert!( + expected == actual, + "expected '{}' got '{}'", + expected, + actual + ); } #[test] @@ -123,7 +158,12 @@ fn test_at_least_grows() { ucmd.args(&["--size", ">15", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); - assert!(expected == actual, "expected '{}' got '{}'", expected, actual); + assert!( + expected == actual, + "expected '{}' got '{}'", + expected, + actual + ); } #[test] @@ -135,7 +175,12 @@ fn test_at_least_no_change() { ucmd.args(&["--size", ">4", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); - assert!(expected == actual, "expected '{}' got '{}'", expected, actual); + assert!( + expected == actual, + "expected '{}' got '{}'", + expected, + actual + ); } #[test] @@ -147,7 +192,12 @@ fn test_round_down() { ucmd.args(&["--size", "/4", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); - assert!(expected == actual, "expected '{}' got '{}'", expected, actual); + assert!( + expected == actual, + "expected '{}' got '{}'", + expected, + actual + ); } #[test] @@ -159,5 +209,10 @@ fn test_round_up() { ucmd.args(&["--size", "*4", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); - assert!(expected == actual, "expected '{}' got '{}'", expected, actual); + assert!( + expected == actual, + "expected '{}' got '{}'", + expected, + actual + ); } From ec19bb72d56be25f7cfb795aa61458b029794def Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Tue, 27 Apr 2021 15:39:20 -0500 Subject: [PATCH 0478/1135] Modified to remove 2 unnecessary consts now that we use std::env::temp_dir --- src/uu/sort/src/sort.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index b6610be64..2c67f1063 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -91,12 +91,6 @@ static THOUSANDS_SEP: char = ','; static NEGATIVE: char = '-'; static POSITIVE: char = '+'; -#[cfg(any(target_os = "windows",))] -static DEFAULT_TMPDIR: &str = r"%USERPROFILE%\AppData\Local\Temp"; - -#[cfg(not(any(target_os = "windows",)))] -static DEFAULT_TMPDIR: &str = r"/tmp"; - static DEFAULT_BUF_SIZE: usize = std::usize::MAX; #[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy)] @@ -179,7 +173,7 @@ impl Default for GlobalSettings { threads: String::new(), zero_terminated: false, buffer_size: DEFAULT_BUF_SIZE, - tmp_dir: PathBuf::from(DEFAULT_TMPDIR), + tmp_dir: PathBuf::new(), ext_sort: false, } } @@ -1064,7 +1058,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let result = matches .value_of(OPT_TMP_DIR) .map(String::from) - .unwrap_or(DEFAULT_TMPDIR.to_owned()); + .unwrap_or(format!("{}", env::temp_dir().display())); settings.tmp_dir = PathBuf::from(result); settings.ext_sort = true; } else { From 25f99097cc28298536282b545269b99dac484d22 Mon Sep 17 00:00:00 2001 From: Chirag Jadwani Date: Wed, 28 Apr 2021 23:28:26 +0530 Subject: [PATCH 0479/1135] cut: add BENCHMARKING.md and minor refactoring --- src/uu/cut/BENCHMARKING.md | 46 ++++++++++++++++++++++++++++++++++++++ src/uu/cut/src/cut.rs | 2 +- src/uu/cut/src/searcher.rs | 2 +- 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 src/uu/cut/BENCHMARKING.md diff --git a/src/uu/cut/BENCHMARKING.md b/src/uu/cut/BENCHMARKING.md new file mode 100644 index 000000000..bd94cf93c --- /dev/null +++ b/src/uu/cut/BENCHMARKING.md @@ -0,0 +1,46 @@ +## Benchmarking cut + +### Performance profile + +In normal use cases a significant amount of the total execution time of `cut` +is spent performing I/O. When invoked with the `-f` option (cut fields) some +CPU time is spent on detecting fields (in `Searcher::next`). Other than that +some small amount of CPU time is spent on breaking the input stream into lines. + + +### How to + +When fixing bugs or adding features you might want to compare +performance before and after your code changes. + +- `hyperfine` can be used to accurately measure and compare the total + execution time of one or more commands. + + ``` + $ cargo build --release --package uu_cut + + $ hyperfine -w3 "./target/release/cut -f2-4,8 -d' ' input.txt" "cut -f2-4,8 -d' ' input.txt" + ``` + You can put those two commands in a shell script to be sure that you don't + forget to build after making any changes. + +When optimizing or fixing performance regressions seeing the number of times a +function is called, and the amount of time it takes can be useful. + +- `cargo flamegraph` generates flame graphs from function level metrics it records using `perf` or `dtrace` + + ``` + $ cargo flamegraph --bin cut --package uu_cut -- -f1,3-4 input.txt > /dev/null + ``` + + +### What to benchmark + +There are four different performance paths in `cut` to benchmark. + +- Byte ranges `-c`/`--characters` or `-b`/`--bytes` e.g. `cut -c 2,4,6-` +- Byte ranges with output delimiters e.g. `cut -c 4- --output-delimiter=/` +- Fields e.g. `cut -f -4` +- Fields with output delimiters e.g. `cut -f 7-10 --output-delimiter=:` + +Choose a test input file with large number of lines so that program startup time does not significantly affect the benchmark. diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index 91dc17e52..40b41e98f 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -205,7 +205,7 @@ fn cut_fields_delimiter( return Ok(true); } - for &Range { low, high } in ranges.iter() { + for &Range { low, high } in ranges { if low - fields_pos > 0 { low_idx = match delim_search.nth(low - fields_pos - 1) { Some(index) => index + input_delim_len, diff --git a/src/uu/cut/src/searcher.rs b/src/uu/cut/src/searcher.rs index 5e3c076df..5fe4a723b 100644 --- a/src/uu/cut/src/searcher.rs +++ b/src/uu/cut/src/searcher.rs @@ -33,9 +33,9 @@ impl<'a> Iterator for Searcher<'a> { if self.needle.len() == 1 || self.haystack[match_idx + 1..].starts_with(&self.needle[1..]) { + let match_pos = self.position + match_idx; let skip = match_idx + self.needle.len(); self.haystack = &self.haystack[skip..]; - let match_pos = self.position + match_idx; self.position += skip; return Some(match_pos); } else { From a60fd07bc3b249b6bc0a07e675b5f3d8023a7dd4 Mon Sep 17 00:00:00 2001 From: Rein F Date: Wed, 28 Apr 2021 20:54:27 +0200 Subject: [PATCH 0480/1135] ls: improvements on time handling (#1986) * ls: added creation time * ls: Added most time features Missing support for posix-,Format+, translating via locales. Also required more tests * ls: rustfmt * ls: Additional changes and fixes Fixed the argument order, fixed a wrong iso format. * ls: additional tests for styles * ls: perfected arg parsing on time styles * fix birthime test * ls: Use 'stdout_str' in new tests * ls: Disabled birthtime test for windows * ls: removed indoc as a dependency * ls: birthime test, sync first created file * ls: birthime test, add comment explaining sync * Removed ruby testfile birth_test.rb This accidentally got commited in a merge --- Cargo.lock | 33 +++++++++--- src/uu/ls/Cargo.toml | 9 ++-- src/uu/ls/src/ls.rs | 112 ++++++++++++++++++++++++++++++++++----- src/uucore/Cargo.toml | 2 +- tests/by-util/test_ls.rs | 112 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 245 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ea67b34af..863a36451 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -165,13 +165,15 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.11" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ + "libc", "num-integer", "num-traits", "time", + "winapi 0.3.9", ] [[package]] @@ -732,6 +734,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" +[[package]] +name = "indoc" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a75aeaaef0ce18b58056d306c27b07436fbb34b8816c53094b76dd81803136" +dependencies = [ + "unindent", +] + [[package]] name = "ioctl-sys" version = "0.5.2" @@ -802,6 +813,15 @@ version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" +[[package]] +name = "locale" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fdbe492a9c0238da900a1165c42fc5067161ce292678a6fe80921f30fe307fd" +dependencies = [ + "libc", +] + [[package]] name = "log" version = "0.4.14" @@ -1573,12 +1593,11 @@ dependencies = [ [[package]] name = "time" -version = "0.1.42" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ "libc", - "redox_syscall 0.1.57", "winapi 0.3.9", ] @@ -2060,15 +2079,17 @@ name = "uu_ls" version = "0.0.6" dependencies = [ "atty", + "chrono", "clap", "globset", + "indoc", "lazy_static", + "locale", "lscolors", "number_prefix", "once_cell", "term_grid", "termsize", - "time", "unicode-width", "uucore", "uucore_procs", diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index d479a57f4..ab58a7300 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -15,16 +15,17 @@ edition = "2018" path = "src/ls.rs" [dependencies] +locale = "0.2.2" +chrono = "0.4.19" clap = "2.33" unicode-width = "0.1.8" number_prefix = "0.4" term_grid = "0.1.5" termsize = "0.1.6" -time = "0.1.40" globset = "0.4.6" -lscolors = { version="0.7.1", features=["ansi_term"] } -uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "fs"] } -uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +lscolors = { version = "0.7.1", features = ["ansi_term"] } +uucore = { version = ">=0.0.8", package = "uucore", path = "../../uucore", features = ["entries", "fs"] } +uucore_procs = { version = ">=0.0.5", package = "uucore_procs", path = "../../uucore_procs" } once_cell = "1.7.2" atty = "0.2" diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 3245e2a56..d78e1977a 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -38,8 +38,11 @@ use std::{ os::unix::fs::{FileTypeExt, MetadataExt}, time::Duration, }; + +use chrono; + use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; -use time::{strftime, Timespec}; + use unicode_width::UnicodeWidthStr; #[cfg(unix)] use uucore::libc::{S_IXGRP, S_IXOTH, S_IXUSR}; @@ -50,6 +53,8 @@ static ABOUT: &str = " the command line, expect that it will ignore files and directories whose names start with '.' "; +static AFTER_HELP: &str = "The TIME_STYLE argument can be full-iso, long-iso, iso. +Also the TIME_STYLE environment variable sets the default style to use."; fn get_usage() -> String { format!("{0} [OPTION]... [FILE]...", executable!()) @@ -117,6 +122,8 @@ pub mod options { pub static COLOR: &str = "color"; pub static PATHS: &str = "paths"; pub static INDICATOR_STYLE: &str = "indicator-style"; + pub static TIME_STYLE: &str = "time-style"; + pub static FULL_TIME: &str = "full-time"; pub static HIDE: &str = "hide"; pub static IGNORE: &str = "ignore"; } @@ -156,6 +163,15 @@ enum Time { Modification, Access, Change, + Birth, +} + +#[derive(Debug)] +enum TimeStyle { + FullIso, + LongIso, + Iso, + Locale, } enum Dereference { @@ -191,6 +207,7 @@ struct Config { width: Option, quoting_style: QuotingStyle, indicator_style: IndicatorStyle, + time_style: TimeStyle, } // Fields that can be removed or added to the long format @@ -251,6 +268,7 @@ impl Config { options::format::LONG_NO_OWNER, options::format::LONG_NO_GROUP, options::format::LONG_NUMERIC_UID_GID, + options::FULL_TIME, ] .iter() .flat_map(|opt| options.indices_of(opt)) @@ -302,6 +320,7 @@ impl Config { match field { "ctime" | "status" => Time::Change, "access" | "atime" | "use" => Time::Access, + "birth" | "creation" => Time::Birth, // below should never happen as clap already restricts the values. _ => unreachable!("Invalid field for --time"), } @@ -439,6 +458,30 @@ impl Config { IndicatorStyle::None }; + let time_style = if let Some(field) = options.value_of(options::TIME_STYLE) { + //If both FULL_TIME and TIME_STYLE are present + //The one added last is dominant + if options.is_present(options::FULL_TIME) + && options.indices_of(options::FULL_TIME).unwrap().last() + > options.indices_of(options::TIME_STYLE).unwrap().last() + { + TimeStyle::FullIso + } else { + //Clap handles the env variable "TIME_STYLE" + match field { + "full-iso" => TimeStyle::FullIso, + "long-iso" => TimeStyle::LongIso, + "iso" => TimeStyle::Iso, + "locale" => TimeStyle::Locale, + // below should never happen as clap already restricts the values. + _ => unreachable!("Invalid field for --time-style"), + } + } + } else if options.is_present(options::FULL_TIME) { + TimeStyle::FullIso + } else { + TimeStyle::Locale + }; let mut ignore_patterns = GlobSetBuilder::new(); if options.is_present(options::IGNORE_BACKUPS) { ignore_patterns.add(Glob::new("*~").unwrap()); @@ -504,6 +547,7 @@ impl Config { width, quoting_style, indicator_style, + time_style, } } } @@ -696,10 +740,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::TIME) .help("Show time in :\n\ \taccess time (-u): atime, access, use;\n\ - \tchange time (-t): ctime, status.") + \tchange time (-t): ctime, status.\n\ + \tbirth time: birth, creation;") .value_name("field") .takes_value(true) - .possible_values(&["atime", "access", "use", "ctime", "status"]) + .possible_values(&["atime", "access", "use", "ctime", "status", "birth", "creation"]) .hide_possible_values(true) .require_equals(true) .overrides_with_all(&[ @@ -1020,9 +1065,34 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::indicator_style::CLASSIFY, options::INDICATOR_STYLE, ])) + .arg( + //This still needs support for posix-*, +FORMAT + Arg::with_name(options::TIME_STYLE) + .long(options::TIME_STYLE) + .help("time/date format with -l; see TIME_STYLE below") + .value_name("TIME_STYLE") + .env("TIME_STYLE") + .possible_values(&[ + "full-iso", + "long-iso", + "iso", + "locale", + ]) + .overrides_with_all(&[ + options::TIME_STYLE + ]) + ) + .arg( + Arg::with_name(options::FULL_TIME) + .long(options::FULL_TIME) + .overrides_with(options::FULL_TIME) + .help("like -l --time-style=full-iso") + ) // Positional arguments - .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)); + .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)) + + .after_help(AFTER_HELP); let matches = app.get_matches_from(args); @@ -1480,6 +1550,7 @@ fn get_system_time(md: &Metadata, config: &Config) -> Option { Time::Change => Some(UNIX_EPOCH + Duration::new(md.ctime() as u64, md.ctime_nsec() as u32)), Time::Modification => md.modified().ok(), Time::Access => md.accessed().ok(), + Time::Birth => md.created().ok(), } } @@ -1492,18 +1563,35 @@ fn get_system_time(md: &Metadata, config: &Config) -> Option { } } -fn get_time(md: &Metadata, config: &Config) -> Option { - let duration = get_system_time(md, config)? - .duration_since(UNIX_EPOCH) - .ok()?; - let secs = duration.as_secs() as i64; - let nsec = duration.subsec_nanos() as i32; - Some(time::at(Timespec::new(secs, nsec))) +fn get_time(md: &Metadata, config: &Config) -> Option> { + let time = get_system_time(md, config)?; + Some(time.into()) } fn display_date(metadata: &Metadata, config: &Config) -> String { match get_time(metadata, config) { - Some(time) => strftime("%F %R", &time).unwrap(), + Some(time) => { + //Date is recent if from past 6 months + //According to GNU a Gregorian year has 365.2425 * 24 * 60 * 60 == 31556952 seconds on the average. + let recent = time + chrono::Duration::seconds(31556952 / 2) > chrono::Local::now(); + + match config.time_style { + TimeStyle::FullIso => time.format("%Y-%m-%d %H:%M:%S.%f %z"), + TimeStyle::LongIso => time.format("%Y-%m-%d %H:%M"), + TimeStyle::Iso => time.format(if recent { "%m-%d %H:%M" } else { "%Y-%m-%d " }), + TimeStyle::Locale => { + let fmt = if recent { "%b %e %H:%M" } else { "%b %e %Y" }; + + //In this version of chrono translating can be done + //The function is chrono::datetime::DateTime::format_localized + //However it's currently still hard to get the current pure-rust-locale + //So it's not yet implemented + + time.format(fmt) + } + } + .to_string() + } None => "???".into(), } } diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 855e64b36..291456760 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -24,7 +24,7 @@ thiserror = { version="1.0", optional=true } lazy_static = { version="1.3", optional=true } nix = { version="<= 0.13", optional=true } platform-info = { version="<= 0.1", optional=true } -time = { version="<= 0.1.42", optional=true } +time = { version="<= 0.1.43", optional=true } # * "problem" dependencies (pinned) data-encoding = { version="~2.1", optional=true } ## data-encoding: require v2.1; but v2.2.0 breaks the build for MinSRV v1.31.0 libc = { version="0.2.15, <= 0.2.85", optional=true } ## libc: initial utmp support added in v0.2.15; but v0.2.68 breaks the build for MinSRV v1.31.0 diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 1a3bdf78a..eeb7a6248 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -558,6 +558,118 @@ fn test_ls_long_ctime() { } } +#[test] +#[cfg(not(windows))] +// This test is currently failing on windows +fn test_ls_order_birthtime() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + /* + Here we make 2 files with a timeout in between. + After creating the first file try to sync it. + This ensures the file gets created immediately instead of being saved + inside the OS's IO operation buffer. + Without this, both files might accidentally be created at the same time, + even though we placed a timeout between creating the two. + + https://github.com/uutils/coreutils/pull/1986/#issuecomment-828490651 + */ + at.make_file("test-birthtime-1").sync_all().unwrap(); + std::thread::sleep(std::time::Duration::from_millis(1)); + at.make_file("test-birthtime-2"); + at.touch("test-birthtime-1"); + + let result = scene.ucmd().arg("--time=birth").arg("-t").run(); + + #[cfg(not(windows))] + assert_eq!(result.stdout_str(), "test-birthtime-2\ntest-birthtime-1\n"); + #[cfg(windows)] + assert_eq!(result.stdout_str(), "test-birthtime-2 test-birthtime-1\n"); +} + +#[test] +fn test_ls_styles() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.touch("test"); + + let re_full = Regex::new( + r"[a-z-]* \d* \w* \w* \d* \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d* \+\d{4} test\n", + ) + .unwrap(); + let re_long = + Regex::new(r"[a-z-]* \d* \w* \w* \d* \d{4}-\d{2}-\d{2} \d{2}:\d{2} test\n").unwrap(); + let re_iso = Regex::new(r"[a-z-]* \d* \w* \w* \d* \d{2}-\d{2} \d{2}:\d{2} test\n").unwrap(); + let re_locale = + Regex::new(r"[a-z-]* \d* \w* \w* \d* [A-Z][a-z]{2} \d{2} \d{2}:\d{2} test\n").unwrap(); + + //full-iso + let result = scene + .ucmd() + .arg("-l") + .arg("--time-style=full-iso") + .succeeds(); + assert!(re_full.is_match(&result.stdout_str())); + //long-iso + let result = scene + .ucmd() + .arg("-l") + .arg("--time-style=long-iso") + .succeeds(); + assert!(re_long.is_match(&result.stdout_str())); + //iso + let result = scene.ucmd().arg("-l").arg("--time-style=iso").succeeds(); + assert!(re_iso.is_match(&result.stdout_str())); + //locale + let result = scene.ucmd().arg("-l").arg("--time-style=locale").succeeds(); + assert!(re_locale.is_match(&result.stdout_str())); + + //Overwrite options tests + let result = scene + .ucmd() + .arg("-l") + .arg("--time-style=long-iso") + .arg("--time-style=iso") + .succeeds(); + assert!(re_iso.is_match(&result.stdout_str())); + let result = scene + .ucmd() + .arg("--time-style=iso") + .arg("--full-time") + .succeeds(); + assert!(re_full.is_match(&result.stdout_str())); + let result = scene + .ucmd() + .arg("--full-time") + .arg("--time-style=iso") + .succeeds(); + assert!(re_iso.is_match(&result.stdout_str())); + + let result = scene + .ucmd() + .arg("--full-time") + .arg("--time-style=iso") + .arg("--full-time") + .succeeds(); + assert!(re_full.is_match(&result.stdout_str())); + + let result = scene + .ucmd() + .arg("--full-time") + .arg("-x") + .arg("-l") + .succeeds(); + assert!(re_full.is_match(&result.stdout_str())); + + at.touch("test2"); + let result = scene.ucmd().arg("--full-time").arg("-x").succeeds(); + #[cfg(not(windows))] + assert_eq!(result.stdout_str(), "test\ntest2\n"); + #[cfg(windows)] + assert_eq!(result.stdout_str(), "test test2\n"); +} + #[test] fn test_ls_order_time() { let scene = TestScenario::new(util_name!()); From 1ca6edb560187d8e4d2df558bd673594117c63fa Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 28 Apr 2021 20:55:08 +0200 Subject: [PATCH 0481/1135] fix the min rust version --- Cargo.lock | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 863a36451..cdba3b784 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,7 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 - [[package]] name = "advapi32-sys" version = "0.2.0" @@ -734,15 +732,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" -[[package]] -name = "indoc" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a75aeaaef0ce18b58056d306c27b07436fbb34b8816c53094b76dd81803136" -dependencies = [ - "unindent", -] - [[package]] name = "ioctl-sys" version = "0.5.2" @@ -1484,9 +1473,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9505f307c872bab8eb46f77ae357c8eba1fdacead58ee5a850116b1d7f82883" +checksum = "ad184cc9470f9117b2ac6817bfe297307418819ba40552f9b3846f05c33d5373" dependencies = [ "proc-macro2", "quote 1.0.9", @@ -2082,7 +2071,6 @@ dependencies = [ "chrono", "clap", "globset", - "indoc", "lazy_static", "locale", "lscolors", From 6f16cafe88d5c807c731a1b1d01b83e7c000c3ff Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 28 Apr 2021 22:58:28 +0200 Subject: [PATCH 0482/1135] who: move from getopts to clap (#2124) --- src/uu/who/Cargo.toml | 1 + src/uu/who/src/who.rs | 221 ++++++++++++++++++++++++++------------ tests/by-util/test_who.rs | 183 ++++++++++++++++++++++++++++--- 3 files changed, 322 insertions(+), 83 deletions(-) diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index c0cd63795..ff1c5b2af 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -17,6 +17,7 @@ path = "src/who.rs" [dependencies] uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["utmpx"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +clap = "3.0.0-beta.2" [[bin]] name = "who" diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index e979d2d46..47c9dfa6e 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -12,79 +12,164 @@ extern crate uucore; use uucore::libc::{ttyname, STDIN_FILENO, S_IWGRP}; use uucore::utmpx::{self, time, Utmpx}; +use clap::{App, Arg}; use std::borrow::Cow; use std::ffi::CStr; use std::os::unix::fs::MetadataExt; use std::path::PathBuf; use uucore::InvalidEncodingHandling; -static SYNTAX: &str = "[OPTION]... [ FILE | ARG1 ARG2 ]"; -static SUMMARY: &str = "Print information about users who are currently logged in."; -static LONG_HELP: &str = " - -a, --all same as -b -d --login -p -r -t -T -u - -b, --boot time of last system boot - -d, --dead print dead processes - -H, --heading print line of column headings - -l, --login print system login processes - --lookup attempt to canonicalize hostnames via DNS - -m only hostname and user associated with stdin - -p, --process print active processes spawned by init - -q, --count all login names and number of users logged on - -r, --runlevel print current runlevel (not available on BSDs) - -s, --short print only name, line, and time (default) - -t, --time print last system clock change - -T, -w, --mesg add user's message status as +, - or ? - -u, --users list users logged in - --message same as -T - --writable same as -T - --help display this help and exit - --version output version information and exit +mod options { + pub const ALL: &str = "all"; + pub const BOOT: &str = "boot"; + pub const DEAD: &str = "dead"; + pub const HEADING: &str = "heading"; + pub const LOGIN: &str = "login"; + pub const LOOKUP: &str = "lookup"; + pub const ONLY_HOSTNAME_USER: &str = "only_hostname_user"; + pub const PROCESS: &str = "process"; + pub const COUNT: &str = "count"; + #[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))] + pub const RUNLEVEL: &str = "runlevel"; + pub const SHORT: &str = "short"; + pub const TIME: &str = "time"; + pub const USERS: &str = "users"; + pub const MESG: &str = "mesg"; // aliases: --message, --writable + pub const FILE: &str = "FILE"; // if length=1: FILE, if length=2: ARG1 ARG2 +} -If FILE is not specified, use /var/run/utmp. /var/log/wtmp as FILE is common. -If ARG1 ARG2 given, -m presumed: 'am i' or 'mom likes' are usual. -"; +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Print information about users who are currently logged in."; + +fn get_usage() -> String { + format!("{0} [OPTION]... [ FILE | ARG1 ARG2 ]", executable!()) +} + +fn get_long_usage() -> String { + String::from( + "If FILE is not specified, use /var/run/utmp. /var/log/wtmp as FILE is common.\n\ +If ARG1 ARG2 given, -m presumed: 'am i' or 'mom likes' are usual.", + ) +} pub fn uumain(args: impl uucore::Args) -> i32 { let args = args .collect_str(InvalidEncodingHandling::Ignore) .accept_any(); - let mut opts = app!(SYNTAX, SUMMARY, LONG_HELP); - opts.optflag("a", "all", "same as -b -d --login -p -r -t -T -u"); - opts.optflag("b", "boot", "time of last system boot"); - opts.optflag("d", "dead", "print dead processes"); - opts.optflag("H", "heading", "print line of column headings"); - opts.optflag("l", "login", "print system login processes"); - opts.optflag("", "lookup", "attempt to canonicalize hostnames via DNS"); - opts.optflag("m", "", "only hostname and user associated with stdin"); - opts.optflag("p", "process", "print active processes spawned by init"); - opts.optflag( - "q", - "count", - "all login names and number of users logged on", - ); - #[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))] - opts.optflag("r", "runlevel", "print current runlevel"); - opts.optflag("s", "short", "print only name, line, and time (default)"); - opts.optflag("t", "time", "print last system clock change"); - opts.optflag("u", "users", "list users logged in"); - opts.optflag("w", "mesg", "add user's message status as +, - or ?"); - // --message, --writable are the same as --mesg - opts.optflag("T", "message", ""); - opts.optflag("T", "writable", ""); + let usage = get_usage(); + let after_help = get_long_usage(); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .override_usage(&usage[..]) + .after_help(&after_help[..]) + .arg( + Arg::new(options::ALL) + .long(options::ALL) + .short('a') + .about("same as -b -d --login -p -r -t -T -u"), + ) + .arg( + Arg::new(options::BOOT) + .long(options::BOOT) + .short('b') + .about("time of last system boot"), + ) + .arg( + Arg::new(options::DEAD) + .long(options::DEAD) + .short('d') + .about("print dead processes"), + ) + .arg( + Arg::new(options::HEADING) + .long(options::HEADING) + .short('H') + .about("print line of column headings"), + ) + .arg( + Arg::new(options::LOGIN) + .long(options::LOGIN) + .short('l') + .about("print system login processes"), + ) + .arg( + Arg::new(options::LOOKUP) + .long(options::LOOKUP) + .about("attempt to canonicalize hostnames via DNS"), + ) + .arg( + Arg::new(options::ONLY_HOSTNAME_USER) + .short('m') + .about("only hostname and user associated with stdin"), + ) + .arg( + Arg::new(options::PROCESS) + .long(options::PROCESS) + .short('p') + .about("print active processes spawned by init"), + ) + .arg( + Arg::new(options::COUNT) + .long(options::COUNT) + .short('q') + .about("all login names and number of users logged on"), + ) + .arg( + #[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))] + Arg::new(options::RUNLEVEL) + .long(options::RUNLEVEL) + .short('r') + .about("print current runlevel"), + ) + .arg( + Arg::new(options::SHORT) + .long(options::SHORT) + .short('s') + .about("print only name, line, and time (default)"), + ) + .arg( + Arg::new(options::TIME) + .long(options::TIME) + .short('t') + .about("print last system clock change"), + ) + .arg( + Arg::new(options::USERS) + .long(options::USERS) + .short('u') + .about("list users logged in"), + ) + .arg( + Arg::new(options::MESG) + .long(options::MESG) + .short('T') + .visible_short_alias('w') + .visible_aliases(&["message", "writable"]) + .about("add user's message status as +, - or ?"), + ) + .arg( + Arg::new(options::FILE) + .takes_value(true) + .min_values(1) + .max_values(2), + ) + .get_matches_from(args); - let matches = opts.parse(args); + let files: Vec = matches + .values_of(options::FILE) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); // If true, attempt to canonicalize hostnames via a DNS lookup. - let do_lookup = matches.opt_present("lookup"); + let do_lookup = matches.is_present(options::LOOKUP); // If true, display only a list of usernames and count of // the users logged on. // Ignored for 'who am i'. - let short_list = matches.opt_present("q"); + let short_list = matches.is_present(options::COUNT); // If true, display only name, line, and time fields. let mut short_output = false; @@ -95,12 +180,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let mut include_idle = false; // If true, display a line at the top describing each field. - let include_heading = matches.opt_present("H"); + let include_heading = matches.is_present(options::HEADING); // If true, display a '+' for each user if mesg y, a '-' if mesg n, // or a '?' if their tty cannot be statted. - let include_mesg = - matches.opt_present("a") || matches.opt_present("T") || matches.opt_present("w"); + let include_mesg = matches.is_present(options::ALL) || matches.is_present(options::MESG); // If true, display process termination & exit status. let mut include_exit = false; @@ -133,7 +217,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { #[allow(clippy::useless_let_if_seq)] { - if matches.opt_present("a") { + if matches.is_present(options::ALL) { need_boottime = true; need_deadprocs = true; need_login = true; @@ -146,49 +230,49 @@ pub fn uumain(args: impl uucore::Args) -> i32 { assumptions = false; } - if matches.opt_present("b") { + if matches.is_present(options::BOOT) { need_boottime = true; assumptions = false; } - if matches.opt_present("d") { + if matches.is_present(options::DEAD) { need_deadprocs = true; include_idle = true; include_exit = true; assumptions = false; } - if matches.opt_present("l") { + if matches.is_present(options::LOGIN) { need_login = true; include_idle = true; assumptions = false; } - if matches.opt_present("m") || matches.free.len() == 2 { + if matches.is_present(options::ONLY_HOSTNAME_USER) || files.len() == 2 { my_line_only = true; } - if matches.opt_present("p") { + if matches.is_present(options::PROCESS) { need_initspawn = true; assumptions = false; } - if matches.opt_present("r") { + if matches.is_present(options::RUNLEVEL) { need_runlevel = true; include_idle = true; assumptions = false; } - if matches.opt_present("s") { + if matches.is_present(options::SHORT) { short_output = true; } - if matches.opt_present("t") { + if matches.is_present(options::TIME) { need_clockchange = true; assumptions = false; } - if matches.opt_present("u") { + if matches.is_present(options::USERS) { need_users = true; include_idle = true; assumptions = false; @@ -202,11 +286,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if include_exit { short_output = false; } - - if matches.free.len() > 2 { - show_usage_error!("{}", msg_wrong_number_of_arguments!()); - exit!(1); - } } let mut who = Who { @@ -225,7 +304,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { need_runlevel, need_users, my_line_only, - args: matches.free, + args: files, }; who.exec(); diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index 32d2427e0..9bd607ec3 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -1,11 +1,13 @@ -#[cfg(target_os = "linux")] use crate::common::util::*; #[cfg(target_os = "linux")] #[test] fn test_count() { for opt in vec!["-q", "--count"] { - new_ucmd!().arg(opt).run().stdout_is(expected_result(opt)); + new_ucmd!() + .arg(opt) + .succeeds() + .stdout_is(expected_result(opt)); } } @@ -13,17 +15,21 @@ fn test_count() { #[test] fn test_boot() { for opt in vec!["-b", "--boot"] { - new_ucmd!().arg(opt).run().stdout_is(expected_result(opt)); + new_ucmd!() + .arg(opt) + .succeeds() + .stdout_is(expected_result(opt)); } } #[cfg(target_os = "linux")] #[test] fn test_heading() { - for opt in vec!["-H"] { + for opt in vec!["-H", "--heading"] { // allow whitespace variation - // * minor whitespace differences occur between platform built-in outputs; specifically number of TABs between "TIME" and "COMMENT" may be variant - let actual = new_ucmd!().arg(opt).run().stdout_move_str(); + // * minor whitespace differences occur between platform built-in outputs; + // specifically number of TABs between "TIME" and "COMMENT" may be variant + let actual = new_ucmd!().arg(opt).succeeds().stdout_move_str(); let expect = expected_result(opt); println!("actual: {:?}", actual); println!("expect: {:?}", expect); @@ -37,7 +43,10 @@ fn test_heading() { #[test] fn test_short() { for opt in vec!["-s", "--short"] { - new_ucmd!().arg(opt).run().stdout_is(expected_result(opt)); + new_ucmd!() + .arg(opt) + .succeeds() + .stdout_is(expected_result(opt)); } } @@ -45,7 +54,10 @@ fn test_short() { #[test] fn test_login() { for opt in vec!["-l", "--login"] { - new_ucmd!().arg(opt).run().stdout_is(expected_result(opt)); + new_ucmd!() + .arg(opt) + .succeeds() + .stdout_is(expected_result(opt)); } } @@ -53,7 +65,109 @@ fn test_login() { #[test] fn test_m() { for opt in vec!["-m"] { - new_ucmd!().arg(opt).run().stdout_is(expected_result(opt)); + new_ucmd!() + .arg(opt) + .succeeds() + .stdout_is(expected_result(opt)); + } +} + +#[cfg(target_os = "linux")] +#[test] +fn test_process() { + for opt in vec!["-p", "--process"] { + new_ucmd!() + .arg(opt) + .succeeds() + .stdout_is(expected_result(opt)); + } +} + +#[cfg(target_os = "linux")] +#[test] +fn test_runlevel() { + for opt in vec!["-r", "--runlevel"] { + new_ucmd!() + .arg(opt) + .succeeds() + .stdout_is(expected_result(opt)); + } +} + +#[cfg(target_os = "linux")] +#[test] +fn test_time() { + for opt in vec!["-t", "--time"] { + new_ucmd!() + .arg(opt) + .succeeds() + .stdout_is(expected_result(opt)); + } +} + +#[cfg(target_os = "linux")] +#[test] +fn test_mesg() { + for opt in vec!["-w", "-T", "--users", "--message", "--writable"] { + new_ucmd!() + .arg(opt) + .succeeds() + .stdout_is(expected_result(opt)); + } +} + +#[cfg(target_os = "linux")] +#[test] +fn test_arg1_arg2() { + let scene = TestScenario::new(util_name!()); + + let expected = scene + .cmd_keepenv(util_name!()) + .env("LANGUAGE", "C") + .arg("am") + .arg("i") + .succeeds(); + + scene + .ucmd() + .arg("am") + .arg("i") + .succeeds() + .stdout_is(expected.stdout_str()); +} + +#[test] +fn test_too_many_args() { + let expected = + "error: The value 'u' was provided to '...' but it wasn't expecting any more values"; + + new_ucmd!() + .arg("am") + .arg("i") + .arg("u") + .fails() + .stderr_contains(expected); +} + +#[cfg(target_os = "linux")] +#[test] +fn test_users() { + for opt in vec!["-u", "--users"] { + new_ucmd!() + .arg(opt) + .succeeds() + .stdout_is(expected_result(opt)); + } +} + +#[cfg(target_os = "linux")] +#[test] +fn test_lookup() { + for opt in vec!["--lookup"] { + new_ucmd!() + .arg(opt) + .succeeds() + .stdout_is(expected_result(opt)); } } @@ -61,15 +175,60 @@ fn test_m() { #[test] fn test_dead() { for opt in vec!["-d", "--dead"] { - new_ucmd!().arg(opt).run().stdout_is(expected_result(opt)); + new_ucmd!() + .arg(opt) + .succeeds() + .stdout_is(expected_result(opt)); } } +#[cfg(target_os = "linux")] +#[test] +fn test_all_separately() { + // -a, --all same as -b -d --login -p -r -t -T -u + let scene = TestScenario::new(util_name!()); + + let expected = scene + .cmd_keepenv(util_name!()) + .env("LANGUAGE", "C") + .arg("-b") + .arg("-d") + .arg("--login") + .arg("-p") + .arg("-r") + .arg("-t") + .arg("-T") + .arg("-u") + .succeeds(); + + scene + .ucmd() + .arg("-b") + .arg("-d") + .arg("--login") + .arg("-p") + .arg("-r") + .arg("-t") + .arg("-T") + .arg("-u") + .succeeds() + .stdout_is(expected.stdout_str()); + + scene + .ucmd() + .arg("--all") + .succeeds() + .stdout_is(expected.stdout_str()); +} + #[cfg(target_os = "linux")] #[test] fn test_all() { for opt in vec!["-a", "--all"] { - new_ucmd!().arg(opt).run().stdout_is(expected_result(opt)); + new_ucmd!() + .arg(opt) + .succeeds() + .stdout_is(expected_result(opt)); } } @@ -79,6 +238,6 @@ fn expected_result(arg: &str) -> String { .cmd_keepenv(util_name!()) .env("LANGUAGE", "C") .args(&[arg]) - .run() + .succeeds() .stdout_move_str() } From 512d206f1e87b546428c2aa45f8a9ef93ce89bef Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Thu, 29 Apr 2021 00:11:21 +0200 Subject: [PATCH 0483/1135] who: move from getopts to clap 2.33.3 (#2124) --- src/uu/who/Cargo.toml | 2 +- src/uu/who/src/who.rs | 97 +++++++++++++++++++++------------------ tests/by-util/test_who.rs | 2 +- 3 files changed, 54 insertions(+), 47 deletions(-) diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index ff1c5b2af..4d8eccb45 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -17,7 +17,7 @@ path = "src/who.rs" [dependencies] uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["utmpx"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } -clap = "3.0.0-beta.2" +clap = "2.33.3" [[bin]] name = "who" diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index 47c9dfa6e..ba1360eff 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -63,95 +63,100 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .version(VERSION) .about(ABOUT) - .override_usage(&usage[..]) + .usage(&usage[..]) .after_help(&after_help[..]) .arg( - Arg::new(options::ALL) + Arg::with_name(options::ALL) .long(options::ALL) - .short('a') - .about("same as -b -d --login -p -r -t -T -u"), + .short("a") + .help("same as -b -d --login -p -r -t -T -u"), ) .arg( - Arg::new(options::BOOT) + Arg::with_name(options::BOOT) .long(options::BOOT) - .short('b') - .about("time of last system boot"), + .short("b") + .help("time of last system boot"), ) .arg( - Arg::new(options::DEAD) + Arg::with_name(options::DEAD) .long(options::DEAD) - .short('d') - .about("print dead processes"), + .short("d") + .help("print dead processes"), ) .arg( - Arg::new(options::HEADING) + Arg::with_name(options::HEADING) .long(options::HEADING) - .short('H') - .about("print line of column headings"), + .short("H") + .help("print line of column headings"), ) .arg( - Arg::new(options::LOGIN) + Arg::with_name(options::LOGIN) .long(options::LOGIN) - .short('l') - .about("print system login processes"), + .short("l") + .help("print system login processes"), ) .arg( - Arg::new(options::LOOKUP) + Arg::with_name(options::LOOKUP) .long(options::LOOKUP) - .about("attempt to canonicalize hostnames via DNS"), + .help("attempt to canonicalize hostnames via DNS"), ) .arg( - Arg::new(options::ONLY_HOSTNAME_USER) - .short('m') - .about("only hostname and user associated with stdin"), + Arg::with_name(options::ONLY_HOSTNAME_USER) + .short("m") + .help("only hostname and user associated with stdin"), ) .arg( - Arg::new(options::PROCESS) + Arg::with_name(options::PROCESS) .long(options::PROCESS) - .short('p') - .about("print active processes spawned by init"), + .short("p") + .help("print active processes spawned by init"), ) .arg( - Arg::new(options::COUNT) + Arg::with_name(options::COUNT) .long(options::COUNT) - .short('q') - .about("all login names and number of users logged on"), + .short("q") + .help("all login names and number of users logged on"), ) .arg( #[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))] - Arg::new(options::RUNLEVEL) + Arg::with_name(options::RUNLEVEL) .long(options::RUNLEVEL) - .short('r') - .about("print current runlevel"), + .short("r") + .help("print current runlevel"), ) .arg( - Arg::new(options::SHORT) + Arg::with_name(options::SHORT) .long(options::SHORT) - .short('s') - .about("print only name, line, and time (default)"), + .short("s") + .help("print only name, line, and time (default)"), ) .arg( - Arg::new(options::TIME) + Arg::with_name(options::TIME) .long(options::TIME) - .short('t') - .about("print last system clock change"), + .short("t") + .help("print last system clock change"), ) .arg( - Arg::new(options::USERS) + Arg::with_name(options::USERS) .long(options::USERS) - .short('u') - .about("list users logged in"), + .short("u") + .help("list users logged in"), ) .arg( - Arg::new(options::MESG) + Arg::with_name(options::MESG) .long(options::MESG) - .short('T') - .visible_short_alias('w') + .short("T") + // .visible_short_alias('w') // TODO: requires clap "3.0.0-beta.2" .visible_aliases(&["message", "writable"]) - .about("add user's message status as +, - or ?"), + .help("add user's message status as +, - or ?"), ) .arg( - Arg::new(options::FILE) + Arg::with_name("w") // work around for `Arg::visible_short_alias` + .short("w") + .help("same as -T"), + ) + .arg( + Arg::with_name(options::FILE) .takes_value(true) .min_values(1) .max_values(2), @@ -184,7 +189,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // If true, display a '+' for each user if mesg y, a '-' if mesg n, // or a '?' if their tty cannot be statted. - let include_mesg = matches.is_present(options::ALL) || matches.is_present(options::MESG); + let include_mesg = matches.is_present(options::ALL) + || matches.is_present(options::MESG) + || matches.is_present("w"); // If true, display process termination & exit status. let mut include_exit = false; diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index 9bd607ec3..a5637f23a 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -139,7 +139,7 @@ fn test_arg1_arg2() { #[test] fn test_too_many_args() { let expected = - "error: The value 'u' was provided to '...' but it wasn't expecting any more values"; + "error: The value 'u' was provided to '...', but it wasn't expecting any more values"; new_ucmd!() .arg("am") From b89978a4c97085924dbc0656b5ead2a103d1274e Mon Sep 17 00:00:00 2001 From: nicoo Date: Thu, 29 Apr 2021 15:56:56 +0200 Subject: [PATCH 0484/1135] factor: Add annotations for coz, the causal profiler (#2142) * factor: Add annotations for coz, the causal profiler * Update Cargo.lock Generated with `nix-shell -p rustup --run 'cargo +1.40.0 update'` --- Cargo.lock | 21 ++++++++++++++++----- src/uu/factor/Cargo.toml | 2 +- src/uu/factor/src/factor.rs | 15 +++++++++++++-- src/uu/factor/src/table.rs | 2 ++ 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cdba3b784..31787e626 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -333,6 +333,16 @@ dependencies = [ "walkdir", ] +[[package]] +name = "coz" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cef55b3fe2f5477d59e12bc792e8b3c95a25bd099eadcfae006ecea136de76e2" +dependencies = [ + "libc", + "once_cell", +] + [[package]] name = "cpp" version = "0.5.6" @@ -608,7 +618,7 @@ checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.6", + "redox_syscall 0.2.7", "winapi 0.3.9", ] @@ -1249,9 +1259,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8270314b5ccceb518e7e578952f0b72b88222d02e8f77f5ecf7abbb673539041" +checksum = "85dd92e586f7355c633911e11f77f3d12f04b1b1bd76a198bd34ae3af8341ef2" dependencies = [ "bitflags", ] @@ -1262,7 +1272,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" dependencies = [ - "redox_syscall 0.2.6", + "redox_syscall 0.2.7", ] [[package]] @@ -1533,7 +1543,7 @@ checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ "libc", "numtoa", - "redox_syscall 0.2.6", + "redox_syscall 0.2.7", "redox_termios", ] @@ -1898,6 +1908,7 @@ dependencies = [ name = "uu_factor" version = "0.0.6" dependencies = [ + "coz", "criterion", "num-traits", "paste", diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index 489c713be..c4e7e8469 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -14,8 +14,8 @@ edition = "2018" [build-dependencies] num-traits = "0.2.13" # used in src/numerics.rs, which is included by build.rs - [dependencies] +coz = { version = "0.1.3", optional = true } num-traits = "0.2.13" # Needs at least version 0.2.13 for "OverflowingAdd" rand = { version="0.7", features=["small_rng"] } smallvec = { version="0.6.14, < 1.0" } diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 7d2e16a11..42586d1da 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -125,6 +125,8 @@ fn _factor(num: u64, f: Factors) -> Factors let n = A::new(num); let divisor = match miller_rabin::test::
(n) { Prime => { + #[cfg(feature="coz")] + coz::progress!("factor found"); let mut r = f; r.push(num); return r; @@ -139,6 +141,8 @@ fn _factor(num: u64, f: Factors) -> Factors } pub fn factor(mut n: u64) -> Factors { + #[cfg(feature="coz")] + coz::begin!("factorization"); let mut factors = Factors::one(); if n < 2 { @@ -152,16 +156,23 @@ pub fn factor(mut n: u64) -> Factors { } if n == 1 { + #[cfg(feature="coz")] + coz::end!("factorization"); return factors; } let (factors, n) = table::factor(n, factors); - if n < (1 << 32) { + let r = if n < (1 << 32) { _factor::>(n, factors) } else { _factor::>(n, factors) - } + }; + + #[cfg(feature="coz")] + coz::end!("factorization"); + + return r; } #[cfg(test)] diff --git a/src/uu/factor/src/table.rs b/src/uu/factor/src/table.rs index d6ef796fc..6291b92c1 100644 --- a/src/uu/factor/src/table.rs +++ b/src/uu/factor/src/table.rs @@ -33,6 +33,8 @@ pub(crate) fn factor(mut num: u64, mut factors: Factors) -> (Factors, u64) { if x <= ceil { num = x; k += 1; + #[cfg(feature="coz")] + coz::progress!("factor found"); } else { if k > 0 { factors.add(prime, k); From 2593b3f2e19ef933a61adea59878a29c911373d2 Mon Sep 17 00:00:00 2001 From: Arijit Dey Date: Sat, 24 Apr 2021 22:32:03 +0530 Subject: [PATCH 0485/1135] Rewrite the cli usage function Add crossterm as dependency Complete the paging portion Fixed tests cp: extract linux COW logic into function cp: add --reflink support for macOS Fixes #1773 Fix error in Cargo.lock Quit automatically if not much output is left Remove unnecessary redox and windows specific code Handle line wrapping Put everything according to uutils coding standards Add support for multiple files Fix failing test Use the args argument to get cli arguments Fix bug where text is repeated multiple times during printing Add a little prompt Add a top file prompt for multiple files Change println in loops to stdout.write and setup terminal only once Fix bug where all lines were printed in a single row Remove useless file and fix failing test Fix another test --- Cargo.lock | 121 ++++++++++ Cargo.toml | 1 + src/uu/more/Cargo.toml | 1 + src/uu/more/src/more.rs | 469 ++++++++++++++++++++++++++++--------- tests/by-util/test_more.rs | 21 +- 5 files changed, 494 insertions(+), 119 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index abdf482ee..fa7a13a5f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -217,6 +217,7 @@ dependencies = [ name = "coreutils" version = "0.0.6" dependencies = [ + "atty", "conv", "filetime", "glob 0.3.0", @@ -507,6 +508,31 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "crossterm" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c36c10130df424b2f3552fcc2ddcd9b28a27b1e54b358b45874f88d1ca6888c" +dependencies = [ + "bitflags", + "crossterm_winapi", + "lazy_static", + "libc", + "mio", + "parking_lot", + "signal-hook", + "winapi 0.3.9", +] + +[[package]] +name = "crossterm_winapi" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0da8964ace4d3e4a044fd027919b2237000b24315a37c916f61809f1ff2140b9" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "csv" version = "1.1.6" @@ -732,6 +758,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" +[[package]] +name = "instant" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "ioctl-sys" version = "0.5.2" @@ -802,6 +837,15 @@ version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" +[[package]] +name = "lock_api" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3c91c24eae6777794bb1997ad98bbb87daf92890acab859f7eaa4320333176" +dependencies = [ + "scopeguard", +] + [[package]] name = "log" version = "0.4.14" @@ -862,6 +906,28 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mio" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e50ae3f04d169fcc9bde0b547d1c205219b7157e07ded9c5aff03e0637cb3ed7" +dependencies = [ + "libc", + "log", + "miow", + "ntapi", + "winapi 0.3.9", +] + +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "nix" version = "0.13.1" @@ -893,6 +959,15 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +[[package]] +name = "ntapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "num-integer" version = "0.1.44" @@ -977,6 +1052,31 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "parking_lot" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" +dependencies = [ + "cfg-if 1.0.0", + "instant", + "libc", + "redox_syscall 0.2.6", + "smallvec 1.6.1", + "winapi 0.3.9", +] + [[package]] name = "paste" version = "0.1.18" @@ -1417,6 +1517,26 @@ dependencies = [ "generic-array", ] +[[package]] +name = "signal-hook" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e31d442c16f047a671b5a71e2161d6e68814012b7f5379d269ebd915fac2729" +dependencies = [ + "libc", + "mio", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-registry" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6" +dependencies = [ + "libc", +] + [[package]] name = "smallvec" version = "0.6.14" @@ -2112,6 +2232,7 @@ name = "uu_more" version = "0.0.6" dependencies = [ "clap", + "crossterm", "nix 0.13.1", "redox_syscall 0.1.57", "redox_termios", diff --git a/Cargo.toml b/Cargo.toml index 7c1a771fd..fdac87d7a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -347,6 +347,7 @@ unindent = "0.1" uucore = { version=">=0.0.8", package="uucore", path="src/uucore", features=["entries"] } walkdir = "2.2" tempdir = "0.3" +atty = "*" [target.'cfg(unix)'.dev-dependencies] rust-users = { version="0.10", package="users" } diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index 1f4bfed68..c79216ae5 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -18,6 +18,7 @@ path = "src/more.rs" clap = "2.33" uucore = { version = ">=0.0.7", package = "uucore", path = "../../uucore" } uucore_procs = { version = ">=0.0.5", package = "uucore_procs", path = "../../uucore_procs" } +crossterm = ">=0.19" [target.'cfg(target_os = "redox")'.dependencies] redox_termios = "0.1" diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index eabdbee85..45fe3ed81 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -10,150 +10,395 @@ #[macro_use] extern crate uucore; -use std::fs::File; -use std::io::{stdin, stdout, BufRead, BufReader, Read, Write}; +use std::{ + convert::TryInto, + fs::File, + io::{stdin, stdout, BufReader, Read, Stdout, Write}, + path::Path, + time::Duration, +}; #[cfg(all(unix, not(target_os = "fuchsia")))] extern crate nix; -#[cfg(all(unix, not(target_os = "fuchsia")))] -use nix::sys::termios::{self, LocalFlags, SetArg}; -use uucore::InvalidEncodingHandling; -#[cfg(target_os = "redox")] -extern crate redox_termios; -#[cfg(target_os = "redox")] -extern crate syscall; +use clap::{App, Arg}; +use crossterm::{ + event::{self, Event, KeyCode, KeyEvent, KeyModifiers}, + execute, + style::Attribute, + terminal, +}; -use clap::{App, Arg, ArgMatches}; - -static VERSION: &str = env!("CARGO_PKG_VERSION"); -static ABOUT: &str = "A file perusal filter for CRT viewing."; - -mod options { - pub const FILE: &str = "file"; +pub mod options { + pub const SILENT: &str = "silent"; + pub const LOGICAL: &str = "logical"; + pub const NO_PAUSE: &str = "no-pause"; + pub const PRINT_OVER: &str = "print-over"; + pub const CLEAN_PRINT: &str = "clean-print"; + pub const SQUEEZE: &str = "squeeze"; + pub const PLAIN: &str = "plain"; + pub const LINES: &str = "lines"; + pub const NUMBER: &str = "number"; + pub const PATTERN: &str = "pattern"; + pub const FROM_LINE: &str = "from-line"; + pub const FILES: &str = "files"; } -fn get_usage() -> String { - format!("{} [options] ...", executable!()) -} +const MULTI_FILE_TOP_PROMPT: &str = "::::::::::::::\n{}\n::::::::::::::\n"; pub fn uumain(args: impl uucore::Args) -> i32 { - let usage = get_usage(); - let args = args - .collect_str(InvalidEncodingHandling::ConvertLossy) - .accept_any(); - let matches = App::new(executable!()) - .version(VERSION) - .usage(usage.as_str()) - .about(ABOUT) + .about("A file perusal filter for CRT viewing.") + .version(env!("CARGO_PKG_VERSION")) .arg( - Arg::with_name(options::FILE) - .number_of_values(1) - .multiple(true), + Arg::with_name(options::SILENT) + .short("d") + .long(options::SILENT) + .help("Display help instead of ringing bell"), + ) + .arg( + Arg::with_name(options::LOGICAL) + .short("f") + .long(options::LOGICAL) + .help("Count logical rather than screen lines"), + ) + .arg( + Arg::with_name(options::NO_PAUSE) + .short("l") + .long(options::NO_PAUSE) + .help("Suppress pause after form feed"), + ) + .arg( + Arg::with_name(options::PRINT_OVER) + .short("c") + .long(options::PRINT_OVER) + .help("Do not scroll, display text and clean line ends"), + ) + .arg( + Arg::with_name(options::CLEAN_PRINT) + .short("p") + .long(options::CLEAN_PRINT) + .help("Do not scroll, clean screen and display text"), + ) + .arg( + Arg::with_name(options::SQUEEZE) + .short("s") + .long(options::SQUEEZE) + .help("Squeeze multiple blank lines into one"), + ) + .arg( + Arg::with_name(options::PLAIN) + .short("u") + .long(options::PLAIN) + .help("Suppress underlining and bold"), + ) + .arg( + Arg::with_name(options::LINES) + .short("n") + .long(options::LINES) + .value_name("number") + .takes_value(true) + .help("The number of lines per screenful"), + ) + .arg( + Arg::with_name(options::NUMBER) + .allow_hyphen_values(true) + .long(options::NUMBER) + .required(false) + .takes_value(true) + .help("Same as --lines"), + ) + .arg( + Arg::with_name(options::FROM_LINE) + .short("F") + .allow_hyphen_values(true) + .required(false) + .takes_value(true) + .value_name("number") + .help("Display file beginning from line number"), + ) + .arg( + Arg::with_name(options::PATTERN) + .short("P") + .allow_hyphen_values(true) + .required(false) + .takes_value(true) + .help("Display file beginning from pattern match"), + ) + .arg( + Arg::with_name(options::FILES) + .required(false) + .multiple(true) + .help("Path to the files to be read"), ) .get_matches_from(args); + let mut buff = String::new(); + let mut stdout = setup_term(); - // FixME: fail without panic for now; but `more` should work with no arguments (ie, for piped input) - if let None | Some("-") = matches.value_of(options::FILE) { - show_usage_error!("Reading from stdin isn't supported yet."); - return 1; - } - - if let Some(x) = matches.value_of(options::FILE) { - let path = std::path::Path::new(x); - if path.is_dir() { - show_usage_error!("'{}' is a directory.", x); - return 1; + if let Some(filenames) = matches.values_of(options::FILES) { + let length = filenames.len(); + for (idx, fname) in filenames.clone().enumerate() { + if Path::new(fname).is_dir() { + show_usage_error!("'{}' is a directory.", fname); + return 1; + } + if filenames.len() > 1 { + buff.push_str(&MULTI_FILE_TOP_PROMPT.replace("{}", fname)); + } + let mut reader = BufReader::new(File::open(fname).unwrap()); + reader.read_to_string(&mut buff).unwrap(); + let last = idx + 1 == length; + more(&buff, &mut stdout, last); + buff.clear(); } + } else { + stdin().read_to_string(&mut buff).unwrap(); + more(&buff, &mut stdout, true); } - - more(matches); - 0 } -#[cfg(all(unix, not(target_os = "fuchsia")))] -fn setup_term() -> termios::Termios { - let mut term = termios::tcgetattr(0).unwrap(); - // Unset canonical mode, so we get characters immediately - term.local_flags.remove(LocalFlags::ICANON); - // Disable local echo - term.local_flags.remove(LocalFlags::ECHO); - termios::tcsetattr(0, SetArg::TCSADRAIN, &term).unwrap(); - term +#[cfg(not(target_os = "fuchsia"))] +fn setup_term() -> std::io::Stdout { + let mut stdout = stdout(); + terminal::enable_raw_mode().unwrap(); + // Change this to a queue if more commands are executed to avoid too many writes to the terminal + execute!(stdout, terminal::Clear(terminal::ClearType::All)).unwrap(); + stdout } -#[cfg(any(windows, target_os = "fuchsia"))] +#[cfg(target_os = "fuchsia")] #[inline(always)] fn setup_term() -> usize { 0 } -#[cfg(target_os = "redox")] -fn setup_term() -> redox_termios::Termios { - let mut term = redox_termios::Termios::default(); - let fd = syscall::dup(0, b"termios").unwrap(); - syscall::read(fd, &mut term).unwrap(); - term.local_flags &= !redox_termios::ICANON; - term.local_flags &= !redox_termios::ECHO; - syscall::write(fd, &term).unwrap(); - let _ = syscall::close(fd); - term +#[cfg(not(target_os = "fuchsia"))] +fn reset_term(stdout: &mut std::io::Stdout) { + terminal::disable_raw_mode().unwrap(); + // Clear the prompt + execute!(stdout, terminal::Clear(terminal::ClearType::CurrentLine)).unwrap(); + println!("\r"); } -#[cfg(all(unix, not(target_os = "fuchsia")))] -fn reset_term(term: &mut termios::Termios) { - term.local_flags.insert(LocalFlags::ICANON); - term.local_flags.insert(LocalFlags::ECHO); - termios::tcsetattr(0, SetArg::TCSADRAIN, &term).unwrap(); -} - -#[cfg(any(windows, target_os = "fuchsia"))] +#[cfg(target_os = "fuchsia")] #[inline(always)] fn reset_term(_: &mut usize) {} -#[cfg(any(target_os = "redox"))] -fn reset_term(term: &mut redox_termios::Termios) { - let fd = syscall::dup(0, b"termios").unwrap(); - syscall::read(fd, term).unwrap(); - term.local_flags |= redox_termios::ICANON; - term.local_flags |= redox_termios::ECHO; - syscall::write(fd, &term).unwrap(); - let _ = syscall::close(fd); -} +fn more(buff: &str, mut stdout: &mut Stdout, is_last: bool) { + let (cols, rows) = terminal::size().unwrap(); + let lines = break_buff(buff, usize::from(cols)); + let line_count: u16 = lines.len().try_into().unwrap(); -fn more(matches: ArgMatches) { - let mut f: Box = match matches.value_of(options::FILE) { - None | Some("-") => Box::new(BufReader::new(stdin())), - Some(filename) => Box::new(BufReader::new(File::open(filename).unwrap())), - }; - let mut buffer = [0; 1024]; - - let mut term = setup_term(); - - let mut end = false; - while let Ok(sz) = f.read(&mut buffer) { - if sz == 0 { - break; - } - stdout().write_all(&buffer[0..sz]).unwrap(); - for byte in std::io::stdin().bytes() { - match byte.unwrap() { - b' ' => break, - b'q' | 27 => { - end = true; - break; - } - _ => (), - } - } - - if end { - break; - } + // Print everything and quit if line count is less than the availale rows + if line_count < rows { + println!("{}", buff); + return; } - reset_term(&mut term); - println!(); + let mut upper_mark = 0; + // Number of lines left + let mut lines_left = line_count - (upper_mark + rows); + // Are we on the very last page and the next down arrow will return this function + let mut to_be_done = false; + draw( + &mut upper_mark, + rows, + &mut stdout, + lines.clone(), + line_count, + ); + + loop { + if event::poll(Duration::from_millis(10)).unwrap() { + match event::read().unwrap() { + Event::Key(KeyEvent { + code: KeyCode::Char('q'), + modifiers: KeyModifiers::NONE, + }) + | Event::Key(KeyEvent { + code: KeyCode::Char('c'), + modifiers: KeyModifiers::CONTROL, + }) => { + reset_term(&mut stdout); + std::process::exit(0); + } + Event::Key(KeyEvent { + code: KeyCode::Down, + modifiers: KeyModifiers::NONE, + }) + | Event::Key(KeyEvent { + code: KeyCode::Char(' '), + modifiers: KeyModifiers::NONE, + }) => { + // If this is the last page but some text + // is still left that does not require a page of its own + // then this event will print the left lines + if lines_left < rows && !to_be_done { + for l in lines.iter().skip((line_count - upper_mark - rows).into()) { + stdout.write_all(format!("\r{}\n", l).as_bytes()).unwrap(); + } + make_prompt_and_flush(&mut stdout, line_count, line_count); + // If this is not the last input file + // do not return, but the next down arrow must return + // because we have printed everyhing + if !is_last { + to_be_done = true; + } else { + // Else quit + reset_term(&mut stdout); + return; + } + // This handles the next arrow key to quit + } else if lines_left < rows && to_be_done { + return; + } else { + // Print a normal page + upper_mark = upper_mark.saturating_add(rows.saturating_sub(1)); + lines_left = line_count.saturating_sub(upper_mark + rows); + draw( + &mut upper_mark, + rows, + &mut stdout, + lines.clone(), + line_count, + ); + } + } + Event::Key(KeyEvent { + code: KeyCode::Up, + modifiers: KeyModifiers::NONE, + }) => { + upper_mark = upper_mark.saturating_sub(rows.saturating_sub(1)); + draw( + &mut upper_mark, + rows, + &mut stdout, + lines.clone(), + line_count, + ); + } + _ => continue, + } + } + } +} + +fn draw( + upper_mark: &mut u16, + rows: u16, + mut stdout: &mut std::io::Stdout, + lines: Vec, + lc: u16, +) { + execute!(stdout, terminal::Clear(terminal::ClearType::CurrentLine)).unwrap(); + let (up_mark, lower_mark) = calc_range(*upper_mark, rows, lc); + // Reduce the row by 1 for the prompt + let displayed_lines = lines + .iter() + .skip(up_mark.into()) + .take(usize::from(rows.saturating_sub(1))); + + for line in displayed_lines { + stdout + .write_all(format!("\r{}\n", line).as_bytes()) + .unwrap(); + } + make_prompt_and_flush(&mut stdout, lower_mark, lc); + *upper_mark = up_mark; +} + +// Break the lines on the cols of the terminal +fn break_buff(buff: &str, cols: usize) -> Vec { + let mut lines = Vec::new(); + + for l in buff.lines() { + lines.append(&mut break_line(l, cols)); + } + lines +} + +fn break_line(mut line: &str, cols: usize) -> Vec { + let breaks = (line.len() / cols).saturating_add(1); + let mut lines = Vec::with_capacity(breaks); + if line.len() < cols { + lines.push(line.to_string()); + return lines; + } + + for _ in 1..=breaks { + let (line1, line2) = line.split_at(cols); + lines.push(line1.to_string()); + if line2.len() < cols { + lines.push(line2.to_string()); + break; + } + line = line2; + } + lines +} + +// Calculate upper_mark based on certain parameters +fn calc_range(mut upper_mark: u16, rows: u16, line_count: u16) -> (u16, u16) { + let mut lower_mark = upper_mark.saturating_add(rows); + + if lower_mark >= line_count { + upper_mark = line_count.saturating_sub(rows); + lower_mark = line_count; + } else { + lower_mark = lower_mark.saturating_sub(1) + } + (upper_mark, lower_mark) +} + +// Make a prompt similar to original more +fn make_prompt_and_flush(stdout: &mut Stdout, lower_mark: u16, lc: u16) { + write!( + stdout, + "\r{}--More--({}%){}", + Attribute::Reverse, + ((lower_mark as f64 / lc as f64) * 100.0).round() as u16, + Attribute::Reset + ) + .unwrap(); + stdout.flush().unwrap(); +} + +#[cfg(test)] +mod tests { + use super::{break_line, calc_range}; + + // It is good to test the above functions + #[test] + fn test_calc_range() { + assert_eq!((0, 24), calc_range(0, 25, 100)); + assert_eq!((50, 74), calc_range(50, 25, 100)); + assert_eq!((75, 100), calc_range(85, 25, 100)); + } + #[test] + fn test_break_lines_long() { + let mut test_string = String::with_capacity(100); + for _ in 0..200 { + test_string.push('#'); + } + + let lines = break_line(&test_string, 80); + + assert_eq!( + (80, 80, 40), + (lines[0].len(), lines[1].len(), lines[2].len()) + ); + } + + #[test] + fn test_break_lines_short() { + let mut test_string = String::with_capacity(100); + for _ in 0..20 { + test_string.push('#'); + } + + let lines = break_line(&test_string, 80); + + assert_eq!(20, lines[0].len()); + } } diff --git a/tests/by-util/test_more.rs b/tests/by-util/test_more.rs index 9245733ca..cc778f0b4 100644 --- a/tests/by-util/test_more.rs +++ b/tests/by-util/test_more.rs @@ -2,15 +2,22 @@ use crate::common::util::*; #[test] fn test_more_no_arg() { - // stderr = more: Reading from stdin isn't supported yet. - new_ucmd!().fails(); + // Reading from stdin is now supported, so this must succeed + if atty::is(atty::Stream::Stdout) { + new_ucmd!().succeeds(); + } else {} } #[test] fn test_more_dir_arg() { - let result = new_ucmd!().arg(".").run(); - result.failure(); - const EXPECTED_ERROR_MESSAGE: &str = - "more: '.' is a directory.\nTry 'more --help' for more information."; - assert_eq!(result.stderr_str().trim(), EXPECTED_ERROR_MESSAGE); + // Run the test only if there's a valud terminal, else do nothing + // Maybe we could capture the error, i.e. "Device not found" in that case + // but I am leaving this for later + if atty::is(atty::Stream::Stdout) { + let result = new_ucmd!().arg(".").run(); + result.failure(); + const EXPECTED_ERROR_MESSAGE: &str = + "more: '.' is a directory.\nTry 'more --help' for more information."; + assert_eq!(result.stderr_str().trim(), EXPECTED_ERROR_MESSAGE); + } else {} } From 9f45431bf041053268bd4e76c10189432122a637 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 29 Apr 2021 18:02:06 +0200 Subject: [PATCH 0486/1135] sort: add some custom string comparisons This removes the need to allocate a new string for each line when used with -f, -d or -i. Instead, a custom string comparison algorithm takes care of these cases. The resulting performance improvement is about 20% per flag (i.e. there is a 60% improvement when combining all three flags) As a side-effect, the size of the Line struct was reduced from 96 to 80 bytes, reducing the overhead for each line. --- src/uu/sort/src/custom_str_cmp.rs | 64 +++++++++++++++++ src/uu/sort/src/sort.rs | 111 ++++++------------------------ 2 files changed, 86 insertions(+), 89 deletions(-) create mode 100644 src/uu/sort/src/custom_str_cmp.rs diff --git a/src/uu/sort/src/custom_str_cmp.rs b/src/uu/sort/src/custom_str_cmp.rs new file mode 100644 index 000000000..a087a9fc2 --- /dev/null +++ b/src/uu/sort/src/custom_str_cmp.rs @@ -0,0 +1,64 @@ +// * This file is part of the uutils coreutils package. +// * +// * (c) Michael Debertol +// * +// * For the full copyright and license information, please view the LICENSE +// * file that was distributed with this source code. + +//! Custom string comparisons. +//! +//! The goal is to compare strings without transforming them first (i.e. not allocating new strings) + +use std::cmp::Ordering; + +fn filter_char(c: char, ignore_non_printing: bool, ignore_non_dictionary: bool) -> bool { + if ignore_non_dictionary && !(c.is_ascii_alphanumeric() || c.is_ascii_whitespace()) { + return false; + } + if ignore_non_printing && (c.is_ascii_control() || !c.is_ascii()) { + return false; + } + true +} + +fn cmp_chars(a: char, b: char, ignore_case: bool) -> Ordering { + if ignore_case { + a.to_ascii_uppercase().cmp(&b.to_ascii_uppercase()) + } else { + a.cmp(&b) + } +} + +pub fn custom_str_cmp( + a: &str, + b: &str, + ignore_non_printing: bool, + ignore_non_dictionary: bool, + ignore_case: bool, +) -> Ordering { + if !(ignore_case || ignore_non_dictionary || ignore_non_printing) { + // There are no custom settings. Fall back to the default strcmp, which is faster. + return a.cmp(&b); + } + let mut a_chars = a + .chars() + .filter(|&c| filter_char(c, ignore_non_printing, ignore_non_dictionary)); + let mut b_chars = b + .chars() + .filter(|&c| filter_char(c, ignore_non_printing, ignore_non_dictionary)); + loop { + let a_char = a_chars.next(); + let b_char = b_chars.next(); + match (a_char, b_char) { + (None, None) => return Ordering::Equal, + (Some(_), None) => return Ordering::Greater, + (None, Some(_)) => return Ordering::Less, + (Some(a_char), Some(b_char)) => { + let ordering = cmp_chars(a_char, b_char, ignore_case); + if ordering != Ordering::Equal { + return ordering; + } + } + } + } +} diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 18d9304fa..a18850e9d 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -15,10 +15,12 @@ #[macro_use] extern crate uucore; +mod custom_str_cmp; mod external_sort; mod numeric_str_cmp; use clap::{App, Arg}; +use custom_str_cmp::custom_str_cmp; use external_sort::{ExternalSorter, ExternallySortable}; use fnv::FnvHasher; use itertools::Itertools; @@ -206,33 +208,23 @@ impl From<&GlobalSettings> for KeySettings { #[derive(Debug, Serialize, Deserialize, Clone)] /// Represents the string selected by a FieldSelector. -enum SelectionRange { - /// If we had to transform this selection, we have to store a new string. - String(String), - /// If there was no transformation, we can store an index into the line. - ByIndex(Range), +struct SelectionRange { + range: Range, } impl SelectionRange { + fn new(range: Range) -> Self { + Self { range } + } + /// Gets the actual string slice represented by this Selection. - fn get_str<'a>(&'a self, line: &'a str) -> &'a str { - match self { - SelectionRange::String(string) => string.as_str(), - SelectionRange::ByIndex(range) => &line[range.to_owned()], - } + fn get_str<'a>(&self, line: &'a str) -> &'a str { + &line[self.range.to_owned()] } fn shorten(&mut self, new_range: Range) { - match self { - SelectionRange::String(string) => { - string.drain(new_range.end..); - string.drain(..new_range.start); - } - SelectionRange::ByIndex(range) => { - range.end = range.start + new_range.end; - range.start += new_range.start; - } - } + self.range.end = self.range.start + new_range.end; + self.range.start += new_range.start; } } @@ -303,14 +295,8 @@ impl Line { .selectors .iter() .map(|selector| { - let range = selector.get_selection(&line, fields.as_deref()); - let mut range = if let Some(transformed) = - transform(&line[range.to_owned()], &selector.settings) - { - SelectionRange::String(transformed) - } else { - SelectionRange::ByIndex(range) - }; + let mut range = + SelectionRange::new(selector.get_selection(&line, fields.as_deref())); let num_cache = if selector.settings.mode == SortMode::Numeric || selector.settings.mode == SortMode::HumanNumeric { @@ -460,34 +446,6 @@ impl Line { } } -/// Transform this line. Returns None if there's no need to transform. -fn transform(line: &str, settings: &KeySettings) -> Option { - let mut transformed = None; - if settings.ignore_case { - transformed = Some(line.to_uppercase()); - } - if settings.ignore_blanks { - transformed = Some( - transformed - .as_deref() - .unwrap_or(line) - .trim_start() - .to_string(), - ); - } - if settings.dictionary_order { - transformed = Some(remove_nondictionary_chars( - transformed.as_deref().unwrap_or(line), - )); - } - if settings.ignore_non_printing { - transformed = Some(remove_nonprinting_chars( - transformed.as_deref().unwrap_or(line), - )); - } - transformed -} - /// Tokenize a line into fields. fn tokenize(line: &str, separator: Option) -> Vec { if let Some(separator) = separator { @@ -1301,7 +1259,13 @@ fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering ), SortMode::Month => month_compare(a_str, b_str), SortMode::Version => version_compare(a_str, b_str), - SortMode::Default => default_compare(a_str, b_str), + SortMode::Default => custom_str_cmp( + a_str, + b_str, + settings.ignore_non_printing, + settings.dictionary_order, + settings.ignore_case, + ), } }; if cmp != Ordering::Equal { @@ -1313,7 +1277,7 @@ fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering let cmp = if global_settings.random || global_settings.stable || global_settings.unique { Ordering::Equal } else { - default_compare(&a.line, &b.line) + a.line.cmp(&b.line) }; if global_settings.reverse { @@ -1323,13 +1287,6 @@ fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering } } -// Test output against BSDs and GNU with their locale -// env var set to lc_ctype=utf-8 to enjoy the exact same output. -#[inline(always)] -fn default_compare(a: &str, b: &str) -> Ordering { - a.cmp(b) -} - // This function cleans up the initial comparison done by leading_num_common for a general numeric compare. // In contrast to numeric compare, GNU general numeric/FP sort *should* recognize positive signs and // scientific notation, so we strip those lines only after the end of the following numeric string. @@ -1516,22 +1473,6 @@ fn version_compare(a: &str, b: &str) -> Ordering { } } -fn remove_nondictionary_chars(s: &str) -> String { - // According to GNU, dictionary chars are those of ASCII - // and a blank is a space or a tab - s.chars() - .filter(|c| c.is_ascii_alphanumeric() || c.is_ascii_whitespace()) - .collect::() -} - -fn remove_nonprinting_chars(s: &str) -> String { - // However, GNU says nonprinting chars are more permissive. - // All of ASCII except control chars ie, escape, newline - s.chars() - .filter(|c| c.is_ascii() && !c.is_ascii_control()) - .collect::() -} - fn print_sorted>(iter: T, settings: &GlobalSettings) { let mut file: Box = match settings.outfile { Some(ref filename) => match File::create(Path::new(&filename)) { @@ -1598,14 +1539,6 @@ mod tests { assert_eq!(Ordering::Equal, random_shuffle(a, b, c)); } - #[test] - fn test_default_compare() { - let a = "your own"; - let b = "your place"; - - assert_eq!(Ordering::Less, default_compare(a, b)); - } - #[test] fn test_month_compare() { let a = "JaN"; From a4813c26468963b7053de57fcddb0c95fa5b23fa Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 29 Apr 2021 18:03:00 +0200 Subject: [PATCH 0487/1135] sort: actually use the f64 cache This was probably reverted accidentally. --- src/uu/sort/src/sort.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index a18850e9d..6768c82c1 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1254,8 +1254,8 @@ fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering (b_str, b_selection.num_cache.as_num_info()), ), SortMode::GeneralNumeric => general_numeric_compare( - general_f64_parse(&a_str[get_leading_gen(a_str)]), - general_f64_parse(&b_str[get_leading_gen(b_str)]), + a_selection.num_cache.as_f64(), + b_selection.num_cache.as_f64(), ), SortMode::Month => month_compare(a_str, b_str), SortMode::Version => version_compare(a_str, b_str), From fecbf3dc856a37db6cf8d7a7a4ca15953b6b3f9d Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 29 Apr 2021 18:03:12 +0200 Subject: [PATCH 0488/1135] sort: remove an unneeded clone() --- src/uu/sort/src/sort.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 6768c82c1..c82524796 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1222,7 +1222,7 @@ fn ext_sort_by(unsorted: Vec, settings: GlobalSettings) -> Vec { settings.clone(), ); let iter = external_sorter - .sort_by(unsorted.into_iter(), settings.clone()) + .sort_by(unsorted.into_iter(), settings) .unwrap() .map(|x| x.unwrap()) .collect::>(); From c69afa00ffcd5721b7bcbaa452495f8b8e673007 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 29 Apr 2021 18:25:34 +0200 Subject: [PATCH 0489/1135] ls: implement device symbol and id --- src/uu/ls/src/ls.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index d78e1977a..777f16e7f 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1623,10 +1623,18 @@ fn format_prefixed(prefixed: NumberPrefix) -> String { fn display_file_size(metadata: &Metadata, config: &Config) -> String { // NOTE: The human-readable behaviour deviates from the GNU ls. // The GNU ls uses binary prefixes by default. - match config.size_format { - SizeFormat::Binary => format_prefixed(NumberPrefix::binary(metadata.len() as f64)), - SizeFormat::Decimal => format_prefixed(NumberPrefix::decimal(metadata.len() as f64)), - SizeFormat::Bytes => metadata.len().to_string(), + let ft = metadata.file_type(); + if ft.is_char_device() || ft.is_block_device() { + let dev: u64 = metadata.rdev(); + let major = (dev >> 8) as u8; + let minor = dev as u8; + return format!("{}, {}", major, minor); + } else { + match config.size_format { + SizeFormat::Binary => format_prefixed(NumberPrefix::binary(metadata.len() as f64)), + SizeFormat::Decimal => format_prefixed(NumberPrefix::decimal(metadata.len() as f64)), + SizeFormat::Bytes => metadata.len().to_string(), + } } } @@ -1635,6 +1643,10 @@ fn display_file_type(file_type: FileType) -> char { 'd' } else if file_type.is_symlink() { 'l' + } else if file_type.is_block_device() { + 'b' + } else if file_type.is_char_device() { + 'c' } else { '-' } From d6248279133a001f66d6c2138a0ffbbb8f3f36fb Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 29 Apr 2021 18:44:46 +0200 Subject: [PATCH 0490/1135] ls: fix windows and add more file types --- src/uu/ls/src/ls.rs | 48 ++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 777f16e7f..adfc654ba 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1621,20 +1621,23 @@ fn format_prefixed(prefixed: NumberPrefix) -> String { } fn display_file_size(metadata: &Metadata, config: &Config) -> String { + #[cfg(unix)] + { + let ft = metadata.file_type(); + if ft.is_char_device() || ft.is_block_device() { + let dev: u64 = metadata.rdev(); + let major = (dev >> 8) as u8; + let minor = dev as u8; + return format!("{}, {}", major, minor); + } + } + // NOTE: The human-readable behaviour deviates from the GNU ls. // The GNU ls uses binary prefixes by default. - let ft = metadata.file_type(); - if ft.is_char_device() || ft.is_block_device() { - let dev: u64 = metadata.rdev(); - let major = (dev >> 8) as u8; - let minor = dev as u8; - return format!("{}, {}", major, minor); - } else { - match config.size_format { - SizeFormat::Binary => format_prefixed(NumberPrefix::binary(metadata.len() as f64)), - SizeFormat::Decimal => format_prefixed(NumberPrefix::decimal(metadata.len() as f64)), - SizeFormat::Bytes => metadata.len().to_string(), - } + match config.size_format { + SizeFormat::Binary => format_prefixed(NumberPrefix::binary(metadata.len() as f64)), + SizeFormat::Decimal => format_prefixed(NumberPrefix::decimal(metadata.len() as f64)), + SizeFormat::Bytes => metadata.len().to_string(), } } @@ -1643,11 +1646,24 @@ fn display_file_type(file_type: FileType) -> char { 'd' } else if file_type.is_symlink() { 'l' - } else if file_type.is_block_device() { - 'b' - } else if file_type.is_char_device() { - 'c' } else { + #[cfg(unix)] + { + if file_type.is_block_device() { + 'b' + } else if file_type.is_char_device() { + 'c' + } else if file_type.is_fifo() { + 'p' + } else if file_type.is_socket() { + 's' + } else if file_type.is_file() { + '-' + } else { + '?' + } + } + #[cfg(not(unix))] '-' } } From d300895d28127befcc1f2922acba1b9279bc0f93 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 29 Apr 2021 22:23:04 +0200 Subject: [PATCH 0491/1135] ls: add birth time for windows and attampt to fix test --- src/uu/ls/src/ls.rs | 1 + tests/by-util/test_ls.rs | 12 +++--------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index d78e1977a..dc7ea4c08 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1559,6 +1559,7 @@ fn get_system_time(md: &Metadata, config: &Config) -> Option { match config.time { Time::Modification => md.modified().ok(), Time::Access => md.accessed().ok(), + Time::Birth => md.created().ok(), _ => None, } } diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index eeb7a6248..cfcbf9fd1 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -559,8 +559,6 @@ fn test_ls_long_ctime() { } #[test] -#[cfg(not(windows))] -// This test is currently failing on windows fn test_ls_order_birthtime() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; @@ -570,15 +568,11 @@ fn test_ls_order_birthtime() { After creating the first file try to sync it. This ensures the file gets created immediately instead of being saved inside the OS's IO operation buffer. - Without this, both files might accidentally be created at the same time, - even though we placed a timeout between creating the two. - - https://github.com/uutils/coreutils/pull/1986/#issuecomment-828490651 + Without this, both files might accidentally be created at the same time. */ at.make_file("test-birthtime-1").sync_all().unwrap(); - std::thread::sleep(std::time::Duration::from_millis(1)); - at.make_file("test-birthtime-2"); - at.touch("test-birthtime-1"); + at.make_file("test-birthtime-2").sync_all().unwrap(); + at.open("test-birthtime-1"); let result = scene.ucmd().arg("--time=birth").arg("-t").run(); From 45dd9d4e963c23ef0dce7f120ba43f80f14d2399 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 30 Apr 2021 20:19:43 +0200 Subject: [PATCH 0492/1135] tr/dirname: fix clap short_alias --- src/uu/dirname/src/dirname.rs | 33 +++++++++++++++++++-------------- src/uu/tr/src/tr.rs | 34 +++++++++++++++++++++++----------- tests/by-util/test_dirname.rs | 15 +++++++++++++++ tests/by-util/test_tr.rs | 14 ++++++++++++++ 4 files changed, 71 insertions(+), 25 deletions(-) diff --git a/src/uu/dirname/src/dirname.rs b/src/uu/dirname/src/dirname.rs index 5937f16ca..63693c982 100644 --- a/src/uu/dirname/src/dirname.rs +++ b/src/uu/dirname/src/dirname.rs @@ -12,37 +12,42 @@ use clap::{App, Arg}; use std::path::Path; use uucore::InvalidEncodingHandling; -static NAME: &str = "dirname"; -static SYNTAX: &str = "[OPTION] NAME..."; -static SUMMARY: &str = "strip last component from file name"; +static ABOUT: &str = "strip last component from file name"; static VERSION: &str = env!("CARGO_PKG_VERSION"); -static LONG_HELP: &str = " - Output each NAME with its last non-slash component and trailing slashes - removed; if NAME contains no /'s, output '.' (meaning the current - directory). -"; mod options { pub const ZERO: &str = "zero"; pub const DIR: &str = "dir"; } +fn get_usage() -> String { + format!("{0} [OPTION] NAME...", executable!()) +} + +fn get_long_usage() -> String { + String::from( + "Output each NAME with its last non-slash component and trailing slashes + removed; if NAME contains no /'s, output '.' (meaning the current directory).", + ) +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); + let usage = get_usage(); + let after_help = get_long_usage(); + let matches = App::new(executable!()) - .name(NAME) - .usage(SYNTAX) - .about(SUMMARY) - .after_help(LONG_HELP) + .about(ABOUT) + .usage(&usage[..]) + .after_help(&after_help[..]) .version(VERSION) .arg( Arg::with_name(options::ZERO) - .short(options::ZERO) + .long(options::ZERO) .short("z") - .takes_value(false) .help("separate output with NUL rather than newline"), ) .arg(Arg::with_name(options::DIR).hidden(true).multiple(true)) diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index 6c1c0746a..706151c35 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -23,11 +23,9 @@ use std::io::{stdin, stdout, BufRead, BufWriter, Write}; use crate::expand::ExpandSet; use uucore::InvalidEncodingHandling; -static NAME: &str = "tr"; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "translate or delete characters"; -static LONG_HELP: &str = "Translate, squeeze, and/or delete characters from standard input, -writing to standard output."; + const BUFFER_LEN: usize = 1024; mod options { @@ -186,24 +184,38 @@ fn get_usage() -> String { format!("{} [OPTION]... SET1 [SET2]", executable!()) } +fn get_long_usage() -> String { + String::from( + "Translate, squeeze, and/or delete characters from standard input, +writing to standard output.", + ) +} + pub fn uumain(args: impl uucore::Args) -> i32 { - let usage = get_usage(); let args = args .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); + let usage = get_usage(); + let after_help = get_long_usage(); + let matches = App::new(executable!()) .version(VERSION) .about(ABOUT) .usage(&usage[..]) - .after_help(LONG_HELP) + .after_help(&after_help[..]) .arg( Arg::with_name(options::COMPLEMENT) - .short("C") + // .visible_short_alias('C') // TODO: requires clap "3.0.0-beta.2" .short("c") .long(options::COMPLEMENT) .help("use the complement of SET1"), ) + .arg( + Arg::with_name("C") // work around for `Arg::visible_short_alias` + .short("C") + .help("same as -c"), + ) .arg( Arg::with_name(options::DELETE) .short("d") @@ -216,8 +228,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .short("s") .help( "replace each sequence of a repeated character that is - listed in the last specified SET, with a single occurrence - of that character", + listed in the last specified SET, with a single occurrence + of that character", ), ) .arg( @@ -230,7 +242,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .get_matches_from(args); let delete_flag = matches.is_present(options::DELETE); - let complement_flag = matches.is_present(options::COMPLEMENT); + let complement_flag = matches.is_present(options::COMPLEMENT) || matches.is_present("C"); let squeeze_flag = matches.is_present(options::SQUEEZE); let truncate_flag = matches.is_present(options::TRUNCATE); @@ -242,7 +254,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if sets.is_empty() { show_error!( "missing operand\nTry `{} --help` for more information.", - NAME + executable!() ); return 1; } @@ -251,7 +263,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { show_error!( "missing operand after ‘{}’\nTry `{} --help` for more information.", sets[0], - NAME + executable!() ); return 1; } diff --git a/tests/by-util/test_dirname.rs b/tests/by-util/test_dirname.rs index bcb4378d6..026ac22bb 100644 --- a/tests/by-util/test_dirname.rs +++ b/tests/by-util/test_dirname.rs @@ -16,6 +16,21 @@ fn test_path_without_trailing_slashes() { .stdout_is("/root/alpha/beta/gamma/delta/epsilon\n"); } +#[test] +fn test_path_without_trailing_slashes_and_zero() { + new_ucmd!() + .arg("-z") + .arg("/root/alpha/beta/gamma/delta/epsilon/omega") + .succeeds() + .stdout_is("/root/alpha/beta/gamma/delta/epsilon\u{0}"); + + new_ucmd!() + .arg("--zero") + .arg("/root/alpha/beta/gamma/delta/epsilon/omega") + .succeeds() + .stdout_is("/root/alpha/beta/gamma/delta/epsilon\u{0}"); +} + #[test] fn test_root() { new_ucmd!().arg("/").run().stdout_is("/\n"); diff --git a/tests/by-util/test_tr.rs b/tests/by-util/test_tr.rs index 630c305c6..995fb6533 100644 --- a/tests/by-util/test_tr.rs +++ b/tests/by-util/test_tr.rs @@ -45,6 +45,20 @@ fn test_delete_complement() { .stdout_is("ac"); } +#[test] +fn test_delete_complement_2() { + new_ucmd!() + .args(&["-d", "-C", "0-9"]) + .pipe_in("Phone: 01234 567890") + .succeeds() + .stdout_is("01234567890"); + new_ucmd!() + .args(&["-d", "--complement", "0-9"]) + .pipe_in("Phone: 01234 567890") + .succeeds() + .stdout_is("01234567890"); +} + #[test] fn test_squeeze() { new_ucmd!() From 798a03331170766b0f83e8de8ad451b67bd6ca94 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 30 Apr 2021 15:23:54 +0200 Subject: [PATCH 0493/1135] pinky: move from getopts to clap (#2123) --- src/uu/pinky/Cargo.toml | 1 + src/uu/pinky/src/pinky.rs | 164 ++++++++++++++++++++++-------------- tests/by-util/test_pinky.rs | 30 +++++++ 3 files changed, 132 insertions(+), 63 deletions(-) diff --git a/src/uu/pinky/Cargo.toml b/src/uu/pinky/Cargo.toml index 3f4a75241..a3c36259a 100644 --- a/src/uu/pinky/Cargo.toml +++ b/src/uu/pinky/Cargo.toml @@ -17,6 +17,7 @@ path = "src/pinky.rs" [dependencies] uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["utmpx", "entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +clap = "2.33.3" [[bin]] name = "pinky" diff --git a/src/uu/pinky/src/pinky.rs b/src/uu/pinky/src/pinky.rs index a02096bc8..e116a2382 100644 --- a/src/uu/pinky/src/pinky.rs +++ b/src/uu/pinky/src/pinky.rs @@ -19,67 +19,110 @@ use std::io::BufReader; use std::fs::File; use std::os::unix::fs::MetadataExt; +use clap::{App, Arg}; use std::path::PathBuf; use uucore::InvalidEncodingHandling; -static SYNTAX: &str = "[OPTION]... [USER]..."; -static SUMMARY: &str = "A lightweight 'finger' program; print user information."; - const BUFSIZE: usize = 1024; +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "pinky - lightweight finger"; + +mod options { + pub const LONG_FORMAT: &str = "long_format"; + pub const OMIT_HOME_DIR: &str = "omit_home_dir"; + pub const OMIT_PROJECT_FILE: &str = "omit_project_file"; + pub const OMIT_PLAN_FILE: &str = "omit_plan_file"; + pub const SHORT_FORMAT: &str = "short_format"; + pub const OMIT_HEADINGS: &str = "omit_headings"; + pub const OMIT_NAME: &str = "omit_name"; + pub const OMIT_NAME_HOST: &str = "omit_name_host"; + pub const OMIT_NAME_HOST_TIME: &str = "omit_name_host_time"; + pub const USER: &str = "user"; +} + +fn get_usage() -> String { + format!("{0} [OPTION]... [USER]...", executable!()) +} + +fn get_long_usage() -> String { + format!( + "A lightweight 'finger' program; print user information.\n\ + The utmp file will be {}.", + utmpx::DEFAULT_FILE + ) +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args .collect_str(InvalidEncodingHandling::Ignore) .accept_any(); - let long_help = &format!( - " - -l produce long format output for the specified USERs - -b omit the user's home directory and shell in long format - -h omit the user's project file in long format - -p omit the user's plan file in long format - -s do short format output, this is the default - -f omit the line of column headings in short format - -w omit the user's full name in short format - -i omit the user's full name and remote host in short format - -q omit the user's full name, remote host and idle time - in short format - --help display this help and exit - --version output version information and exit + let usage = get_usage(); + let after_help = get_long_usage(); -The utmp file will be {}", - utmpx::DEFAULT_FILE - ); - let mut opts = app!(SYNTAX, SUMMARY, &long_help); - opts.optflag( - "l", - "", - "produce long format output for the specified USERs", - ); - opts.optflag( - "b", - "", - "omit the user's home directory and shell in long format", - ); - opts.optflag("h", "", "omit the user's project file in long format"); - opts.optflag("p", "", "omit the user's plan file in long format"); - opts.optflag("s", "", "do short format output, this is the default"); - opts.optflag("f", "", "omit the line of column headings in short format"); - opts.optflag("w", "", "omit the user's full name in short format"); - opts.optflag( - "i", - "", - "omit the user's full name and remote host in short format", - ); - opts.optflag( - "q", - "", - "omit the user's full name, remote host and idle time in short format", - ); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(&after_help[..]) + .arg( + Arg::with_name(options::LONG_FORMAT) + .short("l") + .requires(options::USER) + .help("produce long format output for the specified USERs"), + ) + .arg( + Arg::with_name(options::OMIT_HOME_DIR) + .short("b") + .help("omit the user's home directory and shell in long format"), + ) + .arg( + Arg::with_name(options::OMIT_PROJECT_FILE) + .short("h") + .help("omit the user's project file in long format"), + ) + .arg( + Arg::with_name(options::OMIT_PLAN_FILE) + .short("p") + .help("omit the user's plan file in long format"), + ) + .arg( + Arg::with_name(options::SHORT_FORMAT) + .short("s") + .help("do short format output, this is the default"), + ) + .arg( + Arg::with_name(options::OMIT_HEADINGS) + .short("f") + .help("omit the line of column headings in short format"), + ) + .arg( + Arg::with_name(options::OMIT_NAME) + .short("w") + .help("omit the user's full name in short format"), + ) + .arg( + Arg::with_name(options::OMIT_NAME_HOST) + .short("i") + .help("omit the user's full name and remote host in short format"), + ) + .arg( + Arg::with_name(options::OMIT_NAME_HOST_TIME) + .short("q") + .help("omit the user's full name, remote host and idle time in short format"), + ) + .arg( + Arg::with_name(options::USER) + .takes_value(true) + .multiple(true), + ) + .get_matches_from(args); - let matches = opts.parse(args); + let users: Vec = matches + .values_of(options::USER) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); // If true, display the hours:minutes since each user has touched // the keyboard, or blank if within the last minute, or days followed @@ -87,45 +130,40 @@ The utmp file will be {}", let mut include_idle = true; // If true, display a line at the top describing each field. - let include_heading = !matches.opt_present("f"); + let include_heading = !matches.is_present(options::OMIT_HEADINGS); // if true, display the user's full name from pw_gecos. let mut include_fullname = true; // if true, display the user's ~/.project file when doing long format. - let include_project = !matches.opt_present("h"); + let include_project = !matches.is_present(options::OMIT_PROJECT_FILE); // if true, display the user's ~/.plan file when doing long format. - let include_plan = !matches.opt_present("p"); + let include_plan = !matches.is_present(options::OMIT_PLAN_FILE); // if true, display the user's home directory and shell // when doing long format. - let include_home_and_shell = !matches.opt_present("b"); + let include_home_and_shell = !matches.is_present(options::OMIT_HOME_DIR); // if true, use the "short" output format. - let do_short_format = !matches.opt_present("l"); + let do_short_format = !matches.is_present(options::LONG_FORMAT); /* if true, display the ut_host field. */ let mut include_where = true; - if matches.opt_present("w") { + if matches.is_present(options::OMIT_NAME) { include_fullname = false; } - if matches.opt_present("i") { + if matches.is_present(options::OMIT_NAME_HOST) { include_fullname = false; include_where = false; } - if matches.opt_present("q") { + if matches.is_present(options::OMIT_NAME_HOST_TIME) { include_fullname = false; include_idle = false; include_where = false; } - if !do_short_format && matches.free.is_empty() { - show_usage_error!("no username specified; at least one must be specified when using -l"); - return 1; - } - let pk = Pinky { include_idle, include_heading, @@ -134,7 +172,7 @@ The utmp file will be {}", include_plan, include_home_and_shell, include_where, - names: matches.free, + names: users, }; if do_short_format { diff --git a/tests/by-util/test_pinky.rs b/tests/by-util/test_pinky.rs index 7a4a3f3df..1a7ef8b61 100644 --- a/tests/by-util/test_pinky.rs +++ b/tests/by-util/test_pinky.rs @@ -34,6 +34,36 @@ fn test_long_format() { )); } +#[cfg(target_os = "linux")] +#[test] +fn test_long_format_multiple_users() { + let scene = TestScenario::new(util_name!()); + + let expected = scene + .cmd_keepenv(util_name!()) + .env("LANGUAGE", "C") + .arg("-l") + .arg("root") + .arg("root") + .arg("root") + .succeeds(); + + scene + .ucmd() + .arg("-l") + .arg("root") + .arg("root") + .arg("root") + .succeeds() + .stdout_is(expected.stdout_str()); +} + +#[test] +fn test_long_format_wo_user() { + // "no username specified; at least one must be specified when using -l" + new_ucmd!().arg("-l").fails().code_is(1); +} + #[cfg(target_os = "linux")] #[test] fn test_short_format_i() { From 0f3bc237393adef485182656b0edc986575c592d Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Thu, 29 Apr 2021 23:13:20 -0400 Subject: [PATCH 0494/1135] tr: implement translate and squeeze (-s) mode Add translate and squeeze mode to the `tr` program. For example: $ printf xx | tr -s x y y Fixes #2141. --- src/uu/tr/src/tr.rs | 54 ++++++++++++++++++++++++++++++++++++++-- tests/by-util/test_tr.rs | 18 ++++++++++++++ 2 files changed, 70 insertions(+), 2 deletions(-) diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index 6c1c0746a..09c4304a5 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -278,8 +278,58 @@ pub fn uumain(args: impl uucore::Args) -> i32 { translate_input(&mut locked_stdin, &mut buffered_stdout, op); } } else if squeeze_flag { - let op = SqueezeOperation::new(set1, complement_flag); - translate_input(&mut locked_stdin, &mut buffered_stdout, op); + if sets.len() < 2 { + let op = SqueezeOperation::new(set1, complement_flag); + translate_input(&mut locked_stdin, &mut buffered_stdout, op); + } else { + // Define a closure that computes the translation using a hash map. + // + // The `unwrap()` should never panic because the + // `TranslateOperation.translate()` method always returns + // `Some`. + let mut set2 = ExpandSet::new(sets[1].as_ref()); + let translator = TranslateOperation::new(set1, &mut set2, truncate_flag); + let translate = |c| translator.translate(c, 0 as char).unwrap(); + + // Prepare some variables to be used for the closure that + // computes the squeeze operation. + // + // The `squeeze()` closure needs to be defined anew for + // each line of input, but these variables do not change + // while reading the input so they can be defined before + // the `while` loop. + let set2 = ExpandSet::new(sets[1].as_ref()); + let squeezer = SqueezeOperation::new(set2, complement_flag); + + // Prepare some memory to read each line of the input (`buf`) and to write + let mut buf = String::with_capacity(BUFFER_LEN + 4); + + // Loop over each line of stdin. + while let Ok(length) = locked_stdin.read_line(&mut buf) { + if length == 0 { + break; + } + + // Define a closure that computes the squeeze operation. + // + // We keep track of the previously seen character on + // each call to `squeeze()`, but we need to reset the + // `prev_c` variable at the beginning of each line of + // the input. That's why we define the closure inside + // the `while` loop. + let mut prev_c = 0 as char; + let squeeze = |c| { + let result = squeezer.translate(c, prev_c); + prev_c = c; + result + }; + + // First translate, then squeeze each character of the input line. + let filtered: String = buf.chars().map(translate).filter_map(squeeze).collect(); + buf.clear(); + buffered_stdout.write_all(filtered.as_bytes()).unwrap(); + } + } } else { let mut set2 = ExpandSet::new(sets[1].as_ref()); let op = TranslateOperation::new(set1, &mut set2, truncate_flag); diff --git a/tests/by-util/test_tr.rs b/tests/by-util/test_tr.rs index 630c305c6..5d044a187 100644 --- a/tests/by-util/test_tr.rs +++ b/tests/by-util/test_tr.rs @@ -63,6 +63,24 @@ fn test_squeeze_complement() { .stdout_is("aaBcDcc"); } +#[test] +fn test_translate_and_squeeze() { + new_ucmd!() + .args(&["-s", "x", "y"]) + .pipe_in("xx") + .run() + .stdout_is("y"); +} + +#[test] +fn test_translate_and_squeeze_multiple_lines() { + new_ucmd!() + .args(&["-s", "x", "y"]) + .pipe_in("xxaax\nxaaxx") + .run() + .stdout_is("yaay\nyaay"); +} + #[test] fn test_delete_and_squeeze() { new_ucmd!() From 59ea28628bce74b5c17ea9d3462c27f82f5e5e84 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 1 May 2021 13:11:41 +0200 Subject: [PATCH 0495/1135] printf: remove useless declaration --- .../printf/src/tokenize/num_format/formatters/base_conv/mod.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs b/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs index 82971df3e..7d1d805c6 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs @@ -158,7 +158,6 @@ pub fn base_conv_float(src: &[u8], radix_src: u8, _radix_dest: u8) -> f64 { // to implement this for arbitrary string input. // until then, the below operates as an outline // of how it would work. - let result: Vec = vec![0]; let mut factor: f64 = 1_f64; let radix_src_float: f64 = f64::from(radix_src); let mut r: f64 = 0_f64; From 66930186319c6c0a502e8aad80383313ebb6cbc3 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 1 May 2021 13:12:00 +0200 Subject: [PATCH 0496/1135] refresh cargo.lock with recent updates --- Cargo.lock | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 31787e626..33d599762 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,11 +12,11 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.15" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" dependencies = [ - "memchr 2.3.4", + "memchr 2.4.0", ] [[package]] @@ -111,7 +111,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" dependencies = [ "lazy_static", - "memchr 2.3.4", + "memchr 2.4.0", "regex-automata", "serde", ] @@ -495,9 +495,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" +checksum = "52fb27eab85b17fbb9f6fd667089e07d6a2eb8743d02639ee7f6a7a7729c9c94" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -508,9 +508,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" +checksum = "4feb231f0d4d6af81aed15928e58ecf5816aa62a2393e2c82f46973e92a9a278" dependencies = [ "autocfg", "cfg-if 1.0.0", @@ -536,7 +536,7 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" dependencies = [ - "memchr 2.3.4", + "memchr 2.4.0", ] [[package]] @@ -868,9 +868,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.3.4" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" [[package]] name = "memoffset" @@ -1089,7 +1089,7 @@ version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" dependencies = [ - "unicode-xid 0.2.1", + "unicode-xid 0.2.2", ] [[package]] @@ -1277,12 +1277,12 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.6" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a26af418b574bd56588335b3a3659a65725d4e636eb1016c2f9e3b38c7cc759" +checksum = "a068b905b8cb93815aa3069ae48653d90f382308aebd1d33d940ac1f1d771e2d" dependencies = [ "aho-corasick", - "memchr 2.3.4", + "memchr 2.4.0", "regex-syntax", ] @@ -1297,9 +1297,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.23" +version = "0.6.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" +checksum = "00efb87459ba4f6fb2169d20f68565555688e1250ee6825cdf6254f8b48fafb2" [[package]] name = "remove_dir_all" @@ -1489,7 +1489,7 @@ checksum = "ad184cc9470f9117b2ac6817bfe297307418819ba40552f9b3846f05c33d5373" dependencies = [ "proc-macro2", "quote 1.0.9", - "unicode-xid 0.2.1", + "unicode-xid 0.2.2", ] [[package]] @@ -1636,9 +1636,9 @@ checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" [[package]] name = "unicode-xid" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "unindent" @@ -1806,7 +1806,7 @@ version = "0.0.6" dependencies = [ "bstr", "clap", - "memchr 2.3.4", + "memchr 2.4.0", "uucore", "uucore_procs", ] @@ -2175,7 +2175,7 @@ dependencies = [ "aho-corasick", "clap", "libc", - "memchr 2.3.4", + "memchr 2.4.0", "regex", "regex-syntax", "uucore", @@ -2276,7 +2276,7 @@ dependencies = [ "aho-corasick", "clap", "libc", - "memchr 2.3.4", + "memchr 2.4.0", "regex", "regex-syntax", "uucore", From d2913f80804430c3101f7bdb33f89df15d91204b Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 1 May 2021 13:12:10 +0200 Subject: [PATCH 0497/1135] rustfmt the recent change --- src/uu/factor/src/factor.rs | 8 ++++---- src/uu/factor/src/table.rs | 2 +- tests/by-util/test_sort.rs | 10 +++++----- tests/by-util/test_truncate.rs | 10 ++++++++-- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 42586d1da..5a85194c4 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -125,7 +125,7 @@ fn _factor(num: u64, f: Factors) -> Factors let n = A::new(num); let divisor = match miller_rabin::test::(n) { Prime => { - #[cfg(feature="coz")] + #[cfg(feature = "coz")] coz::progress!("factor found"); let mut r = f; r.push(num); @@ -141,7 +141,7 @@ fn _factor(num: u64, f: Factors) -> Factors } pub fn factor(mut n: u64) -> Factors { - #[cfg(feature="coz")] + #[cfg(feature = "coz")] coz::begin!("factorization"); let mut factors = Factors::one(); @@ -156,7 +156,7 @@ pub fn factor(mut n: u64) -> Factors { } if n == 1 { - #[cfg(feature="coz")] + #[cfg(feature = "coz")] coz::end!("factorization"); return factors; } @@ -169,7 +169,7 @@ pub fn factor(mut n: u64) -> Factors { _factor::>(n, factors) }; - #[cfg(feature="coz")] + #[cfg(feature = "coz")] coz::end!("factorization"); return r; diff --git a/src/uu/factor/src/table.rs b/src/uu/factor/src/table.rs index 6291b92c1..94ad6df4c 100644 --- a/src/uu/factor/src/table.rs +++ b/src/uu/factor/src/table.rs @@ -33,7 +33,7 @@ pub(crate) fn factor(mut num: u64, mut factors: Factors) -> (Factors, u64) { if x <= ceil { num = x; k += 1; - #[cfg(feature="coz")] + #[cfg(feature = "coz")] coz::progress!("factor found"); } else { if k > 0 { diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index cd3a3a496..eac9490a5 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -16,15 +16,15 @@ fn test_helper(file_name: &str, args: &str) { } // FYI, the initialization size of our Line struct is 96 bytes. -// -// At very small buffer sizes, with that overhead we are certainly going -// to overrun our buffer way, way, way too quickly because of these excess +// +// At very small buffer sizes, with that overhead we are certainly going +// to overrun our buffer way, way, way too quickly because of these excess // bytes for the struct. // // For instance, seq 0..20000 > ...text = 108894 bytes // But overhead is 1920000 + 108894 = 2028894 bytes // -// Or kjvbible-random.txt = 4332506 bytes, but minimum size of its +// Or kjvbible-random.txt = 4332506 bytes, but minimum size of its // 99817 lines in memory * 96 bytes = 9582432 bytes // // Here, we test 108894 bytes with a 50K buffer @@ -59,7 +59,7 @@ fn test_human_numeric_whitespace() { test_helper("human-numeric-whitespace", "-h"); } -// This tests where serde often fails when reading back JSON +// This tests where serde often fails when reading back JSON // if it finds a null value #[test] fn test_extsort_as64_bailout() { diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index d524c096f..8f88f4c74 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -224,8 +224,14 @@ fn test_size_and_reference() { let mut file1 = at.make_file(TFILE1); let mut file2 = at.make_file(TFILE2); file1.write_all(b"1234567890").unwrap(); - ucmd.args(&["--reference", TFILE1, "--size", "+5", TFILE2]).succeeds(); + ucmd.args(&["--reference", TFILE1, "--size", "+5", TFILE2]) + .succeeds(); file2.seek(SeekFrom::End(0)).unwrap(); let actual = file2.seek(SeekFrom::Current(0)).unwrap(); - assert!(expected == actual, "expected '{}' got '{}'", expected, actual); + assert!( + expected == actual, + "expected '{}' got '{}'", + expected, + actual + ); } From e1cc434c24144fba951266d12508a3eafbfb26dd Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 1 May 2021 15:27:54 +0200 Subject: [PATCH 0498/1135] ignore the test_ls_styles --- tests/by-util/test_ls.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index cfcbf9fd1..4258331e0 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -583,6 +583,7 @@ fn test_ls_order_birthtime() { } #[test] +#[ignore] fn test_ls_styles() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; From 308bdd7fc99fdf6aba21cb48f09c86bc3791f5a6 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 1 May 2021 15:55:58 +0200 Subject: [PATCH 0499/1135] ignore test_ls_order_birthtime too --- tests/by-util/test_ls.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 4258331e0..2b8f311d1 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -559,6 +559,7 @@ fn test_ls_long_ctime() { } #[test] +#[ignore] fn test_ls_order_birthtime() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; From 70ab0d01d294575f0f9b769ae53339e63c6b9a40 Mon Sep 17 00:00:00 2001 From: Nicolas Thery Date: Sat, 1 May 2021 08:48:18 +0200 Subject: [PATCH 0500/1135] kill: change default signal The default signal is SIGTERM, not SIGKILL. --- src/uu/kill/src/kill.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/kill/src/kill.rs b/src/uu/kill/src/kill.rs index 916c13cc3..fe925ce37 100644 --- a/src/uu/kill/src/kill.rs +++ b/src/uu/kill/src/kill.rs @@ -59,7 +59,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return kill( &matches .opt_str("signal") - .unwrap_or_else(|| obs_signal.unwrap_or_else(|| "9".to_owned())), + .unwrap_or_else(|| obs_signal.unwrap_or_else(|| "TERM".to_owned())), matches.free, ) } From 0ff10589984ca8a7c81bf496cbca4d5df8f1da93 Mon Sep 17 00:00:00 2001 From: Nicolas Thery Date: Mon, 26 Apr 2021 22:14:59 +0200 Subject: [PATCH 0501/1135] kill: add integration tests --- tests/by-util/test_kill.rs | 127 ++++++++++++++++++++++++++++++++++++- 1 file changed, 126 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_kill.rs b/tests/by-util/test_kill.rs index 651491045..637aea9a2 100644 --- a/tests/by-util/test_kill.rs +++ b/tests/by-util/test_kill.rs @@ -1 +1,126 @@ -// ToDO: add tests +use crate::common::util::*; +use regex::Regex; +use std::os::unix::process::ExitStatusExt; +use std::process::{Child, Command}; + +// A child process the tests will try to kill. +struct Target { + child: Child, + killed: bool, +} + +impl Target { + // Creates a target that will naturally die after some time if not killed + // fast enough. + // This timeout avoids hanging failing tests. + fn new() -> Target { + Target { + child: Command::new("sleep") + .arg("30") + .spawn() + .expect("cannot spawn target"), + killed: false, + } + } + + // Waits for the target to complete and returns the signal it received if any. + fn wait_for_signal(&mut self) -> Option { + let sig = self.child.wait().expect("cannot wait on target").signal(); + self.killed = true; + sig + } + + fn pid(&self) -> u32 { + self.child.id() + } +} + +impl Drop for Target { + // Terminates this target to avoid littering test boxes with zombi processes + // when a test fails after creating a target but before killing it. + fn drop(&mut self) { + if !self.killed { + self.child.kill().expect("cannot kill target"); + } + } +} + +#[test] +fn test_kill_list_all_signals() { + // Check for a few signals. Do not try to be comprehensive. + new_ucmd!() + .arg("-l") + .succeeds() + .stdout_contains("KILL") + .stdout_contains("TERM") + .stdout_contains("HUP"); +} + +#[test] +fn test_kill_list_all_signals_as_table() { + // Check for a few signals. Do not try to be comprehensive. + new_ucmd!() + .arg("-t") + .succeeds() + .stdout_contains("KILL") + .stdout_contains("TERM") + .stdout_contains("HUP"); +} + +#[test] +fn test_kill_list_one_signal_from_name() { + // Use SIGKILL because it is 9 on all unixes. + new_ucmd!() + .arg("-l") + .arg("KILL") + .succeeds() + .stdout_matches(&Regex::new("\\b9\\b").unwrap()); +} + +#[test] +fn test_kill_set_bad_signal_name() { + new_ucmd!() + .arg("-s") + .arg("IAMNOTASIGNAL") + .fails() + .stderr_contains("unknown signal"); +} + +#[test] +fn test_kill_with_default_signal() { + let mut target = Target::new(); + new_ucmd!().arg(format!("{}", target.pid())).succeeds(); + assert_eq!(target.wait_for_signal(), Some(libc::SIGTERM)); +} + +#[test] +fn test_kill_with_signal_number_old_form() { + let mut target = Target::new(); + new_ucmd!() + .arg("-9") + .arg(format!("{}", target.pid())) + .succeeds(); + assert_eq!(target.wait_for_signal(), Some(9)); +} + +#[test] +fn test_kill_with_signal_number_new_form() { + let mut target = Target::new(); + new_ucmd!() + .arg("-s") + .arg("9") + .arg(format!("{}", target.pid())) + .succeeds(); + assert_eq!(target.wait_for_signal(), Some(9)); +} + +#[test] +fn test_kill_with_signal_name_new_form() { + let mut target = Target::new(); + new_ucmd!() + .arg("-s") + .arg("KILL") + .arg(format!("{}", target.pid())) + .succeeds(); + assert_eq!(target.wait_for_signal(), Some(libc::SIGKILL)); +} From 01d178cf172bb205721be32c4e9d52e0e38b722d Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 1 May 2021 16:53:34 +0200 Subject: [PATCH 0502/1135] sort: don't rely on serde-json for extsort It is much faster to just write the lines to disk, separated by \n (or \0 if zero-terminated is enabled), instead of serializing to json. external_sort now knows of the Line struct instead of interacting with it using the ExternallySortable trait. Similarly, it now uses the crash_if_err! macro to handle errors, instead of bubbling them up. Some functions were changed from taking &[Line] as the input to taking an Iterator. This removes the need to collect to a Vec when not necessary. --- Cargo.lock | 8 - src/uu/sort/Cargo.toml | 4 +- src/uu/sort/src/external_sort/mod.rs | 356 ++++++++++----------------- src/uu/sort/src/numeric_str_cmp.rs | 7 +- src/uu/sort/src/sort.rs | 220 ++++++++--------- 5 files changed, 249 insertions(+), 346 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 31787e626..9ffc56720 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1372,9 +1372,6 @@ name = "serde" version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" -dependencies = [ - "serde_derive", -] [[package]] name = "serde_cbor" @@ -1453,9 +1450,6 @@ name = "smallvec" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" -dependencies = [ - "serde", -] [[package]] name = "strsim" @@ -2391,8 +2385,6 @@ dependencies = [ "rand 0.7.3", "rayon", "semver", - "serde", - "serde_json", "smallvec 1.6.1", "tempdir", "unicode-width", diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 80ffc92c9..3784ccbb0 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -15,15 +15,13 @@ edition = "2018" path = "src/sort.rs" [dependencies] -serde_json = { version = "1.0.64", default-features = false, features = ["alloc"] } -serde = { version = "1.0", features = ["derive"] } rayon = "1.5" rand = "0.7" clap = "2.33" fnv = "1.0.7" itertools = "0.10.0" semver = "0.9.0" -smallvec = { version="1.6.1", features=["serde"] } +smallvec = "1.6.1" unicode-width = "0.1.8" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/sort/src/external_sort/mod.rs b/src/uu/sort/src/external_sort/mod.rs index fd942d4a7..725b17bbd 100644 --- a/src/uu/sort/src/external_sort/mod.rs +++ b/src/uu/sort/src/external_sort/mod.rs @@ -1,50 +1,32 @@ -use std::clone::Clone; -use std::cmp::Ordering::Less; +use std::cmp::Ordering; use std::collections::VecDeque; -use std::error::Error; use std::fs::{File, OpenOptions}; -use std::io::SeekFrom::Start; +use std::io::SeekFrom; use std::io::{BufRead, BufReader, BufWriter, Seek, Write}; -use std::marker::PhantomData; -use std::path::PathBuf; +use std::path::Path; -use serde::de::DeserializeOwned; -use serde::Serialize; -use serde_json; use tempdir::TempDir; use super::{GlobalSettings, Line}; -/// Trait for types that can be used by -/// [ExternalSorter](struct.ExternalSorter.html). Must be sortable, cloneable, -/// serializeable, and able to report on it's size -pub trait ExternallySortable: Clone + Serialize + DeserializeOwned { - /// Get the size, in bytes, of this object (used to constrain the buffer - /// used in the external sort). - fn get_size(&self) -> u64; -} - /// Iterator that provides sorted `T`s -pub struct ExtSortedIterator { +pub struct ExtSortedIterator { buffers: Vec>, chunk_offsets: Vec, - max_per_chunk: u64, - chunks: u64, + max_per_chunk: usize, + chunks: usize, tmp_dir: TempDir, settings: GlobalSettings, failed: bool, } -impl Iterator for ExtSortedIterator -where - Line: ExternallySortable, -{ - type Item = Result>; +impl Iterator for ExtSortedIterator { + type Item = Line; /// # Errors /// /// This method can fail due to issues reading intermediate sorted chunks - /// from disk, or due to serde deserialization issues + /// from disk fn next(&mut self) -> Option { if self.failed { return None; @@ -53,29 +35,18 @@ where let mut empty = true; for chunk_num in 0..self.chunks { if self.buffers[chunk_num as usize].is_empty() { - let mut f = match File::open(self.tmp_dir.path().join(chunk_num.to_string())) { - Ok(f) => f, - Err(e) => { - self.failed = true; - return Some(Err(Box::new(e))); - } - }; - match f.seek(Start(self.chunk_offsets[chunk_num as usize])) { - Ok(_) => (), - Err(e) => { - self.failed = true; - return Some(Err(Box::new(e))); - } - } - let bytes_read = - match fill_buff(&mut self.buffers[chunk_num as usize], f, self.max_per_chunk) { - Ok(bytes_read) => bytes_read, - Err(e) => { - self.failed = true; - return Some(Err(e)); - } - }; - self.chunk_offsets[chunk_num as usize] += bytes_read; + let mut f = crash_if_err!( + 1, + File::open(self.tmp_dir.path().join(chunk_num.to_string())) + ); + crash_if_err!(1, f.seek(SeekFrom::Start(self.chunk_offsets[chunk_num]))); + let bytes_read = fill_buff( + &mut self.buffers[chunk_num as usize], + f, + self.max_per_chunk, + &self.settings, + ); + self.chunk_offsets[chunk_num as usize] += bytes_read as u64; if !self.buffers[chunk_num as usize].is_empty() { empty = false; } @@ -91,205 +62,150 @@ where // check is_empty() before unwrap()ing let mut idx = 0; for chunk_num in 0..self.chunks as usize { - if !self.buffers[chunk_num].is_empty() { - if self.buffers[idx].is_empty() - || (super::compare_by)( + if !self.buffers[chunk_num].is_empty() + && (self.buffers[idx].is_empty() + || super::compare_by( self.buffers[chunk_num].front().unwrap(), self.buffers[idx].front().unwrap(), &self.settings, - ) == Less - { - idx = chunk_num; - } + ) == Ordering::Less) + { + idx = chunk_num; } } // unwrap due to checks above let r = self.buffers[idx].pop_front().unwrap(); - Some(Ok(r)) + Some(r) } } -/// Perform an external sort on an unsorted stream of incoming data -pub struct ExternalSorter -where - Line: ExternallySortable, -{ - tmp_dir: Option, - buffer_bytes: u64, - phantom: PhantomData, - settings: GlobalSettings, -} +/// Sort (based on `compare`) the `T`s provided by `unsorted` and return an +/// iterator +/// +/// # Errors +/// +/// This method can fail due to issues writing intermediate sorted chunks +/// to disk. +pub fn ext_sort( + unsorted: impl Iterator, + settings: &GlobalSettings, +) -> ExtSortedIterator { + let tmp_dir = crash_if_err!(1, TempDir::new_in(&settings.tmp_dir, "uutils_sort")); -impl ExternalSorter -where - Line: ExternallySortable, -{ - /// Create a new `ExternalSorter` with a specified memory buffer and - /// temporary directory - pub fn new( - buffer_bytes: u64, - tmp_dir: Option, - settings: GlobalSettings, - ) -> ExternalSorter { - ExternalSorter { - buffer_bytes, - tmp_dir, - phantom: PhantomData, + let mut iter = ExtSortedIterator { + buffers: Vec::new(), + chunk_offsets: Vec::new(), + max_per_chunk: 0, + chunks: 0, + tmp_dir, + settings: settings.clone(), + failed: false, + }; + + let mut total_read = 0; + let mut chunk = Vec::new(); + + // make the initial chunks on disk + for seq in unsorted { + let seq_size = seq.estimate_size(); + total_read += seq_size; + + chunk.push(seq); + + if total_read >= settings.buffer_size { + super::sort_by(&mut chunk, &settings); + write_chunk( + settings, + &iter.tmp_dir.path().join(iter.chunks.to_string()), + &mut chunk, + ); + chunk.clear(); + total_read = 0; + iter.chunks += 1; + } + } + // write the last chunk + if !chunk.is_empty() { + super::sort_by(&mut chunk, &settings); + write_chunk( settings, - } + &iter.tmp_dir.path().join(iter.chunks.to_string()), + &mut chunk, + ); + iter.chunks += 1; } - /// Sort (based on `compare`) the `T`s provided by `unsorted` and return an - /// iterator - /// - /// # Errors - /// - /// This method can fail due to issues writing intermediate sorted chunks - /// to disk, or due to serde serialization issues - pub fn sort_by( - &self, - unsorted: I, - settings: GlobalSettings, - ) -> Result, Box> - where - I: Iterator, - { - let tmp_dir = match self.tmp_dir { - Some(ref p) => TempDir::new_in(p, "uutils_sort")?, - None => TempDir::new("uutils_sort")?, - }; - // creating the thing we need to return first due to the face that we need to - // borrow tmp_dir and move it out - let mut iter = ExtSortedIterator { - buffers: Vec::new(), - chunk_offsets: Vec::new(), - max_per_chunk: 0, - chunks: 0, - tmp_dir, - settings, - failed: false, - }; + // initialize buffers for each chunk + // + // Having a right sized buffer for each chunk for smallish values seems silly to me? + // + // We will have to have the entire iter in memory sometime right? + // Set minimum to the size of the writer buffer, ~8K - { - let mut total_read = 0; - let mut chunk = Vec::new(); - // Initial buffer is specified by user - let mut adjusted_buffer_size = self.buffer_bytes; - let (iter_size, _) = unsorted.size_hint(); - - // make the initial chunks on disk - for seq in unsorted { - let seq_size = seq.get_size(); - total_read += seq_size; - - // GNU minimum is 16 * (sizeof struct + 2), but GNU uses about - // 1/10 the memory that we do. And GNU even says in the code it may - // not work on small buffer sizes. - // - // The following seems to work pretty well, and has about the same max - // RSS as lower minimum values. - // - let minimum_buffer_size: u64 = iter_size as u64 * seq_size / 8; - - adjusted_buffer_size = - // Grow buffer size for a struct/Line larger than buffer - if adjusted_buffer_size < seq_size { - seq_size - } else if adjusted_buffer_size < minimum_buffer_size { - minimum_buffer_size - } else { - adjusted_buffer_size - }; - chunk.push(seq); - - if total_read >= adjusted_buffer_size { - super::sort_by(&mut chunk, &self.settings); - self.write_chunk( - &iter.tmp_dir.path().join(iter.chunks.to_string()), - &mut chunk, - )?; - chunk.clear(); - total_read = 0; - iter.chunks += 1; - } - } - // write the last chunk - if chunk.len() > 0 { - super::sort_by(&mut chunk, &self.settings); - self.write_chunk( - &iter.tmp_dir.path().join(iter.chunks.to_string()), - &mut chunk, - )?; - iter.chunks += 1; - } - - // initialize buffers for each chunk - // - // Having a right sized buffer for each chunk for smallish values seems silly to me? - // - // We will have to have the entire iter in memory sometime right? - // Set minimum to the size of the writer buffer, ~8K - // - const MINIMUM_READBACK_BUFFER: u64 = 8200; - let right_sized_buffer = adjusted_buffer_size - .checked_div(iter.chunks) - .unwrap_or(adjusted_buffer_size); - iter.max_per_chunk = if right_sized_buffer > MINIMUM_READBACK_BUFFER { - right_sized_buffer - } else { - MINIMUM_READBACK_BUFFER - }; - iter.buffers = vec![VecDeque::new(); iter.chunks as usize]; - iter.chunk_offsets = vec![0 as u64; iter.chunks as usize]; - for chunk_num in 0..iter.chunks { - let offset = fill_buff( - &mut iter.buffers[chunk_num as usize], - File::open(iter.tmp_dir.path().join(chunk_num.to_string()))?, - iter.max_per_chunk, - )?; - iter.chunk_offsets[chunk_num as usize] = offset; - } - } - - Ok(iter) + const MINIMUM_READBACK_BUFFER: usize = 8200; + let right_sized_buffer = settings + .buffer_size + .checked_div(iter.chunks) + .unwrap_or(settings.buffer_size); + iter.max_per_chunk = if right_sized_buffer > MINIMUM_READBACK_BUFFER { + right_sized_buffer + } else { + MINIMUM_READBACK_BUFFER + }; + iter.buffers = vec![VecDeque::new(); iter.chunks]; + iter.chunk_offsets = vec![0; iter.chunks]; + for chunk_num in 0..iter.chunks { + let offset = fill_buff( + &mut iter.buffers[chunk_num], + crash_if_err!( + 1, + File::open(iter.tmp_dir.path().join(chunk_num.to_string())) + ), + iter.max_per_chunk, + &settings, + ); + iter.chunk_offsets[chunk_num] = offset as u64; } - fn write_chunk(&self, file: &PathBuf, chunk: &mut Vec) -> Result<(), Box> { - let new_file = OpenOptions::new().create(true).append(true).open(file)?; - let mut buf_write = Box::new(BufWriter::new(new_file)) as Box; - for s in chunk { - let mut serialized = serde_json::to_string(&s).expect("JSON write error: "); - serialized.push_str("\n"); - buf_write.write(serialized.as_bytes())?; - } - buf_write.flush()?; - - Ok(()) - } + iter } -fn fill_buff( +fn write_chunk(settings: &GlobalSettings, file: &Path, chunk: &mut Vec) { + let new_file = crash_if_err!(1, OpenOptions::new().create(true).append(true).open(file)); + let mut buf_write = BufWriter::new(new_file); + for s in chunk { + crash_if_err!(1, buf_write.write_all(s.line.as_bytes())); + crash_if_err!( + 1, + buf_write.write_all(if settings.zero_terminated { "\0" } else { "\n" }.as_bytes(),) + ); + } + crash_if_err!(1, buf_write.flush()); +} + +fn fill_buff( vec: &mut VecDeque, file: File, - max_bytes: u64, -) -> Result> -where - Line: ExternallySortable, -{ + max_bytes: usize, + settings: &GlobalSettings, +) -> usize { let mut total_read = 0; let mut bytes_read = 0; - for line in BufReader::new(file).lines() { - let line_s = line?; + for line in BufReader::new(file).split(if settings.zero_terminated { + b'\0' + } else { + b'\n' + }) { + let line_s = String::from_utf8(crash_if_err!(1, line)).unwrap(); bytes_read += line_s.len() + 1; - // This is where the bad stuff happens usually - let deserialized: Line = serde_json::from_str(&line_s).expect("JSON read error: "); - total_read += deserialized.get_size(); + let deserialized = Line::new(line_s, settings); + total_read += deserialized.estimate_size(); vec.push_back(deserialized); if total_read > max_bytes { break; } } - Ok(bytes_read as u64) + bytes_read } diff --git a/src/uu/sort/src/numeric_str_cmp.rs b/src/uu/sort/src/numeric_str_cmp.rs index b74d97867..f8666b701 100644 --- a/src/uu/sort/src/numeric_str_cmp.rs +++ b/src/uu/sort/src/numeric_str_cmp.rs @@ -14,21 +14,20 @@ //! More specifically, exponent can be understood so that the original number is in (1..10)*10^exponent. //! From that follows the constraints of this algorithm: It is able to compare numbers in ±(1*10^[i64::MIN]..10*10^[i64::MAX]). -use serde::{Deserialize, Serialize}; use std::{cmp::Ordering, ops::Range}; -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, Clone)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)] enum Sign { Negative, Positive, } -#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] +#[derive(Debug, PartialEq, Clone)] pub struct NumInfo { exponent: i64, sign: Sign, } -#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] +#[derive(Debug, PartialEq, Clone)] pub struct NumInfoParseSettings { pub accept_si_units: bool, pub thousands_separator: Option, diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 18d9304fa..7c053e4ad 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -19,7 +19,7 @@ mod external_sort; mod numeric_str_cmp; use clap::{App, Arg}; -use external_sort::{ExternalSorter, ExternallySortable}; +use external_sort::ext_sort; use fnv::FnvHasher; use itertools::Itertools; use numeric_str_cmp::{numeric_str_cmp, NumInfo, NumInfoParseSettings}; @@ -27,14 +27,13 @@ use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; use rayon::prelude::*; use semver::Version; -use serde::{Deserialize, Serialize}; use smallvec::SmallVec; use std::cmp::Ordering; use std::collections::BinaryHeap; use std::env; use std::fs::File; use std::hash::{Hash, Hasher}; -use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Lines, Read, Write}; +use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; use std::mem::replace; use std::ops::Range; use std::path::Path; @@ -104,7 +103,7 @@ enum SortMode { Default, } #[derive(Clone)] -struct GlobalSettings { +pub struct GlobalSettings { mode: SortMode, debug: bool, ignore_blanks: bool, @@ -204,7 +203,7 @@ impl From<&GlobalSettings> for KeySettings { } } -#[derive(Debug, Serialize, Deserialize, Clone)] +#[derive(Debug, Clone)] /// Represents the string selected by a FieldSelector. enum SelectionRange { /// If we had to transform this selection, we have to store a new string. @@ -236,7 +235,7 @@ impl SelectionRange { } } -#[derive(Serialize, Deserialize, Clone)] +#[derive(Clone)] enum NumCache { AsF64(GeneralF64ParseResult), WithInfo(NumInfo), @@ -257,7 +256,8 @@ impl NumCache { } } } -#[derive(Serialize, Deserialize, Clone)] + +#[derive(Clone)] struct Selection { range: SelectionRange, num_cache: NumCache, @@ -272,22 +272,19 @@ impl Selection { type Field = Range; -#[derive(Serialize, Deserialize, Clone)] -struct Line { +#[derive(Clone)] +pub struct Line { line: String, // The common case is not to specify fields. Let's make this fast. selections: SmallVec<[Selection; 1]>, } -impl ExternallySortable for Line { - fn get_size(&self) -> u64 { - // Currently 96 bytes, but that could change, so we get that size here - std::mem::size_of::() as u64 - } -} - impl Line { - fn new(line: String, settings: &GlobalSettings) -> Self { + pub fn estimate_size(&self) -> usize { + self.line.capacity() + self.selections.capacity() * std::mem::size_of::() + } + + pub fn new(line: String, settings: &GlobalSettings) -> Self { let fields = if settings .selectors .iter() @@ -299,7 +296,7 @@ impl Line { None }; - let selections = settings + let selections: SmallVec<[Selection; 1]> = settings .selectors .iter() .map(|selector| { @@ -725,7 +722,7 @@ impl FieldSelector { } struct MergeableFile<'a> { - lines: Lines>>, + lines: Box + 'a>, current_line: Line, settings: &'a GlobalSettings, } @@ -765,11 +762,11 @@ impl<'a> FileMerger<'a> { settings, } } - fn push_file(&mut self, mut lines: Lines>>) { - if let Some(Ok(next_line)) = lines.next() { + fn push_file(&mut self, mut lines: Box + 'a>) { + if let Some(next_line) = lines.next() { let mergeable_file = MergeableFile { lines, - current_line: Line::new(next_line, &self.settings), + current_line: next_line, settings: &self.settings, }; self.heap.push(mergeable_file); @@ -783,11 +780,8 @@ impl<'a> Iterator for FileMerger<'a> { match self.heap.pop() { Some(mut current) => { match current.lines.next() { - Some(Ok(next_line)) => { - let ret = replace( - &mut current.current_line, - Line::new(next_line, &self.settings), - ); + Some(next_line) => { + let ret = replace(&mut current.current_line, next_line); self.heap.push(current); Some(ret) } @@ -1155,90 +1149,108 @@ pub fn uumain(args: impl uucore::Args) -> i32 { exec(files, settings) } -fn exec(files: Vec, settings: GlobalSettings) -> i32 { - let mut lines = Vec::new(); - let mut file_merger = FileMerger::new(&settings); +fn file_to_lines_iter<'a>( + file: &str, + settings: &'a GlobalSettings, +) -> Option + 'a> { + let (reader, _) = match open(file) { + Some(x) => x, + None => return None, + }; - for path in &files { - let (reader, _) = match open(path) { - Some(x) => x, - None => continue, - }; + let buf_reader = BufReader::new(reader); - let buf_reader = BufReader::new(reader); - - if settings.merge { - file_merger.push_file(buf_reader.lines()); - } else if settings.zero_terminated { - for line in buf_reader.split(b'\0').flatten() { - lines.push(Line::new( - std::str::from_utf8(&line) - .expect("Could not parse string from zero terminated input.") + Some( + buf_reader + .split(if settings.zero_terminated { + b'\0' + } else { + b'\n' + }) + .map(move |line| { + Line::new( + std::str::from_utf8(&line.unwrap()) + .expect("input is not valid utf-8") .to_string(), - &settings, - )); - } + settings, + ) + }), + ) +} + +fn output_sorted_lines(iter: impl Iterator, settings: &GlobalSettings) { + if settings.unique { + print_sorted( + iter.dedup_by(|a, b| compare_by(a, b, &settings) == Ordering::Equal), + &settings, + ); + } else { + print_sorted(iter, &settings); + } +} + +fn exec(files: Vec, settings: GlobalSettings) -> i32 { + if settings.merge { + let mut file_merger = FileMerger::new(&settings); + for lines in files + .iter() + .filter_map(|file| file_to_lines_iter(file, &settings)) + { + file_merger.push_file(Box::new(lines)); + } + output_sorted_lines(file_merger, &settings); + } else { + let lines = files + .iter() + .filter_map(|file| file_to_lines_iter(file, &settings)) + .flatten(); + + if settings.check { + return exec_check_file(lines, &settings); + } + + // Only use ext_sorter when we need to. + // Probably faster that we don't create + // an owned value each run + if settings.ext_sort { + let sorted_lines = ext_sort(lines, &settings); + output_sorted_lines(sorted_lines, &settings); } else { - for line in buf_reader.lines() { - if let Ok(n) = line { - lines.push(Line::new(n, &settings)); + let mut lines = vec![]; + + // This is duplicated from fn file_to_lines_iter, but using that function directly results in a performance regression. + for (file, _) in files.iter().map(|file| open(file)).flatten() { + let buf_reader = BufReader::new(file); + for line in buf_reader.split(if settings.zero_terminated { + b'\0' } else { - break; + b'\n' + }) { + let string = String::from_utf8(line.unwrap()).unwrap(); + lines.push(Line::new(string, &settings)); } } + + sort_by(&mut lines, &settings); + output_sorted_lines(lines.into_iter(), &settings); } } - if settings.check { - return exec_check_file(&lines, &settings); - } - - // Only use ext_sorter when we need to. - // Probably faster that we don't create - // an owned value each run - if settings.ext_sort { - lines = ext_sort_by(lines, settings.clone()); - } else { - sort_by(&mut lines, &settings); - } - - if settings.merge { - if settings.unique { - print_sorted( - file_merger.dedup_by(|a, b| compare_by(a, b, &settings) == Ordering::Equal), - &settings, - ) - } else { - print_sorted(file_merger, &settings) - } - } else if settings.unique { - print_sorted( - lines - .into_iter() - .dedup_by(|a, b| compare_by(a, b, &settings) == Ordering::Equal), - &settings, - ) - } else { - print_sorted(lines.into_iter(), &settings) - } - 0 } -fn exec_check_file(unwrapped_lines: &[Line], settings: &GlobalSettings) -> i32 { +fn exec_check_file(unwrapped_lines: impl Iterator, settings: &GlobalSettings) -> i32 { // errors yields the line before each disorder, // plus the last line (quirk of .coalesce()) - let mut errors = - unwrapped_lines - .iter() - .enumerate() - .coalesce(|(last_i, last_line), (i, line)| { - if compare_by(&last_line, &line, &settings) == Ordering::Greater { - Err(((last_i, last_line), (i, line))) - } else { - Ok((i, line)) - } - }); + let mut errors = unwrapped_lines + .enumerate() + .coalesce(|(last_i, last_line), (i, line)| { + if compare_by(&last_line, &line, &settings) == Ordering::Greater { + Err(((last_i, last_line), (i, line))) + } else { + Ok((i, line)) + } + }); if let Some((first_error_index, _line)) = errors.next() { // Check for a second "error", as .coalesce() always returns the last // line, no matter what our merging function does. @@ -1257,20 +1269,6 @@ fn exec_check_file(unwrapped_lines: &[Line], settings: &GlobalSettings) -> i32 { } } -fn ext_sort_by(unsorted: Vec, settings: GlobalSettings) -> Vec { - let external_sorter = ExternalSorter::new( - settings.buffer_size as u64, - Some(settings.tmp_dir.clone()), - settings.clone(), - ); - let iter = external_sorter - .sort_by(unsorted.into_iter(), settings.clone()) - .unwrap() - .map(|x| x.unwrap()) - .collect::>(); - iter -} - fn sort_by(unsorted: &mut Vec, settings: &GlobalSettings) { if settings.stable || settings.unique { unsorted.par_sort_by(|a, b| compare_by(a, b, &settings)) @@ -1375,7 +1373,7 @@ fn get_leading_gen(input: &str) -> Range { leading_whitespace_len..input.len() } -#[derive(Serialize, Deserialize, Copy, Clone, PartialEq, PartialOrd)] +#[derive(Copy, Clone, PartialEq, PartialOrd)] enum GeneralF64ParseResult { Invalid, NaN, From 11f387dc93f4d0f218870cc63ad1f1d5d4a80532 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 1 May 2021 17:29:00 +0200 Subject: [PATCH 0503/1135] ls: fix style test --- tests/by-util/test_ls.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 2b8f311d1..79e26f200 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -584,7 +584,6 @@ fn test_ls_order_birthtime() { } #[test] -#[ignore] fn test_ls_styles() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; @@ -598,7 +597,7 @@ fn test_ls_styles() { Regex::new(r"[a-z-]* \d* \w* \w* \d* \d{4}-\d{2}-\d{2} \d{2}:\d{2} test\n").unwrap(); let re_iso = Regex::new(r"[a-z-]* \d* \w* \w* \d* \d{2}-\d{2} \d{2}:\d{2} test\n").unwrap(); let re_locale = - Regex::new(r"[a-z-]* \d* \w* \w* \d* [A-Z][a-z]{2} \d{2} \d{2}:\d{2} test\n").unwrap(); + Regex::new(r"[a-z-]* \d* \w* \w* \d* [A-Z][a-z]{2} ( |\d)\d \d{2}:\d{2} test\n").unwrap(); //full-iso let result = scene From 5567f32f5811a7b48a83f4e57ba284a35b2d199a Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 1 May 2021 17:49:45 +0200 Subject: [PATCH 0504/1135] refresh cargo.lock with recent updates --- Cargo.lock | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 33d599762..c988d6d12 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -106,9 +106,9 @@ dependencies = [ [[package]] name = "bstr" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" +checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279" dependencies = [ "lazy_static", "memchr 2.4.0", @@ -1277,9 +1277,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a068b905b8cb93815aa3069ae48653d90f382308aebd1d33d940ac1f1d771e2d" +checksum = "1efb2352a0f4d4b128f734b5c44c79ff80117351138733f12f982fe3e2b13343" dependencies = [ "aho-corasick", "memchr 2.4.0", @@ -2247,6 +2247,7 @@ dependencies = [ name = "uu_pinky" version = "0.0.6" dependencies = [ + "clap", "uucore", "uucore_procs", ] From 117e84eed3adabb54fa852030712848f08c319f1 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sat, 1 May 2021 18:46:13 +0200 Subject: [PATCH 0505/1135] tr: implement complement separately from delete or squeeze (#2147) --- src/uu/tr/src/tr.rs | 34 ++++++++++++++++++++++++---------- tests/by-util/test_tr.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index 6c1c0746a..f8fabd69f 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -125,10 +125,17 @@ impl SymbolTranslator for DeleteAndSqueezeOperation { struct TranslateOperation { translate_map: FnvHashMap, + complement: bool, + s2_last: char, } impl TranslateOperation { - fn new(set1: ExpandSet, set2: &mut ExpandSet, truncate: bool) -> TranslateOperation { + fn new( + set1: ExpandSet, + set2: &mut ExpandSet, + truncate: bool, + complement: bool, + ) -> TranslateOperation { let mut map = FnvHashMap::default(); let mut s2_prev = '_'; for i in set1 { @@ -141,13 +148,25 @@ impl TranslateOperation { map.insert(i as usize, s2_prev); } } - TranslateOperation { translate_map: map } + TranslateOperation { + translate_map: map, + complement, + s2_last: s2_prev, + } } } impl SymbolTranslator for TranslateOperation { fn translate(&self, c: char, _prev_c: char) -> Option { - Some(*self.translate_map.get(&(c as usize)).unwrap_or(&c)) + if self.complement { + Some(if self.translate_map.contains_key(&(c as usize)) { + c + } else { + self.s2_last + }) + } else { + Some(*self.translate_map.get(&(c as usize)).unwrap_or(&c)) + } } } @@ -256,11 +275,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return 1; } - if complement_flag && !delete_flag && !squeeze_flag { - show_error!("-c is only supported with -d or -s"); - return 1; - } - let stdin = stdin(); let mut locked_stdin = stdin.lock(); let stdout = stdout(); @@ -282,8 +296,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { translate_input(&mut locked_stdin, &mut buffered_stdout, op); } else { let mut set2 = ExpandSet::new(sets[1].as_ref()); - let op = TranslateOperation::new(set1, &mut set2, truncate_flag); - translate_input(&mut locked_stdin, &mut buffered_stdout, op) + let op = TranslateOperation::new(set1, &mut set2, truncate_flag, complement_flag); + translate_input(&mut locked_stdin, &mut buffered_stdout, op); } 0 diff --git a/tests/by-util/test_tr.rs b/tests/by-util/test_tr.rs index 630c305c6..637c9b109 100644 --- a/tests/by-util/test_tr.rs +++ b/tests/by-util/test_tr.rs @@ -45,6 +45,33 @@ fn test_delete_complement() { .stdout_is("ac"); } +#[test] +fn test_complement1() { + new_ucmd!() + .args(&["-c", "a", "X"]) + .pipe_in("ab") + .run() + .stdout_is("aX"); +} + +#[test] +fn test_complement2() { + new_ucmd!() + .args(&["-c", "0-9", "x"]) + .pipe_in("Phone: 01234 567890") + .run() + .stdout_is("xxxxxxx01234x567890"); +} + +#[test] +fn test_complement3() { + new_ucmd!() + .args(&["-c", "abcdefgh", "123"]) + .pipe_in("the cat and the bat") + .run() + .stdout_is("3he3ca33a3d33he3ba3"); +} + #[test] fn test_squeeze() { new_ucmd!() From 5674d093275ea9ddc3be9ffbb3627eb5d6cae3a1 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Sat, 1 May 2021 13:01:55 -0400 Subject: [PATCH 0506/1135] fixup! tr: implement translate and squeeze (-s) mode --- src/uu/tr/src/tr.rs | 89 +++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 47 deletions(-) diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index 09c4304a5..e04737a45 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -151,6 +151,35 @@ impl SymbolTranslator for TranslateOperation { } } +struct TranslateAndSqueezeOperation { + translate: TranslateOperation, + squeeze: SqueezeOperation, +} + +impl TranslateAndSqueezeOperation { + fn new( + set1: ExpandSet, + set2: &mut ExpandSet, + set2_: ExpandSet, + truncate: bool, + complement: bool, + ) -> TranslateAndSqueezeOperation { + TranslateAndSqueezeOperation { + translate: TranslateOperation::new(set1, set2, truncate), + squeeze: SqueezeOperation::new(set2_, complement), + } + } +} + +impl SymbolTranslator for TranslateAndSqueezeOperation { + fn translate(&self, c: char, prev_c: char) -> Option { + // `unwrap()` will never panic because `Translate.translate()` + // always returns `Some`. + self.squeeze + .translate(self.translate.translate(c, 0 as char).unwrap(), prev_c) + } +} + fn translate_input( input: &mut dyn BufRead, output: &mut dyn Write, @@ -168,8 +197,11 @@ fn translate_input( // isolation to make borrow checker happy let filtered = buf.chars().filter_map(|c| { let res = translator.translate(c, prev_c); + // Set `prev_c` to the post-translate character. This + // allows the squeeze operation to correctly function + // after the translate operation. if res.is_some() { - prev_c = c; + prev_c = res.unwrap(); } res }); @@ -282,53 +314,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let op = SqueezeOperation::new(set1, complement_flag); translate_input(&mut locked_stdin, &mut buffered_stdout, op); } else { - // Define a closure that computes the translation using a hash map. - // - // The `unwrap()` should never panic because the - // `TranslateOperation.translate()` method always returns - // `Some`. let mut set2 = ExpandSet::new(sets[1].as_ref()); - let translator = TranslateOperation::new(set1, &mut set2, truncate_flag); - let translate = |c| translator.translate(c, 0 as char).unwrap(); - - // Prepare some variables to be used for the closure that - // computes the squeeze operation. - // - // The `squeeze()` closure needs to be defined anew for - // each line of input, but these variables do not change - // while reading the input so they can be defined before - // the `while` loop. - let set2 = ExpandSet::new(sets[1].as_ref()); - let squeezer = SqueezeOperation::new(set2, complement_flag); - - // Prepare some memory to read each line of the input (`buf`) and to write - let mut buf = String::with_capacity(BUFFER_LEN + 4); - - // Loop over each line of stdin. - while let Ok(length) = locked_stdin.read_line(&mut buf) { - if length == 0 { - break; - } - - // Define a closure that computes the squeeze operation. - // - // We keep track of the previously seen character on - // each call to `squeeze()`, but we need to reset the - // `prev_c` variable at the beginning of each line of - // the input. That's why we define the closure inside - // the `while` loop. - let mut prev_c = 0 as char; - let squeeze = |c| { - let result = squeezer.translate(c, prev_c); - prev_c = c; - result - }; - - // First translate, then squeeze each character of the input line. - let filtered: String = buf.chars().map(translate).filter_map(squeeze).collect(); - buf.clear(); - buffered_stdout.write_all(filtered.as_bytes()).unwrap(); - } + let set2_ = ExpandSet::new(sets[1].as_ref()); + let op = TranslateAndSqueezeOperation::new( + set1, + &mut set2, + set2_, + complement_flag, + truncate_flag, + ); + translate_input(&mut locked_stdin, &mut buffered_stdout, op); } } else { let mut set2 = ExpandSet::new(sets[1].as_ref()); From 05b20c32a996e56c9ced87e520e7a23cd19358af Mon Sep 17 00:00:00 2001 From: Ricardo Iglesias Date: Wed, 28 Apr 2021 00:36:27 -0700 Subject: [PATCH 0507/1135] base64: Moved argument parsing to clap. Moved argument parsing to clap and added tests to cover using "-" as stdin, passing in too many file arguments, and updated the "wrap" error message in the tests. --- Cargo.lock | 1 + src/uu/base64/Cargo.toml | 1 + src/uu/base64/src/base64.rs | 139 +++++++++++++++++++++++-- src/uu/base64/src/base_common.rs | 61 +---------- tests/by-util/test_base64.rs | 40 ++++++- tests/fixtures/base64/input-simple.txt | 1 + 6 files changed, 171 insertions(+), 72 deletions(-) create mode 100644 tests/fixtures/base64/input-simple.txt diff --git a/Cargo.lock b/Cargo.lock index c988d6d12..254ae8fda 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1688,6 +1688,7 @@ dependencies = [ name = "uu_base64" version = "0.0.6" dependencies = [ + "clap", "uucore", "uucore_procs", ] diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index 841ab140c..97241a571 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/base64.rs" [dependencies] +clap = "2.33" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features = ["encoding"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/base64/src/base64.rs b/src/uu/base64/src/base64.rs index 61a8dc5cb..62d36cc5f 100644 --- a/src/uu/base64/src/base64.rs +++ b/src/uu/base64/src/base64.rs @@ -8,12 +8,19 @@ #[macro_use] extern crate uucore; + use uucore::encoding::Format; use uucore::InvalidEncodingHandling; +use std::fs::File; +use std::io::{stdin, BufReader}; +use std::path::Path; + +use clap::{App, Arg}; + mod base_common; -static SYNTAX: &str = "[OPTION]... [FILE]"; +static BASE64_ARG_ERROR: i32 = 1; static SUMMARY: &str = "Base64 encode or decode FILE, or standard input, to standard output."; static LONG_HELP: &str = " With no FILE, or when FILE is -, read standard input. @@ -24,14 +31,128 @@ static LONG_HELP: &str = " to attempt to recover from any other non-alphabet bytes in the encoded stream. "; +static VERSION: &str = env!("CARGO_PKG_VERSION"); + +fn get_usage() -> String { + format!("{0} [OPTION]... [FILE]", executable!()) +} + +pub mod options { + pub static DECODE: &str = "decode"; + pub static WRAP: &str = "wrap"; + pub static IGNORE_GARBAGE: &str = "ignore-garbage"; + pub static FILE: &str = "file"; +} + +struct Config { + decode: bool, + ignore_garbage: bool, + wrap_cols: Option, + to_read: Option, +} + +impl Config { + fn from(options: clap::ArgMatches) -> Config { + let file: Option = match options.values_of(options::FILE) { + Some(mut values) => { + let name = values.next().unwrap(); + if values.len() != 0 { + crash!(BASE64_ARG_ERROR, "extra operand ‘{}’", name); + } + + if name == "-" { + None + } else { + if !Path::exists(Path::new(name)) { + crash!(BASE64_ARG_ERROR, "{}: No such file or directory", name); + } + Some(name.to_owned()) + } + } + None => None, + }; + + let cols = match options.value_of(options::WRAP) { + Some(num) => match num.parse::() { + Ok(n) => Some(n), + Err(e) => { + crash!(BASE64_ARG_ERROR, "invalid wrap size: ‘{}’: {}", num, e); + } + }, + None => None, + }; + + Config { + decode: options.is_present(options::DECODE), + ignore_garbage: options.is_present(options::IGNORE_GARBAGE), + wrap_cols: cols, + to_read: file, + } + } +} pub fn uumain(args: impl uucore::Args) -> i32 { - base_common::execute( - args.collect_str(InvalidEncodingHandling::Ignore) - .accept_any(), - SYNTAX, - SUMMARY, - LONG_HELP, - Format::Base64, - ) + let format = Format::Base64; + let usage = get_usage(); + let app = App::new(executable!()) + .version(VERSION) + .about(SUMMARY) + .usage(&usage[..]) + .about(LONG_HELP) + // Format arguments. + .arg( + Arg::with_name(options::DECODE) + .short("d") + .long(options::DECODE) + .help("decode data"), + ) + .arg( + Arg::with_name(options::IGNORE_GARBAGE) + .short("i") + .long(options::IGNORE_GARBAGE) + .help("when decoding, ignore non-alphabetic characters"), + ) + .arg( + Arg::with_name(options::WRAP) + .short("w") + .long(options::WRAP) + .takes_value(true) + .help( + "wrap encoded lines after COLS character (default 76, 0 to disable wrapping)", + ), + ) + // "multiple" arguments are used to check whether there is more than one + // file passed in. + .arg(Arg::with_name(options::FILE).index(1).multiple(true)); + + let arg_list = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); + let config: Config = Config::from(app.get_matches_from(arg_list)); + match config.to_read { + // Read from file. + Some(name) => { + let file_buf = safe_unwrap!(File::open(Path::new(&name))); + let mut input = BufReader::new(file_buf); + base_common::handle_input( + &mut input, + format, + config.wrap_cols, + config.ignore_garbage, + config.decode, + ); + } + // stdin + None => { + base_common::handle_input( + &mut stdin().lock(), + format, + config.wrap_cols, + config.ignore_garbage, + config.decode, + ); + } + }; + + 0 } diff --git a/src/uu/base64/src/base_common.rs b/src/uu/base64/src/base_common.rs index 3f1436fb2..a4b49e499 100644 --- a/src/uu/base64/src/base_common.rs +++ b/src/uu/base64/src/base_common.rs @@ -7,68 +7,11 @@ // For the full copyright and license information, please view the LICENSE file // that was distributed with this source code. -use std::fs::File; -use std::io::{stdin, stdout, BufReader, Read, Write}; -use std::path::Path; +use std::io::{stdout, Read, Write}; use uucore::encoding::{wrap_print, Data, Format}; -pub fn execute( - args: Vec, - syntax: &str, - summary: &str, - long_help: &str, - format: Format, -) -> i32 { - let matches = app!(syntax, summary, long_help) - .optflag("d", "decode", "decode data") - .optflag( - "i", - "ignore-garbage", - "when decoding, ignore non-alphabetic characters", - ) - .optopt( - "w", - "wrap", - "wrap encoded lines after COLS character (default 76, 0 to disable wrapping)", - "COLS", - ) - .parse(args); - - let line_wrap = matches.opt_str("wrap").map(|s| match s.parse() { - Ok(n) => n, - Err(e) => { - crash!(1, "invalid wrap size: ‘{}’: {}", s, e); - } - }); - let ignore_garbage = matches.opt_present("ignore-garbage"); - let decode = matches.opt_present("decode"); - - if matches.free.len() > 1 { - show_usage_error!("extra operand ‘{}’", matches.free[0]); - return 1; - } - - if matches.free.is_empty() || &matches.free[0][..] == "-" { - let stdin_raw = stdin(); - handle_input( - &mut stdin_raw.lock(), - format, - line_wrap, - ignore_garbage, - decode, - ); - } else { - let path = Path::new(matches.free[0].as_str()); - let file_buf = safe_unwrap!(File::open(&path)); - let mut input = BufReader::new(file_buf); - handle_input(&mut input, format, line_wrap, ignore_garbage, decode); - }; - - 0 -} - -fn handle_input( +pub fn handle_input( input: &mut R, format: Format, line_wrap: Option, diff --git a/tests/by-util/test_base64.rs b/tests/by-util/test_base64.rs index 6bc0436c5..c9adc5c0f 100644 --- a/tests/by-util/test_base64.rs +++ b/tests/by-util/test_base64.rs @@ -7,6 +7,21 @@ fn test_encode() { .pipe_in(input) .succeeds() .stdout_only("aGVsbG8sIHdvcmxkIQ==\n"); + + // Using '-' as our file + new_ucmd!() + .arg("-") + .pipe_in(input) + .succeeds() + .stdout_only("aGVsbG8sIHdvcmxkIQ==\n"); +} + +#[test] +fn test_base64_encode_file() { + new_ucmd!() + .arg("input-simple.txt") + .succeeds() + .stdout_only("SGVsbG8sIFdvcmxkIQo=\n"); } #[test] @@ -60,10 +75,9 @@ fn test_wrap() { #[test] fn test_wrap_no_arg() { for wrap_param in vec!["-w", "--wrap"] { - new_ucmd!().arg(wrap_param).fails().stderr_only(format!( - "base64: error: Argument to option '{}' missing\n", - if wrap_param == "-w" { "w" } else { "wrap" } - )); + new_ucmd!().arg(wrap_param).fails().stderr_contains( + &"The argument '--wrap ' requires a value but none was supplied", + ); } } @@ -77,3 +91,21 @@ fn test_wrap_bad_arg() { .stderr_only("base64: error: invalid wrap size: ‘b’: invalid digit found in string\n"); } } + +#[test] +fn test_base64_extra_operand() { + // Expect a failure when multiple files are specified. + new_ucmd!() + .arg("a.txt") + .arg("a.txt") + .fails() + .stderr_only("base64: error: extra operand ‘a.txt’"); +} + +#[test] +fn test_base64_file_not_found() { + new_ucmd!() + .arg("a.txt") + .fails() + .stderr_only("base64: error: a.txt: No such file or directory"); +} diff --git a/tests/fixtures/base64/input-simple.txt b/tests/fixtures/base64/input-simple.txt new file mode 100644 index 000000000..8ab686eaf --- /dev/null +++ b/tests/fixtures/base64/input-simple.txt @@ -0,0 +1 @@ +Hello, World! From f307de22d0636247c7cfbb4b6db88ea29971a7d6 Mon Sep 17 00:00:00 2001 From: Ricardo Iglesias Date: Thu, 29 Apr 2021 01:59:43 -0700 Subject: [PATCH 0508/1135] base64: Refactor argument parsing Moved most of the argument parsing logic to `base32/base_common.rs` to allow for significant code reuse. --- Cargo.lock | 1 + src/uu/base32/src/base32.rs | 152 +++++++------------------------ src/uu/base32/src/base_common.rs | 125 ++++++++++++++++++++++++- src/uu/base64/Cargo.toml | 1 + src/uu/base64/src/base64.rs | 151 ++++++------------------------ src/uu/base64/src/base_common.rs | 40 -------- tests/by-util/test_base32.rs | 2 +- tests/by-util/test_base64.rs | 2 +- 8 files changed, 187 insertions(+), 287 deletions(-) delete mode 100644 src/uu/base64/src/base_common.rs diff --git a/Cargo.lock b/Cargo.lock index 254ae8fda..54ddbd88e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1689,6 +1689,7 @@ name = "uu_base64" version = "0.0.6" dependencies = [ "clap", + "uu_base32", "uucore", "uucore_procs", ] diff --git a/src/uu/base32/src/base32.rs b/src/uu/base32/src/base32.rs index 6d9f7f08f..f0e187c31 100644 --- a/src/uu/base32/src/base32.rs +++ b/src/uu/base32/src/base32.rs @@ -7,19 +7,14 @@ #[macro_use] extern crate uucore; + +use std::io::{stdin, Read}; + use uucore::encoding::Format; -use uucore::InvalidEncodingHandling; -use std::fs::File; -use std::io::{stdin, BufReader}; -use std::path::Path; +pub mod base_common; -use clap::{App, Arg}; - -mod base_common; - -static SUMMARY: &str = "Base32 encode or decode FILE, or standard input, to standard output."; -static LONG_HELP: &str = " +static ABOUT: &str = " With no FILE, or when FILE is -, read standard input. The data are encoded as described for the base32 alphabet in RFC @@ -30,126 +25,41 @@ static LONG_HELP: &str = " "; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static BASE_CMD_PARSE_ERROR: i32 = 1; + fn get_usage() -> String { format!("{0} [OPTION]... [FILE]", executable!()) } -pub mod options { - pub static DECODE: &str = "decode"; - pub static WRAP: &str = "wrap"; - pub static IGNORE_GARBAGE: &str = "ignore-garbage"; - pub static FILE: &str = "file"; -} - -struct Config { - decode: bool, - ignore_garbage: bool, - wrap_cols: Option, - to_read: Option, -} - -impl Config { - fn from(options: clap::ArgMatches) -> Config { - let file: Option = match options.values_of(options::FILE) { - Some(mut values) => { - let name = values.next().unwrap(); - if values.len() != 0 { - crash!(3, "extra operand ‘{}’", name); - } - - if name == "-" { - None - } else { - if !Path::exists(Path::new(name)) { - crash!(2, "{}: No such file or directory", name); - } - Some(name.to_owned()) - } - } - None => None, - }; - - let cols = match options.value_of(options::WRAP) { - Some(num) => match num.parse::() { - Ok(n) => Some(n), - Err(e) => { - crash!(1, "invalid wrap size: ‘{}’: {}", num, e); - } - }, - None => None, - }; - - Config { - decode: options.is_present(options::DECODE), - ignore_garbage: options.is_present(options::IGNORE_GARBAGE), - wrap_cols: cols, - to_read: file, - } - } -} - pub fn uumain(args: impl uucore::Args) -> i32 { let format = Format::Base32; let usage = get_usage(); - let app = App::new(executable!()) - .version(VERSION) - .about(SUMMARY) - .usage(&usage[..]) - .about(LONG_HELP) - // Format arguments. - .arg( - Arg::with_name(options::DECODE) - .short("d") - .long(options::DECODE) - .help("decode data"), - ) - .arg( - Arg::with_name(options::IGNORE_GARBAGE) - .short("i") - .long(options::IGNORE_GARBAGE) - .help("when decoding, ignore non-alphabetic characters"), - ) - .arg( - Arg::with_name(options::WRAP) - .short("w") - .long(options::WRAP) - .takes_value(true) - .help( - "wrap encoded lines after COLS character (default 76, 0 to disable wrapping)", - ), - ) - // "multiple" arguments are used to check whether there is more than one - // file passed in. - .arg(Arg::with_name(options::FILE).index(1).multiple(true)); + let name = executable!(); - let arg_list = args - .collect_str(InvalidEncodingHandling::ConvertLossy) - .accept_any(); - let config: Config = Config::from(app.get_matches_from(arg_list)); - match config.to_read { - // Read from file. - Some(name) => { - let file_buf = safe_unwrap!(File::open(Path::new(&name))); - let mut input = BufReader::new(file_buf); - base_common::handle_input( - &mut input, - format, - config.wrap_cols, - config.ignore_garbage, - config.decode, - ); + let config_result: Result = + base_common::parse_base_cmd_args(args, name, VERSION, ABOUT, &usage); + + if config_result.is_err() { + match config_result { + Ok(_) => panic!(), + Err(s) => crash!(BASE_CMD_PARSE_ERROR, "{}", s), } - // stdin - None => { - base_common::handle_input( - &mut stdin().lock(), - format, - config.wrap_cols, - config.ignore_garbage, - config.decode, - ); - } - }; + } + + // Create a reference to stdin so we can return a locked stdin from + // parse_base_cmd_args + let stdin_raw = stdin(); + let config = config_result.unwrap(); + let mut input: Box = base_common::get_input(&config, &stdin_raw); + + base_common::handle_input( + &mut input, + format, + config.wrap_cols, + config.ignore_garbage, + config.decode, + name, + ); 0 } diff --git a/src/uu/base32/src/base_common.rs b/src/uu/base32/src/base_common.rs index a4b49e499..d0f47f500 100644 --- a/src/uu/base32/src/base_common.rs +++ b/src/uu/base32/src/base_common.rs @@ -10,6 +10,122 @@ use std::io::{stdout, Read, Write}; use uucore::encoding::{wrap_print, Data, Format}; +use uucore::InvalidEncodingHandling; + +use std::fs::File; +use std::io::{BufReader, Stdin}; +use std::path::Path; + +use clap::{App, Arg}; + +// Config. +pub struct Config { + pub decode: bool, + pub ignore_garbage: bool, + pub wrap_cols: Option, + pub to_read: Option, +} + +pub mod options { + pub static DECODE: &str = "decode"; + pub static WRAP: &str = "wrap"; + pub static IGNORE_GARBAGE: &str = "ignore-garbage"; + pub static FILE: &str = "file"; +} + +impl Config { + fn from(options: clap::ArgMatches) -> Result { + let file: Option = match options.values_of(options::FILE) { + Some(mut values) => { + let name = values.next().unwrap(); + if values.len() != 0 { + return Err(format!("extra operand ‘{}’", name)); + } + + if name == "-" { + None + } else { + if !Path::exists(Path::new(name)) { + return Err(format!("{}: No such file or directory", name)); + } + Some(name.to_owned()) + } + } + None => None, + }; + + let cols = match options.value_of(options::WRAP) { + Some(num) => match num.parse::() { + Ok(n) => Some(n), + Err(e) => { + return Err(format!("Invalid wrap size: ‘{}’: {}", num, e)); + } + }, + None => None, + }; + + Ok(Config { + decode: options.is_present(options::DECODE), + ignore_garbage: options.is_present(options::IGNORE_GARBAGE), + wrap_cols: cols, + to_read: file, + }) + } +} + +pub fn parse_base_cmd_args( + args: impl uucore::Args, + name: &str, + version: &str, + about: &str, + usage: &str, +) -> Result { + let app = App::new(name) + .version(version) + .about(about) + .usage(&usage[..]) + // Format arguments. + .arg( + Arg::with_name(options::DECODE) + .short("d") + .long(options::DECODE) + .help("decode data"), + ) + .arg( + Arg::with_name(options::IGNORE_GARBAGE) + .short("i") + .long(options::IGNORE_GARBAGE) + .help("when decoding, ignore non-alphabetic characters"), + ) + .arg( + Arg::with_name(options::WRAP) + .short("w") + .long(options::WRAP) + .takes_value(true) + .help( + "wrap encoded lines after COLS character (default 76, 0 to disable wrapping)", + ), + ) + // "multiple" arguments are used to check whether there is more than one + // file passed in. + .arg(Arg::with_name(options::FILE).index(1).multiple(true)); + let arg_list = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); + Config::from(app.get_matches_from(arg_list)) +} + +pub fn get_input<'a>(config: &Config, stdin_ref: &'a Stdin) -> Box { + match &config.to_read { + Some(name) => { + let file_buf = safe_unwrap!(File::open(Path::new(name))); + Box::new(BufReader::new(file_buf)) // as Box + } + None => { + Box::new(stdin_ref.lock()) // as Box + } + } +} pub fn handle_input( input: &mut R, @@ -17,6 +133,7 @@ pub fn handle_input( line_wrap: Option, ignore_garbage: bool, decode: bool, + name: &str, ) { let mut data = Data::new(input, format).ignore_garbage(ignore_garbage); if let Some(wrap) = line_wrap { @@ -31,10 +148,14 @@ pub fn handle_input( Ok(s) => { if stdout().write_all(&s).is_err() { // on windows console, writing invalid utf8 returns an error - crash!(1, "Cannot write non-utf8 data"); + eprintln!("{}: error: Cannot write non-utf8 data", name); + exit!(1) } } - Err(_) => crash!(1, "invalid input"), + Err(_) => { + eprintln!("{}: error: invalid input", name); + exit!(1) + } } } } diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index 97241a571..d4ee69f03 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -18,6 +18,7 @@ path = "src/base64.rs" clap = "2.33" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features = ["encoding"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +uu_base32 = { version=">=0.0.6", package="uu_base32", path="../base32"} [[bin]] name = "base64" diff --git a/src/uu/base64/src/base64.rs b/src/uu/base64/src/base64.rs index 62d36cc5f..810df4fe8 100644 --- a/src/uu/base64/src/base64.rs +++ b/src/uu/base64/src/base64.rs @@ -9,20 +9,13 @@ #[macro_use] extern crate uucore; +use uu_base32::base_common; + use uucore::encoding::Format; -use uucore::InvalidEncodingHandling; -use std::fs::File; -use std::io::{stdin, BufReader}; -use std::path::Path; +use std::io::{stdin, Read}; -use clap::{App, Arg}; - -mod base_common; - -static BASE64_ARG_ERROR: i32 = 1; -static SUMMARY: &str = "Base64 encode or decode FILE, or standard input, to standard output."; -static LONG_HELP: &str = " +static ABOUT: &str = " With no FILE, or when FILE is -, read standard input. The data are encoded as described for the base64 alphabet in RFC @@ -33,126 +26,40 @@ static LONG_HELP: &str = " "; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static BASE_CMD_PARSE_ERROR: i32 = 1; + fn get_usage() -> String { format!("{0} [OPTION]... [FILE]", executable!()) } -pub mod options { - pub static DECODE: &str = "decode"; - pub static WRAP: &str = "wrap"; - pub static IGNORE_GARBAGE: &str = "ignore-garbage"; - pub static FILE: &str = "file"; -} - -struct Config { - decode: bool, - ignore_garbage: bool, - wrap_cols: Option, - to_read: Option, -} - -impl Config { - fn from(options: clap::ArgMatches) -> Config { - let file: Option = match options.values_of(options::FILE) { - Some(mut values) => { - let name = values.next().unwrap(); - if values.len() != 0 { - crash!(BASE64_ARG_ERROR, "extra operand ‘{}’", name); - } - - if name == "-" { - None - } else { - if !Path::exists(Path::new(name)) { - crash!(BASE64_ARG_ERROR, "{}: No such file or directory", name); - } - Some(name.to_owned()) - } - } - None => None, - }; - - let cols = match options.value_of(options::WRAP) { - Some(num) => match num.parse::() { - Ok(n) => Some(n), - Err(e) => { - crash!(BASE64_ARG_ERROR, "invalid wrap size: ‘{}’: {}", num, e); - } - }, - None => None, - }; - - Config { - decode: options.is_present(options::DECODE), - ignore_garbage: options.is_present(options::IGNORE_GARBAGE), - wrap_cols: cols, - to_read: file, - } - } -} - pub fn uumain(args: impl uucore::Args) -> i32 { let format = Format::Base64; let usage = get_usage(); - let app = App::new(executable!()) - .version(VERSION) - .about(SUMMARY) - .usage(&usage[..]) - .about(LONG_HELP) - // Format arguments. - .arg( - Arg::with_name(options::DECODE) - .short("d") - .long(options::DECODE) - .help("decode data"), - ) - .arg( - Arg::with_name(options::IGNORE_GARBAGE) - .short("i") - .long(options::IGNORE_GARBAGE) - .help("when decoding, ignore non-alphabetic characters"), - ) - .arg( - Arg::with_name(options::WRAP) - .short("w") - .long(options::WRAP) - .takes_value(true) - .help( - "wrap encoded lines after COLS character (default 76, 0 to disable wrapping)", - ), - ) - // "multiple" arguments are used to check whether there is more than one - // file passed in. - .arg(Arg::with_name(options::FILE).index(1).multiple(true)); + let name = executable!(); + let config_result: Result = + base_common::parse_base_cmd_args(args, name, VERSION, ABOUT, &usage); - let arg_list = args - .collect_str(InvalidEncodingHandling::ConvertLossy) - .accept_any(); - let config: Config = Config::from(app.get_matches_from(arg_list)); - match config.to_read { - // Read from file. - Some(name) => { - let file_buf = safe_unwrap!(File::open(Path::new(&name))); - let mut input = BufReader::new(file_buf); - base_common::handle_input( - &mut input, - format, - config.wrap_cols, - config.ignore_garbage, - config.decode, - ); + if config_result.is_err() { + match config_result { + Ok(_) => panic!(), + Err(s) => crash!(BASE_CMD_PARSE_ERROR, "{}", s), } - // stdin - None => { - base_common::handle_input( - &mut stdin().lock(), - format, - config.wrap_cols, - config.ignore_garbage, - config.decode, - ); - } - }; + } + + // Create a reference to stdin so we can return a locked stdin from + // parse_base_cmd_args + let stdin_raw = stdin(); + let config = config_result.unwrap(); + let mut input: Box = base_common::get_input(&config, &stdin_raw); + + base_common::handle_input( + &mut input, + format, + config.wrap_cols, + config.ignore_garbage, + config.decode, + name, + ); 0 } diff --git a/src/uu/base64/src/base_common.rs b/src/uu/base64/src/base_common.rs deleted file mode 100644 index a4b49e499..000000000 --- a/src/uu/base64/src/base_common.rs +++ /dev/null @@ -1,40 +0,0 @@ -// This file is part of the uutils coreutils package. -// -// (c) Jordy Dickinson -// (c) Jian Zeng -// (c) Alex Lyon -// -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. - -use std::io::{stdout, Read, Write}; - -use uucore::encoding::{wrap_print, Data, Format}; - -pub fn handle_input( - input: &mut R, - format: Format, - line_wrap: Option, - ignore_garbage: bool, - decode: bool, -) { - let mut data = Data::new(input, format).ignore_garbage(ignore_garbage); - if let Some(wrap) = line_wrap { - data = data.line_wrap(wrap); - } - - if !decode { - let encoded = data.encode(); - wrap_print(&data, encoded); - } else { - match data.decode() { - Ok(s) => { - if stdout().write_all(&s).is_err() { - // on windows console, writing invalid utf8 returns an error - crash!(1, "Cannot write non-utf8 data"); - } - } - Err(_) => crash!(1, "invalid input"), - } - } -} diff --git a/tests/by-util/test_base32.rs b/tests/by-util/test_base32.rs index 157503d83..fd49aa951 100644 --- a/tests/by-util/test_base32.rs +++ b/tests/by-util/test_base32.rs @@ -98,7 +98,7 @@ fn test_wrap_bad_arg() { .arg(wrap_param) .arg("b") .fails() - .stderr_only("base32: error: invalid wrap size: ‘b’: invalid digit found in string\n"); + .stderr_only("base32: error: Invalid wrap size: ‘b’: invalid digit found in string\n"); } } diff --git a/tests/by-util/test_base64.rs b/tests/by-util/test_base64.rs index c9adc5c0f..8d9dc5639 100644 --- a/tests/by-util/test_base64.rs +++ b/tests/by-util/test_base64.rs @@ -88,7 +88,7 @@ fn test_wrap_bad_arg() { .arg(wrap_param) .arg("b") .fails() - .stderr_only("base64: error: invalid wrap size: ‘b’: invalid digit found in string\n"); + .stderr_only("base64: error: Invalid wrap size: ‘b’: invalid digit found in string\n"); } } From 193ad56c2a5e9a615618de8e74368c8cc2c1baad Mon Sep 17 00:00:00 2001 From: Ricardo Iglesias Date: Thu, 29 Apr 2021 02:07:59 -0700 Subject: [PATCH 0509/1135] Removed clippy warnings. --- src/uu/base32/src/base_common.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/base32/src/base_common.rs b/src/uu/base32/src/base_common.rs index d0f47f500..ee5fe8675 100644 --- a/src/uu/base32/src/base_common.rs +++ b/src/uu/base32/src/base_common.rs @@ -83,7 +83,7 @@ pub fn parse_base_cmd_args( let app = App::new(name) .version(version) .about(about) - .usage(&usage[..]) + .usage(usage) // Format arguments. .arg( Arg::with_name(options::DECODE) From 83554f4475a2c1c9ddbfe33bedc9ef53bafd922d Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 1 May 2021 17:48:01 +0200 Subject: [PATCH 0510/1135] add benchmarking instructions --- src/uu/sort/BENCHMARKING.md | 6 ++++++ src/uu/sort/src/sort.rs | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/uu/sort/BENCHMARKING.md b/src/uu/sort/BENCHMARKING.md index 1caea0326..1810e8a4e 100644 --- a/src/uu/sort/BENCHMARKING.md +++ b/src/uu/sort/BENCHMARKING.md @@ -69,6 +69,12 @@ Run `cargo build --release` before benchmarking after you make a change! - Benchmark numeric sorting with hyperfine: `hyperfine "target/release/coreutils sort shuffled_numbers_si.txt -h -o output.txt"`. +## External sorting + +Try running commands with the `-S` option set to an amount of memory to be used, such as `1M`. Additionally, you could try sorting +huge files (ideally multiple Gigabytes) with `-S`. Creating such a large file can be achieved by running `cat shuffled_wordlist.txt | sort -R >> shuffled_wordlist.txt` +multiple times (this will add the contents of `shuffled_wordlist.txt` to itself). + ## Stdout and stdin performance Try to run the above benchmarks by piping the input through stdin (standard input) and redirect the diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 7c053e4ad..be7944a0f 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1169,9 +1169,7 @@ fn file_to_lines_iter<'a>( }) .map(move |line| { Line::new( - std::str::from_utf8(&line.unwrap()) - .expect("input is not valid utf-8") - .to_string(), + crash_if_err!(1, String::from_utf8(crash_if_err!(1, line))), settings, ) }), @@ -1226,7 +1224,7 @@ fn exec(files: Vec, settings: GlobalSettings) -> i32 { } else { b'\n' }) { - let string = String::from_utf8(line.unwrap()).unwrap(); + let string = crash_if_err!(1, String::from_utf8(crash_if_err!(1, line))); lines.push(Line::new(string, &settings)); } } From b21a309c3f75d77b7e1c4f21a145e8ff893509e3 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 1 May 2021 21:29:18 +0200 Subject: [PATCH 0511/1135] add a benchmarking example --- src/uu/sort/BENCHMARKING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uu/sort/BENCHMARKING.md b/src/uu/sort/BENCHMARKING.md index 1810e8a4e..17a944b29 100644 --- a/src/uu/sort/BENCHMARKING.md +++ b/src/uu/sort/BENCHMARKING.md @@ -74,6 +74,7 @@ Run `cargo build --release` before benchmarking after you make a change! Try running commands with the `-S` option set to an amount of memory to be used, such as `1M`. Additionally, you could try sorting huge files (ideally multiple Gigabytes) with `-S`. Creating such a large file can be achieved by running `cat shuffled_wordlist.txt | sort -R >> shuffled_wordlist.txt` multiple times (this will add the contents of `shuffled_wordlist.txt` to itself). +Example: Run `hyperfine "target/release/coreutils sort shuffled_wordlist.txt -S 1M"` ## Stdout and stdin performance From 484558e37dbc95ba583a4210205164ef5521655b Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 1 May 2021 21:38:36 +0200 Subject: [PATCH 0512/1135] Update src/uu/sort/BENCHMARKING.md Co-authored-by: Sylvestre Ledru --- src/uu/sort/BENCHMARKING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uu/sort/BENCHMARKING.md b/src/uu/sort/BENCHMARKING.md index 17a944b29..71c331105 100644 --- a/src/uu/sort/BENCHMARKING.md +++ b/src/uu/sort/BENCHMARKING.md @@ -74,7 +74,8 @@ Run `cargo build --release` before benchmarking after you make a change! Try running commands with the `-S` option set to an amount of memory to be used, such as `1M`. Additionally, you could try sorting huge files (ideally multiple Gigabytes) with `-S`. Creating such a large file can be achieved by running `cat shuffled_wordlist.txt | sort -R >> shuffled_wordlist.txt` multiple times (this will add the contents of `shuffled_wordlist.txt` to itself). -Example: Run `hyperfine "target/release/coreutils sort shuffled_wordlist.txt -S 1M"` +Example: Run `hyperfine './target/release/coreutils sort shuffled_wordlist.txt -S 1M' 'sort shuffled_wordlist.txt -S 1M'` +` ## Stdout and stdin performance From c3912d53ac1430b718cebbcf724de3af59a06e2e Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Thu, 22 Apr 2021 20:29:04 -0400 Subject: [PATCH 0513/1135] test: add tests for basic tests & edge cases Some edge cases covered: - no args - operator by itself (!, -a, etc.) - string, file tests of nothing - compound negations --- tests/by-util/test_test.rs | 442 ++++++++++++++++++++++++++++- tests/fixtures/test/non_empty_file | 1 + tests/fixtures/test/regular_file | 0 3 files changed, 442 insertions(+), 1 deletion(-) create mode 100644 tests/fixtures/test/non_empty_file create mode 100644 tests/fixtures/test/regular_file diff --git a/tests/by-util/test_test.rs b/tests/by-util/test_test.rs index 4b9a9ff55..2173371fc 100644 --- a/tests/by-util/test_test.rs +++ b/tests/by-util/test_test.rs @@ -2,6 +2,7 @@ // This file is part of the uutils coreutils package. // // (c) mahkoh (ju.orth [at] gmail [dot] com) +// (c) Daniel Rocco // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. @@ -9,6 +10,436 @@ use crate::common::util::*; +#[test] +fn test_empty_test_equivalent_to_false() { + new_ucmd!().run().status_code(1); +} + +#[test] +fn test_empty_string_is_false() { + new_ucmd!().arg("").run().status_code(1); +} + +#[test] +fn test_solo_not() { + new_ucmd!().arg("!").succeeds(); +} + +#[test] +fn test_solo_and_or_or_is_a_literal() { + // /bin/test '' -a '' => 1; so test(1) must interpret `-a` by itself as + // a literal string + new_ucmd!().arg("-a").succeeds(); + new_ucmd!().arg("-o").succeeds(); +} + +#[test] +fn test_double_not_is_false() { + new_ucmd!().args(&["!", "!"]).run().status_code(1); +} + +#[test] +#[ignore = "fixme: parse/evaluation error (code 2); GNU returns 1"] +fn test_and_not_is_false() { + new_ucmd!().args(&["-a", "!"]).run().status_code(1); +} + +#[test] +fn test_not_and_is_false() { + // `-a` is a literal here & has nonzero length + new_ucmd!().args(&["!", "-a"]).run().status_code(1); +} + +#[test] +#[ignore = "fixme: parse/evaluation error (code 2); GNU returns 0"] +fn test_not_and_not_succeeds() { + new_ucmd!().args(&["!", "-a", "!"]).succeeds(); +} + +#[test] +fn test_simple_or() { + new_ucmd!().args(&["foo", "-o", ""]).succeeds(); +} + +#[test] +#[ignore = "fixme: parse/evaluation error (code 0); GNU returns 1"] +fn test_negated_or() { + new_ucmd!() + .args(&["!", "foo", "-o", "bar"]) + .run() + .status_code(1); + new_ucmd!().args(&["foo", "-o", "!", "bar"]).succeeds(); + new_ucmd!() + .args(&["!", "foo", "-o", "!", "bar"]) + .run() + .status_code(1); +} + +#[test] +fn test_strlen_of_nothing() { + // odd but matches GNU, which must interpret -n as a literal here + new_ucmd!().arg("-n").succeeds(); +} + +#[test] +fn test_strlen_of_empty() { + new_ucmd!().args(&["-n", ""]).run().status_code(1); + + // STRING equivalent to -n STRING + new_ucmd!().arg("").run().status_code(1); +} + +#[test] +fn test_nothing_is_empty() { + // -z is a literal here and has nonzero length + new_ucmd!().arg("-z").succeeds(); +} + +#[test] +fn test_zero_len_of_empty() { + new_ucmd!().args(&["-z", ""]).succeeds(); +} + +#[test] +fn test_solo_paren_is_literal() { + let scenario = TestScenario::new(util_name!()); + let tests = [["("], [")"]]; + + for test in &tests { + scenario.ucmd().args(&test[..]).succeeds(); + } +} + +#[test] +#[ignore = "GNU considers this an error"] +fn test_solo_empty_parenthetical_is_error() { + new_ucmd!() + .args(&["(", ")"]) + .run() + .status_code(2) + .stderr_is("test: missing argument after ‘)’"); +} + +#[test] +fn test_zero_len_equals_zero_len() { + new_ucmd!().args(&["", "=", ""]).succeeds(); +} + +#[test] +fn test_zero_len_not_equals_zero_len_is_false() { + new_ucmd!().args(&["", "!=", ""]).run().status_code(1); +} + +#[test] +fn test_string_comparison() { + let scenario = TestScenario::new(util_name!()); + let tests = [ + ["foo", "!=", "bar"], + ["contained\nnewline", "=", "contained\nnewline"], + ["(", "=", "("], + ["(", "!=", ")"], + ["!", "=", "!"], + ]; + + for test in &tests { + scenario.ucmd().args(&test[..]).succeeds(); + } +} + +#[test] +#[ignore = "fixme: error reporting"] +fn test_dangling_string_comparison_is_error() { + new_ucmd!() + .args(&["missing_something", "="]) + .run() + .status_code(2) + .stderr_is("test: missing argument after ‘=’"); +} + +#[test] +fn test_stringop_is_literal_after_bang() { + let scenario = TestScenario::new(util_name!()); + let tests = [ + ["!", "="], + ["!", "!="], + ["!", "-eq"], + ["!", "-ne"], + ["!", "-lt"], + ["!", "-le"], + ["!", "-gt"], + ["!", "-ge"], + ["!", "-ef"], + ["!", "-nt"], + ["!", "-ot"], + ]; + + for test in &tests { + scenario.ucmd().args(&test[..]).run().status_code(1); + } +} + +#[test] +fn test_a_bunch_of_not() { + new_ucmd!() + .args(&["!", "", "!=", "", "-a", "!", "", "!=", ""]) + .succeeds(); +} + +#[test] +fn test_pseudofloat_equal() { + new_ucmd!().args(&["123.45", "=", "123.45"]).succeeds(); +} + +#[test] +fn test_pseudofloat_not_equal() { + new_ucmd!().args(&["123.45", "!=", "123.450"]).succeeds(); +} + +#[test] +fn test_negative_arg_is_a_string() { + new_ucmd!().arg("-12345").succeeds(); + new_ucmd!().arg("--qwert").succeeds(); +} + +#[test] +fn test_some_int_compares() { + let scenario = TestScenario::new(util_name!()); + + let tests = [ + ["0", "-eq", "0"], + ["0", "-ne", "1"], + ["421", "-lt", "3720"], + ["0", "-le", "0"], + ["11", "-gt", "10"], + ["1024", "-ge", "512"], + ["9223372036854775806", "-le", "9223372036854775807"], + ]; + + for test in &tests { + scenario.ucmd().args(&test[..]).succeeds(); + } +} + +#[test] +#[ignore = "fixme: evaluation error (code 1); GNU returns 0"] +fn test_values_greater_than_i64_allowed() { + new_ucmd!() + .args(&["9223372036854775808", "-gt", "0"]) + .succeeds(); +} + +#[test] +fn test_negative_int_compare() { + let scenario = TestScenario::new(util_name!()); + + let tests = [ + ["-1", "-eq", "-1"], + ["-1", "-ne", "-2"], + ["-3720", "-lt", "-421"], + ["-10", "-le", "-10"], + ["-21", "-gt", "-22"], + ["-128", "-ge", "-256"], + ["-9223372036854775808", "-le", "-9223372036854775807"], + ]; + + for test in &tests { + scenario.ucmd().args(&test[..]).succeeds(); + } +} + +#[test] +#[ignore = "fixme: error reporting"] +fn test_float_inequality_is_error() { + new_ucmd!() + .args(&["123.45", "-ge", "6"]) + .run() + .status_code(2) + .stderr_is("test: invalid integer ‘123.45’"); +} + +#[test] +#[ignore = "fixme: parse/evaluation error (code 2); GNU returns 1"] +fn test_file_is_itself() { + new_ucmd!() + .args(&["regular_file", "-ef", "regular_file"]) + .succeeds(); +} + +#[test] +#[ignore = "fixme: parse/evaluation error (code 2); GNU returns 1"] +fn test_file_is_newer_than_and_older_than_itself() { + // odd but matches GNU + new_ucmd!() + .args(&["regular_file", "-nt", "regular_file"]) + .run() + .status_code(1); + new_ucmd!() + .args(&["regular_file", "-ot", "regular_file"]) + .run() + .status_code(1); +} + +#[test] +#[ignore = "todo: implement these"] +fn test_newer_file() { + let scenario = TestScenario::new(util_name!()); + + scenario.cmd("touch").arg("newer_file").succeeds(); + scenario + .cmd("touch") + .args(&["-m", "-d", "last Thursday", "regular_file"]) + .succeeds(); + + scenario + .ucmd() + .args(&["newer_file", "-nt", "regular_file"]) + .succeeds(); + scenario + .ucmd() + .args(&["regular_file", "-ot", "newer_file"]) + .succeeds(); +} + +#[test] +fn test_file_exists() { + new_ucmd!().args(&["-e", "regular_file"]).succeeds(); +} + +#[test] +fn test_nonexistent_file_does_not_exist() { + new_ucmd!() + .args(&["-e", "nonexistent_file"]) + .run() + .status_code(1); +} + +#[test] +fn test_nonexistent_file_is_not_regular() { + new_ucmd!() + .args(&["-f", "nonexistent_file"]) + .run() + .status_code(1); +} + +#[test] +fn test_file_exists_and_is_regular() { + new_ucmd!().args(&["-f", "regular_file"]).succeeds(); +} + +#[test] +#[cfg(not(windows))] // FIXME: implement on Windows +fn test_file_is_readable() { + new_ucmd!().args(&["-r", "regular_file"]).succeeds(); +} + +#[test] +#[cfg(not(windows))] // FIXME: implement on Windows +fn test_file_is_not_readable() { + let scenario = TestScenario::new(util_name!()); + let mut ucmd = scenario.ucmd(); + let mut chmod = scenario.cmd("chmod"); + + scenario.fixtures.touch("crypto_file"); + chmod.args(&["u-r", "crypto_file"]).succeeds(); + + ucmd.args(&["!", "-r", "crypto_file"]).succeeds(); +} + +#[test] +#[cfg(not(windows))] // FIXME: implement on Windows +fn test_file_is_writable() { + new_ucmd!().args(&["-w", "regular_file"]).succeeds(); +} + +#[test] +#[cfg(not(windows))] // FIXME: implement on Windows +fn test_file_is_not_writable() { + let scenario = TestScenario::new(util_name!()); + let mut ucmd = scenario.ucmd(); + let mut chmod = scenario.cmd("chmod"); + + scenario.fixtures.touch("immutable_file"); + chmod.args(&["u-w", "immutable_file"]).succeeds(); + + ucmd.args(&["!", "-w", "immutable_file"]).succeeds(); +} + +#[test] +fn test_file_is_not_executable() { + new_ucmd!().args(&["!", "-x", "regular_file"]).succeeds(); +} + +#[test] +#[cfg(not(windows))] // FIXME: implement on Windows +fn test_file_is_executable() { + let scenario = TestScenario::new(util_name!()); + let mut chmod = scenario.cmd("chmod"); + + chmod.args(&["u+x", "regular_file"]).succeeds(); + + scenario.ucmd().args(&["-x", "regular_file"]).succeeds(); +} + +#[test] +fn test_is_not_empty() { + new_ucmd!().args(&["-s", "non_empty_file"]).succeeds(); +} + +#[test] +fn test_nonexistent_file_size_test_is_false() { + new_ucmd!() + .args(&["-s", "nonexistent_file"]) + .run() + .status_code(1); +} + +#[test] +fn test_not_is_not_empty() { + new_ucmd!().args(&["!", "-s", "regular_file"]).succeeds(); +} + +#[test] +#[cfg(not(windows))] +fn test_symlink_is_symlink() { + let scenario = TestScenario::new(util_name!()); + let mut ln = scenario.cmd("ln"); + + // creating symlinks requires admin on Windows + ln.args(&["-s", "regular_file", "symlink"]).succeeds(); + + // FIXME: implement on Windows + scenario.ucmd().args(&["-h", "symlink"]).succeeds(); + scenario.ucmd().args(&["-L", "symlink"]).succeeds(); +} + +#[test] +fn test_file_is_not_symlink() { + let scenario = TestScenario::new(util_name!()); + + scenario + .ucmd() + .args(&["!", "-h", "regular_file"]) + .succeeds(); + scenario + .ucmd() + .args(&["!", "-L", "regular_file"]) + .succeeds(); +} + +#[test] +fn test_nonexistent_file_is_not_symlink() { + let scenario = TestScenario::new(util_name!()); + + scenario + .ucmd() + .args(&["!", "-h", "nonexistent_file"]) + .succeeds(); + scenario + .ucmd() + .args(&["!", "-L", "nonexistent_file"]) + .succeeds(); +} + #[test] fn test_op_prec_and_or_1() { new_ucmd!().args(&[" ", "-o", "", "-a", ""]).succeeds(); @@ -23,5 +454,14 @@ fn test_op_prec_and_or_2() { #[test] fn test_or_as_filename() { - new_ucmd!().args(&["x", "-a", "-z", "-o"]).fails(); + new_ucmd!() + .args(&["x", "-a", "-z", "-o"]) + .run() + .status_code(1); +} + +#[test] +#[ignore = "GNU considers this an error"] +fn test_strlen_and_nothing() { + new_ucmd!().args(&["-n", "a", "-a"]).run().status_code(2); } diff --git a/tests/fixtures/test/non_empty_file b/tests/fixtures/test/non_empty_file new file mode 100644 index 000000000..34425caf6 --- /dev/null +++ b/tests/fixtures/test/non_empty_file @@ -0,0 +1 @@ +Not empty! diff --git a/tests/fixtures/test/regular_file b/tests/fixtures/test/regular_file new file mode 100644 index 000000000..e69de29bb From 3c126bad72f9f26245b4aad02b1267c38b248032 Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Mon, 26 Apr 2021 21:27:29 -0400 Subject: [PATCH 0514/1135] test: implement parenthesized expressions, additional tests - Replace the parser with a recursive descent implementation that handles parentheses and produces a stack of operations in postfix order. Parsing now operates directly on OsStrings passed by the uucore framework. - Replace the dispatch mechanism with a stack machine operating on the symbol stack produced by the parser. - Add tests for parenthesized expressions. - Begin testing character encoding handling. --- src/uu/test/src/parser.rs | 292 +++++++++++++++++++++++++ src/uu/test/src/test.rs | 436 ++++++++++++------------------------- tests/by-util/test_test.rs | 84 ++++++- 3 files changed, 504 insertions(+), 308 deletions(-) create mode 100644 src/uu/test/src/parser.rs diff --git a/src/uu/test/src/parser.rs b/src/uu/test/src/parser.rs new file mode 100644 index 000000000..f1ca9dad6 --- /dev/null +++ b/src/uu/test/src/parser.rs @@ -0,0 +1,292 @@ +// This file is part of the uutils coreutils package. +// +// (c) Daniel Rocco +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + +use std::ffi::OsString; +use std::iter::Peekable; + +/// Represents a parsed token from a test expression +#[derive(Debug, PartialEq)] +pub enum Symbol { + LParen, + Bang, + BoolOp(OsString), + Literal(OsString), + StringOp(OsString), + IntOp(OsString), + FileOp(OsString), + StrlenOp(OsString), + FiletestOp(OsString), + None, +} + +impl Symbol { + /// Create a new Symbol from an OsString. + /// + /// Returns Symbol::None in place of None + fn new(token: Option) -> Symbol { + match token { + Some(s) => match s.to_string_lossy().as_ref() { + "(" => Symbol::LParen, + "!" => Symbol::Bang, + "-a" | "-o" => Symbol::BoolOp(s), + "=" | "!=" => Symbol::StringOp(s), + "-eq" | "-ge" | "-gt" | "-le" | "-lt" | "-ne" => Symbol::IntOp(s), + "-ef" | "-nt" | "-ot" => Symbol::FileOp(s), + "-n" | "-z" => Symbol::StrlenOp(s), + "-b" | "-c" | "-d" | "-e" | "-f" | "-g" | "-G" | "-h" | "-k" | "-L" | "-O" + | "-p" | "-r" | "-s" | "-S" | "-t" | "-u" | "-w" | "-x" => Symbol::FiletestOp(s), + _ => Symbol::Literal(s), + }, + None => Symbol::None, + } + } + + /// Convert this Symbol into a Symbol::Literal, useful for cases where + /// test treats an operator as a string operand (test has no reserved + /// words). + /// + /// # Panics + /// + /// Panics if `self` is Symbol::None + fn into_literal(self) -> Symbol { + Symbol::Literal(match self { + Symbol::LParen => OsString::from("("), + Symbol::Bang => OsString::from("!"), + Symbol::BoolOp(s) + | Symbol::Literal(s) + | Symbol::StringOp(s) + | Symbol::IntOp(s) + | Symbol::FileOp(s) + | Symbol::StrlenOp(s) + | Symbol::FiletestOp(s) => s, + Symbol::None => panic!(), + }) + } +} + +/// Recursive descent parser for test, which converts a list of OsStrings +/// (typically command line arguments) into a stack of Symbols in postfix +/// order. +/// +/// Grammar: +/// +/// EXPR → TERM | EXPR BOOLOP EXPR +/// TERM → ( EXPR ) +/// TERM → ( ) +/// TERM → ! EXPR +/// TERM → UOP str +/// UOP → STRLEN | FILETEST +/// TERM → str OP str +/// TERM → str | 𝜖 +/// OP → STRINGOP | INTOP | FILEOP +/// STRINGOP → = | != +/// INTOP → -eq | -ge | -gt | -le | -lt | -ne +/// FILEOP → -ef | -nt | -ot +/// STRLEN → -n | -z +/// FILETEST → -b | -c | -d | -e | -f | -g | -G | -h | -k | -L | -O | -p | +/// -r | -s | -S | -t | -u | -w | -x +/// BOOLOP → -a | -o +/// +#[derive(Debug)] +struct Parser { + tokens: Peekable>, + pub stack: Vec, +} + +impl Parser { + /// Construct a new Parser from a `Vec` of tokens. + fn new(tokens: Vec) -> Parser { + Parser { + tokens: tokens.into_iter().peekable(), + stack: vec![], + } + } + + /// Fetch the next token from the input stream as a Symbol. + fn next_token(&mut self) -> Symbol { + Symbol::new(self.tokens.next()) + } + + /// Peek at the next token from the input stream, returning it as a Symbol. + /// The stream is unchanged and will return the same Symbol on subsequent + /// calls to `next()` or `peek()`. + fn peek(&mut self) -> Symbol { + Symbol::new(self.tokens.peek().map(|s| s.to_os_string())) + } + + /// Test if the next token in the stream is a BOOLOP (-a or -o), without + /// removing the token from the stream. + fn peek_is_boolop(&mut self) -> bool { + if let Symbol::BoolOp(_) = self.peek() { + true + } else { + false + } + } + + /// Parse an expression. + /// + /// EXPR → TERM | EXPR BOOLOP EXPR + fn expr(&mut self) { + if !self.peek_is_boolop() { + self.term(); + } + self.maybe_boolop(); + } + + /// Parse a term token and possible subsequent symbols: "(", "!", UOP, + /// literal, or None. + fn term(&mut self) { + let symbol = self.next_token(); + + match symbol { + Symbol::LParen => self.lparen(), + Symbol::Bang => self.bang(), + Symbol::StrlenOp(_) => self.uop(symbol), + Symbol::FiletestOp(_) => self.uop(symbol), + Symbol::None => self.stack.push(symbol), + literal => self.literal(literal), + } + } + + /// Parse a (possibly) parenthesized expression. + /// + /// test has no reserved keywords, so "(" will be interpreted as a literal + /// if it is followed by nothing or a comparison operator OP. + fn lparen(&mut self) { + match self.peek() { + // lparen is a literal when followed by nothing or comparison + Symbol::None | Symbol::StringOp(_) | Symbol::IntOp(_) | Symbol::FileOp(_) => { + self.literal(Symbol::Literal(OsString::from("("))); + } + // empty parenthetical + Symbol::Literal(s) if s == ")" => {} + _ => { + self.expr(); + match self.next_token() { + Symbol::Literal(s) if s == ")" => (), + _ => panic!("expected ‘)’"), + } + } + } + } + + /// Parse a (possibly) negated expression. + /// + /// Example cases: + /// + /// * `! =`: negate the result of the implicit string length test of `=` + /// * `! = foo`: compare the literal strings `!` and `foo` + /// * `! `: negate the result of the expression + /// + fn bang(&mut self) { + if let Symbol::StringOp(_) | Symbol::IntOp(_) | Symbol::FileOp(_) = self.peek() { + // we need to peek ahead one more token to disambiguate the first + // two cases listed above: case 1 — `! ` — and + // case 2: ` OP str`. + let peek2 = self.tokens.clone().nth(1); + + if peek2.is_none() { + // op is literal + let op = self.next_token().into_literal(); + self.stack.push(op); + self.stack.push(Symbol::Bang); + } else { + // bang is literal; parsing continues with op + self.literal(Symbol::Literal(OsString::from("!"))); + } + } else { + self.expr(); + self.stack.push(Symbol::Bang); + } + } + + /// Peek at the next token and parse it as a BOOLOP or string literal, + /// as appropriate. + fn maybe_boolop(&mut self) { + if self.peek_is_boolop() { + let token = self.tokens.next().unwrap(); // safe because we peeked + + // BoolOp by itself interpreted as Literal + if let Symbol::None = self.peek() { + self.literal(Symbol::Literal(token)) + } else { + self.boolop(Symbol::BoolOp(token)) + } + } + } + + /// Parse a Boolean expression. + /// + /// Logical and (-a) has higher precedence than or (-o), so in an + /// expression like `foo -o '' -a ''`, the and subexpression is evaluated + /// first. + fn boolop(&mut self, op: Symbol) { + if op == Symbol::BoolOp(OsString::from("-a")) { + self.term(); + self.stack.push(op); + self.maybe_boolop(); + } else { + self.expr(); + self.stack.push(op); + } + } + + /// Parse a (possible) unary argument test (string length or file + /// attribute check). + /// + /// If a UOP is followed by nothing it is interpreted as a literal string. + fn uop(&mut self, op: Symbol) { + match self.next_token() { + Symbol::None => self.stack.push(op.into_literal()), + symbol => { + self.stack.push(symbol.into_literal()); + self.stack.push(op); + } + } + } + + /// Parse a string literal, optionally followed by a comparison operator + /// and a second string literal. + fn literal(&mut self, token: Symbol) { + self.stack.push(token.into_literal()); + + // EXPR → str OP str + match self.peek() { + Symbol::StringOp(_) | Symbol::IntOp(_) | Symbol::FileOp(_) => { + let op = self.next_token(); + + match self.next_token() { + Symbol::None => panic!("missing argument after {:?}", op), + token => self.stack.push(token.into_literal()), + } + + self.stack.push(op); + } + _ => {} + } + } + + /// Parser entry point: parse the token stream `self.tokens`, storing the + /// resulting `Symbol` stack in `self.stack`. + fn parse(&mut self) -> Result<(), String> { + self.expr(); + + match self.tokens.next() { + Some(token) => Err(format!("extra argument ‘{}’", token.to_string_lossy())), + None => Ok(()), + } + } +} + +/// Parse the token stream `args`, returning a `Symbol` stack representing the +/// operations to perform in postfix order. +pub fn parse(args: Vec) -> Result, String> { + let mut p = Parser::new(args); + p.parse()?; + Ok(p.stack) +} diff --git a/src/uu/test/src/test.rs b/src/uu/test/src/test.rs index f882ff5ae..3e97af0a6 100644 --- a/src/uu/test/src/test.rs +++ b/src/uu/test/src/test.rs @@ -1,144 +1,154 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) mahkoh (ju.orth [at] gmail [dot] com) -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. +// This file is part of the uutils coreutils package. +// +// (c) mahkoh (ju.orth [at] gmail [dot] com) +// (c) Daniel Rocco +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. // spell-checker:ignore (ToDO) retval paren prec subprec cond -use std::collections::HashMap; -use std::str::from_utf8; +mod parser; -static NAME: &str = "test"; +use parser::{parse, Symbol}; +use std::ffi::{OsStr, OsString}; pub fn uumain(args: impl uucore::Args) -> i32 { - let args: Vec<_> = args.collect(); - // This is completely disregarding valid windows paths that aren't valid unicode - let args = args - .iter() - .map(|a| a.to_str().unwrap().as_bytes()) - .collect::>(); - if args.is_empty() { - return 2; - } - let args = if !args[0].ends_with(NAME.as_bytes()) { - &args[1..] - } else { - &args[..] - }; - let args = match args[0] { - b"[" => match args[args.len() - 1] { - b"]" => &args[1..args.len() - 1], - _ => return 2, - }, - _ => &args[1..args.len()], - }; - let mut error = false; - let retval = 1 - parse_expr(args, &mut error) as i32; - if error { - 2 - } else { - retval - } -} + // TODO: handle being called as `[` + let args: Vec<_> = args.skip(1).collect(); -fn one(args: &[&[u8]]) -> bool { - !args[0].is_empty() -} + let result = parse(args).and_then(|mut stack| eval(&mut stack)); -fn two(args: &[&[u8]], error: &mut bool) -> bool { - match args[0] { - b"!" => !one(&args[1..]), - b"-b" => path(args[1], PathCondition::BlockSpecial), - b"-c" => path(args[1], PathCondition::CharacterSpecial), - b"-d" => path(args[1], PathCondition::Directory), - b"-e" => path(args[1], PathCondition::Exists), - b"-f" => path(args[1], PathCondition::Regular), - b"-g" => path(args[1], PathCondition::GroupIdFlag), - b"-h" => path(args[1], PathCondition::SymLink), - b"-L" => path(args[1], PathCondition::SymLink), - b"-n" => one(&args[1..]), - b"-p" => path(args[1], PathCondition::Fifo), - b"-r" => path(args[1], PathCondition::Readable), - b"-S" => path(args[1], PathCondition::Socket), - b"-s" => path(args[1], PathCondition::NonEmpty), - b"-t" => isatty(args[1]), - b"-u" => path(args[1], PathCondition::UserIdFlag), - b"-w" => path(args[1], PathCondition::Writable), - b"-x" => path(args[1], PathCondition::Executable), - b"-z" => !one(&args[1..]), - _ => { - *error = true; - false - } - } -} - -fn three(args: &[&[u8]], error: &mut bool) -> bool { - match args[1] { - b"=" => args[0] == args[2], - b"==" => args[0] == args[2], - b"!=" => args[0] != args[2], - b"-eq" => integers(args[0], args[2], IntegerCondition::Equal), - b"-ne" => integers(args[0], args[2], IntegerCondition::Unequal), - b"-gt" => integers(args[0], args[2], IntegerCondition::Greater), - b"-ge" => integers(args[0], args[2], IntegerCondition::GreaterEqual), - b"-lt" => integers(args[0], args[2], IntegerCondition::Less), - b"-le" => integers(args[0], args[2], IntegerCondition::LessEqual), - _ => match args[0] { - b"!" => !two(&args[1..], error), - _ => { - *error = true; - false + match result { + Ok(result) => { + if result { + 0 + } else { + 1 } - }, - } -} - -fn four(args: &[&[u8]], error: &mut bool) -> bool { - match args[0] { - b"!" => !three(&args[1..], error), - _ => { - *error = true; - false + } + Err(e) => { + eprintln!("test: {}", e); + 2 } } } -enum IntegerCondition { - Equal, - Unequal, - Greater, - GreaterEqual, - Less, - LessEqual, -} +/// Evaluate a stack of Symbols, returning the result of the evaluation or +/// an error message if evaluation failed. +fn eval(stack: &mut Vec) -> Result { + macro_rules! pop_literal { + () => { + match stack.pop() { + Some(Symbol::Literal(s)) => s, + _ => panic!(), + } + }; + } -fn integers(a: &[u8], b: &[u8], cond: IntegerCondition) -> bool { - let (a, b): (&str, &str) = match (from_utf8(a), from_utf8(b)) { - (Ok(a), Ok(b)) => (a, b), - _ => return false, - }; - let (a, b): (i64, i64) = match (a.parse(), b.parse()) { - (Ok(a), Ok(b)) => (a, b), - _ => return false, - }; - match cond { - IntegerCondition::Equal => a == b, - IntegerCondition::Unequal => a != b, - IntegerCondition::Greater => a > b, - IntegerCondition::GreaterEqual => a >= b, - IntegerCondition::Less => a < b, - IntegerCondition::LessEqual => a <= b, + let s = stack.pop(); + + match s { + Some(Symbol::Bang) => { + let result = eval(stack)?; + + Ok(!result) + } + Some(Symbol::StringOp(op)) => { + let b = stack.pop(); + let a = stack.pop(); + Ok(if op == "=" { a == b } else { a != b }) + } + Some(Symbol::IntOp(op)) => { + let b = pop_literal!(); + let a = pop_literal!(); + + Ok(integers(&a, &b, &op)?) + } + Some(Symbol::FileOp(_op)) => unimplemented!(), + Some(Symbol::StrlenOp(op)) => { + let s = match stack.pop() { + Some(Symbol::Literal(s)) => s, + Some(Symbol::None) => OsString::from(""), + None => { + return Ok(true); + } + _ => { + return Err(format!("missing argument after ‘{:?}’", op)); + } + }; + + Ok(if op == "-z" { + s.is_empty() + } else { + !s.is_empty() + }) + } + Some(Symbol::FiletestOp(op)) => { + let op = op.to_string_lossy(); + + let f = pop_literal!(); + + Ok(match op.as_ref() { + "-b" => path(&f, PathCondition::BlockSpecial), + "-c" => path(&f, PathCondition::CharacterSpecial), + "-d" => path(&f, PathCondition::Directory), + "-e" => path(&f, PathCondition::Exists), + "-f" => path(&f, PathCondition::Regular), + "-g" => path(&f, PathCondition::GroupIdFlag), + "-h" => path(&f, PathCondition::SymLink), + "-L" => path(&f, PathCondition::SymLink), + "-p" => path(&f, PathCondition::Fifo), + "-r" => path(&f, PathCondition::Readable), + "-S" => path(&f, PathCondition::Socket), + "-s" => path(&f, PathCondition::NonEmpty), + "-t" => isatty(&f)?, + "-u" => path(&f, PathCondition::UserIdFlag), + "-w" => path(&f, PathCondition::Writable), + "-x" => path(&f, PathCondition::Executable), + _ => panic!(), + }) + } + Some(Symbol::Literal(s)) => Ok(!s.is_empty()), + Some(Symbol::None) => Ok(false), + Some(Symbol::BoolOp(op)) => { + let b = eval(stack)?; + let a = eval(stack)?; + + Ok(if op == "-a" { a && b } else { a || b }) + } + None => Ok(false), + _ => Err("expected value".to_string()), } } -fn isatty(fd: &[u8]) -> bool { - from_utf8(fd) - .ok() - .and_then(|s| s.parse().ok()) - .map_or(false, |i| { +fn integers(a: &OsStr, b: &OsStr, cond: &OsStr) -> Result { + let format_err = |value| format!("invalid integer ‘{}’", value); + + let a = a.to_string_lossy(); + let a: i64 = a.parse().map_err(|_| format_err(a))?; + + let b = b.to_string_lossy(); + let b: i64 = b.parse().map_err(|_| format_err(b))?; + + let cond = cond.to_string_lossy(); + Ok(match cond.as_ref() { + "-eq" => a == b, + "-ne" => a != b, + "-gt" => a > b, + "-ge" => a >= b, + "-lt" => a < b, + "-le" => a <= b, + _ => return Err(format!("unknown operator ‘{}’", cond)), + }) +} + +fn isatty(fd: &OsStr) -> Result { + let fd = fd.to_string_lossy(); + + fd.parse() + .map_err(|_| format!("invalid integer ‘{}’", fd)) + .map(|i| { #[cfg(not(target_os = "redox"))] unsafe { libc::isatty(i) == 1 @@ -148,173 +158,6 @@ fn isatty(fd: &[u8]) -> bool { }) } -fn dispatch(args: &mut &[&[u8]], error: &mut bool) -> bool { - let (val, idx) = match args.len() { - 0 => { - *error = true; - (false, 0) - } - 1 => (one(*args), 1), - 2 => dispatch_two(args, error), - 3 => dispatch_three(args, error), - _ => dispatch_four(args, error), - }; - *args = &(*args)[idx..]; - val -} - -fn dispatch_two(args: &mut &[&[u8]], error: &mut bool) -> (bool, usize) { - let val = two(*args, error); - if *error { - *error = false; - (one(*args), 1) - } else { - (val, 2) - } -} - -fn dispatch_three(args: &mut &[&[u8]], error: &mut bool) -> (bool, usize) { - let val = three(*args, error); - if *error { - *error = false; - dispatch_two(args, error) - } else { - (val, 3) - } -} - -fn dispatch_four(args: &mut &[&[u8]], error: &mut bool) -> (bool, usize) { - let val = four(*args, error); - if *error { - *error = false; - dispatch_three(args, error) - } else { - (val, 4) - } -} - -#[derive(Clone, Copy)] -enum Precedence { - Unknown = 0, - Paren, // FIXME: this is useless (parentheses have not been implemented) - Or, - And, - BUnOp, - BinOp, - UnOp, -} - -fn parse_expr(mut args: &[&[u8]], error: &mut bool) -> bool { - if args.is_empty() { - false - } else { - let hashmap = setup_hashmap(); - let lhs = dispatch(&mut args, error); - - if !args.is_empty() { - parse_expr_helper(&hashmap, &mut args, lhs, Precedence::Unknown, error) - } else { - lhs - } - } -} - -fn parse_expr_helper<'a>( - hashmap: &HashMap<&'a [u8], Precedence>, - args: &mut &[&'a [u8]], - mut lhs: bool, - min_prec: Precedence, - error: &mut bool, -) -> bool { - let mut prec = *hashmap.get(&args[0]).unwrap_or_else(|| { - *error = true; - &min_prec - }); - while !*error && !args.is_empty() && prec as usize >= min_prec as usize { - let op = args[0]; - *args = &(*args)[1..]; - let mut rhs = dispatch(args, error); - while !args.is_empty() { - let subprec = *hashmap.get(&args[0]).unwrap_or_else(|| { - *error = true; - &min_prec - }); - if subprec as usize <= prec as usize || *error { - break; - } - rhs = parse_expr_helper(hashmap, args, rhs, subprec, error); - } - lhs = match prec { - Precedence::UnOp | Precedence::BUnOp => { - *error = true; - false - } - Precedence::And => lhs && rhs, - Precedence::Or => lhs || rhs, - Precedence::BinOp => three( - &[ - if lhs { b" " } else { b"" }, - op, - if rhs { b" " } else { b"" }, - ], - error, - ), - Precedence::Paren => unimplemented!(), // TODO: implement parentheses - _ => unreachable!(), - }; - if !args.is_empty() { - prec = *hashmap.get(&args[0]).unwrap_or_else(|| { - *error = true; - &min_prec - }); - } - } - lhs -} - -#[inline] -fn setup_hashmap<'a>() -> HashMap<&'a [u8], Precedence> { - let mut hashmap = HashMap::<&'a [u8], Precedence>::new(); - - hashmap.insert(b"-b", Precedence::UnOp); - hashmap.insert(b"-c", Precedence::UnOp); - hashmap.insert(b"-d", Precedence::UnOp); - hashmap.insert(b"-e", Precedence::UnOp); - hashmap.insert(b"-f", Precedence::UnOp); - hashmap.insert(b"-g", Precedence::UnOp); - hashmap.insert(b"-h", Precedence::UnOp); - hashmap.insert(b"-L", Precedence::UnOp); - hashmap.insert(b"-n", Precedence::UnOp); - hashmap.insert(b"-p", Precedence::UnOp); - hashmap.insert(b"-r", Precedence::UnOp); - hashmap.insert(b"-S", Precedence::UnOp); - hashmap.insert(b"-s", Precedence::UnOp); - hashmap.insert(b"-t", Precedence::UnOp); - hashmap.insert(b"-u", Precedence::UnOp); - hashmap.insert(b"-w", Precedence::UnOp); - hashmap.insert(b"-x", Precedence::UnOp); - hashmap.insert(b"-z", Precedence::UnOp); - - hashmap.insert(b"=", Precedence::BinOp); - hashmap.insert(b"!=", Precedence::BinOp); - hashmap.insert(b"-eq", Precedence::BinOp); - hashmap.insert(b"-ne", Precedence::BinOp); - hashmap.insert(b"-gt", Precedence::BinOp); - hashmap.insert(b"-ge", Precedence::BinOp); - hashmap.insert(b"-lt", Precedence::BinOp); - hashmap.insert(b"-le", Precedence::BinOp); - - hashmap.insert(b"!", Precedence::BUnOp); - - hashmap.insert(b"-a", Precedence::And); - hashmap.insert(b"-o", Precedence::Or); - - hashmap.insert(b"(", Precedence::Paren); - hashmap.insert(b")", Precedence::Paren); - - hashmap -} - #[derive(Eq, PartialEq)] enum PathCondition { BlockSpecial, @@ -334,14 +177,10 @@ enum PathCondition { } #[cfg(not(windows))] -fn path(path: &[u8], cond: PathCondition) -> bool { - use std::ffi::OsStr; +fn path(path: &OsStr, cond: PathCondition) -> bool { use std::fs::{self, Metadata}; - use std::os::unix::ffi::OsStrExt; use std::os::unix::fs::{FileTypeExt, MetadataExt}; - let path = OsStr::from_bytes(path); - const S_ISUID: u32 = 0o4000; const S_ISGID: u32 = 0o2000; @@ -403,13 +242,14 @@ fn path(path: &[u8], cond: PathCondition) -> bool { } #[cfg(windows)] -fn path(path: &[u8], cond: PathCondition) -> bool { +fn path(path: &OsStr, cond: PathCondition) -> bool { use std::fs::metadata; - let path = from_utf8(path).unwrap(); + let stat = match metadata(path) { Ok(s) => s, _ => return false, }; + match cond { PathCondition::BlockSpecial => false, PathCondition::CharacterSpecial => false, diff --git a/tests/by-util/test_test.rs b/tests/by-util/test_test.rs index 2173371fc..000013d9c 100644 --- a/tests/by-util/test_test.rs +++ b/tests/by-util/test_test.rs @@ -39,7 +39,6 @@ fn test_double_not_is_false() { } #[test] -#[ignore = "fixme: parse/evaluation error (code 2); GNU returns 1"] fn test_and_not_is_false() { new_ucmd!().args(&["-a", "!"]).run().status_code(1); } @@ -51,7 +50,6 @@ fn test_not_and_is_false() { } #[test] -#[ignore = "fixme: parse/evaluation error (code 2); GNU returns 0"] fn test_not_and_not_succeeds() { new_ucmd!().args(&["!", "-a", "!"]).succeeds(); } @@ -62,7 +60,6 @@ fn test_simple_or() { } #[test] -#[ignore = "fixme: parse/evaluation error (code 0); GNU returns 1"] fn test_negated_or() { new_ucmd!() .args(&["!", "foo", "-o", "bar"]) @@ -111,13 +108,8 @@ fn test_solo_paren_is_literal() { } #[test] -#[ignore = "GNU considers this an error"] fn test_solo_empty_parenthetical_is_error() { - new_ucmd!() - .args(&["(", ")"]) - .run() - .status_code(2) - .stderr_is("test: missing argument after ‘)’"); + new_ucmd!().args(&["(", ")"]).run().status_code(2); } #[test] @@ -248,7 +240,6 @@ fn test_negative_int_compare() { } #[test] -#[ignore = "fixme: error reporting"] fn test_float_inequality_is_error() { new_ucmd!() .args(&["123.45", "-ge", "6"]) @@ -257,6 +248,32 @@ fn test_float_inequality_is_error() { .stderr_is("test: invalid integer ‘123.45’"); } +#[test] +#[cfg(not(windows))] +fn test_invalid_utf8_integer_compare() { + use std::ffi::OsStr; + use std::os::unix::ffi::OsStrExt; + + let source = [0x66, 0x6f, 0x80, 0x6f]; + let arg = OsStr::from_bytes(&source[..]); + + let mut cmd = new_ucmd!(); + cmd.arg("123").arg("-ne"); + cmd.raw.arg(arg); + + cmd.run() + .status_code(2) + .stderr_is("test: invalid integer ‘fo�o’"); + + let mut cmd = new_ucmd!(); + cmd.raw.arg(arg); + cmd.arg("-eq").arg("456"); + + cmd.run() + .status_code(2) + .stderr_is("test: invalid integer ‘fo�o’"); +} + #[test] #[ignore = "fixme: parse/evaluation error (code 2); GNU returns 1"] fn test_file_is_itself() { @@ -445,6 +462,14 @@ fn test_op_prec_and_or_1() { new_ucmd!().args(&[" ", "-o", "", "-a", ""]).succeeds(); } +#[test] +fn test_op_prec_and_or_1_overridden_by_parentheses() { + new_ucmd!() + .args(&["(", " ", "-o", "", ")", "-a", ""]) + .run() + .status_code(1); +} + #[test] fn test_op_prec_and_or_2() { new_ucmd!() @@ -452,6 +477,45 @@ fn test_op_prec_and_or_2() { .succeeds(); } +#[test] +fn test_op_prec_and_or_2_overridden_by_parentheses() { + new_ucmd!() + .args(&["", "-a", "(", "", "-o", " ", ")", "-a", " "]) + .run() + .status_code(1); +} + +#[test] +#[ignore = "fixme: error reporting"] +fn test_dangling_parenthesis() { + new_ucmd!() + .args(&["(", "(", "a", "!=", "b", ")", "-o", "-n", "c"]) + .run() + .status_code(2); + new_ucmd!() + .args(&["(", "(", "a", "!=", "b", ")", "-o", "-n", "c", ")"]) + .succeeds(); +} + +#[test] +fn test_complicated_parenthesized_expression() { + new_ucmd!() + .args(&[ + "(", "(", "!", "(", "a", "=", "b", ")", "-o", "c", "=", "d", ")", "-a", "(", "q", "!=", + "r", ")", ")", + ]) + .succeeds(); +} + +#[test] +fn test_erroneous_parenthesized_expression() { + new_ucmd!() + .args(&["a", "!=", "(", "b", "-a", "b", ")", "!=", "c"]) + .run() + .status_code(2) + .stderr_is("test: extra argument ‘b’"); +} + #[test] fn test_or_as_filename() { new_ucmd!() From f5c7d9bd80c27341efad1af981e69d9e47d47234 Mon Sep 17 00:00:00 2001 From: Dean Li Date: Sat, 1 May 2021 09:51:31 +0800 Subject: [PATCH 0515/1135] link: replace getopts with clap --- Cargo.lock | 1 + src/uu/link/Cargo.toml | 1 + src/uu/link/src/link.rs | 44 +++++++++++++++++++++++++++++------------ 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 31787e626..217533df6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2050,6 +2050,7 @@ dependencies = [ name = "uu_link" version = "0.0.6" dependencies = [ + "clap", "libc", "uucore", "uucore_procs", diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index 13c3453cf..14a6ac7c9 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -18,6 +18,7 @@ path = "src/link.rs" libc = "0.2.42" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +clap = "2.33" [[bin]] name = "link" diff --git a/src/uu/link/src/link.rs b/src/uu/link/src/link.rs index b82d7cfac..bd8b33355 100644 --- a/src/uu/link/src/link.rs +++ b/src/uu/link/src/link.rs @@ -8,14 +8,21 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs::hard_link; use std::io::Error; use std::path::Path; -use uucore::InvalidEncodingHandling; -static SYNTAX: &str = "[OPTIONS] FILE1 FILE2"; -static SUMMARY: &str = "Create a link named FILE2 to FILE1"; -static LONG_HELP: &str = ""; +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Call the link function to create a link named FILE2 to an existing FILE1."; + +pub mod options { + pub static FILES: &str = "FILES"; +} + +fn get_usage() -> String { + format!("{0} FILE1 FILE2", executable!()) +} pub fn normalize_error_message(e: Error) -> String { match e.raw_os_error() { @@ -25,16 +32,27 @@ pub fn normalize_error_message(e: Error) -> String { } pub fn uumain(args: impl uucore::Args) -> i32 { - let matches = app!(SYNTAX, SUMMARY, LONG_HELP).parse( - args.collect_str(InvalidEncodingHandling::Ignore) - .accept_any(), - ); - if matches.free.len() != 2 { - crash!(1, "{}", msg_wrong_number_of_arguments!(2)); - } + let usage = get_usage(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(options::FILES) + .hidden(true) + .required(true) + .min_values(2) + .max_values(2) + .takes_value(true), + ) + .get_matches_from(args); - let old = Path::new(&matches.free[0]); - let new = Path::new(&matches.free[1]); + let files: Vec<_> = matches + .values_of_os(options::FILES) + .unwrap_or_default() + .collect(); + let old = Path::new(files[0]); + let new = Path::new(files[1]); match hard_link(old, new) { Ok(_) => 0, From 42756610206e5efd8ac1a0687b9d856d7b21e68a Mon Sep 17 00:00:00 2001 From: bashi8128 Date: Sun, 2 May 2021 13:47:36 +0900 Subject: [PATCH 0516/1135] tests/basename: add tests for --version, --help --- tests/by-util/test_basename.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/by-util/test_basename.rs b/tests/by-util/test_basename.rs index 8d32b4008..6c7a3ecae 100644 --- a/tests/by-util/test_basename.rs +++ b/tests/by-util/test_basename.rs @@ -1,6 +1,29 @@ use crate::common::util::*; use std::ffi::OsStr; +#[test] +fn test_help() { + for help_flg in vec!["-h", "--help"] { + new_ucmd!() + .arg(&help_flg) + .succeeds() + .no_stderr() + .stdout_contains("USAGE:"); + } +} + +#[test] +fn test_version() { + for version_flg in vec!["-V", "--version"] { + assert!(new_ucmd!() + .arg(&version_flg) + .succeeds() + .no_stderr() + .stdout_str() + .starts_with("basename")); + } +} + #[test] fn test_directory() { new_ucmd!() From 5e82b195bd3f8da8e34e4ccf061227498af3abf1 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 2 May 2021 09:35:00 +0200 Subject: [PATCH 0517/1135] ls: remove redundant import --- src/uu/ls/src/ls.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index dc7ea4c08..381612189 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -39,8 +39,6 @@ use std::{ time::Duration, }; -use chrono; - use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use unicode_width::UnicodeWidthStr; From e723b8db4321a56ddfe1fec5c538ac88370aff40 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 2 May 2021 09:35:59 +0200 Subject: [PATCH 0518/1135] factor: unneeded statement --- src/uu/factor/src/factor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 5a85194c4..138254b51 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -172,7 +172,7 @@ pub fn factor(mut n: u64) -> Factors { #[cfg(feature = "coz")] coz::end!("factorization"); - return r; + r } #[cfg(test)] From 108f9928ef77a6d1b811140a87a0ad053e400ef5 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 2 May 2021 09:39:09 +0200 Subject: [PATCH 0519/1135] cp: fix 'variable does not need to be mutable' --- src/uu/cp/src/cp.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index ca564e37c..3d6faf66a 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -551,6 +551,10 @@ impl FromStr for Attribute { fn add_all_attributes() -> Vec { use Attribute::*; + #[cfg(target_os = "windows")] + let attr = vec![Ownership, Timestamps, Context, Xattr, Links]; + + #[cfg(not(target_os = "windows"))] let mut attr = vec![Ownership, Timestamps, Context, Xattr, Links]; #[cfg(unix)] From c03a7d88561106f1fef24c1ea805513bd0283ff2 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 2 May 2021 09:41:04 +0200 Subject: [PATCH 0520/1135] uname(test): fix 'unused variable: result' --- tests/by-util/test_uname.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_uname.rs b/tests/by-util/test_uname.rs index 6b8d2d59d..da901d985 100644 --- a/tests/by-util/test_uname.rs +++ b/tests/by-util/test_uname.rs @@ -36,7 +36,12 @@ fn test_uname_kernel_version() { fn test_uname_kernel() { let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("-o").succeeds(); #[cfg(target_os = "linux")] - assert!(result.stdout_str().to_lowercase().contains("linux")); + { + let result = ucmd.arg("-o").succeeds(); + assert!(result.stdout_str().to_lowercase().contains("linux")); + } + + #[cfg(not(target_os = "linux"))] + let result = ucmd.arg("-o").succeeds(); } From a34b49ad6053e29ba457f2a43deab21f48ccdf68 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 2 May 2021 09:42:30 +0200 Subject: [PATCH 0521/1135] relpath(test) - fix: 'value assigned to 'result_stdout' is never read' --- tests/by-util/test_relpath.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/by-util/test_relpath.rs b/tests/by-util/test_relpath.rs index cc17b45c3..5094d25a8 100644 --- a/tests/by-util/test_relpath.rs +++ b/tests/by-util/test_relpath.rs @@ -103,7 +103,7 @@ fn test_relpath_with_from_with_d() { at.mkdir_all(from); // d is part of subpath -> expect relative path - let mut result_stdout = scene + let mut _result_stdout = scene .ucmd() .arg(to) .arg(from) @@ -112,17 +112,17 @@ fn test_relpath_with_from_with_d() { .stdout_move_str(); // relax rules for windows test environment #[cfg(not(windows))] - assert!(Path::new(&result_stdout).is_relative()); + assert!(Path::new(&_result_stdout).is_relative()); // d is not part of subpath -> expect absolut path - result_stdout = scene + _result_stdout = scene .ucmd() .arg(to) .arg(from) .arg("-dnon_existing") .succeeds() .stdout_move_str(); - assert!(Path::new(&result_stdout).is_absolute()); + assert!(Path::new(&_result_stdout).is_absolute()); } } @@ -135,12 +135,12 @@ fn test_relpath_no_from_no_d() { let to: &str = &convert_path(test.to); at.mkdir_all(to); - let result_stdout = scene.ucmd().arg(to).succeeds().stdout_move_str(); + let _result_stdout = scene.ucmd().arg(to).succeeds().stdout_move_str(); #[cfg(not(windows))] - assert_eq!(result_stdout, format!("{}\n", to)); + assert_eq!(_result_stdout, format!("{}\n", to)); // relax rules for windows test environment #[cfg(windows)] - assert!(result_stdout.ends_with(&format!("{}\n", to))); + assert!(_result_stdout.ends_with(&format!("{}\n", to))); } } From d0512618d5212d8991556a98c44bb688144c4d45 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 2 May 2021 09:43:32 +0200 Subject: [PATCH 0522/1135] refresh cargo.lock with recent updates --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 091758278..c74f4e2be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1277,9 +1277,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efb2352a0f4d4b128f734b5c44c79ff80117351138733f12f982fe3e2b13343" +checksum = "ce5f1ceb7f74abbce32601642fcf8e8508a8a8991e0621c7d750295b9095702b" dependencies = [ "aho-corasick", "memchr 2.4.0", @@ -1297,9 +1297,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.24" +version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00efb87459ba4f6fb2169d20f68565555688e1250ee6825cdf6254f8b48fafb2" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] name = "remove_dir_all" From 28c7800f73ec2712a296fd930a9e7706efa6a9bd Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 2 May 2021 10:03:01 +0200 Subject: [PATCH 0523/1135] ls: fix subdirectory name --- src/uu/ls/src/ls.rs | 25 ++++++++++------ tests/by-util/test_ls.rs | 63 ++++++++++++++++++++++++++++++++++------ 2 files changed, 70 insertions(+), 18 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index dc7ea4c08..4ebcc479c 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1122,14 +1122,21 @@ impl PathData { fn new( p_buf: PathBuf, file_type: Option>, + file_name: Option, config: &Config, command_line: bool, ) -> Self { - let name = p_buf - .file_name() - .unwrap_or_else(|| p_buf.iter().next_back().unwrap()) - .to_string_lossy() - .into_owned(); + // We cannot use `Path::ends_with` or `Path::Components`, because they remove occurrences of '.' + // For '..', the filename is None + let name = if let Some(name) = file_name { + name + } else { + p_buf + .file_name() + .unwrap_or_else(|| p_buf.iter().next_back().unwrap()) + .to_string_lossy() + .into_owned() + }; let must_dereference = match &config.dereference { Dereference::All => true, Dereference::Args => command_line, @@ -1192,7 +1199,7 @@ fn list(locs: Vec, config: Config) -> i32 { continue; } - let path_data = PathData::new(p, None, &config, true); + let path_data = PathData::new(p, None, None, &config, true); let show_dir_contents = if let Some(ft) = path_data.file_type() { !config.directory && ft.is_dir() @@ -1283,8 +1290,8 @@ fn should_display(entry: &DirEntry, config: &Config) -> bool { fn enter_directory(dir: &PathData, config: &Config, out: &mut BufWriter) { let mut entries: Vec<_> = if config.files == Files::All { vec![ - PathData::new(dir.p_buf.join("."), None, config, false), - PathData::new(dir.p_buf.join(".."), None, config, false), + PathData::new(dir.p_buf.join("."), None, Some(".".into()), config, false), + PathData::new(dir.p_buf.join(".."), None, Some("..".into()), config, false), ] } else { vec![] @@ -1293,7 +1300,7 @@ fn enter_directory(dir: &PathData, config: &Config, out: &mut BufWriter) let mut temp: Vec<_> = safe_unwrap!(fs::read_dir(&dir.p_buf)) .map(|res| safe_unwrap!(res)) .filter(|e| should_display(e, config)) - .map(|e| PathData::new(DirEntry::path(&e), Some(e.file_type()), config, false)) + .map(|e| PathData::new(DirEntry::path(&e), Some(e.file_type()), None, config, false)) .collect(); sort_entries(&mut temp, config); diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 2b8f311d1..0331d0214 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -43,23 +43,68 @@ fn test_ls_a() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.touch(".test-1"); + at.mkdir("some-dir"); + at.touch( + Path::new("some-dir") + .join(".test-2") + .as_os_str() + .to_str() + .unwrap(), + ); - let result = scene.ucmd().succeeds(); - let stdout = result.stdout_str(); - assert!(!stdout.contains(".test-1")); - assert!(!stdout.contains("..")); + let re_pwd = Regex::new(r"^\.\n").unwrap(); + + // Using the present working directory + scene + .ucmd() + .succeeds() + .stdout_does_not_contain(".test-1") + .stdout_does_not_contain("..") + .stdout_does_not_match(&re_pwd); scene .ucmd() .arg("-a") .succeeds() .stdout_contains(&".test-1") - .stdout_contains(&".."); + .stdout_contains(&"..") + .stdout_matches(&re_pwd); - let result = scene.ucmd().arg("-A").succeeds(); - result.stdout_contains(".test-1"); - let stdout = result.stdout_str(); - assert!(!stdout.contains("..")); + scene + .ucmd() + .arg("-A") + .succeeds() + .stdout_contains(".test-1") + .stdout_does_not_contain("..") + .stdout_does_not_match(&re_pwd); + + // Using a subdirectory + scene + .ucmd() + .arg("some-dir") + .succeeds() + .stdout_does_not_contain(".test-2") + .stdout_does_not_contain("..") + .stdout_does_not_match(&re_pwd); + + scene + .ucmd() + .arg("-a") + .arg("some-dir") + .succeeds() + .stdout_contains(&".test-2") + .stdout_contains(&"..") + .no_stderr() + .stdout_matches(&re_pwd); + + scene + .ucmd() + .arg("-A") + .arg("some-dir") + .succeeds() + .stdout_contains(".test-2") + .stdout_does_not_contain("..") + .stdout_does_not_match(&re_pwd); } #[test] From 361408cbe53e37e5b42a4d2b496cb03b2334f406 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 2 May 2021 10:04:11 +0200 Subject: [PATCH 0524/1135] ls: remove case-insensitivity and leading period of name sort --- src/uu/ls/BENCHMARKING.md | 2 ++ src/uu/ls/src/ls.rs | 10 ++-------- tests/by-util/test_ls.rs | 3 +-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/uu/ls/BENCHMARKING.md b/src/uu/ls/BENCHMARKING.md index 852220496..b009b703a 100644 --- a/src/uu/ls/BENCHMARKING.md +++ b/src/uu/ls/BENCHMARKING.md @@ -36,6 +36,8 @@ args="$@" hyperfine "ls $args" "target/release/coreutils ls $args" ``` +**Note**: No localization is currently implemented. This means that the comparison above is not really fair. We can fix this by setting `LC_ALL=C`, so GNU `ls` can ignore localization. + ## Checking system call count - Another thing to look at would be system calls count using strace (on linux) or equivalent on other operating systems. diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 4ebcc479c..2e8a5e5ed 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1244,14 +1244,8 @@ fn sort_entries(entries: &mut Vec, config: &Config) { entries.sort_by_key(|k| Reverse(k.md().as_ref().map(|md| md.len()).unwrap_or(0))) } // The default sort in GNU ls is case insensitive - Sort::Name => entries.sort_by_cached_key(|k| { - let has_dot: bool = k.file_name.starts_with('.'); - let filename_nodot: &str = &k.file_name[if has_dot { 1 } else { 0 }..]; - // We want hidden files to appear before regular files of the same - // name, so we need to negate the "has_dot" variable. - (filename_nodot.to_lowercase(), !has_dot) - }), - Sort::Version => entries.sort_by(|k, j| version_cmp::version_cmp(&k.p_buf, &j.p_buf)), + Sort::Name => entries.sort_by(|a, b| a.file_name.cmp(&b.file_name)), + Sort::Version => entries.sort_by(|a, b| version_cmp::version_cmp(&a.p_buf, &b.p_buf)), Sort::Extension => entries.sort_by(|a, b| { a.p_buf .extension() diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 0331d0214..4be24a99a 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -527,7 +527,6 @@ fn test_ls_sort_name() { .succeeds() .stdout_is(["test-1", "test-2", "test-3\n"].join(sep)); - // Order of a named sort ignores leading dots. let scene_dot = TestScenario::new(util_name!()); let at = &scene_dot.fixtures; at.touch(".a"); @@ -540,7 +539,7 @@ fn test_ls_sort_name() { .arg("--sort=name") .arg("-A") .succeeds() - .stdout_is([".a", "a", ".b", "b\n"].join(sep)); + .stdout_is([".a", ".b", "a", "b\n"].join(sep)); } #[test] From 47a5dd0f9737cebe2859fc1ee5f9fff5e239f3e2 Mon Sep 17 00:00:00 2001 From: bashi8128 Date: Sun, 2 May 2021 17:08:14 +0900 Subject: [PATCH 0525/1135] basename: move from getopts to clap (#2117) Use clap for argument parsing instead of getopts Also, make the following changes * Use `executable!()` macro to output the name of utility * Add another usage to help message --- src/uu/basename/Cargo.toml | 1 + src/uu/basename/src/basename.rs | 91 +++++++++++++++++++++------------ 2 files changed, 58 insertions(+), 34 deletions(-) diff --git a/src/uu/basename/Cargo.toml b/src/uu/basename/Cargo.toml index 92d0ca4cd..0072619b7 100644 --- a/src/uu/basename/Cargo.toml +++ b/src/uu/basename/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/basename.rs" [dependencies] +clap = "2.33.2" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/basename/src/basename.rs b/src/uu/basename/src/basename.rs index 68b705d53..b54a69f44 100644 --- a/src/uu/basename/src/basename.rs +++ b/src/uu/basename/src/basename.rs @@ -10,80 +10,103 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::path::{is_separator, PathBuf}; use uucore::InvalidEncodingHandling; -static NAME: &str = "basename"; -static SYNTAX: &str = "NAME [SUFFIX]"; +static VERSION: &str = env!("CARGO_PKG_VERSION"); static SUMMARY: &str = "Print NAME with any leading directory components removed - If specified, also remove a trailing SUFFIX"; -static LONG_HELP: &str = ""; +If specified, also remove a trailing SUFFIX"; + +fn get_usage() -> String { + format!( + "{0} NAME [SUFFIX] + {0} OPTION... NAME...", + executable!() + ) +} + +pub mod options { + pub static MULTIPLE: &str = "multiple"; + pub static NAME: &str = "name"; + pub static SUFFIX: &str = "suffix"; + pub static ZERO: &str = "zero"; +} pub fn uumain(args: impl uucore::Args) -> i32 { let args = args .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); + let usage = get_usage(); // // Argument parsing // - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optflag( - "a", - "multiple", - "Support more than one argument. Treat every argument as a name.", + let matches = App::new(executable!()) + .version(VERSION) + .about(SUMMARY) + .usage(&usage[..]) + .arg( + Arg::with_name(options::MULTIPLE) + .short("a") + .long(options::MULTIPLE) + .help("support multiple arguments and treat each as a NAME"), ) - .optopt( - "s", - "suffix", - "Remove a trailing suffix. This option implies the -a option.", - "SUFFIX", + .arg(Arg::with_name(options::NAME).multiple(true).hidden(true)) + .arg( + Arg::with_name(options::SUFFIX) + .short("s") + .long(options::SUFFIX) + .value_name("SUFFIX") + .help("remove a trailing SUFFIX; implies -a"), ) - .optflag( - "z", - "zero", - "Output a zero byte (ASCII NUL) at the end of each line, rather than a newline.", + .arg( + Arg::with_name(options::ZERO) + .short("z") + .long(options::ZERO) + .help("end each output line with NUL, not newline"), ) - .parse(args); + .get_matches_from(args); // too few arguments - if matches.free.is_empty() { + if !matches.is_present(options::NAME) { crash!( 1, "{0}: {1}\nTry '{0} --help' for more information.", - NAME, + executable!(), "missing operand" ); } - let opt_s = matches.opt_present("s"); - let opt_a = matches.opt_present("a"); - let opt_z = matches.opt_present("z"); + + let opt_s = matches.is_present(options::SUFFIX); + let opt_a = matches.is_present(options::MULTIPLE); + let opt_z = matches.is_present(options::ZERO); let multiple_paths = opt_s || opt_a; // too many arguments - if !multiple_paths && matches.free.len() > 2 { + if !multiple_paths && matches.occurrences_of(options::NAME) > 2 { crash!( 1, "{0}: extra operand '{1}'\nTry '{0} --help' for more information.", - NAME, - matches.free[2] + executable!(), + matches.values_of(options::NAME).unwrap().nth(2).unwrap() ); } let suffix = if opt_s { - matches.opt_str("s").unwrap() - } else if !opt_a && matches.free.len() > 1 { - matches.free[1].clone() + matches.value_of(options::SUFFIX).unwrap() + } else if !opt_a && matches.occurrences_of(options::NAME) > 1 { + matches.values_of(options::NAME).unwrap().nth(1).unwrap() } else { - "".to_owned() + "" }; // // Main Program Processing // - let paths = if multiple_paths { - &matches.free[..] + let paths: Vec<_> = if multiple_paths { + matches.values_of(options::NAME).unwrap().collect() } else { - &matches.free[0..1] + matches.values_of(options::NAME).unwrap().take(1).collect() }; let line_ending = if opt_z { "\0" } else { "\n" }; From eb3206737b61dab810e7c115ac3fbd077f348702 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 2 May 2021 10:20:14 +0200 Subject: [PATCH 0526/1135] ls: give '.' a file_type --- src/uu/ls/src/ls.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 2e8a5e5ed..482648e79 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1284,7 +1284,13 @@ fn should_display(entry: &DirEntry, config: &Config) -> bool { fn enter_directory(dir: &PathData, config: &Config, out: &mut BufWriter) { let mut entries: Vec<_> = if config.files == Files::All { vec![ - PathData::new(dir.p_buf.join("."), None, Some(".".into()), config, false), + PathData::new( + dir.p_buf.clone(), + Some(Ok(*dir.file_type().unwrap())), + Some(".".into()), + config, + false, + ), PathData::new(dir.p_buf.join(".."), None, Some("..".into()), config, false), ] } else { From 09178360d8286a83e683c16ac18e7e622c1d92fb Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 2 May 2021 10:30:28 +0200 Subject: [PATCH 0527/1135] date: unneeded 'return' statement --- src/uu/date/src/date.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index 43573437d..317fd72d4 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -348,7 +348,7 @@ fn set_system_datetime(_date: DateTime) -> i32 { #[cfg(target_os = "macos")] fn set_system_datetime(_date: DateTime) -> i32 { eprintln!("date: setting the date is not supported by macOS"); - return 1; + 1 } #[cfg(all(unix, not(target_os = "macos")))] From 9554710ab5d71ce9d42dd86d41e752eea607f4ec Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 2 May 2021 10:31:28 +0200 Subject: [PATCH 0528/1135] cat: the function 'unistd::write' doesn't need a mutable reference --- src/uu/cat/src/splice.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/cat/src/splice.rs b/src/uu/cat/src/splice.rs index ccc625467..bd6be60f1 100644 --- a/src/uu/cat/src/splice.rs +++ b/src/uu/cat/src/splice.rs @@ -81,7 +81,7 @@ fn copy_exact(read_fd: RawFd, write_fd: RawFd, num_bytes: usize) -> nix::Result< let mut buf = [0; BUF_SIZE]; loop { let read = unistd::read(read_fd, &mut buf[..left])?; - let written = unistd::write(write_fd, &mut buf[..read])?; + let written = unistd::write(write_fd, &buf[..read])?; left -= written; if left == 0 { break; From 34c22dc3ad359ebdd08ebbfcf6d3651c433de2df Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 2 May 2021 12:15:16 +0200 Subject: [PATCH 0529/1135] tr: fix complement if set2 is range --- src/uu/tr/src/tr.rs | 2 +- tests/by-util/test_tr.rs | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index b1143b4bb..68543229e 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -149,7 +149,7 @@ impl TranslateOperation { TranslateOperation { translate_map: map, complement, - s2_last: s2_prev, + s2_last: set2.last().unwrap_or(s2_prev), } } } diff --git a/tests/by-util/test_tr.rs b/tests/by-util/test_tr.rs index 064fbf779..f840dee62 100644 --- a/tests/by-util/test_tr.rs +++ b/tests/by-util/test_tr.rs @@ -86,6 +86,26 @@ fn test_complement3() { .stdout_is("3he3ca33a3d33he3ba3"); } +#[test] +fn test_complement4() { + // $ echo -n '0x1y2z3' | tr -c '0-@' '*-~' + // 0~1~2~3 + new_ucmd!() + .args(&["-c", "0-@", "*-~"]) + .pipe_in("0x1y2z3") + .run() + .stdout_is("0~1~2~3"); + + // TODO: fix this + // $ echo '0x1y2z3' | tr -c '\0-@' '*-~' + // 0a1b2c3 + // new_ucmd!() + // .args(&["-c", "\\0-@", "*-~"]) + // .pipe_in("0x1y2z3") + // .run() + // .stdout_is("0a1b2c3"); +} + #[test] fn test_squeeze() { new_ucmd!() From 1dccbfd21e2859b06008307e001a20c9516d0cf9 Mon Sep 17 00:00:00 2001 From: Nicolas Thery Date: Sat, 1 May 2021 15:51:12 +0200 Subject: [PATCH 0530/1135] kill: migrate to clap Fixes #2122. --- Cargo.lock | 1 + src/uu/kill/Cargo.toml | 1 + src/uu/kill/src/kill.rs | 89 +++++++++++++++++++++++++++++------------ 3 files changed, 65 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 31787e626..05040dff1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2041,6 +2041,7 @@ dependencies = [ name = "uu_kill" version = "0.0.6" dependencies = [ + "clap", "libc", "uucore", "uucore_procs", diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index 6b66806bc..e33411c70 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/kill.rs" [dependencies] +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["signals"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/kill/src/kill.rs b/src/uu/kill/src/kill.rs index fe925ce37..362f13f18 100644 --- a/src/uu/kill/src/kill.rs +++ b/src/uu/kill/src/kill.rs @@ -10,18 +10,26 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use libc::{c_int, pid_t}; use std::io::Error; use uucore::signals::ALL_SIGNALS; use uucore::InvalidEncodingHandling; -static SYNTAX: &str = "[options] [...]"; -static SUMMARY: &str = ""; -static LONG_HELP: &str = ""; +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Send signal to processes or list information about signals."; static EXIT_OK: i32 = 0; static EXIT_ERR: i32 = 1; +pub mod options { + pub static PIDS_OR_SIGNALS: &str = "pids_of_signals"; + pub static LIST: &str = "list"; + pub static TABLE: &str = "table"; + pub static TABLE_OLD: &str = "table_old"; + pub static SIGNAL: &str = "signal"; +} + #[derive(Clone, Copy)] pub enum Mode { Kill, @@ -33,41 +41,70 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let args = args .collect_str(InvalidEncodingHandling::Ignore) .accept_any(); - let (args, obs_signal) = handle_obsolete(args); - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optopt("s", "signal", "specify the to be sent", "SIGNAL") - .optflagopt( - "l", - "list", - "list all signal names, or convert one to a name", - "LIST", - ) - .optflag("L", "table", "list all signal names in a nice table") - .parse(args); - let mode = if matches.opt_present("table") { + let usage = format!("{} [OPTIONS]... PID...", executable!()); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(options::LIST) + .short("l") + .long(options::LIST) + .help("Lists signals") + .conflicts_with(options::TABLE) + .conflicts_with(options::TABLE_OLD), + ) + .arg( + Arg::with_name(options::TABLE) + .short("t") + .long(options::TABLE) + .help("Lists table of signals"), + ) + .arg(Arg::with_name(options::TABLE_OLD).short("L").hidden(true)) + .arg( + Arg::with_name(options::SIGNAL) + .short("s") + .long(options::SIGNAL) + .help("Sends given signal") + .takes_value(true), + ) + .arg( + Arg::with_name(options::PIDS_OR_SIGNALS) + .hidden(true) + .multiple(true), + ) + .get_matches_from(args); + + let mode = if matches.is_present(options::TABLE) || matches.is_present(options::TABLE_OLD) { Mode::Table - } else if matches.opt_present("list") { + } else if matches.is_present(options::LIST) { Mode::List } else { Mode::Kill }; + let pids_or_signals: Vec = matches + .values_of(options::PIDS_OR_SIGNALS) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + match mode { Mode::Kill => { - return kill( - &matches - .opt_str("signal") - .unwrap_or_else(|| obs_signal.unwrap_or_else(|| "TERM".to_owned())), - matches.free, - ) + let sig = match (obs_signal, matches.value_of(options::SIGNAL)) { + (Some(s), Some(_)) => s, // -s takes precedence + (Some(s), None) => s, + (None, Some(s)) => s.to_owned(), + (None, None) => "TERM".to_owned(), + }; + return kill(&sig, &pids_or_signals); } Mode::Table => table(), - Mode::List => list(matches.opt_str("list")), + Mode::List => list(pids_or_signals.get(0).cloned()), } - 0 + EXIT_OK } fn handle_obsolete(mut args: Vec) -> (Vec, Option) { @@ -148,14 +185,14 @@ fn list(arg: Option) { }; } -fn kill(signalname: &str, pids: std::vec::Vec) -> i32 { +fn kill(signalname: &str, pids: &[String]) -> i32 { let mut status = 0; let optional_signal_value = uucore::signals::signal_by_name_or_value(signalname); let signal_value = match optional_signal_value { Some(x) => x, None => crash!(EXIT_ERR, "unknown signal name {}", signalname), }; - for pid in &pids { + for pid in pids { match pid.parse::() { Ok(x) => { if unsafe { libc::kill(x as pid_t, signal_value as c_int) } != 0 { From 0e6b63b47bdf95c8458c717144ba1df9b1a66215 Mon Sep 17 00:00:00 2001 From: Dean Li Date: Sun, 2 May 2021 18:32:34 +0800 Subject: [PATCH 0531/1135] Add tests to check link fails with 1 or 3 argument(s) --- tests/by-util/test_link.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/by-util/test_link.rs b/tests/by-util/test_link.rs index 381ea168a..99559a7fe 100644 --- a/tests/by-util/test_link.rs +++ b/tests/by-util/test_link.rs @@ -39,3 +39,25 @@ fn test_link_nonexistent_file() { assert!(!at.file_exists(file)); assert!(!at.file_exists(link)); } + +#[test] +fn test_link_one_argument() { + let (_, mut ucmd) = at_and_ucmd!(); + let file = "test_link_argument"; + ucmd.args(&[file]).fails().stderr_contains( + "error: The argument '...' requires at least 2 values, but only 1 was provide", + ); +} + +#[test] +fn test_link_three_arguments() { + let (_, mut ucmd) = at_and_ucmd!(); + let arguments = vec![ + "test_link_argument1", + "test_link_argument2", + "test_link_argument3", + ]; + ucmd.args(&arguments[..]).fails().stderr_contains( + format!("error: The value '{}' was provided to '...', but it wasn't expecting any more values", arguments[2]), + ); +} From 000bd73edceae756be09693d4f7db9ed5899210a Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 2 May 2021 12:39:25 +0200 Subject: [PATCH 0532/1135] tr: fix merge conflict --- src/uu/tr/src/tr.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index 5e6c41a86..dcb64a127 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -182,7 +182,7 @@ impl TranslateAndSqueezeOperation { complement: bool, ) -> TranslateAndSqueezeOperation { TranslateAndSqueezeOperation { - translate: TranslateOperation::new(set1, set2, truncate), + translate: TranslateOperation::new(set1, set2, truncate, complement), squeeze: SqueezeOperation::new(set2_, complement), } } From acd30526a26ccfaf0a6860c913e552b1f7363729 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 2 May 2021 13:53:11 +0200 Subject: [PATCH 0533/1135] tr: fix clippy warning --- src/uu/tr/src/tr.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index dcb64a127..a44f2733c 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -217,8 +217,8 @@ fn translate_input( // Set `prev_c` to the post-translate character. This // allows the squeeze operation to correctly function // after the translate operation. - if res.is_some() { - prev_c = res.unwrap(); + if let Some(rc) = res { + prev_c = rc; } res }); From fba245b176d47b9e9d25975dd87f5d4babfaf5dd Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 2 May 2021 14:26:23 +0200 Subject: [PATCH 0534/1135] ls: add -1 to tests to separate names with \n on windows --- tests/by-util/test_ls.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 4be24a99a..65dd51c8b 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -57,6 +57,7 @@ fn test_ls_a() { // Using the present working directory scene .ucmd() + .arg("-1") .succeeds() .stdout_does_not_contain(".test-1") .stdout_does_not_contain("..") @@ -65,6 +66,7 @@ fn test_ls_a() { scene .ucmd() .arg("-a") + .arg("-1") .succeeds() .stdout_contains(&".test-1") .stdout_contains(&"..") @@ -73,6 +75,7 @@ fn test_ls_a() { scene .ucmd() .arg("-A") + .arg("-1") .succeeds() .stdout_contains(".test-1") .stdout_does_not_contain("..") @@ -81,6 +84,7 @@ fn test_ls_a() { // Using a subdirectory scene .ucmd() + .arg("-1") .arg("some-dir") .succeeds() .stdout_does_not_contain(".test-2") @@ -90,6 +94,7 @@ fn test_ls_a() { scene .ucmd() .arg("-a") + .arg("-1") .arg("some-dir") .succeeds() .stdout_contains(&".test-2") @@ -100,6 +105,7 @@ fn test_ls_a() { scene .ucmd() .arg("-A") + .arg("-1") .arg("some-dir") .succeeds() .stdout_contains(".test-2") From dc5bd9f0bed39fa659edd43ac7c670c71ebf53bc Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sun, 2 May 2021 17:27:44 +0200 Subject: [PATCH 0535/1135] improve memory usage estimation --- src/uu/sort/src/sort.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index be7944a0f..7436b9fda 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -281,7 +281,9 @@ pub struct Line { impl Line { pub fn estimate_size(&self) -> usize { - self.line.capacity() + self.selections.capacity() * std::mem::size_of::() + self.line.capacity() + + self.selections.capacity() * std::mem::size_of::() + + std::mem::size_of::() } pub fn new(line: String, settings: &GlobalSettings) -> Self { From 8b35dd974141218987749cf3b60ba8f5a190c1a0 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sun, 2 May 2021 17:27:52 +0200 Subject: [PATCH 0536/1135] add requested tests --- tests/by-util/test_sort.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index eac9490a5..4465e861f 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -37,7 +37,29 @@ fn test_larger_than_specified_segment() { .arg("50K") .arg("ext_sort.txt") .succeeds() - .stdout_is_fixture(format!("{}", "ext_sort.expected")); + .stdout_is_fixture("ext_sort.expected"); +} + +#[test] +fn test_smaller_than_specified_segment() { + new_ucmd!() + .arg("-n") + .arg("-S") + .arg("100M") + .arg("ext_sort.txt") + .succeeds() + .stdout_is_fixture("ext_sort.expected"); +} + +#[test] +fn test_extsort_zero_terminated() { + new_ucmd!() + .arg("-z") + .arg("-S") + .arg("10K") + .arg("zero-terminated.txt") + .succeeds() + .stdout_is_fixture("zero-terminated.expected"); } #[test] From 3fcac152f8ef1e57de96bc999b2104da1a94ca91 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 2 May 2021 18:35:52 +0200 Subject: [PATCH 0537/1135] tr: add test --- tests/by-util/test_tr.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/by-util/test_tr.rs b/tests/by-util/test_tr.rs index a035faae7..29712b44a 100644 --- a/tests/by-util/test_tr.rs +++ b/tests/by-util/test_tr.rs @@ -95,15 +95,18 @@ fn test_complement4() { .pipe_in("0x1y2z3") .run() .stdout_is("0~1~2~3"); +} - // TODO: fix this +#[test] +#[ignore = "fixme: GNU tr returns '0a1b2c3' instead of '0~1~2~3', see #2158"] +fn test_complement5() { // $ echo '0x1y2z3' | tr -c '\0-@' '*-~' // 0a1b2c3 - // new_ucmd!() - // .args(&["-c", "\\0-@", "*-~"]) - // .pipe_in("0x1y2z3") - // .run() - // .stdout_is("0a1b2c3"); + new_ucmd!() + .args(&["-c", "\\0-@", "*-~"]) + .pipe_in("0x1y2z3") + .run() + .stdout_is("0a1b2c3"); } #[test] From 0a3e2216d72b925d6e47237c37f5e233a656c358 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Sun, 2 May 2021 16:29:34 -0400 Subject: [PATCH 0538/1135] wc: add lines() method for iterating over lines Add the `WordCountable::lines()` method that returns an iterator over lines of a file-like object. This mirrors the `std::io::BufRead::lines()` method, with some minor differences due to the particular use case of `wc`. This commit also creates a new module, `countable.rs`, to contain the `WordCountable` trait and the new `Lines` struct returned by `lines()`. --- src/uu/wc/src/countable.rs | 72 ++++++++++++++++++++++++++++++++++++++ src/uu/wc/src/wc.rs | 55 +++++------------------------ 2 files changed, 81 insertions(+), 46 deletions(-) create mode 100644 src/uu/wc/src/countable.rs diff --git a/src/uu/wc/src/countable.rs b/src/uu/wc/src/countable.rs new file mode 100644 index 000000000..3da910a03 --- /dev/null +++ b/src/uu/wc/src/countable.rs @@ -0,0 +1,72 @@ +//! Traits and implementations for iterating over lines in a file-like object. +//! +//! This module provides a [`WordCountable`] trait and implementations +//! for some common file-like objects. Use the [`WordCountable::lines`] +//! method to get an iterator over lines of a file-like object. +use std::fs::File; +use std::io::{self, BufRead, BufReader, Read, StdinLock}; + +#[cfg(unix)] +use std::os::unix::io::AsRawFd; + +#[cfg(unix)] +pub trait WordCountable: AsRawFd + Read { + type Buffered: BufRead; + fn lines(self) -> Lines; +} + +#[cfg(not(unix))] +pub trait WordCountable: Read { + type Buffered: BufRead; + fn lines(self) -> Lines; +} + +impl WordCountable for StdinLock<'_> { + type Buffered = Self; + + fn lines(self) -> Lines + where + Self: Sized, + { + Lines { buf: self } + } +} +impl WordCountable for File { + type Buffered = BufReader; + + fn lines(self) -> Lines + where + Self: Sized, + { + Lines { + buf: BufReader::new(self), + } + } +} + +/// An iterator over the lines of an instance of `BufRead`. +/// +/// Similar to [`io::Lines`] but yields each line as a `Vec` and +/// includes the newline character (`\n`, the `0xA` byte) that +/// terminates the line. +/// +/// [`io::Lines`]:: io::Lines +pub struct Lines { + buf: B, +} + +impl Iterator for Lines { + type Item = io::Result>; + + fn next(&mut self) -> Option { + let mut line = Vec::new(); + + // reading from a TTY seems to raise a condition on, rather than return Some(0) like a file. + // hence the option wrapped in a result here + match self.buf.read_until(b'\n', &mut line) { + Ok(0) => None, + Ok(_n) => Some(Ok(line)), + Err(e) => Some(Err(e)), + } + } +} diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 59ca10141..3b70856fa 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -11,17 +11,17 @@ extern crate uucore; mod count_bytes; +mod countable; use count_bytes::count_bytes_fast; +use countable::WordCountable; use clap::{App, Arg, ArgMatches}; use thiserror::Error; use std::cmp::max; use std::fs::File; -use std::io::{self, BufRead, BufReader, Read, StdinLock, Write}; +use std::io::{self, Write}; use std::ops::{Add, AddAssign}; -#[cfg(unix)] -use std::os::unix::io::AsRawFd; use std::path::Path; use std::str::from_utf8; @@ -82,32 +82,6 @@ impl Settings { } } -#[cfg(unix)] -trait WordCountable: AsRawFd + Read { - type Buffered: BufRead; - fn get_buffered(self) -> Self::Buffered; -} -#[cfg(not(unix))] -trait WordCountable: Read { - type Buffered: BufRead; - fn get_buffered(self) -> Self::Buffered; -} - -impl WordCountable for StdinLock<'_> { - type Buffered = Self; - - fn get_buffered(self) -> Self::Buffered { - self - } -} -impl WordCountable for File { - type Buffered = BufReader; - - fn get_buffered(self) -> Self::Buffered { - BufReader::new(self) - } -} - #[derive(Debug, Default, Copy, Clone)] struct WordCount { bytes: usize, @@ -270,25 +244,16 @@ fn word_count_from_reader( let mut byte_count: usize = 0; let mut char_count: usize = 0; let mut longest_line_length: usize = 0; - let mut raw_line = Vec::new(); let mut ends_lf: bool; // reading from a TTY seems to raise a condition on, rather than return Some(0) like a file. // hence the option wrapped in a result here - let mut buffered_reader = reader.get_buffered(); - loop { - match buffered_reader.read_until(LF, &mut raw_line) { - Ok(n) => { - if n == 0 { - break; - } - } - Err(ref e) => { - if !raw_line.is_empty() { - show_warning!("Error while reading {}: {}", path, e); - } else { - break; - } + for line_result in reader.lines() { + let raw_line = match line_result { + Ok(l) => l, + Err(e) => { + show_warning!("Error while reading {}: {}", path, e); + continue; } }; @@ -317,8 +282,6 @@ fn word_count_from_reader( longest_line_length = current_char_count - (ends_lf as usize); } } - - raw_line.truncate(0); } Ok(WordCount { From 219fc48487c2095958bf46f70adf6da0436a4fd4 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Mon, 3 May 2021 08:42:23 +0100 Subject: [PATCH 0539/1135] compile_table: adding mac M1 to report. --- README.md | 1 + docs/compiles_table.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 12dfb5609..95dc036fd 100644 --- a/README.md +++ b/README.md @@ -429,6 +429,7 @@ This is an auto-generated table showing which binaries compile for each target-t |windows-msvc|i686|y|y|y|y|y| | | | |y|y|y|y|y|y|y|y|y| |y|y|y| |y|y|y|y| |y|y|y|y| | |y| |y|y|y|y|y| | |y|y|y| |y| |y|y|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y|y|y|y|y|y|y|y|y|y|y| |netbsd|x86_64|y|y|y|y|y|y|y|y| |y|y|y|y|y|y| |y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y| |y|y| |y|y|y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y| |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y|y| |y|y|y| | |y| |y|y| diff --git a/docs/compiles_table.py b/docs/compiles_table.py index 0cbfdf0e9..a051287c9 100644 --- a/docs/compiles_table.py +++ b/docs/compiles_table.py @@ -26,6 +26,7 @@ TARGETS = [ "x86_64-pc-windows-gnu", "x86_64-pc-windows-msvc", # Apple + "aarch64-apple-darwin", "x86_64-apple-darwin", "aarch64-apple-ios", "x86_64-apple-ios", @@ -231,4 +232,4 @@ if __name__ == "__main__": prev_table, _, _ = load_csv(CACHE_PATH) new_table = merge_tables(prev_table, table) - save_csv(CACHE_PATH, new_table) \ No newline at end of file + save_csv(CACHE_PATH, new_table) From 91c736bd95bc8eafdff1ff428bc68e3ed76fa34c Mon Sep 17 00:00:00 2001 From: bashi8128 Date: Mon, 3 May 2021 23:22:00 +0900 Subject: [PATCH 0540/1135] tests/basename: add tests for error messages --- tests/by-util/test_basename.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/by-util/test_basename.rs b/tests/by-util/test_basename.rs index 6c7a3ecae..2a40ba4b9 100644 --- a/tests/by-util/test_basename.rs +++ b/tests/by-util/test_basename.rs @@ -104,11 +104,25 @@ fn test_no_args() { expect_error(vec![]); } +#[test] +fn test_no_args_output() { + new_ucmd!() + .fails() + .stderr_is("basename: error: missing operand\nTry 'basename --help' for more information."); +} + #[test] fn test_too_many_args() { expect_error(vec!["a", "b", "c"]); } +#[test] +fn test_too_many_args_output() { + new_ucmd!().args(&["a", "b", "c"]).fails().stderr_is( + "basename: error: extra operand 'c'\nTry 'basename --help' for more information.", + ); +} + fn test_invalid_utf8_args(os_str: &OsStr) { let test_vec = vec![os_str.to_os_string()]; new_ucmd!().args(&test_vec).succeeds().stdout_is("fo�o\n"); From 74802f9f0fca4579315ce6f7097ff131534d211f Mon Sep 17 00:00:00 2001 From: bashi8128 Date: Mon, 3 May 2021 23:26:46 +0900 Subject: [PATCH 0541/1135] basename: improve error messages Remove duplicated utility name from error messages --- src/uu/basename/src/basename.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/basename/src/basename.rs b/src/uu/basename/src/basename.rs index b54a69f44..d5512863f 100644 --- a/src/uu/basename/src/basename.rs +++ b/src/uu/basename/src/basename.rs @@ -71,7 +71,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if !matches.is_present(options::NAME) { crash!( 1, - "{0}: {1}\nTry '{0} --help' for more information.", + "{1}\nTry '{0} --help' for more information.", executable!(), "missing operand" ); @@ -85,7 +85,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if !multiple_paths && matches.occurrences_of(options::NAME) > 2 { crash!( 1, - "{0}: extra operand '{1}'\nTry '{0} --help' for more information.", + "extra operand '{1}'\nTry '{0} --help' for more information.", executable!(), matches.values_of(options::NAME).unwrap().nth(2).unwrap() ); From 5a4bb610ffec547fdac3f749a17f46b572f62962 Mon Sep 17 00:00:00 2001 From: bashi8128 Date: Mon, 3 May 2021 23:32:01 +0900 Subject: [PATCH 0542/1135] basename: rename variable names Rename variable names to be more explicit ones --- src/uu/basename/src/basename.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/uu/basename/src/basename.rs b/src/uu/basename/src/basename.rs index d5512863f..c20561b30 100644 --- a/src/uu/basename/src/basename.rs +++ b/src/uu/basename/src/basename.rs @@ -77,10 +77,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); } - let opt_s = matches.is_present(options::SUFFIX); - let opt_a = matches.is_present(options::MULTIPLE); - let opt_z = matches.is_present(options::ZERO); - let multiple_paths = opt_s || opt_a; + let opt_suffix = matches.is_present(options::SUFFIX); + let opt_multiple = matches.is_present(options::MULTIPLE); + let opt_zero = matches.is_present(options::ZERO); + let multiple_paths = opt_suffix || opt_multiple; // too many arguments if !multiple_paths && matches.occurrences_of(options::NAME) > 2 { crash!( @@ -91,9 +91,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); } - let suffix = if opt_s { + let suffix = if opt_suffix { matches.value_of(options::SUFFIX).unwrap() - } else if !opt_a && matches.occurrences_of(options::NAME) > 1 { + } else if !opt_multiple && matches.occurrences_of(options::NAME) > 1 { matches.values_of(options::NAME).unwrap().nth(1).unwrap() } else { "" @@ -109,7 +109,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { matches.values_of(options::NAME).unwrap().take(1).collect() }; - let line_ending = if opt_z { "\0" } else { "\n" }; + let line_ending = if opt_zero { "\0" } else { "\n" }; for path in paths { print!("{}{}", basename(&path, &suffix), line_ending); } From 224c8b3f9469e3f9030dc5d076b4e398f2df694b Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Mon, 3 May 2021 09:55:17 +0100 Subject: [PATCH 0543/1135] df output update (non inode mode) proposal specific for mac. on this platform, capacity column is also displayed. --- src/uu/df/src/df.rs | 8 ++++++++ tests/by-util/test_df.rs | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index e898b187c..c917eb2e8 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -916,6 +916,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { "Use%", ] }); + if cfg!(target_os = "macos") && !opt.show_inode_instead { + header.insert(header.len() - 1, "Capacity"); + } header.push("Mounted on"); for (idx, title) in header.iter().enumerate() { @@ -970,6 +973,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { "{0: >12} ", human_readable(free_size, opt.human_readable_base) ); + if cfg!(target_os = "macos") { + let used = fs.usage.blocks - fs.usage.bfree; + let blocks = used + fs.usage.bavail; + print!("{0: >12} ", use_size(used, blocks)); + } print!("{0: >5} ", use_size(free_size, total_size)); } print!("{0: <16}", fs.mountinfo.mount_dir); diff --git a/tests/by-util/test_df.rs b/tests/by-util/test_df.rs index 0ae8d2339..e3b7141d1 100644 --- a/tests/by-util/test_df.rs +++ b/tests/by-util/test_df.rs @@ -20,4 +20,16 @@ fn test_df_compatible_si() { new_ucmd!().arg("-aH").succeeds(); } +#[test] +fn test_df_output() { + if cfg!(target_os = "macos") { + new_ucmd!().arg("-H").arg("-total").succeeds(). + stdout_only("Filesystem Size Used Available Capacity Use% Mounted on \n"); + } else { + new_ucmd!().arg("-H").arg("-total").succeeds().stdout_only( + "Filesystem Size Used Available Use% Mounted on \n" + ); + } +} + // ToDO: more tests... From 56761ba584112c84f71523b2a3ef101bbc14ae49 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 3 May 2021 22:30:56 +0200 Subject: [PATCH 0544/1135] stat: implement support for macos --- src/uu/stat/Cargo.toml | 1 + src/uu/stat/src/fsext.rs | 187 +++++++++++++++++++++++++++++++++++++ src/uu/stat/src/stat.rs | 13 +-- tests/by-util/test_stat.rs | 14 +++ 4 files changed, 205 insertions(+), 10 deletions(-) diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index 96bf63ffe..43c5432f8 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -17,6 +17,7 @@ path = "src/stat.rs" [dependencies] clap = "2.33" time = "0.1.40" +libc = "0.2" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "libc"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/stat/src/fsext.rs b/src/uu/stat/src/fsext.rs index d90099892..4e949047d 100644 --- a/src/uu/stat/src/fsext.rs +++ b/src/uu/stat/src/fsext.rs @@ -9,6 +9,12 @@ extern crate time; +#[cfg(target_os = "linux")] +static LINUX_MTAB: &str = "/etc/mtab"; +#[cfg(target_os = "linux")] +static LINUX_MOUNTINFO: &str = "/proc/self/mountinfo"; +static MOUNT_OPT_BIND: &str = "bind"; + use self::time::Timespec; use std::time::UNIX_EPOCH; pub use uucore::libc::{ @@ -413,3 +419,184 @@ pub fn pretty_fstype<'a>(fstype: i64) -> Cow<'a, str> { other => format!("UNKNOWN ({:#x})", other).into(), } } + +#[cfg(any(target_os = "freebsd", target_vendor = "apple"))] +extern "C" { + #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))] + #[link_name = "getmntinfo$INODE64"] + fn getmntinfo(mntbufp: *mut *mut Sstatfs, flags: c_int) -> c_int; + + #[cfg(any( + all(target_os = "freebsd"), + all(target_vendor = "apple", target_arch = "aarch64") + ))] + fn getmntinfo(mntbufp: *mut *mut Sstatfs, flags: c_int) -> c_int; +} + +#[derive(Debug, Clone)] +pub struct MountInfo { + // it stores `volume_name` in windows platform and `dev_id` in unix platform + dev_id: String, + dev_name: String, + fs_type: String, + pub mount_dir: String, + mount_option: String, // we only care "bind" option + mount_root: String, + remote: bool, + dummy: bool, +} + +impl MountInfo { + fn set_missing_fields(&mut self) { + #[cfg(unix)] + { + // We want to keep the dev_id on Windows + // but set dev_id + let path = CString::new(self.mount_dir.clone()).unwrap(); + unsafe { + let mut stat = mem::zeroed(); + if libc::stat(path.as_ptr(), &mut stat) == 0 { + self.dev_id = (stat.st_dev as i32).to_string(); + } else { + self.dev_id = "".to_string(); + } + } + } + // set MountInfo::dummy + match self.fs_type.as_ref() { + "autofs" | "proc" | "subfs" + /* for Linux 2.6/3.x */ + | "debugfs" | "devpts" | "fusectl" | "mqueue" | "rpc_pipefs" | "sysfs" + /* FreeBSD, Linux 2.4 */ + | "devfs" + /* for NetBSD 3.0 */ + | "kernfs" + /* for Irix 6.5 */ + | "ignore" => self.dummy = true, + _ => self.dummy = self.fs_type == "none" + && self.mount_option.find(MOUNT_OPT_BIND).is_none(), + } + // set MountInfo::remote + #[cfg(unix)] + { + if self.dev_name.find(':').is_some() + || (self.dev_name.starts_with("//") && self.fs_type == "smbfs" + || self.fs_type == "cifs") + || self.dev_name == "-hosts" + { + self.remote = true; + } else { + self.remote = false; + } + } + } + + #[cfg(target_os = "linux")] + fn new(file_name: &str, raw: Vec<&str>) -> Option { + match file_name { + // Format: 36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue + // "man proc" for more details + "/proc/self/mountinfo" => { + let mut m = MountInfo { + dev_id: "".to_string(), + dev_name: raw[9].to_string(), + fs_type: raw[8].to_string(), + mount_root: raw[3].to_string(), + mount_dir: raw[4].to_string(), + mount_option: raw[5].to_string(), + remote: false, + dummy: false, + }; + m.set_missing_fields(); + Some(m) + } + "/etc/mtab" => { + let mut m = MountInfo { + dev_id: "".to_string(), + dev_name: raw[0].to_string(), + fs_type: raw[2].to_string(), + mount_root: "".to_string(), + mount_dir: raw[1].to_string(), + mount_option: raw[3].to_string(), + remote: false, + dummy: false, + }; + m.set_missing_fields(); + Some(m) + } + _ => None, + } + } +} + +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] +use std::ffi::CStr; +#[cfg(any(target_os = "freebsd", target_vendor = "apple"))] +impl From for MountInfo { + fn from(statfs: Sstatfs) -> Self { + let mut info = MountInfo { + dev_id: "".to_string(), + dev_name: unsafe { + CStr::from_ptr(&statfs.f_mntfromname[0]) + .to_string_lossy() + .into_owned() + }, + fs_type: unsafe { + CStr::from_ptr(&statfs.f_fstypename[0]) + .to_string_lossy() + .into_owned() + }, + mount_dir: unsafe { + CStr::from_ptr(&statfs.f_mntonname[0]) + .to_string_lossy() + .into_owned() + }, + mount_root: "".to_string(), + mount_option: "".to_string(), + remote: false, + dummy: false, + }; + info.set_missing_fields(); + info + } +} + +#[cfg(target_os = "linux")] +use std::fs::File; +#[cfg(target_os = "linux")] +use std::io::{BufRead, BufReader}; +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] +use std::ptr; +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] +use std::slice; +pub fn read_fs_list() -> Vec { + #[cfg(target_os = "linux")] + { + let (file_name, fobj) = File::open(LINUX_MOUNTINFO) + .map(|f| (LINUX_MOUNTINFO, f)) + .or_else(|_| File::open(LINUX_MTAB).map(|f| (LINUX_MTAB, f))) + .expect("failed to find mount list files"); + let reader = BufReader::new(fobj); + reader + .lines() + .filter_map(|line| line.ok()) + .filter_map(|line| { + let raw_data = line.split_whitespace().collect::>(); + MountInfo::new(file_name, raw_data) + }) + .collect::>() + } + #[cfg(any(target_os = "freebsd", target_vendor = "apple"))] + { + let mut mptr: *mut Sstatfs = ptr::null_mut(); + let len = unsafe { getmntinfo(&mut mptr, 1 as c_int) }; + if len < 0 { + crash!(1, "getmntinfo failed"); + } + let mounts = unsafe { slice::from_raw_parts(mptr, len as usize) }; + mounts + .iter() + .map(|m| MountInfo::from(*m)) + .collect::>() + } +} diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 5216fb293..dab5f6d97 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -18,8 +18,6 @@ use uucore::entries; use clap::{App, Arg, ArgMatches}; use std::borrow::Cow; use std::convert::AsRef; -use std::fs::File; -use std::io::{BufRead, BufReader}; use std::os::unix::fs::{FileTypeExt, MetadataExt}; use std::path::Path; use std::{cmp, fs, iter}; @@ -97,7 +95,6 @@ pub mod options { static ARG_FILES: &str = "files"; -const MOUNT_INFO: &str = "/etc/mtab"; pub const F_ALTER: u8 = 1; pub const F_ZERO: u8 = 1 << 1; pub const F_LEFT: u8 = 1 << 2; @@ -490,13 +487,9 @@ impl Stater { // mount points aren't displayed when showing filesystem information None } else { - let reader = BufReader::new( - File::open(MOUNT_INFO).unwrap_or_else(|_| panic!("Failed to read {}", MOUNT_INFO)), - ); - let mut mount_list = reader - .lines() - .filter_map(Result::ok) - .filter_map(|line| line.split_whitespace().nth(1).map(ToOwned::to_owned)) + let mut mount_list = read_fs_list() + .iter() + .map(|mi| mi.mount_dir.clone()) .collect::>(); // Reverse sort. The longer comes first. mount_list.sort(); diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 60d735c51..0069d2f0d 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -317,6 +317,20 @@ fn test_multi_files() { .stdout_is(expected_result(&args)); } +#[cfg(any(target_os = "linux", target_os = "freebsd", target_vendor = "apple"))] +#[test] +fn test_one_file() { + let (at, mut ucmd) = at_and_ucmd!(); + let file = "TEST_FILE.mp4"; + at.touch(file); + + ucmd.arg(file) + .succeeds() + .stdout_contains(format!("File: `{}'", file)) + .stdout_contains(format!("Size: 0")) + .stdout_contains(format!("Access: (0644/-rw-r--r--)")); +} + #[test] #[cfg(target_os = "linux")] fn test_printf() { From 5bcfa88f0ab75c32b5278150531b8affdce53f94 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 3 May 2021 23:09:45 +0200 Subject: [PATCH 0545/1135] stat: fix test to ignore selinux related output --- tests/by-util/test_stat.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 60d735c51..7b7e990f4 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -198,9 +198,16 @@ fn test_terse_normal_format() { let expect = expected_result(&args); println!("actual: {:?}", actual); println!("expect: {:?}", expect); - let v_actual: Vec<&str> = actual.split(' ').collect(); - let v_expect: Vec<&str> = expect.split(' ').collect(); + let v_actual: Vec<&str> = actual.trim().split(' ').collect(); + let mut v_expect: Vec<&str> = expect.trim().split(' ').collect(); assert!(!v_expect.is_empty()); + + // uu_stat does not support selinux + if v_actual.len() == v_expect.len() - 1 && v_expect[v_expect.len() - 1].contains(":") { + // assume last element contains: `SELinux security context string` + v_expect.pop(); + } + // * allow for inequality if `stat` (aka, expect) returns "0" (unknown value) assert!( expect == "0" From 0cafe2b70d463ec7c5a8ec2be6a42cdfd37e58f6 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Mon, 3 May 2021 20:52:32 -0400 Subject: [PATCH 0546/1135] wc: add tests for edge cases for wc on files --- tests/by-util/test_wc.rs | 57 ++++++++++++++ tests/fixtures/wc/emptyfile.txt | 0 tests/fixtures/wc/manyemptylines.txt | 100 ++++++++++++++++++++++++ tests/fixtures/wc/notrailingnewline.txt | 1 + tests/fixtures/wc/onelongemptyline.txt | 1 + tests/fixtures/wc/onelongword.txt | 1 + 6 files changed, 160 insertions(+) create mode 100644 tests/fixtures/wc/emptyfile.txt create mode 100644 tests/fixtures/wc/manyemptylines.txt create mode 100644 tests/fixtures/wc/notrailingnewline.txt create mode 100644 tests/fixtures/wc/onelongemptyline.txt create mode 100644 tests/fixtures/wc/onelongword.txt diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index 075878470..a16f1854e 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -112,3 +112,60 @@ fn test_multiple_default() { alice_in_wonderland.txt\n 36 370 2189 total\n", ); } + +/// Test for an empty file. +#[test] +fn test_file_empty() { + // TODO There is a leading space in the output that should be + // removed; see issue #2173. + new_ucmd!() + .args(&["-clmwL", "emptyfile.txt"]) + .run() + .stdout_is(" 0 0 0 0 0 emptyfile.txt\n"); +} + +/// Test for an file containing a single non-whitespace character +/// *without* a trailing newline. +#[test] +fn test_file_single_line_no_trailing_newline() { + // TODO There is a leading space in the output that should be + // removed; see issue #2173. + new_ucmd!() + .args(&["-clmwL", "notrailingnewline.txt"]) + .run() + .stdout_is(" 1 1 2 2 1 notrailingnewline.txt\n"); +} + +/// Test for a file that has 100 empty lines (that is, the contents of +/// the file are the newline character repeated one hundred times). +#[test] +fn test_file_many_empty_lines() { + // TODO There is a leading space in the output that should be + // removed; see issue #2173. + new_ucmd!() + .args(&["-clmwL", "manyemptylines.txt"]) + .run() + .stdout_is(" 100 0 100 100 0 manyemptylines.txt\n"); +} + +/// Test for a file that has one long line comprising only spaces. +#[test] +fn test_file_one_long_line_only_spaces() { + // TODO There is a leading space in the output that should be + // removed; see issue #2173. + new_ucmd!() + .args(&["-clmwL", "onelongemptyline.txt"]) + .run() + .stdout_is(" 1 0 10001 10001 10000 onelongemptyline.txt\n"); +} + +/// Test for a file that has one long line comprising a single "word". +#[test] +fn test_file_one_long_word() { + // TODO There is a leading space in the output that should be + // removed; see issue #2173. + new_ucmd!() + .args(&["-clmwL", "onelongword.txt"]) + .run() + .stdout_is(" 1 1 10001 10001 10000 onelongword.txt\n"); +} diff --git a/tests/fixtures/wc/emptyfile.txt b/tests/fixtures/wc/emptyfile.txt new file mode 100644 index 000000000..e69de29bb diff --git a/tests/fixtures/wc/manyemptylines.txt b/tests/fixtures/wc/manyemptylines.txt new file mode 100644 index 000000000..716f02896 --- /dev/null +++ b/tests/fixtures/wc/manyemptylines.txt @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/fixtures/wc/notrailingnewline.txt b/tests/fixtures/wc/notrailingnewline.txt new file mode 100644 index 000000000..789819226 --- /dev/null +++ b/tests/fixtures/wc/notrailingnewline.txt @@ -0,0 +1 @@ +a diff --git a/tests/fixtures/wc/onelongemptyline.txt b/tests/fixtures/wc/onelongemptyline.txt new file mode 100644 index 000000000..f93ac3c2c --- /dev/null +++ b/tests/fixtures/wc/onelongemptyline.txt @@ -0,0 +1 @@ + diff --git a/tests/fixtures/wc/onelongword.txt b/tests/fixtures/wc/onelongword.txt new file mode 100644 index 000000000..9d693a7ca --- /dev/null +++ b/tests/fixtures/wc/onelongword.txt @@ -0,0 +1 @@ +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa From 6dff9f00a35d2893033330cb8f281357d6904fd9 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 4 May 2021 10:02:40 +0200 Subject: [PATCH 0547/1135] refresh cargo.lock with recent updates --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2a33ab099..8d740bb9a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1483,9 +1483,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.71" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad184cc9470f9117b2ac6817bfe297307418819ba40552f9b3846f05c33d5373" +checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82" dependencies = [ "proc-macro2", "quote 1.0.9", From 231bb7be93639576bdc553ae7a6fa2f7f5568ddc Mon Sep 17 00:00:00 2001 From: rethab Date: Wed, 5 May 2021 22:59:40 +0200 Subject: [PATCH 0548/1135] Migrate mknod to clap, closes #2051 (#2056) * mknod: add tests for fifo * mknod: add test for character device --- .gitignore | 1 + Cargo.lock | 2 +- src/uu/mknod/Cargo.toml | 2 +- src/uu/mknod/src/mknod.rs | 304 +++++++++++++++------------- src/uu/mknod/src/parsemode.rs | 54 +++++ src/uucore/src/lib/features/mode.rs | 33 ++- tests/by-util/test_mknod.rs | 125 +++++++++++- tests/common/util.rs | 16 +- 8 files changed, 371 insertions(+), 166 deletions(-) create mode 100644 src/uu/mknod/src/parsemode.rs diff --git a/.gitignore b/.gitignore index b1ac52506..11f46e13e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ target/ Cargo.lock lib*.a /docs/_build +*.iml diff --git a/Cargo.lock b/Cargo.lock index 6ff3cd5c1..62fa80c2d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2116,7 +2116,7 @@ dependencies = [ name = "uu_mknod" version = "0.0.6" dependencies = [ - "getopts", + "clap", "libc", "uucore", "uucore_procs", diff --git a/src/uu/mknod/Cargo.toml b/src/uu/mknod/Cargo.toml index 2c3ac8fb9..1320e3546 100644 --- a/src/uu/mknod/Cargo.toml +++ b/src/uu/mknod/Cargo.toml @@ -16,7 +16,7 @@ name = "uu_mknod" path = "src/mknod.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "^0.2.42" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["mode"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/mknod/src/mknod.rs b/src/uu/mknod/src/mknod.rs index fc6fb0870..5b6c2fa8c 100644 --- a/src/uu/mknod/src/mknod.rs +++ b/src/uu/mknod/src/mknod.rs @@ -5,21 +5,41 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// spell-checker:ignore (ToDO) parsemode makedev sysmacros makenod newmode perror IFBLK IFCHR IFIFO +// spell-checker:ignore (ToDO) parsemode makedev sysmacros perror IFBLK IFCHR IFIFO #[macro_use] extern crate uucore; +use std::ffi::CString; + +use clap::{App, Arg, ArgMatches}; use libc::{dev_t, mode_t}; use libc::{S_IFBLK, S_IFCHR, S_IFIFO, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR}; -use getopts::Options; - -use std::ffi::CString; use uucore::InvalidEncodingHandling; static NAME: &str = "mknod"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Create the special file NAME of the given TYPE."; +static USAGE: &str = "mknod [OPTION]... NAME TYPE [MAJOR MINOR]"; +static LONG_HELP: &str = "Mandatory arguments to long options are mandatory for short options too. +-m, --mode=MODE set file permission bits to MODE, not a=rw - umask +--help display this help and exit +--version output version information and exit + +Both MAJOR and MINOR must be specified when TYPE is b, c, or u, and they +must be omitted when TYPE is p. If MAJOR or MINOR begins with 0x or 0X, +it is interpreted as hexadecimal; otherwise, if it begins with 0, as octal; +otherwise, as decimal. TYPE may be: + +b create a block (buffered) special file +c, u create a character (unbuffered) special file +p create a FIFO + +NOTE: your shell may have its own version of mknod, which usually supersedes +the version described here. Please refer to your shell's documentation +for details about the options it supports. +"; const MODE_RW_UGO: mode_t = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; @@ -30,13 +50,35 @@ fn makedev(maj: u64, min: u64) -> dev_t { } #[cfg(windows)] -fn _makenod(path: CString, mode: mode_t, dev: dev_t) -> i32 { +fn _makenod(file_name: &str, mode: mode_t, dev: dev_t) -> i32 { panic!("Unsupported for windows platform") } #[cfg(unix)] -fn _makenod(path: CString, mode: mode_t, dev: dev_t) -> i32 { - unsafe { libc::mknod(path.as_ptr(), mode, dev) } +fn _makenod(file_name: &str, mode: mode_t, dev: dev_t) -> i32 { + let c_str = CString::new(file_name).expect("Failed to convert to CString"); + + // the user supplied a mode + let set_umask = mode & MODE_RW_UGO != MODE_RW_UGO; + + unsafe { + // store prev umask + let last_umask = if set_umask { libc::umask(0) } else { 0 }; + + let errno = libc::mknod(c_str.as_ptr(), mode, dev); + + // set umask back to original value + if set_umask { + libc::umask(last_umask); + } + + if errno == -1 { + let c_str = CString::new(NAME).expect("Failed to convert to CString"); + // shows the error from the mknod syscall + libc::perror(c_str.as_ptr()); + } + errno + } } #[allow(clippy::cognitive_complexity)] @@ -44,156 +86,136 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let args = args .collect_str(InvalidEncodingHandling::Ignore) .accept_any(); - - let mut opts = Options::new(); - // Linux-specific options, not implemented // opts.optflag("Z", "", "set the SELinux security context to default type"); // opts.optopt("", "context", "like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX"); - opts.optopt( - "m", - "mode", - "set file permission bits to MODE, not a=rw - umask", - "MODE", - ); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); + let matches = App::new(executable!()) + .version(VERSION) + .usage(USAGE) + .after_help(LONG_HELP) + .about(ABOUT) + .arg( + Arg::with_name("mode") + .short("m") + .long("mode") + .value_name("MODE") + .help("set file permission bits to MODE, not a=rw - umask"), + ) + .arg( + Arg::with_name("name") + .value_name("NAME") + .help("name of the new file") + .required(true) + .index(1), + ) + .arg( + Arg::with_name("type") + .value_name("TYPE") + .help("type of the new file (b, c, u or p)") + .required(true) + .validator(valid_type) + .index(2), + ) + .arg( + Arg::with_name("major") + .value_name("MAJOR") + .help("major file type") + .validator(valid_u64) + .index(3), + ) + .arg( + Arg::with_name("minor") + .value_name("MINOR") + .help("minor file type") + .validator(valid_u64) + .index(4), + ) + .get_matches_from(args); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}\nTry '{} --help' for more information.", f, NAME), + let mode = match get_mode(&matches) { + Ok(mode) => mode, + Err(err) => { + show_info!("{}", err); + return 1; + } }; - if matches.opt_present("help") { - println!( - "Usage: {0} [OPTION]... NAME TYPE [MAJOR MINOR] + let file_name = matches.value_of("name").expect("Missing argument 'NAME'"); -Mandatory arguments to long options are mandatory for short options too. - -m, --mode=MODE set file permission bits to MODE, not a=rw - umask - --help display this help and exit - --version output version information and exit + // Only check the first character, to allow mnemonic usage like + // 'mknod /dev/rst0 character 18 0'. + let ch = matches + .value_of("type") + .expect("Missing argument 'TYPE'") + .chars() + .next() + .expect("Failed to get the first char"); -Both MAJOR and MINOR must be specified when TYPE is b, c, or u, and they -must be omitted when TYPE is p. If MAJOR or MINOR begins with 0x or 0X, -it is interpreted as hexadecimal; otherwise, if it begins with 0, as octal; -otherwise, as decimal. TYPE may be: - - b create a block (buffered) special file - c, u create a character (unbuffered) special file - p create a FIFO - -NOTE: your shell may have its own version of mknod, which usually supersedes -the version described here. Please refer to your shell's documentation -for details about the options it supports.", - NAME - ); - return 0; - } - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let mut last_umask: mode_t = 0; - let mut newmode: mode_t = MODE_RW_UGO; - if matches.opt_present("mode") { - match uucore::mode::parse_mode(matches.opt_str("mode")) { - Ok(parsed) => { - if parsed > 0o777 { - show_info!("mode must specify only file permission bits"); - return 1; - } - newmode = parsed; - } - Err(e) => { - show_info!("{}", e); - return 1; - } + if ch == 'p' { + if matches.is_present("major") || matches.is_present("minor") { + eprintln!("Fifos do not have major and minor device numbers."); + eprintln!("Try '{} --help' for more information.", NAME); + 1 + } else { + _makenod(file_name, S_IFIFO | mode, 0) } - unsafe { - last_umask = libc::umask(0); - } - } + } else { + match (matches.value_of("major"), matches.value_of("minor")) { + (None, None) | (_, None) | (None, _) => { + eprintln!("Special files require major and minor device numbers."); + eprintln!("Try '{} --help' for more information.", NAME); + 1 + } + (Some(major), Some(minor)) => { + let major = major.parse::().expect("validated by clap"); + let minor = minor.parse::().expect("validated by clap"); - let mut ret = 0i32; - match matches.free.len() { - 0 => show_usage_error!("missing operand"), - 1 => show_usage_error!("missing operand after ‘{}’", matches.free[0]), - _ => { - let args = &matches.free; - let c_str = CString::new(args[0].as_str()).expect("Failed to convert to CString"); - - // Only check the first character, to allow mnemonic usage like - // 'mknod /dev/rst0 character 18 0'. - let ch = args[1] - .chars() - .next() - .expect("Failed to get the first char"); - - if ch == 'p' { - if args.len() > 2 { - show_info!("{}: extra operand ‘{}’", NAME, args[2]); - if args.len() == 4 { - eprintln!("Fifos do not have major and minor device numbers."); - } - eprintln!("Try '{} --help' for more information.", NAME); - return 1; - } - - ret = _makenod(c_str, S_IFIFO | newmode, 0); - } else { - if args.len() < 4 { - show_info!("missing operand after ‘{}’", args[args.len() - 1]); - if args.len() == 2 { - eprintln!("Special files require major and minor device numbers."); - } - eprintln!("Try '{} --help' for more information.", NAME); - return 1; - } else if args.len() > 4 { - show_usage_error!("extra operand ‘{}’", args[4]); - return 1; - } else if !"bcu".contains(ch) { - show_usage_error!("invalid device type ‘{}’", args[1]); - return 1; - } - - let maj = args[2].parse::(); - let min = args[3].parse::(); - if maj.is_err() { - show_info!("invalid major device number ‘{}’", args[2]); - return 1; - } else if min.is_err() { - show_info!("invalid minor device number ‘{}’", args[3]); - return 1; - } - - let (maj, min) = (maj.unwrap(), min.unwrap()); - let dev = makedev(maj, min); + let dev = makedev(major, minor); if ch == 'b' { // block special file - ret = _makenod(c_str, S_IFBLK | newmode, dev); - } else { + _makenod(file_name, S_IFBLK | mode, dev) + } else if ch == 'c' || ch == 'u' { // char special file - ret = _makenod(c_str, S_IFCHR | newmode, dev); + _makenod(file_name, S_IFCHR | mode, dev) + } else { + unreachable!("{} was validated to be only b, c or u", ch); } } } } - - if last_umask != 0 { - unsafe { - libc::umask(last_umask); - } - } - if ret == -1 { - let c_str = CString::new(format!("{}: {}", NAME, matches.free[0]).as_str()) - .expect("Failed to convert to CString"); - unsafe { - libc::perror(c_str.as_ptr()); - } - } - - ret +} + +fn get_mode(matches: &ArgMatches) -> Result { + match matches.value_of("mode") { + None => Ok(MODE_RW_UGO), + Some(str_mode) => uucore::mode::parse_mode(str_mode) + .map_err(|e| format!("invalid mode ({})", e)) + .and_then(|mode| { + if mode > 0o777 { + Err("mode must specify only file permission bits".to_string()) + } else { + Ok(mode) + } + }), + } +} + +fn valid_type(tpe: String) -> Result<(), String> { + // Only check the first character, to allow mnemonic usage like + // 'mknod /dev/rst0 character 18 0'. + tpe.chars() + .next() + .ok_or_else(|| "missing device type".to_string()) + .and_then(|first_char| { + if vec!['b', 'c', 'u', 'p'].contains(&first_char) { + Ok(()) + } else { + Err(format!("invalid device type ‘{}’", tpe)) + } + }) +} + +fn valid_u64(num: String) -> Result<(), String> { + num.parse::().map(|_| ()).map_err(|_| num) } diff --git a/src/uu/mknod/src/parsemode.rs b/src/uu/mknod/src/parsemode.rs new file mode 100644 index 000000000..026fc4a56 --- /dev/null +++ b/src/uu/mknod/src/parsemode.rs @@ -0,0 +1,54 @@ +// spell-checker:ignore (ToDO) fperm + +use libc::{mode_t, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR}; + +use uucore::mode; + +pub const MODE_RW_UGO: mode_t = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; + +pub fn parse_mode(mode: &str) -> Result { + let arr: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; + let result = if mode.contains(arr) { + mode::parse_numeric(MODE_RW_UGO as u32, mode) + } else { + mode::parse_symbolic(MODE_RW_UGO as u32, mode, true) + }; + result.map(|mode| mode as mode_t) +} + +#[cfg(test)] +mod test { + /// Test if the program is running under WSL + // ref: @@ + // ToDO: test on WSL2 which likely doesn't need special handling; plan change to `is_wsl_1()` if WSL2 is less needy + pub fn is_wsl() -> bool { + #[cfg(target_os = "linux")] + { + if let Ok(b) = std::fs::read("/proc/sys/kernel/osrelease") { + if let Ok(s) = std::str::from_utf8(&b) { + let a = s.to_ascii_lowercase(); + return a.contains("microsoft") || a.contains("wsl"); + } + } + } + false + } + + #[test] + fn symbolic_modes() { + assert_eq!(super::parse_mode("u+x").unwrap(), 0o766); + assert_eq!( + super::parse_mode("+x").unwrap(), + if !is_wsl() { 0o777 } else { 0o776 } + ); + assert_eq!(super::parse_mode("a-w").unwrap(), 0o444); + assert_eq!(super::parse_mode("g-r").unwrap(), 0o626); + } + + #[test] + fn numeric_modes() { + assert_eq!(super::parse_mode("644").unwrap(), 0o644); + assert_eq!(super::parse_mode("+100").unwrap(), 0o766); + assert_eq!(super::parse_mode("-4").unwrap(), 0o662); + } +} diff --git a/src/uucore/src/lib/features/mode.rs b/src/uucore/src/lib/features/mode.rs index 1bb79ac03..4fb5a6509 100644 --- a/src/uucore/src/lib/features/mode.rs +++ b/src/uucore/src/lib/features/mode.rs @@ -132,19 +132,15 @@ fn parse_change(mode: &str, fperm: u32, considering_dir: bool) -> (u32, usize) { (srwx, pos) } -pub fn parse_mode(mode: Option) -> Result { +pub fn parse_mode(mode: &str) -> Result { let fperm = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; - if let Some(mode) = mode { - let arr: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; - let result = if mode.contains(arr) { - parse_numeric(fperm as u32, mode.as_str()) - } else { - parse_symbolic(fperm as u32, mode.as_str(), true) - }; - result.map(|mode| mode as mode_t) + let arr: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; + let result = if mode.contains(arr) { + parse_numeric(fperm as u32, mode) } else { - Ok(fperm) - } + parse_symbolic(fperm as u32, mode, true) + }; + result.map(|mode| mode as mode_t) } #[cfg(test)] @@ -152,20 +148,19 @@ mod test { #[test] fn symbolic_modes() { - assert_eq!(super::parse_mode(Some("u+x".to_owned())).unwrap(), 0o766); + assert_eq!(super::parse_mode("u+x").unwrap(), 0o766); assert_eq!( - super::parse_mode(Some("+x".to_owned())).unwrap(), + super::parse_mode("+x").unwrap(), if !crate::os::is_wsl_1() { 0o777 } else { 0o776 } ); - assert_eq!(super::parse_mode(Some("a-w".to_owned())).unwrap(), 0o444); - assert_eq!(super::parse_mode(Some("g-r".to_owned())).unwrap(), 0o626); + assert_eq!(super::parse_mode("a-w").unwrap(), 0o444); + assert_eq!(super::parse_mode("g-r").unwrap(), 0o626); } #[test] fn numeric_modes() { - assert_eq!(super::parse_mode(Some("644".to_owned())).unwrap(), 0o644); - assert_eq!(super::parse_mode(Some("+100".to_owned())).unwrap(), 0o766); - assert_eq!(super::parse_mode(Some("-4".to_owned())).unwrap(), 0o662); - assert_eq!(super::parse_mode(None).unwrap(), 0o666); + assert_eq!(super::parse_mode("644").unwrap(), 0o644); + assert_eq!(super::parse_mode("+100").unwrap(), 0o766); + assert_eq!(super::parse_mode("-4").unwrap(), 0o662); } } diff --git a/tests/by-util/test_mknod.rs b/tests/by-util/test_mknod.rs index 651491045..1d39372ac 100644 --- a/tests/by-util/test_mknod.rs +++ b/tests/by-util/test_mknod.rs @@ -1 +1,124 @@ -// ToDO: add tests +use crate::common::util::*; + +#[cfg(not(windows))] +#[test] +fn test_mknod_help() { + new_ucmd!() + .arg("--help") + .succeeds() + .no_stderr() + .stdout_contains("USAGE:"); +} + +#[test] +#[cfg(not(windows))] +fn test_mknod_version() { + assert!(new_ucmd!() + .arg("--version") + .succeeds() + .no_stderr() + .stdout_str() + .starts_with("mknod")); +} + +#[test] +#[cfg(not(windows))] +fn test_mknod_fifo_default_writable() { + let ts = TestScenario::new(util_name!()); + ts.ucmd().arg("test_file").arg("p").succeeds(); + assert!(ts.fixtures.is_fifo("test_file")); + assert!(!ts.fixtures.metadata("test_file").permissions().readonly()); +} + +#[test] +#[cfg(not(windows))] +fn test_mknod_fifo_mnemonic_usage() { + let ts = TestScenario::new(util_name!()); + ts.ucmd().arg("test_file").arg("pipe").succeeds(); + assert!(ts.fixtures.is_fifo("test_file")); +} + +#[test] +#[cfg(not(windows))] +fn test_mknod_fifo_read_only() { + let ts = TestScenario::new(util_name!()); + ts.ucmd() + .arg("-m") + .arg("a=r") + .arg("test_file") + .arg("p") + .succeeds(); + assert!(ts.fixtures.is_fifo("test_file")); + assert!(ts.fixtures.metadata("test_file").permissions().readonly()); +} + +#[test] +#[cfg(not(windows))] +fn test_mknod_fifo_invalid_extra_operand() { + new_ucmd!() + .arg("test_file") + .arg("p") + .arg("1") + .arg("2") + .fails() + .stderr_contains(&"Fifos do not have major and minor device numbers"); +} + +#[test] +#[cfg(not(windows))] +fn test_mknod_character_device_requires_major_and_minor() { + new_ucmd!() + .arg("test_file") + .arg("c") + .fails() + .status_code(1) + .stderr_contains(&"Special files require major and minor device numbers."); + new_ucmd!() + .arg("test_file") + .arg("c") + .arg("1") + .fails() + .status_code(1) + .stderr_contains(&"Special files require major and minor device numbers."); + new_ucmd!() + .arg("test_file") + .arg("c") + .arg("1") + .arg("c") + .fails() + .status_code(1) + .stderr_contains(&"Invalid value for ''"); + new_ucmd!() + .arg("test_file") + .arg("c") + .arg("c") + .arg("1") + .fails() + .status_code(1) + .stderr_contains(&"Invalid value for ''"); +} + +#[test] +#[cfg(not(windows))] +fn test_mknod_invalid_arg() { + new_ucmd!() + .arg("--foo") + .fails() + .status_code(1) + .no_stdout() + .stderr_contains(&"Found argument '--foo' which wasn't expected"); +} + +#[test] +#[cfg(not(windows))] +fn test_mknod_invalid_mode() { + new_ucmd!() + .arg("--mode") + .arg("rw") + .arg("test_file") + .arg("p") + .fails() + .no_stdout() + .status_code(1) + .stderr_contains(&"invalid mode"); +} diff --git a/tests/common/util.rs b/tests/common/util.rs index 1ade70127..719849afc 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -163,7 +163,7 @@ impl CmdResult { /// asserts that the command's exit code is the same as the given one pub fn status_code(&self, code: i32) -> &CmdResult { - assert!(self.code == Some(code)); + assert_eq!(self.code, Some(code)); self } @@ -295,12 +295,22 @@ impl CmdResult { } pub fn stdout_contains>(&self, cmp: T) -> &CmdResult { - assert!(self.stdout_str().contains(cmp.as_ref())); + assert!( + self.stdout_str().contains(cmp.as_ref()), + "'{}' does not contain '{}'", + self.stdout_str(), + cmp.as_ref() + ); self } pub fn stderr_contains>(&self, cmp: T) -> &CmdResult { - assert!(self.stderr_str().contains(cmp.as_ref())); + assert!( + self.stderr_str().contains(cmp.as_ref()), + "'{}' does not contain '{}'", + self.stderr_str(), + cmp.as_ref() + ); self } From 7d2b051866f77000d253de324ad69e3fbe31ce9d Mon Sep 17 00:00:00 2001 From: Anup Mahindre Date: Thu, 6 May 2021 02:33:25 +0530 Subject: [PATCH 0549/1135] Implement Total size feature (#2170) * ls: Implement total size feature - Implement total size reporting that was missing - Fix minor formatting / readability nits * tests: Add tests for ls total sizes feature * ls: Fix MSRV build errors due to unsupported attributes for if blocks * ls: Add windows support for total sizes feature - Add windows support (defaults to file size as block sizes related infromation is not avialable on windows) - Renamed some functions --- Cargo.lock | 2 ++ src/uu/ls/src/ls.rs | 74 ++++++++++++++++++++++++++++------------ tests/by-util/test_ls.rs | 45 ++++++++++++++++++++++++ 3 files changed, 100 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 62fa80c2d..3cd0c7cda 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1692,6 +1692,7 @@ dependencies = [ name = "uu_basename" version = "0.0.6" dependencies = [ + "clap", "uucore", "uucore_procs", ] @@ -2645,6 +2646,7 @@ dependencies = [ name = "uu_who" version = "0.0.6" dependencies = [ + "clap", "uucore", "uucore_procs", ] diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 0e2754f07..f24bf513e 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1179,31 +1179,32 @@ impl PathData { } fn list(locs: Vec, config: Config) -> i32 { - let number_of_locs = locs.len(); - let mut files = Vec::::new(); let mut dirs = Vec::::new(); let mut has_failed = false; let mut out = BufWriter::new(stdout()); - for loc in locs { + for loc in &locs { let p = PathBuf::from(&loc); if !p.exists() { show_error!("'{}': {}", &loc, "No such file or directory"); - // We found an error, the return code of ls should not be 0 - // And no need to continue the execution + /* + We found an error, the return code of ls should not be 0 + And no need to continue the execution + */ has_failed = true; continue; } let path_data = PathData::new(p, None, None, &config, true); - let show_dir_contents = if let Some(ft) = path_data.file_type() { - !config.directory && ft.is_dir() - } else { - has_failed = true; - false + let show_dir_contents = match path_data.file_type() { + Some(ft) => !config.directory && ft.is_dir(), + None => { + has_failed = true; + false + } }; if show_dir_contents { @@ -1217,7 +1218,7 @@ fn list(locs: Vec, config: Config) -> i32 { sort_entries(&mut dirs, &config); for dir in dirs { - if number_of_locs > 1 { + if locs.len() > 1 { let _ = writeln!(out, "\n{}:", dir.p_buf.display()); } enter_directory(&dir, &config, &mut out); @@ -1331,7 +1332,7 @@ fn display_dir_entry_size(entry: &PathData, config: &Config) -> (usize, usize) { if let Some(md) = entry.md() { ( display_symlink_count(&md).len(), - display_file_size(&md, config).len(), + display_size(md.len(), config).len(), ) } else { (0, 0) @@ -1344,14 +1345,22 @@ fn pad_left(string: String, count: usize) -> String { fn display_items(items: &[PathData], config: &Config, out: &mut BufWriter) { if config.format == Format::Long { - let (mut max_links, mut max_size) = (1, 1); + let (mut max_links, mut max_width) = (1, 1); + let mut total_size = 0; + for item in items { - let (links, size) = display_dir_entry_size(item, config); + let (links, width) = display_dir_entry_size(item, config); max_links = links.max(max_links); - max_size = size.max(max_size); + max_width = width.max(max_width); + total_size += item.md().map_or(0, |md| get_block_size(md, config)); } + + if total_size > 0 { + let _ = writeln!(out, "total {}", display_size(total_size, config)); + } + for item in items { - display_item_long(item, max_links, max_size, config, out); + display_item_long(item, max_links, max_width, config, out); } } else { let names = items.iter().filter_map(|i| display_file_name(&i, config)); @@ -1396,6 +1405,29 @@ fn display_items(items: &[PathData], config: &Config, out: &mut BufWriter u64 { + /* GNU ls will display sizes in terms of block size + md.len() will differ from this value when the file has some holes + */ + #[cfg(unix)] + { + // hard-coded for now - enabling setting this remains a TODO + let ls_block_size = 1024; + return match config.size_format { + SizeFormat::Binary => md.blocks() * 512, + SizeFormat::Decimal => md.blocks() * 512, + SizeFormat::Bytes => md.blocks() * 512 / ls_block_size, + }; + } + + #[cfg(not(unix))] + { + let _ = config; + // no way to get block size for windows, fall-back to file size + md.len() + } +} + fn display_grid( names: impl Iterator, width: u16, @@ -1471,7 +1503,7 @@ fn display_item_long( let _ = writeln!( out, " {} {} {}", - pad_left(display_file_size(&md, config), max_size), + pad_left(display_size(md.len(), config), max_size), display_date(&md, config), // unwrap is fine because it fails when metadata is not available // but we already know that it is because it's checked at the @@ -1626,13 +1658,13 @@ fn format_prefixed(prefixed: NumberPrefix) -> String { } } -fn display_file_size(metadata: &Metadata, config: &Config) -> String { +fn display_size(len: u64, config: &Config) -> String { // NOTE: The human-readable behaviour deviates from the GNU ls. // The GNU ls uses binary prefixes by default. match config.size_format { - SizeFormat::Binary => format_prefixed(NumberPrefix::binary(metadata.len() as f64)), - SizeFormat::Decimal => format_prefixed(NumberPrefix::decimal(metadata.len() as f64)), - SizeFormat::Bytes => metadata.len().to_string(), + SizeFormat::Binary => format_prefixed(NumberPrefix::binary(len as f64)), + SizeFormat::Decimal => format_prefixed(NumberPrefix::decimal(len as f64)), + SizeFormat::Bytes => len.to_string(), } } diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 110764aa5..0985ba719 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -5,6 +5,7 @@ use crate::common::util::*; extern crate regex; use self::regex::Regex; +use std::collections::HashMap; use std::path::Path; use std::thread::sleep; use std::time::Duration; @@ -308,6 +309,50 @@ fn test_ls_long() { } } +#[test] +fn test_ls_long_total_size() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.touch(&at.plus_as_string("test-long")); + at.append("test-long", "1"); + at.touch(&at.plus_as_string("test-long2")); + at.append("test-long2", "2"); + + let expected_prints: HashMap<_, _> = if cfg!(unix) { + [ + ("long_vanilla", "total 8"), + ("long_human_readable", "total 8.0K"), + ("long_si", "total 8.2k"), + ] + .iter() + .cloned() + .collect() + } else { + [ + ("long_vanilla", "total 2"), + ("long_human_readable", "total 2"), + ("long_si", "total 2"), + ] + .iter() + .cloned() + .collect() + }; + + for arg in &["-l", "--long", "--format=long", "--format=verbose"] { + let result = scene.ucmd().arg(arg).succeeds(); + result.stdout_contains(expected_prints["long_vanilla"]); + + for arg2 in &["-h", "--human-readable", "--si"] { + let result = scene.ucmd().arg(arg).arg(arg2).succeeds(); + result.stdout_contains(if *arg2 == "--si" { + expected_prints["long_si"] + } else { + expected_prints["long_human_readable"] + }); + } + } +} + #[test] fn test_ls_long_formats() { let scene = TestScenario::new(util_name!()); From a2658250fc12f7b1d55978afa3774dd8263955c9 Mon Sep 17 00:00:00 2001 From: jaggededgedjustice Date: Wed, 5 May 2021 22:12:17 +0100 Subject: [PATCH 0550/1135] Fix fmt crashing on subtracting unsigned numbers (#2178) --- src/uu/fmt/src/linebreak.rs | 2 +- tests/by-util/test_fmt.rs | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/uu/fmt/src/linebreak.rs b/src/uu/fmt/src/linebreak.rs index 50cb6f77f..fe9f8568e 100644 --- a/src/uu/fmt/src/linebreak.rs +++ b/src/uu/fmt/src/linebreak.rs @@ -296,7 +296,7 @@ fn find_kp_breakpoints<'a, T: Iterator>>( (0, 0.0) } else { compute_demerits( - (args.opts.goal - tlen) as isize, + args.opts.goal as isize - tlen as isize, stretch, w.word_nchars as isize, active.prev_rat, diff --git a/tests/by-util/test_fmt.rs b/tests/by-util/test_fmt.rs index 21a5f3396..a83fae58e 100644 --- a/tests/by-util/test_fmt.rs +++ b/tests/by-util/test_fmt.rs @@ -33,18 +33,16 @@ fn test_fmt_w_too_big() { "fmt: error: invalid width: '2501': Numerical result out of range" ); } -/* #[test] - Fails for now, see https://github.com/uutils/coreutils/issues/1501 +#[test] fn test_fmt_w() { let result = new_ucmd!() .arg("-w") .arg("10") .arg("one-word-per-line.txt") .run(); - //.stdout_is_fixture("call_graph.expected"); - assert_eq!(result.stdout_str().trim(), "this is a file with one word per line"); + //.stdout_is_fixture("call_graph.expected"); + assert_eq!( + result.stdout_str().trim(), + "this is\na file\nwith one\nword per\nline" + ); } - - -fmt is pretty broken in general, needs more works to have more tests - */ From 9f9735694db35ac47b4ad1b01b146c3d80f377d7 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 5 May 2021 22:52:07 +0200 Subject: [PATCH 0551/1135] refresh cargo.lock with recent updates --- Cargo.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3cd0c7cda..a0169b412 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -618,7 +618,7 @@ checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.7", + "redox_syscall 0.2.8", "winapi 0.3.9", ] @@ -1259,9 +1259,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85dd92e586f7355c633911e11f77f3d12f04b1b1bd76a198bd34ae3af8341ef2" +checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc" dependencies = [ "bitflags", ] @@ -1272,7 +1272,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" dependencies = [ - "redox_syscall 0.2.7", + "redox_syscall 0.2.8", ] [[package]] @@ -1537,7 +1537,7 @@ checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ "libc", "numtoa", - "redox_syscall 0.2.7", + "redox_syscall 0.2.8", "redox_termios", ] From 928fc59845d9854fd16ae324d4ed82882bec99bd Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 6 May 2021 10:43:48 +0200 Subject: [PATCH 0552/1135] Ignore test_lookup until issue #2181 is fixed --- tests/by-util/test_who.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index a5637f23a..8aeecfb55 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -162,6 +162,7 @@ fn test_users() { #[cfg(target_os = "linux")] #[test] +#[ignore] fn test_lookup() { for opt in vec!["--lookup"] { new_ucmd!() From cdd3998a445ea31a14320d27b97f1f8d74d3af4d Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Thu, 6 May 2021 14:10:16 +0200 Subject: [PATCH 0553/1135] gitignore: add ds_store files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 11f46e13e..77e8f717e 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ Cargo.lock lib*.a /docs/_build *.iml +### macOS ### +.DS_Store From b24b9d501bfc84702f635669d703a7a7aa0156fc Mon Sep 17 00:00:00 2001 From: Idan Attias Date: Thu, 6 May 2021 10:52:35 +0300 Subject: [PATCH 0554/1135] logname: replace getopts with clap --- Cargo.lock | 1 + src/uu/logname/Cargo.toml | 1 + src/uu/logname/src/logname.rs | 16 ++++++++-------- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a0169b412..24c008040 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2068,6 +2068,7 @@ dependencies = [ name = "uu_logname" version = "0.0.6" dependencies = [ + "clap", "libc", "uucore", "uucore_procs", diff --git a/src/uu/logname/Cargo.toml b/src/uu/logname/Cargo.toml index 416f817d7..4aa4d68f4 100644 --- a/src/uu/logname/Cargo.toml +++ b/src/uu/logname/Cargo.toml @@ -16,6 +16,7 @@ path = "src/logname.rs" [dependencies] libc = "0.2.42" +clap = "2.33" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/logname/src/logname.rs b/src/uu/logname/src/logname.rs index 8c6a946f5..9f9319e65 100644 --- a/src/uu/logname/src/logname.rs +++ b/src/uu/logname/src/logname.rs @@ -13,7 +13,8 @@ extern crate uucore; use std::ffi::CStr; -use uucore::InvalidEncodingHandling; + +use clap::App; extern "C" { // POSIX requires using getlogin (or equivalent code) @@ -31,15 +32,14 @@ fn get_userlogin() -> Option { } } -static SYNTAX: &str = ""; static SUMMARY: &str = "Print user's login name"; -static LONG_HELP: &str = ""; +static VERSION: &str = env!("CARGO_PKG_VERSION"); -pub fn uumain(args: impl uucore::Args) -> i32 { - app!(SYNTAX, SUMMARY, LONG_HELP).parse( - args.collect_str(InvalidEncodingHandling::ConvertLossy) - .accept_any(), - ); +pub fn uumain(_: impl uucore::Args) -> i32 { + let _ = App::new(executable!()) + .version(VERSION) + .about(SUMMARY) + .get_matches(); match get_userlogin() { Some(userlogin) => println!("{}", userlogin), From 41eb930292ba994b11e03dd700a0180f008c5d9b Mon Sep 17 00:00:00 2001 From: Idan Attias Date: Thu, 6 May 2021 11:06:38 +0300 Subject: [PATCH 0555/1135] logname: align profile --- src/uu/logname/src/logname.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/uu/logname/src/logname.rs b/src/uu/logname/src/logname.rs index 9f9319e65..ae0f93533 100644 --- a/src/uu/logname/src/logname.rs +++ b/src/uu/logname/src/logname.rs @@ -13,6 +13,7 @@ extern crate uucore; use std::ffi::CStr; +use uucore::InvalidEncodingHandling; use clap::App; @@ -35,10 +36,21 @@ fn get_userlogin() -> Option { static SUMMARY: &str = "Print user's login name"; static VERSION: &str = env!("CARGO_PKG_VERSION"); -pub fn uumain(_: impl uucore::Args) -> i32 { +fn get_usage() -> String { + format!("{0}", executable!()) +} + +pub fn uumain(args: impl uucore::Args) -> i32 { + let _ = args + .collect_str(InvalidEncodingHandling::Ignore) + .accept_any(); + + let usage = get_usage(); + let _ = App::new(executable!()) .version(VERSION) .about(SUMMARY) + .usage(&usage[..]) .get_matches(); match get_userlogin() { From 34b9809223ac5d260fa9931da6206597bf49865a Mon Sep 17 00:00:00 2001 From: Idan Attias Date: Thu, 6 May 2021 11:59:58 +0300 Subject: [PATCH 0556/1135] logname: fix test & style warning --- src/uu/logname/src/logname.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/uu/logname/src/logname.rs b/src/uu/logname/src/logname.rs index ae0f93533..14bf7ef3b 100644 --- a/src/uu/logname/src/logname.rs +++ b/src/uu/logname/src/logname.rs @@ -37,21 +37,20 @@ static SUMMARY: &str = "Print user's login name"; static VERSION: &str = env!("CARGO_PKG_VERSION"); fn get_usage() -> String { - format!("{0}", executable!()) + String::from(executable!()) } pub fn uumain(args: impl uucore::Args) -> i32 { - let _ = args + let args = args .collect_str(InvalidEncodingHandling::Ignore) .accept_any(); let usage = get_usage(); - let _ = App::new(executable!()) .version(VERSION) .about(SUMMARY) .usage(&usage[..]) - .get_matches(); + .get_matches_from(args); match get_userlogin() { Some(userlogin) => println!("{}", userlogin), From d2ab0dcdedf1fee740690225dd0c761f77201d51 Mon Sep 17 00:00:00 2001 From: Arijit Dey Date: Thu, 6 May 2021 22:10:32 +0530 Subject: [PATCH 0557/1135] Make a nice error when file does not exist --- src/uu/more/Cargo.toml | 1 + src/uu/more/src/more.rs | 40 ++++++++++++++++++++++++++++------------ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index c79216ae5..35c3309e1 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -19,6 +19,7 @@ clap = "2.33" uucore = { version = ">=0.0.7", package = "uucore", path = "../../uucore" } uucore_procs = { version = ">=0.0.5", package = "uucore_procs", path = "../../uucore_procs" } crossterm = ">=0.19" +atty = "*" [target.'cfg(target_os = "redox")'.dependencies] redox_termios = "0.1" diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 45fe3ed81..904787d67 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -24,7 +24,7 @@ extern crate nix; use clap::{App, Arg}; use crossterm::{ event::{self, Event, KeyCode, KeyEvent, KeyModifiers}, - execute, + execute, queue, style::Attribute, terminal, }; @@ -134,16 +134,26 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .get_matches_from(args); let mut buff = String::new(); let mut stdout = setup_term(); - if let Some(filenames) = matches.values_of(options::FILES) { let length = filenames.len(); for (idx, fname) in filenames.clone().enumerate() { - if Path::new(fname).is_dir() { - show_usage_error!("'{}' is a directory.", fname); + let fname = Path::new(fname); + if fname.is_dir() { + terminal::disable_raw_mode().unwrap(); + show_usage_error!("'{}' is a directory.", fname.display()); + return 1; + } + if !fname.exists() { + terminal::disable_raw_mode().unwrap(); + eprintln!( + "{}: cannot open {}: No such file or directory", + executable!(), + fname.display() + ); return 1; } if filenames.len() > 1 { - buff.push_str(&MULTI_FILE_TOP_PROMPT.replace("{}", fname)); + buff.push_str(&MULTI_FILE_TOP_PROMPT.replace("{}", fname.to_str().unwrap())); } let mut reader = BufReader::new(File::open(fname).unwrap()); reader.read_to_string(&mut buff).unwrap(); @@ -151,19 +161,23 @@ pub fn uumain(args: impl uucore::Args) -> i32 { more(&buff, &mut stdout, last); buff.clear(); } + reset_term(&mut stdout); } else { - stdin().read_to_string(&mut buff).unwrap(); - more(&buff, &mut stdout, true); + if atty::isnt(atty::Stream::Stdin) { + let mut stdout = setup_term(); + stdin().read_to_string(&mut buff).unwrap(); + more(&buff, &mut stdout, true); + } else { + show_usage_error!("bad usage"); + } } 0 } #[cfg(not(target_os = "fuchsia"))] fn setup_term() -> std::io::Stdout { - let mut stdout = stdout(); + let stdout = stdout(); terminal::enable_raw_mode().unwrap(); - // Change this to a queue if more commands are executed to avoid too many writes to the terminal - execute!(stdout, terminal::Clear(terminal::ClearType::All)).unwrap(); stdout } @@ -177,8 +191,10 @@ fn setup_term() -> usize { fn reset_term(stdout: &mut std::io::Stdout) { terminal::disable_raw_mode().unwrap(); // Clear the prompt - execute!(stdout, terminal::Clear(terminal::ClearType::CurrentLine)).unwrap(); - println!("\r"); + queue!(stdout, terminal::Clear(terminal::ClearType::CurrentLine)).unwrap(); + // Move cursor to the beginning without printing new line + print!("\r"); + stdout.flush().unwrap(); } #[cfg(target_os = "fuchsia")] From 704c6865b1d3f5a3523b354b60ee30f8ee6c59f2 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 7 May 2021 09:57:31 +0200 Subject: [PATCH 0558/1135] refresh cargo.lock with recent updates --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 24c008040..2362342d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1277,9 +1277,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce5f1ceb7f74abbce32601642fcf8e8508a8a8991e0621c7d750295b9095702b" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" dependencies = [ "aho-corasick", "memchr 2.4.0", @@ -1312,9 +1312,9 @@ dependencies = [ [[package]] name = "retain_mut" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1" +checksum = "e9c17925a9027d298a4603d286befe3f9dc0e8ed02523141914eb628798d6e5b" [[package]] name = "rust-ini" From c38373946a6a24afa02050a9dc41d88bc2afcdd7 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 7 May 2021 21:49:44 +0200 Subject: [PATCH 0559/1135] sort: optimize the Line struct --- Cargo.lock | 9 +-- src/uu/sort/Cargo.toml | 1 - src/uu/sort/src/sort.rs | 118 +++++++++++++++++++++++++--------------- 3 files changed, 74 insertions(+), 54 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2362342d4..13441d4fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1445,12 +1445,6 @@ dependencies = [ "maybe-uninit", ] -[[package]] -name = "smallvec" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" - [[package]] name = "strsim" version = "0.8.0" @@ -1912,7 +1906,7 @@ dependencies = [ "quickcheck", "rand 0.7.3", "rand_chacha", - "smallvec 0.6.14", + "smallvec", "uucore", "uucore_procs", ] @@ -2392,7 +2386,6 @@ dependencies = [ "rand 0.7.3", "rayon", "semver", - "smallvec 1.6.1", "tempdir", "unicode-width", "uucore", diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 3784ccbb0..5221f1f4e 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -21,7 +21,6 @@ clap = "2.33" fnv = "1.0.7" itertools = "0.10.0" semver = "0.9.0" -smallvec = "1.6.1" unicode-width = "0.1.8" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index d8978cb2b..71d912f33 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -20,8 +20,8 @@ mod external_sort; mod numeric_str_cmp; use clap::{App, Arg}; -use external_sort::ext_sort; use custom_str_cmp::custom_str_cmp; +use external_sort::ext_sort; use fnv::FnvHasher; use itertools::Itertools; use numeric_str_cmp::{numeric_str_cmp, NumInfo, NumInfoParseSettings}; @@ -29,7 +29,6 @@ use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; use rayon::prelude::*; use semver::Version; -use smallvec::SmallVec; use std::cmp::Ordering; use std::collections::BinaryHeap; use std::env; @@ -231,7 +230,6 @@ impl SelectionRange { enum NumCache { AsF64(GeneralF64ParseResult), WithInfo(NumInfo), - None, } impl NumCache { @@ -252,7 +250,7 @@ impl NumCache { #[derive(Clone)] struct Selection { range: SelectionRange, - num_cache: NumCache, + num_cache: Option>, } impl Selection { @@ -266,15 +264,17 @@ type Field = Range; #[derive(Clone)] pub struct Line { - line: String, + line: Box, // The common case is not to specify fields. Let's make this fast. - selections: SmallVec<[Selection; 1]>, + first_selection: Selection, + other_selections: Box<[Selection]>, } impl Line { + /// Estimate the number of bytes that this Line is occupying pub fn estimate_size(&self) -> usize { - self.line.capacity() - + self.selections.capacity() * std::mem::size_of::() + self.line.len() + + self.other_selections.len() * std::mem::size_of::() + std::mem::size_of::() } @@ -290,35 +290,22 @@ impl Line { None }; - let selections: SmallVec<[Selection; 1]> = settings - .selectors - .iter() - .map(|selector| { - let mut range = - SelectionRange::new(selector.get_selection(&line, fields.as_deref())); - let num_cache = if selector.settings.mode == SortMode::Numeric - || selector.settings.mode == SortMode::HumanNumeric - { - let (info, num_range) = NumInfo::parse( - range.get_str(&line), - NumInfoParseSettings { - accept_si_units: selector.settings.mode == SortMode::HumanNumeric, - thousands_separator: Some(THOUSANDS_SEP), - decimal_pt: Some(DECIMAL_PT), - }, - ); - range.shorten(num_range); - NumCache::WithInfo(info) - } else if selector.settings.mode == SortMode::GeneralNumeric { - let str = range.get_str(&line); - NumCache::AsF64(general_f64_parse(&str[get_leading_gen(str)])) - } else { - NumCache::None - }; - Selection { range, num_cache } - }) + let mut selectors = settings.selectors.iter(); + + let first_selection = selectors + .next() + .unwrap() + .get_selection(&line, fields.as_deref()); + + let other_selections: Vec = selectors + .map(|selector| selector.get_selection(&line, fields.as_deref())) .collect(); - Self { line, selections } + + Self { + line: line.into_boxed_str(), + first_selection, + other_selections: other_selections.into_boxed_slice(), + } } /// Writes indicators for the selections this line matched. The original line content is NOT expected @@ -337,7 +324,7 @@ impl Line { let fields = tokenize(&self.line, settings.separator); for selector in settings.selectors.iter() { - let mut selection = selector.get_selection(&self.line, Some(&fields)); + let mut selection = selector.get_range(&self.line, Some(&fields)); match selector.settings.mode { SortMode::Numeric | SortMode::HumanNumeric => { // find out which range is used for numeric comparisons @@ -594,9 +581,35 @@ impl FieldSelector { self.from.field != 1 || self.from.char == 0 || self.to.is_some() } + fn get_selection(&self, line: &str, fields: Option<&[Field]>) -> Selection { + let mut range = SelectionRange::new(self.get_range(&line, fields)); + let num_cache = if self.settings.mode == SortMode::Numeric + || self.settings.mode == SortMode::HumanNumeric + { + let (info, num_range) = NumInfo::parse( + range.get_str(&line), + NumInfoParseSettings { + accept_si_units: self.settings.mode == SortMode::HumanNumeric, + thousands_separator: Some(THOUSANDS_SEP), + decimal_pt: Some(DECIMAL_PT), + }, + ); + range.shorten(num_range); + Some(Box::new(NumCache::WithInfo(info))) + } else if self.settings.mode == SortMode::GeneralNumeric { + let str = range.get_str(&line); + Some(Box::new(NumCache::AsF64(general_f64_parse( + &str[get_leading_gen(str)], + )))) + } else { + None + }; + Selection { range, num_cache } + } + /// Look up the slice that corresponds to this selector for the given line. - /// If needs_fields returned false, fields may be None. - fn get_selection<'a>(&self, line: &'a str, tokens: Option<&[Field]>) -> Range { + /// If needs_fields returned false, tokens may be None. + fn get_range<'a>(&self, line: &'a str, tokens: Option<&[Field]>) -> Range { enum Resolution { // The start index of the resolved character, inclusive StartOfChar(usize), @@ -1237,8 +1250,11 @@ fn sort_by(unsorted: &mut Vec, settings: &GlobalSettings) { fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering { for (idx, selector) in global_settings.selectors.iter().enumerate() { - let a_selection = &a.selections[idx]; - let b_selection = &b.selections[idx]; + let (a_selection, b_selection) = if idx == 0 { + (&a.first_selection, &b.first_selection) + } else { + (&a.other_selections[idx - 1], &b.other_selections[idx - 1]) + }; let a_str = a_selection.get_str(a); let b_str = b_selection.get_str(b); let settings = &selector.settings; @@ -1248,12 +1264,12 @@ fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering } else { match settings.mode { SortMode::Numeric | SortMode::HumanNumeric => numeric_str_cmp( - (a_str, a_selection.num_cache.as_num_info()), - (b_str, b_selection.num_cache.as_num_info()), + (a_str, a_selection.num_cache.as_ref().unwrap().as_num_info()), + (b_str, b_selection.num_cache.as_ref().unwrap().as_num_info()), ), SortMode::GeneralNumeric => general_numeric_compare( - a_selection.num_cache.as_f64(), - b_selection.num_cache.as_f64(), + a_selection.num_cache.as_ref().unwrap().as_f64(), + b_selection.num_cache.as_ref().unwrap().as_f64(), ), SortMode::Month => month_compare(a_str, b_str), SortMode::Version => version_compare(a_str, b_str), @@ -1591,4 +1607,16 @@ mod tests { let line = "..a..a"; assert_eq!(tokenize(line, Some('a')), vec![0..2, 3..5]); } + + #[test] + #[cfg(target_pointer_width = "64")] + fn test_line_size() { + // We should make sure to not regress the size of the Line struct because + // it is unconditional overhead for every line we sort. + assert_eq!(std::mem::size_of::(), 56); + // These are the fields of Line: + assert_eq!(std::mem::size_of::>(), 16); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::>(), 16); + } } From 8c9faa16b94c9ef9064b9a2e9d521046619bcc66 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 7 May 2021 21:50:33 +0200 Subject: [PATCH 0560/1135] sort: improve memory usage for extsort --- src/uu/sort/src/external_sort/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/uu/sort/src/external_sort/mod.rs b/src/uu/sort/src/external_sort/mod.rs index 725b17bbd..662250e1d 100644 --- a/src/uu/sort/src/external_sort/mod.rs +++ b/src/uu/sort/src/external_sort/mod.rs @@ -113,7 +113,7 @@ pub fn ext_sort( chunk.push(seq); - if total_read >= settings.buffer_size { + if total_read + chunk.len() * std::mem::size_of::() >= settings.buffer_size { super::sort_by(&mut chunk, &settings); write_chunk( settings, @@ -136,6 +136,9 @@ pub fn ext_sort( iter.chunks += 1; } + // We manually drop here to not go over our memory limit when we allocate below. + drop(chunk); + // initialize buffers for each chunk // // Having a right sized buffer for each chunk for smallish values seems silly to me? From 3b6c7bc9e97c9d01d31cef2e8fd3641743985bc6 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 8 May 2021 00:50:36 +0200 Subject: [PATCH 0561/1135] Fix mistakes with merging --- src/uu/ls/src/ls.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 06bbeddea..bacd4176a 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1332,7 +1332,7 @@ fn display_dir_entry_size(entry: &PathData, config: &Config) -> (usize, usize) { if let Some(md) = entry.md() { ( display_symlink_count(&md).len(), - display_size(md.len(), config).len(), + display_size_or_rdev(&md, config).len(), ) } else { (0, 0) @@ -1503,7 +1503,7 @@ fn display_item_long( let _ = writeln!( out, " {} {} {}", - pad_left(display_size(md.len(), config), max_size), + pad_left(display_size_or_rdev(md, config), max_size), display_date(&md, config), // unwrap is fine because it fails when metadata is not available // but we already know that it is because it's checked at the @@ -1658,7 +1658,7 @@ fn format_prefixed(prefixed: NumberPrefix) -> String { } } -fn display_size(metadata: &Metadata, config: &Config) -> String { +fn display_size_or_rdev(metadata: &Metadata, config: &Config) -> String { #[cfg(unix)] { let ft = metadata.file_type(); @@ -1670,12 +1670,16 @@ fn display_size(metadata: &Metadata, config: &Config) -> String { } } + display_size(metadata.len(), config) +} + +fn display_size(size: u64, config: &Config) -> String { // NOTE: The human-readable behaviour deviates from the GNU ls. // The GNU ls uses binary prefixes by default. match config.size_format { - SizeFormat::Binary => format_prefixed(NumberPrefix::binary(len as f64)), - SizeFormat::Decimal => format_prefixed(NumberPrefix::decimal(len as f64)), - SizeFormat::Bytes => len.to_string(), + SizeFormat::Binary => format_prefixed(NumberPrefix::binary(size as f64)), + SizeFormat::Decimal => format_prefixed(NumberPrefix::decimal(size as f64)), + SizeFormat::Bytes => size.to_string(), } } From c0c240f194da65e1cc53d7d878cd89fb00d346bb Mon Sep 17 00:00:00 2001 From: David Carlier Date: Wed, 5 May 2021 19:05:03 +0100 Subject: [PATCH 0562/1135] du: fix couple of du unit tests for FreeBSD. --- tests/by-util/test_du.rs | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index 111f2dc90..c1b7fcb7b 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -53,7 +53,11 @@ fn _du_basics_subdir(s: &str) { fn _du_basics_subdir(s: &str) { assert_eq!(s, "0\tsubdir/deeper\n"); } -#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] +#[cfg(target_os = "freebsd")] +fn _du_basics_subdir(s: &str) { + assert_eq!(s, "8\tsubdir/deeper\n"); +} +#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "freebsd")))] fn _du_basics_subdir(s: &str) { // MS-WSL linux has altered expected output if !uucore::os::is_wsl_1() { @@ -100,7 +104,11 @@ fn _du_soft_link(s: &str) { fn _du_soft_link(s: &str) { assert_eq!(s, "8\tsubdir/links\n"); } -#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] +#[cfg(target_os = "freebsd")] +fn _du_soft_link(s: &str) { + assert_eq!(s, "16\tsubdir/links\n"); +} +#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "freebsd")))] fn _du_soft_link(s: &str) { // MS-WSL linux has altered expected output if !uucore::os::is_wsl_1() { @@ -141,7 +149,11 @@ fn _du_hard_link(s: &str) { fn _du_hard_link(s: &str) { assert_eq!(s, "8\tsubdir/links\n") } -#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] +#[cfg(target_os = "freebsd")] +fn _du_hard_link(s: &str) { + assert_eq!(s, "16\tsubdir/links\n") +} +#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "freebsd")))] fn _du_hard_link(s: &str) { // MS-WSL linux has altered expected output if !uucore::os::is_wsl_1() { @@ -181,7 +193,11 @@ fn _du_d_flag(s: &str) { fn _du_d_flag(s: &str) { assert_eq!(s, "8\t./subdir\n8\t./\n"); } -#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] +#[cfg(target_os = "freebsd")] +fn _du_d_flag(s: &str) { + assert_eq!(s, "28\t./subdir\n36\t./\n"); +} +#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "freebsd")))] fn _du_d_flag(s: &str) { // MS-WSL linux has altered expected output if !uucore::os::is_wsl_1() { From 64c1f164211d6f7bb147cf2be9c14e963aad2cf2 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 7 May 2021 23:40:07 +0200 Subject: [PATCH 0563/1135] sort: allow some functions to be called with OsStr --- src/uu/sort/src/sort.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index d8978cb2b..730be0039 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -20,8 +20,8 @@ mod external_sort; mod numeric_str_cmp; use clap::{App, Arg}; -use external_sort::ext_sort; use custom_str_cmp::custom_str_cmp; +use external_sort::ext_sort; use fnv::FnvHasher; use itertools::Itertools; use numeric_str_cmp::{numeric_str_cmp, NumInfo, NumInfoParseSettings}; @@ -33,6 +33,7 @@ use smallvec::SmallVec; use std::cmp::Ordering; use std::collections::BinaryHeap; use std::env; +use std::ffi::OsStr; use std::fs::File; use std::hash::{Hash, Hasher}; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; @@ -1109,10 +1110,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { exec(files, settings) } -fn file_to_lines_iter<'a>( - file: &str, - settings: &'a GlobalSettings, -) -> Option + 'a> { +fn file_to_lines_iter( + file: impl AsRef, + settings: &'_ GlobalSettings, +) -> Option + '_> { let (reader, _) = match open(file) { Some(x) => x, None => return None, @@ -1177,7 +1178,7 @@ fn exec(files: Vec, settings: GlobalSettings) -> i32 { let mut lines = vec![]; // This is duplicated from fn file_to_lines_iter, but using that function directly results in a performance regression. - for (file, _) in files.iter().map(|file| open(file)).flatten() { + for (file, _) in files.iter().map(open).flatten() { let buf_reader = BufReader::new(file); for line in buf_reader.split(if settings.zero_terminated { b'\0' @@ -1501,7 +1502,8 @@ fn print_sorted>(iter: T, settings: &GlobalSettings) { } // from cat.rs -fn open(path: &str) -> Option<(Box, bool)> { +fn open(path: impl AsRef) -> Option<(Box, bool)> { + let path = path.as_ref(); if path == "-" { let stdin = stdin(); return Some((Box::new(stdin) as Box, is_stdin_interactive())); @@ -1510,7 +1512,7 @@ fn open(path: &str) -> Option<(Box, bool)> { match File::open(Path::new(path)) { Ok(f) => Some((Box::new(f) as Box, false)), Err(e) => { - show_error!("{0}: {1}", path, e.to_string()); + show_error!("{0:?}: {1}", path, e.to_string()); None } } From 38effc93b3d8a34a1136a9911eb9b1e0da7359c7 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 7 May 2021 23:39:00 +0200 Subject: [PATCH 0564/1135] sort: use FileMerger for extsort merge step MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FileMerger is much more efficient than the previous algorithm, which looped over all elements every time to determine the next element. FileMerger uses a BinaryHeap, which should bring the complexity for the merge step down from O(n²) to O(n log n). --- src/uu/sort/src/external_sort/mod.rs | 178 +++++---------------------- 1 file changed, 30 insertions(+), 148 deletions(-) diff --git a/src/uu/sort/src/external_sort/mod.rs b/src/uu/sort/src/external_sort/mod.rs index 725b17bbd..af6902367 100644 --- a/src/uu/sort/src/external_sort/mod.rs +++ b/src/uu/sort/src/external_sort/mod.rs @@ -1,91 +1,33 @@ -use std::cmp::Ordering; -use std::collections::VecDeque; -use std::fs::{File, OpenOptions}; -use std::io::SeekFrom; -use std::io::{BufRead, BufReader, BufWriter, Seek, Write}; +use std::fs::OpenOptions; +use std::io::{BufWriter, Write}; use std::path::Path; use tempdir::TempDir; +use crate::{file_to_lines_iter, FileMerger}; + use super::{GlobalSettings, Line}; /// Iterator that provides sorted `T`s -pub struct ExtSortedIterator { - buffers: Vec>, - chunk_offsets: Vec, - max_per_chunk: usize, - chunks: usize, - tmp_dir: TempDir, - settings: GlobalSettings, - failed: bool, +pub struct ExtSortedIterator<'a> { + file_merger: FileMerger<'a>, + // Keep tmp_dir around, it is deleted when dropped. + _tmp_dir: TempDir, } -impl Iterator for ExtSortedIterator { +impl<'a> Iterator for ExtSortedIterator<'a> { type Item = Line; - - /// # Errors - /// - /// This method can fail due to issues reading intermediate sorted chunks - /// from disk fn next(&mut self) -> Option { - if self.failed { - return None; - } - // fill up any empty buffers - let mut empty = true; - for chunk_num in 0..self.chunks { - if self.buffers[chunk_num as usize].is_empty() { - let mut f = crash_if_err!( - 1, - File::open(self.tmp_dir.path().join(chunk_num.to_string())) - ); - crash_if_err!(1, f.seek(SeekFrom::Start(self.chunk_offsets[chunk_num]))); - let bytes_read = fill_buff( - &mut self.buffers[chunk_num as usize], - f, - self.max_per_chunk, - &self.settings, - ); - self.chunk_offsets[chunk_num as usize] += bytes_read as u64; - if !self.buffers[chunk_num as usize].is_empty() { - empty = false; - } - } else { - empty = false; - } - } - if empty { - return None; - } - - // find the next record to write - // check is_empty() before unwrap()ing - let mut idx = 0; - for chunk_num in 0..self.chunks as usize { - if !self.buffers[chunk_num].is_empty() - && (self.buffers[idx].is_empty() - || super::compare_by( - self.buffers[chunk_num].front().unwrap(), - self.buffers[idx].front().unwrap(), - &self.settings, - ) == Ordering::Less) - { - idx = chunk_num; - } - } - - // unwrap due to checks above - let r = self.buffers[idx].pop_front().unwrap(); - Some(r) + self.file_merger.next() } } /// Sort (based on `compare`) the `T`s provided by `unsorted` and return an /// iterator /// -/// # Errors +/// # Panics /// -/// This method can fail due to issues writing intermediate sorted chunks +/// This method can panic due to issues writing intermediate sorted chunks /// to disk. pub fn ext_sort( unsorted: impl Iterator, @@ -93,19 +35,12 @@ pub fn ext_sort( ) -> ExtSortedIterator { let tmp_dir = crash_if_err!(1, TempDir::new_in(&settings.tmp_dir, "uutils_sort")); - let mut iter = ExtSortedIterator { - buffers: Vec::new(), - chunk_offsets: Vec::new(), - max_per_chunk: 0, - chunks: 0, - tmp_dir, - settings: settings.clone(), - failed: false, - }; - let mut total_read = 0; let mut chunk = Vec::new(); + let mut chunks_read = 0; + let mut file_merger = FileMerger::new(settings); + // make the initial chunks on disk for seq in unsorted { let seq_size = seq.estimate_size(); @@ -113,62 +48,35 @@ pub fn ext_sort( chunk.push(seq); - if total_read >= settings.buffer_size { + if total_read >= settings.buffer_size && chunk.len() >= 2 { super::sort_by(&mut chunk, &settings); - write_chunk( - settings, - &iter.tmp_dir.path().join(iter.chunks.to_string()), - &mut chunk, - ); + + let file_path = tmp_dir.path().join(chunks_read.to_string()); + write_chunk(settings, &file_path, &mut chunk); chunk.clear(); total_read = 0; - iter.chunks += 1; + chunks_read += 1; + + file_merger.push_file(Box::new(file_to_lines_iter(file_path, settings).unwrap())) } } // write the last chunk if !chunk.is_empty() { super::sort_by(&mut chunk, &settings); + + let file_path = tmp_dir.path().join(chunks_read.to_string()); write_chunk( settings, - &iter.tmp_dir.path().join(iter.chunks.to_string()), + &tmp_dir.path().join(chunks_read.to_string()), &mut chunk, ); - iter.chunks += 1; + + file_merger.push_file(Box::new(file_to_lines_iter(file_path, settings).unwrap())); } - - // initialize buffers for each chunk - // - // Having a right sized buffer for each chunk for smallish values seems silly to me? - // - // We will have to have the entire iter in memory sometime right? - // Set minimum to the size of the writer buffer, ~8K - - const MINIMUM_READBACK_BUFFER: usize = 8200; - let right_sized_buffer = settings - .buffer_size - .checked_div(iter.chunks) - .unwrap_or(settings.buffer_size); - iter.max_per_chunk = if right_sized_buffer > MINIMUM_READBACK_BUFFER { - right_sized_buffer - } else { - MINIMUM_READBACK_BUFFER - }; - iter.buffers = vec![VecDeque::new(); iter.chunks]; - iter.chunk_offsets = vec![0; iter.chunks]; - for chunk_num in 0..iter.chunks { - let offset = fill_buff( - &mut iter.buffers[chunk_num], - crash_if_err!( - 1, - File::open(iter.tmp_dir.path().join(chunk_num.to_string())) - ), - iter.max_per_chunk, - &settings, - ); - iter.chunk_offsets[chunk_num] = offset as u64; + ExtSortedIterator { + file_merger, + _tmp_dir: tmp_dir, } - - iter } fn write_chunk(settings: &GlobalSettings, file: &Path, chunk: &mut Vec) { @@ -183,29 +91,3 @@ fn write_chunk(settings: &GlobalSettings, file: &Path, chunk: &mut Vec) { } crash_if_err!(1, buf_write.flush()); } - -fn fill_buff( - vec: &mut VecDeque, - file: File, - max_bytes: usize, - settings: &GlobalSettings, -) -> usize { - let mut total_read = 0; - let mut bytes_read = 0; - for line in BufReader::new(file).split(if settings.zero_terminated { - b'\0' - } else { - b'\n' - }) { - let line_s = String::from_utf8(crash_if_err!(1, line)).unwrap(); - bytes_read += line_s.len() + 1; - let deserialized = Line::new(line_s, settings); - total_read += deserialized.estimate_size(); - vec.push_back(deserialized); - if total_read > max_bytes { - break; - } - } - - bytes_read -} From a8853765831ae747affb6af22491ae428a1b6d0e Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 7 May 2021 23:36:36 +0200 Subject: [PATCH 0565/1135] uucore: refactor - reduce duplicate code related to `fs::display_permissions` This is a refactor to reduce duplicate code, it affects chmod/ls/stat. * merge `stat/src/fsext::pretty_access` into `uucore/src/lib/feature/fs::display_permissions_unix` * move tests for `fs::display_permissions` from `test_stat::test_access` to `uucore/src/lib/features/fs::test_display_permissions` * adjust `uu_chmod`, `uu_ls` and `uu_stat` to use `uucore::fs::display_permissions` --- src/uu/chmod/src/chmod.rs | 11 ++-- src/uu/ls/src/ls.rs | 15 +---- src/uu/stat/Cargo.toml | 2 +- src/uu/stat/src/fsext.rs | 66 --------------------- src/uu/stat/src/stat.rs | 4 +- src/uucore/src/lib/features/fs.rs | 97 +++++++++++++++++++++++++++---- tests/by-util/test_stat.rs | 36 ------------ 7 files changed, 97 insertions(+), 134 deletions(-) diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index d01f0316e..88e3403fe 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -15,6 +15,7 @@ use std::fs; use std::os::unix::fs::{MetadataExt, PermissionsExt}; use std::path::Path; use uucore::fs::display_permissions_unix; +use uucore::libc::mode_t; #[cfg(not(windows))] use uucore::mode; use uucore::InvalidEncodingHandling; @@ -306,7 +307,7 @@ impl Chmoder { "mode of '{}' retained as {:04o} ({})", file.display(), fperm, - display_permissions_unix(fperm), + display_permissions_unix(fperm as mode_t, false), ); } Ok(()) @@ -319,9 +320,9 @@ impl Chmoder { "failed to change mode of file '{}' from {:o} ({}) to {:o} ({})", file.display(), fperm, - display_permissions_unix(fperm), + display_permissions_unix(fperm as mode_t, false), mode, - display_permissions_unix(mode) + display_permissions_unix(mode as mode_t, false) ); } Err(1) @@ -331,9 +332,9 @@ impl Chmoder { "mode of '{}' changed from {:o} ({}) to {:o} ({})", file.display(), fperm, - display_permissions_unix(fperm), + display_permissions_unix(fperm as mode_t, false), mode, - display_permissions_unix(mode) + display_permissions_unix(mode as mode_t, false) ); } Ok(()) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index f24bf513e..36f0ad758 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1480,9 +1480,8 @@ fn display_item_long( let _ = write!( out, - "{}{} {}", - display_file_type(md.file_type()), - display_permissions(&md), + "{} {}", + display_permissions(&md, true), pad_left(display_symlink_count(&md), max_links), ); @@ -1668,16 +1667,6 @@ fn display_size(len: u64, config: &Config) -> String { } } -fn display_file_type(file_type: FileType) -> char { - if file_type.is_dir() { - 'd' - } else if file_type.is_symlink() { - 'l' - } else { - '-' - } -} - #[cfg(unix)] fn file_is_executable(md: &Metadata) -> bool { // Mode always returns u32, but the flags might not be, based on the platform diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index 96bf63ffe..c325c20db 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -17,7 +17,7 @@ path = "src/stat.rs" [dependencies] clap = "2.33" time = "0.1.40" -uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "libc"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "libc", "fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/stat/src/fsext.rs b/src/uu/stat/src/fsext.rs index d90099892..53280790e 100644 --- a/src/uu/stat/src/fsext.rs +++ b/src/uu/stat/src/fsext.rs @@ -41,13 +41,6 @@ impl BirthTime for Metadata { } } -#[macro_export] -macro_rules! has { - ($mode:expr, $perm:expr) => { - $mode & $perm != 0 - }; -} - pub fn pretty_time(sec: i64, nsec: i64) -> String { // sec == seconds since UNIX_EPOCH // nsec == nanoseconds since (UNIX_EPOCH + sec) @@ -81,65 +74,6 @@ pub fn pretty_filetype<'a>(mode: mode_t, size: u64) -> &'a str { } } -pub fn pretty_access(mode: mode_t) -> String { - let mut result = String::with_capacity(10); - result.push(match mode & S_IFMT { - S_IFDIR => 'd', - S_IFCHR => 'c', - S_IFBLK => 'b', - S_IFREG => '-', - S_IFIFO => 'p', - S_IFLNK => 'l', - S_IFSOCK => 's', - // TODO: Other file types - _ => '?', - }); - - result.push(if has!(mode, S_IRUSR) { 'r' } else { '-' }); - result.push(if has!(mode, S_IWUSR) { 'w' } else { '-' }); - result.push(if has!(mode, S_ISUID as mode_t) { - if has!(mode, S_IXUSR) { - 's' - } else { - 'S' - } - } else if has!(mode, S_IXUSR) { - 'x' - } else { - '-' - }); - - result.push(if has!(mode, S_IRGRP) { 'r' } else { '-' }); - result.push(if has!(mode, S_IWGRP) { 'w' } else { '-' }); - result.push(if has!(mode, S_ISGID as mode_t) { - if has!(mode, S_IXGRP) { - 's' - } else { - 'S' - } - } else if has!(mode, S_IXGRP) { - 'x' - } else { - '-' - }); - - result.push(if has!(mode, S_IROTH) { 'r' } else { '-' }); - result.push(if has!(mode, S_IWOTH) { 'w' } else { '-' }); - result.push(if has!(mode, S_ISVTX as mode_t) { - if has!(mode, S_IXOTH) { - 't' - } else { - 'T' - } - } else if has!(mode, S_IXOTH) { - 'x' - } else { - '-' - }); - - result -} - use std::borrow::Cow; use std::convert::{AsRef, From}; use std::ffi::CString; diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 5216fb293..d46c54910 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -7,13 +7,13 @@ // spell-checker:ignore (ToDO) mtab fsext showfs otype fmtstr prec ftype blocksize nlink rdev fnodes fsid namelen blksize inodes fstype iosize statfs gnulib NBLOCKSIZE -#[macro_use] mod fsext; pub use crate::fsext::*; #[macro_use] extern crate uucore; use uucore::entries; +use uucore::fs::display_permissions; use clap::{App, Arg, ArgMatches}; use std::borrow::Cow; @@ -575,7 +575,7 @@ impl Stater { } // access rights in human readable form 'A' => { - arg = pretty_access(meta.mode() as mode_t); + arg = display_permissions(&meta, true); otype = OutputType::Str; } // number of blocks allocated (see %B) diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index a72d6ea82..040c36e95 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -8,8 +8,9 @@ #[cfg(unix)] use libc::{ - mode_t, S_IRGRP, S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, S_IWUSR, - S_IXGRP, S_IXOTH, S_IXUSR, + mode_t, S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFLNK, S_IFMT, S_IFREG, S_IFSOCK, S_IRGRP, + S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, S_IWUSR, S_IXGRP, S_IXOTH, + S_IXUSR, }; use std::borrow::Cow; use std::env; @@ -23,9 +24,10 @@ use std::os::unix::fs::MetadataExt; use std::path::{Component, Path, PathBuf}; #[cfg(unix)] +#[macro_export] macro_rules! has { ($mode:expr, $perm:expr) => { - $mode & ($perm as u32) != 0 + $mode & $perm != 0 }; } @@ -240,22 +242,42 @@ pub fn is_stderr_interactive() -> bool { #[cfg(not(unix))] #[allow(unused_variables)] -pub fn display_permissions(metadata: &fs::Metadata) -> String { +pub fn display_permissions(metadata: &fs::Metadata, display_file_type: bool) -> String { + if display_file_type { + return String::from("----------"); + } String::from("---------") } #[cfg(unix)] -pub fn display_permissions(metadata: &fs::Metadata) -> String { +pub fn display_permissions(metadata: &fs::Metadata, display_file_type: bool) -> String { let mode: mode_t = metadata.mode() as mode_t; - display_permissions_unix(mode as u32) + display_permissions_unix(mode, display_file_type) } #[cfg(unix)] -pub fn display_permissions_unix(mode: u32) -> String { - let mut result = String::with_capacity(9); +pub fn display_permissions_unix(mode: mode_t, display_file_type: bool) -> String { + let mut result; + if display_file_type { + result = String::with_capacity(10); + result.push(match mode & S_IFMT { + S_IFDIR => 'd', + S_IFCHR => 'c', + S_IFBLK => 'b', + S_IFREG => '-', + S_IFIFO => 'p', + S_IFLNK => 'l', + S_IFSOCK => 's', + // TODO: Other file types + _ => '?', + }); + } else { + result = String::with_capacity(9); + } + result.push(if has!(mode, S_IRUSR) { 'r' } else { '-' }); result.push(if has!(mode, S_IWUSR) { 'w' } else { '-' }); - result.push(if has!(mode, S_ISUID) { + result.push(if has!(mode, S_ISUID as mode_t) { if has!(mode, S_IXUSR) { 's' } else { @@ -269,7 +291,7 @@ pub fn display_permissions_unix(mode: u32) -> String { result.push(if has!(mode, S_IRGRP) { 'r' } else { '-' }); result.push(if has!(mode, S_IWGRP) { 'w' } else { '-' }); - result.push(if has!(mode, S_ISGID) { + result.push(if has!(mode, S_ISGID as mode_t) { if has!(mode, S_IXGRP) { 's' } else { @@ -283,7 +305,7 @@ pub fn display_permissions_unix(mode: u32) -> String { result.push(if has!(mode, S_IROTH) { 'r' } else { '-' }); result.push(if has!(mode, S_IWOTH) { 'w' } else { '-' }); - result.push(if has!(mode, S_ISVTX) { + result.push(if has!(mode, S_ISVTX as mode_t) { if has!(mode, S_IXOTH) { 't' } else { @@ -355,4 +377,57 @@ mod tests { ); } } + + #[cfg(unix)] + #[test] + fn test_display_permissions() { + assert_eq!( + "drwxr-xr-x", + display_permissions_unix(S_IFDIR | 0o755, true) + ); + assert_eq!( + "rwxr-xr-x", + display_permissions_unix(S_IFDIR | 0o755, false) + ); + assert_eq!( + "-rw-r--r--", + display_permissions_unix(S_IFREG | 0o644, true) + ); + assert_eq!( + "srw-r-----", + display_permissions_unix(S_IFSOCK | 0o640, true) + ); + assert_eq!( + "lrw-r-xr-x", + display_permissions_unix(S_IFLNK | 0o655, true) + ); + assert_eq!("?rw-r-xr-x", display_permissions_unix(0o655, true)); + + assert_eq!( + "brwSr-xr-x", + display_permissions_unix(S_IFBLK | S_ISUID as mode_t | 0o655, true) + ); + assert_eq!( + "brwsr-xr-x", + display_permissions_unix(S_IFBLK | S_ISUID as mode_t | 0o755, true) + ); + + assert_eq!( + "prw---sr--", + display_permissions_unix(S_IFIFO | S_ISGID as mode_t | 0o614, true) + ); + assert_eq!( + "prw---Sr--", + display_permissions_unix(S_IFIFO | S_ISGID as mode_t | 0o604, true) + ); + + assert_eq!( + "c---r-xr-t", + display_permissions_unix(S_IFCHR | S_ISVTX as mode_t | 0o055, true) + ); + assert_eq!( + "c---r-xr-T", + display_permissions_unix(S_IFCHR | S_ISVTX as mode_t | 0o054, true) + ); + } } diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 7b7e990f4..5c4e62610 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -9,42 +9,6 @@ pub use self::stat::*; mod test_fsext { use super::*; - #[test] - fn test_access() { - assert_eq!("drwxr-xr-x", pretty_access(S_IFDIR | 0o755)); - assert_eq!("-rw-r--r--", pretty_access(S_IFREG | 0o644)); - assert_eq!("srw-r-----", pretty_access(S_IFSOCK | 0o640)); - assert_eq!("lrw-r-xr-x", pretty_access(S_IFLNK | 0o655)); - assert_eq!("?rw-r-xr-x", pretty_access(0o655)); - - assert_eq!( - "brwSr-xr-x", - pretty_access(S_IFBLK | S_ISUID as mode_t | 0o655) - ); - assert_eq!( - "brwsr-xr-x", - pretty_access(S_IFBLK | S_ISUID as mode_t | 0o755) - ); - - assert_eq!( - "prw---sr--", - pretty_access(S_IFIFO | S_ISGID as mode_t | 0o614) - ); - assert_eq!( - "prw---Sr--", - pretty_access(S_IFIFO | S_ISGID as mode_t | 0o604) - ); - - assert_eq!( - "c---r-xr-t", - pretty_access(S_IFCHR | S_ISVTX as mode_t | 0o055) - ); - assert_eq!( - "c---r-xr-T", - pretty_access(S_IFCHR | S_ISVTX as mode_t | 0o054) - ); - } - #[test] fn test_file_type() { assert_eq!("block special file", pretty_filetype(S_IFBLK, 0)); From 525f71badafd5191f202ce7fdf95d4b9ceb2a208 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Wed, 5 May 2021 20:59:37 -0400 Subject: [PATCH 0566/1135] wc: rm leading space when printing multiple counts Remove the leading space from the output of `wc` when printing two or more types of counts. Fixes #2173. --- src/uu/wc/src/wc.rs | 55 ++++++++++++++++++++++++++++++++-------- tests/by-util/test_wc.rs | 34 +++++++++---------------- 2 files changed, 57 insertions(+), 32 deletions(-) diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 3b70856fa..43ce11aa8 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -323,7 +323,12 @@ fn wc(files: Vec, settings: &Settings) -> Result<(), u32> { error_count += 1; WordCount::default() }); - max_width = max(max_width, word_count.bytes.to_string().len() + 1); + // Compute the number of digits needed to display the number + // of bytes in the file. Even if the settings indicate that we + // won't *display* the number of bytes, we still use the + // number of digits in the byte count as the width when + // formatting each count as a string for output. + max_width = max(max_width, word_count.bytes.to_string().len()); total_word_count += word_count; results.push(word_count.with_title(path)); } @@ -364,24 +369,54 @@ fn print_stats( min_width = 0; } + let mut is_first: bool = true; + if settings.show_lines { - write!(stdout_lock, "{:1$}", result.count.lines, min_width)?; + if is_first { + write!(stdout_lock, "{:1$}", result.count.lines, min_width)?; + } else { + write!(stdout_lock, " {:1$}", result.count.lines, min_width)?; + } + is_first = false; } if settings.show_words { - write!(stdout_lock, "{:1$}", result.count.words, min_width)?; + if is_first { + write!(stdout_lock, "{:1$}", result.count.words, min_width)?; + } else { + write!(stdout_lock, " {:1$}", result.count.words, min_width)?; + } + is_first = false; } if settings.show_bytes { - write!(stdout_lock, "{:1$}", result.count.bytes, min_width)?; + if is_first { + write!(stdout_lock, "{:1$}", result.count.bytes, min_width)?; + } else { + write!(stdout_lock, " {:1$}", result.count.bytes, min_width)?; + } + is_first = false; } if settings.show_chars { - write!(stdout_lock, "{:1$}", result.count.chars, min_width)?; + if is_first { + write!(stdout_lock, "{:1$}", result.count.chars, min_width)?; + } else { + write!(stdout_lock, " {:1$}", result.count.chars, min_width)?; + } + is_first = false; } if settings.show_max_line_length { - write!( - stdout_lock, - "{:1$}", - result.count.max_line_length, min_width - )?; + if is_first { + write!( + stdout_lock, + "{:1$}", + result.count.max_line_length, min_width + )?; + } else { + write!( + stdout_lock, + " {:1$}", + result.count.max_line_length, min_width + )?; + } } if result.title == "-" { diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index a16f1854e..87a86fca4 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -33,7 +33,7 @@ fn test_stdin_default() { new_ucmd!() .pipe_in_fixture("lorem_ipsum.txt") .run() - .stdout_is(" 13 109 772\n"); + .stdout_is(" 13 109 772\n"); } #[test] @@ -42,7 +42,7 @@ fn test_utf8() { .args(&["-lwmcL"]) .pipe_in_fixture("UTF_8_test.txt") .run() - .stdout_is(" 300 4969 22781 22213 79\n"); + .stdout_is(" 300 4969 22781 22213 79\n"); // GNU returns " 300 2086 22219 22781 79" // TODO: we should fix that to match GNU's behavior } @@ -71,7 +71,7 @@ fn test_stdin_all_counts() { .args(&["-c", "-m", "-l", "-L", "-w"]) .pipe_in_fixture("alice_in_wonderland.txt") .run() - .stdout_is(" 5 57 302 302 66\n"); + .stdout_is(" 5 57 302 302 66\n"); } #[test] @@ -79,7 +79,7 @@ fn test_single_default() { new_ucmd!() .arg("moby_dick.txt") .run() - .stdout_is(" 18 204 1115 moby_dick.txt\n"); + .stdout_is(" 18 204 1115 moby_dick.txt\n"); } #[test] @@ -95,7 +95,7 @@ fn test_single_all_counts() { new_ucmd!() .args(&["-c", "-l", "-L", "-m", "-w", "alice_in_wonderland.txt"]) .run() - .stdout_is(" 5 57 302 302 66 alice_in_wonderland.txt\n"); + .stdout_is(" 5 57 302 302 66 alice_in_wonderland.txt\n"); } #[test] @@ -108,64 +108,54 @@ fn test_multiple_default() { ]) .run() .stdout_is( - " 13 109 772 lorem_ipsum.txt\n 18 204 1115 moby_dick.txt\n 5 57 302 \ - alice_in_wonderland.txt\n 36 370 2189 total\n", + " 13 109 772 lorem_ipsum.txt\n 18 204 1115 moby_dick.txt\n 5 57 302 \ + alice_in_wonderland.txt\n 36 370 2189 total\n", ); } /// Test for an empty file. #[test] fn test_file_empty() { - // TODO There is a leading space in the output that should be - // removed; see issue #2173. new_ucmd!() .args(&["-clmwL", "emptyfile.txt"]) .run() - .stdout_is(" 0 0 0 0 0 emptyfile.txt\n"); + .stdout_is("0 0 0 0 0 emptyfile.txt\n"); } /// Test for an file containing a single non-whitespace character /// *without* a trailing newline. #[test] fn test_file_single_line_no_trailing_newline() { - // TODO There is a leading space in the output that should be - // removed; see issue #2173. new_ucmd!() .args(&["-clmwL", "notrailingnewline.txt"]) .run() - .stdout_is(" 1 1 2 2 1 notrailingnewline.txt\n"); + .stdout_is("1 1 2 2 1 notrailingnewline.txt\n"); } /// Test for a file that has 100 empty lines (that is, the contents of /// the file are the newline character repeated one hundred times). #[test] fn test_file_many_empty_lines() { - // TODO There is a leading space in the output that should be - // removed; see issue #2173. new_ucmd!() .args(&["-clmwL", "manyemptylines.txt"]) .run() - .stdout_is(" 100 0 100 100 0 manyemptylines.txt\n"); + .stdout_is("100 0 100 100 0 manyemptylines.txt\n"); } /// Test for a file that has one long line comprising only spaces. #[test] fn test_file_one_long_line_only_spaces() { - // TODO There is a leading space in the output that should be - // removed; see issue #2173. new_ucmd!() .args(&["-clmwL", "onelongemptyline.txt"]) .run() - .stdout_is(" 1 0 10001 10001 10000 onelongemptyline.txt\n"); + .stdout_is(" 1 0 10001 10001 10000 onelongemptyline.txt\n"); } /// Test for a file that has one long line comprising a single "word". #[test] fn test_file_one_long_word() { - // TODO There is a leading space in the output that should be - // removed; see issue #2173. new_ucmd!() .args(&["-clmwL", "onelongword.txt"]) .run() - .stdout_is(" 1 1 10001 10001 10000 onelongword.txt\n"); + .stdout_is(" 1 1 10001 10001 10000 onelongword.txt\n"); } From ee43655bdbb836ee6e5d461b75b9dd0a12c65ce5 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Fri, 7 May 2021 13:59:31 -0400 Subject: [PATCH 0567/1135] fixup! wc: rm leading space when printing multiple counts --- src/uu/wc/src/wc.rs | 47 ++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 43ce11aa8..b5f2a273b 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -372,51 +372,42 @@ fn print_stats( let mut is_first: bool = true; if settings.show_lines { - if is_first { - write!(stdout_lock, "{:1$}", result.count.lines, min_width)?; - } else { - write!(stdout_lock, " {:1$}", result.count.lines, min_width)?; + if !is_first { + write!(stdout_lock, " ")?; } + write!(stdout_lock, "{:1$}", result.count.lines, min_width)?; is_first = false; } if settings.show_words { - if is_first { - write!(stdout_lock, "{:1$}", result.count.words, min_width)?; - } else { - write!(stdout_lock, " {:1$}", result.count.words, min_width)?; + if !is_first { + write!(stdout_lock, " ")?; } + write!(stdout_lock, "{:1$}", result.count.words, min_width)?; is_first = false; } if settings.show_bytes { - if is_first { - write!(stdout_lock, "{:1$}", result.count.bytes, min_width)?; - } else { - write!(stdout_lock, " {:1$}", result.count.bytes, min_width)?; + if !is_first { + write!(stdout_lock, " ")?; } + write!(stdout_lock, "{:1$}", result.count.bytes, min_width)?; is_first = false; } if settings.show_chars { - if is_first { - write!(stdout_lock, "{:1$}", result.count.chars, min_width)?; - } else { - write!(stdout_lock, " {:1$}", result.count.chars, min_width)?; + if !is_first { + write!(stdout_lock, " ")?; } + write!(stdout_lock, "{:1$}", result.count.chars, min_width)?; is_first = false; } if settings.show_max_line_length { - if is_first { - write!( - stdout_lock, - "{:1$}", - result.count.max_line_length, min_width - )?; - } else { - write!( - stdout_lock, - " {:1$}", - result.count.max_line_length, min_width - )?; + if !is_first { + write!(stdout_lock, " ")?; } + write!( + stdout_lock, + "{:1$}", + result.count.max_line_length, min_width + )?; } if result.title == "-" { From a74a729aa8c6f7b0b38b907a1e227b9d5a61bf4d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 8 May 2021 13:13:52 +0200 Subject: [PATCH 0568/1135] rustfmt the recent change --- tests/by-util/test_df.rs | 2 +- tests/by-util/test_du.rs | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/tests/by-util/test_df.rs b/tests/by-util/test_df.rs index e3b7141d1..ac3776b96 100644 --- a/tests/by-util/test_df.rs +++ b/tests/by-util/test_df.rs @@ -27,7 +27,7 @@ fn test_df_output() { stdout_only("Filesystem Size Used Available Capacity Use% Mounted on \n"); } else { new_ucmd!().arg("-H").arg("-total").succeeds().stdout_only( - "Filesystem Size Used Available Use% Mounted on \n" + "Filesystem Size Used Available Use% Mounted on \n", ); } } diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index c1b7fcb7b..c72bd02a6 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -57,7 +57,11 @@ fn _du_basics_subdir(s: &str) { fn _du_basics_subdir(s: &str) { assert_eq!(s, "8\tsubdir/deeper\n"); } -#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "freebsd")))] +#[cfg(all( + not(target_vendor = "apple"), + not(target_os = "windows"), + not(target_os = "freebsd") +))] fn _du_basics_subdir(s: &str) { // MS-WSL linux has altered expected output if !uucore::os::is_wsl_1() { @@ -108,7 +112,11 @@ fn _du_soft_link(s: &str) { fn _du_soft_link(s: &str) { assert_eq!(s, "16\tsubdir/links\n"); } -#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "freebsd")))] +#[cfg(all( + not(target_vendor = "apple"), + not(target_os = "windows"), + not(target_os = "freebsd") +))] fn _du_soft_link(s: &str) { // MS-WSL linux has altered expected output if !uucore::os::is_wsl_1() { @@ -153,7 +161,11 @@ fn _du_hard_link(s: &str) { fn _du_hard_link(s: &str) { assert_eq!(s, "16\tsubdir/links\n") } -#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "freebsd")))] +#[cfg(all( + not(target_vendor = "apple"), + not(target_os = "windows"), + not(target_os = "freebsd") +))] fn _du_hard_link(s: &str) { // MS-WSL linux has altered expected output if !uucore::os::is_wsl_1() { @@ -197,7 +209,11 @@ fn _du_d_flag(s: &str) { fn _du_d_flag(s: &str) { assert_eq!(s, "28\t./subdir\n36\t./\n"); } -#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "freebsd")))] +#[cfg(all( + not(target_vendor = "apple"), + not(target_os = "windows"), + not(target_os = "freebsd") +))] fn _du_d_flag(s: &str) { // MS-WSL linux has altered expected output if !uucore::os::is_wsl_1() { From 50f4941d4903d13c018a7aeb35eac4f4ebfa103f Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Tue, 4 May 2021 19:04:23 -0400 Subject: [PATCH 0569/1135] wc: refactor WordCount into its own module Move the `WordCount` struct and its implementations into the `wordcount.rs`. --- src/uu/wc/src/wc.rs | 48 ++------------------------------------ src/uu/wc/src/wordcount.rs | 47 +++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 46 deletions(-) create mode 100644 src/uu/wc/src/wordcount.rs diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index b5f2a273b..8e973ccbd 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -12,8 +12,10 @@ extern crate uucore; mod count_bytes; mod countable; +mod wordcount; use count_bytes::count_bytes_fast; use countable::WordCountable; +use wordcount::{TitledWordCount, WordCount}; use clap::{App, Arg, ArgMatches}; use thiserror::Error; @@ -21,7 +23,6 @@ use thiserror::Error; use std::cmp::max; use std::fs::File; use std::io::{self, Write}; -use std::ops::{Add, AddAssign}; use std::path::Path; use std::str::from_utf8; @@ -82,51 +83,6 @@ impl Settings { } } -#[derive(Debug, Default, Copy, Clone)] -struct WordCount { - bytes: usize, - chars: usize, - lines: usize, - words: usize, - max_line_length: usize, -} - -impl Add for WordCount { - type Output = Self; - - fn add(self, other: Self) -> Self { - Self { - bytes: self.bytes + other.bytes, - chars: self.chars + other.chars, - lines: self.lines + other.lines, - words: self.words + other.words, - max_line_length: max(self.max_line_length, other.max_line_length), - } - } -} - -impl AddAssign for WordCount { - fn add_assign(&mut self, other: Self) { - *self = *self + other - } -} - -impl WordCount { - fn with_title(self, title: &str) -> TitledWordCount { - TitledWordCount { title, count: self } - } -} - -/// This struct supplements the actual word count with a title that is displayed -/// to the user at the end of the program. -/// The reason we don't simply include title in the `WordCount` struct is that -/// it would result in unneccesary copying of `String`. -#[derive(Debug, Default, Clone)] -struct TitledWordCount<'a> { - title: &'a str, - count: WordCount, -} - static ABOUT: &str = "Display newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified."; static VERSION: &str = env!("CARGO_PKG_VERSION"); diff --git a/src/uu/wc/src/wordcount.rs b/src/uu/wc/src/wordcount.rs new file mode 100644 index 000000000..38efb216f --- /dev/null +++ b/src/uu/wc/src/wordcount.rs @@ -0,0 +1,47 @@ +use std::cmp::max; +use std::ops::{Add, AddAssign}; + +#[derive(Debug, Default, Copy, Clone)] +pub struct WordCount { + pub bytes: usize, + pub chars: usize, + pub lines: usize, + pub words: usize, + pub max_line_length: usize, +} + +impl Add for WordCount { + type Output = Self; + + fn add(self, other: Self) -> Self { + Self { + bytes: self.bytes + other.bytes, + chars: self.chars + other.chars, + lines: self.lines + other.lines, + words: self.words + other.words, + max_line_length: max(self.max_line_length, other.max_line_length), + } + } +} + +impl AddAssign for WordCount { + fn add_assign(&mut self, other: Self) { + *self = *self + other + } +} + +impl WordCount { + pub fn with_title(self, title: &str) -> TitledWordCount { + TitledWordCount { title, count: self } + } +} + +/// This struct supplements the actual word count with a title that is displayed +/// to the user at the end of the program. +/// The reason we don't simply include title in the `WordCount` struct is that +/// it would result in unneccesary copying of `String`. +#[derive(Debug, Default, Clone)] +pub struct TitledWordCount<'a> { + pub title: &'a str, + pub count: WordCount, +} From ba8f4ea67041c500a2ca55fc09e87408d8a531f2 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Tue, 4 May 2021 22:13:28 -0400 Subject: [PATCH 0570/1135] wc: move counting code into WordCount::from_line() Refactor the counting code from the inner loop of the `wc` program into the `WordCount::from_line()` associated function. This commit also splits that function up into other helper functions that encapsulate decoding characters and finding word boundaries from raw bytes. This commit also implements the `Sum` trait for the `WordCount` struct, so that we can simply call `sum()` on an iterator that yields `WordCount` instances. --- src/uu/wc/src/wc.rs | 73 +++++---------------------------- src/uu/wc/src/wordcount.rs | 84 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 62 deletions(-) diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 8e973ccbd..33b2ba5ec 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -24,7 +24,6 @@ use std::cmp::max; use std::fs::File; use std::io::{self, Write}; use std::path::Path; -use std::str::from_utf8; #[derive(Error, Debug)] pub enum WcError { @@ -163,18 +162,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } -const CR: u8 = b'\r'; -const LF: u8 = b'\n'; -const SPACE: u8 = b' '; -const TAB: u8 = b'\t'; -const SYN: u8 = 0x16_u8; -const FF: u8 = 0x0C_u8; - -#[inline(always)] -fn is_word_separator(byte: u8) -> bool { - byte == SPACE || byte == TAB || byte == CR || byte == SYN || byte == FF -} - fn word_count_from_reader( mut reader: T, settings: &Settings, @@ -195,58 +182,20 @@ fn word_count_from_reader( // we do not need to decode the byte stream if we're only counting bytes/newlines let decode_chars = settings.show_chars || settings.show_words || settings.show_max_line_length; - let mut line_count: usize = 0; - let mut word_count: usize = 0; - let mut byte_count: usize = 0; - let mut char_count: usize = 0; - let mut longest_line_length: usize = 0; - let mut ends_lf: bool; - - // reading from a TTY seems to raise a condition on, rather than return Some(0) like a file. - // hence the option wrapped in a result here - for line_result in reader.lines() { - let raw_line = match line_result { - Ok(l) => l, + // Sum the WordCount for each line. Show a warning for each line + // that results in an IO error when trying to read it. + let total = reader + .lines() + .filter_map(|res| match res { + Ok(line) => Some(line), Err(e) => { show_warning!("Error while reading {}: {}", path, e); - continue; + None } - }; - - // GNU 'wc' only counts lines that end in LF as lines - ends_lf = *raw_line.last().unwrap() == LF; - line_count += ends_lf as usize; - - byte_count += raw_line.len(); - - if decode_chars { - // try and convert the bytes to UTF-8 first - let current_char_count; - match from_utf8(&raw_line[..]) { - Ok(line) => { - word_count += line.split_whitespace().count(); - current_char_count = line.chars().count(); - } - Err(..) => { - word_count += raw_line.split(|&x| is_word_separator(x)).count(); - current_char_count = raw_line.iter().filter(|c| c.is_ascii()).count() - } - } - char_count += current_char_count; - if current_char_count > longest_line_length { - // -L is a GNU 'wc' extension so same behavior on LF - longest_line_length = current_char_count - (ends_lf as usize); - } - } - } - - Ok(WordCount { - bytes: byte_count, - chars: char_count, - lines: line_count, - words: word_count, - max_line_length: longest_line_length, - }) + }) + .map(|line| WordCount::from_line(&line, decode_chars)) + .sum(); + Ok(total) } fn word_count_from_path(path: &str, settings: &Settings) -> WcResult { diff --git a/src/uu/wc/src/wordcount.rs b/src/uu/wc/src/wordcount.rs index 38efb216f..785e57eff 100644 --- a/src/uu/wc/src/wordcount.rs +++ b/src/uu/wc/src/wordcount.rs @@ -1,5 +1,19 @@ use std::cmp::max; +use std::iter::Sum; use std::ops::{Add, AddAssign}; +use std::str::from_utf8; + +const CR: u8 = b'\r'; +const LF: u8 = b'\n'; +const SPACE: u8 = b' '; +const TAB: u8 = b'\t'; +const SYN: u8 = 0x16_u8; +const FF: u8 = 0x0C_u8; + +#[inline(always)] +fn is_word_separator(byte: u8) -> bool { + byte == SPACE || byte == TAB || byte == CR || byte == SYN || byte == FF +} #[derive(Debug, Default, Copy, Clone)] pub struct WordCount { @@ -30,10 +44,80 @@ impl AddAssign for WordCount { } } +impl Sum for WordCount { + fn sum(iter: I) -> WordCount + where + I: Iterator, + { + iter.fold(WordCount::default(), |acc, x| acc + x) + } +} + impl WordCount { + /// Count the characters and whitespace-separated words in the given bytes. + /// + /// `line` is a slice of bytes that will be decoded as ASCII characters. + fn ascii_word_and_char_count(line: &[u8]) -> (usize, usize) { + let word_count = line.split(|&x| is_word_separator(x)).count(); + let char_count = line.iter().filter(|c| c.is_ascii()).count(); + (word_count, char_count) + } + + /// Create a [`WordCount`] from a sequence of bytes representing a line. + /// + /// If the last byte of `line` encodes a newline character (`\n`), + /// then the [`lines`] field will be set to 1. Otherwise, it will + /// be set to 0. The [`bytes`] field is simply the length of + /// `line`. + /// + /// If `decode_chars` is `false`, the [`chars`] and [`words`] + /// fields will be set to 0. If it is `true`, this function will + /// attempt to decode the bytes first as UTF-8, and failing that, + /// as ASCII. + pub fn from_line(line: &[u8], decode_chars: bool) -> WordCount { + // GNU 'wc' only counts lines that end in LF as lines + let lines = (*line.last().unwrap() == LF) as usize; + let bytes = line.len(); + let (words, chars) = if decode_chars { + WordCount::word_and_char_count(line) + } else { + (0, 0) + }; + // -L is a GNU 'wc' extension so same behavior on LF + let max_line_length = if chars > 0 { chars - lines } else { 0 }; + WordCount { + bytes, + chars, + lines, + words, + max_line_length, + } + } + + /// Count the UTF-8 characters and words in the given string slice. + /// + /// `s` is a string slice that is assumed to be a UTF-8 string. + fn utf8_word_and_char_count(s: &str) -> (usize, usize) { + let word_count = s.split_whitespace().count(); + let char_count = s.chars().count(); + (word_count, char_count) + } + pub fn with_title(self, title: &str) -> TitledWordCount { TitledWordCount { title, count: self } } + + /// Count the characters and words in the given slice of bytes. + /// + /// `line` is a slice of bytes that will be decoded as UTF-8 + /// characters, or if that fails, as ASCII characters. + fn word_and_char_count(line: &[u8]) -> (usize, usize) { + // try and convert the bytes to UTF-8 first + match from_utf8(line) { + Ok(s) => WordCount::utf8_word_and_char_count(s), + Err(..) => WordCount::ascii_word_and_char_count(line), + } + } } /// This struct supplements the actual word count with a title that is displayed From a9ac7af9e14a9baa674a43e4164f85234a2d952b Mon Sep 17 00:00:00 2001 From: Samuel Ainsworth Date: Tue, 4 May 2021 00:21:39 -0700 Subject: [PATCH 0571/1135] Simplify parsing of --bytes for the split command --- src/uu/split/src/split.rs | 60 +++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index 4f80e25a3..445c1f205 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -261,31 +261,41 @@ struct ByteSplitter { impl ByteSplitter { fn new(settings: &Settings) -> ByteSplitter { - let mut strategy_param: Vec = settings.strategy_param.chars().collect(); - let suffix = strategy_param.pop().unwrap(); - let multiplier = match suffix { - '0'..='9' => 1usize, - 'b' => 512usize, - 'k' => 1024usize, - 'm' => 1024usize * 1024usize, - _ => crash!(1, "invalid number of bytes"), - }; - let n = if suffix.is_alphabetic() { - match strategy_param - .iter() - .cloned() - .collect::() - .parse::() - { - Ok(a) => a, - Err(e) => crash!(1, "invalid number of bytes: {}", e), - } - } else { - match settings.strategy_param.parse::() { - Ok(a) => a, - Err(e) => crash!(1, "invalid number of bytes: {}", e), - } - }; + // These multipliers are the same as supported by GNU coreutils with the + // exception of zetabytes (2^70) and yottabytes (2^80) as they overflow + // standard machine usize (2^64), so we disable for now. Note however + // that they are supported by the GNU coreutils split. Ignored for now. + let modifiers: Vec<(&str, usize)> = vec![ + ("K", 1024usize), + ("M", 1024 * 1024), + ("G", 1024 * 1024 * 1024), + ("T", 1024 * 1024 * 1024 * 1024), + ("P", 1024 * 1024 * 1024 * 1024 * 1024), + ("E", 1024 * 1024 * 1024 * 1024 * 1024 * 1024), + // ("Z", 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024), + // ("Y", 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024), + ("KB", 1000), + ("MB", 1000 * 1000), + ("GB", 1000 * 1000 * 1000), + ("TB", 1000 * 1000 * 1000 * 1000), + ("PB", 1000 * 1000 * 1000 * 1000 * 1000), + ("EB", 1000 * 1000 * 1000 * 1000 * 1000 * 1000), + // ("ZB", 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000), + // ("YB", 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000), + ]; + + // This sequential find is acceptable since none of the modifiers are + // suffixes of any other modifiers, a la Huffman codes. + let (suffix, multiplier) = modifiers + .iter() + .find(|(suffix, _)| settings.strategy_param.ends_with(suffix)) + .unwrap_or(&("", 1)); + + // Try to parse the actual numeral. + let n = &settings.strategy_param[0..(settings.strategy_param.len() - suffix.len())] + .parse::() + .unwrap_or_else(|_| crash!(1, "invalid number of bytes")); + ByteSplitter { saved_bytes_to_write: n * multiplier, bytes_to_write: n * multiplier, From 7c1395366e151ade7ac3fc3c056e55150d62dedc Mon Sep 17 00:00:00 2001 From: Samuel Ainsworth Date: Tue, 4 May 2021 04:01:01 -0700 Subject: [PATCH 0572/1135] Fix split's handling of non-UTF-8 files --- src/uu/split/src/split.rs | 191 +++++++++++++++++++----------------- tests/by-util/test_split.rs | 98 +++++++++++++----- 2 files changed, 176 insertions(+), 113 deletions(-) diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index 445c1f205..128ef73c6 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -13,11 +13,11 @@ extern crate uucore; mod platform; use clap::{App, Arg}; -use std::char; use std::env; use std::fs::File; -use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; +use std::io::{stdin, BufRead, BufReader, BufWriter, Read, Write}; use std::path::Path; +use std::{char, fs::remove_file}; static NAME: &str = "split"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -213,50 +213,65 @@ struct Settings { verbose: bool, } -struct SplitControl { - current_line: String, // Don't touch - request_new_file: bool, // Splitter implementation requests new file -} - trait Splitter { - // Consume the current_line and return the consumed string - fn consume(&mut self, _: &mut SplitControl) -> String; + // Consume as much as possible from `reader` so as to saturate `writer`. + // Equivalent to finishing one of the part files. Returns the number of + // bytes that have been moved. + fn consume( + &mut self, + reader: &mut BufReader>, + writer: &mut BufWriter>, + ) -> usize; } struct LineSplitter { - saved_lines_to_write: usize, - lines_to_write: usize, + lines_per_split: usize, } impl LineSplitter { fn new(settings: &Settings) -> LineSplitter { - let n = match settings.strategy_param.parse() { - Ok(a) => a, - Err(e) => crash!(1, "invalid number of lines: {}", e), - }; LineSplitter { - saved_lines_to_write: n, - lines_to_write: n, + lines_per_split: settings + .strategy_param + .parse() + .unwrap_or_else(|e| crash!(1, "invalid number of lines: {}", e)), } } } impl Splitter for LineSplitter { - fn consume(&mut self, control: &mut SplitControl) -> String { - self.lines_to_write -= 1; - if self.lines_to_write == 0 { - self.lines_to_write = self.saved_lines_to_write; - control.request_new_file = true; + fn consume( + &mut self, + reader: &mut BufReader>, + writer: &mut BufWriter>, + ) -> usize { + let mut bytes_consumed = 0usize; + let mut buffer = String::with_capacity(1024); + for _ in 0..self.lines_per_split { + let bytes_read = reader + .read_line(&mut buffer) + .unwrap_or_else(|_| crash!(1, "error reading bytes from input file")); + // If we ever read 0 bytes then we know we've hit EOF. + if bytes_read == 0 { + return bytes_consumed; + } + + writer + .write_all(buffer.as_bytes()) + .unwrap_or_else(|_| crash!(1, "error writing bytes to output file")); + // Empty out the String buffer since `read_line` appends instead of + // replaces. + buffer.clear(); + + bytes_consumed += bytes_read; } - control.current_line.clone() + + bytes_consumed } } struct ByteSplitter { - saved_bytes_to_write: usize, - bytes_to_write: usize, - break_on_line_end: bool, - require_whole_line: bool, + bytes_per_split: usize, } impl ByteSplitter { @@ -294,36 +309,44 @@ impl ByteSplitter { // Try to parse the actual numeral. let n = &settings.strategy_param[0..(settings.strategy_param.len() - suffix.len())] .parse::() - .unwrap_or_else(|_| crash!(1, "invalid number of bytes")); + .unwrap_or_else(|e| crash!(1, "invalid number of bytes: {}", e)); ByteSplitter { - saved_bytes_to_write: n * multiplier, - bytes_to_write: n * multiplier, - break_on_line_end: settings.strategy == "b", - require_whole_line: false, + bytes_per_split: n * multiplier, } } } impl Splitter for ByteSplitter { - fn consume(&mut self, control: &mut SplitControl) -> String { - let line = control.current_line.clone(); - let n = std::cmp::min(line.chars().count(), self.bytes_to_write); - if self.require_whole_line && n < line.chars().count() { - self.bytes_to_write = self.saved_bytes_to_write; - control.request_new_file = true; - self.require_whole_line = false; - return "".to_owned(); + fn consume( + &mut self, + reader: &mut BufReader>, + writer: &mut BufWriter>, + ) -> usize { + // We buffer reads and writes. We proceed until `bytes_consumed` is + // equal to `self.bytes_per_split` or we reach EOF. + let mut bytes_consumed = 0usize; + const BUFFER_SIZE: usize = 1024; + let mut buffer = [0u8; BUFFER_SIZE]; + while bytes_consumed < self.bytes_per_split { + // Don't overshoot `self.bytes_per_split`! + let bytes_desired = std::cmp::min(BUFFER_SIZE, self.bytes_per_split - bytes_consumed); + let bytes_read = reader + .read(&mut buffer[0..bytes_desired]) + .unwrap_or_else(|_| crash!(1, "error reading bytes from input file")); + // If we ever read 0 bytes then we know we've hit EOF. + if bytes_read == 0 { + return bytes_consumed; + } + + writer + .write_all(&buffer[0..bytes_read]) + .unwrap_or_else(|_| crash!(1, "error writing bytes to output file")); + + bytes_consumed += bytes_read; } - self.bytes_to_write -= n; - if n == 0 { - self.bytes_to_write = self.saved_bytes_to_write; - control.request_new_file = true; - } - if self.break_on_line_end && n == line.chars().count() { - self.require_whole_line = self.break_on_line_end; - } - line[..n].to_owned() + + bytes_consumed } } @@ -363,14 +386,13 @@ fn split(settings: &Settings) -> i32 { let mut reader = BufReader::new(if settings.input == "-" { Box::new(stdin()) as Box } else { - let r = match File::open(Path::new(&settings.input)) { - Ok(a) => a, - Err(_) => crash!( + let r = File::open(Path::new(&settings.input)).unwrap_or_else(|_| { + crash!( 1, "cannot open '{}' for reading: No such file or directory", settings.input - ), - }; + ) + }); Box::new(r) as Box }); @@ -380,48 +402,39 @@ fn split(settings: &Settings) -> i32 { a => crash!(1, "strategy {} not supported", a), }; - let mut control = SplitControl { - current_line: "".to_owned(), // Request new line - request_new_file: true, // Request new file - }; - - let mut writer = BufWriter::new(Box::new(stdout()) as Box); let mut fileno = 0; loop { - if control.current_line.chars().count() == 0 { - match reader.read_line(&mut control.current_line) { - Ok(0) | Err(_) => break, - _ => {} + // Get a new part file set up, and construct `writer` for it. + let mut filename = settings.prefix.clone(); + filename.push_str( + if settings.numeric_suffix { + num_prefix(fileno, settings.suffix_length) + } else { + str_prefix(fileno, settings.suffix_length) } - } - if control.request_new_file { - let mut filename = settings.prefix.clone(); - filename.push_str( - if settings.numeric_suffix { - num_prefix(fileno, settings.suffix_length) - } else { - str_prefix(fileno, settings.suffix_length) - } - .as_ref(), - ); - filename.push_str(settings.additional_suffix.as_ref()); + .as_ref(), + ); + filename.push_str(settings.additional_suffix.as_ref()); + let mut writer = platform::instantiate_current_writer(&settings.filter, filename.as_str()); - crash_if_err!(1, writer.flush()); - fileno += 1; - writer = platform::instantiate_current_writer(&settings.filter, filename.as_str()); - control.request_new_file = false; - if settings.verbose { - println!("creating file '{}'", filename); + let bytes_consumed = splitter.consume(&mut reader, &mut writer); + writer + .flush() + .unwrap_or_else(|e| crash!(1, "error flushing to output file: {}", e)); + + // If we didn't write anything we should clean up the empty file, and + // break from the loop. + if bytes_consumed == 0 { + // The output file is only ever created if filter's aren't used. + // Complicated, I know... + if settings.filter.is_none() { + remove_file(filename) + .unwrap_or_else(|e| crash!(1, "error removing empty file: {}", e)); } + break; } - let consumed = splitter.consume(&mut control); - crash_if_err!(1, writer.write_all(consumed.as_bytes())); - - let advance = consumed.chars().count(); - let clone = control.current_line.clone(); - let sl = clone; - control.current_line = sl[advance..sl.chars().count()].to_owned(); + fileno += 1; } 0 } diff --git a/tests/by-util/test_split.rs b/tests/by-util/test_split.rs index 521cbbe9a..37856f419 100644 --- a/tests/by-util/test_split.rs +++ b/tests/by-util/test_split.rs @@ -4,11 +4,15 @@ extern crate regex; use self::rand::{thread_rng, Rng}; use self::regex::Regex; use crate::common::util::*; +use rand::SeedableRng; #[cfg(not(windows))] use std::env; -use std::fs::{read_dir, File}; use std::io::Write; use std::path::Path; +use std::{ + fs::{read_dir, File}, + io::BufWriter, +}; fn random_chars(n: usize) -> String { thread_rng() @@ -58,7 +62,7 @@ impl Glob { files.sort(); let mut data: Vec = vec![]; for name in &files { - data.extend(self.directory.read(name).into_bytes()); + data.extend(self.directory.read_bytes(name)); } data } @@ -81,20 +85,30 @@ impl RandomFile { } fn add_bytes(&mut self, bytes: usize) { - let chunk_size: usize = if bytes >= 1024 { 1024 } else { bytes }; - let mut n = bytes; - while n > chunk_size { - let _ = write!(self.inner, "{}", random_chars(chunk_size)); - n -= chunk_size; + // Note that just writing random characters isn't enough to cover all + // cases. We need truly random bytes. + let mut writer = BufWriter::new(&self.inner); + + // Seed the rng so as to avoid spurious test failures. + let mut rng = rand::rngs::StdRng::seed_from_u64(123); + let mut buffer = [0; 1024]; + let mut remaining_size = bytes; + + while remaining_size > 0 { + let to_write = std::cmp::min(remaining_size, buffer.len()); + let buf = &mut buffer[..to_write]; + rng.fill(buf); + writer.write(buf).unwrap(); + + remaining_size -= to_write; } - let _ = write!(self.inner, "{}", random_chars(n)); } /// Add n lines each of size `RandomFile::LINESIZE` fn add_lines(&mut self, lines: usize) { let mut n = lines; while n > 0 { - let _ = writeln!(self.inner, "{}", random_chars(RandomFile::LINESIZE)); + writeln!(self.inner, "{}", random_chars(RandomFile::LINESIZE)).unwrap(); n -= 1; } } @@ -104,18 +118,18 @@ impl RandomFile { fn test_split_default() { let (at, mut ucmd) = at_and_ucmd!(); let name = "split_default"; - let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]]$"); RandomFile::new(&at, name).add_lines(2000); ucmd.args(&[name]).succeeds(); + + let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]]$"); assert_eq!(glob.count(), 2); - assert_eq!(glob.collate(), at.read(name).into_bytes()); + assert_eq!(glob.collate(), at.read_bytes(name)); } #[test] fn test_split_numeric_prefixed_chunks_by_bytes() { let (at, mut ucmd) = at_and_ucmd!(); let name = "split_num_prefixed_chunks_by_bytes"; - let glob = Glob::new(&at, ".", r"a\d\d$"); RandomFile::new(&at, name).add_bytes(10000); ucmd.args(&[ "-d", // --numeric-suffixes @@ -123,52 +137,86 @@ fn test_split_numeric_prefixed_chunks_by_bytes() { "1000", name, "a", ]) .succeeds(); + + let glob = Glob::new(&at, ".", r"a\d\d$"); assert_eq!(glob.count(), 10); - assert_eq!(glob.collate(), at.read(name).into_bytes()); + for filename in glob.collect() { + assert_eq!(glob.directory.metadata(&filename).len(), 1000); + } + assert_eq!(glob.collate(), at.read_bytes(name)); } #[test] fn test_split_str_prefixed_chunks_by_bytes() { let (at, mut ucmd) = at_and_ucmd!(); let name = "split_str_prefixed_chunks_by_bytes"; - let glob = Glob::new(&at, ".", r"b[[:alpha:]][[:alpha:]]$"); RandomFile::new(&at, name).add_bytes(10000); + // Important that this is less than 1024 since that's our internal buffer + // size. Good to test that we don't overshoot. ucmd.args(&["-b", "1000", name, "b"]).succeeds(); + + let glob = Glob::new(&at, ".", r"b[[:alpha:]][[:alpha:]]$"); assert_eq!(glob.count(), 10); - assert_eq!(glob.collate(), at.read(name).into_bytes()); + for filename in glob.collect() { + assert_eq!(glob.directory.metadata(&filename).len(), 1000); + } + assert_eq!(glob.collate(), at.read_bytes(name)); +} + +// This is designed to test what happens when the desired part size is not a +// multiple of the buffer size and we hopefully don't overshoot the desired part +// size. +#[test] +fn test_split_bytes_prime_part_size() { + let (at, mut ucmd) = at_and_ucmd!(); + let name = "test_split_bytes_prime_part_size"; + RandomFile::new(&at, name).add_bytes(10000); + // 1753 is prime and greater than the buffer size, 1024. + ucmd.args(&["-b", "1753", name, "b"]).succeeds(); + + let glob = Glob::new(&at, ".", r"b[[:alpha:]][[:alpha:]]$"); + assert_eq!(glob.count(), 6); + for i in 0..5 { + assert_eq!(glob.directory.metadata(&glob.collect()[i]).len(), 1753); + } + assert_eq!(glob.directory.metadata(&glob.collect()[5]).len(), 1235); + assert_eq!(glob.collate(), at.read_bytes(name)); } #[test] fn test_split_num_prefixed_chunks_by_lines() { let (at, mut ucmd) = at_and_ucmd!(); let name = "split_num_prefixed_chunks_by_lines"; - let glob = Glob::new(&at, ".", r"c\d\d$"); RandomFile::new(&at, name).add_lines(10000); ucmd.args(&["-d", "-l", "1000", name, "c"]).succeeds(); + + let glob = Glob::new(&at, ".", r"c\d\d$"); assert_eq!(glob.count(), 10); - assert_eq!(glob.collate(), at.read(name).into_bytes()); + assert_eq!(glob.collate(), at.read_bytes(name)); } #[test] fn test_split_str_prefixed_chunks_by_lines() { let (at, mut ucmd) = at_and_ucmd!(); let name = "split_str_prefixed_chunks_by_lines"; - let glob = Glob::new(&at, ".", r"d[[:alpha:]][[:alpha:]]$"); RandomFile::new(&at, name).add_lines(10000); ucmd.args(&["-l", "1000", name, "d"]).succeeds(); + + let glob = Glob::new(&at, ".", r"d[[:alpha:]][[:alpha:]]$"); assert_eq!(glob.count(), 10); - assert_eq!(glob.collate(), at.read(name).into_bytes()); + assert_eq!(glob.collate(), at.read_bytes(name)); } #[test] fn test_split_additional_suffix() { let (at, mut ucmd) = at_and_ucmd!(); let name = "split_additional_suffix"; - let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]].txt$"); RandomFile::new(&at, name).add_lines(2000); ucmd.args(&["--additional-suffix", ".txt", name]).succeeds(); + + let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]].txt$"); assert_eq!(glob.count(), 2); - assert_eq!(glob.collate(), at.read(name).into_bytes()); + assert_eq!(glob.collate(), at.read_bytes(name)); } // note: the test_filter* tests below are unix-only @@ -182,15 +230,16 @@ fn test_filter() { // like `test_split_default()` but run a command before writing let (at, mut ucmd) = at_and_ucmd!(); let name = "filtered"; - let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]]$"); let n_lines = 3; RandomFile::new(&at, name).add_lines(n_lines); // change all characters to 'i' ucmd.args(&["--filter=sed s/./i/g > $FILE", name]) .succeeds(); + // assert all characters are 'i' / no character is not 'i' // (assert that command succeded) + let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]]$"); assert!( glob.collate().iter().find(|&&c| { // is not i @@ -209,7 +258,6 @@ fn test_filter_with_env_var_set() { // implemented like `test_split_default()` but run a command before writing let (at, mut ucmd) = at_and_ucmd!(); let name = "filtered"; - let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]]$"); let n_lines = 3; RandomFile::new(&at, name).add_lines(n_lines); @@ -217,7 +265,9 @@ fn test_filter_with_env_var_set() { env::set_var("FILE", &env_var_value); ucmd.args(&[format!("--filter={}", "cat > $FILE").as_str(), name]) .succeeds(); - assert_eq!(glob.collate(), at.read(name).into_bytes()); + + let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]]$"); + assert_eq!(glob.collate(), at.read_bytes(name)); assert!(env::var("FILE").unwrap_or("var was unset".to_owned()) == env_var_value); } From b8a3a8995f875fb4615fd3bbf51e0820cf6bdc95 Mon Sep 17 00:00:00 2001 From: Samuel Ainsworth Date: Tue, 4 May 2021 15:19:35 -0700 Subject: [PATCH 0573/1135] Fix test_split_bytes_prime_part_size --- tests/by-util/test_split.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_split.rs b/tests/by-util/test_split.rs index 37856f419..d83de4323 100644 --- a/tests/by-util/test_split.rs +++ b/tests/by-util/test_split.rs @@ -176,10 +176,13 @@ fn test_split_bytes_prime_part_size() { let glob = Glob::new(&at, ".", r"b[[:alpha:]][[:alpha:]]$"); assert_eq!(glob.count(), 6); + let mut fns = glob.collect(); + // glob.collect() is not guaranteed to return in sorted order, so we sort. + fns.sort(); for i in 0..5 { - assert_eq!(glob.directory.metadata(&glob.collect()[i]).len(), 1753); + assert_eq!(glob.directory.metadata(&fns[i]).len(), 1753); } - assert_eq!(glob.directory.metadata(&glob.collect()[5]).len(), 1235); + assert_eq!(glob.directory.metadata(&fns[5]).len(), 1235); assert_eq!(glob.collate(), at.read_bytes(name)); } From bacad8ed93d00315746fdc5142180a8517f2731c Mon Sep 17 00:00:00 2001 From: Samuel Ainsworth Date: Tue, 4 May 2021 15:21:35 -0700 Subject: [PATCH 0574/1135] Use u128 instead of usize for large numbers, and consistency across architectures --- src/uu/split/src/split.rs | 47 ++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index 128ef73c6..b2d141b8a 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -221,7 +221,7 @@ trait Splitter { &mut self, reader: &mut BufReader>, writer: &mut BufWriter>, - ) -> usize; + ) -> u128; } struct LineSplitter { @@ -244,8 +244,8 @@ impl Splitter for LineSplitter { &mut self, reader: &mut BufReader>, writer: &mut BufWriter>, - ) -> usize { - let mut bytes_consumed = 0usize; + ) -> u128 { + let mut bytes_consumed = 0u128; let mut buffer = String::with_capacity(1024); for _ in 0..self.lines_per_split { let bytes_read = reader @@ -263,7 +263,7 @@ impl Splitter for LineSplitter { // replaces. buffer.clear(); - bytes_consumed += bytes_read; + bytes_consumed += bytes_read as u128; } bytes_consumed @@ -271,32 +271,29 @@ impl Splitter for LineSplitter { } struct ByteSplitter { - bytes_per_split: usize, + bytes_per_split: u128, } impl ByteSplitter { fn new(settings: &Settings) -> ByteSplitter { - // These multipliers are the same as supported by GNU coreutils with the - // exception of zetabytes (2^70) and yottabytes (2^80) as they overflow - // standard machine usize (2^64), so we disable for now. Note however - // that they are supported by the GNU coreutils split. Ignored for now. - let modifiers: Vec<(&str, usize)> = vec![ - ("K", 1024usize), + // These multipliers are the same as supported by GNU coreutils. + let modifiers: Vec<(&str, u128)> = vec![ + ("K", 1024u128), ("M", 1024 * 1024), ("G", 1024 * 1024 * 1024), ("T", 1024 * 1024 * 1024 * 1024), ("P", 1024 * 1024 * 1024 * 1024 * 1024), ("E", 1024 * 1024 * 1024 * 1024 * 1024 * 1024), - // ("Z", 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024), - // ("Y", 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024), + ("Z", 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024), + ("Y", 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024), ("KB", 1000), ("MB", 1000 * 1000), ("GB", 1000 * 1000 * 1000), ("TB", 1000 * 1000 * 1000 * 1000), ("PB", 1000 * 1000 * 1000 * 1000 * 1000), ("EB", 1000 * 1000 * 1000 * 1000 * 1000 * 1000), - // ("ZB", 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000), - // ("YB", 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000), + ("ZB", 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000), + ("YB", 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000), ]; // This sequential find is acceptable since none of the modifiers are @@ -308,7 +305,7 @@ impl ByteSplitter { // Try to parse the actual numeral. let n = &settings.strategy_param[0..(settings.strategy_param.len() - suffix.len())] - .parse::() + .parse::() .unwrap_or_else(|e| crash!(1, "invalid number of bytes: {}", e)); ByteSplitter { @@ -322,15 +319,23 @@ impl Splitter for ByteSplitter { &mut self, reader: &mut BufReader>, writer: &mut BufWriter>, - ) -> usize { + ) -> u128 { // We buffer reads and writes. We proceed until `bytes_consumed` is // equal to `self.bytes_per_split` or we reach EOF. - let mut bytes_consumed = 0usize; + let mut bytes_consumed = 0u128; const BUFFER_SIZE: usize = 1024; let mut buffer = [0u8; BUFFER_SIZE]; while bytes_consumed < self.bytes_per_split { - // Don't overshoot `self.bytes_per_split`! - let bytes_desired = std::cmp::min(BUFFER_SIZE, self.bytes_per_split - bytes_consumed); + // Don't overshoot `self.bytes_per_split`! Note: Using std::cmp::min + // doesn't really work since we have to get types to match which + // can't be done in a way that keeps all conversions safe. + let bytes_desired = if (BUFFER_SIZE as u128) <= self.bytes_per_split - bytes_consumed { + BUFFER_SIZE + } else { + // This is a safe conversion since the difference must be less + // than BUFFER_SIZE in this branch. + (self.bytes_per_split - bytes_consumed) as usize + }; let bytes_read = reader .read(&mut buffer[0..bytes_desired]) .unwrap_or_else(|_| crash!(1, "error reading bytes from input file")); @@ -343,7 +348,7 @@ impl Splitter for ByteSplitter { .write_all(&buffer[0..bytes_read]) .unwrap_or_else(|_| crash!(1, "error writing bytes to output file")); - bytes_consumed += bytes_read; + bytes_consumed += bytes_read as u128; } bytes_consumed From 2ff9cc657039739b3fa22c5a2c47f02544faec3a Mon Sep 17 00:00:00 2001 From: Samuel Ainsworth Date: Tue, 4 May 2021 15:28:46 -0700 Subject: [PATCH 0575/1135] Typo in comment --- src/uu/split/src/split.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index b2d141b8a..726c9b8cd 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -430,7 +430,7 @@ fn split(settings: &Settings) -> i32 { // If we didn't write anything we should clean up the empty file, and // break from the loop. if bytes_consumed == 0 { - // The output file is only ever created if filter's aren't used. + // The output file is only ever created if --filter isn't used. // Complicated, I know... if settings.filter.is_none() { remove_file(filename) From d686f7e48f929c7fccfade292dce0a1dd2ff8eea Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 8 May 2021 22:31:53 +0200 Subject: [PATCH 0576/1135] sort: improve comments --- src/uu/sort/src/sort.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 02e54baf8..776f71058 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -582,11 +582,14 @@ impl FieldSelector { self.from.field != 1 || self.from.char == 0 || self.to.is_some() } - fn get_selection(&self, line: &str, fields: Option<&[Field]>) -> Selection { - let mut range = SelectionRange::new(self.get_range(&line, fields)); + /// Get the selection that corresponds to this selector for the line. + /// If needs_fields returned false, tokens may be None. + fn get_selection(&self, line: &str, tokens: Option<&[Field]>) -> Selection { + let mut range = SelectionRange::new(self.get_range(&line, tokens)); let num_cache = if self.settings.mode == SortMode::Numeric || self.settings.mode == SortMode::HumanNumeric { + // Parse NumInfo for this number. let (info, num_range) = NumInfo::parse( range.get_str(&line), NumInfoParseSettings { @@ -595,20 +598,23 @@ impl FieldSelector { decimal_pt: Some(DECIMAL_PT), }, ); + // Shorten the range to what we need to pass to numeric_str_cmp later. range.shorten(num_range); Some(Box::new(NumCache::WithInfo(info))) } else if self.settings.mode == SortMode::GeneralNumeric { + // Parse this number as f64, as this is the requirement for general numeric sorting. let str = range.get_str(&line); Some(Box::new(NumCache::AsF64(general_f64_parse( &str[get_leading_gen(str)], )))) } else { + // This is not a numeric sort, so we don't need a NumCache. None }; Selection { range, num_cache } } - /// Look up the slice that corresponds to this selector for the given line. + /// Look up the range in the line that corresponds to this selector. /// If needs_fields returned false, tokens may be None. fn get_range<'a>(&self, line: &'a str, tokens: Option<&[Field]>) -> Range { enum Resolution { @@ -1356,7 +1362,8 @@ enum GeneralF64ParseResult { Infinity, } -/// Parse the beginning string into an f64, returning -inf instead of NaN on errors. +/// Parse the beginning string into a GeneralF64ParseResult. +/// Using a GeneralF64ParseResult instead of f64 is necessary to correctly order floats. #[inline(always)] fn general_f64_parse(a: &str) -> GeneralF64ParseResult { // The actual behavior here relies on Rust's implementation of parsing floating points. From e0ebf907a4fec88d81bb20b226f0ade6ae932d60 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 8 May 2021 23:06:17 +0200 Subject: [PATCH 0577/1135] sort: make merging stable When merging files we need to prioritize files that occur earlier in the command line arguments with -m. This also makes the extsort merge step (and thus extsort itself) stable again. --- src/uu/sort/src/sort.rs | 11 ++++++++++- tests/by-util/test_sort.rs | 24 +++++++++++++++++++++++ tests/fixtures/sort/ext_stable.expected | 4 ++++ tests/fixtures/sort/ext_stable.txt | 4 ++++ tests/fixtures/sort/merge_stable.expected | 3 +++ tests/fixtures/sort/merge_stable_1.txt | 2 ++ tests/fixtures/sort/merge_stable_2.txt | 1 + 7 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 tests/fixtures/sort/ext_stable.expected create mode 100644 tests/fixtures/sort/ext_stable.txt create mode 100644 tests/fixtures/sort/merge_stable.expected create mode 100644 tests/fixtures/sort/merge_stable_1.txt create mode 100644 tests/fixtures/sort/merge_stable_2.txt diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 730be0039..d35c62f87 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -686,6 +686,7 @@ struct MergeableFile<'a> { lines: Box + 'a>, current_line: Line, settings: &'a GlobalSettings, + file_index: usize, } // BinaryHeap depends on `Ord`. Note that we want to pop smallest items @@ -693,7 +694,14 @@ struct MergeableFile<'a> { // trick it into the right order by calling reverse() here. impl<'a> Ord for MergeableFile<'a> { fn cmp(&self, other: &MergeableFile) -> Ordering { - compare_by(&self.current_line, &other.current_line, self.settings).reverse() + let comparison = compare_by(&self.current_line, &other.current_line, self.settings); + if comparison == Ordering::Equal { + // If lines are equal, the earlier file takes precedence. + self.file_index.cmp(&other.file_index) + } else { + comparison + } + .reverse() } } @@ -729,6 +737,7 @@ impl<'a> FileMerger<'a> { lines, current_line: next_line, settings: &self.settings, + file_index: self.heap.len(), }; self.heap.push(mergeable_file); } diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 4465e861f..bad9d577e 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -51,6 +51,18 @@ fn test_smaller_than_specified_segment() { .stdout_is_fixture("ext_sort.expected"); } +#[test] +fn test_ext_sort_stable() { + new_ucmd!() + .arg("-n") + .arg("--stable") + .arg("-S") + .arg("0M") + .arg("ext_stable.txt") + .succeeds() + .stdout_only_fixture("ext_stable.expected"); +} + #[test] fn test_extsort_zero_terminated() { new_ucmd!() @@ -566,6 +578,18 @@ fn test_merge_unique() { .stdout_only_fixture("merge_ints_interleaved.expected"); } +#[test] +fn test_merge_stable() { + new_ucmd!() + .arg("-m") + .arg("--stable") + .arg("-n") + .arg("merge_stable_1.txt") + .arg("merge_stable_2.txt") + .succeeds() + .stdout_only_fixture("merge_stable.expected"); +} + #[test] fn test_merge_reversed() { new_ucmd!() diff --git a/tests/fixtures/sort/ext_stable.expected b/tests/fixtures/sort/ext_stable.expected new file mode 100644 index 000000000..11ca4deb7 --- /dev/null +++ b/tests/fixtures/sort/ext_stable.expected @@ -0,0 +1,4 @@ +0a +0a +0b +0b diff --git a/tests/fixtures/sort/ext_stable.txt b/tests/fixtures/sort/ext_stable.txt new file mode 100644 index 000000000..11ca4deb7 --- /dev/null +++ b/tests/fixtures/sort/ext_stable.txt @@ -0,0 +1,4 @@ +0a +0a +0b +0b diff --git a/tests/fixtures/sort/merge_stable.expected b/tests/fixtures/sort/merge_stable.expected new file mode 100644 index 000000000..49f57888d --- /dev/null +++ b/tests/fixtures/sort/merge_stable.expected @@ -0,0 +1,3 @@ +0a +0c +0b diff --git a/tests/fixtures/sort/merge_stable_1.txt b/tests/fixtures/sort/merge_stable_1.txt new file mode 100644 index 000000000..20528104f --- /dev/null +++ b/tests/fixtures/sort/merge_stable_1.txt @@ -0,0 +1,2 @@ +0a +0c \ No newline at end of file diff --git a/tests/fixtures/sort/merge_stable_2.txt b/tests/fixtures/sort/merge_stable_2.txt new file mode 100644 index 000000000..d3523d976 --- /dev/null +++ b/tests/fixtures/sort/merge_stable_2.txt @@ -0,0 +1 @@ +0b \ No newline at end of file From 112b04276922a3c10f39abf88907bccf714d6b30 Mon Sep 17 00:00:00 2001 From: Nicolas Thery Date: Sun, 9 May 2021 15:42:55 +0200 Subject: [PATCH 0578/1135] wc: emit '-' in ouput when set on command-line When stdin is explicitly specified on the command-line with '-', emit it in the output stats to match GNU wc output. Fixes #2188. --- src/uu/wc/src/wc.rs | 100 ++++++++++++++++++++++++++----------- src/uu/wc/src/wordcount.rs | 8 +-- tests/by-util/test_wc.rs | 9 ++++ 3 files changed, 85 insertions(+), 32 deletions(-) diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 33b2ba5ec..226608d40 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -104,6 +104,34 @@ fn get_usage() -> String { ) } +enum StdinKind { + /// Stdin specified on command-line with "-". + Explicit, + + /// Stdin implicitly specified on command-line by not passing any positional argument. + Implicit, +} + +/// Supported inputs. +enum Input { + /// A regular file. + Path(String), + + /// Standard input. + Stdin(StdinKind), +} + +impl Input { + /// Converts input to title that appears in stats. + fn to_title(&self) -> Option<&str> { + match self { + Input::Path(path) => Some(path), + Input::Stdin(StdinKind::Explicit) => Some("-"), + Input::Stdin(StdinKind::Implicit) => None, + } + } +} + pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); @@ -144,18 +172,27 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) .get_matches_from(args); - let mut files: Vec = matches + let mut inputs: Vec = matches .values_of(ARG_FILES) - .map(|v| v.map(ToString::to_string).collect()) + .map(|v| { + v.map(|i| { + if i == "-" { + Input::Stdin(StdinKind::Explicit) + } else { + Input::Path(ToString::to_string(i)) + } + }) + .collect() + }) .unwrap_or_default(); - if files.is_empty() { - files.push("-".to_owned()); + if inputs.is_empty() { + inputs.push(Input::Stdin(StdinKind::Implicit)); } let settings = Settings::new(&matches); - if wc(files, &settings).is_ok() { + if wc(inputs, &settings).is_ok() { 0 } else { 1 @@ -198,32 +235,35 @@ fn word_count_from_reader( Ok(total) } -fn word_count_from_path(path: &str, settings: &Settings) -> WcResult { - if path == "-" { - let stdin = io::stdin(); - let stdin_lock = stdin.lock(); - word_count_from_reader(stdin_lock, settings, path) - } else { - let path_obj = Path::new(path); - if path_obj.is_dir() { - Err(WcError::IsDirectory(path.to_owned())) - } else { - let file = File::open(path)?; - word_count_from_reader(file, settings, path) +fn word_count_from_input(input: &Input, settings: &Settings) -> WcResult { + match input { + Input::Stdin(_) => { + let stdin = io::stdin(); + let stdin_lock = stdin.lock(); + word_count_from_reader(stdin_lock, settings, "-") + } + Input::Path(path) => { + let path_obj = Path::new(path); + if path_obj.is_dir() { + Err(WcError::IsDirectory(path.to_owned())) + } else { + let file = File::open(path)?; + word_count_from_reader(file, settings, path) + } } } } -fn wc(files: Vec, settings: &Settings) -> Result<(), u32> { +fn wc(inputs: Vec, settings: &Settings) -> Result<(), u32> { let mut total_word_count = WordCount::default(); let mut results = vec![]; let mut max_width: usize = 0; let mut error_count = 0; - let num_files = files.len(); + let num_inputs = inputs.len(); - for path in &files { - let word_count = word_count_from_path(&path, settings).unwrap_or_else(|err| { + for input in &inputs { + let word_count = word_count_from_input(&input, settings).unwrap_or_else(|err| { show_error!("{}", err); error_count += 1; WordCount::default() @@ -235,18 +275,22 @@ fn wc(files: Vec, settings: &Settings) -> Result<(), u32> { // formatting each count as a string for output. max_width = max(max_width, word_count.bytes.to_string().len()); total_word_count += word_count; - results.push(word_count.with_title(path)); + results.push(word_count.with_title(input.to_title())); } for result in &results { if let Err(err) = print_stats(settings, &result, max_width) { - show_warning!("failed to print result for {}: {}", result.title, err); + show_warning!( + "failed to print result for {}: {}", + result.title.unwrap_or(""), + err + ); error_count += 1; } } - if num_files > 1 { - let total_result = total_word_count.with_title("total"); + if num_inputs > 1 { + let total_result = total_word_count.with_title(Some("total")); if let Err(err) = print_stats(settings, &total_result, max_width) { show_warning!("failed to print total: {}", err); error_count += 1; @@ -315,10 +359,10 @@ fn print_stats( )?; } - if result.title == "-" { - writeln!(stdout_lock)?; + if let Some(title) = result.title { + writeln!(stdout_lock, " {}", title)?; } else { - writeln!(stdout_lock, " {}", result.title)?; + writeln!(stdout_lock)?; } Ok(()) diff --git a/src/uu/wc/src/wordcount.rs b/src/uu/wc/src/wordcount.rs index 785e57eff..9e2a81fca 100644 --- a/src/uu/wc/src/wordcount.rs +++ b/src/uu/wc/src/wordcount.rs @@ -103,7 +103,7 @@ impl WordCount { (word_count, char_count) } - pub fn with_title(self, title: &str) -> TitledWordCount { + pub fn with_title(self, title: Option<&str>) -> TitledWordCount { TitledWordCount { title, count: self } } @@ -120,12 +120,12 @@ impl WordCount { } } -/// This struct supplements the actual word count with a title that is displayed -/// to the user at the end of the program. +/// This struct supplements the actual word count with an optional title that is +/// displayed to the user at the end of the program. /// The reason we don't simply include title in the `WordCount` struct is that /// it would result in unneccesary copying of `String`. #[derive(Debug, Default, Clone)] pub struct TitledWordCount<'a> { - pub title: &'a str, + pub title: Option<&'a str>, pub count: WordCount, } diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index 87a86fca4..b61d7e3aa 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -36,6 +36,15 @@ fn test_stdin_default() { .stdout_is(" 13 109 772\n"); } +#[test] +fn test_stdin_explicit() { + new_ucmd!() + .pipe_in_fixture("lorem_ipsum.txt") + .arg("-") + .run() + .stdout_is(" 13 109 772 -\n"); +} + #[test] fn test_utf8() { new_ucmd!() From 33206e1adcac4a938d879a815b7804e5ced42d4b Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 9 May 2021 18:42:16 +0200 Subject: [PATCH 0579/1135] Ignore test_domain_socket as it fails too often --- tests/by-util/test_cat.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index c8ae29a9d..67722daa2 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -395,6 +395,7 @@ fn test_dev_full_show_all() { #[test] #[cfg(unix)] +#[ignore] fn test_domain_socket() { use std::io::prelude::*; use std::sync::{Arc, Barrier}; From 8747800697d7d58532c71805cb8f7fbfc32783d6 Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Sun, 9 May 2021 21:53:03 +0300 Subject: [PATCH 0580/1135] Switched 'arch' to use clap instead of getopts --- Cargo.lock | 2 ++ src/uu/arch/Cargo.toml | 1 + src/uu/arch/src/arch.rs | 17 ++++++++++------- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 13441d4fe..730c53547 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1658,6 +1658,7 @@ dependencies = [ name = "uu_arch" version = "0.0.6" dependencies = [ + "clap", "platform-info", "uucore", "uucore_procs", @@ -2406,6 +2407,7 @@ name = "uu_stat" version = "0.0.6" dependencies = [ "clap", + "libc", "time", "uucore", "uucore_procs", diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index 0b4359620..b3fe1f8cb 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -16,6 +16,7 @@ path = "src/arch.rs" [dependencies] platform-info = "0.1" +clap = "2.33" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/arch/src/arch.rs b/src/uu/arch/src/arch.rs index a4c57e282..31278f000 100644 --- a/src/uu/arch/src/arch.rs +++ b/src/uu/arch/src/arch.rs @@ -10,17 +10,20 @@ extern crate uucore; use platform_info::*; -use uucore::InvalidEncodingHandling; -static SYNTAX: &str = "Display machine architecture"; +use clap::App; + +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Display machine architecture"; static SUMMARY: &str = "Determine architecture name for current machine."; -static LONG_HELP: &str = ""; pub fn uumain(args: impl uucore::Args) -> i32 { - app!(SYNTAX, SUMMARY, LONG_HELP).parse( - args.collect_str(InvalidEncodingHandling::ConvertLossy) - .accept_any(), - ); + App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .after_help(SUMMARY) + .get_matches_from(args); + let uts = return_if_err!(1, PlatformInfo::new()); println!("{}", uts.machine().trim()); 0 From 0cc779c73360199b661246fa343101ef07bfece1 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Sun, 9 May 2021 21:36:39 -0400 Subject: [PATCH 0581/1135] tail: simplify unbounded_tail() function Refactor common code out of two branches of the `unbounded_tail()` function into a new `unbounded_tail_collect()` helper function, that collects from an iterator into a `VecDeque` and keeps either the last `n` elements or all but the first `n` elements. This commit also adds a new struct, `RingBuffer`, in a new module, `ringbuffer.rs`, to be responsible for keeping the last `n` elements of an iterator. --- src/uu/tail/src/ringbuffer.rs | 61 ++++++++++++++++++++++ src/uu/tail/src/tail.rs | 98 +++++++++++++---------------------- 2 files changed, 96 insertions(+), 63 deletions(-) create mode 100644 src/uu/tail/src/ringbuffer.rs diff --git a/src/uu/tail/src/ringbuffer.rs b/src/uu/tail/src/ringbuffer.rs new file mode 100644 index 000000000..86483b8ed --- /dev/null +++ b/src/uu/tail/src/ringbuffer.rs @@ -0,0 +1,61 @@ +//! A fixed-size ring buffer. +use std::collections::VecDeque; + +/// A fixed-size ring buffer backed by a `VecDeque`. +/// +/// If the ring buffer is not full, then calling the [`push_back`] +/// method appends elements, as in a [`VecDeque`]. If the ring buffer +/// is full, then calling [`push_back`] removes the element at the +/// front of the buffer (in a first-in, first-out manner) before +/// appending the new element to the back of the buffer. +/// +/// Use [`from_iter`] to take the last `size` elements from an +/// iterator. +/// +/// # Examples +/// +/// After exceeding the size limit, the oldest elements are dropped in +/// favor of the newest element: +/// +/// ```rust,ignore +/// let buffer: RingBuffer = RingBuffer::new(2); +/// buffer.push_back(0); +/// buffer.push_back(1); +/// buffer.push_back(2); +/// assert_eq!(vec![1, 2], buffer.data); +/// ``` +/// +/// Take the last `n` elements from an iterator: +/// +/// ```rust,ignore +/// let iter = vec![0, 1, 2, 3].iter(); +/// assert_eq!(vec![2, 3], RingBuffer::from_iter(iter, 2).data); +/// ``` +pub struct RingBuffer { + pub data: VecDeque, + size: usize, +} + +impl RingBuffer { + pub fn new(size: usize) -> RingBuffer { + RingBuffer { + data: VecDeque::new(), + size, + } + } + + pub fn from_iter(iter: impl Iterator, size: usize) -> RingBuffer { + let mut ringbuf = RingBuffer::new(size); + for value in iter { + ringbuf.push_back(value); + } + ringbuf + } + + pub fn push_back(&mut self, value: T) { + if self.size <= self.data.len() { + self.data.pop_front(); + } + self.data.push_back(value) + } +} diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index fec88e841..0a3ff778d 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -16,6 +16,8 @@ extern crate clap; extern crate uucore; mod platform; +mod ringbuffer; +use ringbuffer::RingBuffer; use clap::{App, Arg}; use std::collections::VecDeque; @@ -482,71 +484,46 @@ fn bounded_tail(mut file: &File, settings: &Settings) { } } +/// Collect the last elements of an iterator into a `VecDeque`. +/// +/// This function returns a [`VecDeque`] containing either the last +/// `count` elements of `iter`, an [`Iterator`] over [`Result`] +/// instances, or all but the first `count` elements of `iter`. If +/// `beginning` is `true`, then all but the first `count` elements are +/// returned. +/// +/// # Panics +/// +/// If any element of `iter` is an [`Err`], then this function panics. +fn unbounded_tail_collect( + iter: impl Iterator>, + count: u64, + beginning: bool, +) -> VecDeque +where + E: fmt::Debug, +{ + if beginning { + iter.skip(count as usize).map(|r| r.unwrap()).collect() + } else { + RingBuffer::from_iter(iter.map(|r| r.unwrap()), count as usize).data + } +} + fn unbounded_tail(reader: &mut BufReader, settings: &Settings) { // 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. match settings.mode { - FilterMode::Lines(mut count, _delimiter) => { - let mut ringbuf: VecDeque = VecDeque::new(); - let mut skip = if settings.beginning { - let temp = count; - count = ::std::u64::MAX; - temp - 1 - } else { - 0 - }; - loop { - let mut datum = String::new(); - match reader.read_line(&mut datum) { - Ok(0) => break, - Ok(_) => { - if skip > 0 { - skip -= 1; - } else { - if count <= ringbuf.len() as u64 { - ringbuf.pop_front(); - } - ringbuf.push_back(datum); - } - } - Err(err) => panic!("{}", err), - } - } - let mut stdout = stdout(); - for datum in &ringbuf { - print_string(&mut stdout, datum); + FilterMode::Lines(count, _) => { + for line in unbounded_tail_collect(reader.lines(), count, settings.beginning) { + println!("{}", line); } } - FilterMode::Bytes(mut count) => { - let mut ringbuf: VecDeque = VecDeque::new(); - let mut skip = if settings.beginning { - let temp = count; - count = ::std::u64::MAX; - temp - 1 - } else { - 0 - }; - loop { - let mut datum = [0; 1]; - match reader.read(&mut datum) { - Ok(0) => break, - Ok(_) => { - if skip > 0 { - skip -= 1; - } else { - if count <= ringbuf.len() as u64 { - ringbuf.pop_front(); - } - ringbuf.push_back(datum[0]); - } - } - Err(err) => panic!("{}", err), - } - } - let mut stdout = stdout(); - for datum in &ringbuf { - print_byte(&mut stdout, *datum); + FilterMode::Bytes(count) => { + for byte in unbounded_tail_collect(reader.bytes(), count, settings.beginning) { + let mut stdout = stdout(); + print_byte(&mut stdout, byte); } } } @@ -562,8 +539,3 @@ fn print_byte(stdout: &mut T, ch: u8) { crash!(1, "{}", err); } } - -#[inline] -fn print_string(_: &mut T, s: &str) { - print!("{}", s); -} From 881bbf512ed544142214066d2b60ff6419b27d73 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 10 May 2021 08:59:45 +0200 Subject: [PATCH 0582/1135] refresh cargo.lock with recent updates --- Cargo.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.lock b/Cargo.lock index 13441d4fe..e729bfcd2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2406,6 +2406,7 @@ name = "uu_stat" version = "0.0.6" dependencies = [ "clap", + "libc", "time", "uucore", "uucore_procs", From 203ee463c74fd0c7f134c2f1009d9a5accf8fbf9 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 9 May 2021 14:21:15 +0200 Subject: [PATCH 0583/1135] stat/uucore: refactor - move fsext.rs to uucore --- src/uu/stat/Cargo.toml | 4 +- src/uu/stat/src/stat.rs | 9 ++-- src/uucore/Cargo.toml | 1 + src/uucore/src/lib/features.rs | 2 + .../src => uucore/src/lib/features}/fsext.rs | 43 ++++++++++++++++--- src/uucore/src/lib/lib.rs | 2 + tests/by-util/test_stat.rs | 27 ------------ 7 files changed, 47 insertions(+), 41 deletions(-) rename src/{uu/stat/src => uucore/src/lib/features}/fsext.rs (93%) diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index c51f972a9..86b7da139 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -16,9 +16,7 @@ path = "src/stat.rs" [dependencies] clap = "2.33" -time = "0.1.40" -libc = "0.2" -uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "libc", "fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "libc", "fs", "fsext"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 905058766..8b148d39d 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -5,15 +5,16 @@ // For the full copyright and license information, please view the LICENSE file // that was distributed with this source code. -// spell-checker:ignore (ToDO) mtab fsext showfs otype fmtstr prec ftype blocksize nlink rdev fnodes fsid namelen blksize inodes fstype iosize statfs gnulib NBLOCKSIZE - -mod fsext; -pub use crate::fsext::*; +// spell-checker:ignore (ToDO) showfs otype fmtstr prec ftype blocksize nlink rdev fnodes fsid namelen blksize inodes fstype iosize statfs gnulib NBLOCKSIZE #[macro_use] extern crate uucore; use uucore::entries; use uucore::fs::display_permissions; +use uucore::fsext::{ + pretty_filetype, pretty_fstype, pretty_time, read_fs_list, statfs, BirthTime, FsMeta, +}; +use uucore::libc::mode_t; use clap::{App, Arg, ArgMatches}; use std::borrow::Cow; diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 291456760..51bb4c66e 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -38,6 +38,7 @@ default = [] encoding = ["data-encoding", "thiserror"] entries = ["libc"] fs = ["libc"] +fsext = ["libc", "time"] mode = ["libc"] parse_time = [] perms = ["libc"] diff --git a/src/uucore/src/lib/features.rs b/src/uucore/src/lib/features.rs index c26225cb7..0287b9675 100644 --- a/src/uucore/src/lib/features.rs +++ b/src/uucore/src/lib/features.rs @@ -4,6 +4,8 @@ pub mod encoding; #[cfg(feature = "fs")] pub mod fs; +#[cfg(feature = "fsext")] +pub mod fsext; #[cfg(feature = "parse_time")] pub mod parse_time; #[cfg(feature = "zero-copy")] diff --git a/src/uu/stat/src/fsext.rs b/src/uucore/src/lib/features/fsext.rs similarity index 93% rename from src/uu/stat/src/fsext.rs rename to src/uucore/src/lib/features/fsext.rs index e831a159e..3c95af73e 100644 --- a/src/uu/stat/src/fsext.rs +++ b/src/uucore/src/lib/features/fsext.rs @@ -9,6 +9,8 @@ extern crate time; +pub use crate::*; // import macros from `../../macros.rs` + #[cfg(target_os = "linux")] static LINUX_MTAB: &str = "/etc/mtab"; #[cfg(target_os = "linux")] @@ -16,12 +18,12 @@ static LINUX_MOUNTINFO: &str = "/proc/self/mountinfo"; static MOUNT_OPT_BIND: &str = "bind"; use self::time::Timespec; -use std::time::UNIX_EPOCH; -pub use uucore::libc::{ +pub use libc::{ c_int, mode_t, strerror, S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFLNK, S_IFMT, S_IFREG, S_IFSOCK, S_IRGRP, S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, S_IWUSR, S_IXGRP, S_IXOTH, S_IXUSR, }; +use std::time::UNIX_EPOCH; pub trait BirthTime { fn pretty_birth(&self) -> String; @@ -93,7 +95,7 @@ use std::path::Path; target_os = "android", target_os = "freebsd" ))] -use uucore::libc::statfs as Sstatfs; +use libc::statfs as Sstatfs; #[cfg(any( target_os = "openbsd", target_os = "netbsd", @@ -101,7 +103,7 @@ use uucore::libc::statfs as Sstatfs; target_os = "bitrig", target_os = "dragonfly" ))] -use uucore::libc::statvfs as Sstatfs; +use libc::statvfs as Sstatfs; #[cfg(any( target_os = "linux", @@ -109,7 +111,7 @@ use uucore::libc::statvfs as Sstatfs; target_os = "android", target_os = "freebsd" ))] -use uucore::libc::statfs as statfs_fn; +use libc::statfs as statfs_fn; #[cfg(any( target_os = "openbsd", target_os = "netbsd", @@ -117,7 +119,7 @@ use uucore::libc::statfs as statfs_fn; target_os = "bitrig", target_os = "dragonfly" ))] -use uucore::libc::statvfs as statfs_fn; +use libc::statvfs as statfs_fn; pub trait FsMeta { fn fs_type(&self) -> i64; @@ -184,7 +186,7 @@ impl FsMeta for Sstatfs { #[cfg(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux"))] fn fsid(&self) -> u64 { let f_fsid: &[u32; 2] = - unsafe { &*(&self.f_fsid as *const uucore::libc::fsid_t as *const [u32; 2]) }; + unsafe { &*(&self.f_fsid as *const libc::fsid_t as *const [u32; 2]) }; (u64::from(f_fsid[0])) << 32 | u64::from(f_fsid[1]) } #[cfg(not(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux")))] @@ -534,3 +536,30 @@ pub fn read_fs_list() -> Vec { .collect::>() } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_file_type() { + assert_eq!("block special file", pretty_filetype(S_IFBLK, 0)); + assert_eq!("character special file", pretty_filetype(S_IFCHR, 0)); + assert_eq!("regular file", pretty_filetype(S_IFREG, 1)); + assert_eq!("regular empty file", pretty_filetype(S_IFREG, 0)); + assert_eq!("weird file", pretty_filetype(0, 0)); + } + + #[test] + fn test_fs_type() { + assert_eq!("ext2/ext3", pretty_fstype(0xEF53)); + assert_eq!("tmpfs", pretty_fstype(0x01021994)); + assert_eq!("nfs", pretty_fstype(0x6969)); + assert_eq!("btrfs", pretty_fstype(0x9123683e)); + assert_eq!("xfs", pretty_fstype(0x58465342)); + assert_eq!("zfs", pretty_fstype(0x2FC12FC1)); + assert_eq!("ntfs", pretty_fstype(0x5346544e)); + assert_eq!("fat", pretty_fstype(0x4006)); + assert_eq!("UNKNOWN (0x1234)", pretty_fstype(0x1234)); + } +} diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 6dddf8696..f2a4292fb 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -35,6 +35,8 @@ pub use crate::mods::ranges; pub use crate::features::encoding; #[cfg(feature = "fs")] pub use crate::features::fs; +#[cfg(feature = "fsext")] +pub use crate::features::fsext; #[cfg(feature = "parse_time")] pub use crate::features::parse_time; #[cfg(feature = "zero-copy")] diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 569d6873e..308dcb9f5 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -5,33 +5,6 @@ use crate::common::util::*; extern crate stat; pub use self::stat::*; -#[cfg(test)] -mod test_fsext { - use super::*; - - #[test] - fn test_file_type() { - assert_eq!("block special file", pretty_filetype(S_IFBLK, 0)); - assert_eq!("character special file", pretty_filetype(S_IFCHR, 0)); - assert_eq!("regular file", pretty_filetype(S_IFREG, 1)); - assert_eq!("regular empty file", pretty_filetype(S_IFREG, 0)); - assert_eq!("weird file", pretty_filetype(0, 0)); - } - - #[test] - fn test_fs_type() { - assert_eq!("ext2/ext3", pretty_fstype(0xEF53)); - assert_eq!("tmpfs", pretty_fstype(0x01021994)); - assert_eq!("nfs", pretty_fstype(0x6969)); - assert_eq!("btrfs", pretty_fstype(0x9123683e)); - assert_eq!("xfs", pretty_fstype(0x58465342)); - assert_eq!("zfs", pretty_fstype(0x2FC12FC1)); - assert_eq!("ntfs", pretty_fstype(0x5346544e)); - assert_eq!("fat", pretty_fstype(0x4006)); - assert_eq!("UNKNOWN (0x1234)", pretty_fstype(0x1234)); - } -} - #[test] fn test_scanutil() { assert_eq!(Some((-5, 2)), "-5zxc".scan_num::()); From 4ac75898c377c433a2cb2698dd09c94dae14540e Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 10 May 2021 13:28:35 +0200 Subject: [PATCH 0584/1135] fix clippy warnings --- src/uu/factor/src/factor.rs | 3 ++- src/uu/ls/src/ls.rs | 4 ++-- src/uu/test/src/parser.rs | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 138254b51..ebe06a1c5 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -163,6 +163,7 @@ pub fn factor(mut n: u64) -> Factors { let (factors, n) = table::factor(n, factors); + #[allow(clippy::let_and_return)] let r = if n < (1 << 32) { _factor::>(n, factors) } else { @@ -280,6 +281,6 @@ impl std::ops::BitXor for Factors { } debug_assert_eq!(r.product(), self.product().pow(rhs.into())); - return r; + r } } diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 16f2ce8ff..c5389295b 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1413,11 +1413,11 @@ fn get_block_size(md: &Metadata, config: &Config) -> u64 { { // hard-coded for now - enabling setting this remains a TODO let ls_block_size = 1024; - return match config.size_format { + match config.size_format { SizeFormat::Binary => md.blocks() * 512, SizeFormat::Decimal => md.blocks() * 512, SizeFormat::Bytes => md.blocks() * 512 / ls_block_size, - }; + } } #[cfg(not(unix))] diff --git a/src/uu/test/src/parser.rs b/src/uu/test/src/parser.rs index f1ca9dad6..2c9c9db30 100644 --- a/src/uu/test/src/parser.rs +++ b/src/uu/test/src/parser.rs @@ -121,6 +121,8 @@ impl Parser { /// Test if the next token in the stream is a BOOLOP (-a or -o), without /// removing the token from the stream. fn peek_is_boolop(&mut self) -> bool { + // TODO: change to `matches!(self.peek(), Symbol::BoolOp(_))` once MSRV is 1.42 + // #[allow(clippy::match_like_matches_macro)] // needs MSRV 1.43 if let Symbol::BoolOp(_) = self.peek() { true } else { From 381f8dafc6eed456f4a9298baba635ccfd5c826b Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 10 May 2021 10:56:33 +0200 Subject: [PATCH 0585/1135] df/uucore: refactor - move duplicate code to uucore/fsext.rs --- src/uu/df/Cargo.toml | 6 +- src/uu/df/src/df.rs | 486 +---------------- src/uucore/Cargo.toml | 3 + src/uucore/src/lib/features/fsext.rs | 754 ++++++++++++++++++--------- src/uucore/src/lib/lib.rs | 4 +- 5 files changed, 519 insertions(+), 734 deletions(-) diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index 4770cb557..0e65fdb32 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -16,14 +16,10 @@ path = "src/df.rs" [dependencies] clap = "2.33" -libc = "0.2" number_prefix = "0.4" -uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["libc", "fsext"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } -[target.'cfg(target_os = "windows")'.dependencies] -winapi = { version = "0.3", features = ["errhandlingapi", "fileapi", "handleapi", "winerror"] } - [[bin]] name = "df" path = "src/main.rs" diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index c917eb2e8..8219b0a27 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -6,22 +6,17 @@ // For the full copyright and license information, please view the LICENSE file // that was distributed with this source code. -// spell-checker:ignore (ToDO) mountinfo mtab BLOCKSIZE getmntinfo fobj mptr noatime Iused overmounted -// spell-checker:ignore (libc/fs) asyncreads asyncwrites autofs bavail bfree bsize charspare cifs debugfs devfs devpts ffree frsize fsid fstypename fusectl inode inodes iosize kernfs mntbufp mntfromname mntonname mqueue namemax pipefs smbfs statfs statvfs subfs syncreads syncwrites sysfs wcslen +// spell-checker:ignore (ToDO) mountinfo BLOCKSIZE fobj mptr noatime Iused overmounted +// spell-checker:ignore (libc/fs) asyncreads asyncwrites autofs bavail bfree bsize charspare cifs debugfs devfs devpts ffree frsize fsid fstypename fusectl inode inodes iosize kernfs mntbufp mntfromname mntonname mqueue namemax pipefs smbfs statvfs subfs syncreads syncwrites sysfs wcslen #[macro_use] extern crate uucore; +#[cfg(unix)] +use uucore::fsext::statfs_fn; +use uucore::fsext::{read_fs_list, FsUsage, MountInfo}; use clap::{App, Arg}; -#[cfg(windows)] -use winapi::um::errhandlingapi::GetLastError; -#[cfg(windows)] -use winapi::um::fileapi::{ - FindFirstVolumeW, FindNextVolumeW, FindVolumeClose, GetDriveTypeW, GetVolumeInformationW, - GetVolumePathNamesForVolumeNameW, QueryDosDeviceW, -}; - use number_prefix::NumberPrefix; use std::cell::Cell; use std::collections::HashMap; @@ -32,41 +27,11 @@ use std::ffi::CString; #[cfg(unix)] use std::mem; -#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] -use libc::c_int; -#[cfg(target_vendor = "apple")] -use libc::statfs; -#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] -use std::ffi::CStr; -#[cfg(any(target_vendor = "apple", target_os = "freebsd", target_os = "windows"))] -use std::ptr; -#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] -use std::slice; - #[cfg(target_os = "freebsd")] -use libc::{c_char, fsid_t, uid_t}; +use uucore::libc::{c_char, fsid_t, uid_t}; -#[cfg(target_os = "linux")] -use std::fs::File; -#[cfg(target_os = "linux")] -use std::io::{BufRead, BufReader}; - -#[cfg(windows)] -use std::ffi::OsString; -#[cfg(windows)] -use std::os::windows::ffi::OsStrExt; -#[cfg(windows)] -use std::os::windows::ffi::OsStringExt; #[cfg(windows)] use std::path::Path; -#[cfg(windows)] -use winapi::shared::minwindef::DWORD; -#[cfg(windows)] -use winapi::um::fileapi::GetDiskFreeSpaceW; -#[cfg(windows)] -use winapi::um::handleapi::INVALID_HANDLE_VALUE; -#[cfg(windows)] -use winapi::um::winbase::DRIVE_REMOTE; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Show information about the file system on which each FILE resides,\n\ @@ -75,14 +40,6 @@ static ABOUT: &str = "Show information about the file system on which each FILE static EXIT_OK: i32 = 0; static EXIT_ERR: i32 = 1; -#[cfg(windows)] -const MAX_PATH: usize = 266; - -#[cfg(target_os = "linux")] -static LINUX_MOUNTINFO: &str = "/proc/self/mountinfo"; -#[cfg(target_os = "linux")] -static LINUX_MTAB: &str = "/etc/mtab"; - static OPT_ALL: &str = "all"; static OPT_BLOCKSIZE: &str = "blocksize"; static OPT_DIRECT: &str = "direct"; @@ -101,8 +58,6 @@ static OPT_TYPE: &str = "type"; static OPT_PRINT_TYPE: &str = "print-type"; static OPT_EXCLUDE_TYPE: &str = "exclude-type"; -static MOUNT_OPT_BIND: &str = "bind"; - /// Store names of file systems as a selector. /// Note: `exclude` takes priority over `include`. struct FsSelector { @@ -121,136 +76,16 @@ struct Options { fs_selector: FsSelector, } -#[derive(Debug, Clone)] -struct MountInfo { - // it stores `volume_name` in windows platform and `dev_id` in unix platform - dev_id: String, - dev_name: String, - fs_type: String, - mount_dir: String, - mount_option: String, // we only care "bind" option - mount_root: String, - remote: bool, - dummy: bool, -} - -#[cfg(all( - target_os = "freebsd", - not(all(target_vendor = "apple", target_arch = "x86_64")) -))] -#[repr(C)] -#[derive(Copy, Clone)] -#[allow(non_camel_case_types)] -struct statfs { - f_version: u32, - f_type: u32, - f_flags: u64, - f_bsize: u64, - f_iosize: u64, - f_blocks: u64, - f_bfree: u64, - f_bavail: i64, - f_files: u64, - f_ffree: i64, - f_syncwrites: u64, - f_asyncwrites: u64, - f_syncreads: u64, - f_asyncreads: u64, - f_spare: [u64; 10usize], - f_namemax: u32, - f_owner: uid_t, - f_fsid: fsid_t, - f_charspare: [c_char; 80usize], - f_fstypename: [c_char; 16usize], - f_mntfromname: [c_char; 88usize], - f_mntonname: [c_char; 88usize], -} - -#[derive(Debug, Clone)] -struct FsUsage { - blocksize: u64, - blocks: u64, - bfree: u64, - bavail: u64, - bavail_top_bit_set: bool, - files: u64, - ffree: u64, -} - #[derive(Debug, Clone)] struct Filesystem { mountinfo: MountInfo, usage: FsUsage, } -#[cfg(windows)] -macro_rules! String2LPWSTR { - ($str: expr) => { - OsString::from($str.clone()) - .as_os_str() - .encode_wide() - .chain(Some(0)) - .collect::>() - .as_ptr() - }; -} - -#[cfg(windows)] -#[allow(non_snake_case)] -fn LPWSTR2String(buf: &[u16]) -> String { - let len = unsafe { libc::wcslen(buf.as_ptr()) }; - OsString::from_wide(&buf[..len as usize]) - .into_string() - .unwrap() -} - fn get_usage() -> String { format!("{0} [OPTION]... [FILE]...", executable!()) } -#[cfg(any(target_os = "freebsd", target_vendor = "apple"))] -extern "C" { - #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))] - #[link_name = "getmntinfo$INODE64"] - fn getmntinfo(mntbufp: *mut *mut statfs, flags: c_int) -> c_int; - - #[cfg(any( - all(target_os = "freebsd"), - all(target_vendor = "apple", target_arch = "aarch64") - ))] - fn getmntinfo(mntbufp: *mut *mut statfs, flags: c_int) -> c_int; -} - -#[cfg(any(target_os = "freebsd", target_vendor = "apple"))] -impl From for MountInfo { - fn from(statfs: statfs) -> Self { - let mut info = MountInfo { - dev_id: "".to_string(), - dev_name: unsafe { - CStr::from_ptr(&statfs.f_mntfromname[0]) - .to_string_lossy() - .into_owned() - }, - fs_type: unsafe { - CStr::from_ptr(&statfs.f_fstypename[0]) - .to_string_lossy() - .into_owned() - }, - mount_dir: unsafe { - CStr::from_ptr(&statfs.f_mntonname[0]) - .to_string_lossy() - .into_owned() - }, - mount_root: "".to_string(), - mount_option: "".to_string(), - remote: false, - dummy: false, - }; - info.set_missing_fields(); - info - } -} - impl FsSelector { fn new() -> FsSelector { FsSelector { @@ -295,239 +130,6 @@ impl Options { } } -impl MountInfo { - fn set_missing_fields(&mut self) { - #[cfg(unix)] - { - // We want to keep the dev_id on Windows - // but set dev_id - let path = CString::new(self.mount_dir.clone()).unwrap(); - unsafe { - let mut stat = mem::zeroed(); - if libc::stat(path.as_ptr(), &mut stat) == 0 { - self.dev_id = (stat.st_dev as i32).to_string(); - } else { - self.dev_id = "".to_string(); - } - } - } - // set MountInfo::dummy - match self.fs_type.as_ref() { - "autofs" | "proc" | "subfs" - /* for Linux 2.6/3.x */ - | "debugfs" | "devpts" | "fusectl" | "mqueue" | "rpc_pipefs" | "sysfs" - /* FreeBSD, Linux 2.4 */ - | "devfs" - /* for NetBSD 3.0 */ - | "kernfs" - /* for Irix 6.5 */ - | "ignore" => self.dummy = true, - _ => self.dummy = self.fs_type == "none" - && self.mount_option.find(MOUNT_OPT_BIND).is_none(), - } - // set MountInfo::remote - #[cfg(windows)] - { - self.remote = DRIVE_REMOTE == unsafe { GetDriveTypeW(String2LPWSTR!(self.mount_root)) }; - } - #[cfg(unix)] - { - if self.dev_name.find(':').is_some() - || (self.dev_name.starts_with("//") && self.fs_type == "smbfs" - || self.fs_type == "cifs") - || self.dev_name == "-hosts" - { - self.remote = true; - } else { - self.remote = false; - } - } - } - - #[cfg(target_os = "linux")] - fn new(file_name: &str, raw: Vec<&str>) -> Option { - match file_name { - // Format: 36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue - // "man proc" for more details - "/proc/self/mountinfo" => { - let mut m = MountInfo { - dev_id: "".to_string(), - dev_name: raw[9].to_string(), - fs_type: raw[8].to_string(), - mount_root: raw[3].to_string(), - mount_dir: raw[4].to_string(), - mount_option: raw[5].to_string(), - remote: false, - dummy: false, - }; - m.set_missing_fields(); - Some(m) - } - "/etc/mtab" => { - let mut m = MountInfo { - dev_id: "".to_string(), - dev_name: raw[0].to_string(), - fs_type: raw[2].to_string(), - mount_root: "".to_string(), - mount_dir: raw[1].to_string(), - mount_option: raw[3].to_string(), - remote: false, - dummy: false, - }; - m.set_missing_fields(); - Some(m) - } - _ => None, - } - } - #[cfg(windows)] - fn new(mut volume_name: String) -> Option { - let mut dev_name_buf = [0u16; MAX_PATH]; - volume_name.pop(); - unsafe { - QueryDosDeviceW( - OsString::from(volume_name.clone()) - .as_os_str() - .encode_wide() - .chain(Some(0)) - .skip(4) - .collect::>() - .as_ptr(), - dev_name_buf.as_mut_ptr(), - dev_name_buf.len() as DWORD, - ) - }; - volume_name.push('\\'); - let dev_name = LPWSTR2String(&dev_name_buf); - - let mut mount_root_buf = [0u16; MAX_PATH]; - let success = unsafe { - GetVolumePathNamesForVolumeNameW( - String2LPWSTR!(volume_name), - mount_root_buf.as_mut_ptr(), - mount_root_buf.len() as DWORD, - ptr::null_mut(), - ) - }; - if 0 == success { - // TODO: support the case when `GetLastError()` returns `ERROR_MORE_DATA` - return None; - } - let mount_root = LPWSTR2String(&mount_root_buf); - - let mut fs_type_buf = [0u16; MAX_PATH]; - let success = unsafe { - GetVolumeInformationW( - String2LPWSTR!(mount_root), - ptr::null_mut(), - 0 as DWORD, - ptr::null_mut(), - ptr::null_mut(), - ptr::null_mut(), - fs_type_buf.as_mut_ptr(), - fs_type_buf.len() as DWORD, - ) - }; - let fs_type = if 0 != success { - Some(LPWSTR2String(&fs_type_buf)) - } else { - None - }; - let mut mn_info = MountInfo { - dev_id: volume_name, - dev_name, - fs_type: fs_type.unwrap_or_else(|| "".to_string()), - mount_root, - mount_dir: "".to_string(), - mount_option: "".to_string(), - remote: false, - dummy: false, - }; - mn_info.set_missing_fields(); - Some(mn_info) - } -} - -impl FsUsage { - #[cfg(unix)] - fn new(statvfs: libc::statvfs) -> FsUsage { - { - FsUsage { - blocksize: if statvfs.f_frsize != 0 { - statvfs.f_frsize as u64 - } else { - statvfs.f_bsize as u64 - }, - blocks: statvfs.f_blocks as u64, - bfree: statvfs.f_bfree as u64, - bavail: statvfs.f_bavail as u64, - bavail_top_bit_set: ((statvfs.f_bavail as u64) & (1u64.rotate_right(1))) != 0, - files: statvfs.f_files as u64, - ffree: statvfs.f_ffree as u64, - } - } - } - #[cfg(not(unix))] - fn new(path: &Path) -> FsUsage { - let mut root_path = [0u16; MAX_PATH]; - let success = unsafe { - GetVolumePathNamesForVolumeNameW( - //path_utf8.as_ptr(), - String2LPWSTR!(path.as_os_str()), - root_path.as_mut_ptr(), - root_path.len() as DWORD, - ptr::null_mut(), - ) - }; - if 0 == success { - crash!( - EXIT_ERR, - "GetVolumePathNamesForVolumeNameW failed: {}", - unsafe { GetLastError() } - ); - } - - let mut sectors_per_cluster = 0; - let mut bytes_per_sector = 0; - let mut number_of_free_clusters = 0; - let mut total_number_of_clusters = 0; - - let success = unsafe { - GetDiskFreeSpaceW( - String2LPWSTR!(path.as_os_str()), - &mut sectors_per_cluster, - &mut bytes_per_sector, - &mut number_of_free_clusters, - &mut total_number_of_clusters, - ) - }; - if 0 == success { - // Fails in case of CD for example - //crash!(EXIT_ERR, "GetDiskFreeSpaceW failed: {}", unsafe { - //GetLastError() - //}); - } - - let bytes_per_cluster = sectors_per_cluster as u64 * bytes_per_sector as u64; - FsUsage { - // f_bsize File system block size. - blocksize: bytes_per_cluster as u64, - // f_blocks - Total number of blocks on the file system, in units of f_frsize. - // frsize = Fundamental file system block size (fragment size). - blocks: total_number_of_clusters as u64, - // Total number of free blocks. - bfree: number_of_free_clusters as u64, - // Total number of free blocks available to non-privileged processes. - bavail: 0 as u64, - bavail_top_bit_set: ((bytes_per_sector as u64) & (1u64.rotate_right(1))) != 0, - // Total number of file nodes (inodes) on the file system. - files: 0 as u64, // Not available on windows - // Total number of free file nodes (inodes). - ffree: 4096 as u64, // Meaningless on Windows - } - } -} - impl Filesystem { // TODO: resolve uuid in `mountinfo.dev_name` if exists fn new(mountinfo: MountInfo) -> Option { @@ -548,7 +150,7 @@ impl Filesystem { unsafe { let path = CString::new(_stat_path).unwrap(); let mut statvfs = mem::zeroed(); - if libc::statvfs(path.as_ptr(), &mut statvfs) < 0 { + if statfs_fn(path.as_ptr(), &mut statvfs) < 0 { None } else { Some(Filesystem { @@ -565,80 +167,6 @@ impl Filesystem { } } -/// Read file system list. -fn read_fs_list() -> Vec { - #[cfg(target_os = "linux")] - { - let (file_name, fobj) = File::open(LINUX_MOUNTINFO) - .map(|f| (LINUX_MOUNTINFO, f)) - .or_else(|_| File::open(LINUX_MTAB).map(|f| (LINUX_MTAB, f))) - .expect("failed to find mount list files"); - let reader = BufReader::new(fobj); - reader - .lines() - .filter_map(|line| line.ok()) - .filter_map(|line| { - let raw_data = line.split_whitespace().collect::>(); - MountInfo::new(file_name, raw_data) - }) - .collect::>() - } - #[cfg(any(target_os = "freebsd", target_vendor = "apple"))] - { - let mut mptr: *mut statfs = ptr::null_mut(); - let len = unsafe { getmntinfo(&mut mptr, 1 as c_int) }; - if len < 0 { - crash!(EXIT_ERR, "getmntinfo failed"); - } - let mounts = unsafe { slice::from_raw_parts(mptr, len as usize) }; - mounts - .iter() - .map(|m| MountInfo::from(*m)) - .collect::>() - } - #[cfg(windows)] - { - let mut volume_name_buf = [0u16; MAX_PATH]; - // As recommended in the MS documentation, retrieve the first volume before the others - let find_handle = unsafe { - FindFirstVolumeW(volume_name_buf.as_mut_ptr(), volume_name_buf.len() as DWORD) - }; - if INVALID_HANDLE_VALUE == find_handle { - crash!(EXIT_ERR, "FindFirstVolumeW failed: {}", unsafe { - GetLastError() - }); - } - let mut mounts = Vec::::new(); - loop { - let volume_name = LPWSTR2String(&volume_name_buf); - if !volume_name.starts_with("\\\\?\\") || !volume_name.ends_with('\\') { - show_warning!("A bad path was skipped: {}", volume_name); - continue; - } - if let Some(m) = MountInfo::new(volume_name) { - mounts.push(m); - } - if 0 == unsafe { - FindNextVolumeW( - find_handle, - volume_name_buf.as_mut_ptr(), - volume_name_buf.len() as DWORD, - ) - } { - let err = unsafe { GetLastError() }; - if err != winapi::shared::winerror::ERROR_NO_MORE_FILES { - crash!(EXIT_ERR, "FindNextVolumeW failed: {}", err); - } - break; - } - } - unsafe { - FindVolumeClose(find_handle); - } - mounts - } -} - fn filter_mount_list(vmi: Vec, paths: &[String], opt: &Options) -> Vec { vmi.into_iter() .filter_map(|mi| { diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 51bb4c66e..da51f7ca4 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -29,6 +29,9 @@ time = { version="<= 0.1.43", optional=true } data-encoding = { version="~2.1", optional=true } ## data-encoding: require v2.1; but v2.2.0 breaks the build for MinSRV v1.31.0 libc = { version="0.2.15, <= 0.2.85", optional=true } ## libc: initial utmp support added in v0.2.15; but v0.2.68 breaks the build for MinSRV v1.31.0 +[target.'cfg(target_os = "windows")'.dependencies] +winapi = { version = "0.3", features = ["errhandlingapi", "fileapi", "handleapi", "winerror"] } + [target.'cfg(target_os = "redox")'.dependencies] termion = "1.5" diff --git a/src/uucore/src/lib/features/fsext.rs b/src/uucore/src/lib/features/fsext.rs index 3c95af73e..887c31e01 100644 --- a/src/uucore/src/lib/features/fsext.rs +++ b/src/uucore/src/lib/features/fsext.rs @@ -1,6 +1,8 @@ // This file is part of the uutils coreutils package. // // (c) Jian Zeng +// (c) Fangxu Hu +// (c) Sylvestre Ledru // // For the full copyright and license information, please view the LICENSE file // that was distributed with this source code. @@ -12,19 +14,106 @@ extern crate time; pub use crate::*; // import macros from `../../macros.rs` #[cfg(target_os = "linux")] -static LINUX_MTAB: &str = "/etc/mtab"; +const LINUX_MTAB: &str = "/etc/mtab"; #[cfg(target_os = "linux")] -static LINUX_MOUNTINFO: &str = "/proc/self/mountinfo"; +const LINUX_MOUNTINFO: &str = "/proc/self/mountinfo"; static MOUNT_OPT_BIND: &str = "bind"; +#[cfg(windows)] +const MAX_PATH: usize = 266; +#[cfg(not(unix))] +static EXIT_ERR: i32 = 1; + +#[cfg(windows)] +use std::ffi::OsString; +#[cfg(windows)] +use std::os::windows::ffi::OsStrExt; +#[cfg(windows)] +use std::os::windows::ffi::OsStringExt; +#[cfg(windows)] +use winapi::shared::minwindef::DWORD; +#[cfg(windows)] +use winapi::um::errhandlingapi::GetLastError; +#[cfg(windows)] +use winapi::um::fileapi::GetDiskFreeSpaceW; +#[cfg(windows)] +use winapi::um::fileapi::{ + FindFirstVolumeW, FindNextVolumeW, FindVolumeClose, GetDriveTypeW, GetVolumeInformationW, + GetVolumePathNamesForVolumeNameW, QueryDosDeviceW, +}; +#[cfg(windows)] +use winapi::um::handleapi::INVALID_HANDLE_VALUE; +#[cfg(windows)] +use winapi::um::winbase::DRIVE_REMOTE; + +#[cfg(windows)] +macro_rules! String2LPWSTR { + ($str: expr) => { + OsString::from($str.clone()) + .as_os_str() + .encode_wide() + .chain(Some(0)) + .collect::>() + .as_ptr() + }; +} + +#[cfg(windows)] +#[allow(non_snake_case)] +fn LPWSTR2String(buf: &[u16]) -> String { + let len = unsafe { libc::wcslen(buf.as_ptr()) }; + OsString::from_wide(&buf[..len as usize]) + .into_string() + .unwrap() +} use self::time::Timespec; -pub use libc::{ - c_int, mode_t, strerror, S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFLNK, S_IFMT, S_IFREG, - S_IFSOCK, S_IRGRP, S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, S_IWUSR, - S_IXGRP, S_IXOTH, S_IXUSR, +#[cfg(unix)] +use libc::{ + mode_t, strerror, S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFLNK, S_IFMT, S_IFREG, S_IFSOCK, }; +use std::borrow::Cow; +use std::convert::{AsRef, From}; +#[cfg(unix)] +use std::ffi::CString; +#[cfg(unix)] +use std::io::Error as IOError; +#[cfg(unix)] +use std::mem; +use std::path::Path; use std::time::UNIX_EPOCH; +#[cfg(any( + target_os = "linux", + target_vendor = "apple", + target_os = "android", + target_os = "freebsd" +))] +pub use libc::statfs as Sstatfs; +#[cfg(any( + target_os = "openbsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "bitrig", + target_os = "dragonfly" +))] +pub use libc::statvfs as Sstatfs; + +#[cfg(any( + target_os = "linux", + target_vendor = "apple", + target_os = "android", + target_os = "freebsd" +))] +pub use libc::statfs as statfs_fn; +#[cfg(any( + target_os = "openbsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "bitrig", + target_os = "dragonfly" +))] +pub use libc::statvfs as statfs_fn; + pub trait BirthTime { fn pretty_birth(&self) -> String; fn birth(&self) -> String; @@ -49,78 +138,389 @@ impl BirthTime for Metadata { } } -pub fn pretty_time(sec: i64, nsec: i64) -> String { - // sec == seconds since UNIX_EPOCH - // nsec == nanoseconds since (UNIX_EPOCH + sec) - let tm = time::at(Timespec::new(sec, nsec as i32)); - let res = time::strftime("%Y-%m-%d %H:%M:%S.%f %z", &tm).unwrap(); - if res.ends_with(" -0000") { - res.replace(" -0000", " +0000") - } else { - res - } +#[derive(Debug, Clone)] +pub struct MountInfo { + // it stores `volume_name` in windows platform and `dev_id` in unix platform + pub dev_id: String, + pub dev_name: String, + pub fs_type: String, + pub mount_dir: String, + pub mount_option: String, // we only care "bind" option + pub mount_root: String, + pub remote: bool, + pub dummy: bool, } -pub fn pretty_filetype<'a>(mode: mode_t, size: u64) -> &'a str { - match mode & S_IFMT { - S_IFREG => { - if size != 0 { - "regular file" - } else { - "regular empty file" +impl MountInfo { + fn set_missing_fields(&mut self) { + #[cfg(unix)] + { + // We want to keep the dev_id on Windows + // but set dev_id + let path = CString::new(self.mount_dir.clone()).unwrap(); + unsafe { + let mut stat = mem::zeroed(); + if libc::stat(path.as_ptr(), &mut stat) == 0 { + self.dev_id = (stat.st_dev as i32).to_string(); + } else { + self.dev_id = "".to_string(); + } } } - S_IFDIR => "directory", - S_IFLNK => "symbolic link", - S_IFCHR => "character special file", - S_IFBLK => "block special file", - S_IFIFO => "fifo", - S_IFSOCK => "socket", - // TODO: Other file types - // See coreutils/gnulib/lib/file-type.c - _ => "weird file", + // set MountInfo::dummy + match self.fs_type.as_ref() { + "autofs" | "proc" | "subfs" + /* for Linux 2.6/3.x */ + | "debugfs" | "devpts" | "fusectl" | "mqueue" | "rpc_pipefs" | "sysfs" + /* FreeBSD, Linux 2.4 */ + | "devfs" + /* for NetBSD 3.0 */ + | "kernfs" + /* for Irix 6.5 */ + | "ignore" => self.dummy = true, + _ => self.dummy = self.fs_type == "none" + && self.mount_option.find(MOUNT_OPT_BIND).is_none(), + } + // set MountInfo::remote + #[cfg(windows)] + { + self.remote = DRIVE_REMOTE == unsafe { GetDriveTypeW(String2LPWSTR!(self.mount_root)) }; + } + #[cfg(unix)] + { + if self.dev_name.find(':').is_some() + || (self.dev_name.starts_with("//") && self.fs_type == "smbfs" + || self.fs_type == "cifs") + || self.dev_name == "-hosts" + { + self.remote = true; + } else { + self.remote = false; + } + } + } + + #[cfg(target_os = "linux")] + fn new(file_name: &str, raw: Vec<&str>) -> Option { + match file_name { + // Format: 36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue + // "man proc" for more details + LINUX_MOUNTINFO => { + let mut m = MountInfo { + dev_id: "".to_string(), + dev_name: raw[9].to_string(), + fs_type: raw[8].to_string(), + mount_root: raw[3].to_string(), + mount_dir: raw[4].to_string(), + mount_option: raw[5].to_string(), + remote: false, + dummy: false, + }; + m.set_missing_fields(); + Some(m) + } + LINUX_MTAB => { + let mut m = MountInfo { + dev_id: "".to_string(), + dev_name: raw[0].to_string(), + fs_type: raw[2].to_string(), + mount_root: "".to_string(), + mount_dir: raw[1].to_string(), + mount_option: raw[3].to_string(), + remote: false, + dummy: false, + }; + m.set_missing_fields(); + Some(m) + } + _ => None, + } + } + #[cfg(windows)] + fn new(mut volume_name: String) -> Option { + let mut dev_name_buf = [0u16; MAX_PATH]; + volume_name.pop(); + unsafe { + QueryDosDeviceW( + OsString::from(volume_name.clone()) + .as_os_str() + .encode_wide() + .chain(Some(0)) + .skip(4) + .collect::>() + .as_ptr(), + dev_name_buf.as_mut_ptr(), + dev_name_buf.len() as DWORD, + ) + }; + volume_name.push('\\'); + let dev_name = LPWSTR2String(&dev_name_buf); + + let mut mount_root_buf = [0u16; MAX_PATH]; + let success = unsafe { + GetVolumePathNamesForVolumeNameW( + String2LPWSTR!(volume_name), + mount_root_buf.as_mut_ptr(), + mount_root_buf.len() as DWORD, + ptr::null_mut(), + ) + }; + if 0 == success { + // TODO: support the case when `GetLastError()` returns `ERROR_MORE_DATA` + return None; + } + let mount_root = LPWSTR2String(&mount_root_buf); + + let mut fs_type_buf = [0u16; MAX_PATH]; + let success = unsafe { + GetVolumeInformationW( + String2LPWSTR!(mount_root), + ptr::null_mut(), + 0 as DWORD, + ptr::null_mut(), + ptr::null_mut(), + ptr::null_mut(), + fs_type_buf.as_mut_ptr(), + fs_type_buf.len() as DWORD, + ) + }; + let fs_type = if 0 != success { + Some(LPWSTR2String(&fs_type_buf)) + } else { + None + }; + let mut mn_info = MountInfo { + dev_id: volume_name, + dev_name, + fs_type: fs_type.unwrap_or_else(|| "".to_string()), + mount_root, + mount_dir: "".to_string(), + mount_option: "".to_string(), + remote: false, + dummy: false, + }; + mn_info.set_missing_fields(); + Some(mn_info) } } -use std::borrow::Cow; -use std::convert::{AsRef, From}; -use std::ffi::CString; -use std::io::Error as IOError; -use std::mem; -use std::path::Path; +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] +use std::ffi::CStr; +#[cfg(any(target_os = "freebsd", target_vendor = "apple"))] +impl From for MountInfo { + fn from(statfs: Sstatfs) -> Self { + let mut info = MountInfo { + dev_id: "".to_string(), + dev_name: unsafe { + CStr::from_ptr(&statfs.f_mntfromname[0]) + .to_string_lossy() + .into_owned() + }, + fs_type: unsafe { + CStr::from_ptr(&statfs.f_fstypename[0]) + .to_string_lossy() + .into_owned() + }, + mount_dir: unsafe { + CStr::from_ptr(&statfs.f_mntonname[0]) + .to_string_lossy() + .into_owned() + }, + mount_root: "".to_string(), + mount_option: "".to_string(), + remote: false, + dummy: false, + }; + info.set_missing_fields(); + info + } +} -#[cfg(any( - target_os = "linux", - target_vendor = "apple", - target_os = "android", - target_os = "freebsd" -))] -use libc::statfs as Sstatfs; -#[cfg(any( - target_os = "openbsd", - target_os = "netbsd", - target_os = "openbsd", - target_os = "bitrig", - target_os = "dragonfly" -))] -use libc::statvfs as Sstatfs; +#[cfg(any(target_os = "freebsd", target_vendor = "apple"))] +use libc::c_int; +#[cfg(any(target_os = "freebsd", target_vendor = "apple"))] +extern "C" { + #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))] + #[link_name = "getmntinfo$INODE64"] + fn getmntinfo(mntbufp: *mut *mut Sstatfs, flags: c_int) -> c_int; -#[cfg(any( - target_os = "linux", - target_vendor = "apple", - target_os = "android", - target_os = "freebsd" -))] -use libc::statfs as statfs_fn; -#[cfg(any( - target_os = "openbsd", - target_os = "netbsd", - target_os = "openbsd", - target_os = "bitrig", - target_os = "dragonfly" -))] -use libc::statvfs as statfs_fn; + #[cfg(any( + all(target_os = "freebsd"), + all(target_vendor = "apple", target_arch = "aarch64") + ))] + fn getmntinfo(mntbufp: *mut *mut Sstatfs, flags: c_int) -> c_int; +} +#[cfg(target_os = "linux")] +use std::fs::File; +#[cfg(target_os = "linux")] +use std::io::{BufRead, BufReader}; +#[cfg(any(target_vendor = "apple", target_os = "freebsd", target_os = "windows"))] +use std::ptr; +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] +use std::slice; +/// Read file system list. +pub fn read_fs_list() -> Vec { + #[cfg(target_os = "linux")] + { + let (file_name, fobj) = File::open(LINUX_MOUNTINFO) + .map(|f| (LINUX_MOUNTINFO, f)) + .or_else(|_| File::open(LINUX_MTAB).map(|f| (LINUX_MTAB, f))) + .expect("failed to find mount list files"); + let reader = BufReader::new(fobj); + reader + .lines() + .filter_map(|line| line.ok()) + .filter_map(|line| { + let raw_data = line.split_whitespace().collect::>(); + MountInfo::new(file_name, raw_data) + }) + .collect::>() + } + #[cfg(any(target_os = "freebsd", target_vendor = "apple"))] + { + let mut mptr: *mut Sstatfs = ptr::null_mut(); + let len = unsafe { getmntinfo(&mut mptr, 1_i32) }; + if len < 0 { + crash!(1, "getmntinfo failed"); + } + let mounts = unsafe { slice::from_raw_parts(mptr, len as usize) }; + mounts + .iter() + .map(|m| MountInfo::from(*m)) + .collect::>() + } + #[cfg(windows)] + { + let mut volume_name_buf = [0u16; MAX_PATH]; + // As recommended in the MS documentation, retrieve the first volume before the others + let find_handle = unsafe { + FindFirstVolumeW(volume_name_buf.as_mut_ptr(), volume_name_buf.len() as DWORD) + }; + if INVALID_HANDLE_VALUE == find_handle { + crash!(EXIT_ERR, "FindFirstVolumeW failed: {}", unsafe { + GetLastError() + }); + } + let mut mounts = Vec::::new(); + loop { + let volume_name = LPWSTR2String(&volume_name_buf); + if !volume_name.starts_with("\\\\?\\") || !volume_name.ends_with('\\') { + show_warning!("A bad path was skipped: {}", volume_name); + continue; + } + if let Some(m) = MountInfo::new(volume_name) { + mounts.push(m); + } + if 0 == unsafe { + FindNextVolumeW( + find_handle, + volume_name_buf.as_mut_ptr(), + volume_name_buf.len() as DWORD, + ) + } { + let err = unsafe { GetLastError() }; + if err != winapi::shared::winerror::ERROR_NO_MORE_FILES { + crash!(EXIT_ERR, "FindNextVolumeW failed: {}", err); + } + break; + } + } + unsafe { + FindVolumeClose(find_handle); + } + mounts + } +} + +#[derive(Debug, Clone)] +pub struct FsUsage { + pub blocksize: u64, + pub blocks: u64, + pub bfree: u64, + pub bavail: u64, + pub bavail_top_bit_set: bool, + pub files: u64, + pub ffree: u64, +} + +impl FsUsage { + #[cfg(unix)] + pub fn new(statvfs: Sstatfs) -> FsUsage { + { + FsUsage { + blocksize: statvfs.f_bsize as u64, // or `statvfs.f_frsize` ? + blocks: statvfs.f_blocks as u64, + bfree: statvfs.f_bfree as u64, + bavail: statvfs.f_bavail as u64, + bavail_top_bit_set: ((statvfs.f_bavail as u64) & (1u64.rotate_right(1))) != 0, + files: statvfs.f_files as u64, + ffree: statvfs.f_ffree as u64, + } + } + } + #[cfg(not(unix))] + pub fn new(path: &Path) -> FsUsage { + let mut root_path = [0u16; MAX_PATH]; + let success = unsafe { + GetVolumePathNamesForVolumeNameW( + //path_utf8.as_ptr(), + String2LPWSTR!(path.as_os_str()), + root_path.as_mut_ptr(), + root_path.len() as DWORD, + ptr::null_mut(), + ) + }; + if 0 == success { + crash!( + EXIT_ERR, + "GetVolumePathNamesForVolumeNameW failed: {}", + unsafe { GetLastError() } + ); + } + + let mut sectors_per_cluster = 0; + let mut bytes_per_sector = 0; + let mut number_of_free_clusters = 0; + let mut total_number_of_clusters = 0; + + let success = unsafe { + GetDiskFreeSpaceW( + String2LPWSTR!(path.as_os_str()), + &mut sectors_per_cluster, + &mut bytes_per_sector, + &mut number_of_free_clusters, + &mut total_number_of_clusters, + ) + }; + if 0 == success { + // Fails in case of CD for example + //crash!(EXIT_ERR, "GetDiskFreeSpaceW failed: {}", unsafe { + //GetLastError() + //}); + } + + let bytes_per_cluster = sectors_per_cluster as u64 * bytes_per_sector as u64; + FsUsage { + // f_bsize File system block size. + blocksize: bytes_per_cluster as u64, + // f_blocks - Total number of blocks on the file system, in units of f_frsize. + // frsize = Fundamental file system block size (fragment size). + blocks: total_number_of_clusters as u64, + // Total number of free blocks. + bfree: number_of_free_clusters as u64, + // Total number of free blocks available to non-privileged processes. + bavail: 0 as u64, + bavail_top_bit_set: ((bytes_per_sector as u64) & (1u64.rotate_right(1))) != 0, + // Total number of file nodes (inodes) on the file system. + files: 0 as u64, // Not available on windows + // Total number of free file nodes (inodes). + ffree: 4096 as u64, // Meaningless on Windows + } + } +} + +#[cfg(unix)] pub trait FsMeta { fn fs_type(&self) -> i64; fn iosize(&self) -> u64; @@ -134,6 +534,7 @@ pub trait FsMeta { fn namelen(&self) -> u64; } +#[cfg(unix)] impl FsMeta for Sstatfs { fn blksize(&self) -> i64 { self.f_bsize as i64 @@ -213,6 +614,7 @@ impl FsMeta for Sstatfs { } } +#[cfg(unix)] pub fn statfs>(path: P) -> Result where Vec: From

, @@ -236,6 +638,40 @@ where } } +pub fn pretty_time(sec: i64, nsec: i64) -> String { + // sec == seconds since UNIX_EPOCH + // nsec == nanoseconds since (UNIX_EPOCH + sec) + let tm = time::at(Timespec::new(sec, nsec as i32)); + let res = time::strftime("%Y-%m-%d %H:%M:%S.%f %z", &tm).unwrap(); + if res.ends_with(" -0000") { + res.replace(" -0000", " +0000") + } else { + res + } +} + +#[cfg(unix)] +pub fn pretty_filetype<'a>(mode: mode_t, size: u64) -> &'a str { + match mode & S_IFMT { + S_IFREG => { + if size != 0 { + "regular file" + } else { + "regular empty file" + } + } + S_IFDIR => "directory", + S_IFLNK => "symbolic link", + S_IFCHR => "character special file", + S_IFBLK => "block special file", + S_IFIFO => "fifo", + S_IFSOCK => "socket", + // TODO: Other file types + // See coreutils/gnulib/lib/file-type.c + _ => "weird file", + } +} + pub fn pretty_fstype<'a>(fstype: i64) -> Cow<'a, str> { match fstype { 0x6163_6673 => "acfs".into(), @@ -356,192 +792,12 @@ pub fn pretty_fstype<'a>(fstype: i64) -> Cow<'a, str> { } } -#[cfg(any(target_os = "freebsd", target_vendor = "apple"))] -extern "C" { - #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))] - #[link_name = "getmntinfo$INODE64"] - fn getmntinfo(mntbufp: *mut *mut Sstatfs, flags: c_int) -> c_int; - - #[cfg(any( - all(target_os = "freebsd"), - all(target_vendor = "apple", target_arch = "aarch64") - ))] - fn getmntinfo(mntbufp: *mut *mut Sstatfs, flags: c_int) -> c_int; -} - -#[derive(Debug, Clone)] -pub struct MountInfo { - // it stores `volume_name` in windows platform and `dev_id` in unix platform - dev_id: String, - dev_name: String, - fs_type: String, - pub mount_dir: String, - mount_option: String, // we only care "bind" option - mount_root: String, - remote: bool, - dummy: bool, -} - -impl MountInfo { - fn set_missing_fields(&mut self) { - #[cfg(unix)] - { - // We want to keep the dev_id on Windows - // but set dev_id - let path = CString::new(self.mount_dir.clone()).unwrap(); - unsafe { - let mut stat = mem::zeroed(); - if libc::stat(path.as_ptr(), &mut stat) == 0 { - self.dev_id = (stat.st_dev as i32).to_string(); - } else { - self.dev_id = "".to_string(); - } - } - } - // set MountInfo::dummy - match self.fs_type.as_ref() { - "autofs" | "proc" | "subfs" - /* for Linux 2.6/3.x */ - | "debugfs" | "devpts" | "fusectl" | "mqueue" | "rpc_pipefs" | "sysfs" - /* FreeBSD, Linux 2.4 */ - | "devfs" - /* for NetBSD 3.0 */ - | "kernfs" - /* for Irix 6.5 */ - | "ignore" => self.dummy = true, - _ => self.dummy = self.fs_type == "none" - && self.mount_option.find(MOUNT_OPT_BIND).is_none(), - } - // set MountInfo::remote - #[cfg(unix)] - { - if self.dev_name.find(':').is_some() - || (self.dev_name.starts_with("//") && self.fs_type == "smbfs" - || self.fs_type == "cifs") - || self.dev_name == "-hosts" - { - self.remote = true; - } else { - self.remote = false; - } - } - } - - #[cfg(target_os = "linux")] - fn new(file_name: &str, raw: Vec<&str>) -> Option { - match file_name { - // Format: 36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue - // "man proc" for more details - "/proc/self/mountinfo" => { - let mut m = MountInfo { - dev_id: "".to_string(), - dev_name: raw[9].to_string(), - fs_type: raw[8].to_string(), - mount_root: raw[3].to_string(), - mount_dir: raw[4].to_string(), - mount_option: raw[5].to_string(), - remote: false, - dummy: false, - }; - m.set_missing_fields(); - Some(m) - } - "/etc/mtab" => { - let mut m = MountInfo { - dev_id: "".to_string(), - dev_name: raw[0].to_string(), - fs_type: raw[2].to_string(), - mount_root: "".to_string(), - mount_dir: raw[1].to_string(), - mount_option: raw[3].to_string(), - remote: false, - dummy: false, - }; - m.set_missing_fields(); - Some(m) - } - _ => None, - } - } -} - -#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] -use std::ffi::CStr; -#[cfg(any(target_os = "freebsd", target_vendor = "apple"))] -impl From for MountInfo { - fn from(statfs: Sstatfs) -> Self { - let mut info = MountInfo { - dev_id: "".to_string(), - dev_name: unsafe { - CStr::from_ptr(&statfs.f_mntfromname[0]) - .to_string_lossy() - .into_owned() - }, - fs_type: unsafe { - CStr::from_ptr(&statfs.f_fstypename[0]) - .to_string_lossy() - .into_owned() - }, - mount_dir: unsafe { - CStr::from_ptr(&statfs.f_mntonname[0]) - .to_string_lossy() - .into_owned() - }, - mount_root: "".to_string(), - mount_option: "".to_string(), - remote: false, - dummy: false, - }; - info.set_missing_fields(); - info - } -} - -#[cfg(target_os = "linux")] -use std::fs::File; -#[cfg(target_os = "linux")] -use std::io::{BufRead, BufReader}; -#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] -use std::ptr; -#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] -use std::slice; -pub fn read_fs_list() -> Vec { - #[cfg(target_os = "linux")] - { - let (file_name, fobj) = File::open(LINUX_MOUNTINFO) - .map(|f| (LINUX_MOUNTINFO, f)) - .or_else(|_| File::open(LINUX_MTAB).map(|f| (LINUX_MTAB, f))) - .expect("failed to find mount list files"); - let reader = BufReader::new(fobj); - reader - .lines() - .filter_map(|line| line.ok()) - .filter_map(|line| { - let raw_data = line.split_whitespace().collect::>(); - MountInfo::new(file_name, raw_data) - }) - .collect::>() - } - #[cfg(any(target_os = "freebsd", target_vendor = "apple"))] - { - let mut mptr: *mut Sstatfs = ptr::null_mut(); - let len = unsafe { getmntinfo(&mut mptr, 1 as c_int) }; - if len < 0 { - crash!(1, "getmntinfo failed"); - } - let mounts = unsafe { slice::from_raw_parts(mptr, len as usize) }; - mounts - .iter() - .map(|m| MountInfo::from(*m)) - .collect::>() - } -} - #[cfg(test)] mod tests { use super::*; #[test] + #[cfg(unix)] fn test_file_type() { assert_eq!("block special file", pretty_filetype(S_IFBLK, 0)); assert_eq!("character special file", pretty_filetype(S_IFCHR, 0)); diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index f2a4292fb..28bae08cb 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -189,6 +189,7 @@ mod tests { vec.into_iter().collect_str(handling) } + #[cfg(any(unix, target_os = "redox"))] fn test_invalid_utf8_args_lossy(os_str: &OsStr) { //assert our string is invalid utf8 assert!(os_str.to_os_string().into_string().is_err()); @@ -212,6 +213,7 @@ mod tests { ); } + #[cfg(any(unix, target_os = "redox"))] fn test_invalid_utf8_args_ignore(os_str: &OsStr) { //assert our string is invalid utf8 assert!(os_str.to_os_string().into_string().is_err()); @@ -236,7 +238,7 @@ mod tests { //create a vector containing only correct encoding let test_vec = make_os_vec(&OsString::from("test2")); //expect complete conversion without losses, even when lossy conversion is accepted - let _ = collect_os_str(test_vec.clone(), InvalidEncodingHandling::ConvertLossy) + let _ = collect_os_str(test_vec, InvalidEncodingHandling::ConvertLossy) .expect_complete("Lossy conversion not expected in this test"); } From 2ec4bee350bf5d974665d3391fc91c6d90729456 Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Thu, 6 May 2021 08:28:54 -0400 Subject: [PATCH 0586/1135] test: improve handling of inverted Boolean expressions - add `==` as undocumented alias of `=` - handle negated comparison of `=` as literal - negation generally applies to only the first expression of a Boolean chain, except when combining evaluation of two literal strings --- src/uu/test/src/parser.rs | 88 ++++++++++++++++++++++++++---------- src/uu/test/src/test.rs | 2 +- tests/by-util/test_test.rs | 93 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 158 insertions(+), 25 deletions(-) diff --git a/src/uu/test/src/parser.rs b/src/uu/test/src/parser.rs index 2c9c9db30..aa44bc5f2 100644 --- a/src/uu/test/src/parser.rs +++ b/src/uu/test/src/parser.rs @@ -33,7 +33,7 @@ impl Symbol { "(" => Symbol::LParen, "!" => Symbol::Bang, "-a" | "-o" => Symbol::BoolOp(s), - "=" | "!=" => Symbol::StringOp(s), + "=" | "==" | "!=" => Symbol::StringOp(s), "-eq" | "-ge" | "-gt" | "-le" | "-lt" | "-ne" => Symbol::IntOp(s), "-ef" | "-nt" | "-ot" => Symbol::FileOp(s), "-n" | "-z" => Symbol::StrlenOp(s), @@ -83,7 +83,7 @@ impl Symbol { /// TERM → str OP str /// TERM → str | 𝜖 /// OP → STRINGOP | INTOP | FILEOP -/// STRINGOP → = | != +/// STRINGOP → = | == | != /// INTOP → -eq | -ge | -gt | -le | -lt | -ne /// FILEOP → -ef | -nt | -ot /// STRLEN → -n | -z @@ -163,7 +163,7 @@ impl Parser { match self.peek() { // lparen is a literal when followed by nothing or comparison Symbol::None | Symbol::StringOp(_) | Symbol::IntOp(_) | Symbol::FileOp(_) => { - self.literal(Symbol::Literal(OsString::from("("))); + self.literal(Symbol::LParen.into_literal()); } // empty parenthetical Symbol::Literal(s) if s == ")" => {} @@ -183,27 +183,67 @@ impl Parser { /// /// * `! =`: negate the result of the implicit string length test of `=` /// * `! = foo`: compare the literal strings `!` and `foo` - /// * `! `: negate the result of the expression + /// * `! = = str`: negate comparison of literal `=` and `str` + /// * `!`: bang followed by nothing is literal + /// * `! EXPR`: negate the result of the expression + /// + /// Combined Boolean & negation: + /// + /// * `! ( EXPR ) [BOOLOP EXPR]`: negate the parenthesized expression only + /// * `! UOP str BOOLOP EXPR`: negate the unary subexpression + /// * `! str BOOLOP str`: negate the entire Boolean expression + /// * `! str BOOLOP EXPR BOOLOP EXPR`: negate the value of the first `str` term /// fn bang(&mut self) { - if let Symbol::StringOp(_) | Symbol::IntOp(_) | Symbol::FileOp(_) = self.peek() { - // we need to peek ahead one more token to disambiguate the first - // two cases listed above: case 1 — `! ` — and - // case 2: ` OP str`. - let peek2 = self.tokens.clone().nth(1); + match self.peek() { + Symbol::StringOp(_) | Symbol::IntOp(_) | Symbol::FileOp(_) | Symbol::BoolOp(_) => { + // we need to peek ahead one more token to disambiguate the first + // three cases listed above + let peek2 = Symbol::new(self.tokens.clone().nth(1)); - if peek2.is_none() { - // op is literal - let op = self.next_token().into_literal(); - self.stack.push(op); - self.stack.push(Symbol::Bang); - } else { - // bang is literal; parsing continues with op - self.literal(Symbol::Literal(OsString::from("!"))); + match peek2 { + // case 1: `! ` + // case 3: `! = OP str` + Symbol::StringOp(_) | Symbol::None => { + // op is literal + let op = self.next_token().into_literal(); + self.literal(op); + self.stack.push(Symbol::Bang); + } + // case 2: ` OP str [BOOLOP EXPR]`. + _ => { + // bang is literal; parsing continues with op + self.literal(Symbol::Bang.into_literal()); + self.maybe_boolop(); + } + } + } + + // bang followed by nothing is literal + Symbol::None => self.stack.push(Symbol::Bang.into_literal()), + + _ => { + // peek ahead up to 4 tokens to determine if we need to negate + // the entire expression or just the first term + let peek4: Vec = self + .tokens + .clone() + .take(4) + .map(|token| Symbol::new(Some(token))) + .collect(); + + match peek4.as_slice() { + // we peeked ahead 4 but there were only 3 tokens left + [Symbol::Literal(_), Symbol::BoolOp(_), Symbol::Literal(_)] => { + self.expr(); + self.stack.push(Symbol::Bang); + } + _ => { + self.term(); + self.stack.push(Symbol::Bang); + } + } } - } else { - self.expr(); - self.stack.push(Symbol::Bang); } } @@ -211,13 +251,14 @@ impl Parser { /// as appropriate. fn maybe_boolop(&mut self) { if self.peek_is_boolop() { - let token = self.tokens.next().unwrap(); // safe because we peeked + let symbol = self.next_token(); // BoolOp by itself interpreted as Literal if let Symbol::None = self.peek() { - self.literal(Symbol::Literal(token)) + self.literal(symbol.into_literal()); } else { - self.boolop(Symbol::BoolOp(token)) + self.boolop(symbol); + self.maybe_boolop(); } } } @@ -231,7 +272,6 @@ impl Parser { if op == Symbol::BoolOp(OsString::from("-a")) { self.term(); self.stack.push(op); - self.maybe_boolop(); } else { self.expr(); self.stack.push(op); diff --git a/src/uu/test/src/test.rs b/src/uu/test/src/test.rs index 3e97af0a6..86950ecc2 100644 --- a/src/uu/test/src/test.rs +++ b/src/uu/test/src/test.rs @@ -57,7 +57,7 @@ fn eval(stack: &mut Vec) -> Result { Some(Symbol::StringOp(op)) => { let b = stack.pop(); let a = stack.pop(); - Ok(if op == "=" { a == b } else { a != b }) + Ok(if op == "!=" { a != b } else { a == b }) } Some(Symbol::IntOp(op)) => { let b = pop_literal!(); diff --git a/tests/by-util/test_test.rs b/tests/by-util/test_test.rs index 000013d9c..0dfc0c620 100644 --- a/tests/by-util/test_test.rs +++ b/tests/by-util/test_test.rs @@ -122,6 +122,13 @@ fn test_zero_len_not_equals_zero_len_is_false() { new_ucmd!().args(&["", "!=", ""]).run().status_code(1); } +#[test] +fn test_double_equal_is_string_comparison_op() { + // undocumented but part of the GNU test suite + new_ucmd!().args(&["t", "==", "t"]).succeeds(); + new_ucmd!().args(&["t", "==", "f"]).run().status_code(1); +} + #[test] fn test_string_comparison() { let scenario = TestScenario::new(util_name!()); @@ -131,11 +138,22 @@ fn test_string_comparison() { ["(", "=", "("], ["(", "!=", ")"], ["!", "=", "!"], + ["=", "=", "="], ]; for test in &tests { scenario.ucmd().args(&test[..]).succeeds(); } + + // run the inverse of all these tests + for test in &tests { + scenario + .ucmd() + .arg("!") + .args(&test[..]) + .run() + .status_code(1); + } } #[test] @@ -485,6 +503,81 @@ fn test_op_prec_and_or_2_overridden_by_parentheses() { .status_code(1); } +#[test] +fn test_negated_boolean_precedence() { + let scenario = TestScenario::new(util_name!()); + + let tests = [ + vec!["!", "(", "foo", ")", "-o", "bar"], + vec!["!", "", "-o", "", "-a", ""], + vec!["!", "(", "", "-a", "", ")", "-o", ""], + ]; + + for test in &tests { + scenario.ucmd().args(&test[..]).succeeds(); + } + + let negative_tests = [ + vec!["!", "-n", "", "-a", ""], + vec!["", "-a", "", "-o", ""], + vec!["!", "", "-a", "", "-o", ""], + vec!["!", "(", "", "-a", "", ")", "-a", ""], + ]; + + for test in &negative_tests { + scenario.ucmd().args(&test[..]).run().status_code(1); + } +} + +#[test] +fn test_bang_boolop_precedence() { + // For a Boolean combination of two literals, bang inverts the entire expression + new_ucmd!().args(&["!", "", "-a", ""]).succeeds(); + new_ucmd!().args(&["!", "", "-o", ""]).succeeds(); + + new_ucmd!() + .args(&["!", "a value", "-o", "another value"]) + .run() + .status_code(1); + + // Introducing a UOP — even one that is equivalent to a bare string — causes + // bang to invert only the first term + new_ucmd!() + .args(&["!", "-n", "", "-a", ""]) + .run() + .status_code(1); + new_ucmd!() + .args(&["!", "", "-a", "-n", ""]) + .run() + .status_code(1); + + // for compound Boolean expressions, bang inverts the _next_ expression + // only, not the entire compound expression + new_ucmd!() + .args(&["!", "", "-a", "", "-a", ""]) + .run() + .status_code(1); + + // parentheses can override this + new_ucmd!() + .args(&["!", "(", "", "-a", "", "-a", "", ")"]) + .succeeds(); +} + +#[test] +fn test_inverted_parenthetical_boolop_precedence() { + // For a Boolean combination of two literals, bang inverts the entire expression + new_ucmd!() + .args(&["!", "a value", "-o", "another value"]) + .run() + .status_code(1); + + // only the parenthetical is inverted, not the entire expression + new_ucmd!() + .args(&["!", "(", "a value", ")", "-o", "another value"]) + .succeeds(); +} + #[test] #[ignore = "fixme: error reporting"] fn test_dangling_parenthesis() { From 6aee792a9318dd47b9c9738a3a6c440e99f6fb85 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 11 May 2021 09:29:46 +0200 Subject: [PATCH 0587/1135] Remove travis CI * it is redundant with github action * less integrated * fails someone for some unexpected reasons * it is blocking code coverage results ?! --- .travis.yml | 72 ------------------------------------------------- CONTRIBUTING.md | 4 --- README.md | 1 - 3 files changed, 77 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 389ba44b0..000000000 --- a/.travis.yml +++ /dev/null @@ -1,72 +0,0 @@ -language: rust - -rust: - - stable - - beta - -os: - - linux - # - osx - -env: - # sphinx v1.8.0 is bugged & fails for linux builds; so, force specific `sphinx` version - global: FEATURES='' TEST_INSTALL='' SPHINX_VERSIONED='sphinx==1.7.8' - -matrix: - allow_failures: - - rust: beta - - rust: nightly - fast_finish: true - include: - - rust: 1.40.0 - env: FEATURES=unix - # - rust: stable - # os: linux - # env: FEATURES=unix TEST_INSTALL=true - # - rust: stable - # os: osx - # env: FEATURES=macos TEST_INSTALL=true - - rust: nightly - os: linux - env: FEATURES=nightly,unix TEST_INSTALL=true - - rust: nightly - os: osx - env: FEATURES=nightly,macos TEST_INSTALL=true - - rust: nightly - os: linux - env: FEATURES=nightly,feat_os_unix_redox CC=x86_64-unknown-redox-gcc CARGO_ARGS='--no-default-features --target=x86_64-unknown-redox' REDOX=1 - -cache: - directories: - - $HOME/.cargo - -sudo: true - -before_install: - - if [ $REDOX ]; then ./.travis/redox-toolchain.sh; fi - -install: - - if [ $TRAVIS_OS_NAME = linux ]; then sudo apt-get install python-pip && sudo pip install $SPHINX_VERSIONED; fi - - | - if [ $TRAVIS_OS_NAME = osx ]; then - brew update - brew upgrade python - pip3 install $SPHINX_VERSIONED - fi - -script: - - cargo build $CARGO_ARGS --features "$FEATURES" - - if [ ! $REDOX ]; then cargo test $CARGO_ARGS -p uucore -p coreutils --features "$FEATURES" --no-fail-fast; fi - - if [ -n "$TEST_INSTALL" ]; then mkdir installdir_test; DESTDIR=installdir_test make install; [ `ls installdir_test/usr/local/bin | wc -l` -gt 0 ]; fi - -addons: - apt: - packages: - - libssl-dev - -after_success: | - if [ "$TRAVIS_OS_NAME" = linux -a "$TRAVIS_RUST_VERSION" = stable ]; then - bash <(curl https://raw.githubusercontent.com/xd009642/tarpaulin/master/travis-install.sh) - cargo tarpaulin --out Xml - bash <(curl -s https://codecov.io/bash) - fi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bcb1f8fff..3793a0968 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -70,10 +70,6 @@ lines for non-utility modules include: README: add help ``` -``` -travis: fix build -``` - ``` uucore: add new modules ``` diff --git a/README.md b/README.md index 95dc036fd..7de4419af 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ [![LOC](https://tokei.rs/b1/github/uutils/coreutils?category=code)](https://github.com/Aaronepower/tokei) [![dependency status](https://deps.rs/repo/github/uutils/coreutils/status.svg)](https://deps.rs/repo/github/uutils/coreutils) -[![Build Status](https://api.travis-ci.org/uutils/coreutils.svg?branch=master)](https://travis-ci.org/uutils/coreutils) [![Build Status (FreeBSD)](https://api.cirrus-ci.com/github/uutils/coreutils.svg)](https://cirrus-ci.com/github/uutils/coreutils/master) [![CodeCov](https://codecov.io/gh/uutils/coreutils/branch/master/graph/badge.svg)](https://codecov.io/gh/uutils/coreutils) From b9d44facb9a8c03b968280ff4a085e863a97e829 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 11 May 2021 10:27:13 +0200 Subject: [PATCH 0588/1135] refresh cargo.lock with recent updates --- Cargo.lock | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e729bfcd2..a3f870fc6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -783,9 +783,9 @@ checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "js-sys" -version = "0.3.50" +version = "0.3.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d99f9e3e84b8f67f846ef5b4cbbc3b1c29f6c759fcbce6f01aa0e73d932a24c" +checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062" dependencies = [ "wasm-bindgen", ] @@ -2723,9 +2723,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" -version = "0.2.73" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83240549659d187488f91f33c0f8547cbfef0b2088bc470c116d1d260ef623d9" +checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -2733,9 +2733,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.73" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae70622411ca953215ca6d06d3ebeb1e915f0f6613e3b495122878d7ebec7dae" +checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900" dependencies = [ "bumpalo", "lazy_static", @@ -2748,9 +2748,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.73" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e734d91443f177bfdb41969de821e15c516931c3c3db3d318fa1b68975d0f6f" +checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4" dependencies = [ "quote 1.0.9", "wasm-bindgen-macro-support", @@ -2758,9 +2758,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.73" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53739ff08c8a68b0fdbcd54c372b8ab800b1449ab3c9d706503bc7dd1621b2c" +checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97" dependencies = [ "proc-macro2", "quote 1.0.9", @@ -2771,15 +2771,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.73" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9a543ae66aa233d14bb765ed9af4a33e81b8b58d1584cf1b47ff8cd0b9e4489" +checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" [[package]] name = "web-sys" -version = "0.3.50" +version = "0.3.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a905d57e488fec8861446d3393670fb50d27a262344013181c2cdf9fff5481be" +checksum = "e828417b379f3df7111d3a2a9e5753706cae29c41f7c4029ee9fd77f3e09e582" dependencies = [ "js-sys", "wasm-bindgen", From 8200d399e8d5bc7d7da0d7a65f693620b73e0ed2 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Tue, 11 May 2021 23:03:59 +0200 Subject: [PATCH 0589/1135] date: fix format for nanoseconds --- src/uu/date/src/date.rs | 13 +++++++++---- tests/by-util/test_date.rs | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index 317fd72d4..577cba460 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -207,11 +207,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .alias(OPT_UNIVERSAL_2) .help("print or set Coordinated Universal Time (UTC)"), ) - .arg(Arg::with_name(OPT_FORMAT).multiple(true)) + .arg(Arg::with_name(OPT_FORMAT).multiple(false)) .get_matches_from(args); let format = if let Some(form) = matches.value_of(OPT_FORMAT) { - let form = form[1..].into(); + if !form.starts_with('+') { + eprintln!("date: invalid date ‘{}’", form); + return 1; + } + // GNU `date` uses `%N` for nano seconds, however crate::chrono uses `%f` + let form = form[1..].replace("%N", "%f"); Format::Custom(form) } else if let Some(fmt) = matches .values_of(OPT_ISO_8601) @@ -237,7 +242,7 @@ 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))) => { - eprintln!("date: invalid date '{}'", input); + eprintln!("date: invalid date ‘{}’", input); return 1; } Some(Ok(date)) => Some(date), @@ -301,7 +306,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { println!("{}", formatted); } Err((input, _err)) => { - println!("date: invalid date '{}'", input); + println!("date: invalid date ‘{}’", input); } } } diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 0ca0a74ea..464655315 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -104,6 +104,23 @@ fn test_date_format_full_day() { .stdout_matches(&re); } +#[test] +fn test_date_nano_seconds() { + // %N nanoseconds (000000000..999999999) + let re = Regex::new(r"^\d{1,9}$").unwrap(); + new_ucmd!().arg("+%N").succeeds().stdout_matches(&re); +} + +#[test] +fn test_date_format_without_plus() { + // [+FORMAT] + new_ucmd!() + .arg("%s") + .fails() + .stderr_contains("date: invalid date ‘%s’") + .code_is(1); +} + #[test] #[cfg(all(unix, not(target_os = "macos")))] fn test_date_set_valid() { From 12a43d6eb3e1ec5d6a249f548e7b05c2bfb29065 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 12 May 2021 10:21:24 +0200 Subject: [PATCH 0590/1135] date: fix format literal for nanoseconds --- src/uu/date/src/date.rs | 7 ++++--- tests/by-util/test_date.rs | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index 577cba460..1fe80c03f 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -215,8 +215,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { eprintln!("date: invalid date ‘{}’", form); return 1; } - // GNU `date` uses `%N` for nano seconds, however crate::chrono uses `%f` - let form = form[1..].replace("%N", "%f"); + let form = form[1..].to_string(); Format::Custom(form) } else if let Some(fmt) = matches .values_of(OPT_ISO_8601) @@ -302,7 +301,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { for date in dates { match date { Ok(date) => { - let formatted = date.format(format_string); + // GNU `date` uses `%N` for nano seconds, however crate::chrono uses `%f` + let format_string = &format_string.replace("%N", "%f"); + let formatted = date.format(format_string).to_string().replace("%f", "%N"); println!("{}", formatted); } Err((input, _err)) => { diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 464655315..f4990566a 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -121,6 +121,12 @@ fn test_date_format_without_plus() { .code_is(1); } +#[test] +fn test_date_format_literal() { + new_ucmd!().arg("+%%s").succeeds().stdout_is("%s\n"); + new_ucmd!().arg("+%%N").succeeds().stdout_is("%N\n"); +} + #[test] #[cfg(all(unix, not(target_os = "macos")))] fn test_date_set_valid() { From 0669c89ef311111f1cd1d81d89032457bb2fd0c8 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 12 May 2021 14:47:45 +0200 Subject: [PATCH 0591/1135] refresh cargo.lock with recent updates --- Cargo.lock | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d942c04d4..7bd97c917 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1820,11 +1820,9 @@ name = "uu_df" version = "0.0.6" dependencies = [ "clap", - "libc", "number_prefix", "uucore", "uucore_procs", - "winapi 0.3.9", ] [[package]] @@ -2407,8 +2405,6 @@ name = "uu_stat" version = "0.0.6" dependencies = [ "clap", - "libc", - "time", "uucore", "uucore_procs", ] @@ -2682,6 +2678,7 @@ dependencies = [ "thiserror", "time", "wild", + "winapi 0.3.9", ] [[package]] From 3114fd77be546db6e72046d57d0abfb956486f20 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Tue, 11 May 2021 20:13:38 -0400 Subject: [PATCH 0592/1135] tail: use &mut File instead of mut file: &File --- src/uu/tail/src/tail.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 0a3ff778d..9246f4f43 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -241,7 +241,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } let mut file = File::open(&path).unwrap(); if is_seekable(&mut file) { - bounded_tail(&file, &settings); + bounded_tail(&mut file, &settings); if settings.follow { let reader = BufReader::new(file); readers.push(reader); @@ -400,7 +400,7 @@ fn follow(readers: &mut [BufReader], filenames: &[String], settings: /// true. The `file` is left seek'd to the position just after the byte that /// `should_stop` returned true for. fn backwards_thru_file( - mut file: &File, + file: &mut File, size: u64, buf: &mut Vec, delimiter: u8, @@ -448,14 +448,14 @@ fn backwards_thru_file( /// end of the file, and then read the file "backwards" in blocks of size /// `BLOCK_SIZE` until we find the location of the first line/byte. This ends up /// being a nice performance win for very large files. -fn bounded_tail(mut file: &File, settings: &Settings) { +fn bounded_tail(file: &mut File, settings: &Settings) { let size = file.seek(SeekFrom::End(0)).unwrap(); let mut buf = vec![0; BLOCK_SIZE as usize]; // Find the position in the file to start printing from. match settings.mode { FilterMode::Lines(mut count, delimiter) => { - backwards_thru_file(&file, size, &mut buf, delimiter, &mut |byte| { + backwards_thru_file(file, size, &mut buf, delimiter, &mut |byte| { if byte == delimiter { count -= 1; count == 0 From 2e621759b255391b379ce34fa42e86bc68ed4701 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Tue, 11 May 2021 21:10:30 -0400 Subject: [PATCH 0593/1135] tail: refactor code into ReverseChunks iterator Refactor code from the `backwards_thru_file()` function into a new `ReverseChunks` iterator, and use that iterator to simplify the implementation of the `backwards_thru_file()` function. The `ReverseChunks` iterator yields `Vec` objects, each of which references bytes of a given file. --- src/uu/tail/src/chunks.rs | 83 ++++++++++++++++++++++++++++++++++++ src/uu/tail/src/tail.rs | 89 ++++++++++++++++----------------------- 2 files changed, 120 insertions(+), 52 deletions(-) create mode 100644 src/uu/tail/src/chunks.rs diff --git a/src/uu/tail/src/chunks.rs b/src/uu/tail/src/chunks.rs new file mode 100644 index 000000000..57a26dabf --- /dev/null +++ b/src/uu/tail/src/chunks.rs @@ -0,0 +1,83 @@ +//! Iterating over a file by chunks, starting at the end of the file. +//! +//! Use [`ReverseChunks::new`] to create a new iterator over chunks of +//! bytes from the file. +use std::fs::File; +use std::io::{Read, Seek, SeekFrom}; + +/// When reading files in reverse in `bounded_tail`, this is the size of each +/// block read at a time. +pub const BLOCK_SIZE: u64 = 1 << 16; + +/// An iterator over a file in non-overlapping chunks from the end of the file. +/// +/// Each chunk is a [`Vec`]<[`u8`]> of size [`BLOCK_SIZE`] (except +/// possibly the last chunk, which might be smaller). Each call to +/// [`next`] will seek backwards through the given file. +pub struct ReverseChunks<'a> { + /// The file to iterate over, by blocks, from the end to the beginning. + file: &'a File, + + /// The total number of bytes in the file. + size: u64, + + /// The total number of blocks to read. + max_blocks_to_read: usize, + + /// The index of the next block to read. + block_idx: usize, +} + +impl<'a> ReverseChunks<'a> { + pub fn new(file: &'a mut File) -> ReverseChunks<'a> { + let size = file.seek(SeekFrom::End(0)).unwrap(); + let max_blocks_to_read = (size as f64 / BLOCK_SIZE as f64).ceil() as usize; + let block_idx = 0; + ReverseChunks { + file, + size, + max_blocks_to_read, + block_idx, + } + } +} + +impl<'a> Iterator for ReverseChunks<'a> { + type Item = Vec; + + fn next(&mut self) -> Option { + // If there are no more chunks to read, terminate the iterator. + if self.block_idx >= self.max_blocks_to_read { + return None; + } + + // The chunk size is `BLOCK_SIZE` for all but the last chunk + // (that is, the chunk closest to the beginning of the file), + // which contains the remainder of the bytes. + let block_size = if self.block_idx == self.max_blocks_to_read - 1 { + self.size % BLOCK_SIZE + } else { + BLOCK_SIZE + }; + + // Seek backwards by the next chunk, read the full chunk into + // `buf`, and then seek back to the start of the chunk again. + let mut buf = vec![0; BLOCK_SIZE as usize]; + let pos = self + .file + .seek(SeekFrom::Current(-(block_size as i64))) + .unwrap(); + self.file + .read_exact(&mut buf[0..(block_size as usize)]) + .unwrap(); + let pos2 = self + .file + .seek(SeekFrom::Current(-(block_size as i64))) + .unwrap(); + assert_eq!(pos, pos2); + + self.block_idx += 1; + + Some(buf[0..(block_size as usize)].to_vec()) + } +} diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 9246f4f43..6dafee184 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -15,8 +15,11 @@ extern crate clap; #[macro_use] extern crate uucore; +mod chunks; mod platform; mod ringbuffer; +use chunks::ReverseChunks; +use chunks::BLOCK_SIZE; use ringbuffer::RingBuffer; use clap::{App, Arg}; @@ -355,10 +358,6 @@ pub fn parse_size(mut size_slice: &str) -> Result { } } -/// When reading files in reverse in `bounded_tail`, this is the size of each -/// block read at a time. -const BLOCK_SIZE: u64 = 1 << 16; - fn follow(readers: &mut [BufReader], filenames: &[String], settings: &Settings) { assert!(settings.follow); let mut last = readers.len() - 1; @@ -396,48 +395,42 @@ fn follow(readers: &mut [BufReader], filenames: &[String], settings: } } -/// Iterate over bytes in the file, in reverse, until `should_stop` returns -/// true. The `file` is left seek'd to the position just after the byte that -/// `should_stop` returned true for. -fn backwards_thru_file( - file: &mut File, - size: u64, - buf: &mut Vec, - delimiter: u8, - should_stop: &mut F, -) where - F: FnMut(u8) -> bool, -{ - assert!(buf.len() >= BLOCK_SIZE as usize); +/// Iterate over bytes in the file, in reverse, until we find the +/// `num_delimiters` instance of `delimiter`. The `file` is left seek'd to the +/// position just after that delimiter. +fn backwards_thru_file(file: &mut File, num_delimiters: usize, delimiter: u8) { + // This variable counts the number of delimiters found in the file + // so far (reading from the end of the file toward the beginning). + let mut counter = 0; - let max_blocks_to_read = (size as f64 / BLOCK_SIZE as f64).ceil() as usize; + for (block_idx, slice) in ReverseChunks::new(file).enumerate() { + // Iterate over each byte in the slice in reverse order. + let mut iter = slice.iter().enumerate().rev(); - for block_idx in 0..max_blocks_to_read { - let block_size = if block_idx == max_blocks_to_read - 1 { - size % BLOCK_SIZE - } else { - BLOCK_SIZE - }; - - // Seek backwards by the next block, read the full block into - // `buf`, and then seek back to the start of the block again. - let pos = file.seek(SeekFrom::Current(-(block_size as i64))).unwrap(); - file.read_exact(&mut buf[0..(block_size as usize)]).unwrap(); - let pos2 = file.seek(SeekFrom::Current(-(block_size as i64))).unwrap(); - assert_eq!(pos, pos2); - - // Iterate backwards through the bytes, calling `should_stop` on each - // one. - let slice = &buf[0..(block_size as usize)]; - for (i, ch) in slice.iter().enumerate().rev() { - // Ignore one trailing newline. - if block_idx == 0 && i as u64 == block_size - 1 && *ch == delimiter { - continue; + // Ignore a trailing newline in the last block, if there is one. + if block_idx == 0 { + if let Some(c) = slice.last() { + if *c == delimiter { + iter.next(); + } } + } - if should_stop(*ch) { - file.seek(SeekFrom::Current((i + 1) as i64)).unwrap(); - return; + // For each byte, increment the count of the number of + // delimiters found. If we have found more than the specified + // number of delimiters, terminate the search and seek to the + // appropriate location in the file. + for (i, ch) in iter { + if *ch == delimiter { + counter += 1; + if counter >= num_delimiters { + // After each iteration of the outer loop, the + // cursor in the file is at the *beginning* of the + // block, so seeking forward by `i + 1` bytes puts + // us right after the found delimiter. + file.seek(SeekFrom::Current((i + 1) as i64)).unwrap(); + return; + } } } } @@ -449,20 +442,12 @@ fn backwards_thru_file( /// `BLOCK_SIZE` until we find the location of the first line/byte. This ends up /// being a nice performance win for very large files. fn bounded_tail(file: &mut File, settings: &Settings) { - let size = file.seek(SeekFrom::End(0)).unwrap(); let mut buf = vec![0; BLOCK_SIZE as usize]; // Find the position in the file to start printing from. match settings.mode { - FilterMode::Lines(mut count, delimiter) => { - backwards_thru_file(file, size, &mut buf, delimiter, &mut |byte| { - if byte == delimiter { - count -= 1; - count == 0 - } else { - false - } - }); + FilterMode::Lines(count, delimiter) => { + backwards_thru_file(file, count as usize, delimiter); } FilterMode::Bytes(count) => { file.seek(SeekFrom::End(-(count as i64))).unwrap(); From a4fc2b5106ad1a9226c6c396b5bb2ea191ac9814 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Thu, 13 May 2021 10:17:57 +0200 Subject: [PATCH 0594/1135] who: fix `--lookup` This closes #2181. `who --lookup` is failing with a runtime panic (double free). Since `crate::dns-lookup` already includes a safe wrapper for `getaddrinfo` I used this crate instead of further debugging the existing code in utmpx::canon_host(). * It was neccessary to remove the version constraint for libc in uucore. --- Cargo.lock | 29 +++++++++++-- src/uu/pinky/src/pinky.rs | 15 ++----- src/uu/who/src/who.rs | 16 ++----- src/uucore/Cargo.toml | 1 + src/uucore/src/lib/features/utmpx.rs | 65 +++++++++++++--------------- tests/by-util/test_pinky.rs | 17 ++++++++ tests/by-util/test_who.rs | 1 - 7 files changed, 79 insertions(+), 65 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d942c04d4..77957de80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -576,6 +576,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "dns-lookup" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "093d88961fd18c4ecacb8c80cd0b356463ba941ba11e0e01f9cf5271380b79dc" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "socket2", + "winapi 0.3.9", +] + [[package]] name = "dunce" version = "1.0.1" @@ -1445,6 +1457,17 @@ dependencies = [ "maybe-uninit", ] +[[package]] +name = "socket2" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "winapi 0.3.9", +] + [[package]] name = "strsim" version = "0.8.0" @@ -1820,11 +1843,9 @@ name = "uu_df" version = "0.0.6" dependencies = [ "clap", - "libc", "number_prefix", "uucore", "uucore_procs", - "winapi 0.3.9", ] [[package]] @@ -2407,8 +2428,6 @@ name = "uu_stat" version = "0.0.6" dependencies = [ "clap", - "libc", - "time", "uucore", "uucore_procs", ] @@ -2672,6 +2691,7 @@ name = "uucore" version = "0.0.8" dependencies = [ "data-encoding", + "dns-lookup", "dunce", "getopts", "lazy_static", @@ -2682,6 +2702,7 @@ dependencies = [ "thiserror", "time", "wild", + "winapi 0.3.9", ] [[package]] diff --git a/src/uu/pinky/src/pinky.rs b/src/uu/pinky/src/pinky.rs index e116a2382..f0ab44e5f 100644 --- a/src/uu/pinky/src/pinky.rs +++ b/src/uu/pinky/src/pinky.rs @@ -286,17 +286,10 @@ impl Pinky { print!(" {}", time_string(&ut)); - if self.include_where && !ut.host().is_empty() { - let ut_host = ut.host(); - let mut res = ut_host.splitn(2, ':'); - let host = match res.next() { - Some(_) => ut.canon_host().unwrap_or_else(|_| ut_host.clone()), - None => ut_host.clone(), - }; - match res.next() { - Some(d) => print!(" {}:{}", host, d), - None => print!(" {}", host), - } + let mut s = ut.host(); + if self.include_where && !s.is_empty() { + s = safe_unwrap!(ut.canon_host()); + print!(" {}", s); } println!(); diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index ba1360eff..aef23b3a2 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -548,20 +548,10 @@ impl Who { " ?".into() }; - let mut buf = vec![]; - let ut_host = ut.host(); - let mut res = ut_host.splitn(2, ':'); - if let Some(h) = res.next() { - if self.do_lookup { - buf.push(ut.canon_host().unwrap_or_else(|_| h.to_owned())); - } else { - buf.push(h.to_owned()); - } + let mut s = ut.host(); + if self.do_lookup { + s = safe_unwrap!(ut.canon_host()); } - if let Some(h) = res.next() { - buf.push(h.to_owned()); - } - let s = buf.join(":"); let hoststr = if s.is_empty() { s } else { format!("({})", s) }; self.print_line( diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index da51f7ca4..85efe0434 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -16,6 +16,7 @@ edition = "2018" path="src/lib/lib.rs" [dependencies] +dns-lookup = "1.0.5" dunce = "1.0.0" getopts = "<= 0.2.21" wild = "2.0.4" diff --git a/src/uucore/src/lib/features/utmpx.rs b/src/uucore/src/lib/features/utmpx.rs index 0308d8a5e..96db33c35 100644 --- a/src/uucore/src/lib/features/utmpx.rs +++ b/src/uucore/src/lib/features/utmpx.rs @@ -188,47 +188,40 @@ impl Utmpx { /// Canonicalize host name using DNS pub fn canon_host(&self) -> IOResult { - const AI_CANONNAME: libc::c_int = 0x2; let host = self.host(); - let host = host.split(':').next().unwrap(); - let hints = libc::addrinfo { - ai_flags: AI_CANONNAME, - ai_family: 0, - ai_socktype: 0, - ai_protocol: 0, - ai_addrlen: 0, - ai_addr: ptr::null_mut(), - ai_canonname: ptr::null_mut(), - ai_next: ptr::null_mut(), - }; - let c_host = CString::new(host).unwrap(); - let mut res = ptr::null_mut(); - let status = unsafe { - libc::getaddrinfo( - c_host.as_ptr(), - ptr::null(), - &hints as *const _, - &mut res as *mut _, - ) - }; - if status == 0 { - let info: libc::addrinfo = unsafe { ptr::read(res as *const _) }; - // http://lists.gnu.org/archive/html/bug-coreutils/2006-09/msg00300.html - // says Darwin 7.9.0 getaddrinfo returns 0 but sets - // res->ai_canonname to NULL. - let ret = if info.ai_canonname.is_null() { - Ok(String::from(host)) - } else { - Ok(unsafe { CString::from_raw(info.ai_canonname).into_string().unwrap() }) + + // TODO: change to use `split_once` when MSRV hits 1.52.0 + // let (hostname, display) = host.split_once(':').unwrap_or((&host, "")); + let mut h = host.split(':'); + let hostname = h.next().unwrap_or(&host); + let display = h.next().unwrap_or(""); + + if !hostname.is_empty() { + extern crate dns_lookup; + use dns_lookup::{getaddrinfo, AddrInfoHints}; + + const AI_CANONNAME: i32 = 0x2; + let hints = AddrInfoHints { + flags: AI_CANONNAME, + ..AddrInfoHints::default() }; - unsafe { - libc::freeaddrinfo(res); + let sockets = getaddrinfo(Some(&hostname), None, Some(hints)) + .unwrap() + .collect::>>()?; + for socket in sockets { + if let Some(ai_canonname) = socket.canonname { + return Ok(if display.is_empty() { + ai_canonname + } else { + format!("{}:{}", ai_canonname, display) + }); + } } - ret - } else { - Err(IOError::last_os_error()) } + + Ok(host.to_string()) } + pub fn iter_all_records() -> UtmpxIter { UtmpxIter } diff --git a/tests/by-util/test_pinky.rs b/tests/by-util/test_pinky.rs index 1a7ef8b61..904a05f93 100644 --- a/tests/by-util/test_pinky.rs +++ b/tests/by-util/test_pinky.rs @@ -98,6 +98,23 @@ fn test_short_format_q() { assert_eq!(v_actual, v_expect); } +#[cfg(target_os = "linux")] +#[test] +fn test_no_flag() { + let scene = TestScenario::new(util_name!()); + + let actual = scene.ucmd().succeeds().stdout_move_str(); + let expect = scene + .cmd_keepenv(util_name!()) + .env("LANGUAGE", "C") + .succeeds() + .stdout_move_str(); + + let v_actual: Vec<&str> = actual.split_whitespace().collect(); + let v_expect: Vec<&str> = expect.split_whitespace().collect(); + assert_eq!(v_actual, v_expect); +} + #[cfg(target_os = "linux")] fn expected_result(args: &[&str]) -> String { TestScenario::new(util_name!()) diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index 8aeecfb55..a5637f23a 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -162,7 +162,6 @@ fn test_users() { #[cfg(target_os = "linux")] #[test] -#[ignore] fn test_lookup() { for opt in vec!["--lookup"] { new_ucmd!() From e8d911d9d5ccf1c92d53a02ed8cc8fc729950b36 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Sat, 15 May 2021 10:32:03 -0400 Subject: [PATCH 0595/1135] wc: correct some error messages for invalid inputs Change the error messages that get printed to `stderr` for compatibility with GNU `wc` when an input is a directory and when an input does not exist. Fixes #2211. --- src/uu/wc/src/wc.rs | 27 +++++++++++++++++++++++++-- tests/by-util/test_wc.rs | 23 +++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 226608d40..5670508f4 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -22,7 +22,7 @@ use thiserror::Error; use std::cmp::max; use std::fs::File; -use std::io::{self, Write}; +use std::io::{self, ErrorKind, Write}; use std::path::Path; #[derive(Error, Debug)] @@ -254,6 +254,29 @@ fn word_count_from_input(input: &Input, settings: &Settings) -> WcResult { + show_error_custom_description!(path, "Is a directory"); + } + (Input::Path(path), WcError::Io(e)) if e.kind() == ErrorKind::NotFound => { + show_error_custom_description!(path, "No such file or directory"); + } + (_, e) => { + show_error!("{}", e); + } + }; +} + fn wc(inputs: Vec, settings: &Settings) -> Result<(), u32> { let mut total_word_count = WordCount::default(); let mut results = vec![]; @@ -264,7 +287,7 @@ fn wc(inputs: Vec, settings: &Settings) -> Result<(), u32> { for input in &inputs { let word_count = word_count_from_input(&input, settings).unwrap_or_else(|err| { - show_error!("{}", err); + show_error(&input, err); error_count += 1; WordCount::default() }); diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index b61d7e3aa..8036d0eaa 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -168,3 +168,26 @@ fn test_file_one_long_word() { .run() .stdout_is(" 1 1 10001 10001 10000 onelongword.txt\n"); } + +/// Test that getting counts from a directory is an error. +#[test] +fn test_read_from_directory_error() { + // TODO To match GNU `wc`, the `stdout` should be: + // + // " 0 0 0 .\n" + // + new_ucmd!() + .args(&["."]) + .fails() + .stderr_contains(".: Is a directory\n") + .stdout_is("0 0 0 .\n"); +} + +/// Test that getting counts from nonexistent file is an error. +#[test] +fn test_read_from_nonexistent_file() { + new_ucmd!() + .args(&["bogusfile"]) + .fails() + .stderr_contains("bogusfile: No such file or directory\n"); +} From 97a49c7c95ec51839650b3b95ebff7d44ea401db Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Fri, 7 May 2021 15:07:17 -0400 Subject: [PATCH 0596/1135] wc: compute min width to format counts up front Fix two issues with the string formatting width for counts displayed by `wc`. First, the output was previously not using the default minimum width (seven characters) when reading from `stdin`. This commit corrects this behavior to match GNU `wc`. For example, $ cat alice_in_wonderland.txt | wc 5 57 302 Second, if at least 10^7 bytes were read from `stdin` *after* reading from a smaller regular file, then every output row would have width 8. This disagrees with GNU `wc`, in which only the `stdin` row and the total row would have width 8. This commit corrects this behavior to match GNU `wc`. For example, $ printf "%.0s0" {1..10000000} | wc emptyfile.txt - 0 0 0 emptyfile.txt 0 1 10000000 0 1 10000000 total Fixes #2186. --- src/uu/wc/src/wc.rs | 106 +++++++++++++++++++++++++++++++++++---- tests/by-util/test_wc.rs | 38 +++++++++++--- 2 files changed, 128 insertions(+), 16 deletions(-) diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 5670508f4..b323f7261 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -20,11 +20,13 @@ use wordcount::{TitledWordCount, WordCount}; use clap::{App, Arg, ArgMatches}; use thiserror::Error; -use std::cmp::max; -use std::fs::File; +use std::fs::{self, File}; use std::io::{self, ErrorKind, Write}; use std::path::Path; +/// The minimum character width for formatting counts when reading from stdin. +const MINIMUM_WIDTH: usize = 7; + #[derive(Error, Debug)] pub enum WcError { #[error("{0}")] @@ -277,11 +279,101 @@ fn show_error(input: &Input, err: WcError) { }; } +/// Compute the number of digits needed to represent any count for this input. +/// +/// If `input` is [`Input::Stdin`], then this function returns +/// [`MINIMUM_WIDTH`]. Otherwise, if metadata could not be read from +/// `input` then this function returns 1. +/// +/// # Errors +/// +/// This function will return an error if `input` is a [`Input::Path`] +/// and there is a problem accessing the metadata of the given `input`. +/// +/// # Examples +/// +/// A [`Input::Stdin`] gets a default minimum width: +/// +/// ```rust,ignore +/// let input = Input::Stdin(StdinKind::Explicit); +/// assert_eq!(7, digit_width(input)); +/// ``` +fn digit_width(input: &Input) -> WcResult> { + match input { + Input::Stdin(_) => Ok(Some(MINIMUM_WIDTH)), + Input::Path(filename) => { + let path = Path::new(filename); + let metadata = fs::metadata(path)?; + if metadata.is_file() { + // TODO We are now computing the number of bytes in a file + // twice: once here and once in `WordCount::from_line()` (or + // in `count_bytes_fast()` if that function is called + // instead). See GitHub issue #2201. + let num_bytes = metadata.len(); + let num_digits = num_bytes.to_string().len(); + Ok(Some(num_digits)) + } else { + Ok(None) + } + } + } +} + +/// Compute the number of digits needed to represent all counts in all inputs. +/// +/// `inputs` may include zero or more [`Input::Stdin`] entries, each of +/// which represents reading from `stdin`. The presence of any such +/// entry causes this function to return a width that is at least +/// [`MINIMUM_WIDTH`]. +/// +/// If `input` is empty, then this function returns 1. If file metadata +/// could not be read from any of the [`Input::Path`] inputs and there +/// are no [`Input::Stdin`] inputs, then this function returns 1. +/// +/// If there is a problem accessing the metadata, this function will +/// silently ignore the error and assume that the number of digits +/// needed to display the counts for that file is 1. +/// +/// # Examples +/// +/// An empty slice implies a width of 1: +/// +/// ```rust,ignore +/// assert_eq!(1, max_width(&vec![])); +/// ``` +/// +/// The presence of [`Input::Stdin`] implies a minimum width: +/// +/// ```rust,ignore +/// let inputs = vec![Input::Stdin(StdinKind::Explicit)]; +/// assert_eq!(7, max_width(&inputs)); +/// ``` +fn max_width(inputs: &[Input]) -> usize { + let mut result = 1; + for input in inputs { + match digit_width(input) { + Ok(maybe_n) => { + if let Some(n) = maybe_n { + result = result.max(n); + } + } + Err(_) => continue, + } + } + result +} + fn wc(inputs: Vec, settings: &Settings) -> Result<(), u32> { + // Compute the width, in digits, to use when formatting counts. + // + // The width is the number of digits needed to print the number of + // bytes in the largest file. This is true regardless of whether + // the `settings` indicate that the bytes will be displayed. + let mut error_count = 0; + let max_width = max_width(&inputs); + let mut total_word_count = WordCount::default(); let mut results = vec![]; - let mut max_width: usize = 0; - let mut error_count = 0; let num_inputs = inputs.len(); @@ -291,12 +383,6 @@ fn wc(inputs: Vec, settings: &Settings) -> Result<(), u32> { error_count += 1; WordCount::default() }); - // Compute the number of digits needed to display the number - // of bytes in the file. Even if the settings indicate that we - // won't *display* the number of bytes, we still use the - // number of digits in the byte count as the width when - // formatting each count as a string for output. - max_width = max(max_width, word_count.bytes.to_string().len()); total_word_count += word_count; results.push(word_count.with_title(input.to_title())); } diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index 8036d0eaa..1203c0b1d 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -33,7 +33,7 @@ fn test_stdin_default() { new_ucmd!() .pipe_in_fixture("lorem_ipsum.txt") .run() - .stdout_is(" 13 109 772\n"); + .stdout_is(" 13 109 772\n"); } #[test] @@ -42,7 +42,7 @@ fn test_stdin_explicit() { .pipe_in_fixture("lorem_ipsum.txt") .arg("-") .run() - .stdout_is(" 13 109 772 -\n"); + .stdout_is(" 13 109 772 -\n"); } #[test] @@ -51,9 +51,11 @@ fn test_utf8() { .args(&["-lwmcL"]) .pipe_in_fixture("UTF_8_test.txt") .run() - .stdout_is(" 300 4969 22781 22213 79\n"); - // GNU returns " 300 2086 22219 22781 79" - // TODO: we should fix that to match GNU's behavior + .stdout_is(" 300 4969 22781 22213 79\n"); + // GNU returns " 300 2086 22219 22781 79" + // + // TODO: we should fix the word, character, and byte count to + // match the behavior of GNU wc } #[test] @@ -80,7 +82,7 @@ fn test_stdin_all_counts() { .args(&["-c", "-m", "-l", "-L", "-w"]) .pipe_in_fixture("alice_in_wonderland.txt") .run() - .stdout_is(" 5 57 302 302 66\n"); + .stdout_is(" 5 57 302 302 66\n"); } #[test] @@ -169,6 +171,30 @@ fn test_file_one_long_word() { .stdout_is(" 1 1 10001 10001 10000 onelongword.txt\n"); } +/// Test that the number of bytes in the file dictate the display width. +/// +/// The width in digits of any count is the width in digits of the +/// number of bytes in the file, regardless of whether the number of +/// bytes are displayed. +#[test] +fn test_file_bytes_dictate_width() { + // This file has 10,001 bytes. Five digits are required to + // represent that. Even though the number of lines is 1 and the + // number of words is 0, each of those counts is formatted with + // five characters, filled with whitespace. + new_ucmd!() + .args(&["-lw", "onelongemptyline.txt"]) + .run() + .stdout_is(" 1 0 onelongemptyline.txt\n"); + + // This file has zero bytes. Only one digit is required to + // represent that. + new_ucmd!() + .args(&["-lw", "emptyfile.txt"]) + .run() + .stdout_is("0 0 emptyfile.txt\n"); +} + /// Test that getting counts from a directory is an error. #[test] fn test_read_from_directory_error() { From 733d347fa86839a84d5cc153f0428dacd3547632 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Tue, 11 May 2021 23:18:32 -0400 Subject: [PATCH 0597/1135] head: simplify rbuf_n_bytes() in head.rs Simplify the code in `rbuf_n_bytes()` to use existing abstractions provided by the standard library. --- src/uu/head/src/head.rs | 40 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 807d04314..e050d26f6 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -1,7 +1,7 @@ use clap::{App, Arg}; use std::convert::TryFrom; use std::ffi::OsString; -use std::io::{ErrorKind, Read, Seek, SeekFrom, Write}; +use std::io::{self, ErrorKind, Read, Seek, SeekFrom, Write}; use uucore::{crash, executable, show_error}; const EXIT_FAILURE: i32 = 1; @@ -206,38 +206,20 @@ impl Default for HeadOptions { } } -fn rbuf_n_bytes(input: &mut impl std::io::BufRead, n: usize) -> std::io::Result<()> { - if n == 0 { - return Ok(()); - } - let mut readbuf = [0u8; BUF_SIZE]; - let mut i = 0usize; +fn rbuf_n_bytes(input: R, n: usize) -> std::io::Result<()> +where + R: Read, +{ + // Read the first `n` bytes from the `input` reader. + let mut reader = input.take(n as u64); + // Write those bytes to `stdout`. let stdout = std::io::stdout(); let mut stdout = stdout.lock(); - loop { - let read = loop { - match input.read(&mut readbuf) { - Ok(n) => break n, - Err(e) => match e.kind() { - ErrorKind::Interrupted => {} - _ => return Err(e), - }, - } - }; - if read == 0 { - // might be unexpected if - // we haven't read `n` bytes - // but this mirrors GNU's behavior - return Ok(()); - } - stdout.write_all(&readbuf[..read.min(n - i)])?; - i += read.min(n - i); - if i == n { - return Ok(()); - } - } + io::copy(&mut reader, &mut stdout)?; + + Ok(()) } fn rbuf_n_lines(input: &mut impl std::io::BufRead, n: usize, zero: bool) -> std::io::Result<()> { From 659bf58a4c80201db406e4d7c2b3e8cef56931a3 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Sun, 16 May 2021 11:30:10 -0400 Subject: [PATCH 0598/1135] head: print headings when reading multiple files Fix a bug in which `head` failed to print headings for `stdin` inputs when reading from multiple files, and fix another bug in which `head` failed to print a blank line between the contents of a file and the heading for the next file when reading multiple files. The output now matches that of GNU `head`. --- src/uu/head/src/head.rs | 5 ++++- tests/by-util/test_head.rs | 25 +++++++++++++++++++++++++ tests/fixtures/head/emptyfile.txt | 0 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tests/fixtures/head/emptyfile.txt diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index e050d26f6..faaeedd3f 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -405,7 +405,7 @@ fn uu_head(options: &HeadOptions) { for fname in &options.files { let res = match fname.as_str() { "-" => { - if options.verbose { + if (options.files.len() > 1 && !options.quiet) || options.verbose { if !first { println!(); } @@ -459,6 +459,9 @@ fn uu_head(options: &HeadOptions) { }, }; if (options.files.len() > 1 && !options.quiet) || options.verbose { + if !first { + println!(); + } println!("==> {} <==", name) } head_file(&mut file, options) diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index 4f009c800..2aedbdcbe 100755 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -196,3 +196,28 @@ fn test_obsolete_extras() { .succeeds() .stdout_is("==> standard input <==\n1\02\03\04\05\0"); } + +#[test] +fn test_multiple_files() { + new_ucmd!() + .args(&["emptyfile.txt", "emptyfile.txt"]) + .succeeds() + .stdout_is("==> emptyfile.txt <==\n\n==> emptyfile.txt <==\n"); +} + +#[test] +fn test_multiple_files_with_stdin() { + new_ucmd!() + .args(&["emptyfile.txt", "-", "emptyfile.txt"]) + .pipe_in("hello\n") + .succeeds() + .stdout_is( + "==> emptyfile.txt <== + +==> standard input <== +hello + +==> emptyfile.txt <== +", + ); +} diff --git a/tests/fixtures/head/emptyfile.txt b/tests/fixtures/head/emptyfile.txt new file mode 100644 index 000000000..e69de29bb From 22ba21d8ab6d9e7efbcfe83da22a855c2338d5eb Mon Sep 17 00:00:00 2001 From: Arijit Dey Date: Sun, 16 May 2021 22:26:54 +0530 Subject: [PATCH 0599/1135] Fix bug with terminal getting weird --- Cargo.lock | 23 +++++++++++++---------- Cargo.toml | 2 +- src/uu/more/Cargo.toml | 2 +- src/uu/more/src/more.rs | 1 + 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 473281ef0..972003e85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -847,15 +847,6 @@ version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" -[[package]] -name = "lock_api" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3c91c24eae6777794bb1997ad98bbb87daf92890acab859f7eaa4320333176" -dependencies = [ - "scopeguard", -] - [[package]] name = "locale" version = "0.2.2" @@ -865,6 +856,15 @@ dependencies = [ "libc", ] +[[package]] +name = "lock_api" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3c91c24eae6777794bb1997ad98bbb87daf92890acab859f7eaa4320333176" +dependencies = [ + "scopeguard", +] + [[package]] name = "log" version = "0.4.14" @@ -1091,7 +1091,7 @@ dependencies = [ "cfg-if 1.0.0", "instant", "libc", - "redox_syscall 0.2.6", + "redox_syscall 0.2.7", "smallvec 1.6.1", "winapi 0.3.9", ] @@ -1818,6 +1818,7 @@ dependencies = [ name = "uu_basename" version = "0.0.6" dependencies = [ + "clap", "uucore", "uucore_procs", ] @@ -2263,6 +2264,7 @@ dependencies = [ name = "uu_more" version = "0.0.6" dependencies = [ + "atty", "clap", "crossterm", "nix 0.13.1", @@ -2774,6 +2776,7 @@ dependencies = [ name = "uu_who" version = "0.0.6" dependencies = [ + "clap", "uucore", "uucore_procs", ] diff --git a/Cargo.toml b/Cargo.toml index fdac87d7a..322d34f3a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -347,7 +347,7 @@ unindent = "0.1" uucore = { version=">=0.0.8", package="uucore", path="src/uucore", features=["entries"] } walkdir = "2.2" tempdir = "0.3" -atty = "*" +atty = "0.2.14" [target.'cfg(unix)'.dev-dependencies] rust-users = { version="0.10", package="users" } diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index 35c3309e1..9b1a3d7b6 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -19,7 +19,7 @@ clap = "2.33" uucore = { version = ">=0.0.7", package = "uucore", path = "../../uucore" } uucore_procs = { version = ">=0.0.5", package = "uucore_procs", path = "../../uucore_procs" } crossterm = ">=0.19" -atty = "*" +atty = "0.2.14" [target.'cfg(target_os = "redox")'.dependencies] redox_termios = "0.1" diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 904787d67..f09a924f8 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -168,6 +168,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { stdin().read_to_string(&mut buff).unwrap(); more(&buff, &mut stdout, true); } else { + terminal::disable_raw_mode().unwrap(); show_usage_error!("bad usage"); } } From c930509095dc37a20bbfd4a51460dfc42be06e36 Mon Sep 17 00:00:00 2001 From: Arijit Dey Date: Sun, 16 May 2021 22:30:46 +0530 Subject: [PATCH 0600/1135] Fix clippy warning --- src/uu/more/src/more.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index f09a924f8..e9687dcc4 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -162,15 +162,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { buff.clear(); } reset_term(&mut stdout); + } else if atty::isnt(atty::Stream::Stdin) { + let mut stdout = setup_term(); + stdin().read_to_string(&mut buff).unwrap(); + more(&buff, &mut stdout, true); } else { - if atty::isnt(atty::Stream::Stdin) { - let mut stdout = setup_term(); - stdin().read_to_string(&mut buff).unwrap(); - more(&buff, &mut stdout, true); - } else { - terminal::disable_raw_mode().unwrap(); - show_usage_error!("bad usage"); - } + terminal::disable_raw_mode().unwrap(); + show_usage_error!("bad usage"); } 0 } From fcd48813e01b279604f286e87f7dcbacafe9759b Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sun, 16 May 2021 21:13:37 +0200 Subject: [PATCH 0601/1135] sort: read files as chunks, off-thread Instead of using a BufReader and reading each line separately, allocating a String for each one, we read to a chunk. Lines are references to this chunk. This makes the allocator's job much easier and yields performance improvements. Chunks are read on a separate thread to further improve performance. --- Cargo.lock | 141 +++++++- src/uu/sort/BENCHMARKING.md | 15 +- src/uu/sort/Cargo.toml | 10 +- src/uu/sort/src/check.rs | 102 ++++++ src/uu/sort/src/chunks.rs | 202 +++++++++++ src/uu/sort/src/ext_sort.rs | 160 +++++++++ src/uu/sort/src/external_sort/LICENSE | 19 - src/uu/sort/src/external_sort/mod.rs | 93 ----- src/uu/sort/src/merge.rs | 223 ++++++++++++ src/uu/sort/src/sort.rs | 486 +++++++++----------------- tests/by-util/test_sort.rs | 4 +- 11 files changed, 1003 insertions(+), 452 deletions(-) create mode 100644 src/uu/sort/src/check.rs create mode 100644 src/uu/sort/src/chunks.rs create mode 100644 src/uu/sort/src/ext_sort.rs delete mode 100644 src/uu/sort/src/external_sort/LICENSE delete mode 100644 src/uu/sort/src/external_sort/mod.rs create mode 100644 src/uu/sort/src/merge.rs diff --git a/Cargo.lock b/Cargo.lock index 77957de80..feda68de5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,11 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" + [[package]] name = "advapi32-sys" version = "0.2.0" @@ -63,6 +69,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +[[package]] +name = "binary-heap-plus" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f068638f8ff9e118a9361e66a411eff410e7fb3ecaa23bf9272324f8fc606d7" +dependencies = [ + "compare", +] + [[package]] name = "bit-set" version = "0.5.2" @@ -136,9 +151,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cast" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc38c385bfd7e444464011bb24820f40dd1c76bcdfa1b78611cb7c2e5cafab75" +checksum = "57cdfa5d50aad6cb4d44dcab6101a7f79925bd59d82ca42f38a9856a28865374" dependencies = [ "rustc_version", ] @@ -198,6 +213,12 @@ dependencies = [ "bitflags", ] +[[package]] +name = "compare" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120133d4db2ec47efe2e26502ee984747630c67f51974fca0b6c1340cf2368d3" + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -999,6 +1020,29 @@ version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +[[package]] +name = "ouroboros" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc1f52300b81ac4eeeb6c00c20f7e86556c427d9fb2d92b68fc73c22f331cd15" +dependencies = [ + "ouroboros_macro", + "stable_deref_trait", +] + +[[package]] +name = "ouroboros_macro" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41db02c8f8731cdd7a72b433c7900cce4bf245465b452c364bfd21f4566ab055" +dependencies = [ + "Inflector", + "proc-macro-error", + "proc-macro2", + "quote 1.0.9", + "syn", +] + [[package]] name = "output_vt100" version = "0.1.2" @@ -1027,6 +1071,15 @@ dependencies = [ "proc-macro-hack", ] +[[package]] +name = "pest" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +dependencies = [ + "ucd-trie", +] + [[package]] name = "pkg-config" version = "0.3.19" @@ -1089,6 +1142,30 @@ dependencies = [ "output_vt100", ] +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote 1.0.9", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote 1.0.9", + "version_check", +] + [[package]] name = "proc-macro-hack" version = "0.5.19" @@ -1336,11 +1413,11 @@ checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" [[package]] name = "rustc_version" -version = "0.2.3" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" dependencies = [ - "semver", + "semver 0.11.0", ] [[package]] @@ -1370,7 +1447,16 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser", + "semver-parser 0.7.0", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser 0.10.2", ] [[package]] @@ -1380,10 +1466,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] -name = "serde" -version = "1.0.125" +name = "semver-parser" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + +[[package]] +name = "serde" +version = "1.0.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" [[package]] name = "serde_cbor" @@ -1397,9 +1492,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.125" +version = "1.0.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" +checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" dependencies = [ "proc-macro2", "quote 1.0.9", @@ -1468,6 +1563,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "strsim" version = "0.8.0" @@ -1627,6 +1728,12 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" + [[package]] name = "unicode-segmentation" version = "1.7.1" @@ -2402,12 +2509,16 @@ dependencies = [ name = "uu_sort" version = "0.0.6" dependencies = [ + "binary-heap-plus", "clap", + "compare", "fnv", "itertools 0.10.0", + "memchr 2.4.0", + "ouroboros", "rand 0.7.3", "rayon", - "semver", + "semver 0.9.0", "tempdir", "unicode-width", "uucore", @@ -2720,6 +2831,12 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +[[package]] +name = "version_check" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" + [[package]] name = "void" version = "1.0.2" diff --git a/src/uu/sort/BENCHMARKING.md b/src/uu/sort/BENCHMARKING.md index 71c331105..52866719d 100644 --- a/src/uu/sort/BENCHMARKING.md +++ b/src/uu/sort/BENCHMARKING.md @@ -75,7 +75,20 @@ Try running commands with the `-S` option set to an amount of memory to be used, huge files (ideally multiple Gigabytes) with `-S`. Creating such a large file can be achieved by running `cat shuffled_wordlist.txt | sort -R >> shuffled_wordlist.txt` multiple times (this will add the contents of `shuffled_wordlist.txt` to itself). Example: Run `hyperfine './target/release/coreutils sort shuffled_wordlist.txt -S 1M' 'sort shuffled_wordlist.txt -S 1M'` -` + +## Merging + +"Merge" sort merges already sorted files. It is a sub-step of external sorting, so benchmarking it separately may be helpful. + +- Splitting `shuffled_wordlist.txt` can be achieved by running `split shuffled_wordlist.txt shuffled_wordlist_slice_ --additional-suffix=.txt` +- Sort each part by running `for f in shuffled_wordlist_slice_*; do sort $f -o $f; done` +- Benchmark merging by running `hyperfine "target/release/coreutils sort -m shuffled_wordlist_slice_*"` + +## Check + +When invoked with -c, we simply check if the input is already ordered. The input for benchmarking should be an already sorted file. + +- Benchmark checking by running `hyperfine "target/release/coreutils sort -c sorted_wordlist.txt"` ## Stdout and stdin performance diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 5221f1f4e..724744dc4 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -15,16 +15,20 @@ edition = "2018" path = "src/sort.rs" [dependencies] -rayon = "1.5" -rand = "0.7" +binary-heap-plus = "0.4.1" clap = "2.33" +compare = "0.1.0" fnv = "1.0.7" itertools = "0.10.0" +memchr = "2.4.0" +ouroboros = "0.9.3" +rand = "0.7" +rayon = "1.5" semver = "0.9.0" +tempdir = "0.3.7" unicode-width = "0.1.8" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } -tempdir = "0.3.7" [[bin]] name = "sort" diff --git a/src/uu/sort/src/check.rs b/src/uu/sort/src/check.rs new file mode 100644 index 000000000..fe815b624 --- /dev/null +++ b/src/uu/sort/src/check.rs @@ -0,0 +1,102 @@ +// * This file is part of the uutils coreutils package. +// * +// * (c) Michael Debertol +// * +// * For the full copyright and license information, please view the LICENSE +// * file that was distributed with this source code. + +//! Check if a file is ordered + +use crate::{ + chunks::{self, Chunk}, + compare_by, open, GlobalSettings, +}; +use itertools::Itertools; +use std::{ + cmp::Ordering, + io::Read, + iter, + sync::mpsc::{sync_channel, Receiver, SyncSender}, + thread, +}; + +/// Check if the file at `path` is ordered. +/// +/// # Returns +/// +/// The code we should exit with. +pub fn check(path: &str, settings: &GlobalSettings) -> i32 { + let file = open(path).expect("failed to open input file"); + let (recycled_sender, recycled_receiver) = sync_channel(2); + let (loaded_sender, loaded_receiver) = sync_channel(2); + thread::spawn({ + let settings = settings.clone(); + move || reader(file, recycled_receiver, loaded_sender, &settings) + }); + for _ in 0..2 { + recycled_sender + .send(Chunk::new(vec![0; 100 * 1024], |_| Vec::new())) + .unwrap(); + } + + let mut prev_chunk: Option = None; + let mut line_idx = 0; + for chunk in loaded_receiver.iter() { + line_idx += 1; + if let Some(prev_chunk) = prev_chunk.take() { + // Check if the first element of the new chunk is greater than the last + // element from the previous chunk + let prev_last = prev_chunk.borrow_lines().last().unwrap(); + let new_first = chunk.borrow_lines().first().unwrap(); + + if compare_by(prev_last, new_first, &settings) == Ordering::Greater { + if !settings.check_silent { + println!("sort: {}:{}: disorder: {}", path, line_idx, new_first.line); + } + return 1; + } + recycled_sender.send(prev_chunk).ok(); + } + + for (a, b) in chunk.borrow_lines().iter().tuple_windows() { + line_idx += 1; + if compare_by(a, b, &settings) == Ordering::Greater { + if !settings.check_silent { + println!("sort: {}:{}: disorder: {}", path, line_idx, b.line); + } + return 1; + } + } + + prev_chunk = Some(chunk); + } + 0 +} + +/// The function running on the reader thread. +fn reader( + mut file: Box, + receiver: Receiver, + sender: SyncSender, + settings: &GlobalSettings, +) { + let mut sender = Some(sender); + let mut carry_over = vec![]; + for chunk in receiver.iter() { + let (recycled_lines, recycled_buffer) = chunk.recycle(); + chunks::read( + &mut sender, + recycled_buffer, + &mut carry_over, + &mut file, + &mut iter::empty(), + if settings.zero_terminated { + b'\0' + } else { + b'\n' + }, + recycled_lines, + settings, + ) + } +} diff --git a/src/uu/sort/src/chunks.rs b/src/uu/sort/src/chunks.rs new file mode 100644 index 000000000..c679980ec --- /dev/null +++ b/src/uu/sort/src/chunks.rs @@ -0,0 +1,202 @@ +// * This file is part of the uutils coreutils package. +// * +// * (c) Michael Debertol +// * +// * For the full copyright and license information, please view the LICENSE +// * file that was distributed with this source code. + +//! Utilities for reading files as chunks. + +use std::{ + io::{ErrorKind, Read}, + sync::mpsc::SyncSender, +}; + +use memchr::memchr_iter; +use ouroboros::self_referencing; + +use crate::{GlobalSettings, Line}; + +/// The chunk that is passed around between threads. +/// `lines` consist of slices into `buffer`. +#[self_referencing(pub_extras)] +#[derive(Debug)] +pub struct Chunk { + pub buffer: Vec, + #[borrows(buffer)] + #[covariant] + pub lines: Vec>, +} + +impl Chunk { + /// Destroy this chunk and return its components to be reused. + /// + /// # Returns + /// + /// * The `lines` vector, emptied + /// * The `buffer` vector, **not** emptied + pub fn recycle(mut self) -> (Vec>, Vec) { + let recycled_lines = self.with_lines_mut(|lines| { + lines.clear(); + unsafe { + // SAFETY: It is safe to (temporarily) transmute to a vector of lines with a longer lifetime, + // because the vector is empty. + // Transmuting is necessary to make recycling possible. See https://github.com/rust-lang/rfcs/pull/2802 + // for a rfc to make this unnecessary. Its example is similar to the code here. + std::mem::transmute::>, Vec>>(std::mem::take(lines)) + } + }); + (recycled_lines, self.into_heads().buffer) + } +} + +/// Read a chunk, parse lines and send them. +/// +/// No empty chunk will be sent. +/// +/// # Arguments +/// +/// * `sender_option`: The sender to send the lines to the sorter. If `None`, does nothing. +/// * `buffer`: The recycled buffer. All contents will be overwritten, but it must already be filled. +/// (i.e. `buffer.len()` should be equal to `buffer.capacity()`) +/// * `carry_over`: The bytes that must be carried over in between invocations. +/// * `file`: The current file. +/// * `next_files`: What `file` should be updated to next. +/// * `separator`: The line separator. +/// * `lines`: The recycled vector to fill with lines. Must be empty. +/// * `settings`: The global settings. +#[allow(clippy::too_many_arguments)] +pub fn read( + sender_option: &mut Option>, + mut buffer: Vec, + carry_over: &mut Vec, + file: &mut Box, + next_files: &mut impl Iterator>, + separator: u8, + lines: Vec>, + settings: &GlobalSettings, +) { + assert!(lines.is_empty()); + if let Some(sender) = sender_option { + if buffer.len() < carry_over.len() { + buffer.resize(carry_over.len() + 10 * 1024, 0); + } + buffer[..carry_over.len()].copy_from_slice(&carry_over); + let (read, should_continue) = + read_to_buffer(file, next_files, &mut buffer, carry_over.len(), separator); + carry_over.clear(); + carry_over.extend_from_slice(&buffer[read..]); + + let payload = Chunk::new(buffer, |buf| { + let mut lines = unsafe { + // SAFETY: It is safe to transmute to a vector of lines with shorter lifetime, + // because it was only temporarily transmuted to a Vec> to make recycling possible. + std::mem::transmute::>, Vec>>(lines) + }; + let read = crash_if_err!(1, std::str::from_utf8(&buf[..read])); + parse_lines(read, &mut lines, separator, &settings); + lines + }); + if !payload.borrow_lines().is_empty() { + sender.send(payload).unwrap(); + } + if !should_continue { + *sender_option = None; + } + } +} + +/// Split `read` into `Line`s, and add them to `lines`. +fn parse_lines<'a>( + mut read: &'a str, + lines: &mut Vec>, + separator: u8, + settings: &GlobalSettings, +) { + // Strip a trailing separator. TODO: Once our MinRustV is 1.45 or above, use strip_suffix() instead. + if read.ends_with(separator as char) { + read = &read[..read.len() - 1]; + } + + lines.extend( + read.split(separator as char) + .map(|line| Line::create(line, settings)), + ); +} + +/// Read from `file` into `buffer`. +/// +/// This function makes sure that at least two lines are read (unless we reach EOF and there's no next file), +/// growing the buffer if necessary. +/// The last line is likely to not have been fully read into the buffer. Its bytes must be copied to +/// the front of the buffer for the next invocation so that it can be continued to be read +/// (see the return values and `start_offset`). +/// +/// # Arguments +/// +/// * `file`: The file to start reading from. +/// * `next_files`: When `file` reaches EOF, it is updated to `next_files.next()` if that is `Some`, +/// and this function continues reading. +/// * `buffer`: The buffer that is filled with bytes. Its contents will mostly be overwritten (see `start_offset` +/// as well). It will not be grown by default, unless that is necessary to read at least two lines. +/// * `start_offset`: The amount of bytes at the start of `buffer` that were carried over +/// from the previous read and should not be overwritten. +/// * `separator`: The byte that separates lines. +/// +/// # Returns +/// +/// * The amount of bytes in `buffer` that can now be interpreted as lines. +/// The remaining bytes must be copied to the start of the buffer for the next invocation, +/// if another invocation is necessary, which is determined by the other return value. +/// * Whether this function should be called again. +fn read_to_buffer( + file: &mut Box, + next_files: &mut impl Iterator>, + buffer: &mut Vec, + start_offset: usize, + separator: u8, +) -> (usize, bool) { + let mut read_target = &mut buffer[start_offset..]; + loop { + match file.read(read_target) { + Ok(0) => { + if read_target.is_empty() { + // chunk is full + let mut sep_iter = memchr_iter(separator, &buffer).rev(); + let last_line_end = sep_iter.next(); + if sep_iter.next().is_some() { + // We read enough lines. + let end = last_line_end.unwrap(); + // We want to include the separator here, because it shouldn't be carried over. + return (end + 1, true); + } else { + // We need to read more lines + let len = buffer.len(); + // resize the vector to 10 KB more + buffer.resize(len + 1024 * 10, 0); + read_target = &mut buffer[len..]; + } + } else { + // This file is empty. + if let Some(next_file) = next_files.next() { + // There is another file. + *file = next_file; + } else { + // This was the last file. + let leftover_len = read_target.len(); + return (buffer.len() - leftover_len, false); + } + } + } + Ok(n) => { + read_target = &mut read_target[n..]; + } + Err(e) if e.kind() == ErrorKind::Interrupted => { + // retry + } + Err(e) => { + crash!(1, "{}", e) + } + } + } +} diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs new file mode 100644 index 000000000..629ebb714 --- /dev/null +++ b/src/uu/sort/src/ext_sort.rs @@ -0,0 +1,160 @@ +// * This file is part of the uutils coreutils package. +// * +// * (c) Michael Debertol +// * +// * For the full copyright and license information, please view the LICENSE +// * file that was distributed with this source code. + +//! Sort big files by using files for storing intermediate chunks. +//! +//! Files are read into chunks of memory which are then sorted individually and +//! written to temporary files. There are two threads: One sorter, and one reader/writer. +//! The buffers for the individual chunks are recycled. There are two buffers. + +use std::io::{BufWriter, Write}; +use std::path::Path; +use std::{ + fs::OpenOptions, + io::Read, + sync::mpsc::{Receiver, SyncSender}, + thread, +}; + +use tempdir::TempDir; + +use crate::{ + chunks::{self, Chunk}, + merge::{self, FileMerger}, + sort_by, GlobalSettings, +}; + +/// Iterator that wraps the +pub struct ExtSortedMerger<'a> { + pub file_merger: FileMerger<'a>, + // Keep _tmp_dir around, as it is deleted when dropped. + _tmp_dir: TempDir, +} + +/// Sort big files by using files for storing intermediate chunks. +/// +/// # Returns +/// +/// An iterator that merges intermediate files back together. +pub fn ext_sort<'a>( + files: &mut impl Iterator>, + settings: &'a GlobalSettings, +) -> ExtSortedMerger<'a> { + let tmp_dir = crash_if_err!(1, TempDir::new_in(&settings.tmp_dir, "uutils_sort")); + let (sorted_sender, sorted_receiver) = std::sync::mpsc::sync_channel(1); + let (recycled_sender, recycled_receiver) = std::sync::mpsc::sync_channel(1); + thread::spawn({ + let settings = settings.clone(); + move || sorter(recycled_receiver, sorted_sender, settings) + }); + let chunks_read = reader_writer( + files, + &tmp_dir, + if settings.zero_terminated { + b'\0' + } else { + b'\n' + }, + // Heuristically chosen: Dividing by 10 seems to keep our memory usage roughly + // around settings.buffer_size as a whole. + settings.buffer_size / 10, + settings.clone(), + sorted_receiver, + recycled_sender, + ); + let files = (0..chunks_read) + .map(|chunk_num| tmp_dir.path().join(chunk_num.to_string())) + .collect::>(); + + ExtSortedMerger { + file_merger: merge::merge(&files, settings), + _tmp_dir: tmp_dir, + } +} + +/// The function that is executed on the sorter thread. +fn sorter(receiver: Receiver, sender: SyncSender, settings: GlobalSettings) { + while let Ok(mut payload) = receiver.recv() { + payload.with_lines_mut(|lines| sort_by(lines, &settings)); + sender.send(payload).unwrap(); + } +} + +/// The function that is executed on the reader/writer thread. +/// +/// # Returns +/// * The number of chunks read. +fn reader_writer( + mut files: impl Iterator>, + tmp_dir: &TempDir, + separator: u8, + buffer_size: usize, + settings: GlobalSettings, + receiver: Receiver, + sender: SyncSender, +) -> usize { + let mut sender_option = Some(sender); + + let mut file = files.next().unwrap(); + + let mut carry_over = vec![]; + // kick things off with two reads + for _ in 0..2 { + chunks::read( + &mut sender_option, + vec![0; buffer_size], + &mut carry_over, + &mut file, + &mut files, + separator, + Vec::new(), + &settings, + ) + } + + let mut file_number = 0; + loop { + let mut chunk = match receiver.recv() { + Ok(it) => it, + _ => return file_number, + }; + + write( + &mut chunk, + &tmp_dir.path().join(file_number.to_string()), + separator, + ); + + let (recycled_lines, recycled_buffer) = chunk.recycle(); + + file_number += 1; + + chunks::read( + &mut sender_option, + recycled_buffer, + &mut carry_over, + &mut file, + &mut files, + separator, + recycled_lines, + &settings, + ); + } +} + +/// Write the lines in `chunk` to `file`, separated by `separator`. +fn write(chunk: &mut Chunk, file: &Path, separator: u8) { + chunk.with_lines_mut(|lines| { + // Write the lines to the file + let file = crash_if_err!(1, OpenOptions::new().create(true).write(true).open(file)); + let mut writer = BufWriter::new(file); + for s in lines.iter() { + crash_if_err!(1, writer.write_all(s.line.as_bytes())); + crash_if_err!(1, writer.write_all(&[separator])); + } + }); +} diff --git a/src/uu/sort/src/external_sort/LICENSE b/src/uu/sort/src/external_sort/LICENSE deleted file mode 100644 index e26c89c9f..000000000 --- a/src/uu/sort/src/external_sort/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright 2018 Battelle Memorial Institute - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/src/uu/sort/src/external_sort/mod.rs b/src/uu/sort/src/external_sort/mod.rs deleted file mode 100644 index af6902367..000000000 --- a/src/uu/sort/src/external_sort/mod.rs +++ /dev/null @@ -1,93 +0,0 @@ -use std::fs::OpenOptions; -use std::io::{BufWriter, Write}; -use std::path::Path; - -use tempdir::TempDir; - -use crate::{file_to_lines_iter, FileMerger}; - -use super::{GlobalSettings, Line}; - -/// Iterator that provides sorted `T`s -pub struct ExtSortedIterator<'a> { - file_merger: FileMerger<'a>, - // Keep tmp_dir around, it is deleted when dropped. - _tmp_dir: TempDir, -} - -impl<'a> Iterator for ExtSortedIterator<'a> { - type Item = Line; - fn next(&mut self) -> Option { - self.file_merger.next() - } -} - -/// Sort (based on `compare`) the `T`s provided by `unsorted` and return an -/// iterator -/// -/// # Panics -/// -/// This method can panic due to issues writing intermediate sorted chunks -/// to disk. -pub fn ext_sort( - unsorted: impl Iterator, - settings: &GlobalSettings, -) -> ExtSortedIterator { - let tmp_dir = crash_if_err!(1, TempDir::new_in(&settings.tmp_dir, "uutils_sort")); - - let mut total_read = 0; - let mut chunk = Vec::new(); - - let mut chunks_read = 0; - let mut file_merger = FileMerger::new(settings); - - // make the initial chunks on disk - for seq in unsorted { - let seq_size = seq.estimate_size(); - total_read += seq_size; - - chunk.push(seq); - - if total_read >= settings.buffer_size && chunk.len() >= 2 { - super::sort_by(&mut chunk, &settings); - - let file_path = tmp_dir.path().join(chunks_read.to_string()); - write_chunk(settings, &file_path, &mut chunk); - chunk.clear(); - total_read = 0; - chunks_read += 1; - - file_merger.push_file(Box::new(file_to_lines_iter(file_path, settings).unwrap())) - } - } - // write the last chunk - if !chunk.is_empty() { - super::sort_by(&mut chunk, &settings); - - let file_path = tmp_dir.path().join(chunks_read.to_string()); - write_chunk( - settings, - &tmp_dir.path().join(chunks_read.to_string()), - &mut chunk, - ); - - file_merger.push_file(Box::new(file_to_lines_iter(file_path, settings).unwrap())); - } - ExtSortedIterator { - file_merger, - _tmp_dir: tmp_dir, - } -} - -fn write_chunk(settings: &GlobalSettings, file: &Path, chunk: &mut Vec) { - let new_file = crash_if_err!(1, OpenOptions::new().create(true).append(true).open(file)); - let mut buf_write = BufWriter::new(new_file); - for s in chunk { - crash_if_err!(1, buf_write.write_all(s.line.as_bytes())); - crash_if_err!( - 1, - buf_write.write_all(if settings.zero_terminated { "\0" } else { "\n" }.as_bytes(),) - ); - } - crash_if_err!(1, buf_write.flush()); -} diff --git a/src/uu/sort/src/merge.rs b/src/uu/sort/src/merge.rs new file mode 100644 index 000000000..6f7cdfed7 --- /dev/null +++ b/src/uu/sort/src/merge.rs @@ -0,0 +1,223 @@ +//! Merge already sorted files. +//! +//! We achieve performance by splitting the tasks of sorting and writing, and reading and parsing between two threads. +//! The threads communicate over channels. There's one channel per file in the direction reader -> sorter, but only +//! one channel from the sorter back to the reader. The channels to the sorter are used to send the read chunks. +//! The sorter reads the next chunk from the channel whenever it needs the next chunk after running out of lines +//! from the previous read of the file. The channel back from the sorter to the reader has two purposes: To allow the reader +//! to reuse memory allocations and to tell the reader which file to read from next. + +use std::{ + cmp::Ordering, + ffi::OsStr, + io::{Read, Write}, + iter, + rc::Rc, + sync::mpsc::{channel, sync_channel, Receiver, Sender, SyncSender}, + thread, +}; + +use compare::Compare; + +use crate::{ + chunks::{self, Chunk}, + compare_by, open, GlobalSettings, +}; + +// Merge already sorted files. +pub fn merge<'a>(files: &[impl AsRef], settings: &'a GlobalSettings) -> FileMerger<'a> { + let (request_sender, request_receiver) = channel(); + let mut reader_files = Vec::with_capacity(files.len()); + let mut loaded_receivers = Vec::with_capacity(files.len()); + for (file_number, file) in files.iter().filter_map(open).enumerate() { + let (sender, receiver) = sync_channel(2); + loaded_receivers.push(receiver); + reader_files.push(ReaderFile { + file, + sender: Some(sender), + carry_over: vec![], + }); + request_sender + .send((file_number, Chunk::new(vec![0; 8 * 1024], |_| Vec::new()))) + .unwrap(); + } + + for file_number in 0..reader_files.len() { + request_sender + .send((file_number, Chunk::new(vec![0; 8 * 1024], |_| Vec::new()))) + .unwrap(); + } + + thread::spawn({ + let settings = settings.clone(); + move || { + reader( + request_receiver, + &mut reader_files, + &settings, + if settings.zero_terminated { + b'\0' + } else { + b'\n' + }, + ) + } + }); + + let mut mergeable_files = vec![]; + + for (file_number, receiver) in loaded_receivers.into_iter().enumerate() { + mergeable_files.push(MergeableFile { + current_chunk: Rc::new(receiver.recv().unwrap()), + file_number, + line_idx: 0, + receiver, + }) + } + + FileMerger { + heap: binary_heap_plus::BinaryHeap::from_vec_cmp( + mergeable_files, + FileComparator { settings }, + ), + request_sender, + prev: None, + } +} +/// The struct on the reader thread representing an input file +struct ReaderFile { + file: Box, + sender: Option>, + carry_over: Vec, +} + +/// The function running on the reader thread. +fn reader( + recycled_receiver: Receiver<(usize, Chunk)>, + files: &mut [ReaderFile], + settings: &GlobalSettings, + separator: u8, +) { + for (file_idx, chunk) in recycled_receiver.iter() { + let (recycled_lines, recycled_buffer) = chunk.recycle(); + let ReaderFile { + file, + sender, + carry_over, + } = &mut files[file_idx]; + chunks::read( + sender, + recycled_buffer, + carry_over, + file, + &mut iter::empty(), + separator, + recycled_lines, + settings, + ); + } +} +/// The struct on the main thread representing an input file +pub struct MergeableFile { + current_chunk: Rc, + line_idx: usize, + receiver: Receiver, + file_number: usize, +} + +/// A struct to keep track of the previous line we encountered. +/// +/// This is required for deduplication purposes. +struct PreviousLine { + chunk: Rc, + line_idx: usize, + file_number: usize, +} + +/// Merges files together. This is **not** an iterator because of lifetime problems. +pub struct FileMerger<'a> { + heap: binary_heap_plus::BinaryHeap>, + request_sender: Sender<(usize, Chunk)>, + prev: Option, +} + +impl<'a> FileMerger<'a> { + /// Write the merged contents to the output file. + pub fn write_all(&mut self, settings: &GlobalSettings) { + let mut out = settings.out_writer(); + while self.write_next(settings, &mut out) {} + } + + fn write_next(&mut self, settings: &GlobalSettings, out: &mut impl Write) -> bool { + if let Some(file) = self.heap.peek() { + let prev = self.prev.replace(PreviousLine { + chunk: file.current_chunk.clone(), + line_idx: file.line_idx, + file_number: file.file_number, + }); + + file.current_chunk.with_lines(|lines| { + let current_line = &lines[file.line_idx]; + if settings.unique { + if let Some(prev) = &prev { + let cmp = compare_by( + &prev.chunk.borrow_lines()[prev.line_idx], + current_line, + settings, + ); + if cmp == Ordering::Equal { + return; + } + } + } + current_line.print(out, settings); + }); + + let was_last_line_for_file = + file.current_chunk.borrow_lines().len() == file.line_idx + 1; + + if was_last_line_for_file { + if let Ok(next_chunk) = file.receiver.recv() { + let mut file = self.heap.peek_mut().unwrap(); + file.current_chunk = Rc::new(next_chunk); + file.line_idx = 0; + } else { + self.heap.pop(); + } + } else { + self.heap.peek_mut().unwrap().line_idx += 1; + } + + if let Some(prev) = prev { + if let Ok(prev_chunk) = Rc::try_unwrap(prev.chunk) { + self.request_sender + .send((prev.file_number, prev_chunk)) + .ok(); + } + } + } + !self.heap.is_empty() + } +} + +/// Compares files by their current line. +struct FileComparator<'a> { + settings: &'a GlobalSettings, +} + +impl<'a> Compare for FileComparator<'a> { + fn compare(&self, a: &MergeableFile, b: &MergeableFile) -> Ordering { + let mut cmp = compare_by( + &a.current_chunk.borrow_lines()[a.line_idx], + &b.current_chunk.borrow_lines()[b.line_idx], + self.settings, + ); + if cmp == Ordering::Equal { + // To make sorting stable, we need to consider the file number as well, + // as lines from a file with a lower number are to be considered "earlier". + cmp = a.file_number.cmp(&b.file_number); + } + // Our BinaryHeap is a max heap. We use it as a min heap, so we need to reverse the ordering. + cmp.reverse() + } +} diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 2697d7df4..b6ab5a2b1 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -15,13 +15,16 @@ #[macro_use] extern crate uucore; +mod check; +mod chunks; mod custom_str_cmp; -mod external_sort; +mod ext_sort; +mod merge; mod numeric_str_cmp; use clap::{App, Arg}; use custom_str_cmp::custom_str_cmp; -use external_sort::ext_sort; +use ext_sort::ext_sort; use fnv::FnvHasher; use itertools::Itertools; use numeric_str_cmp::{numeric_str_cmp, NumInfo, NumInfoParseSettings}; @@ -30,18 +33,15 @@ use rand::{thread_rng, Rng}; use rayon::prelude::*; use semver::Version; use std::cmp::Ordering; -use std::collections::BinaryHeap; use std::env; use std::ffi::OsStr; use std::fs::File; use std::hash::{Hash, Hasher}; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; -use std::mem::replace; use std::ops::Range; use std::path::Path; use std::path::PathBuf; use unicode_width::UnicodeWidthStr; -use uucore::fs::is_stdin_interactive; // for Iterator::dedup() use uucore::InvalidEncodingHandling; static NAME: &str = "sort"; @@ -150,6 +150,19 @@ impl GlobalSettings { }; num_usize * suf_usize } + + fn out_writer(&self) -> BufWriter> { + match self.outfile { + Some(ref filename) => match File::create(Path::new(&filename)) { + Ok(f) => BufWriter::new(Box::new(f) as Box), + Err(e) => { + show_error!("{0}: {1}", filename, e.to_string()); + panic!("Could not open output file"); + } + }, + None => BufWriter::new(Box::new(stdout()) as Box), + } + } } impl Default for GlobalSettings { @@ -205,29 +218,7 @@ impl From<&GlobalSettings> for KeySettings { } } -#[derive(Debug, Clone)] -/// Represents the string selected by a FieldSelector. -struct SelectionRange { - range: Range, -} - -impl SelectionRange { - fn new(range: Range) -> Self { - Self { range } - } - - /// Gets the actual string slice represented by this Selection. - fn get_str<'a>(&self, line: &'a str) -> &'a str { - &line[self.range.to_owned()] - } - - fn shorten(&mut self, new_range: Range) { - self.range.end = self.range.start + new_range.end; - self.range.start += new_range.start; - } -} - -#[derive(Clone)] +#[derive(Clone, Debug)] enum NumCache { AsF64(GeneralF64ParseResult), WithInfo(NumInfo), @@ -248,64 +239,53 @@ impl NumCache { } } -#[derive(Clone)] -struct Selection { - range: SelectionRange, +#[derive(Clone, Debug)] +struct Selection<'a> { + slice: &'a str, num_cache: Option>, } -impl Selection { - /// Gets the actual string slice represented by this Selection. - fn get_str<'a>(&'a self, line: &'a Line) -> &'a str { - self.range.get_str(&line.line) - } -} - type Field = Range; -#[derive(Clone)] -pub struct Line { - line: Box, - // The common case is not to specify fields. Let's make this fast. - first_selection: Selection, - other_selections: Box<[Selection]>, +#[derive(Clone, Debug)] +pub struct Line<'a> { + line: &'a str, + selections: Box<[Selection<'a>]>, } -impl Line { - /// Estimate the number of bytes that this Line is occupying - pub fn estimate_size(&self) -> usize { - self.line.len() - + self.other_selections.len() * std::mem::size_of::() - + std::mem::size_of::() - } - - pub fn new(line: String, settings: &GlobalSettings) -> Self { +impl<'a> Line<'a> { + fn create(string: &'a str, settings: &GlobalSettings) -> Self { let fields = if settings .selectors .iter() - .any(|selector| selector.needs_tokens()) + .any(|selector| selector.needs_tokens) { // Only tokenize if we will need tokens. - Some(tokenize(&line, settings.separator)) + Some(tokenize(string, settings.separator)) } else { None }; - let mut selectors = settings.selectors.iter(); + Line { + line: string, + selections: settings + .selectors + .iter() + .filter(|selector| !selector.is_default_selection) + .map(|selector| selector.get_selection(string, fields.as_deref())) + .collect(), + } + } - let first_selection = selectors - .next() - .unwrap() - .get_selection(&line, fields.as_deref()); - - let other_selections: Vec = selectors - .map(|selector| selector.get_selection(&line, fields.as_deref())) - .collect(); - - Self { - line: line.into_boxed_str(), - first_selection, - other_selections: other_selections.into_boxed_slice(), + fn print(&self, writer: &mut impl Write, settings: &GlobalSettings) { + if settings.zero_terminated && !settings.debug { + crash_if_err!(1, writer.write_all(self.line.as_bytes())); + crash_if_err!(1, writer.write_all("\0".as_bytes())); + } else if !settings.debug { + crash_if_err!(1, writer.write_all(self.line.as_bytes())); + crash_if_err!(1, writer.write_all("\n".as_bytes())); + } else { + crash_if_err!(1, self.print_debug(settings, writer)); } } @@ -314,7 +294,7 @@ impl Line { fn print_debug( &self, settings: &GlobalSettings, - writer: &mut dyn Write, + writer: &mut impl Write, ) -> std::io::Result<()> { // We do not consider this function performance critical, as debug output is only useful for small files, // which are not a performance problem in any case. Therefore there aren't any special performance @@ -575,23 +555,39 @@ struct FieldSelector { from: KeyPosition, to: Option, settings: KeySettings, + needs_tokens: bool, + // Whether the selection for each line is going to be the whole line with no NumCache + is_default_selection: bool, } impl FieldSelector { - fn needs_tokens(&self) -> bool { - self.from.field != 1 || self.from.char == 0 || self.to.is_some() + fn new(from: KeyPosition, to: Option, settings: KeySettings) -> Self { + Self { + is_default_selection: from.field == 1 + && from.char == 1 + && to.is_none() + // TODO: Once our MinRustV is 1.42 or higher, change this to the matches! macro + && match settings.mode { + SortMode::Numeric | SortMode::GeneralNumeric | SortMode::HumanNumeric => false, + _ => true, + }, + needs_tokens: from.field != 1 || from.char == 0 || to.is_some(), + from, + to, + settings, + } } /// Get the selection that corresponds to this selector for the line. /// If needs_fields returned false, tokens may be None. - fn get_selection(&self, line: &str, tokens: Option<&[Field]>) -> Selection { - let mut range = SelectionRange::new(self.get_range(&line, tokens)); + fn get_selection<'a>(&self, line: &'a str, tokens: Option<&[Field]>) -> Selection<'a> { + let mut range = &line[self.get_range(&line, tokens)]; let num_cache = if self.settings.mode == SortMode::Numeric || self.settings.mode == SortMode::HumanNumeric { // Parse NumInfo for this number. let (info, num_range) = NumInfo::parse( - range.get_str(&line), + range, NumInfoParseSettings { accept_si_units: self.settings.mode == SortMode::HumanNumeric, thousands_separator: Some(THOUSANDS_SEP), @@ -599,19 +595,21 @@ impl FieldSelector { }, ); // Shorten the range to what we need to pass to numeric_str_cmp later. - range.shorten(num_range); + range = &range[num_range]; Some(Box::new(NumCache::WithInfo(info))) } else if self.settings.mode == SortMode::GeneralNumeric { // Parse this number as f64, as this is the requirement for general numeric sorting. - let str = range.get_str(&line); Some(Box::new(NumCache::AsF64(general_f64_parse( - &str[get_leading_gen(str)], + &range[get_leading_gen(range)], )))) } else { // This is not a numeric sort, so we don't need a NumCache. None }; - Selection { range, num_cache } + Selection { + slice: range, + num_cache, + } } /// Look up the range in the line that corresponds to this selector. @@ -701,91 +699,6 @@ impl FieldSelector { } } -struct MergeableFile<'a> { - lines: Box + 'a>, - current_line: Line, - settings: &'a GlobalSettings, - file_index: usize, -} - -// BinaryHeap depends on `Ord`. Note that we want to pop smallest items -// from the heap first, and BinaryHeap.pop() returns the largest, so we -// trick it into the right order by calling reverse() here. -impl<'a> Ord for MergeableFile<'a> { - fn cmp(&self, other: &MergeableFile) -> Ordering { - let comparison = compare_by(&self.current_line, &other.current_line, self.settings); - if comparison == Ordering::Equal { - // If lines are equal, the earlier file takes precedence. - self.file_index.cmp(&other.file_index) - } else { - comparison - } - .reverse() - } -} - -impl<'a> PartialOrd for MergeableFile<'a> { - fn partial_cmp(&self, other: &MergeableFile) -> Option { - Some(self.cmp(other)) - } -} - -impl<'a> PartialEq for MergeableFile<'a> { - fn eq(&self, other: &MergeableFile) -> bool { - Ordering::Equal == self.cmp(other) - } -} - -impl<'a> Eq for MergeableFile<'a> {} - -struct FileMerger<'a> { - heap: BinaryHeap>, - settings: &'a GlobalSettings, -} - -impl<'a> FileMerger<'a> { - fn new(settings: &'a GlobalSettings) -> FileMerger<'a> { - FileMerger { - heap: BinaryHeap::new(), - settings, - } - } - fn push_file(&mut self, mut lines: Box + 'a>) { - if let Some(next_line) = lines.next() { - let mergeable_file = MergeableFile { - lines, - current_line: next_line, - settings: &self.settings, - file_index: self.heap.len(), - }; - self.heap.push(mergeable_file); - } - } -} - -impl<'a> Iterator for FileMerger<'a> { - type Item = Line; - fn next(&mut self) -> Option { - match self.heap.pop() { - Some(mut current) => { - match current.lines.next() { - Some(next_line) => { - let ret = replace(&mut current.current_line, next_line); - self.heap.push(current); - Some(ret) - } - _ => { - // Don't put it back in the heap (it's empty/erroring) - // but its first line is still valid. - Some(current.current_line) - } - } - } - None => None, - } - } -} - fn get_usage() -> String { format!( "{0} {1} @@ -985,7 +898,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let mut files = Vec::new(); for path in &files0_from { - let (reader, _) = open(path.as_str()).expect("Could not read from file specified."); + let reader = open(path.as_str()).expect("Could not read from file specified."); let buf_reader = BufReader::new(reader); for line in buf_reader.split(b'\0').flatten() { files.push( @@ -1112,11 +1025,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let to = from_to .next() .map(|to| KeyPosition::parse(to, 0, &mut key_settings)); - let field_selector = FieldSelector { - from, - to, - settings: key_settings, - }; + let field_selector = FieldSelector::new(from, to, key_settings); settings.selectors.push(field_selector); } } @@ -1124,48 +1033,21 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if !settings.stable || !matches.is_present(OPT_KEY) { // add a default selector matching the whole line let key_settings = KeySettings::from(&settings); - settings.selectors.push(FieldSelector { - from: KeyPosition { + settings.selectors.push(FieldSelector::new( + KeyPosition { field: 1, char: 1, ignore_blanks: key_settings.ignore_blanks, }, - to: None, - settings: key_settings, - }); + None, + key_settings, + )); } - exec(files, settings) + exec(&files, &settings) } -fn file_to_lines_iter( - file: impl AsRef, - settings: &'_ GlobalSettings, -) -> Option + '_> { - let (reader, _) = match open(file) { - Some(x) => x, - None => return None, - }; - - let buf_reader = BufReader::new(reader); - - Some( - buf_reader - .split(if settings.zero_terminated { - b'\0' - } else { - b'\n' - }) - .map(move |line| { - Line::new( - crash_if_err!(1, String::from_utf8(crash_if_err!(1, line))), - settings, - ) - }), - ) -} - -fn output_sorted_lines(iter: impl Iterator, settings: &GlobalSettings) { +fn output_sorted_lines<'a>(iter: impl Iterator>, settings: &GlobalSettings) { if settings.unique { print_sorted( iter.dedup_by(|a, b| compare_by(a, b, &settings) == Ordering::Equal), @@ -1176,87 +1058,48 @@ fn output_sorted_lines(iter: impl Iterator, settings: &GlobalSettin } } -fn exec(files: Vec, settings: GlobalSettings) -> i32 { +fn exec(files: &[String], settings: &GlobalSettings) -> i32 { if settings.merge { - let mut file_merger = FileMerger::new(&settings); - for lines in files - .iter() - .filter_map(|file| file_to_lines_iter(file, &settings)) - { - file_merger.push_file(Box::new(lines)); + let mut file_merger = merge::merge(files, settings); + file_merger.write_all(settings); + } else if settings.check { + if files.len() > 1 { + crash!(1, "only one file allowed with -c"); } - output_sorted_lines(file_merger, &settings); + return check::check(files.first().unwrap(), settings); + } else if settings.ext_sort { + let mut lines = files.iter().filter_map(open); + + let mut sorted = ext_sort(&mut lines, &settings); + sorted.file_merger.write_all(settings); } else { - let lines = files - .iter() - .filter_map(|file| file_to_lines_iter(file, &settings)) - .flatten(); + let separator = if settings.zero_terminated { '\0' } else { '\n' }; + let mut lines = vec![]; + let mut full_string = String::new(); - if settings.check { - return exec_check_file(lines, &settings); - } + for mut file in files.iter().filter_map(open) { + crash_if_err!(1, file.read_to_string(&mut full_string)); - // Only use ext_sorter when we need to. - // Probably faster that we don't create - // an owned value each run - if settings.ext_sort { - let sorted_lines = ext_sort(lines, &settings); - output_sorted_lines(sorted_lines, &settings); - } else { - let mut lines = vec![]; - - // This is duplicated from fn file_to_lines_iter, but using that function directly results in a performance regression. - for (file, _) in files.iter().map(open).flatten() { - let buf_reader = BufReader::new(file); - for line in buf_reader.split(if settings.zero_terminated { - b'\0' - } else { - b'\n' - }) { - let string = crash_if_err!(1, String::from_utf8(crash_if_err!(1, line))); - lines.push(Line::new(string, &settings)); - } + if !full_string.ends_with(separator) { + full_string.push(separator); } - - sort_by(&mut lines, &settings); - output_sorted_lines(lines.into_iter(), &settings); } - } + if full_string.ends_with(separator) { + full_string.pop(); + } + + for line in full_string.split(if settings.zero_terminated { '\0' } else { '\n' }) { + lines.push(Line::create(line, &settings)); + } + + sort_by(&mut lines, &settings); + output_sorted_lines(lines.into_iter(), &settings); + } 0 } -fn exec_check_file(unwrapped_lines: impl Iterator, settings: &GlobalSettings) -> i32 { - // errors yields the line before each disorder, - // plus the last line (quirk of .coalesce()) - let mut errors = unwrapped_lines - .enumerate() - .coalesce(|(last_i, last_line), (i, line)| { - if compare_by(&last_line, &line, &settings) == Ordering::Greater { - Err(((last_i, last_line), (i, line))) - } else { - Ok((i, line)) - } - }); - if let Some((first_error_index, _line)) = errors.next() { - // Check for a second "error", as .coalesce() always returns the last - // line, no matter what our merging function does. - if let Some(_last_line_or_next_error) = errors.next() { - if !settings.check_silent { - println!("sort: disorder in line {}", first_error_index); - }; - 1 - } else { - // first "error" was actually the last line. - 0 - } - } else { - // unwrapped_lines was empty. Empty files are defined to be sorted. - 0 - } -} - -fn sort_by(unsorted: &mut Vec, settings: &GlobalSettings) { +fn sort_by<'a>(unsorted: &mut Vec>, settings: &GlobalSettings) { if settings.stable || settings.unique { unsorted.par_sort_by(|a, b| compare_by(a, b, &settings)) } else { @@ -1264,19 +1107,39 @@ fn sort_by(unsorted: &mut Vec, settings: &GlobalSettings) { } } -fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering { - for (idx, selector) in global_settings.selectors.iter().enumerate() { - let (a_selection, b_selection) = if idx == 0 { - (&a.first_selection, &b.first_selection) +fn compare_by<'a>(a: &Line<'a>, b: &Line<'a>, global_settings: &GlobalSettings) -> Ordering { + let mut idx = 0; + for selector in &global_settings.selectors { + let mut _selections = None; + let (a_selection, b_selection) = if selector.is_default_selection { + // We can select the whole line. + // We have to store the selections outside of the if-block so that they live long enough. + _selections = Some(( + Selection { + slice: a.line, + num_cache: None, + }, + Selection { + slice: b.line, + num_cache: None, + }, + )); + // Unwrap the selections again, and return references to them. + ( + &_selections.as_ref().unwrap().0, + &_selections.as_ref().unwrap().1, + ) } else { - (&a.other_selections[idx - 1], &b.other_selections[idx - 1]) + let selections = (&a.selections[idx], &b.selections[idx]); + idx += 1; + selections }; - let a_str = a_selection.get_str(a); - let b_str = b_selection.get_str(b); + let a_str = a_selection.slice; + let b_str = b_selection.slice; let settings = &selector.settings; let cmp: Ordering = if settings.random { - random_shuffle(a_str, b_str, global_settings.salt.clone()) + random_shuffle(a_str, b_str, &global_settings.salt) } else { match settings.mode { SortMode::Numeric | SortMode::HumanNumeric => numeric_str_cmp( @@ -1307,7 +1170,7 @@ fn compare_by(a: &Line, b: &Line, global_settings: &GlobalSettings) -> Ordering let cmp = if global_settings.random || global_settings.stable || global_settings.unique { Ordering::Equal } else { - a.line.cmp(&b.line) + a.line.cmp(b.line) }; if global_settings.reverse { @@ -1362,7 +1225,7 @@ fn get_leading_gen(input: &str) -> Range { leading_whitespace_len..input.len() } -#[derive(Copy, Clone, PartialEq, PartialOrd)] +#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)] enum GeneralF64ParseResult { Invalid, NaN, @@ -1408,12 +1271,11 @@ fn get_hash(t: &T) -> u64 { s.finish() } -fn random_shuffle(a: &str, b: &str, x: String) -> Ordering { +fn random_shuffle(a: &str, b: &str, salt: &str) -> Ordering { #![allow(clippy::comparison_chain)] - let salt_slice = x.as_str(); - let da = get_hash(&[a, salt_slice].concat()); - let db = get_hash(&[b, salt_slice].concat()); + let da = get_hash(&[a, salt].concat()); + let db = get_hash(&[b, salt].concat()); da.cmp(&db) } @@ -1504,45 +1366,23 @@ fn version_compare(a: &str, b: &str) -> Ordering { } } -fn print_sorted>(iter: T, settings: &GlobalSettings) { - let mut file: Box = match settings.outfile { - Some(ref filename) => match File::create(Path::new(&filename)) { - Ok(f) => Box::new(BufWriter::new(f)) as Box, - Err(e) => { - show_error!("{0}: {1}", filename, e.to_string()); - panic!("Could not open output file"); - } - }, - None => Box::new(BufWriter::new(stdout())) as Box, - }; - if settings.zero_terminated && !settings.debug { - for line in iter { - crash_if_err!(1, file.write_all(line.line.as_bytes())); - crash_if_err!(1, file.write_all("\0".as_bytes())); - } - } else { - for line in iter { - if !settings.debug { - crash_if_err!(1, file.write_all(line.line.as_bytes())); - crash_if_err!(1, file.write_all("\n".as_bytes())); - } else { - crash_if_err!(1, line.print_debug(settings, &mut file)); - } - } +fn print_sorted<'a, T: Iterator>>(iter: T, settings: &GlobalSettings) { + let mut writer = settings.out_writer(); + for line in iter { + line.print(&mut writer, settings); } - crash_if_err!(1, file.flush()); } // from cat.rs -fn open(path: impl AsRef) -> Option<(Box, bool)> { +fn open(path: impl AsRef) -> Option> { let path = path.as_ref(); if path == "-" { let stdin = stdin(); - return Some((Box::new(stdin) as Box, is_stdin_interactive())); + return Some(Box::new(stdin) as Box); } match File::open(Path::new(path)) { - Ok(f) => Some((Box::new(f) as Box, false)), + Ok(f) => Some(Box::new(f) as Box), Err(e) => { show_error!("{0:?}: {1}", path, e.to_string()); None @@ -1568,7 +1408,7 @@ mod tests { let b = "Ted"; let c = get_rand_string(); - assert_eq!(Ordering::Equal, random_shuffle(a, b, c)); + assert_eq!(Ordering::Equal, random_shuffle(a, b, &c)); } #[test] @@ -1592,7 +1432,7 @@ mod tests { let b = "9"; let c = get_rand_string(); - assert_eq!(Ordering::Equal, random_shuffle(a, b, c)); + assert_eq!(Ordering::Equal, random_shuffle(a, b, &c)); } #[test] @@ -1631,10 +1471,12 @@ mod tests { fn test_line_size() { // We should make sure to not regress the size of the Line struct because // it is unconditional overhead for every line we sort. - assert_eq!(std::mem::size_of::(), 56); + assert_eq!(std::mem::size_of::(), 32); // These are the fields of Line: - assert_eq!(std::mem::size_of::>(), 16); - assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::<&str>(), 16); assert_eq!(std::mem::size_of::>(), 16); + + // How big is a selection? Constant cost all lines pay when we need selections. + assert_eq!(std::mem::size_of::(), 24); } } diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index bad9d577e..e89d18054 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -122,7 +122,7 @@ fn test_check_zero_terminated_failure() { .arg("-c") .arg("zero-terminated.txt") .fails() - .stdout_is("sort: disorder in line 0\n"); + .stdout_is("sort: zero-terminated.txt:2: disorder: ../../fixtures/du\n"); } #[test] @@ -621,7 +621,7 @@ fn test_check() { .arg("-c") .arg("check_fail.txt") .fails() - .stdout_is("sort: disorder in line 4\n"); + .stdout_is("sort: check_fail.txt:6: disorder: 5\n"); new_ucmd!() .arg("-c") From 2f84f59573128927b5f8ffd9cad6a09ef895ffad Mon Sep 17 00:00:00 2001 From: Chad Brewbaker Date: Sun, 16 May 2021 19:43:53 -0500 Subject: [PATCH 0602/1135] fixing regex to take negative time offsets --- tests/by-util/test_ls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 0985ba719..a57525e4b 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -685,7 +685,7 @@ fn test_ls_styles() { at.touch("test"); let re_full = Regex::new( - r"[a-z-]* \d* \w* \w* \d* \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d* \+\d{4} test\n", + r"[a-z-]* \d* \w* \w* \d* \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d* (\+|\-)\d{4} test\n", ) .unwrap(); let re_long = From eeef8290df9e5ea24eb8ca4ae5fb3e0fc40576b3 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Sun, 16 May 2021 21:21:20 -0400 Subject: [PATCH 0603/1135] head: display errors for each input file Change the behavior of `head` to display an error for each problematic file, instead of displaying an error message for the first problematic file and terminating immediately at that point. This change now matches the behavior of GNU `head`. Before this commit, the first error caused the program to terminate immediately: $ head a b c head: error: head: cannot open 'a' for reading: No such file or directory After this commit: $ head a b c head: cannot open 'a' for reading: No such file or directory head: cannot open 'b' for reading: No such file or directory head: cannot open 'c' for reading: No such file or directory --- src/uu/head/src/head.rs | 73 ++++++++++++++++++-------------------- tests/by-util/test_head.rs | 12 +++++++ tests/common/util.rs | 7 +++- 3 files changed, 52 insertions(+), 40 deletions(-) diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index faaeedd3f..0c8b3bc88 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -2,7 +2,7 @@ use clap::{App, Arg}; use std::convert::TryFrom; use std::ffi::OsString; use std::io::{self, ErrorKind, Read, Seek, SeekFrom, Write}; -use uucore::{crash, executable, show_error}; +use uucore::{crash, executable, show_error, show_error_custom_description}; const EXIT_FAILURE: i32 = 1; const EXIT_SUCCESS: i32 = 0; @@ -400,7 +400,8 @@ fn head_file(input: &mut std::fs::File, options: &HeadOptions) -> std::io::Resul } } -fn uu_head(options: &HeadOptions) { +fn uu_head(options: &HeadOptions) -> Result<(), u32> { + let mut error_count = 0; let mut first = true; for fname in &options.files { let res = match fname.as_str() { @@ -433,30 +434,22 @@ fn uu_head(options: &HeadOptions) { name => { let mut file = match std::fs::File::open(name) { Ok(f) => f, - Err(err) => match err.kind() { - ErrorKind::NotFound => { - crash!( - EXIT_FAILURE, - "head: cannot open '{}' for reading: No such file or directory", - name - ); + Err(err) => { + let prefix = format!("cannot open '{}' for reading", name); + match err.kind() { + ErrorKind::NotFound => { + show_error_custom_description!(prefix, "No such file or directory"); + } + ErrorKind::PermissionDenied => { + show_error_custom_description!(prefix, "Permission denied"); + } + _ => { + show_error_custom_description!(prefix, "{}", err); + } } - ErrorKind::PermissionDenied => { - crash!( - EXIT_FAILURE, - "head: cannot open '{}' for reading: Permission denied", - name - ); - } - _ => { - crash!( - EXIT_FAILURE, - "head: cannot open '{}' for reading: {}", - name, - err - ); - } - }, + error_count += 1; + continue; + } }; if (options.files.len() > 1 && !options.quiet) || options.verbose { if !first { @@ -468,21 +461,22 @@ fn uu_head(options: &HeadOptions) { } }; if res.is_err() { - if fname.as_str() == "-" { - crash!( - EXIT_FAILURE, - "head: error reading standard input: Input/output error" - ); + let name = if fname.as_str() == "-" { + "standard input" } else { - crash!( - EXIT_FAILURE, - "head: error reading {}: Input/output error", - fname - ); - } + fname + }; + let prefix = format!("error reading {}", name); + show_error_custom_description!(prefix, "Input/output error"); + error_count += 1; } first = false; } + if error_count > 0 { + Err(error_count) + } else { + Ok(()) + } } pub fn uumain(args: impl uucore::Args) -> i32 { @@ -492,9 +486,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { crash!(EXIT_FAILURE, "head: {}", s); } }; - uu_head(&args); - - EXIT_SUCCESS + match uu_head(&args) { + Ok(_) => EXIT_SUCCESS, + Err(_) => EXIT_FAILURE, + } } #[cfg(test)] diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index 2aedbdcbe..88df1f068 100755 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -162,6 +162,18 @@ fn test_no_such_file_or_directory() { .stderr_contains("cannot open 'no_such_file.toml' for reading: No such file or directory"); } +/// Test that each non-existent files gets its own error message printed. +#[test] +fn test_multiple_nonexistent_files() { + new_ucmd!() + .args(&["bogusfile1", "bogusfile2"]) + .fails() + .stdout_does_not_contain("==> bogusfile1 <==") + .stderr_contains("cannot open 'bogusfile1' for reading: No such file or directory") + .stdout_does_not_contain("==> bogusfile2 <==") + .stderr_contains("cannot open 'bogusfile2' for reading: No such file or directory"); +} + // there was a bug not caught by previous tests // where for negative n > 3, the total amount of lines // was correct, but it would eat from the second line diff --git a/tests/common/util.rs b/tests/common/util.rs index 719849afc..611baadd4 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -315,7 +315,12 @@ impl CmdResult { } pub fn stdout_does_not_contain>(&self, cmp: T) -> &CmdResult { - assert!(!self.stdout_str().contains(cmp.as_ref())); + assert!( + !self.stdout_str().contains(cmp.as_ref()), + "'{}' contains '{}' but should not", + self.stdout_str(), + cmp.as_ref(), + ); self } From c68c83c6ddc8b629d178b47ba6d7a6f987f54817 Mon Sep 17 00:00:00 2001 From: nicoo Date: Thu, 29 Apr 2021 13:50:31 +0200 Subject: [PATCH 0604/1135] factor::table: Take mutable refs This will be easier to adapt to working with multiple numbers to process at once. --- src/uu/factor/src/factor.rs | 2 +- src/uu/factor/src/table.rs | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index ebe06a1c5..f53abd772 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -161,7 +161,7 @@ pub fn factor(mut n: u64) -> Factors { return factors; } - let (factors, n) = table::factor(n, factors); + table::factor(&mut n, &mut factors); #[allow(clippy::let_and_return)] let r = if n < (1 << 32) { diff --git a/src/uu/factor/src/table.rs b/src/uu/factor/src/table.rs index 94ad6df4c..cbd4af5e4 100644 --- a/src/uu/factor/src/table.rs +++ b/src/uu/factor/src/table.rs @@ -8,15 +8,13 @@ // spell-checker: ignore (ToDO) INVS -use std::num::Wrapping; - use crate::Factors; include!(concat!(env!("OUT_DIR"), "/prime_table.rs")); -pub(crate) fn factor(mut num: u64, mut factors: Factors) -> (Factors, u64) { +pub(crate) fn factor(num: &mut u64, factors: &mut Factors) { for &(prime, inv, ceil) in P_INVS_U64 { - if num == 1 { + if *num == 1 { break; } @@ -27,11 +25,11 @@ pub(crate) fn factor(mut num: u64, mut factors: Factors) -> (Factors, u64) { // for a nice explanation. let mut k = 0; loop { - let Wrapping(x) = Wrapping(num) * Wrapping(inv); + let x = num.wrapping_mul(inv); // While prime divides num if x <= ceil { - num = x; + *num = x; k += 1; #[cfg(feature = "coz")] coz::progress!("factor found"); @@ -43,6 +41,4 @@ pub(crate) fn factor(mut num: u64, mut factors: Factors) -> (Factors, u64) { } } } - - (factors, num) } From cd047425aaefbf9ea4bb059651dffddbcbace251 Mon Sep 17 00:00:00 2001 From: nicoo Date: Thu, 29 Apr 2021 14:15:40 +0200 Subject: [PATCH 0605/1135] factor::table: Add chunked implementation and microbenchmarks The factor_chunk implementation is a strawman, but getting it in place allows us to set up the microbenchmarking etc. --- src/uu/factor/Cargo.toml | 5 ++++ src/uu/factor/benches/table.rs | 44 ++++++++++++++++++++++++++++++++++ src/uu/factor/src/cli.rs | 4 ++-- src/uu/factor/src/table.rs | 9 ++++++- 4 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 src/uu/factor/benches/table.rs diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index c4e7e8469..cb77c5d19 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -23,6 +23,7 @@ uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [dev-dependencies] +array-init = "2.0.0" criterion = "0.3" paste = "0.1.18" quickcheck = "0.9.2" @@ -32,6 +33,10 @@ rand_chacha = "0.2.2" name = "gcd" harness = false +[[bench]] +name = "table" +harness = false + [[bin]] name = "factor" path = "src/main.rs" diff --git a/src/uu/factor/benches/table.rs b/src/uu/factor/benches/table.rs new file mode 100644 index 000000000..8fae7cef6 --- /dev/null +++ b/src/uu/factor/benches/table.rs @@ -0,0 +1,44 @@ +use array_init::array_init; +use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; +use uu_factor::{table::*, Factors}; + +fn table(c: &mut Criterion) { + let inputs = { + // Deterministic RNG; use an explicitely-named RNG to guarantee stability + use rand::{RngCore, SeedableRng}; + use rand_chacha::ChaCha8Rng; + const SEED: u64 = 0xdead_bebe_ea75_cafe; + let mut rng = ChaCha8Rng::seed_from_u64(SEED); + + std::iter::repeat_with(move || array_init(|_| rng.next_u64())) + }; + + let mut group = c.benchmark_group("table"); + for a in inputs.take(10) { + let a_str = format!("{:?}", a); + group.bench_with_input( + BenchmarkId::from_parameter("chunked_".to_owned() + &a_str), + &a, + |b, &a| { + b.iter(|| factor_chunk(&mut a.clone(), &mut array_init(|_| Factors::one()))); + }, + ); + group.bench_with_input( + BenchmarkId::from_parameter("seq_".to_owned() + &a_str), + &a, + |b, &a| { + b.iter(|| { + let mut n_s = a.clone(); + let mut f_s: [_; CHUNK_SIZE] = array_init(|_| Factors::one()); + for (n, f) in n_s.iter_mut().zip(f_s.iter_mut()) { + factor(n, f) + } + }) + }, + ); + } + group.finish() +} + +criterion_group!(benches, table); +criterion_main!(benches); diff --git a/src/uu/factor/src/cli.rs b/src/uu/factor/src/cli.rs index fb7b3f192..ee4c8a4c4 100644 --- a/src/uu/factor/src/cli.rs +++ b/src/uu/factor/src/cli.rs @@ -13,13 +13,13 @@ use std::error::Error; use std::io::{self, stdin, stdout, BufRead, Write}; mod factor; -pub(crate) use factor::*; +pub use factor::*; use uucore::InvalidEncodingHandling; mod miller_rabin; pub mod numeric; mod rho; -mod table; +pub mod table; static SYNTAX: &str = "[OPTION] [NUMBER]..."; static SUMMARY: &str = "Print the prime factors of the given number(s). diff --git a/src/uu/factor/src/table.rs b/src/uu/factor/src/table.rs index cbd4af5e4..72628054c 100644 --- a/src/uu/factor/src/table.rs +++ b/src/uu/factor/src/table.rs @@ -12,7 +12,7 @@ use crate::Factors; include!(concat!(env!("OUT_DIR"), "/prime_table.rs")); -pub(crate) fn factor(num: &mut u64, factors: &mut Factors) { +pub fn factor(num: &mut u64, factors: &mut Factors) { for &(prime, inv, ceil) in P_INVS_U64 { if *num == 1 { break; @@ -42,3 +42,10 @@ pub(crate) fn factor(num: &mut u64, factors: &mut Factors) { } } } + +pub const CHUNK_SIZE: usize = 4; +pub fn factor_chunk(n_s: &mut [u64; CHUNK_SIZE], f_s: &mut [Factors; CHUNK_SIZE]) { + for (n, s) in n_s.iter_mut().zip(f_s.iter_mut()) { + factor(n, s); + } +} From 1fd5f9da25d9ce7be5206e5b1eabc0364064cdfb Mon Sep 17 00:00:00 2001 From: nicoo Date: Thu, 29 Apr 2021 14:29:59 +0200 Subject: [PATCH 0606/1135] factor::table::factor_chunk: Turn loop inside-out This keeps the traversal of `P_INVS_U64` (a large table) to a single pass in-order, rather than `CHUNK_SIZE` passes. --- src/uu/factor/src/table.rs | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/uu/factor/src/table.rs b/src/uu/factor/src/table.rs index 72628054c..45464ac27 100644 --- a/src/uu/factor/src/table.rs +++ b/src/uu/factor/src/table.rs @@ -45,7 +45,30 @@ pub fn factor(num: &mut u64, factors: &mut Factors) { pub const CHUNK_SIZE: usize = 4; pub fn factor_chunk(n_s: &mut [u64; CHUNK_SIZE], f_s: &mut [Factors; CHUNK_SIZE]) { - for (n, s) in n_s.iter_mut().zip(f_s.iter_mut()) { - factor(n, s); + for &(prime, inv, ceil) in P_INVS_U64 { + if n_s[0] == 1 && n_s[1] == 1 && n_s[2] == 1 && n_s[3] == 1 { + break; + } + + for (num, factors) in n_s.iter_mut().zip(f_s.iter_mut()) { + if *num == 1 { + continue; + } + let mut k = 0; + loop { + let x = num.wrapping_mul(inv); + + // While prime divides num + if x <= ceil { + *num = x; + k += 1; + } else { + if k > 0 { + factors.add(prime, k); + } + break; + } + } + } } } From 7c287542c7cd436520b3b07f124c6dcdf69e9f36 Mon Sep 17 00:00:00 2001 From: nicoo Date: Thu, 29 Apr 2021 15:45:04 +0200 Subject: [PATCH 0607/1135] factor::table: Fixup microbenchmark Previous version would perform an amount of work proportional to `CHUNK_SIZE`, so this wasn't a valid way to benchmark at multiple values of that constant. The `TryInto` implementation for `&mut [T]` to `&mut [T; N]` relies on `const` generics, and is available in (stable) Rust v1.51 and later. --- src/uu/factor/benches/table.rs | 20 +++++++++++++++++--- src/uu/factor/src/table.rs | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/uu/factor/benches/table.rs b/src/uu/factor/benches/table.rs index 8fae7cef6..ad8036d67 100644 --- a/src/uu/factor/benches/table.rs +++ b/src/uu/factor/benches/table.rs @@ -1,8 +1,16 @@ +use std::convert::TryInto; use array_init::array_init; use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; use uu_factor::{table::*, Factors}; fn table(c: &mut Criterion) { + const INPUT_SIZE: usize = 128; + assert!( + INPUT_SIZE % CHUNK_SIZE == 0, + "INPUT_SIZE ({}) is not divisible by CHUNK_SIZE ({})", + INPUT_SIZE, + CHUNK_SIZE + ); let inputs = { // Deterministic RNG; use an explicitely-named RNG to guarantee stability use rand::{RngCore, SeedableRng}; @@ -10,7 +18,7 @@ fn table(c: &mut Criterion) { const SEED: u64 = 0xdead_bebe_ea75_cafe; let mut rng = ChaCha8Rng::seed_from_u64(SEED); - std::iter::repeat_with(move || array_init(|_| rng.next_u64())) + std::iter::repeat_with(move || array_init::<_, _, INPUT_SIZE>(|_| rng.next_u64())) }; let mut group = c.benchmark_group("table"); @@ -20,7 +28,13 @@ fn table(c: &mut Criterion) { BenchmarkId::from_parameter("chunked_".to_owned() + &a_str), &a, |b, &a| { - b.iter(|| factor_chunk(&mut a.clone(), &mut array_init(|_| Factors::one()))); + b.iter(|| { + let mut n_s = a.clone(); + let mut f_s: [_; INPUT_SIZE] = array_init(|_| Factors::one()); + for (n_s, f_s) in n_s.chunks_mut(CHUNK_SIZE).zip(f_s.chunks_mut(CHUNK_SIZE)) { + factor_chunk(n_s.try_into().unwrap(), f_s.try_into().unwrap()) + } + }) }, ); group.bench_with_input( @@ -29,7 +43,7 @@ fn table(c: &mut Criterion) { |b, &a| { b.iter(|| { let mut n_s = a.clone(); - let mut f_s: [_; CHUNK_SIZE] = array_init(|_| Factors::one()); + let mut f_s: [_; INPUT_SIZE] = array_init(|_| Factors::one()); for (n, f) in n_s.iter_mut().zip(f_s.iter_mut()) { factor(n, f) } diff --git a/src/uu/factor/src/table.rs b/src/uu/factor/src/table.rs index 45464ac27..db2698e4b 100644 --- a/src/uu/factor/src/table.rs +++ b/src/uu/factor/src/table.rs @@ -43,7 +43,7 @@ pub fn factor(num: &mut u64, factors: &mut Factors) { } } -pub const CHUNK_SIZE: usize = 4; +pub const CHUNK_SIZE: usize = 8; pub fn factor_chunk(n_s: &mut [u64; CHUNK_SIZE], f_s: &mut [Factors; CHUNK_SIZE]) { for &(prime, inv, ceil) in P_INVS_U64 { if n_s[0] == 1 && n_s[1] == 1 && n_s[2] == 1 && n_s[3] == 1 { From 12efaa6add6d5ceab0c9c73459088faa806ec82e Mon Sep 17 00:00:00 2001 From: nicoo Date: Mon, 3 May 2021 12:26:05 +0200 Subject: [PATCH 0608/1135] factor: Add BENCHMARKING.md --- src/uu/factor/BENCHMARKING.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/uu/factor/BENCHMARKING.md diff --git a/src/uu/factor/BENCHMARKING.md b/src/uu/factor/BENCHMARKING.md new file mode 100644 index 000000000..e93bed95e --- /dev/null +++ b/src/uu/factor/BENCHMARKING.md @@ -0,0 +1,12 @@ +# Benchmarking `factor` + +## Microbenchmarking deterministic functions + +We currently use [`criterion`] to benchmark deterministic functions, +such as `gcd` and `table::factor`. + +Those benchmarks can be simply executed with `cargo bench` as usual, +but may require a recent version of Rust, *i.e.* the project's minimum +supported version of Rust does not apply to the benchmarks. + +[`criterion`]: https://bheisler.github.io/criterion.rs/book/index.html From ae15bf16a83328c08fd77f31da40af192eeedb5e Mon Sep 17 00:00:00 2001 From: nicoo Date: Mon, 3 May 2021 14:42:26 +0200 Subject: [PATCH 0609/1135] factor::benches::table: Report throughput (in numbers/s) --- src/uu/factor/benches/table.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/uu/factor/benches/table.rs b/src/uu/factor/benches/table.rs index ad8036d67..44ea1c863 100644 --- a/src/uu/factor/benches/table.rs +++ b/src/uu/factor/benches/table.rs @@ -1,6 +1,6 @@ -use std::convert::TryInto; use array_init::array_init; -use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; +use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; +use std::convert::TryInto; use uu_factor::{table::*, Factors}; fn table(c: &mut Criterion) { @@ -22,6 +22,7 @@ fn table(c: &mut Criterion) { }; let mut group = c.benchmark_group("table"); + group.throughput(Throughput::Elements(INPUT_SIZE as _)); for a in inputs.take(10) { let a_str = format!("{:?}", a); group.bench_with_input( From e9f8194266125f72d8bf99ab83e8562a21c9d048 Mon Sep 17 00:00:00 2001 From: nicoo Date: Mon, 3 May 2021 14:45:00 +0200 Subject: [PATCH 0610/1135] =?UTF-8?q?factor::benchmarking(doc):=20Add=20gu?= =?UTF-8?q?idance=20on=20running=20=C2=B5benches?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/uu/factor/BENCHMARKING.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/uu/factor/BENCHMARKING.md b/src/uu/factor/BENCHMARKING.md index e93bed95e..e87c965c2 100644 --- a/src/uu/factor/BENCHMARKING.md +++ b/src/uu/factor/BENCHMARKING.md @@ -9,4 +9,26 @@ Those benchmarks can be simply executed with `cargo bench` as usual, but may require a recent version of Rust, *i.e.* the project's minimum supported version of Rust does not apply to the benchmarks. + +However, µbenchmarks are by nature unstable: not only are they specific to +the hardware, operating system version, etc., but they are noisy and affected +by other tasks on the system (browser, compile jobs, etc.), which can cause +`criterion` to report spurious performance improvements and regressions. + +This can be mitigated by getting as close to [idealised conditions][lemire] +as possible: +- minimize the amount of computation and I/O running concurrently to the + benchmark, *i.e.* close your browser and IM clients, don't compile at the + same time, etc. ; +- ensure the CPU's [frequency stays constant] during the benchmark ; +- [isolate a **physical** core], set it to `nohz_full`, and pin the benchmark + to it, so it won't be preempted in the middle of a measurement ; +- disable ASLR by running `setarch -R cargo bench`, so we can compare results + across multiple executions. + **TODO**: check this propagates to the benchmark process + + [`criterion`]: https://bheisler.github.io/criterion.rs/book/index.html +[lemire]: https://lemire.me/blog/2018/01/16/microbenchmarking-calls-for-idealized-conditions/ +[isolate a **physical** core]: https://pyperf.readthedocs.io/en/latest/system.html#isolate-cpus-on-linux +[frequency stays constant]: XXXTODO From 1d75f09743a8fbe436da4d84701200f844cfae9f Mon Sep 17 00:00:00 2001 From: nicoo Date: Mon, 3 May 2021 14:45:24 +0200 Subject: [PATCH 0611/1135] =?UTF-8?q?factor::benchmarking(doc):=20Add=20gu?= =?UTF-8?q?idance=20on=20writing=20=C2=B5benches?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/uu/factor/BENCHMARKING.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/uu/factor/BENCHMARKING.md b/src/uu/factor/BENCHMARKING.md index e87c965c2..c629252b8 100644 --- a/src/uu/factor/BENCHMARKING.md +++ b/src/uu/factor/BENCHMARKING.md @@ -32,3 +32,34 @@ as possible: [lemire]: https://lemire.me/blog/2018/01/16/microbenchmarking-calls-for-idealized-conditions/ [isolate a **physical** core]: https://pyperf.readthedocs.io/en/latest/system.html#isolate-cpus-on-linux [frequency stays constant]: XXXTODO + + +### Guidance for designing µbenchmarks + +*Note:* this guidance is specific to `factor` and takes its application domain +into account; do not expect it to generalise to other projects. It is based +on Daniel Lemire's [*Microbenchmarking calls for idealized conditions*][lemire], +which I recommend reading if you want to add benchmarks to `factor`. + +1. Select a small, self-contained, deterministic component + `gcd` and `table::factor` are good example of such: + - no I/O or access to external data structures ; + - no call into other components ; + - behaviour is deterministic: no RNG, no concurrency, ... ; + - the test's body is *fast* (~100ns for `gcd`, ~10µs for `factor::table`), + so each sample takes a very short time, minimizing variability and + maximizing the numbers of samples we can take in a given time. + +2. Benchmarks are immutable (once merged in `uutils`) + Modifying a benchmark means previously-collected values cannot meaningfully + be compared, silently giving nonsensical results. If you must modify an + existing benchmark, rename it. + +3. Test common cases + We are interested in overall performance, rather than specific edge-cases; + use **reproducibly-randomised inputs**, sampling from either all possible + input values or some subset of interest. + +4. Use [`criterion`], `criterion::black_box`, ... + `criterion` isn't perfect, but it is also much better than ad-hoc + solutions in each benchmark. From ddfcd2eb14d8046c6246c753b00e2c0466e43c17 Mon Sep 17 00:00:00 2001 From: nicoo Date: Mon, 3 May 2021 15:04:06 +0200 Subject: [PATCH 0612/1135] factor::benchmarking: Add wishlist / planned work --- src/uu/factor/BENCHMARKING.md | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/src/uu/factor/BENCHMARKING.md b/src/uu/factor/BENCHMARKING.md index c629252b8..3ad038c15 100644 --- a/src/uu/factor/BENCHMARKING.md +++ b/src/uu/factor/BENCHMARKING.md @@ -63,3 +63,52 @@ which I recommend reading if you want to add benchmarks to `factor`. 4. Use [`criterion`], `criterion::black_box`, ... `criterion` isn't perfect, but it is also much better than ad-hoc solutions in each benchmark. + + +## Wishlist + +### Configurable statistical estimators + +`criterion` always uses the arithmetic average as estimator; in µbenchmarks, +where the code under test is fully deterministic and the measurements are +subject to additive, positive noise, [the minimum is more appropriate][lemire]. + + +### CI & reproducible performance testing + +Measuring performance on real hardware is important, as it relates directly +to what users of `factor` experience; however, such measurements are subject +to the constraints of the real-world, and aren't perfectly reproducible. +Moreover, the mitigations for it (described above) aren't achievable in +virtualized, multi-tenant environments such as CI. + +Instead, we could run the µbenchmarks in a simulated CPU with [`cachegrind`], +measure execution “time” in that model (in CI), and use it to detect and report +performance improvements and regressions. + +[`iai`] is an implementation of this idea for Rust. + +[`cachegrind`]: https://www.valgrind.org/docs/manual/cg-manual.html +[`iai`]: https://bheisler.github.io/criterion.rs/book/iai/iai.html + + +### Comparing randomised implementations across multiple inputs + +`factor` is a challenging target for system benchmarks as it combines two +characteristics: + +1. integer factoring algorithms are randomised, with large variance in + execution time ; + +2. various inputs also have large differences in factoring time, that + corresponds to no natural, linear ordering of the inputs. + + +If (1) was untrue (i.e. if execution time wasn't random), we could faithfully +compare 2 implementations (2 successive versions, or `uutils` and GNU) using +a scatter plot, where each axis corresponds to the perf. of one implementation. + +Similarly, without (2) we could plot numbers on the X axis and their factoring +time on the Y axis, using multiple lines for various quantiles. The large +differences in factoring times for successive numbers, mean that such a plot +would be unreadable. From 7c649bc74ecd425bdf15f5376979eeac973821c0 Mon Sep 17 00:00:00 2001 From: nicoo Date: Mon, 3 May 2021 16:14:38 +0200 Subject: [PATCH 0613/1135] factor::benches: Add check against ASLR --- src/uu/factor/BENCHMARKING.md | 1 - src/uu/factor/benches/table.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/uu/factor/BENCHMARKING.md b/src/uu/factor/BENCHMARKING.md index 3ad038c15..cf3bb35d0 100644 --- a/src/uu/factor/BENCHMARKING.md +++ b/src/uu/factor/BENCHMARKING.md @@ -25,7 +25,6 @@ as possible: to it, so it won't be preempted in the middle of a measurement ; - disable ASLR by running `setarch -R cargo bench`, so we can compare results across multiple executions. - **TODO**: check this propagates to the benchmark process [`criterion`]: https://bheisler.github.io/criterion.rs/book/index.html diff --git a/src/uu/factor/benches/table.rs b/src/uu/factor/benches/table.rs index 44ea1c863..232e59053 100644 --- a/src/uu/factor/benches/table.rs +++ b/src/uu/factor/benches/table.rs @@ -4,6 +4,9 @@ use std::convert::TryInto; use uu_factor::{table::*, Factors}; fn table(c: &mut Criterion) { + #[cfg(target_os = "linux")] + check_personality(); + const INPUT_SIZE: usize = 128; assert!( INPUT_SIZE % CHUNK_SIZE == 0, @@ -55,5 +58,29 @@ fn table(c: &mut Criterion) { group.finish() } +#[cfg(target_os = "linux")] +fn check_personality() { + use std::fs; + const ADDR_NO_RANDOMIZE: u64 = 0x0040000; + const PERSONALITY_PATH: &'static str = "/proc/self/personality"; + + let p_string = fs::read_to_string(PERSONALITY_PATH) + .expect(&format!("Couldn't read '{}'", PERSONALITY_PATH)) + .strip_suffix("\n") + .unwrap() + .to_owned(); + + let personality = u64::from_str_radix(&p_string, 16).expect(&format!( + "Expected a hex value for personality, got '{:?}'", + p_string + )); + if personality & ADDR_NO_RANDOMIZE == 0 { + eprintln!( + "WARNING: Benchmarking with ASLR enabled (personality is {:x}), results might not be reproducible.", + personality + ); + } +} + criterion_group!(benches, table); criterion_main!(benches); From 1cd001f529c80484f52175370972015abef425b9 Mon Sep 17 00:00:00 2001 From: nicoo Date: Sat, 8 May 2021 17:56:18 +0200 Subject: [PATCH 0614/1135] factor::benches::table: Match BenchmarkId w/ criterion's conventions See https://bheisler.github.io/criterion.rs/book/user_guide/comparing_functions.html --- src/uu/factor/benches/table.rs | 44 ++++++++++++++-------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/src/uu/factor/benches/table.rs b/src/uu/factor/benches/table.rs index 232e59053..0b31b2b4c 100644 --- a/src/uu/factor/benches/table.rs +++ b/src/uu/factor/benches/table.rs @@ -28,32 +28,24 @@ fn table(c: &mut Criterion) { group.throughput(Throughput::Elements(INPUT_SIZE as _)); for a in inputs.take(10) { let a_str = format!("{:?}", a); - group.bench_with_input( - BenchmarkId::from_parameter("chunked_".to_owned() + &a_str), - &a, - |b, &a| { - b.iter(|| { - let mut n_s = a.clone(); - let mut f_s: [_; INPUT_SIZE] = array_init(|_| Factors::one()); - for (n_s, f_s) in n_s.chunks_mut(CHUNK_SIZE).zip(f_s.chunks_mut(CHUNK_SIZE)) { - factor_chunk(n_s.try_into().unwrap(), f_s.try_into().unwrap()) - } - }) - }, - ); - group.bench_with_input( - BenchmarkId::from_parameter("seq_".to_owned() + &a_str), - &a, - |b, &a| { - b.iter(|| { - let mut n_s = a.clone(); - let mut f_s: [_; INPUT_SIZE] = array_init(|_| Factors::one()); - for (n, f) in n_s.iter_mut().zip(f_s.iter_mut()) { - factor(n, f) - } - }) - }, - ); + group.bench_with_input(BenchmarkId::new("factor_chunk", &a_str), &a, |b, &a| { + b.iter(|| { + let mut n_s = a.clone(); + let mut f_s: [_; INPUT_SIZE] = array_init(|_| Factors::one()); + for (n_s, f_s) in n_s.chunks_mut(CHUNK_SIZE).zip(f_s.chunks_mut(CHUNK_SIZE)) { + factor_chunk(n_s.try_into().unwrap(), f_s.try_into().unwrap()) + } + }) + }); + group.bench_with_input(BenchmarkId::new("factor", &a_str), &a, |b, &a| { + b.iter(|| { + let mut n_s = a.clone(); + let mut f_s: [_; INPUT_SIZE] = array_init(|_| Factors::one()); + for (n, f) in n_s.iter_mut().zip(f_s.iter_mut()) { + factor(n, f) + } + }) + }); } group.finish() } From 00322b986bfe9311985f64f3401112db12600813 Mon Sep 17 00:00:00 2001 From: nicoo Date: Mon, 17 May 2021 19:22:56 +0200 Subject: [PATCH 0615/1135] factor: Move benchmarks out-of-crate --- Cargo.toml | 3 +++ src/uu/factor/BENCHMARKING.md | 13 ++++++---- src/uu/factor/Cargo.toml | 18 +++---------- tests/benches/factor/Cargo.toml | 26 +++++++++++++++++++ .../benches}/factor/benches/gcd.rs | 0 .../benches}/factor/benches/table.rs | 0 6 files changed, 41 insertions(+), 19 deletions(-) create mode 100644 tests/benches/factor/Cargo.toml rename {src/uu => tests/benches}/factor/benches/gcd.rs (100%) rename {src/uu => tests/benches}/factor/benches/table.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 7c1a771fd..745393260 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -324,6 +324,9 @@ wc = { optional=true, version="0.0.6", package="uu_wc", path="src/uu/wc" } who = { optional=true, version="0.0.6", package="uu_who", path="src/uu/who" } whoami = { optional=true, version="0.0.6", package="uu_whoami", path="src/uu/whoami" } yes = { optional=true, version="0.0.6", package="uu_yes", path="src/uu/yes" } + +factor_benches = { optional = true, version = "0.0.0", package = "uu_factor_benches", path = "tests/benches/factor" } + # # * pinned transitive dependencies # Not needed for now. Keep as examples: diff --git a/src/uu/factor/BENCHMARKING.md b/src/uu/factor/BENCHMARKING.md index cf3bb35d0..e174d62b7 100644 --- a/src/uu/factor/BENCHMARKING.md +++ b/src/uu/factor/BENCHMARKING.md @@ -1,15 +1,18 @@ # Benchmarking `factor` +The benchmarks for `factor` are located under `tests/benches/factor` +and can be invoked with `cargo bench` in that directory. + +They are located outside the `uu_factor` crate, as they do not comply +with the project's minimum supported Rust version, *i.e.* may require +a newer version of `rustc`. + + ## Microbenchmarking deterministic functions We currently use [`criterion`] to benchmark deterministic functions, such as `gcd` and `table::factor`. -Those benchmarks can be simply executed with `cargo bench` as usual, -but may require a recent version of Rust, *i.e.* the project's minimum -supported version of Rust does not apply to the benchmarks. - - However, µbenchmarks are by nature unstable: not only are they specific to the hardware, operating system version, etc., but they are noisy and affected by other tasks on the system (browser, compile jobs, etc.), which can cause diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index cb77c5d19..eb34519f1 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -17,25 +17,15 @@ num-traits = "0.2.13" # used in src/numerics.rs, which is included by build.rs [dependencies] coz = { version = "0.1.3", optional = true } num-traits = "0.2.13" # Needs at least version 0.2.13 for "OverflowingAdd" -rand = { version="0.7", features=["small_rng"] } -smallvec = { version="0.6.14, < 1.0" } -uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +rand = { version = "0.7", features = ["small_rng"] } +smallvec = { version = "0.6.14, < 1.0" } +uucore = { version = ">=0.0.8", package = "uucore", path = "../../uucore" } +uucore_procs = { version = ">=0.0.5", package = "uucore_procs", path = "../../uucore_procs" } [dev-dependencies] -array-init = "2.0.0" -criterion = "0.3" paste = "0.1.18" quickcheck = "0.9.2" -rand_chacha = "0.2.2" -[[bench]] -name = "gcd" -harness = false - -[[bench]] -name = "table" -harness = false [[bin]] name = "factor" diff --git a/tests/benches/factor/Cargo.toml b/tests/benches/factor/Cargo.toml new file mode 100644 index 000000000..b3b718477 --- /dev/null +++ b/tests/benches/factor/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "uu_factor_benches" +version = "0.0.0" +authors = ["nicoo "] +license = "MIT" +description = "Benchmarks for the uu_factor integer factorization tool" +homepage = "https://github.com/uutils/coreutils" +edition = "2018" + +[dependencies] +uu_factor = { path = "../../../src/uu/factor" } + +[dev-dependencies] +array-init = "2.0.0" +criterion = "0.3" +rand = "0.7" +rand_chacha = "0.2.2" + + +[[bench]] +name = "gcd" +harness = false + +[[bench]] +name = "table" +harness = false diff --git a/src/uu/factor/benches/gcd.rs b/tests/benches/factor/benches/gcd.rs similarity index 100% rename from src/uu/factor/benches/gcd.rs rename to tests/benches/factor/benches/gcd.rs diff --git a/src/uu/factor/benches/table.rs b/tests/benches/factor/benches/table.rs similarity index 100% rename from src/uu/factor/benches/table.rs rename to tests/benches/factor/benches/table.rs From 9afed1f25f244305a1e24fc17aae061d0bd58c75 Mon Sep 17 00:00:00 2001 From: nicoo Date: Mon, 17 May 2021 19:41:32 +0200 Subject: [PATCH 0616/1135] Update Cargo.lock Adding array-init v2.0.0 Updating cast v0.2.5 -> v0.2.6 Adding pest v2.1.3 Updating rustc_version v0.2.3 -> v0.3.3 Adding semver v0.11.0 Adding semver-parser v0.10.2 Updating serde v1.0.125 -> v1.0.126 Updating serde_derive v1.0.125 -> v1.0.126 Adding ucd-trie v0.1.3 Adding uu_factor_benches v0.0.0 (#tests/benches/factor) --- Cargo.lock | 77 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 63 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 77957de80..34e918b45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -37,6 +37,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "array-init" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6945cc5422176fc5e602e590c2878d2c2acd9a4fe20a4baa7c28022521698ec6" + [[package]] name = "arrayvec" version = "0.4.12" @@ -136,9 +142,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cast" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc38c385bfd7e444464011bb24820f40dd1c76bcdfa1b78611cb7c2e5cafab75" +checksum = "57cdfa5d50aad6cb4d44dcab6101a7f79925bd59d82ca42f38a9856a28865374" dependencies = [ "rustc_version", ] @@ -258,6 +264,7 @@ dependencies = [ "uu_expand", "uu_expr", "uu_factor", + "uu_factor_benches", "uu_false", "uu_fmt", "uu_fold", @@ -1027,6 +1034,15 @@ dependencies = [ "proc-macro-hack", ] +[[package]] +name = "pest" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +dependencies = [ + "ucd-trie", +] + [[package]] name = "pkg-config" version = "0.3.19" @@ -1336,11 +1352,11 @@ checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" [[package]] name = "rustc_version" -version = "0.2.3" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" dependencies = [ - "semver", + "semver 0.11.0", ] [[package]] @@ -1370,7 +1386,16 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser", + "semver-parser 0.7.0", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser 0.10.2", ] [[package]] @@ -1380,10 +1405,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] -name = "serde" -version = "1.0.125" +name = "semver-parser" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + +[[package]] +name = "serde" +version = "1.0.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" [[package]] name = "serde_cbor" @@ -1397,9 +1431,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.125" +version = "1.0.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" +checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" dependencies = [ "proc-macro2", "quote 1.0.9", @@ -1627,6 +1661,12 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" + [[package]] name = "unicode-segmentation" version = "1.7.1" @@ -1922,17 +1962,26 @@ name = "uu_factor" version = "0.0.6" dependencies = [ "coz", - "criterion", "num-traits", "paste", "quickcheck", "rand 0.7.3", - "rand_chacha", "smallvec", "uucore", "uucore_procs", ] +[[package]] +name = "uu_factor_benches" +version = "0.0.0" +dependencies = [ + "array-init", + "criterion", + "rand 0.7.3", + "rand_chacha", + "uu_factor", +] + [[package]] name = "uu_false" version = "0.0.6" @@ -2407,7 +2456,7 @@ dependencies = [ "itertools 0.10.0", "rand 0.7.3", "rayon", - "semver", + "semver 0.9.0", "tempdir", "unicode-width", "uucore", From f46b119493bfe419437e3bd97638f8553eb5ad8a Mon Sep 17 00:00:00 2001 From: nicoo Date: Mon, 17 May 2021 20:37:26 +0200 Subject: [PATCH 0617/1135] CI: Stabilise the version of GNU tests used in CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The “GNU tests” task is routinely broken on `master`. Broken CI is worse than no CI, as it teaches people to ignore errors. This PR pins the versions of the GNU testsuite (and GNUlib) used, to current stable versions, so this task stops breaking unexpectedly. Presumably, someone will update `GNU.yml` when a new stable version of the GNU coreutils is released, but I'm not volunteering. --- .github/workflows/GNU.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index a68f0a083..d721eb8b1 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -12,16 +12,18 @@ jobs: uses: actions/checkout@v2 with: path: 'uutils' - - name: Chechout GNU coreutils + - name: Checkout GNU coreutils uses: actions/checkout@v2 with: repository: 'coreutils/coreutils' path: 'gnu' - - name: Chechout GNU corelib + ref: v8.32 + - name: Checkout GNU corelib uses: actions/checkout@v2 with: repository: 'coreutils/gnulib' path: 'gnulib' + ref: 8e99f24c0931a38880c6ee9b8287c7da80b0036b fetch-depth: 0 # gnu gets upset if gnulib is a shallow checkout - name: Install `rust` toolchain uses: actions-rs/toolchain@v1 From 047d775e5ee44dddfe77a98f019bda920458d554 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 17 May 2021 21:24:58 +0200 Subject: [PATCH 0618/1135] gh action: fix the GNU testsuite job --- .github/workflows/GNU.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index a68f0a083..f976b4633 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -92,7 +92,7 @@ jobs: sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/misc/test-N.sh sed -i 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh sed -i 's|truncate |/usr/bin/truncate |' tests/split/fail.sh - sed -i 's|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh tests/cp/fiemap-2.sh init.cfg + sed -i 's|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh init.cfg sed -i 's|id -|/usr/bin/id -|' tests/misc/runcon-no-reorder.sh sed -i 's|touch |/usr/bin/touch |' tests/cp/preserve-link.sh tests/cp/reflink-perm.sh tests/ls/block-size.sh tests/ls/abmon-align.sh tests/ls/rt-1.sh tests/mv/update.sh tests/misc/ls-time.sh tests/misc/stat-nanoseconds.sh tests/misc/time-style.sh tests/misc/test-N.sh sed -i 's|ln -|/usr/bin/ln -|' tests/cp/link-deref.sh @@ -104,7 +104,6 @@ jobs: #Add specific timeout to tests that currently hang to limit time spent waiting sed -i 's|seq \$|/usr/bin/timeout 0.1 seq \$|' tests/misc/seq-precision.sh tests/misc/seq-long-double.sh sed -i 's|cat |/usr/bin/timeout 0.1 cat |' tests/misc/cat-self.sh - test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" - name: Run GNU tests From dc93f29fe3532318059f9d5b7e39c1048f6bbc81 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 17 May 2021 22:22:18 +0200 Subject: [PATCH 0619/1135] CICD: install GNU coreutils on macOS --- .github/workflows/CICD.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index cc0972bf9..a42d2f335 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -235,6 +235,9 @@ jobs: 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 From fea1026669ec4f01b121eb1b2c027ad00595cc5c Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Mon, 17 May 2021 18:15:39 -0400 Subject: [PATCH 0620/1135] tail: use std::io::copy() to write bytes to stdout --- src/uu/tail/src/tail.rs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 6dafee184..371f0e2ed 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -19,7 +19,6 @@ mod chunks; mod platform; mod ringbuffer; use chunks::ReverseChunks; -use chunks::BLOCK_SIZE; use ringbuffer::RingBuffer; use clap::{App, Arg}; @@ -442,8 +441,6 @@ fn backwards_thru_file(file: &mut File, num_delimiters: usize, delimiter: u8) { /// `BLOCK_SIZE` until we find the location of the first line/byte. This ends up /// being a nice performance win for very large files. fn bounded_tail(file: &mut File, settings: &Settings) { - let mut buf = vec![0; BLOCK_SIZE as usize]; - // Find the position in the file to start printing from. match settings.mode { FilterMode::Lines(count, delimiter) => { @@ -455,18 +452,9 @@ fn bounded_tail(file: &mut File, settings: &Settings) { } // Print the target section of the file. - loop { - let bytes_read = file.read(&mut buf).unwrap(); - - let mut stdout = stdout(); - for b in &buf[0..bytes_read] { - print_byte(&mut stdout, *b); - } - - if bytes_read == 0 { - break; - } - } + let stdout = stdout(); + let mut stdout = stdout.lock(); + std::io::copy(file, &mut stdout).unwrap(); } /// Collect the last elements of an iterator into a `VecDeque`. From bc296455316a418ede9238f0b0a3745e261a0b46 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Mon, 17 May 2021 19:33:49 -0400 Subject: [PATCH 0621/1135] tail: fix off-by-one issue for +NUM args Fix an off-by-one issue for `tail -c +NUM` and `tail -n +NUM` command line options. --- src/uu/tail/src/tail.rs | 5 ++++- tests/by-util/test_tail.rs | 44 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 6dafee184..6af6d4b97 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -489,7 +489,10 @@ where E: fmt::Debug, { if beginning { - iter.skip(count as usize).map(|r| r.unwrap()).collect() + // GNU `tail` seems to index bytes and lines starting at 1, not + // at 0. It seems to treat `+0` and `+1` as the same thing. + let i = count.max(1) - 1; + iter.skip(i as usize).map(|r| r.unwrap()).collect() } else { RingBuffer::from_iter(iter.map(|r| r.unwrap()), count as usize).data } diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 1c025cf4c..dddbb9c31 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -348,3 +348,47 @@ fn test_negative_indexing() { fn test_sleep_interval() { new_ucmd!().arg("-s").arg("10").arg(FOOBAR_TXT).succeeds(); } + + +/// Test for reading all but the first NUM bytes: `tail -c +3`. +#[test] +fn test_positive_bytes() { + new_ucmd!() + .args(&["-c", "+3"]) + .pipe_in("abcde") + .succeeds() + .stdout_is("cde"); +} + + +/// Test for reading all bytes, specified by `tail -c +0`. +#[test] +fn test_positive_zero_bytes() { + new_ucmd!() + .args(&["-c", "+0"]) + .pipe_in("abcde") + .succeeds() + .stdout_is("abcde"); +} + + +/// Test for reading all but the first NUM lines: `tail -n +3`. +#[test] +fn test_positive_lines() { + new_ucmd!() + .args(&["-n", "+3"]) + .pipe_in("a\nb\nc\nd\ne\n") + .succeeds() + .stdout_is("c\nd\ne\n"); +} + + +/// Test for reading all lines, specified by `tail -n +0`. +#[test] +fn test_positive_zero_lines() { + new_ucmd!() + .args(&["-n", "+0"]) + .pipe_in("a\nb\nc\nd\ne\n") + .succeeds() + .stdout_is("a\nb\nc\nd\ne\n"); +} From 7c7d622d540449cc77e9adf84ee6c32dcb73e30b Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Tue, 18 May 2021 02:00:16 +0200 Subject: [PATCH 0622/1135] tests: add test for issue #2223 --- tests/by-util/test_ls.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index a57525e4b..8d32172b0 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1966,3 +1966,38 @@ fn test_ls_sort_extension() { expected, ); } + +// This tests for the open issue described in #2223 +#[cfg_attr(not(feature = "test_unimplemented"), ignore)] +#[test] +fn test_ls_path() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let file1 = "file1"; + let file2 = "file2"; + let dir = "dir"; + let path = &format!("{}/{}", dir, file2); + + at.mkdir(dir); + at.touch(file1); + at.touch(path); + + let expected_stdout = &format!("{}\n", path); + scene.ucmd().arg(path).run().stdout_is(expected_stdout); + + let expected_stdout = &format!("./{}\n", path); + scene.ucmd().arg(path).run().stdout_is(expected_stdout); + + let abs_path = format!("{}/{}\n", at.as_string(), path); + println!(":{}", abs_path); + scene.ucmd().arg(&abs_path).run().stdout_is(&abs_path); + + let expected_stdout = &format!("{}\n{}\n", file1, path); + scene + .ucmd() + .arg(file1) + .arg(path) + .run() + .stdout_is(expected_stdout); +} From 7a88df9fb493df3c169d55e697a70b4349fa809c Mon Sep 17 00:00:00 2001 From: Arijit Dey Date: Tue, 18 May 2021 12:42:33 +0530 Subject: [PATCH 0623/1135] Fix broken terminal in tests --- src/uu/more/src/more.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index e9687dcc4..2f8d179a8 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -133,8 +133,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) .get_matches_from(args); let mut buff = String::new(); - let mut stdout = setup_term(); if let Some(filenames) = matches.values_of(options::FILES) { + let mut stdout = setup_term(); let length = filenames.len(); for (idx, fname) in filenames.clone().enumerate() { let fname = Path::new(fname); @@ -163,11 +163,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } reset_term(&mut stdout); } else if atty::isnt(atty::Stream::Stdin) { - let mut stdout = setup_term(); stdin().read_to_string(&mut buff).unwrap(); + let mut stdout = setup_term(); more(&buff, &mut stdout, true); + reset_term(&mut stdout); } else { - terminal::disable_raw_mode().unwrap(); show_usage_error!("bad usage"); } 0 From 1596c65dfd6decc671ea906f2f140a9d86ce04a4 Mon Sep 17 00:00:00 2001 From: Arijit Dey Date: Tue, 18 May 2021 22:29:59 +0530 Subject: [PATCH 0624/1135] Downgrade crossterm version --- Cargo.lock | 36 +++++++++++++----------------------- src/uu/more/Cargo.toml | 2 +- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 972003e85..6deae1a49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -520,9 +520,9 @@ dependencies = [ [[package]] name = "crossterm" -version = "0.19.0" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c36c10130df424b2f3552fcc2ddcd9b28a27b1e54b358b45874f88d1ca6888c" +checksum = "6f4919d60f26ae233e14233cc39746c8c8bb8cd7b05840ace83604917b51b6c7" dependencies = [ "bitflags", "crossterm_winapi", @@ -536,9 +536,9 @@ dependencies = [ [[package]] name = "crossterm_winapi" -version = "0.7.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da8964ace4d3e4a044fd027919b2237000b24315a37c916f61809f1ff2140b9" +checksum = "c2265c3f8e080075d9b6417aa72293fc71662f34b4af2612d8d1b074d29510db" dependencies = [ "winapi 0.3.9", ] @@ -768,15 +768,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" -[[package]] -name = "instant" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" -dependencies = [ - "cfg-if 1.0.0", -] - [[package]] name = "ioctl-sys" version = "0.5.2" @@ -858,9 +849,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3c91c24eae6777794bb1997ad98bbb87daf92890acab859f7eaa4320333176" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" dependencies = [ "scopeguard", ] @@ -1073,25 +1064,24 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.11.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" dependencies = [ - "instant", "lock_api", "parking_lot_core", ] [[package]] name = "parking_lot_core" -version = "0.8.3" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" +checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" dependencies = [ - "cfg-if 1.0.0", - "instant", + "cfg-if 0.1.10", + "cloudabi", "libc", - "redox_syscall 0.2.7", + "redox_syscall 0.1.57", "smallvec 1.6.1", "winapi 0.3.9", ] diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index 9b1a3d7b6..613dcc37b 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -18,7 +18,7 @@ path = "src/more.rs" clap = "2.33" uucore = { version = ">=0.0.7", package = "uucore", path = "../../uucore" } uucore_procs = { version = ">=0.0.5", package = "uucore_procs", path = "../../uucore_procs" } -crossterm = ">=0.19" +crossterm = "~0.17" atty = "0.2.14" [target.'cfg(target_os = "redox")'.dependencies] From ce5b852a3121bf8069c1d8b2948fa8c3b31f6134 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Tue, 18 May 2021 19:58:33 +0200 Subject: [PATCH 0625/1135] stat: remove unused/duplicate tests --- src/uu/stat/src/test_stat.rs | 76 ------------------------------------ 1 file changed, 76 deletions(-) delete mode 100644 src/uu/stat/src/test_stat.rs diff --git a/src/uu/stat/src/test_stat.rs b/src/uu/stat/src/test_stat.rs deleted file mode 100644 index 05e91fb84..000000000 --- a/src/uu/stat/src/test_stat.rs +++ /dev/null @@ -1,76 +0,0 @@ -// spell-checker:ignore (ToDO) scanutil qzxc dqzxc - -pub use super::*; - -#[test] -fn test_scanutil() { - assert_eq!(Some((-5, 2)), "-5zxc".scan_num::()); - assert_eq!(Some((51, 2)), "51zxc".scan_num::()); - assert_eq!(Some((192, 4)), "+192zxc".scan_num::()); - assert_eq!(None, "z192zxc".scan_num::()); - - assert_eq!(Some(('a', 3)), "141zxc".scan_char(8)); - assert_eq!(Some(('\n', 2)), "12qzxc".scan_char(8)); - assert_eq!(Some(('\r', 1)), "dqzxc".scan_char(16)); - assert_eq!(None, "z2qzxc".scan_char(8)); -} - -#[cfg(test)] -mod test_generate_tokens { - use super::*; - - #[test] - fn test_normal_format() { - let s = "%10.2ac%-5.w\n"; - let expected = vec![ - Token::Directive { - flag: 0, - width: 10, - precision: 2, - format: 'a', - }, - Token::Char('c'), - Token::Directive { - flag: F_LEFT, - width: 5, - precision: 0, - format: 'w', - }, - Token::Char('\n'), - ]; - assert_eq!(&expected, &Stater::generate_tokens(s, false).unwrap()); - } - - #[test] - fn test_printf_format() { - let s = "%-# 15a\\r\\\"\\\\\\a\\b\\e\\f\\v%+020.-23w\\x12\\167\\132\\112\\n"; - let expected = vec![ - Token::Directive { - flag: F_LEFT | F_ALTER | F_SPACE, - width: 15, - precision: -1, - format: 'a', - }, - Token::Char('\r'), - Token::Char('"'), - Token::Char('\\'), - Token::Char('\x07'), - Token::Char('\x08'), - Token::Char('\x1B'), - Token::Char('\x0C'), - Token::Char('\x0B'), - Token::Directive { - flag: F_SIGN | F_ZERO, - width: 20, - precision: -1, - format: 'w', - }, - Token::Char('\x12'), - Token::Char('w'), - Token::Char('Z'), - Token::Char('J'), - Token::Char('\n'), - ]; - assert_eq!(&expected, &Stater::generate_tokens(s, true).unwrap()); - } -} From c60d3866c33243d2c186ba15e314eca791053f02 Mon Sep 17 00:00:00 2001 From: Chad Brewbaker Date: Tue, 18 May 2021 15:10:51 -0500 Subject: [PATCH 0626/1135] dev random blocks on linux --- tests/by-util/test_cat.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index 67722daa2..6ec021ffa 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -347,10 +347,18 @@ fn test_squeeze_blank_before_numbering() { #[cfg(unix)] fn test_dev_random() { let mut buf = [0; 2048]; - let mut proc = new_ucmd!().args(&["/dev/random"]).run_no_wait(); + #[cfg(target_os = "linux")] + fn rand_gen() -> &'static str { "/dev/urandom"} + + #[cfg(not(target_os = "linux"))] + fn rand_gen() -> &'static str { "/dev/random"} + + let mut proc = new_ucmd!().args(&[rand_gen()]).run_no_wait(); let mut proc_stdout = proc.stdout.take().unwrap(); + println!("I got to 1"); proc_stdout.read_exact(&mut buf).unwrap(); + println!("I got to 3"); let num_zeroes = buf.iter().fold(0, |mut acc, &n| { if n == 0 { acc += 1; From a69cb11de9de0d51e679a78f4a1055d199d2915c Mon Sep 17 00:00:00 2001 From: Chad Brewbaker Date: Tue, 18 May 2021 15:17:07 -0500 Subject: [PATCH 0627/1135] Removing debug code --- tests/by-util/test_cat.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index 6ec021ffa..997a7964c 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -355,10 +355,8 @@ fn test_dev_random() { let mut proc = new_ucmd!().args(&[rand_gen()]).run_no_wait(); let mut proc_stdout = proc.stdout.take().unwrap(); - println!("I got to 1"); proc_stdout.read_exact(&mut buf).unwrap(); - println!("I got to 3"); let num_zeroes = buf.iter().fold(0, |mut acc, &n| { if n == 0 { acc += 1; From 7bf342fa52300fdbe17fdb86cd630b40b267598e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 18 May 2021 21:31:55 +0200 Subject: [PATCH 0628/1135] publish the results of the gnu testsuite as a json file too --- .github/workflows/GNU.yml | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index f976b4633..3fd39aa15 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -34,7 +34,7 @@ jobs: shell: bash run: | sudo apt-get update - sudo apt-get install autoconf autopoint bison texinfo gperf gcc g++ gdb python-pyinotify python3-sphinx + sudo apt-get install autoconf autopoint bison texinfo gperf gcc g++ gdb python-pyinotify python3-sphinx jq pushd uutils make PROFILE=release BUILDDIR="$PWD/target/release/" @@ -117,15 +117,24 @@ jobs: - name: Extract tests info shell: bash run: | - if test -f gnu/tests/test-suite.log + LOG_FILE=gnu/tests/test-suite.log + if test -f "$LOG_FILE" then - TOTAL=$( grep "# TOTAL:" gnu/tests/test-suite.log|cut -d' ' -f2-) - PASS=$( grep "# PASS:" gnu/tests/test-suite.log|cut -d' ' -f2-) - SKIP=$( grep "# SKIP:" gnu/tests/test-suite.log|cut -d' ' -f2-) - FAIL=$( grep "# FAIL:" gnu/tests/test-suite.log|cut -d' ' -f2-) - XPASS=$( grep "# XPASS:" gnu/tests/test-suite.log|cut -d' ' -f2-) - ERROR=$( grep "# ERROR:" gnu/tests/test-suite.log|cut -d' ' -f2-) - echo "::warning ::GNU testsuite = $TOTAL / $PASS / $FAIL / $ERROR" + TOTAL=$(sed -n "s/.*# TOTAL: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1) + PASS=$(sed -n "s/.*# PASS: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1) + SKIP=$(sed -n "s/.*# SKIP: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1) + FAIL=$(sed -n "s/.*# FAIL: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1) + XPASS=$(sed -n "s/.*# XPASS: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1) + ERROR=$(sed -n "s/.*# ERROR: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1) + echo "::warning ::GNU testsuite = TOTAL: $TOTAL / PASS: $PASS / FAIL: $FAIL / ERROR: $ERROR" + jq -n \ + --arg total "$TOTAL" \ + --arg pass "$PASS" \ + --arg skip "$SKIP" \ + --arg fail "$FAIL" \ + --arg xpass "$XPASS" \ + --arg error "$ERROR" \ + '{total: $total, pass: $pass, skip: $skip, fail: $fail, xpass: $xpass, error: $error, }' > gnu-result.json else echo "::error ::Failed to get summary of test results" fi @@ -134,3 +143,8 @@ jobs: with: name: test-report path: gnu/tests/**/*.log + + - uses: actions/upload-artifact@v2 + with: + name: gnu-result + path: gnu-result.json From 8032c6d750f4a97b0d5880fc0180554f10360d8f Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 19 May 2021 01:04:24 +0200 Subject: [PATCH 0629/1135] fix clippy warnings --- src/uucore/src/lib/features/fsext.rs | 8 ++++---- tests/by-util/test_basename.rs | 2 ++ tests/by-util/test_relpath.rs | 6 +++--- tests/by-util/test_uname.rs | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/uucore/src/lib/features/fsext.rs b/src/uucore/src/lib/features/fsext.rs index 887c31e01..19c634b0b 100644 --- a/src/uucore/src/lib/features/fsext.rs +++ b/src/uucore/src/lib/features/fsext.rs @@ -276,7 +276,7 @@ impl MountInfo { GetVolumeInformationW( String2LPWSTR!(mount_root), ptr::null_mut(), - 0 as DWORD, + 0, ptr::null_mut(), ptr::null_mut(), ptr::null_mut(), @@ -510,12 +510,12 @@ impl FsUsage { // Total number of free blocks. bfree: number_of_free_clusters as u64, // Total number of free blocks available to non-privileged processes. - bavail: 0 as u64, + bavail: 0, bavail_top_bit_set: ((bytes_per_sector as u64) & (1u64.rotate_right(1))) != 0, // Total number of file nodes (inodes) on the file system. - files: 0 as u64, // Not available on windows + files: 0, // Not available on windows // Total number of free file nodes (inodes). - ffree: 4096 as u64, // Meaningless on Windows + ffree: 4096, // Meaningless on Windows } } } diff --git a/tests/by-util/test_basename.rs b/tests/by-util/test_basename.rs index 2a40ba4b9..baf15f78a 100644 --- a/tests/by-util/test_basename.rs +++ b/tests/by-util/test_basename.rs @@ -1,4 +1,5 @@ use crate::common::util::*; +#[cfg(any(unix, target_os = "redox"))] use std::ffi::OsStr; #[test] @@ -123,6 +124,7 @@ fn test_too_many_args_output() { ); } +#[cfg(any(unix, target_os = "redox"))] fn test_invalid_utf8_args(os_str: &OsStr) { let test_vec = vec![os_str.to_os_string()]; new_ucmd!().args(&test_vec).succeeds().stdout_is("fo�o\n"); diff --git a/tests/by-util/test_relpath.rs b/tests/by-util/test_relpath.rs index 5094d25a8..70d9f2a5d 100644 --- a/tests/by-util/test_relpath.rs +++ b/tests/by-util/test_relpath.rs @@ -155,7 +155,7 @@ fn test_relpath_no_from_with_d() { at.mkdir_all(to); // d is part of subpath -> expect relative path - let mut result_stdout = scene + let _result_stdout = scene .ucmd() .arg(to) .arg(&format!("-d{}", pwd)) @@ -163,10 +163,10 @@ fn test_relpath_no_from_with_d() { .stdout_move_str(); // relax rules for windows test environment #[cfg(not(windows))] - assert!(Path::new(&result_stdout).is_relative()); + assert!(Path::new(&_result_stdout).is_relative()); // d is not part of subpath -> expect absolut path - result_stdout = scene + let result_stdout = scene .ucmd() .arg(to) .arg("-dnon_existing") diff --git a/tests/by-util/test_uname.rs b/tests/by-util/test_uname.rs index da901d985..d878ed7ac 100644 --- a/tests/by-util/test_uname.rs +++ b/tests/by-util/test_uname.rs @@ -43,5 +43,5 @@ fn test_uname_kernel() { } #[cfg(not(target_os = "linux"))] - let result = ucmd.arg("-o").succeeds(); + ucmd.arg("-o").succeeds(); } From 9167a4128da23f14831819bd2b6d89f624ab9cfb Mon Sep 17 00:00:00 2001 From: Chad Brewbaker Date: Wed, 19 May 2021 04:06:46 -0500 Subject: [PATCH 0630/1135] Update test_cat.rs Refactored to constants --- tests/by-util/test_cat.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index 997a7964c..4bb673b95 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -348,12 +348,12 @@ fn test_squeeze_blank_before_numbering() { fn test_dev_random() { let mut buf = [0; 2048]; #[cfg(target_os = "linux")] - fn rand_gen() -> &'static str { "/dev/urandom"} + const DEV_RANDOM: &str = "/dev/urandom"; #[cfg(not(target_os = "linux"))] - fn rand_gen() -> &'static str { "/dev/random"} + const DEV_RANDOM: &str = "/dev/random"; - let mut proc = new_ucmd!().args(&[rand_gen()]).run_no_wait(); + let mut proc = new_ucmd!().args(&[DEV_RANDOM]).run_no_wait(); let mut proc_stdout = proc.stdout.take().unwrap(); proc_stdout.read_exact(&mut buf).unwrap(); From 0c6a84831452b4c00216a498be053cda0ecc3912 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 19 May 2021 20:33:28 +0200 Subject: [PATCH 0631/1135] gnu results: also add the date (#2236) --- .github/workflows/GNU.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 3fd39aa15..213137acc 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -128,13 +128,14 @@ jobs: ERROR=$(sed -n "s/.*# ERROR: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1) echo "::warning ::GNU testsuite = TOTAL: $TOTAL / PASS: $PASS / FAIL: $FAIL / ERROR: $ERROR" jq -n \ + --arg date "$(date --rfc-email)" \ --arg total "$TOTAL" \ --arg pass "$PASS" \ --arg skip "$SKIP" \ --arg fail "$FAIL" \ --arg xpass "$XPASS" \ --arg error "$ERROR" \ - '{total: $total, pass: $pass, skip: $skip, fail: $fail, xpass: $xpass, error: $error, }' > gnu-result.json + '{($date): { total: $total, pass: $pass, skip: $skip, fail: $fail, xpass: $xpass, error: $error, }}' > gnu-result.json else echo "::error ::Failed to get summary of test results" fi From 63b496eaa8a87a696fd9ea21eb3bffc86fe0a971 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Wed, 19 May 2021 22:23:28 -0400 Subject: [PATCH 0632/1135] truncate: refactor parse_size() function Change the interface provided by the `parse_size()` function to reduce its responsibilities to just a single task: parsing a number of bytes from a string of the form '123KB', etc. Previously, the function was also responsible for deciding which mode truncate would operate in. Furthermore, this commit simplifies the code for parsing the number and unit to be less verbose and use less mutable state. Finally, this commit adds some unit tests for the `parse_size()` function. --- src/uu/truncate/src/truncate.rs | 171 +++++++++++++++++++++----------- tests/by-util/test_truncate.rs | 10 ++ 2 files changed, 122 insertions(+), 59 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 91f705bd1..3190e6ad4 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -133,7 +133,35 @@ fn truncate( filenames: Vec, ) { let (modsize, mode) = match size { - Some(size_string) => parse_size(&size_string), + Some(size_string) => { + // Trim any whitespace. + let size_string = size_string.trim(); + + // Get the modifier character from the size string, if any. For + // example, if the argument is "+123", then the modifier is '+'. + let c = size_string.chars().next().unwrap(); + + let mode = match c { + '+' => TruncateMode::Extend, + '-' => TruncateMode::Reduce, + '<' => TruncateMode::AtMost, + '>' => TruncateMode::AtLeast, + '/' => TruncateMode::RoundDown, + '*' => TruncateMode::RoundUp, + _ => TruncateMode::Absolute, /* assume that the size is just a number */ + }; + + // If there was a modifier character, strip it. + let size_string = match mode { + TruncateMode::Absolute => size_string, + _ => &size_string[1..], + }; + let num_bytes = match parse_size(size_string) { + Ok(b) => b, + Err(_) => crash!(1, "Invalid number: ‘{}’", size_string), + }; + (num_bytes, mode) + } None => (0, TruncateMode::Reference), }; @@ -208,64 +236,89 @@ fn truncate( } } -fn parse_size(size: &str) -> (u64, TruncateMode) { - let clean_size = size.replace(" ", ""); - let mode = match clean_size.chars().next().unwrap() { - '+' => TruncateMode::Extend, - '-' => TruncateMode::Reduce, - '<' => TruncateMode::AtMost, - '>' => TruncateMode::AtLeast, - '/' => TruncateMode::RoundDown, - '*' => TruncateMode::RoundUp, - _ => TruncateMode::Absolute, /* assume that the size is just a number */ +/// Parse a size string into a number of bytes. +/// +/// A size string comprises an integer and an optional unit. The unit +/// may be K, M, G, T, P, E, Z, or Y (powers of 1024) or KB, MB, +/// etc. (powers of 1000). +/// +/// # Errors +/// +/// This function returns an error if the string does not begin with a +/// numeral, or if the unit is not one of the supported units described +/// in the preceding section. +/// +/// # Examples +/// +/// ```rust,ignore +/// assert_eq!(parse_size("123").unwrap(), 123); +/// assert_eq!(parse_size("123K").unwrap(), 123 * 1024); +/// assert_eq!(parse_size("123KB").unwrap(), 123 * 1000); +/// ``` +fn parse_size(size: &str) -> Result { + // Get the numeric part of the size argument. For example, if the + // argument is "123K", then the numeric part is "123". + let numeric_string: String = size.chars().take_while(|c| c.is_digit(10)).collect(); + let number: u64 = match numeric_string.parse() { + Ok(n) => n, + Err(_) => return Err(()), }; - let bytes = { - let mut slice = if mode == TruncateMode::Absolute { - &clean_size - } else { - &clean_size[1..] - }; - if slice.chars().last().unwrap().is_alphabetic() { - slice = &slice[..slice.len() - 1]; - if !slice.is_empty() && slice.chars().last().unwrap().is_alphabetic() { - slice = &slice[..slice.len() - 1]; - } - } - slice - } - .to_owned(); - let mut number: u64 = match bytes.parse() { - Ok(num) => num, - Err(e) => crash!(1, "'{}' is not a valid number: {}", size, e), + + // Get the alphabetic units part of the size argument and compute + // the factor it represents. For example, if the argument is "123K", + // then the unit part is "K" and the factor is 1024. This may be the + // empty string, in which case, the factor is 1. + let n = numeric_string.len(); + let (base, exponent): (u64, u32) = match &size[n..] { + "" => (1, 0), + "K" | "k" => (1024, 1), + "M" | "m" => (1024, 2), + "G" | "g" => (1024, 3), + "T" | "t" => (1024, 4), + "P" | "p" => (1024, 5), + "E" | "e" => (1024, 6), + "Z" | "z" => (1024, 7), + "Y" | "y" => (1024, 8), + "KB" | "kB" => (1000, 1), + "MB" | "mB" => (1000, 2), + "GB" | "gB" => (1000, 3), + "TB" | "tB" => (1000, 4), + "PB" | "pB" => (1000, 5), + "EB" | "eB" => (1000, 6), + "ZB" | "zB" => (1000, 7), + "YB" | "yB" => (1000, 8), + _ => return Err(()), }; - if clean_size.chars().last().unwrap().is_alphabetic() { - number *= match clean_size.chars().last().unwrap().to_ascii_uppercase() { - 'B' => match clean_size - .chars() - .nth(clean_size.len() - 2) - .unwrap() - .to_ascii_uppercase() - { - 'K' => 1000u64, - 'M' => 1000u64.pow(2), - 'G' => 1000u64.pow(3), - 'T' => 1000u64.pow(4), - 'P' => 1000u64.pow(5), - 'E' => 1000u64.pow(6), - 'Z' => 1000u64.pow(7), - 'Y' => 1000u64.pow(8), - letter => crash!(1, "'{}B' is not a valid suffix.", letter), - }, - 'K' => 1024u64, - 'M' => 1024u64.pow(2), - 'G' => 1024u64.pow(3), - 'T' => 1024u64.pow(4), - 'P' => 1024u64.pow(5), - 'E' => 1024u64.pow(6), - 'Z' => 1024u64.pow(7), - 'Y' => 1024u64.pow(8), - letter => crash!(1, "'{}' is not a valid suffix.", letter), - }; - } - (number, mode) + let factor = base.pow(exponent); + Ok(number * factor) +} + +#[cfg(test)] +mod tests { + use crate::parse_size; + + #[test] + fn test_parse_size_zero() { + assert_eq!(parse_size("0").unwrap(), 0); + assert_eq!(parse_size("0K").unwrap(), 0); + assert_eq!(parse_size("0KB").unwrap(), 0); + } + + #[test] + fn test_parse_size_without_factor() { + assert_eq!(parse_size("123").unwrap(), 123); + } + + #[test] + fn test_parse_size_kilobytes() { + assert_eq!(parse_size("123K").unwrap(), 123 * 1024); + assert_eq!(parse_size("123KB").unwrap(), 123 * 1000); + } + + #[test] + fn test_parse_size_megabytes() { + assert_eq!(parse_size("123").unwrap(), 123); + assert_eq!(parse_size("123M").unwrap(), 123 * 1024 * 1024); + assert_eq!(parse_size("123MB").unwrap(), 123 * 1000 * 1000); + } } diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index 8f88f4c74..b1f806f82 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -235,3 +235,13 @@ fn test_size_and_reference() { actual ); } + +#[test] +fn test_invalid_numbers() { + // TODO For compatibility with GNU, `truncate -s 0X` should cause + // the same error as `truncate -s 0X file`, but currently it returns + // a different error. + new_ucmd!().args(&["-s", "0X", "file"]).fails().stderr_contains("Invalid number: ‘0X’"); + new_ucmd!().args(&["-s", "0XB", "file"]).fails().stderr_contains("Invalid number: ‘0XB’"); + new_ucmd!().args(&["-s", "0B", "file"]).fails().stderr_contains("Invalid number: ‘0B’"); +} From 998b3c11d3af933afdd714f1678e2080740cbb07 Mon Sep 17 00:00:00 2001 From: nicoo Date: Thu, 20 May 2021 17:00:49 +0200 Subject: [PATCH 0633/1135] factor: Make random Factors instance generatable for tests --- src/uu/factor/src/factor.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index f53abd772..b279de7fc 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -239,9 +239,13 @@ mod tests { } #[cfg(test)] -impl quickcheck::Arbitrary for Factors { - fn arbitrary(gen: &mut G) -> Self { - use rand::Rng; +use rand::{ + distributions::{Distribution, Standard}, + Rng, +}; +#[cfg(test)] +impl Distribution for Standard { + fn sample(&self, rng: &mut R) -> Factors { let mut f = Factors::one(); let mut g = 1u64; let mut n = u64::MAX; @@ -252,7 +256,7 @@ impl quickcheck::Arbitrary for Factors { // See Generating Random Factored Numbers, Easily, J. Cryptology (2003) 'attempt: loop { while n > 1 { - n = gen.gen_range(1, n); + n = rng.gen_range(1, n); if miller_rabin::is_prime(n) { if let Some(h) = g.checked_mul(n) { f.push(n); @@ -269,6 +273,13 @@ impl quickcheck::Arbitrary for Factors { } } +#[cfg(test)] +impl quickcheck::Arbitrary for Factors { + fn arbitrary(g: &mut G) -> Self { + g.gen() + } +} + #[cfg(test)] impl std::ops::BitXor for Factors { type Output = Self; From a0a103b15e52b20f63d36aee93083c81b007326d Mon Sep 17 00:00:00 2001 From: nicoo Date: Thu, 20 May 2021 17:01:33 +0200 Subject: [PATCH 0634/1135] factor::table::chunked: Add test (equivalent to the single-number version) --- src/uu/factor/src/table.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/uu/factor/src/table.rs b/src/uu/factor/src/table.rs index db2698e4b..518d4f241 100644 --- a/src/uu/factor/src/table.rs +++ b/src/uu/factor/src/table.rs @@ -72,3 +72,30 @@ pub fn factor_chunk(n_s: &mut [u64; CHUNK_SIZE], f_s: &mut [Factors; CHUNK_SIZE] } } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::Factors; + use quickcheck::quickcheck; + use rand::{rngs::SmallRng, Rng, SeedableRng}; + + quickcheck! { + fn chunk_vs_iter(seed: u64) -> () { + let mut rng = SmallRng::seed_from_u64(seed); + let mut n_c: [u64; CHUNK_SIZE] = rng.gen(); + let mut f_c: [Factors; CHUNK_SIZE] = rng.gen(); + + let mut n_i = n_c.clone(); + let mut f_i = f_c.clone(); + for (n, f) in n_i.iter_mut().zip(f_i.iter_mut()) { + factor(n, f); + } + + factor_chunk(&mut n_c, &mut f_c); + + assert_eq!(n_i, n_c); + assert_eq!(f_i, f_c); + } + } +} From d30393089f4d9f02f492933fd8bdd283724e401f Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Thu, 20 May 2021 20:57:28 -0400 Subject: [PATCH 0635/1135] truncate: rustfmt test_truncate.rs file --- tests/by-util/test_truncate.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index b1f806f82..fc302dcba 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -241,7 +241,16 @@ fn test_invalid_numbers() { // TODO For compatibility with GNU, `truncate -s 0X` should cause // the same error as `truncate -s 0X file`, but currently it returns // a different error. - new_ucmd!().args(&["-s", "0X", "file"]).fails().stderr_contains("Invalid number: ‘0X’"); - new_ucmd!().args(&["-s", "0XB", "file"]).fails().stderr_contains("Invalid number: ‘0XB’"); - new_ucmd!().args(&["-s", "0B", "file"]).fails().stderr_contains("Invalid number: ‘0B’"); + new_ucmd!() + .args(&["-s", "0X", "file"]) + .fails() + .stderr_contains("Invalid number: ‘0X’"); + new_ucmd!() + .args(&["-s", "0XB", "file"]) + .fails() + .stderr_contains("Invalid number: ‘0XB’"); + new_ucmd!() + .args(&["-s", "0B", "file"]) + .fails() + .stderr_contains("Invalid number: ‘0B’"); } From fc29846b45e20956ed3ebb37b67aa172290767e2 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Thu, 20 May 2021 20:55:11 -0400 Subject: [PATCH 0636/1135] truncate: fix error message for file not found Change the error message for when the reference file (the `-r` argument) is not found to match GNU coreutils. This commit also eliminates a redundant call to `File::open`; the file need not be opened because the size in bytes can be read from the result of `std::fs::metadata()`. --- src/uu/truncate/src/truncate.rs | 14 ++++++++------ tests/by-util/test_truncate.rs | 8 ++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 3190e6ad4..c74171373 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -11,7 +11,8 @@ extern crate uucore; use clap::{App, Arg}; -use std::fs::{metadata, File, OpenOptions}; +use std::fs::{metadata, OpenOptions}; +use std::io::ErrorKind; use std::path::Path; #[derive(Eq, PartialEq)] @@ -174,13 +175,14 @@ fn truncate( TruncateMode::Reduce => (), _ => crash!(1, "you must specify a relative ‘--size’ with ‘--reference’"), }; - let _ = match File::open(Path::new(rfilename)) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f.to_string()), - }; match metadata(rfilename) { Ok(meta) => meta.len(), - Err(f) => crash!(1, "{}", f.to_string()), + Err(f) => match f.kind() { + ErrorKind::NotFound => { + crash!(1, "cannot stat '{}': No such file or directory", rfilename) + } + _ => crash!(1, "{}", f.to_string()), + }, } } None => 0, diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index b1f806f82..e14836fcf 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -245,3 +245,11 @@ fn test_invalid_numbers() { new_ucmd!().args(&["-s", "0XB", "file"]).fails().stderr_contains("Invalid number: ‘0XB’"); new_ucmd!().args(&["-s", "0B", "file"]).fails().stderr_contains("Invalid number: ‘0B’"); } + +#[test] +fn test_reference_file_not_found() { + new_ucmd!() + .args(&["-r", "a", "b"]) + .fails() + .stderr_contains("cannot stat 'a': No such file or directory"); +} From 17b95246cdcb4df0807af0aebcac19590837df57 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Thu, 20 May 2021 21:24:43 -0400 Subject: [PATCH 0637/1135] truncate: use min() and max() instead of if stmts --- src/uu/truncate/src/truncate.rs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 3190e6ad4..3fb1f2663 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -209,20 +209,8 @@ fn truncate( TruncateMode::Reference => fsize, TruncateMode::Extend => fsize + modsize, TruncateMode::Reduce => fsize - modsize, - TruncateMode::AtMost => { - if fsize > modsize { - modsize - } else { - fsize - } - } - TruncateMode::AtLeast => { - if fsize < modsize { - modsize - } else { - fsize - } - } + TruncateMode::AtMost => fsize.min(modsize), + TruncateMode::AtLeast => fsize.max(modsize), TruncateMode::RoundDown => fsize - fsize % modsize, TruncateMode::RoundUp => fsize + fsize % modsize, }; From a23555e857e89f1cd7a9c08429886b102e95f01a Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Thu, 20 May 2021 23:19:58 -0400 Subject: [PATCH 0638/1135] truncate: fix character used to indicate round up Fix a bug in which the incorrect character was being used to indicate "round up to the nearest multiple" mode. The character was "*" but it should be "%". This commit corrects that. --- src/uu/truncate/src/truncate.rs | 2 +- tests/by-util/test_truncate.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 3190e6ad4..7537987e0 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -147,7 +147,7 @@ fn truncate( '<' => TruncateMode::AtMost, '>' => TruncateMode::AtLeast, '/' => TruncateMode::RoundDown, - '*' => TruncateMode::RoundUp, + '%' => TruncateMode::RoundUp, _ => TruncateMode::Absolute, /* assume that the size is just a number */ }; diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index b1f806f82..7fa3df98c 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -206,7 +206,7 @@ fn test_round_up() { let (at, mut ucmd) = at_and_ucmd!(); let mut file = at.make_file(TFILE2); file.write_all(b"1234567890").unwrap(); - ucmd.args(&["--size", "*4", TFILE2]).succeeds(); + ucmd.args(&["--size", "%4", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); assert!( From 007e0a4e7f915989298278f0a777a63ab2af1185 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Thu, 20 May 2021 23:11:40 +0200 Subject: [PATCH 0639/1135] who/stat/pinky: adjust tests to be compatible with running on macOS A lot of tests depend on GNU's coreutils to be installed in order to obtain reference values during testing. In these cases testing is limited to `target_os = linux`. This PR installs GNU's coreutils on "github actions" and adjusts the tests for `who`, `stat` and `pinky` in order to be compatible with macOS. * `brew install coreutils` (prefix is 'g', e.g. `gwho`, `gstat`, etc. * switch paths for testing to something that's available on both OSs, e.g. `/boot` -> `/bin`, etc. * switch paths for testing to the macOS equivalent, e.g. `/dev/pts/ptmx` -> `/dev/ptmx`, etc. * exclude paths when no equivalent is available, e.g. `/proc`, `/etc/fstab`, etc. * refactor tests to make better use of the testing API * fix a warning in utmpx.rs to print to stderr instead of stdout * fix long_usage text in `who` * fix minor output formatting in `stat` * the `expected_result` function should be refactored to reduce duplicate code * more tests should be adjusted to not only run on `target_os = linux` --- src/uu/stat/src/stat.rs | 2 +- src/uu/who/src/who.rs | 7 +- src/uucore/src/lib/features/utmpx.rs | 4 +- tests/by-util/test_pinky.rs | 95 +++++++-------- tests/by-util/test_stat.rs | 127 +++++++++++--------- tests/by-util/test_who.rs | 168 +++++++++++++-------------- 6 files changed, 207 insertions(+), 196 deletions(-) diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 8b148d39d..5bb0e5f12 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -657,7 +657,7 @@ impl Stater { dst.to_string_lossy() ); } else { - arg = format!("`{}'", file); + arg = file.to_string(); } otype = OutputType::Str; } diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index aef23b3a2..1ae4f1c8d 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -46,9 +46,10 @@ fn get_usage() -> String { } fn get_long_usage() -> String { - String::from( - "If FILE is not specified, use /var/run/utmp. /var/log/wtmp as FILE is common.\n\ -If ARG1 ARG2 given, -m presumed: 'am i' or 'mom likes' are usual.", + format!( + "If FILE is not specified, use {}. /var/log/wtmp as FILE is common.\n\ + If ARG1 ARG2 given, -m presumed: 'am i' or 'mom likes' are usual.", + utmpx::DEFAULT_FILE, ) } diff --git a/src/uucore/src/lib/features/utmpx.rs b/src/uucore/src/lib/features/utmpx.rs index 96db33c35..826831ba6 100644 --- a/src/uucore/src/lib/features/utmpx.rs +++ b/src/uucore/src/lib/features/utmpx.rs @@ -54,6 +54,8 @@ pub unsafe extern "C" fn utmpxname(_file: *const libc::c_char) -> libc::c_int { 0 } +pub use crate::*; // import macros from `../../macros.rs` + // In case the c_char array doesn't end with NULL macro_rules! chars2string { ($arr:expr) => { @@ -240,7 +242,7 @@ impl UtmpxIter { utmpxname(cstr.as_ptr()) }; if res != 0 { - println!("Warning: {}", IOError::last_os_error()); + show_warning!("utmpxname: {}", IOError::last_os_error()); } unsafe { setutxent(); diff --git a/tests/by-util/test_pinky.rs b/tests/by-util/test_pinky.rs index 904a05f93..ccabb7345 100644 --- a/tests/by-util/test_pinky.rs +++ b/tests/by-util/test_pinky.rs @@ -20,42 +20,37 @@ fn test_long_format() { let ulogin = "root"; let pw: Passwd = Passwd::locate(ulogin).unwrap(); let real_name = pw.user_info().replace("&", &pw.name().capitalize()); - new_ucmd!().arg("-l").arg(ulogin).run().stdout_is(format!( - "Login name: {:<28}In real life: {}\nDirectory: {:<29}Shell: {}\n\n", - ulogin, - real_name, - pw.user_dir(), - pw.user_shell() - )); + new_ucmd!() + .arg("-l") + .arg(ulogin) + .succeeds() + .stdout_is(format!( + "Login name: {:<28}In real life: {}\nDirectory: {:<29}Shell: {}\n\n", + ulogin, + real_name, + pw.user_dir(), + pw.user_shell() + )); - new_ucmd!().arg("-lb").arg(ulogin).run().stdout_is(format!( - "Login name: {:<28}In real life: {1}\n\n", - ulogin, real_name - )); + new_ucmd!() + .arg("-lb") + .arg(ulogin) + .succeeds() + .stdout_is(format!( + "Login name: {:<28}In real life: {1}\n\n", + ulogin, real_name + )); } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_long_format_multiple_users() { - let scene = TestScenario::new(util_name!()); + let args = ["-l", "root", "root", "root"]; - let expected = scene - .cmd_keepenv(util_name!()) - .env("LANGUAGE", "C") - .arg("-l") - .arg("root") - .arg("root") - .arg("root") - .succeeds(); - - scene - .ucmd() - .arg("-l") - .arg("root") - .arg("root") - .arg("root") + new_ucmd!() + .args(&args) .succeeds() - .stdout_is(expected.stdout_str()); + .stdout_is(expected_result(&args)); } #[test] @@ -64,63 +59,53 @@ fn test_long_format_wo_user() { new_ucmd!().arg("-l").fails().code_is(1); } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_short_format_i() { // allow whitespace variation // * minor whitespace differences occur between platform built-in outputs; specifically, the number of trailing TABs may be variant let args = ["-i"]; - let actual = TestScenario::new(util_name!()) - .ucmd() - .args(&args) - .succeeds() - .stdout_move_str(); + let actual = new_ucmd!().args(&args).succeeds().stdout_move_str(); let expect = expected_result(&args); let v_actual: Vec<&str> = actual.split_whitespace().collect(); let v_expect: Vec<&str> = expect.split_whitespace().collect(); assert_eq!(v_actual, v_expect); } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_short_format_q() { // allow whitespace variation // * minor whitespace differences occur between platform built-in outputs; specifically, the number of trailing TABs may be variant let args = ["-q"]; - let actual = TestScenario::new(util_name!()) - .ucmd() - .args(&args) - .succeeds() - .stdout_move_str(); + let actual = new_ucmd!().args(&args).succeeds().stdout_move_str(); let expect = expected_result(&args); let v_actual: Vec<&str> = actual.split_whitespace().collect(); let v_expect: Vec<&str> = expect.split_whitespace().collect(); assert_eq!(v_actual, v_expect); } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_no_flag() { - let scene = TestScenario::new(util_name!()); - - let actual = scene.ucmd().succeeds().stdout_move_str(); - let expect = scene - .cmd_keepenv(util_name!()) - .env("LANGUAGE", "C") - .succeeds() - .stdout_move_str(); - + let actual = new_ucmd!().succeeds().stdout_move_str(); + let expect = expected_result(&[]); let v_actual: Vec<&str> = actual.split_whitespace().collect(); let v_expect: Vec<&str> = expect.split_whitespace().collect(); assert_eq!(v_actual, v_expect); } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] fn expected_result(args: &[&str]) -> String { - TestScenario::new(util_name!()) - .cmd_keepenv(util_name!()) + #[cfg(target_os = "linux")] + let util_name = util_name!(); + #[cfg(target_vendor = "apple")] + let util_name = format!("g{}", util_name!()); + + TestScenario::new(&util_name) + .cmd_keepenv(util_name) .env("LANGUAGE", "C") .args(args) - .run() + .succeeds() .stdout_move_str() } diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 308dcb9f5..44bce9cd8 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -96,10 +96,10 @@ fn test_invalid_option() { new_ucmd!().arg("-w").arg("-q").arg("/").fails(); } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_vendor = "apple"))] const NORMAL_FMTSTR: &'static str = "%a %A %b %B %d %D %f %F %g %G %h %i %m %n %o %s %u %U %x %X %y %Y %z %Z"; // avoid "%w %W" (birth/creation) due to `stat` limitations and linux kernel & rust version capability variations -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux"))] const DEV_FMTSTR: &'static str = "%a %A %b %B %d %D %f %F %g %G %h %i %m %n %o %s (%t/%T) %u %U %w %W %x %X %y %Y %z %Z"; #[cfg(target_os = "linux")] @@ -125,8 +125,8 @@ fn test_fs_format() { .stdout_is(expected_result(&args)); } +#[cfg(any(target_os = "linux", target_vendor = "apple"))] #[test] -#[cfg(target_os = "linux")] fn test_terse_normal_format() { // note: contains birth/creation date which increases test fragility // * results may vary due to built-in `stat` limitations as well as linux kernel and rust version capability variations @@ -156,10 +156,10 @@ fn test_terse_normal_format() { ); } +#[cfg(any(target_os = "linux", target_vendor = "apple"))] #[test] -#[cfg(target_os = "linux")] fn test_format_created_time() { - let args = ["-c", "%w", "/boot"]; + let args = ["-c", "%w", "/bin"]; let actual = new_ucmd!().args(&args).succeeds().stdout_move_str(); let expect = expected_result(&args); println!("actual: {:?}", actual); @@ -180,10 +180,10 @@ fn test_format_created_time() { ); } +#[cfg(any(target_os = "linux", target_vendor = "apple"))] #[test] -#[cfg(target_os = "linux")] fn test_format_created_seconds() { - let args = ["-c", "%W", "/boot"]; + let args = ["-c", "%W", "/bin"]; let actual = new_ucmd!().args(&args).succeeds().stdout_move_str(); let expect = expected_result(&args); println!("actual: {:?}", actual); @@ -204,79 +204,97 @@ fn test_format_created_seconds() { ); } +#[cfg(any(target_os = "linux", target_vendor = "apple"))] #[test] -#[cfg(target_os = "linux")] fn test_normal_format() { - let args = ["-c", NORMAL_FMTSTR, "/boot"]; + let args = ["-c", NORMAL_FMTSTR, "/bin"]; new_ucmd!() .args(&args) - .run() + .succeeds() .stdout_is(expected_result(&args)); } +#[cfg(any(target_os = "linux", target_vendor = "apple"))] #[test] -#[cfg(target_os = "linux")] -fn test_follow_symlink() { - let args = ["-L", "-c", DEV_FMTSTR, "/dev/cdrom"]; - new_ucmd!() - .args(&args) - .run() - .stdout_is(expected_result(&args)); +fn test_symlinks() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let mut tested: bool = false; + // arbitrarily chosen symlinks with hope that the CI environment provides at least one of them + for file in vec![ + "/bin/sh", + "/bin/sudoedit", + "/usr/bin/ex", + "/etc/localtime", + "/etc/aliases", + ] { + if at.file_exists(file) && at.is_symlink(file) { + tested = true; + let args = ["-c", NORMAL_FMTSTR, file]; + scene + .ucmd() + .args(&args) + .succeeds() + .stdout_is(expected_result(&args)); + // -L, --dereference follow links + let args = ["-L", "-c", NORMAL_FMTSTR, file]; + scene + .ucmd() + .args(&args) + .succeeds() + .stdout_is(expected_result(&args)); + } + } + if !tested { + panic!("No symlink found to test in this environment"); + } } +#[cfg(any(target_os = "linux", target_vendor = "apple"))] #[test] -#[cfg(target_os = "linux")] -fn test_symlink() { - let args = ["-c", DEV_FMTSTR, "/dev/cdrom"]; - new_ucmd!() - .args(&args) - .run() - .stdout_is(expected_result(&args)); -} - -#[test] -#[cfg(target_os = "linux")] fn test_char() { - let args = ["-c", DEV_FMTSTR, "/dev/pts/ptmx"]; + // TODO: "(%t) (%x) (%w)" deviate from GNU stat for `character special file` on macOS + // Diff < left / right > : + // <"(f0000) (2021-05-20 23:08:03.442555000 +0200) (1970-01-01 01:00:00.000000000 +0100)\n" + // >"(f) (2021-05-20 23:08:03.455598000 +0200) (-)\n" + let args = [ + "-c", + #[cfg(target_os = "linux")] + DEV_FMTSTR, + #[cfg(target_os = "linux")] + "/dev/pts/ptmx", + #[cfg(any(target_vendor = "apple"))] + "%a %A %b %B %d %D %f %F %g %G %h %i %m %n %o %s (/%T) %u %U %W %X %y %Y %z %Z", + #[cfg(any(target_vendor = "apple"))] + "/dev/ptmx", + ]; new_ucmd!() .args(&args) - .run() + .succeeds() .stdout_is(expected_result(&args)); } +#[cfg(any(target_os = "linux", target_vendor = "apple"))] #[test] -#[cfg(target_os = "linux")] fn test_multi_files() { let args = [ "-c", NORMAL_FMTSTR, "/dev", "/usr/lib", + #[cfg(target_os = "linux")] "/etc/fstab", "/var", ]; new_ucmd!() .args(&args) - .run() + .succeeds() .stdout_is(expected_result(&args)); } -#[cfg(any(target_os = "linux", target_os = "freebsd", target_vendor = "apple"))] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] -fn test_one_file() { - let (at, mut ucmd) = at_and_ucmd!(); - let file = "TEST_FILE.mp4"; - at.touch(file); - - ucmd.arg(file) - .succeeds() - .stdout_contains(format!("File: `{}'", file)) - .stdout_contains(format!("Size: 0")) - .stdout_contains(format!("Access: (0644/-rw-r--r--)")); -} - -#[test] -#[cfg(target_os = "linux")] fn test_printf() { let args = [ "--printf=123%-# 15q\\r\\\"\\\\\\a\\b\\e\\f\\v%+020.23m\\x12\\167\\132\\112\\n", @@ -284,16 +302,21 @@ fn test_printf() { ]; new_ucmd!() .args(&args) - .run() + .succeeds() .stdout_is(expected_result(&args)); } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] fn expected_result(args: &[&str]) -> String { - TestScenario::new(util_name!()) - .cmd_keepenv(util_name!()) + #[cfg(target_os = "linux")] + let util_name = util_name!(); + #[cfg(target_vendor = "apple")] + let util_name = format!("g{}", util_name!()); + + TestScenario::new(&util_name) + .cmd_keepenv(util_name) .env("LANGUAGE", "C") .args(args) - .run() + .succeeds() .stdout_move_str() } diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index a5637f23a..725ec0b1e 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -1,28 +1,28 @@ use crate::common::util::*; -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_count() { for opt in vec!["-q", "--count"] { new_ucmd!() .arg(opt) .succeeds() - .stdout_is(expected_result(opt)); + .stdout_is(expected_result(&[opt])); } } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_boot() { for opt in vec!["-b", "--boot"] { new_ucmd!() .arg(opt) .succeeds() - .stdout_is(expected_result(opt)); + .stdout_is(expected_result(&[opt])); } } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_heading() { for opt in vec!["-H", "--heading"] { @@ -30,7 +30,7 @@ fn test_heading() { // * minor whitespace differences occur between platform built-in outputs; // specifically number of TABs between "TIME" and "COMMENT" may be variant let actual = new_ucmd!().arg(opt).succeeds().stdout_move_str(); - let expect = expected_result(opt); + let expect = expected_result(&[opt]); println!("actual: {:?}", actual); println!("expect: {:?}", expect); let v_actual: Vec<&str> = actual.split_whitespace().collect(); @@ -39,205 +39,205 @@ fn test_heading() { } } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_short() { for opt in vec!["-s", "--short"] { new_ucmd!() .arg(opt) .succeeds() - .stdout_is(expected_result(opt)); + .stdout_is(expected_result(&[opt])); } } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_login() { for opt in vec!["-l", "--login"] { new_ucmd!() .arg(opt) .succeeds() - .stdout_is(expected_result(opt)); + .stdout_is(expected_result(&[opt])); } } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_m() { for opt in vec!["-m"] { new_ucmd!() .arg(opt) .succeeds() - .stdout_is(expected_result(opt)); + .stdout_is(expected_result(&[opt])); } } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_process() { for opt in vec!["-p", "--process"] { new_ucmd!() .arg(opt) .succeeds() - .stdout_is(expected_result(opt)); + .stdout_is(expected_result(&[opt])); } } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_runlevel() { for opt in vec!["-r", "--runlevel"] { new_ucmd!() .arg(opt) .succeeds() - .stdout_is(expected_result(opt)); + .stdout_is(expected_result(&[opt])); } } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_time() { for opt in vec!["-t", "--time"] { new_ucmd!() .arg(opt) .succeeds() - .stdout_is(expected_result(opt)); + .stdout_is(expected_result(&[opt])); } } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_mesg() { - for opt in vec!["-w", "-T", "--users", "--message", "--writable"] { + // -T, -w, --mesg + // add user's message status as +, - or ? + // --message + // same as -T + // --writable + // same as -T + for opt in vec!["-T", "-w", "--mesg", "--message", "--writable"] { new_ucmd!() .arg(opt) .succeeds() - .stdout_is(expected_result(opt)); + .stdout_is(expected_result(&[opt])); } } -#[cfg(target_os = "linux")] #[test] fn test_arg1_arg2() { - let scene = TestScenario::new(util_name!()); + let args = ["am", "i"]; - let expected = scene - .cmd_keepenv(util_name!()) - .env("LANGUAGE", "C") - .arg("am") - .arg("i") - .succeeds(); - - scene - .ucmd() - .arg("am") - .arg("i") + new_ucmd!() + .args(&args) .succeeds() - .stdout_is(expected.stdout_str()); + .stdout_is(expected_result(&args)); } #[test] fn test_too_many_args() { - let expected = + const EXPECTED: &str = "error: The value 'u' was provided to '...', but it wasn't expecting any more values"; - new_ucmd!() - .arg("am") - .arg("i") - .arg("u") - .fails() - .stderr_contains(expected); + let args = ["am", "i", "u"]; + new_ucmd!().args(&args).fails().stderr_contains(EXPECTED); } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_users() { for opt in vec!["-u", "--users"] { - new_ucmd!() - .arg(opt) - .succeeds() - .stdout_is(expected_result(opt)); + let actual = new_ucmd!().arg(opt).succeeds().stdout_move_str(); + let expect = expected_result(&[opt]); + println!("actual: {:?}", actual); + println!("expect: {:?}", expect); + + let mut v_actual: Vec<&str> = actual.split_whitespace().collect(); + let mut v_expect: Vec<&str> = expect.split_whitespace().collect(); + + // TODO: `--users` differs from GNU's output on manOS running in CI + // Diff < left / right > : + // <"runner console 2021-05-20 22:03 00:08 196\n" + // >"runner console 2021-05-20 22:03 old 196\n" + if is_ci() && cfg!(target_os = "macos") { + v_actual.remove(4); + v_expect.remove(4); + } + + assert_eq!(v_actual, v_expect); } } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_lookup() { for opt in vec!["--lookup"] { new_ucmd!() .arg(opt) .succeeds() - .stdout_is(expected_result(opt)); + .stdout_is(expected_result(&[opt])); } } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_dead() { for opt in vec!["-d", "--dead"] { new_ucmd!() .arg(opt) .succeeds() - .stdout_is(expected_result(opt)); + .stdout_is(expected_result(&[opt])); } } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_all_separately() { + if is_ci() && cfg!(target_os = "macos") { + // TODO: fix `-u`, see: test_users + return; + } + // -a, --all same as -b -d --login -p -r -t -T -u + let args = ["-b", "-d", "--login", "-p", "-r", "-t", "-T", "-u"]; let scene = TestScenario::new(util_name!()); - - let expected = scene - .cmd_keepenv(util_name!()) - .env("LANGUAGE", "C") - .arg("-b") - .arg("-d") - .arg("--login") - .arg("-p") - .arg("-r") - .arg("-t") - .arg("-T") - .arg("-u") - .succeeds(); - scene .ucmd() - .arg("-b") - .arg("-d") - .arg("--login") - .arg("-p") - .arg("-r") - .arg("-t") - .arg("-T") - .arg("-u") + .args(&args) .succeeds() - .stdout_is(expected.stdout_str()); - + .stdout_is(expected_result(&args)); scene .ucmd() .arg("--all") .succeeds() - .stdout_is(expected.stdout_str()); + .stdout_is(expected_result(&args)); } -#[cfg(target_os = "linux")] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_all() { + if is_ci() && cfg!(target_os = "macos") { + // TODO: fix `-u`, see: test_users + return; + } + for opt in vec!["-a", "--all"] { new_ucmd!() .arg(opt) .succeeds() - .stdout_is(expected_result(opt)); + .stdout_is(expected_result(&[opt])); } } -#[cfg(target_os = "linux")] -fn expected_result(arg: &str) -> String { - TestScenario::new(util_name!()) - .cmd_keepenv(util_name!()) +#[cfg(any(target_vendor = "apple", target_os = "linux"))] +fn expected_result(args: &[&str]) -> String { + #[cfg(target_os = "linux")] + let util_name = util_name!(); + #[cfg(target_vendor = "apple")] + let util_name = format!("g{}", util_name!()); + + TestScenario::new(&util_name) + .cmd_keepenv(util_name) .env("LANGUAGE", "C") - .args(&[arg]) + .args(args) .succeeds() .stdout_move_str() } From 6ed080cf97d7bece6163a190bc07b0179d90f5ac Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 21 May 2021 12:39:48 +0200 Subject: [PATCH 0640/1135] CICD: install GNU coreutils on macOS (Code Coverage) --- .github/workflows/CICD.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index a42d2f335..bb29355cf 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -489,6 +489,13 @@ jobs: - { os: windows-latest , features: windows } steps: - uses: actions/checkout@v1 + - 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 From 0dafbfccca27154b6c831fed0338c1c54da63e3d Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 21 May 2021 13:30:24 +0200 Subject: [PATCH 0641/1135] CI-Trigger From 73b47b8c765284f7cc1586a46358e86eb56ae22a Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 21 May 2021 13:27:35 +0200 Subject: [PATCH 0642/1135] gnu/ci: install the dep into a separate task --- .github/workflows/GNU.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index a72cb0cfc..57730aee7 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -32,11 +32,14 @@ jobs: default: true profile: minimal # minimal component installation (ie, no documentation) components: rustfmt - - name: Build binaries + - name: Install deps shell: bash run: | sudo apt-get update sudo apt-get install autoconf autopoint bison texinfo gperf gcc g++ gdb python-pyinotify python3-sphinx jq + - name: Build binaries + shell: bash + run: | pushd uutils make PROFILE=release BUILDDIR="$PWD/target/release/" From 414c92eed79d5b8687db332e84c6d67f9b2b2593 Mon Sep 17 00:00:00 2001 From: Anup Mahindre Date: Fri, 21 May 2021 22:04:24 +0530 Subject: [PATCH 0643/1135] ls: Fix printing paths behavior For any commandline arguments, ls should print the argument as is (and not truncate to just the file name) For any other files it reaches (say through recursive exploration), ls should print just the filename (as path is printed once when we enter the directory) --- src/uu/ls/src/ls.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index c5389295b..d467d431a 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1110,7 +1110,7 @@ struct PathData { md: OnceCell>, ft: OnceCell>, // Name of the file - will be empty for . or .. - file_name: String, + display_name: String, // PathBuf that all above data corresponds to p_buf: PathBuf, must_dereference: bool, @@ -1126,14 +1126,18 @@ impl PathData { ) -> Self { // We cannot use `Path::ends_with` or `Path::Components`, because they remove occurrences of '.' // For '..', the filename is None - let name = if let Some(name) = file_name { + let display_name = if let Some(name) = file_name { name } else { - p_buf - .file_name() - .unwrap_or_else(|| p_buf.iter().next_back().unwrap()) - .to_string_lossy() - .into_owned() + let display_osstr = if command_line { + p_buf.as_os_str() + } else { + p_buf + .file_name() + .unwrap_or_else(|| p_buf.iter().next_back().unwrap()) + }; + + display_osstr.to_string_lossy().into_owned() }; let must_dereference = match &config.dereference { Dereference::All => true, @@ -1159,7 +1163,7 @@ impl PathData { Self { md: OnceCell::new(), ft, - file_name: name, + display_name, p_buf, must_dereference, } @@ -1243,7 +1247,7 @@ fn sort_entries(entries: &mut Vec, config: &Config) { entries.sort_by_key(|k| Reverse(k.md().as_ref().map(|md| md.len()).unwrap_or(0))) } // The default sort in GNU ls is case insensitive - Sort::Name => entries.sort_by(|a, b| a.file_name.cmp(&b.file_name)), + Sort::Name => entries.sort_by(|a, b| a.display_name.cmp(&b.display_name)), Sort::Version => entries.sort_by(|a, b| version_cmp::version_cmp(&a.p_buf, &b.p_buf)), Sort::Extension => entries.sort_by(|a, b| { a.p_buf @@ -1719,7 +1723,7 @@ fn classify_file(path: &PathData) -> Option { } fn display_file_name(path: &PathData, config: &Config) -> Option { - let mut name = escape_name(&path.file_name, &config.quoting_style); + let mut name = escape_name(&path.display_name, &config.quoting_style); #[cfg(unix)] { From 31545258ac6b6ef11ef8c04f2564825e08f7ad50 Mon Sep 17 00:00:00 2001 From: Anup Mahindre Date: Fri, 21 May 2021 22:20:54 +0530 Subject: [PATCH 0644/1135] tests: Fix test_ls_path --- tests/by-util/test_ls.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 8d32172b0..fc4051039 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1967,8 +1967,6 @@ fn test_ls_sort_extension() { ); } -// This tests for the open issue described in #2223 -#[cfg_attr(not(feature = "test_unimplemented"), ignore)] #[test] fn test_ls_path() { let scene = TestScenario::new(util_name!()); @@ -1987,13 +1985,17 @@ fn test_ls_path() { scene.ucmd().arg(path).run().stdout_is(expected_stdout); let expected_stdout = &format!("./{}\n", path); - scene.ucmd().arg(path).run().stdout_is(expected_stdout); + scene + .ucmd() + .arg(format!("./{}", path)) + .run() + .stdout_is(expected_stdout); - let abs_path = format!("{}/{}\n", at.as_string(), path); - println!(":{}", abs_path); - scene.ucmd().arg(&abs_path).run().stdout_is(&abs_path); + let abs_path = format!("{}/{}", at.as_string(), path); + let expected_stdout = &format!("{}\n", abs_path); + scene.ucmd().arg(&abs_path).run().stdout_is(expected_stdout); - let expected_stdout = &format!("{}\n{}\n", file1, path); + let expected_stdout = &format!("{}\n{}\n", path, file1); scene .ucmd() .arg(file1) From e7da8058dc27dc106af66b206318faeec6cf9938 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 21 May 2021 23:00:13 +0200 Subject: [PATCH 0645/1135] sort: automatically fall back to extsort To make this work we make default sort a special case of external sort. External sorting uses auxiliary files for intermediate chunks. However, when we can keep our intermediate chunks in memory, we don't write them to the file system at all. Only when we notice that we can't keep them in memory they are written to the disk. Additionally, we don't allocate buffers with the capacity of their maximum size anymore. Instead, they start with a capacity of 8kb and are grown only when needed. This makes sorting smaller files about as fast as it was before (I'm seeing a regression of ~3%), and allows us to seamlessly continue with auxiliary files when needed. --- src/uu/sort/BENCHMARKING.md | 3 +- src/uu/sort/src/check.rs | 1 + src/uu/sort/src/chunks.rs | 39 ++++++++++++-- src/uu/sort/src/ext_sort.rs | 105 +++++++++++++++++++++++++----------- src/uu/sort/src/merge.rs | 1 + src/uu/sort/src/sort.rs | 68 ++++++----------------- tests/by-util/test_sort.rs | 33 ++++-------- 7 files changed, 138 insertions(+), 112 deletions(-) diff --git a/src/uu/sort/BENCHMARKING.md b/src/uu/sort/BENCHMARKING.md index 52866719d..fd728c41d 100644 --- a/src/uu/sort/BENCHMARKING.md +++ b/src/uu/sort/BENCHMARKING.md @@ -72,7 +72,8 @@ Run `cargo build --release` before benchmarking after you make a change! ## External sorting Try running commands with the `-S` option set to an amount of memory to be used, such as `1M`. Additionally, you could try sorting -huge files (ideally multiple Gigabytes) with `-S`. Creating such a large file can be achieved by running `cat shuffled_wordlist.txt | sort -R >> shuffled_wordlist.txt` +huge files (ideally multiple Gigabytes) with `-S` (or without `-S` to benchmark with our default value). +Creating such a large file can be achieved by running `cat shuffled_wordlist.txt | sort -R >> shuffled_wordlist.txt` multiple times (this will add the contents of `shuffled_wordlist.txt` to itself). Example: Run `hyperfine './target/release/coreutils sort shuffled_wordlist.txt -S 1M' 'sort shuffled_wordlist.txt -S 1M'` diff --git a/src/uu/sort/src/check.rs b/src/uu/sort/src/check.rs index fe815b624..01b5a25b5 100644 --- a/src/uu/sort/src/check.rs +++ b/src/uu/sort/src/check.rs @@ -87,6 +87,7 @@ fn reader( chunks::read( &mut sender, recycled_buffer, + None, &mut carry_over, &mut file, &mut iter::empty(), diff --git a/src/uu/sort/src/chunks.rs b/src/uu/sort/src/chunks.rs index c679980ec..7a7749003 100644 --- a/src/uu/sort/src/chunks.rs +++ b/src/uu/sort/src/chunks.rs @@ -52,13 +52,20 @@ impl Chunk { /// Read a chunk, parse lines and send them. /// -/// No empty chunk will be sent. +/// No empty chunk will be sent. If we reach the end of the input, sender_option +/// is set to None. If this function however does not set sender_option to None, +/// it is not guaranteed that there is still input left: If the input fits _exactly_ +/// into a buffer, we will only notice that there's nothing more to read at the next +/// invocation. /// /// # Arguments /// -/// * `sender_option`: The sender to send the lines to the sorter. If `None`, does nothing. +/// (see also `read_to_chunk` for a more detailed documentation) +/// +/// * `sender_option`: The sender to send the lines to the sorter. If `None`, this function does nothing. /// * `buffer`: The recycled buffer. All contents will be overwritten, but it must already be filled. /// (i.e. `buffer.len()` should be equal to `buffer.capacity()`) +/// * `max_buffer_size`: How big `buffer` can be. /// * `carry_over`: The bytes that must be carried over in between invocations. /// * `file`: The current file. /// * `next_files`: What `file` should be updated to next. @@ -69,6 +76,7 @@ impl Chunk { pub fn read( sender_option: &mut Option>, mut buffer: Vec, + max_buffer_size: Option, carry_over: &mut Vec, file: &mut Box, next_files: &mut impl Iterator>, @@ -82,8 +90,14 @@ pub fn read( buffer.resize(carry_over.len() + 10 * 1024, 0); } buffer[..carry_over.len()].copy_from_slice(&carry_over); - let (read, should_continue) = - read_to_buffer(file, next_files, &mut buffer, carry_over.len(), separator); + let (read, should_continue) = read_to_buffer( + file, + next_files, + &mut buffer, + max_buffer_size, + carry_over.len(), + separator, + ); carry_over.clear(); carry_over.extend_from_slice(&buffer[read..]); @@ -138,7 +152,8 @@ fn parse_lines<'a>( /// * `next_files`: When `file` reaches EOF, it is updated to `next_files.next()` if that is `Some`, /// and this function continues reading. /// * `buffer`: The buffer that is filled with bytes. Its contents will mostly be overwritten (see `start_offset` -/// as well). It will not be grown by default, unless that is necessary to read at least two lines. +/// as well). It will be grown up to `max_buffer_size` if necessary, but it will always grow to read at least two lines. +/// * `max_buffer_size`: Grow the buffer to at most this length. If None, the buffer will not grow, unless needed to read at least two lines. /// * `start_offset`: The amount of bytes at the start of `buffer` that were carried over /// from the previous read and should not be overwritten. /// * `separator`: The byte that separates lines. @@ -153,6 +168,7 @@ fn read_to_buffer( file: &mut Box, next_files: &mut impl Iterator>, buffer: &mut Vec, + max_buffer_size: Option, start_offset: usize, separator: u8, ) -> (usize, bool) { @@ -162,6 +178,19 @@ fn read_to_buffer( Ok(0) => { if read_target.is_empty() { // chunk is full + if let Some(max_buffer_size) = max_buffer_size { + if max_buffer_size > buffer.len() { + // we can grow the buffer + let prev_len = buffer.len(); + if buffer.len() < max_buffer_size / 2 { + buffer.resize(buffer.len() * 2, 0); + } else { + buffer.resize(max_buffer_size, 0); + } + read_target = &mut buffer[prev_len..]; + continue; + } + } let mut sep_iter = memchr_iter(separator, &buffer).rev(); let last_line_end = sep_iter.next(); if sep_iter.next().is_some() { diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs index 629ebb714..a304bf7c0 100644 --- a/src/uu/sort/src/ext_sort.rs +++ b/src/uu/sort/src/ext_sort.rs @@ -5,12 +5,13 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -//! Sort big files by using files for storing intermediate chunks. +//! Sort big files by using auxiliary files for storing intermediate chunks. //! //! Files are read into chunks of memory which are then sorted individually and //! written to temporary files. There are two threads: One sorter, and one reader/writer. //! The buffers for the individual chunks are recycled. There are two buffers. +use std::cmp::Ordering; use std::io::{BufWriter, Write}; use std::path::Path; use std::{ @@ -20,30 +21,19 @@ use std::{ thread, }; +use itertools::Itertools; + use tempdir::TempDir; use crate::{ chunks::{self, Chunk}, - merge::{self, FileMerger}, - sort_by, GlobalSettings, + compare_by, merge, output_sorted_lines, sort_by, GlobalSettings, }; -/// Iterator that wraps the -pub struct ExtSortedMerger<'a> { - pub file_merger: FileMerger<'a>, - // Keep _tmp_dir around, as it is deleted when dropped. - _tmp_dir: TempDir, -} +const MIN_BUFFER_SIZE: usize = 8_000; -/// Sort big files by using files for storing intermediate chunks. -/// -/// # Returns -/// -/// An iterator that merges intermediate files back together. -pub fn ext_sort<'a>( - files: &mut impl Iterator>, - settings: &'a GlobalSettings, -) -> ExtSortedMerger<'a> { +/// Sort files by using auxiliary files for storing intermediate chunks (if needed), and output the result. +pub fn ext_sort(files: &mut impl Iterator>, settings: &GlobalSettings) { let tmp_dir = crash_if_err!(1, TempDir::new_in(&settings.tmp_dir, "uutils_sort")); let (sorted_sender, sorted_receiver) = std::sync::mpsc::sync_channel(1); let (recycled_sender, recycled_receiver) = std::sync::mpsc::sync_channel(1); @@ -51,7 +41,7 @@ pub fn ext_sort<'a>( let settings = settings.clone(); move || sorter(recycled_receiver, sorted_sender, settings) }); - let chunks_read = reader_writer( + let read_result = reader_writer( files, &tmp_dir, if settings.zero_terminated { @@ -66,13 +56,29 @@ pub fn ext_sort<'a>( sorted_receiver, recycled_sender, ); - let files = (0..chunks_read) - .map(|chunk_num| tmp_dir.path().join(chunk_num.to_string())) - .collect::>(); - - ExtSortedMerger { - file_merger: merge::merge(&files, settings), - _tmp_dir: tmp_dir, + match read_result { + ReadResult::WroteChunksToFile { chunks_written } => { + let files = (0..chunks_written) + .map(|chunk_num| tmp_dir.path().join(chunk_num.to_string())) + .collect::>(); + let mut merger = merge::merge(&files, settings); + merger.write_all(settings); + } + ReadResult::SortedSingleChunk(chunk) => { + output_sorted_lines(chunk.borrow_lines().iter(), settings); + } + ReadResult::SortedTwoChunks([a, b]) => { + let merged_iter = a + .borrow_lines() + .iter() + .merge_by(b.borrow_lines().iter(), |line_a, line_b| { + compare_by(line_a, line_b, settings) != Ordering::Greater + }); + output_sorted_lines(merged_iter, settings); + } + ReadResult::EmptyInput => { + // don't output anything + } } } @@ -84,6 +90,21 @@ fn sorter(receiver: Receiver, sender: SyncSender, settings: Global } } +/// Describes how we read the chunks from the input. +enum ReadResult { + /// The input was empty. Nothing was read. + EmptyInput, + /// The input fits into a single Chunk, which was kept in memory. + SortedSingleChunk(Chunk), + /// The input fits into two chunks, which were kept in memory. + SortedTwoChunks([Chunk; 2]), + /// The input was read into multiple chunks, which were written to auxiliary files. + WroteChunksToFile { + /// The number of chunks written to auxiliary files. + chunks_written: usize, + }, +} + /// The function that is executed on the reader/writer thread. /// /// # Returns @@ -96,7 +117,7 @@ fn reader_writer( settings: GlobalSettings, receiver: Receiver, sender: SyncSender, -) -> usize { +) -> ReadResult { let mut sender_option = Some(sender); let mut file = files.next().unwrap(); @@ -106,21 +127,40 @@ fn reader_writer( for _ in 0..2 { chunks::read( &mut sender_option, - vec![0; buffer_size], + vec![0; MIN_BUFFER_SIZE], + Some(buffer_size), &mut carry_over, &mut file, &mut files, separator, Vec::new(), &settings, - ) + ); + if sender_option.is_none() { + // We have already read the whole input. Since we are in our first two reads, + // this means that we can fit the whole input into memory. Bypass writing below and + // handle this case in a more straightforward way. + return if let Ok(first_chunk) = receiver.recv() { + if let Ok(second_chunk) = receiver.recv() { + ReadResult::SortedTwoChunks([first_chunk, second_chunk]) + } else { + ReadResult::SortedSingleChunk(first_chunk) + } + } else { + ReadResult::EmptyInput + }; + } } let mut file_number = 0; loop { let mut chunk = match receiver.recv() { Ok(it) => it, - _ => return file_number, + _ => { + return ReadResult::WroteChunksToFile { + chunks_written: file_number, + } + } }; write( @@ -129,13 +169,14 @@ fn reader_writer( separator, ); - let (recycled_lines, recycled_buffer) = chunk.recycle(); - file_number += 1; + let (recycled_lines, recycled_buffer) = chunk.recycle(); + chunks::read( &mut sender_option, recycled_buffer, + None, &mut carry_over, &mut file, &mut files, diff --git a/src/uu/sort/src/merge.rs b/src/uu/sort/src/merge.rs index 6f7cdfed7..48d48ad40 100644 --- a/src/uu/sort/src/merge.rs +++ b/src/uu/sort/src/merge.rs @@ -108,6 +108,7 @@ fn reader( chunks::read( sender, recycled_buffer, + None, carry_over, file, &mut iter::empty(), diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index b6ab5a2b1..78388a298 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -93,7 +93,10 @@ static THOUSANDS_SEP: char = ','; static NEGATIVE: char = '-'; static POSITIVE: char = '+'; -static DEFAULT_BUF_SIZE: usize = std::usize::MAX; +/// Choosing a higher buffer size does not result in performance improvements +/// (at least not on my machine). TODO: In the future, we should also take the amount of +/// available memory into consideration, instead of relying on this constant only. +static DEFAULT_BUF_SIZE: usize = 1_000_000_000; #[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy)] enum SortMode { @@ -127,7 +130,6 @@ pub struct GlobalSettings { zero_terminated: bool, buffer_size: usize, tmp_dir: PathBuf, - ext_sort: bool, } impl GlobalSettings { @@ -189,7 +191,6 @@ impl Default for GlobalSettings { zero_terminated: false, buffer_size: DEFAULT_BUF_SIZE, tmp_dir: PathBuf::new(), - ext_sort: false, } } } @@ -941,28 +942,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { env::set_var("RAYON_NUM_THREADS", &settings.threads); } - if matches.is_present(OPT_BUF_SIZE) { - settings.buffer_size = { - let input = matches - .value_of(OPT_BUF_SIZE) - .map(String::from) - .unwrap_or(format!("{}", DEFAULT_BUF_SIZE)); + settings.buffer_size = matches + .value_of(OPT_BUF_SIZE) + .map(GlobalSettings::human_numeric_convert) + .unwrap_or(DEFAULT_BUF_SIZE); - GlobalSettings::human_numeric_convert(&input) - }; - settings.ext_sort = true; - } - - if matches.is_present(OPT_TMP_DIR) { - let result = matches - .value_of(OPT_TMP_DIR) - .map(String::from) - .unwrap_or(format!("{}", env::temp_dir().display())); - settings.tmp_dir = PathBuf::from(result); - settings.ext_sort = true; - } else { - settings.tmp_dir = env::temp_dir(); - } + settings.tmp_dir = matches + .value_of(OPT_TMP_DIR) + .map(PathBuf::from) + .unwrap_or_else(env::temp_dir); settings.zero_terminated = matches.is_present(OPT_ZERO_TERMINATED); settings.merge = matches.is_present(OPT_MERGE); @@ -1047,7 +1035,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { exec(&files, &settings) } -fn output_sorted_lines<'a>(iter: impl Iterator>, settings: &GlobalSettings) { +fn output_sorted_lines<'a>(iter: impl Iterator>, settings: &GlobalSettings) { if settings.unique { print_sorted( iter.dedup_by(|a, b| compare_by(a, b, &settings) == Ordering::Equal), @@ -1067,34 +1055,10 @@ fn exec(files: &[String], settings: &GlobalSettings) -> i32 { crash!(1, "only one file allowed with -c"); } return check::check(files.first().unwrap(), settings); - } else if settings.ext_sort { + } else { let mut lines = files.iter().filter_map(open); - let mut sorted = ext_sort(&mut lines, &settings); - sorted.file_merger.write_all(settings); - } else { - let separator = if settings.zero_terminated { '\0' } else { '\n' }; - let mut lines = vec![]; - let mut full_string = String::new(); - - for mut file in files.iter().filter_map(open) { - crash_if_err!(1, file.read_to_string(&mut full_string)); - - if !full_string.ends_with(separator) { - full_string.push(separator); - } - } - - if full_string.ends_with(separator) { - full_string.pop(); - } - - for line in full_string.split(if settings.zero_terminated { '\0' } else { '\n' }) { - lines.push(Line::create(line, &settings)); - } - - sort_by(&mut lines, &settings); - output_sorted_lines(lines.into_iter(), &settings); + ext_sort(&mut lines, &settings); } 0 } @@ -1366,7 +1330,7 @@ fn version_compare(a: &str, b: &str) -> Ordering { } } -fn print_sorted<'a, T: Iterator>>(iter: T, settings: &GlobalSettings) { +fn print_sorted<'a, T: Iterator>>(iter: T, settings: &GlobalSettings) { let mut writer = settings.out_writer(); for line in iter { line.print(&mut writer, settings); diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index e89d18054..59058d5bc 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -15,29 +15,18 @@ fn test_helper(file_name: &str, args: &str) { .stdout_is_fixture(format!("{}.expected.debug", file_name)); } -// FYI, the initialization size of our Line struct is 96 bytes. -// -// At very small buffer sizes, with that overhead we are certainly going -// to overrun our buffer way, way, way too quickly because of these excess -// bytes for the struct. -// -// For instance, seq 0..20000 > ...text = 108894 bytes -// But overhead is 1920000 + 108894 = 2028894 bytes -// -// Or kjvbible-random.txt = 4332506 bytes, but minimum size of its -// 99817 lines in memory * 96 bytes = 9582432 bytes -// -// Here, we test 108894 bytes with a 50K buffer -// #[test] -fn test_larger_than_specified_segment() { - new_ucmd!() - .arg("-n") - .arg("-S") - .arg("50K") - .arg("ext_sort.txt") - .succeeds() - .stdout_is_fixture("ext_sort.expected"); +fn test_buffer_sizes() { + let buffer_sizes = ["0", "50K", "1M", "1000G"]; + for buffer_size in &buffer_sizes { + new_ucmd!() + .arg("-n") + .arg("-S") + .arg(buffer_size) + .arg("ext_sort.txt") + .succeeds() + .stdout_is_fixture("ext_sort.expected"); + } } #[test] From adaba5402691ee1286abc4ce8be7dd8f66862aa7 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 21 May 2021 18:25:23 +0200 Subject: [PATCH 0646/1135] gnu/ci: move the operations into script to run them locally --- .github/workflows/GNU.yml | 79 ++--------------------------------- util/build-gnu.sh | 86 +++++++++++++++++++++++++++++++++++++++ util/run-gnu-test.sh | 7 ++++ 3 files changed, 96 insertions(+), 76 deletions(-) create mode 100644 util/build-gnu.sh create mode 100644 util/run-gnu-test.sh diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 57730aee7..c94902bbc 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -40,85 +40,12 @@ jobs: - name: Build binaries shell: bash run: | - pushd uutils - make PROFILE=release - BUILDDIR="$PWD/target/release/" - cp "${BUILDDIR}/install" "${BUILDDIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target - # Create *sum binaries - for sum in b2sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum - do - sum_path="${BUILDDIR}/${sum}" - test -f "${sum_path}" || cp "${BUILDDIR}/hashsum" "${sum_path}" - done - test -f "${BUILDDIR}/[" || cp "${BUILDDIR}/test" "${BUILDDIR}/[" - popd - GNULIB_SRCDIR="$PWD/gnulib" - pushd gnu/ - - # Any binaries that aren't built become `false` so their tests fail - for binary in $(./build-aux/gen-lists-of-programs.sh --list-progs) - do - bin_path="${BUILDDIR}/${binary}" - test -f "${bin_path}" || { echo "'${binary}' was not built with uutils, using the 'false' program"; cp "${BUILDDIR}/false" "${bin_path}"; } - done - - ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" - ./configure --quiet --disable-gcc-warnings - #Add timeout to to protect against hangs - sed -i 's|"\$@|/usr/bin/timeout 600 "\$@|' build-aux/test-driver - # Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils - sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile - sed -i 's| tr | /usr/bin/tr |' tests/init.sh - make - # Generate the factor tests, so they can be fixed - for i in {00..36} - do - make tests/factor/t${i}.sh - done - grep -rl 'path_prepend_' tests/* | xargs sed -i 's|path_prepend_ ./src||' - sed -i -e 's|^seq |/usr/bin/seq |' -e 's|sha1sum |/usr/bin/sha1sum |' tests/factor/t*sh - - # Remove tests checking for --version & --help - # Not really interesting for us and logs are too big - sed -i -e '/tests\/misc\/invalid-opt.pl/ D' \ - -e '/tests\/misc\/help-version.sh/ D' \ - -e '/tests\/misc\/help-version-getopt.sh/ D' \ - Makefile - - # printf doesn't limit the values used in its arg, so this produced ~2GB of output - sed -i '/INT_OFLOW/ D' tests/misc/printf.sh - - # Use the system coreutils where the test fails due to error in a util that is not the one being tested - sed -i 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh - sed -i 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh tests/du/8gb.sh - sed -i 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i 's|timeout \([[:digit:]]\)| /usr/bin/timeout \1|' tests/tail-2/inotify-rotate.sh tests/tail-2/inotify-dir-recreate.sh tests/tail-2/inotify-rotate-resources.sh tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh tests/tail-2/follow-name.sh tests/misc/shuf.sh # Don't break the function called 'grep_timeout' - sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh tests/tail-2/tail-n0f.sh tests/cp/fail-perm.sh tests/du/inaccessible-cwd.sh tests/mv/i-2.sh tests/chgrp/basic.sh tests/misc/shuf.sh - sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/misc/test-N.sh - sed -i 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh - sed -i 's|truncate |/usr/bin/truncate |' tests/split/fail.sh - sed -i 's|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh init.cfg - sed -i 's|id -|/usr/bin/id -|' tests/misc/runcon-no-reorder.sh - sed -i 's|touch |/usr/bin/touch |' tests/cp/preserve-link.sh tests/cp/reflink-perm.sh tests/ls/block-size.sh tests/ls/abmon-align.sh tests/ls/rt-1.sh tests/mv/update.sh tests/misc/ls-time.sh tests/misc/stat-nanoseconds.sh tests/misc/time-style.sh tests/misc/test-N.sh - sed -i 's|ln -|/usr/bin/ln -|' tests/cp/link-deref.sh - sed -i 's|printf |/usr/bin/printf |' tests/dd/ascii.sh - sed -i 's|cp |/usr/bin/cp |' tests/mv/hard-2.sh - sed -i 's|paste |/usr/bin/paste |' tests/misc/od-endian.sh - sed -i 's|seq |/usr/bin/seq |' tests/misc/sort-discrim.sh - - #Add specific timeout to tests that currently hang to limit time spent waiting - sed -i 's|seq \$|/usr/bin/timeout 0.1 seq \$|' tests/misc/seq-precision.sh tests/misc/seq-long-double.sh - sed -i 's|cat |/usr/bin/timeout 0.1 cat |' tests/misc/cat-self.sh - - test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" + cd uutils + bash util/build-gnu.sh - name: Run GNU tests shell: bash run: | - BUILDDIR="${PWD}/uutils/target/release" - GNULIB_DIR="${PWD}/gnulib" - pushd gnu - - timeout -sKILL 2h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make + bash uutils/util/run-gnu-test.sh - name: Extract tests info shell: bash run: | diff --git a/util/build-gnu.sh b/util/build-gnu.sh new file mode 100644 index 000000000..667dc8e46 --- /dev/null +++ b/util/build-gnu.sh @@ -0,0 +1,86 @@ +#!/bin/bash +set -e +if test ! -d ../gnu; then + echo "Could not find ../gnu" + echo "git clone git@github.com:coreutils/coreutils.git ../gnu" + exit 1 +fi +if test ! -d ../gnulib; then + echo "Could not find ../gnulib" + echo "git clone git@github.com:coreutils/gnulib.git ../gnulib" + exit 1 +fi + + +pushd $(pwd) +make PROFILE=release +BUILDDIR="$PWD/target/release/" +cp "${BUILDDIR}/install" "${BUILDDIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target +# Create *sum binaries +for sum in b2sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum +do + sum_path="${BUILDDIR}/${sum}" + test -f "${sum_path}" || cp "${BUILDDIR}/hashsum" "${sum_path}" +done +test -f "${BUILDDIR}/[" || cp "${BUILDDIR}/test" "${BUILDDIR}/[" +popd +GNULIB_SRCDIR="$PWD/../gnulib" +pushd ../gnu/ + +# Any binaries that aren't built become `false` so their tests fail +for binary in $(./build-aux/gen-lists-of-programs.sh --list-progs) +do + bin_path="${BUILDDIR}/${binary}" + test -f "${bin_path}" || { echo "'${binary}' was not built with uutils, using the 'false' program"; cp "${BUILDDIR}/false" "${bin_path}"; } +done + +./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" +./configure --quiet --disable-gcc-warnings +#Add timeout to to protect against hangs +sed -i 's|"\$@|/usr/bin/timeout 600 "\$@|' build-aux/test-driver +# Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils +sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile +sed -i 's| tr | /usr/bin/tr |' tests/init.sh +make +# Generate the factor tests, so they can be fixed +for i in {00..36} +do + make tests/factor/t${i}.sh +done +grep -rl 'path_prepend_' tests/* | xargs sed -i 's|path_prepend_ ./src||' +sed -i -e 's|^seq |/usr/bin/seq |' -e 's|sha1sum |/usr/bin/sha1sum |' tests/factor/t*sh + +# Remove tests checking for --version & --help +# Not really interesting for us and logs are too big +sed -i -e '/tests\/misc\/invalid-opt.pl/ D' \ + -e '/tests\/misc\/help-version.sh/ D' \ + -e '/tests\/misc\/help-version-getopt.sh/ D' \ + Makefile + +# printf doesn't limit the values used in its arg, so this produced ~2GB of output +sed -i '/INT_OFLOW/ D' tests/misc/printf.sh + +# Use the system coreutils where the test fails due to error in a util that is not the one being tested +sed -i 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh +sed -i 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh tests/du/8gb.sh +sed -i 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh +sed -i 's|timeout \([[:digit:]]\)| /usr/bin/timeout \1|' tests/tail-2/inotify-rotate.sh tests/tail-2/inotify-dir-recreate.sh tests/tail-2/inotify-rotate-resources.sh tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh tests/tail-2/follow-name.sh tests/misc/shuf.sh # Don't break the function called 'grep_timeout' +sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh tests/tail-2/tail-n0f.sh tests/cp/fail-perm.sh tests/du/inaccessible-cwd.sh tests/mv/i-2.sh tests/chgrp/basic.sh tests/misc/shuf.sh +sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/misc/test-N.sh +sed -i 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh +sed -i 's|truncate |/usr/bin/truncate |' tests/split/fail.sh +sed -i 's|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh init.cfg +sed -i 's|id -|/usr/bin/id -|' tests/misc/runcon-no-reorder.sh +sed -i 's|touch |/usr/bin/touch |' tests/cp/preserve-link.sh tests/cp/reflink-perm.sh tests/ls/block-size.sh tests/ls/abmon-align.sh tests/ls/rt-1.sh tests/mv/update.sh tests/misc/ls-time.sh tests/misc/stat-nanoseconds.sh tests/misc/time-style.sh tests/misc/test-N.sh +sed -i 's|ln -|/usr/bin/ln -|' tests/cp/link-deref.sh +sed -i 's|printf |/usr/bin/printf |' tests/dd/ascii.sh +sed -i 's|cp |/usr/bin/cp |' tests/mv/hard-2.sh +sed -i 's|paste |/usr/bin/paste |' tests/misc/od-endian.sh +sed -i 's|seq |/usr/bin/seq |' tests/misc/sort-discrim.sh + +#Add specific timeout to tests that currently hang to limit time spent waiting +sed -i 's|seq \$|/usr/bin/timeout 0.1 seq \$|' tests/misc/seq-precision.sh tests/misc/seq-long-double.sh +sed -i 's|cat |/usr/bin/timeout 0.1 cat |' tests/misc/cat-self.sh + +test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" + diff --git a/util/run-gnu-test.sh b/util/run-gnu-test.sh new file mode 100644 index 000000000..5031863c4 --- /dev/null +++ b/util/run-gnu-test.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e +BUILDDIR="${PWD}/uutils/target/release" +GNULIB_DIR="${PWD}/gnulib" +pushd gnu + +timeout -sKILL 2h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=no RUN_VERY_EXPENSIVE_TESTS=no VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make From ddcd6be37afb0b9a23431415399ad6cf4f881b74 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 21 May 2021 18:31:21 +0200 Subject: [PATCH 0647/1135] gnu: document how to run the tests --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 7de4419af..6b29fa854 100644 --- a/README.md +++ b/README.md @@ -318,6 +318,16 @@ To pass an argument like "-v" to the busybox test runtime $ make UTILS='UTILITY_1 UTILITY_2' RUNTEST_ARGS='-v' busytest ``` +## Comparing with GNU + +![Evolution over time](https://github.com/uutils/coreutils-tracking/blob/main/gnu-results.png?raw=true) + +To run locally: +```bash +$ bash util/build-gnu.sh +$ bash util/run-gnu-test.sh +``` + ## Contribute To contribute to uutils, please see [CONTRIBUTING](CONTRIBUTING.md). From 373776e0713580935b3eb8395585655bd492e019 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 22 May 2021 09:40:35 +0200 Subject: [PATCH 0648/1135] freebsd/circus: workaround the timeout https://github.com/rust-lang/rustup/issues/2774 It is failing currently on: ``` info: installing component 'cargo' error: error: 'sysinfo not supported on this platform' ``` with 1.52.1 --- .cirrus.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index 5d16dce92..fb9b038a8 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,3 +1,10 @@ +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: From 33fb491c6e89dccb0f6532f1bd2c6bb024c4640d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 22 May 2021 11:05:55 +0200 Subject: [PATCH 0649/1135] freebsd/circus: update to freebsd 12.2 --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index fb9b038a8..50f8a25b1 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -8,7 +8,7 @@ env: task: name: stable x86_64-unknown-freebsd-12 freebsd_instance: - image: freebsd-12-1-release-amd64 + image: freebsd-12-2-release-amd64 setup_script: - pkg install -y curl gmake - curl https://sh.rustup.rs -sSf --output rustup.sh From 0d1b14ee333bdaae9942cf45f1d5cb7e395f8ab6 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 22 May 2021 11:08:03 +0200 Subject: [PATCH 0650/1135] Bring back the run expensive tests --- util/run-gnu-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/run-gnu-test.sh b/util/run-gnu-test.sh index 5031863c4..b9948ccd3 100644 --- a/util/run-gnu-test.sh +++ b/util/run-gnu-test.sh @@ -4,4 +4,4 @@ BUILDDIR="${PWD}/uutils/target/release" GNULIB_DIR="${PWD}/gnulib" pushd gnu -timeout -sKILL 2h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=no RUN_VERY_EXPENSIVE_TESTS=no VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make +timeout -sKILL 2h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make From 9f88963764ad2e02836b6583ac556503b4f3c687 Mon Sep 17 00:00:00 2001 From: Anup Mahindre Date: Sat, 22 May 2021 14:51:50 +0530 Subject: [PATCH 0651/1135] tests: fix test_ls_path for windows --- tests/by-util/test_ls.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index fc4051039..6d6c65194 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1992,10 +1992,18 @@ fn test_ls_path() { .stdout_is(expected_stdout); let abs_path = format!("{}/{}", at.as_string(), path); - let expected_stdout = &format!("{}\n", abs_path); + let expected_stdout = if cfg!(windows) { + format!("\'{}\'\n", abs_path) + } else { + format!("{}\n", abs_path) + }; scene.ucmd().arg(&abs_path).run().stdout_is(expected_stdout); - let expected_stdout = &format!("{}\n{}\n", path, file1); + let expected_stdout = if cfg!(windows) { + format!("{} {}\n", path, file1) + } else { + format!("{}\n{}\n", path, file1) + }; scene .ucmd() .arg(file1) From 628684af4f8f8fbeed87ba0b8dd592b255f634ab Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 22 May 2021 12:20:13 +0200 Subject: [PATCH 0652/1135] refresh cargo.lock with recent updates --- Cargo.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index feda68de5..997d52fab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1098,9 +1098,9 @@ dependencies = [ [[package]] name = "plotters" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" +checksum = "32a3fd9ec30b9749ce28cd91f255d569591cdf937fe280c312143e3c4bad6f2a" dependencies = [ "num-traits", "plotters-backend", @@ -1174,9 +1174,9 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" +checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" dependencies = [ "unicode-xid 0.2.2", ] @@ -1308,9 +1308,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" +checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" dependencies = [ "autocfg", "crossbeam-deque", @@ -1320,9 +1320,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.9.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" +checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" dependencies = [ "crossbeam-channel", "crossbeam-deque", From 088443276a6d0229dc93b5a9502ff3d09870d782 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 22 May 2021 14:00:07 +0200 Subject: [PATCH 0653/1135] sort: improve handling of buffer size cmd arg Instead of overflowing when calculating the buffer size, use saturating_{pow, mul}. When failing to parse the buffer size, we now crash instead of silently ignoring the error. --- src/uu/sort/src/sort.rs | 54 ++++++++++++++++++++++---------------- tests/by-util/test_sort.rs | 24 ++++++++++------- 2 files changed, 46 insertions(+), 32 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 78388a298..bc3b65492 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -93,10 +93,10 @@ static THOUSANDS_SEP: char = ','; static NEGATIVE: char = '-'; static POSITIVE: char = '+'; -/// Choosing a higher buffer size does not result in performance improvements -/// (at least not on my machine). TODO: In the future, we should also take the amount of -/// available memory into consideration, instead of relying on this constant only. -static DEFAULT_BUF_SIZE: usize = 1_000_000_000; +// Choosing a higher buffer size does not result in performance improvements +// (at least not on my machine). TODO: In the future, we should also take the amount of +// available memory into consideration, instead of relying on this constant only. +static DEFAULT_BUF_SIZE: usize = 1_000_000_000; // 1 GB #[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy)] enum SortMode { @@ -133,24 +133,32 @@ pub struct GlobalSettings { } impl GlobalSettings { - // It's back to do conversions for command line opts! - // Probably want to do through numstrcmp somehow now? - fn human_numeric_convert(a: &str) -> usize { - let num_str = &a[get_leading_gen(a)]; - let (_, suf_str) = a.split_at(num_str.len()); - let num_usize = num_str - .parse::() - .expect("Error parsing buffer size: "); - let suf_usize: usize = match suf_str.to_uppercase().as_str() { - // SI Units - "B" => 1usize, - "K" => 1000usize, - "M" => 1000000usize, - "G" => 1000000000usize, - // GNU regards empty human numeric values as K by default - _ => 1000usize, - }; - num_usize * suf_usize + /// Interpret this `&str` as a number with an optional trailing si unit. + /// + /// If there is no trailing si unit, the implicit unit is K. + /// The suffix B causes the number to be interpreted as a byte count. + fn parse_byte_count(input: &str) -> usize { + const SI_UNITS: &[char] = &['B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; + + let input = input.trim(); + + let (num_str, si_unit) = + if input.ends_with(|c: char| SI_UNITS.contains(&c.to_ascii_uppercase())) { + let mut chars = input.chars(); + let si_suffix = chars.next_back().unwrap().to_ascii_uppercase(); + let si_unit = SI_UNITS.iter().position(|&c| c == si_suffix).unwrap(); + let num_str = chars.as_str(); + (num_str, si_unit) + } else { + (input, 1) + }; + + let num_usize: usize = num_str + .trim() + .parse() + .unwrap_or_else(|e| crash!(1, "failed to parse buffer size `{}`: {}", num_str, e)); + + num_usize.saturating_mul(1000usize.saturating_pow(si_unit as u32)) } fn out_writer(&self) -> BufWriter> { @@ -944,7 +952,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.buffer_size = matches .value_of(OPT_BUF_SIZE) - .map(GlobalSettings::human_numeric_convert) + .map(GlobalSettings::parse_byte_count) .unwrap_or(DEFAULT_BUF_SIZE); settings.tmp_dir = matches diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 59058d5bc..23705d2ee 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -17,7 +17,9 @@ fn test_helper(file_name: &str, args: &str) { #[test] fn test_buffer_sizes() { - let buffer_sizes = ["0", "50K", "1M", "1000G"]; + let buffer_sizes = [ + "0", "50K", "50k", "1M", "100M", "1000G", "10T", "500E", "1Y", + ]; for buffer_size in &buffer_sizes { new_ucmd!() .arg("-n") @@ -30,14 +32,18 @@ fn test_buffer_sizes() { } #[test] -fn test_smaller_than_specified_segment() { - new_ucmd!() - .arg("-n") - .arg("-S") - .arg("100M") - .arg("ext_sort.txt") - .succeeds() - .stdout_is_fixture("ext_sort.expected"); +fn test_invalid_buffer_size() { + let buffer_sizes = ["asd", "100f"]; + for invalid_buffer_size in &buffer_sizes { + new_ucmd!() + .arg("-S") + .arg(invalid_buffer_size) + .fails() + .stderr_only(format!( + "sort: error: failed to parse buffer size `{}`: invalid digit found in string", + invalid_buffer_size + )); + } } #[test] From bee3b1237c589f7c2e22d94d0c6d2e99bea0b5b5 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Sat, 22 May 2021 10:44:50 -0400 Subject: [PATCH 0654/1135] uucore::fs: don't canonicalize last component Change the behavior of `uucore::fs::canonicalize()` when `can_mode` is `CanonicalizeMode::None` so that it does not attempt to resolve the final component if it is a symbolic link. This matches the behavior of the function for the non-final components of a path when `can_mode` is `None`. --- src/uucore/src/lib/features/fs.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index 040c36e95..afaa07af1 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -54,11 +54,19 @@ pub fn resolve_relative_path(path: &Path) -> Cow { result.into() } +/// Controls how symbolic links should be handled when canonicalizing a path. #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum CanonicalizeMode { + /// Do not resolve any symbolic links. None, + + /// Resolve all symbolic links. Normal, + + /// Resolve symbolic links, ignoring errors on the final component. Existing, + + /// Resolve symbolic links, ignoring errors on the non-final components. Missing, } @@ -125,6 +133,24 @@ fn resolve>(original: P) -> IOResult { Ok(result) } +/// Return the canonical, absolute form of a path. +/// +/// This function is a generalization of [`std::fs::canonicalize`] that +/// allows controlling how symbolic links are resolved and how to deal +/// with missing components. It returns the canonical, absolute form of +/// a path. The `can_mode` parameter controls how symbolic links are +/// resolved: +/// +/// * [`CanonicalizeMode::Normal`] makes this function behave like +/// [`std::fs::canonicalize`], resolving symbolic links and returning +/// an error if the path does not exist. +/// * [`CanonicalizeMode::Missing`] makes this function ignore non-final +/// components of the path that could not be resolved. +/// * [`CanonicalizeMode::Existing`] makes this function return an error +/// if the final component of the path does not exist. +/// * [`CanonicalizeMode::None`] makes this function not try to resolve +/// any symbolic links. +/// pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> IOResult { // Create an absolute path let original = original.as_ref(); @@ -180,6 +206,10 @@ pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> result.push(parts.last().unwrap()); + if can_mode == CanonicalizeMode::None { + return Ok(result); + } + match resolve(&result) { Err(e) => { if can_mode == CanonicalizeMode::Existing { From 4b5c3efe85bf3dd735401f40d44eda16dd1c67c2 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Sat, 22 May 2021 10:50:00 -0400 Subject: [PATCH 0655/1135] realpath: use uucore::fs::canonicalize() Use the `uucore::fs::canonicalize()` function to simplify the implementation of `realpath`. --- src/uu/realpath/src/realpath.rs | 78 ++++++++++----------------------- 1 file changed, 24 insertions(+), 54 deletions(-) diff --git a/src/uu/realpath/src/realpath.rs b/src/uu/realpath/src/realpath.rs index 37ff70fb2..937cee5bd 100644 --- a/src/uu/realpath/src/realpath.rs +++ b/src/uu/realpath/src/realpath.rs @@ -11,7 +11,6 @@ extern crate uucore; use clap::{App, Arg}; -use std::fs; use std::path::{Path, PathBuf}; use uucore::fs::{canonicalize, CanonicalizeMode}; @@ -75,64 +74,35 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let quiet = matches.is_present(OPT_QUIET); let mut retcode = 0; for path in &paths { - if !resolve_path(path, strip, zero, quiet) { + if let Err(e) = resolve_path(path, strip, zero) { + if !quiet { + show_error!("{}: {}", e, path.display()); + } retcode = 1 }; } retcode } -fn resolve_path(p: &Path, strip: bool, zero: bool, quiet: bool) -> bool { - let abs = canonicalize(p, CanonicalizeMode::Normal).unwrap(); - - if strip { - if zero { - print!("{}\0", p.display()); - } else { - println!("{}", p.display()) - } - return true; - } - - let mut result = PathBuf::new(); - let mut links_left = 256; - - for part in abs.components() { - result.push(part.as_os_str()); - loop { - if links_left == 0 { - if !quiet { - show_error!("Too many symbolic links: {}", p.display()) - }; - return false; - } - match fs::metadata(result.as_path()) { - Err(_) => break, - Ok(ref m) if !m.file_type().is_symlink() => break, - Ok(_) => { - links_left -= 1; - match fs::read_link(result.as_path()) { - Ok(x) => { - result.pop(); - result.push(x.as_path()); - } - _ => { - if !quiet { - show_error!("Invalid path: {}", p.display()) - }; - return false; - } - } - } - } - } - } - - if zero { - print!("{}\0", result.display()); +/// Resolve a path to an absolute form and print it. +/// +/// If `strip` is `true`, then this function does not attempt to resolve +/// symbolic links in the path. If `zero` is `true`, then this function +/// prints the path followed by the null byte (`'\0'`) instead of a +/// newline character (`'\n'`). +/// +/// # Errors +/// +/// This function returns an error if there is a problem resolving +/// symbolic links. +fn resolve_path(p: &Path, strip: bool, zero: bool) -> std::io::Result<()> { + let mode = if strip { + CanonicalizeMode::None } else { - println!("{}", result.display()); - } - - true + CanonicalizeMode::Normal + }; + let abs = canonicalize(p, mode)?; + let line_ending = if zero { '\0' } else { '\n' }; + print!("{}{}", abs.display(), line_ending); + Ok(()) } From fcb079e20e6cd6008d7146a9a5dc04ddda0e5bdd Mon Sep 17 00:00:00 2001 From: David Carlier Date: Thu, 20 May 2021 20:09:41 +0100 Subject: [PATCH 0656/1135] who freebsd build fix unsupported RUN_LVL option only for other platforms. --- src/uu/who/src/who.rs | 17 +++++++++++------ tests/by-util/test_who.rs | 17 ++++++++++++++++- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index 1ae4f1c8d..81fc2a687 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -29,7 +29,7 @@ mod options { pub const ONLY_HOSTNAME_USER: &str = "only_hostname_user"; pub const PROCESS: &str = "process"; pub const COUNT: &str = "count"; - #[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android"))] pub const RUNLEVEL: &str = "runlevel"; pub const SHORT: &str = "short"; pub const TIME: &str = "time"; @@ -119,11 +119,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("all login names and number of users logged on"), ) .arg( - #[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android"))] Arg::with_name(options::RUNLEVEL) .long(options::RUNLEVEL) .short("r") .help("print current runlevel"), + #[cfg(any(target_vendor = "apple", target_os = "freebsd"))] + Arg::with_name(""), ) .arg( Arg::with_name(options::SHORT) @@ -265,10 +267,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { assumptions = false; } - if matches.is_present(options::RUNLEVEL) { - need_runlevel = true; - include_idle = true; - assumptions = false; + #[cfg(any(target_os = "linux", target_os = "android"))] + { + if matches.is_present(options::RUNLEVEL) { + need_runlevel = true; + include_idle = true; + assumptions = false; + } } if matches.is_present(options::SHORT) { diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index 725ec0b1e..1aa8d604d 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -83,7 +83,7 @@ fn test_process() { } } -#[cfg(any(target_vendor = "apple", target_os = "linux"))] +#[cfg(target_os = "linux")] #[test] fn test_runlevel() { for opt in vec!["-r", "--runlevel"] { @@ -94,6 +94,19 @@ fn test_runlevel() { } } +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] +#[test] +fn test_runlevel() { + let expected = + "error: Found argument"; + for opt in vec!["-r", "--runlevel"] { + new_ucmd!() + .arg(opt) + .fails() + .stderr_contains(expected); + } +} + #[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_time() { @@ -122,6 +135,7 @@ fn test_mesg() { } } +#[cfg(target_os = "linux")] #[test] fn test_arg1_arg2() { let args = ["am", "i"]; @@ -132,6 +146,7 @@ fn test_arg1_arg2() { .stdout_is(expected_result(&args)); } +#[cfg(target_os = "linux")] #[test] fn test_too_many_args() { const EXPECTED: &str = From 4521aa2659c2e44516415913d63da0774e1fd1bc Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Thu, 6 May 2021 22:39:39 -0400 Subject: [PATCH 0657/1135] wc: print counts for each file as soon as computed Change the behavior of `wc` to print the counts for a file as soon as it is computed, instead of waiting to compute the counts for all files before writing any output to `stdout`. The new behavior matches the behavior of GNU `wc`. The old behavior looked like this (the word "hello" is entered on `stdin`): $ wc emptyfile.txt - hello 0 0 0 emptyfile.txt 1 1 6 1 1 6 total The new behavior looks like this: $ wc emptyfile.txt - 0 0 0 emptyfile.txt hello 1 1 6 1 1 6 total --- src/uu/wc/src/wc.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index b323f7261..6e95254ee 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -373,7 +373,6 @@ fn wc(inputs: Vec, settings: &Settings) -> Result<(), u32> { let max_width = max_width(&inputs); let mut total_word_count = WordCount::default(); - let mut results = vec![]; let num_inputs = inputs.len(); @@ -384,10 +383,7 @@ fn wc(inputs: Vec, settings: &Settings) -> Result<(), u32> { WordCount::default() }); total_word_count += word_count; - results.push(word_count.with_title(input.to_title())); - } - - for result in &results { + let result = word_count.with_title(input.to_title()); if let Err(err) = print_stats(settings, &result, max_width) { show_warning!( "failed to print result for {}: {}", From 9f0ef3ba54a83e4ed5e5a87bf8f3663eeccfa1c2 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 22 May 2021 21:59:54 +0200 Subject: [PATCH 0658/1135] gnu/ci: also store the hash in the json --- .github/workflows/GNU.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index c94902bbc..1f9250900 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -61,13 +61,14 @@ jobs: echo "::warning ::GNU testsuite = TOTAL: $TOTAL / PASS: $PASS / FAIL: $FAIL / ERROR: $ERROR" jq -n \ --arg date "$(date --rfc-email)" \ + --arg sha "$GITHUB_SHA" \ --arg total "$TOTAL" \ --arg pass "$PASS" \ --arg skip "$SKIP" \ --arg fail "$FAIL" \ --arg xpass "$XPASS" \ --arg error "$ERROR" \ - '{($date): { total: $total, pass: $pass, skip: $skip, fail: $fail, xpass: $xpass, error: $error, }}' > gnu-result.json + '{($date): { sha: $sha, total: $total, pass: $pass, skip: $skip, fail: $fail, xpass: $xpass, error: $error, }}' > gnu-result.json else echo "::error ::Failed to get summary of test results" fi From c1f67ed775bb33cdf17d563c20ebce8cdf886cde Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 22 May 2021 23:06:30 +0200 Subject: [PATCH 0659/1135] sort: support --sort flag and check for conflicts `sort` supports three ways to specify the sort mode: a long option (e.g. --numeric-sort), a short option (e.g. -n) and the sort flag (e.g. --sort=numeric). This adds support for the sort flag. Additionally, sort modes now conflict, which means that an error is shown when multiple modes are passed, instead of silently picking a mode. For consistency, I added the `random` sort mode to the `SortMode` enum, instead of it being a bool flag. --- src/uu/sort/src/sort.rs | 178 +++++++++++++++++++++++-------------- tests/by-util/test_sort.rs | 139 +++++++++++++++++++---------- 2 files changed, 202 insertions(+), 115 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index bc3b65492..81787ece6 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -64,6 +64,17 @@ static OPT_NUMERIC_SORT: &str = "numeric-sort"; static OPT_GENERAL_NUMERIC_SORT: &str = "general-numeric-sort"; static OPT_VERSION_SORT: &str = "version-sort"; +static OPT_SORT: &str = "sort"; + +static ALL_SORT_MODES: &[&str] = &[ + OPT_GENERAL_NUMERIC_SORT, + OPT_HUMAN_NUMERIC_SORT, + OPT_MONTH_SORT, + OPT_NUMERIC_SORT, + OPT_VERSION_SORT, + OPT_RANDOM, +]; + static OPT_DICTIONARY_ORDER: &str = "dictionary-order"; static OPT_MERGE: &str = "merge"; static OPT_CHECK: &str = "check"; @@ -105,6 +116,7 @@ enum SortMode { GeneralNumeric, Month, Version, + Random, Default, } #[derive(Clone)] @@ -122,7 +134,6 @@ pub struct GlobalSettings { unique: bool, check: bool, check_silent: bool, - random: bool, salt: String, selectors: Vec, separator: Option, @@ -191,7 +202,6 @@ impl Default for GlobalSettings { unique: false, check: false, check_silent: false, - random: false, salt: String::new(), selectors: vec![], separator: None, @@ -209,7 +219,6 @@ struct KeySettings { ignore_case: bool, dictionary_order: bool, ignore_non_printing: bool, - random: bool, reverse: bool, } @@ -220,7 +229,6 @@ impl From<&GlobalSettings> for KeySettings { ignore_blanks: settings.ignore_blanks, ignore_case: settings.ignore_case, ignore_non_printing: settings.ignore_non_printing, - random: settings.random, reverse: settings.reverse, dictionary_order: settings.dictionary_order, } @@ -398,7 +406,7 @@ impl<'a> Line<'a> { } } } - if !(settings.random + if !(settings.mode == SortMode::Random || settings.stable || settings.unique || !(settings.dictionary_order @@ -502,7 +510,7 @@ impl KeyPosition { 'h' => settings.mode = SortMode::HumanNumeric, 'i' => settings.ignore_non_printing = true, 'n' => settings.mode = SortMode::Numeric, - 'R' => settings.random = true, + 'R' => settings.mode = SortMode::Random, 'r' => settings.reverse = true, 'V' => settings.mode = SortMode::Version, c => { @@ -526,7 +534,9 @@ impl KeyPosition { | SortMode::GeneralNumeric | SortMode::Month => SortMode::Default, // Only SortMode::Default and SortMode::Version work with dictionary_order and ignore_non_printing - m @ SortMode::Default | m @ SortMode::Version => m, + m @ SortMode::Default + | m @ SortMode::Version + | m @ SortMode::Random => m, } } _ => {} @@ -720,6 +730,16 @@ With no FILE, or when FILE is -, read standard input.", ) } +fn make_sort_mode_arg<'a, 'b>(mode: &'a str, short: &'b str, help: &'b str) -> Arg<'a, 'b> { + let mut arg = Arg::with_name(mode).short(short).long(mode).help(help); + for possible_mode in ALL_SORT_MODES { + if *possible_mode != mode { + arg = arg.conflicts_with(possible_mode); + } + } + arg +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args .collect_str(InvalidEncodingHandling::Ignore) @@ -732,34 +752,62 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .arg( - Arg::with_name(OPT_HUMAN_NUMERIC_SORT) - .short("h") - .long(OPT_HUMAN_NUMERIC_SORT) - .help("compare according to human readable sizes, eg 1M > 100k"), + Arg::with_name(OPT_SORT) + .long(OPT_SORT) + .takes_value(true) + .possible_values( + &[ + "general-numeric", + "human-numeric", + "month", + "numeric", + "version", + "random", + ] + ) + .conflicts_with_all(ALL_SORT_MODES) ) .arg( - Arg::with_name(OPT_MONTH_SORT) - .short("M") - .long(OPT_MONTH_SORT) - .help("compare according to month name abbreviation"), + make_sort_mode_arg( + OPT_HUMAN_NUMERIC_SORT, + "h", + "compare according to human readable sizes, eg 1M > 100k" + ), ) .arg( - Arg::with_name(OPT_NUMERIC_SORT) - .short("n") - .long(OPT_NUMERIC_SORT) - .help("compare according to string numerical value"), + make_sort_mode_arg( + OPT_MONTH_SORT, + "M", + "compare according to month name abbreviation" + ), ) .arg( - Arg::with_name(OPT_GENERAL_NUMERIC_SORT) - .short("g") - .long(OPT_GENERAL_NUMERIC_SORT) - .help("compare according to string general numerical value"), + make_sort_mode_arg( + OPT_NUMERIC_SORT, + "n", + "compare according to string numerical value" + ), ) .arg( - Arg::with_name(OPT_VERSION_SORT) - .short("V") - .long(OPT_VERSION_SORT) - .help("Sort by SemVer version number, eg 1.12.2 > 1.1.2"), + make_sort_mode_arg( + OPT_GENERAL_NUMERIC_SORT, + "g", + "compare according to string general numerical value" + ), + ) + .arg( + make_sort_mode_arg( + OPT_VERSION_SORT, + "V", + "Sort by SemVer version number, eg 1.12.2 > 1.1.2", + ), + ) + .arg( + make_sort_mode_arg( + OPT_RANDOM, + "R", + "shuffle in random order", + ), ) .arg( Arg::with_name(OPT_DICTIONARY_ORDER) @@ -813,12 +861,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .value_name("FILENAME"), ) - .arg( - Arg::with_name(OPT_RANDOM) - .short("R") - .long(OPT_RANDOM) - .help("shuffle in random order"), - ) .arg( Arg::with_name(OPT_REVERSE) .short("r") @@ -925,16 +967,25 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .unwrap_or_default() }; - settings.mode = if matches.is_present(OPT_HUMAN_NUMERIC_SORT) { + settings.mode = if matches.is_present(OPT_HUMAN_NUMERIC_SORT) + || matches.value_of(OPT_SORT) == Some("human-numeric") + { SortMode::HumanNumeric - } else if matches.is_present(OPT_MONTH_SORT) { + } else if matches.is_present(OPT_MONTH_SORT) || matches.value_of(OPT_SORT) == Some("month") { SortMode::Month - } else if matches.is_present(OPT_GENERAL_NUMERIC_SORT) { + } else if matches.is_present(OPT_GENERAL_NUMERIC_SORT) + || matches.value_of(OPT_SORT) == Some("general-numeric") + { SortMode::GeneralNumeric - } else if matches.is_present(OPT_NUMERIC_SORT) { + } else if matches.is_present(OPT_NUMERIC_SORT) || matches.value_of(OPT_SORT) == Some("numeric") + { SortMode::Numeric - } else if matches.is_present(OPT_VERSION_SORT) { + } else if matches.is_present(OPT_VERSION_SORT) || matches.value_of(OPT_SORT) == Some("version") + { SortMode::Version + } else if matches.is_present(OPT_RANDOM) || matches.value_of(OPT_SORT) == Some("random") { + settings.salt = get_rand_string(); + SortMode::Random } else { SortMode::Default }; @@ -978,11 +1029,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.stable = matches.is_present(OPT_STABLE); settings.unique = matches.is_present(OPT_UNIQUE); - if matches.is_present(OPT_RANDOM) { - settings.random = matches.is_present(OPT_RANDOM); - settings.salt = get_rand_string(); - } - if files.is_empty() { /* if no file, default to stdin */ files.push("-".to_owned()); @@ -1110,28 +1156,25 @@ fn compare_by<'a>(a: &Line<'a>, b: &Line<'a>, global_settings: &GlobalSettings) let b_str = b_selection.slice; let settings = &selector.settings; - let cmp: Ordering = if settings.random { - random_shuffle(a_str, b_str, &global_settings.salt) - } else { - match settings.mode { - SortMode::Numeric | SortMode::HumanNumeric => numeric_str_cmp( - (a_str, a_selection.num_cache.as_ref().unwrap().as_num_info()), - (b_str, b_selection.num_cache.as_ref().unwrap().as_num_info()), - ), - SortMode::GeneralNumeric => general_numeric_compare( - a_selection.num_cache.as_ref().unwrap().as_f64(), - b_selection.num_cache.as_ref().unwrap().as_f64(), - ), - SortMode::Month => month_compare(a_str, b_str), - SortMode::Version => version_compare(a_str, b_str), - SortMode::Default => custom_str_cmp( - a_str, - b_str, - settings.ignore_non_printing, - settings.dictionary_order, - settings.ignore_case, - ), - } + let cmp: Ordering = match settings.mode { + SortMode::Random => random_shuffle(a_str, b_str, &global_settings.salt), + SortMode::Numeric | SortMode::HumanNumeric => numeric_str_cmp( + (a_str, a_selection.num_cache.as_ref().unwrap().as_num_info()), + (b_str, b_selection.num_cache.as_ref().unwrap().as_num_info()), + ), + SortMode::GeneralNumeric => general_numeric_compare( + a_selection.num_cache.as_ref().unwrap().as_f64(), + b_selection.num_cache.as_ref().unwrap().as_f64(), + ), + SortMode::Month => month_compare(a_str, b_str), + SortMode::Version => version_compare(a_str, b_str), + SortMode::Default => custom_str_cmp( + a_str, + b_str, + settings.ignore_non_printing, + settings.dictionary_order, + settings.ignore_case, + ), }; if cmp != Ordering::Equal { return if settings.reverse { cmp.reverse() } else { cmp }; @@ -1139,7 +1182,10 @@ fn compare_by<'a>(a: &Line<'a>, b: &Line<'a>, global_settings: &GlobalSettings) } // Call "last resort compare" if all selectors returned Equal - let cmp = if global_settings.random || global_settings.stable || global_settings.unique { + let cmp = if global_settings.mode == SortMode::Random + || global_settings.stable + || global_settings.unique + { Ordering::Equal } else { a.line.cmp(b.line) diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 23705d2ee..e4676b379 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -1,18 +1,20 @@ use crate::common::util::*; -fn test_helper(file_name: &str, args: &str) { - new_ucmd!() - .arg(format!("{}.txt", file_name)) - .args(&args.split(' ').collect::>()) - .succeeds() - .stdout_is_fixture(format!("{}.expected", file_name)); +fn test_helper(file_name: &str, possible_args: &[&str]) { + for args in possible_args { + new_ucmd!() + .arg(format!("{}.txt", file_name)) + .args(&args.split(' ').collect::>()) + .succeeds() + .stdout_is_fixture(format!("{}.expected", file_name)); - new_ucmd!() - .arg(format!("{}.txt", file_name)) - .arg("--debug") - .args(&args.split(' ').collect::>()) - .succeeds() - .stdout_is_fixture(format!("{}.expected.debug", file_name)); + new_ucmd!() + .arg(format!("{}.txt", file_name)) + .arg("--debug") + .args(&args.split(' ').collect::>()) + .succeeds() + .stdout_is_fixture(format!("{}.expected.debug", file_name)); + } } #[test] @@ -71,7 +73,7 @@ fn test_extsort_zero_terminated() { #[test] fn test_months_whitespace() { - test_helper("months-whitespace", "-M"); + test_helper("months-whitespace", &["-M", "--month-sort", "--sort=month"]); } #[test] @@ -85,7 +87,10 @@ fn test_version_empty_lines() { #[test] fn test_human_numeric_whitespace() { - test_helper("human-numeric-whitespace", "-h"); + test_helper( + "human-numeric-whitespace", + &["-h", "--human-numeric-sort", "--sort=human-numeric"], + ); } // This tests where serde often fails when reading back JSON @@ -102,12 +107,18 @@ fn test_extsort_as64_bailout() { #[test] fn test_multiple_decimals_general() { - test_helper("multiple_decimals_general", "-g") + test_helper( + "multiple_decimals_general", + &["-g", "--general-numeric-sort", "--sort=general-numeric"], + ) } #[test] fn test_multiple_decimals_numeric() { - test_helper("multiple_decimals_numeric", "-n") + test_helper( + "multiple_decimals_numeric", + &["-n", "--numeric-sort", "--sort=numeric"], + ) } #[test] @@ -186,72 +197,93 @@ fn test_random_shuffle_contains_two_runs_not_the_same() { #[test] fn test_numeric_floats_and_ints() { - test_helper("numeric_floats_and_ints", "-n"); + test_helper( + "numeric_floats_and_ints", + &["-n", "--numeric-sort", "--sort=numeric"], + ); } #[test] fn test_numeric_floats() { - test_helper("numeric_floats", "-n"); + test_helper( + "numeric_floats", + &["-n", "--numeric-sort", "--sort=numeric"], + ); } #[test] fn test_numeric_floats_with_nan() { - test_helper("numeric_floats_with_nan", "-n"); + test_helper( + "numeric_floats_with_nan", + &["-n", "--numeric-sort", "--sort=numeric"], + ); } #[test] fn test_numeric_unfixed_floats() { - test_helper("numeric_unfixed_floats", "-n"); + test_helper( + "numeric_unfixed_floats", + &["-n", "--numeric-sort", "--sort=numeric"], + ); } #[test] fn test_numeric_fixed_floats() { - test_helper("numeric_fixed_floats", "-n"); + test_helper( + "numeric_fixed_floats", + &["-n", "--numeric-sort", "--sort=numeric"], + ); } #[test] fn test_numeric_unsorted_ints() { - test_helper("numeric_unsorted_ints", "-n"); + test_helper( + "numeric_unsorted_ints", + &["-n", "--numeric-sort", "--sort=numeric"], + ); } #[test] fn test_human_block_sizes() { - test_helper("human_block_sizes", "-h"); + test_helper( + "human_block_sizes", + &["-h", "--human-numeric-sort", "--sort=human-numeric"], + ); } #[test] fn test_month_default() { - test_helper("month_default", "-M"); + test_helper("month_default", &["-M", "--month-sort", "--sort=month"]); } #[test] fn test_month_stable() { - test_helper("month_stable", "-Ms"); + test_helper("month_stable", &["-Ms"]); } #[test] fn test_default_unsorted_ints() { - test_helper("default_unsorted_ints", ""); + test_helper("default_unsorted_ints", &[""]); } #[test] fn test_numeric_unique_ints() { - test_helper("numeric_unsorted_ints_unique", "-nu"); + test_helper("numeric_unsorted_ints_unique", &["-nu"]); } #[test] fn test_version() { - test_helper("version", "-V"); + test_helper("version", &["-V"]); } #[test] fn test_ignore_case() { - test_helper("ignore_case", "-f"); + test_helper("ignore_case", &["-f"]); } #[test] fn test_dictionary_order() { - test_helper("dictionary_order", "-d"); + test_helper("dictionary_order", &["-d"]); } #[test] @@ -278,47 +310,53 @@ fn test_non_printing_chars() { #[test] fn test_exponents_positive_general_fixed() { - test_helper("exponents_general", "-g"); + test_helper("exponents_general", &["-g"]); } #[test] fn test_exponents_positive_numeric() { - test_helper("exponents-positive-numeric", "-n"); + test_helper( + "exponents-positive-numeric", + &["-n", "--numeric-sort", "--sort=numeric"], + ); } #[test] fn test_months_dedup() { - test_helper("months-dedup", "-Mu"); + test_helper("months-dedup", &["-Mu"]); } #[test] fn test_mixed_floats_ints_chars_numeric() { - test_helper("mixed_floats_ints_chars_numeric", "-n"); + test_helper( + "mixed_floats_ints_chars_numeric", + &["-n", "--numeric-sort", "--sort=numeric"], + ); } #[test] fn test_mixed_floats_ints_chars_numeric_unique() { - test_helper("mixed_floats_ints_chars_numeric_unique", "-nu"); + test_helper("mixed_floats_ints_chars_numeric_unique", &["-nu"]); } #[test] fn test_words_unique() { - test_helper("words_unique", "-u"); + test_helper("words_unique", &["-u"]); } #[test] fn test_numeric_unique() { - test_helper("numeric_unique", "-nu"); + test_helper("numeric_unique", &["-nu"]); } #[test] fn test_mixed_floats_ints_chars_numeric_reverse() { - test_helper("mixed_floats_ints_chars_numeric_unique_reverse", "-nur"); + test_helper("mixed_floats_ints_chars_numeric_unique_reverse", &["-nur"]); } #[test] fn test_mixed_floats_ints_chars_numeric_stable() { - test_helper("mixed_floats_ints_chars_numeric_stable", "-ns"); + test_helper("mixed_floats_ints_chars_numeric_stable", &["-ns"]); } #[test] @@ -347,12 +385,15 @@ fn test_numeric_floats2() { #[test] fn test_numeric_floats_with_nan2() { - test_helper("numeric-floats-with-nan2", "-n"); + test_helper( + "numeric-floats-with-nan2", + &["-n", "--numeric-sort", "--sort=numeric"], + ); } #[test] fn test_human_block_sizes2() { - for human_numeric_sort_param in vec!["-h", "--human-numeric-sort"] { + for human_numeric_sort_param in &["-h", "--human-numeric-sort", "--sort=human-numeric"] { let input = "8981K\n909991M\n-8T\n21G\n0.8M"; new_ucmd!() .arg(human_numeric_sort_param) @@ -364,7 +405,7 @@ fn test_human_block_sizes2() { #[test] fn test_month_default2() { - for month_sort_param in vec!["-M", "--month-sort"] { + for month_sort_param in &["-M", "--month-sort", "--sort=month"] { let input = "JAn\nMAY\n000may\nJun\nFeb"; new_ucmd!() .arg(month_sort_param) @@ -397,32 +438,32 @@ fn test_numeric_unique_ints2() { #[test] fn test_keys_open_ended() { - test_helper("keys_open_ended", "-k 2.3"); + test_helper("keys_open_ended", &["-k 2.3"]); } #[test] fn test_keys_closed_range() { - test_helper("keys_closed_range", "-k 2.2,2.2"); + test_helper("keys_closed_range", &["-k 2.2,2.2"]); } #[test] fn test_keys_multiple_ranges() { - test_helper("keys_multiple_ranges", "-k 2,2 -k 3,3"); + test_helper("keys_multiple_ranges", &["-k 2,2 -k 3,3"]); } #[test] fn test_keys_no_field_match() { - test_helper("keys_no_field_match", "-k 4,4"); + test_helper("keys_no_field_match", &["-k 4,4"]); } #[test] fn test_keys_no_char_match() { - test_helper("keys_no_char_match", "-k 1.2"); + test_helper("keys_no_char_match", &["-k 1.2"]); } #[test] fn test_keys_custom_separator() { - test_helper("keys_custom_separator", "-k 2.2,2.2 -t x"); + test_helper("keys_custom_separator", &["-k 2.2,2.2 -t x"]); } #[test] @@ -534,7 +575,7 @@ aaaa #[test] fn test_zero_terminated() { - test_helper("zero-terminated", "-z"); + test_helper("zero-terminated", &["-z"]); } #[test] From 4aaeede3d8475058531daf740059ed44c3a12850 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 23 May 2021 00:13:53 +0200 Subject: [PATCH 0660/1135] rustfmt the recent change --- src/uu/pinky/src/pinky.rs | 2 +- src/uu/sort/src/chunks.rs | 4 +--- src/uu/sort/src/sort.rs | 4 +--- src/uu/stdbuf/src/stdbuf.rs | 25 +++++++++++++------------ tests/by-util/test_stdbuf.rs | 12 ++++++------ tests/by-util/test_tail.rs | 4 ---- tests/by-util/test_who.rs | 8 ++------ 7 files changed, 24 insertions(+), 35 deletions(-) diff --git a/src/uu/pinky/src/pinky.rs b/src/uu/pinky/src/pinky.rs index f0ab44e5f..d65775c2d 100644 --- a/src/uu/pinky/src/pinky.rs +++ b/src/uu/pinky/src/pinky.rs @@ -48,7 +48,7 @@ fn get_usage() -> String { fn get_long_usage() -> String { format!( "A lightweight 'finger' program; print user information.\n\ - The utmp file will be {}.", + The utmp file will be {}.", utmpx::DEFAULT_FILE ) } diff --git a/src/uu/sort/src/chunks.rs b/src/uu/sort/src/chunks.rs index 7a7749003..6ec759211 100644 --- a/src/uu/sort/src/chunks.rs +++ b/src/uu/sort/src/chunks.rs @@ -223,9 +223,7 @@ fn read_to_buffer( Err(e) if e.kind() == ErrorKind::Interrupted => { // retry } - Err(e) => { - crash!(1, "{}", e) - } + Err(e) => crash!(1, "{}", e), } } } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index bc3b65492..1bbfdc5c5 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -505,9 +505,7 @@ impl KeyPosition { 'R' => settings.random = true, 'r' => settings.reverse = true, 'V' => settings.mode = SortMode::Version, - c => { - crash!(1, "invalid option for key: `{}`", c) - } + c => crash!(1, "invalid option for key: `{}`", c), } // All numeric sorts and month sort conflict with dictionary_order and ignore_non_printing. // Instad of reporting an error, let them overwrite each other. diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 77f6d9dad..485b3c70e 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -24,18 +24,19 @@ use uucore::InvalidEncodingHandling; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Run COMMAND, with modified buffering operations for its standard streams.\n\n\ - Mandatory arguments to long options are mandatory for short options too."; -static LONG_HELP: &str = "If MODE is 'L' the corresponding stream will be line buffered.\n\ - This option is invalid with standard input.\n\n\ - If MODE is '0' the corresponding stream will be unbuffered.\n\n\ - Otherwise MODE is a number which may be followed by one of the following:\n\n\ - KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.\n\ - In this case the corresponding stream will be fully buffered with the buffer size set to \ - MODE bytes.\n\n\ - NOTE: If COMMAND adjusts the buffering of its standard streams ('tee' does for e.g.) then \ - that will override corresponding settings changed by 'stdbuf'.\n\ - Also some filters (like 'dd' and 'cat' etc.) don't use streams for I/O, \ - and are thus unaffected by 'stdbuf' settings.\n"; + Mandatory arguments to long options are mandatory for short options too."; +static LONG_HELP: &str = + "If MODE is 'L' the corresponding stream will be line buffered.\n\ + This option is invalid with standard input.\n\n\ + If MODE is '0' the corresponding stream will be unbuffered.\n\n\ + Otherwise MODE is a number which may be followed by one of the following:\n\n\ + KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.\n\ + In this case the corresponding stream will be fully buffered with the buffer size set to \ + MODE bytes.\n\n\ + NOTE: If COMMAND adjusts the buffering of its standard streams ('tee' does for e.g.) then \ + that will override corresponding settings changed by 'stdbuf'.\n\ + Also some filters (like 'dd' and 'cat' etc.) don't use streams for I/O, \ + and are thus unaffected by 'stdbuf' settings.\n"; mod options { pub const INPUT: &str = "input"; diff --git a/tests/by-util/test_stdbuf.rs b/tests/by-util/test_stdbuf.rs index 808b7382a..4105cb7a2 100644 --- a/tests/by-util/test_stdbuf.rs +++ b/tests/by-util/test_stdbuf.rs @@ -27,12 +27,12 @@ fn test_stdbuf_line_buffered_stdout() { fn test_stdbuf_no_buffer_option_fails() { new_ucmd!().args(&["head"]).fails().stderr_is( "error: The following required arguments were not provided:\n \ - --error \n \ - --input \n \ - --output \n\n\ - USAGE:\n \ - stdbuf OPTION... COMMAND\n\n\ - For more information try --help", + --error \n \ + --input \n \ + --output \n\n\ + USAGE:\n \ + stdbuf OPTION... COMMAND\n\n\ + For more information try --help", ); } diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index dddbb9c31..f3c9a7b11 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -349,7 +349,6 @@ fn test_sleep_interval() { new_ucmd!().arg("-s").arg("10").arg(FOOBAR_TXT).succeeds(); } - /// Test for reading all but the first NUM bytes: `tail -c +3`. #[test] fn test_positive_bytes() { @@ -360,7 +359,6 @@ fn test_positive_bytes() { .stdout_is("cde"); } - /// Test for reading all bytes, specified by `tail -c +0`. #[test] fn test_positive_zero_bytes() { @@ -371,7 +369,6 @@ fn test_positive_zero_bytes() { .stdout_is("abcde"); } - /// Test for reading all but the first NUM lines: `tail -n +3`. #[test] fn test_positive_lines() { @@ -382,7 +379,6 @@ fn test_positive_lines() { .stdout_is("c\nd\ne\n"); } - /// Test for reading all lines, specified by `tail -n +0`. #[test] fn test_positive_zero_lines() { diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index 1aa8d604d..df023bb0a 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -97,13 +97,9 @@ fn test_runlevel() { #[cfg(any(target_vendor = "apple", target_os = "freebsd"))] #[test] fn test_runlevel() { - let expected = - "error: Found argument"; + let expected = "error: Found argument"; for opt in vec!["-r", "--runlevel"] { - new_ucmd!() - .arg(opt) - .fails() - .stderr_contains(expected); + new_ucmd!().arg(opt).fails().stderr_contains(expected); } } From 95092e64402cf5feadeb4d5f496cc1f8cbdd239e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 23 May 2021 00:33:54 +0200 Subject: [PATCH 0661/1135] ignore test_should_calculate_implicit_padding_per_free_argument Fails from time to time with ``` ---- test_numfmt::test_should_calculate_implicit_padding_per_free_argument stdout ---- current_directory_resolved: run: /target/x86_64-unknown-linux-musl/debug/coreutils numfmt --from=auto 1Ki 2K thread 'test_numfmt::test_should_calculate_implicit_padding_per_free_argument' panicked at 'failed to write to stdin of child: Broken pipe (os error 32)', tests/common/util.rs:859:21 ``` --- tests/by-util/test_numfmt.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_numfmt.rs b/tests/by-util/test_numfmt.rs index 64fc5360d..b52dbc359 100644 --- a/tests/by-util/test_numfmt.rs +++ b/tests/by-util/test_numfmt.rs @@ -281,6 +281,7 @@ fn test_leading_whitespace_in_free_argument_should_imply_padding() { } #[test] +#[ignore] fn test_should_calculate_implicit_padding_per_free_argument() { new_ucmd!() .args(&["--from=auto", " 1Ki", " 2K"]) From 44c033a013a12adf4123d3c112c38700fc462001 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 23 May 2021 02:07:32 +0200 Subject: [PATCH 0662/1135] who: exclude --runlevel from non Linux targets (fix #2239) --- src/uu/who/src/who.rs | 39 ++++++++++++++++++--------------------- tests/by-util/test_who.rs | 26 +++++++------------------- 2 files changed, 25 insertions(+), 40 deletions(-) diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index 81fc2a687..19ae3addb 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -29,7 +29,6 @@ mod options { pub const ONLY_HOSTNAME_USER: &str = "only_hostname_user"; pub const PROCESS: &str = "process"; pub const COUNT: &str = "count"; - #[cfg(any(target_os = "linux", target_os = "android"))] pub const RUNLEVEL: &str = "runlevel"; pub const SHORT: &str = "short"; pub const TIME: &str = "time"; @@ -41,6 +40,11 @@ mod options { static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Print information about users who are currently logged in."; +#[cfg(any(target_os = "linux"))] +static RUNLEVEL_HELP: &str = "print current runlevel"; +#[cfg(not(target_os = "linux"))] +static RUNLEVEL_HELP: &str = "print current runlevel (This is meaningless on non Linux)"; + fn get_usage() -> String { format!("{0} [OPTION]... [ FILE | ARG1 ARG2 ]", executable!()) } @@ -119,13 +123,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("all login names and number of users logged on"), ) .arg( - #[cfg(any(target_os = "linux", target_os = "android"))] Arg::with_name(options::RUNLEVEL) .long(options::RUNLEVEL) .short("r") - .help("print current runlevel"), - #[cfg(any(target_vendor = "apple", target_os = "freebsd"))] - Arg::with_name(""), + .help(RUNLEVEL_HELP), ) .arg( Arg::with_name(options::SHORT) @@ -267,13 +268,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { assumptions = false; } - #[cfg(any(target_os = "linux", target_os = "android"))] - { - if matches.is_present(options::RUNLEVEL) { - need_runlevel = true; - include_idle = true; - assumptions = false; - } + if matches.is_present(options::RUNLEVEL) { + need_runlevel = true; + include_idle = true; + assumptions = false; } if matches.is_present(options::SHORT) { @@ -389,15 +387,12 @@ fn current_tty() -> String { impl Who { fn exec(&mut self) { - let run_level_chk = |record: i16| { - #[allow(unused_assignments)] - let mut res = false; + let run_level_chk = |_record: i16| { + #[cfg(not(target_os = "linux"))] + return false; - #[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))] - { - res = record == utmpx::RUN_LVL; - } - res + #[cfg(target_os = "linux")] + return _record == utmpx::RUN_LVL; }; let f = if self.args.len() == 1 { @@ -430,7 +425,9 @@ impl Who { if self.need_users && ut.is_user_process() { self.print_user(&ut); } else if self.need_runlevel && run_level_chk(ut.record_type()) { - self.print_runlevel(&ut); + if cfg!(target_os = "linux") { + self.print_runlevel(&ut); + } } else if self.need_boottime && ut.record_type() == utmpx::BOOT_TIME { self.print_boottime(&ut); } else if self.need_clockchange && ut.record_type() == utmpx::NEW_TIME { diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index 1aa8d604d..21b5eb93e 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -83,27 +83,17 @@ fn test_process() { } } -#[cfg(target_os = "linux")] #[test] fn test_runlevel() { for opt in vec!["-r", "--runlevel"] { + #[cfg(any(target_vendor = "apple", target_os = "linux"))] new_ucmd!() .arg(opt) .succeeds() .stdout_is(expected_result(&[opt])); - } -} -#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] -#[test] -fn test_runlevel() { - let expected = - "error: Found argument"; - for opt in vec!["-r", "--runlevel"] { - new_ucmd!() - .arg(opt) - .fails() - .stderr_contains(expected); + #[cfg(not(target_os = "linux"))] + new_ucmd!().arg(opt).succeeds().stdout_is(""); } } @@ -135,7 +125,6 @@ fn test_mesg() { } } -#[cfg(target_os = "linux")] #[test] fn test_arg1_arg2() { let args = ["am", "i"]; @@ -146,7 +135,6 @@ fn test_arg1_arg2() { .stdout_is(expected_result(&args)); } -#[cfg(target_os = "linux")] #[test] fn test_too_many_args() { const EXPECTED: &str = @@ -168,11 +156,11 @@ fn test_users() { let mut v_actual: Vec<&str> = actual.split_whitespace().collect(); let mut v_expect: Vec<&str> = expect.split_whitespace().collect(); - // TODO: `--users` differs from GNU's output on manOS running in CI + // TODO: `--users` differs from GNU's output on macOS // Diff < left / right > : // <"runner console 2021-05-20 22:03 00:08 196\n" // >"runner console 2021-05-20 22:03 old 196\n" - if is_ci() && cfg!(target_os = "macos") { + if cfg!(target_os = "macos") { v_actual.remove(4); v_expect.remove(4); } @@ -206,7 +194,7 @@ fn test_dead() { #[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_all_separately() { - if is_ci() && cfg!(target_os = "macos") { + if cfg!(target_os = "macos") { // TODO: fix `-u`, see: test_users return; } @@ -229,7 +217,7 @@ fn test_all_separately() { #[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_all() { - if is_ci() && cfg!(target_os = "macos") { + if cfg!(target_os = "macos") { // TODO: fix `-u`, see: test_users return; } From a746e37dc7e087159ede20c9c887015d77ff6221 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Fri, 21 May 2021 18:20:05 -0400 Subject: [PATCH 0663/1135] truncate: add test for -r and -s options together Add a test for when the reference file is not found and both `-r` and `-s` options are given on the command-line. --- tests/by-util/test_truncate.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index 120982e3c..6323b058f 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -262,3 +262,11 @@ fn test_reference_file_not_found() { .fails() .stderr_contains("cannot stat 'a': No such file or directory"); } + +#[test] +fn test_reference_with_size_file_not_found() { + new_ucmd!() + .args(&["-r", "a", "-s", "+1", "b"]) + .fails() + .stderr_contains("cannot stat 'a': No such file or directory"); +} From 5eb2a5c3e1e72e7d01ce87eed55928f37b14d5ca Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Fri, 21 May 2021 18:23:50 -0400 Subject: [PATCH 0664/1135] truncate: remove read permissions from OpenOptions Remove "read" permissions from the `OpenOptions` when opening a new file just to truncate it. We will never read from the file, only write to it. (Specifically, we will only call `File::set_len()`.) --- src/uu/truncate/src/truncate.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 03b18723c..086e14858 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -189,12 +189,7 @@ fn truncate( }; for filename in &filenames { let path = Path::new(filename); - match OpenOptions::new() - .read(true) - .write(true) - .create(!no_create) - .open(path) - { + match OpenOptions::new().write(true).create(!no_create).open(path) { Ok(file) => { let fsize = match reference { Some(_) => refsize, From 544ae875753b050a5073278e8bcb8af893e31de0 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Fri, 21 May 2021 21:06:45 -0400 Subject: [PATCH 0665/1135] truncate: add parse_mode_and_size() helper func Add a helper function to contain the code for parsing the size and the modifier symbol, if any. This commit also changes the `TruncateMode` enum so that the parameter for each "mode" is stored along with the enumeration value. This is because the parameter has a different meaning in each mode. --- src/uu/truncate/src/truncate.rs | 136 ++++++++++++++++++++------------ 1 file changed, 85 insertions(+), 51 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 086e14858..9df775300 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -15,16 +15,16 @@ use std::fs::{metadata, OpenOptions}; use std::io::ErrorKind; use std::path::Path; -#[derive(Eq, PartialEq)] +#[derive(Debug, Eq, PartialEq)] enum TruncateMode { - Absolute, - Reference, - Extend, - Reduce, - AtMost, - AtLeast, - RoundDown, - RoundUp, + Reference(u64), + Absolute(u64), + Extend(u64), + Reduce(u64), + AtMost(u64), + AtLeast(u64), + RoundDown(u64), + RoundUp(u64), } static ABOUT: &str = "Shrink or extend the size of each file to the specified size."; @@ -133,46 +133,21 @@ fn truncate( size: Option, filenames: Vec, ) { - let (modsize, mode) = match size { - Some(size_string) => { - // Trim any whitespace. - let size_string = size_string.trim(); - - // Get the modifier character from the size string, if any. For - // example, if the argument is "+123", then the modifier is '+'. - let c = size_string.chars().next().unwrap(); - - let mode = match c { - '+' => TruncateMode::Extend, - '-' => TruncateMode::Reduce, - '<' => TruncateMode::AtMost, - '>' => TruncateMode::AtLeast, - '/' => TruncateMode::RoundDown, - '%' => TruncateMode::RoundUp, - _ => TruncateMode::Absolute, /* assume that the size is just a number */ - }; - - // If there was a modifier character, strip it. - let size_string = match mode { - TruncateMode::Absolute => size_string, - _ => &size_string[1..], - }; - let num_bytes = match parse_size(size_string) { - Ok(b) => b, - Err(_) => crash!(1, "Invalid number: ‘{}’", size_string), - }; - (num_bytes, mode) - } - None => (0, TruncateMode::Reference), + let mode = match size { + Some(size_string) => match parse_mode_and_size(&size_string) { + Ok(m) => m, + Err(_) => crash!(1, "Invalid number: ‘{}’", size_string), + }, + None => TruncateMode::Reference(0), }; let refsize = match reference { Some(ref rfilename) => { match mode { // Only Some modes work with a reference - TruncateMode::Reference => (), //No --size was given - TruncateMode::Extend => (), - TruncateMode::Reduce => (), + TruncateMode::Reference(_) => (), //No --size was given + TruncateMode::Extend(_) => (), + TruncateMode::Reduce(_) => (), _ => crash!(1, "you must specify a relative ‘--size’ with ‘--reference’"), }; match metadata(rfilename) { @@ -202,14 +177,14 @@ fn truncate( }, }; let tsize: u64 = match mode { - TruncateMode::Absolute => modsize, - TruncateMode::Reference => fsize, - TruncateMode::Extend => fsize + modsize, - TruncateMode::Reduce => fsize - modsize, - TruncateMode::AtMost => fsize.min(modsize), - TruncateMode::AtLeast => fsize.max(modsize), - TruncateMode::RoundDown => fsize - fsize % modsize, - TruncateMode::RoundUp => fsize + fsize % modsize, + TruncateMode::Absolute(modsize) => modsize, + TruncateMode::Reference(_) => fsize, + TruncateMode::Extend(modsize) => fsize + modsize, + TruncateMode::Reduce(modsize) => fsize - modsize, + TruncateMode::AtMost(modsize) => fsize.min(modsize), + TruncateMode::AtLeast(modsize) => fsize.max(modsize), + TruncateMode::RoundDown(modsize) => fsize - fsize % modsize, + TruncateMode::RoundUp(modsize) => fsize + fsize % modsize, }; match file.set_len(tsize) { Ok(_) => {} @@ -221,6 +196,52 @@ fn truncate( } } +/// Decide whether a character is one of the size modifiers, like '+' or '<'. +fn is_modifier(c: char) -> bool { + c == '+' || c == '-' || c == '<' || c == '>' || c == '/' || c == '%' +} + +/// Parse a size string with optional modifier symbol as its first character. +/// +/// A size string is as described in [`parse_size`]. The first character +/// of `size_string` might be a modifier symbol, like `'+'` or +/// `'<'`. The first element of the pair returned by this function +/// indicates which modifier symbol was present, or +/// [`TruncateMode::Absolute`] if none. +/// +/// # Panics +/// +/// If `size_string` is empty, or if no number could be parsed from the +/// given string (for example, if the string were `"abc"`). +/// +/// # Examples +/// +/// ```rust,ignore +/// assert_eq!(parse_mode_and_size("+123"), (TruncateMode::Extend, 123)); +/// ``` +fn parse_mode_and_size(size_string: &str) -> Result { + // Trim any whitespace. + let size_string = size_string.trim(); + + // Get the modifier character from the size string, if any. For + // example, if the argument is "+123", then the modifier is '+'. + let c = size_string.chars().next().unwrap(); + let size_string = if is_modifier(c) { + &size_string[1..] + } else { + size_string + }; + parse_size(size_string).map(match c { + '+' => TruncateMode::Extend, + '-' => TruncateMode::Reduce, + '<' => TruncateMode::AtMost, + '>' => TruncateMode::AtLeast, + '/' => TruncateMode::RoundDown, + '%' => TruncateMode::RoundUp, + _ => TruncateMode::Absolute, + }) +} + /// Parse a size string into a number of bytes. /// /// A size string comprises an integer and an optional unit. The unit @@ -280,7 +301,9 @@ fn parse_size(size: &str) -> Result { #[cfg(test)] mod tests { + use crate::parse_mode_and_size; use crate::parse_size; + use crate::TruncateMode; #[test] fn test_parse_size_zero() { @@ -306,4 +329,15 @@ mod tests { assert_eq!(parse_size("123M").unwrap(), 123 * 1024 * 1024); assert_eq!(parse_size("123MB").unwrap(), 123 * 1000 * 1000); } + + #[test] + fn test_parse_mode_and_size() { + assert_eq!(parse_mode_and_size("10"), Ok(TruncateMode::Absolute(10))); + assert_eq!(parse_mode_and_size("+10"), Ok(TruncateMode::Extend(10))); + assert_eq!(parse_mode_and_size("-10"), Ok(TruncateMode::Reduce(10))); + assert_eq!(parse_mode_and_size("<10"), Ok(TruncateMode::AtMost(10))); + assert_eq!(parse_mode_and_size(">10"), Ok(TruncateMode::AtLeast(10))); + assert_eq!(parse_mode_and_size("/10"), Ok(TruncateMode::RoundDown(10))); + assert_eq!(parse_mode_and_size("%10"), Ok(TruncateMode::RoundUp(10))); + } } From c6d4d0c07d1f1ed5d6dbe58ca0eda5e9c939b2c2 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Fri, 21 May 2021 21:09:33 -0400 Subject: [PATCH 0666/1135] truncate: create TruncateMode::to_size() method Create a method that computes the final target size in bytes for the file to truncate, given the reference file size and the parameter to the `TruncateMode`. --- src/uu/truncate/src/truncate.rs | 37 ++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 9df775300..c0f078458 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -27,6 +27,32 @@ enum TruncateMode { RoundUp(u64), } +impl TruncateMode { + /// Compute a target size in bytes for this truncate mode. + /// + /// `fsize` is the size of the reference file, in bytes. + /// + /// # Examples + /// + /// ```rust,ignore + /// let mode = TruncateMode::Extend(5); + /// let fsize = 10; + /// assert_eq!(mode.to_size(fsize), 15); + /// ``` + fn to_size(&self, fsize: u64) -> u64 { + match self { + TruncateMode::Absolute(modsize) => *modsize, + TruncateMode::Reference(_) => fsize, + TruncateMode::Extend(modsize) => fsize + modsize, + TruncateMode::Reduce(modsize) => fsize - modsize, + TruncateMode::AtMost(modsize) => fsize.min(*modsize), + TruncateMode::AtLeast(modsize) => fsize.max(*modsize), + TruncateMode::RoundDown(modsize) => fsize - fsize % modsize, + TruncateMode::RoundUp(modsize) => fsize + fsize % modsize, + } + } +} + static ABOUT: &str = "Shrink or extend the size of each file to the specified size."; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -176,16 +202,7 @@ fn truncate( } }, }; - let tsize: u64 = match mode { - TruncateMode::Absolute(modsize) => modsize, - TruncateMode::Reference(_) => fsize, - TruncateMode::Extend(modsize) => fsize + modsize, - TruncateMode::Reduce(modsize) => fsize - modsize, - TruncateMode::AtMost(modsize) => fsize.min(modsize), - TruncateMode::AtLeast(modsize) => fsize.max(modsize), - TruncateMode::RoundDown(modsize) => fsize - fsize % modsize, - TruncateMode::RoundUp(modsize) => fsize + fsize % modsize, - }; + let tsize = mode.to_size(fsize); match file.set_len(tsize) { Ok(_) => {} Err(f) => crash!(1, "{}", f.to_string()), From 1f1cd3d966cd4317c2eec8e8dfdcfb350f79fcf4 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Fri, 21 May 2021 21:12:13 -0400 Subject: [PATCH 0667/1135] truncate: re-organize into one func for each mode Reorganize the code in `truncate.rs` into three distinct functions representing the three modes of operation of the `truncate` program. The three modes are - `truncate -r RFILE FILE`, which sets the length of `FILE` to match the length of `RFILE`, - `truncate -r RFILE -s NUM FILE`, which sets the length of `FILE` relative to the given `RFILE`, - `truncate -s NUM FILE`, which sets the length of `FILE` either absolutely or relative to its curent length. This organization of the code makes it more concise and easier to follow. --- src/uu/truncate/src/truncate.rs | 196 ++++++++++++++++++++++---------- 1 file changed, 139 insertions(+), 57 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index c0f078458..3a6077b3c 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -17,7 +17,6 @@ use std::path::Path; #[derive(Debug, Eq, PartialEq)] enum TruncateMode { - Reference(u64), Absolute(u64), Extend(u64), Reduce(u64), @@ -42,7 +41,6 @@ impl TruncateMode { fn to_size(&self, fsize: u64) -> u64 { match self { TruncateMode::Absolute(modsize) => *modsize, - TruncateMode::Reference(_) => fsize, TruncateMode::Extend(modsize) => fsize + modsize, TruncateMode::Reduce(modsize) => fsize - modsize, TruncateMode::AtMost(modsize) => fsize.min(*modsize), @@ -142,74 +140,158 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let no_create = matches.is_present(options::NO_CREATE); let reference = matches.value_of(options::REFERENCE).map(String::from); let size = matches.value_of(options::SIZE).map(String::from); - if reference.is_none() && size.is_none() { - crash!(1, "you must specify either --reference or --size"); - } else { - truncate(no_create, io_blocks, reference, size, files); + if let Err(e) = truncate(no_create, io_blocks, reference, size, files) { + match e.kind() { + ErrorKind::NotFound => { + // TODO Improve error-handling so that the error + // returned by `truncate()` provides the necessary + // parameter for formatting the error message. + let reference = matches.value_of(options::REFERENCE).map(String::from); + crash!( + 1, + "cannot stat '{}': No such file or directory", + reference.unwrap() + ); + } + _ => crash!(1, "{}", e.to_string()), + } } } 0 } +/// Truncate the named file to the specified size. +/// +/// If `create` is true, then the file will be created if it does not +/// already exist. If `size` is larger than the number of bytes in the +/// file, then the file will be padded with zeros. If `size` is smaller +/// than the number of bytes in the file, then the file will be +/// truncated and any bytes beyond `size` will be lost. +/// +/// # Errors +/// +/// If the file could not be opened, or there was a problem setting the +/// size of the file. +fn file_truncate(filename: &str, create: bool, size: u64) -> std::io::Result<()> { + let path = Path::new(filename); + let f = OpenOptions::new().write(true).create(create).open(path)?; + f.set_len(size) +} + +/// Truncate files to a size relative to a given file. +/// +/// `rfilename` is the name of the reference file. +/// +/// `size_string` gives the size relative to the reference file to which +/// to set the target files. For example, "+3K" means "set each file to +/// be three kilobytes larger than the size of the reference file". +/// +/// If `create` is true, then each file will be created if it does not +/// already exist. +/// +/// # Errors +/// +/// If the any file could not be opened, or there was a problem setting +/// the size of at least one file. +fn truncate_reference_and_size( + rfilename: &str, + size_string: &str, + filenames: Vec, + create: bool, +) -> std::io::Result<()> { + let mode = match parse_mode_and_size(size_string) { + Ok(m) => match m { + TruncateMode::Absolute(_) => { + crash!(1, "you must specify a relative ‘--size’ with ‘--reference’") + } + _ => m, + }, + Err(_) => crash!(1, "Invalid number: ‘{}’", size_string), + }; + let fsize = metadata(rfilename)?.len(); + let tsize = mode.to_size(fsize); + for filename in &filenames { + file_truncate(filename, create, tsize)?; + } + Ok(()) +} + +/// Truncate files to match the size of a given reference file. +/// +/// `rfilename` is the name of the reference file. +/// +/// If `create` is true, then each file will be created if it does not +/// already exist. +/// +/// # Errors +/// +/// If the any file could not be opened, or there was a problem setting +/// the size of at least one file. +fn truncate_reference_file_only( + rfilename: &str, + filenames: Vec, + create: bool, +) -> std::io::Result<()> { + let tsize = metadata(rfilename)?.len(); + for filename in &filenames { + file_truncate(filename, create, tsize)?; + } + Ok(()) +} + +/// Truncate files to a specified size. +/// +/// `size_string` gives either an absolute size or a relative size. A +/// relative size adjusts the size of each file relative to its current +/// size. For example, "3K" means "set each file to be three kilobytes" +/// whereas "+3K" means "set each file to be three kilobytes larger than +/// its current size". +/// +/// If `create` is true, then each file will be created if it does not +/// already exist. +/// +/// # Errors +/// +/// If the any file could not be opened, or there was a problem setting +/// the size of at least one file. +fn truncate_size_only( + size_string: &str, + filenames: Vec, + create: bool, +) -> std::io::Result<()> { + let mode = match parse_mode_and_size(size_string) { + Ok(m) => m, + Err(_) => crash!(1, "Invalid number: ‘{}’", size_string), + }; + for filename in &filenames { + let fsize = metadata(filename).map(|m| m.len()).unwrap_or(0); + let tsize = mode.to_size(fsize); + file_truncate(filename, create, tsize)?; + } + Ok(()) +} + fn truncate( no_create: bool, _: bool, reference: Option, size: Option, filenames: Vec, -) { - let mode = match size { - Some(size_string) => match parse_mode_and_size(&size_string) { - Ok(m) => m, - Err(_) => crash!(1, "Invalid number: ‘{}’", size_string), - }, - None => TruncateMode::Reference(0), - }; - - let refsize = match reference { - Some(ref rfilename) => { - match mode { - // Only Some modes work with a reference - TruncateMode::Reference(_) => (), //No --size was given - TruncateMode::Extend(_) => (), - TruncateMode::Reduce(_) => (), - _ => crash!(1, "you must specify a relative ‘--size’ with ‘--reference’"), - }; - match metadata(rfilename) { - Ok(meta) => meta.len(), - Err(f) => match f.kind() { - ErrorKind::NotFound => { - crash!(1, "cannot stat '{}': No such file or directory", rfilename) - } - _ => crash!(1, "{}", f.to_string()), - }, - } - } - None => 0, - }; - for filename in &filenames { - let path = Path::new(filename); - match OpenOptions::new().write(true).create(!no_create).open(path) { - Ok(file) => { - let fsize = match reference { - Some(_) => refsize, - None => match metadata(filename) { - Ok(meta) => meta.len(), - Err(f) => { - show_warning!("{}", f.to_string()); - continue; - } - }, - }; - let tsize = mode.to_size(fsize); - match file.set_len(tsize) { - Ok(_) => {} - Err(f) => crash!(1, "{}", f.to_string()), - }; - } - Err(f) => crash!(1, "{}", f.to_string()), +) -> std::io::Result<()> { + let create = !no_create; + // There are four possibilities + // - reference file given and size given, + // - reference file given but no size given, + // - no reference file given but size given, + // - no reference file given and no size given, + match (reference, size) { + (Some(rfilename), Some(size_string)) => { + truncate_reference_and_size(&rfilename, &size_string, filenames, create) } + (Some(rfilename), None) => truncate_reference_file_only(&rfilename, filenames, create), + (None, Some(size_string)) => truncate_size_only(&size_string, filenames, create), + (None, None) => crash!(1, "you must specify either --reference or --size"), } } From bc9db289e8edad21de4b2e57a457542d6b1280ee Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Tue, 11 May 2021 23:48:06 -0400 Subject: [PATCH 0668/1135] head: add abstractions for "all but last n lines" Add some abstractions to simplify the `rbuf_but_last_n_lines()` function, which implements the "take all but the last `n` lines" functionality of the `head` program. This commit adds - `RingBuffer`, a fixed-size ring buffer, - `ZLines`, an iterator over zero-terminated "lines", - `TakeAllBut`, an iterator over all but the last `n` elements of an iterator. These three together make the implementation of `rbuf_but_last_n_lines()` concise. --- src/uu/head/Cargo.toml | 2 +- src/uu/head/src/head.rs | 42 +++---- src/uu/head/src/lines.rs | 73 ++++++++++++ src/uu/head/src/take.rs | 93 +++++++++++++++ src/uu/tail/Cargo.toml | 2 +- src/uu/tail/src/ringbuffer.rs | 61 ---------- src/uu/tail/src/tail.rs | 3 +- src/uucore/Cargo.toml | 1 + src/uucore/src/lib/features.rs | 2 + src/uucore/src/lib/features/ringbuffer.rs | 134 ++++++++++++++++++++++ src/uucore/src/lib/lib.rs | 2 + tests/by-util/test_head.rs | 9 ++ 12 files changed, 333 insertions(+), 91 deletions(-) create mode 100644 src/uu/head/src/lines.rs create mode 100644 src/uu/head/src/take.rs delete mode 100644 src/uu/tail/src/ringbuffer.rs create mode 100644 src/uucore/src/lib/features/ringbuffer.rs diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index 3c383cb6f..661052f58 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -16,7 +16,7 @@ path = "src/head.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["ringbuffer"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 0c8b3bc88..3602b4a73 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -27,8 +27,12 @@ mod options { pub const ZERO_NAME: &str = "ZERO"; pub const FILES_NAME: &str = "FILE"; } +mod lines; mod parse; mod split; +mod take; +use lines::zlines; +use take::take_all_but; fn app<'a>() -> App<'a, 'a> { App::new(executable!()) @@ -293,36 +297,22 @@ fn rbuf_but_last_n_bytes(input: &mut impl std::io::BufRead, n: usize) -> std::io } fn rbuf_but_last_n_lines( - input: &mut impl std::io::BufRead, + input: impl std::io::BufRead, n: usize, zero: bool, ) -> std::io::Result<()> { - if n == 0 { - //prints everything - return rbuf_n_bytes(input, std::usize::MAX); + if zero { + let stdout = std::io::stdout(); + let mut stdout = stdout.lock(); + for bytes in take_all_but(zlines(input), n) { + stdout.write_all(&bytes?)?; + } + } else { + for line in take_all_but(input.lines(), n) { + println!("{}", line?); + } } - let mut ringbuf = vec![Vec::new(); n]; - let stdout = std::io::stdout(); - let mut stdout = stdout.lock(); - let mut line = Vec::new(); - let mut lines = 0usize; - split::walk_lines(input, zero, |e| match e { - split::Event::Data(dat) => { - line.extend_from_slice(dat); - Ok(true) - } - split::Event::Line => { - if lines < n { - ringbuf[lines] = std::mem::replace(&mut line, Vec::new()); - lines += 1; - } else { - stdout.write_all(&ringbuf[0])?; - ringbuf.rotate_left(1); - ringbuf[n - 1] = std::mem::replace(&mut line, Vec::new()); - } - Ok(true) - } - }) + Ok(()) } fn head_backwards_file(input: &mut std::fs::File, options: &HeadOptions) -> std::io::Result<()> { diff --git a/src/uu/head/src/lines.rs b/src/uu/head/src/lines.rs new file mode 100644 index 000000000..dcae27bc8 --- /dev/null +++ b/src/uu/head/src/lines.rs @@ -0,0 +1,73 @@ +//! Iterate over zero-terminated lines. +use std::io::BufRead; + +/// The zero byte, representing the null character. +const ZERO: u8 = 0; + +/// Returns an iterator over the lines of the given reader. +/// +/// The iterator returned from this function will yield instances of +/// [`io::Result`]<[`Vec`]<[`u8`]>>, representing the bytes of the line +/// *including* the null character (with the possible exception of the +/// last line, which may not have one). +/// +/// # Examples +/// +/// ```rust,ignore +/// use std::io::Cursor; +/// +/// let cursor = Cursor::new(b"x\0y\0z\0"); +/// let mut iter = zlines(cursor).map(|l| l.unwrap()); +/// assert_eq!(iter.next(), Some(b"x\0".to_vec())); +/// assert_eq!(iter.next(), Some(b"y\0".to_vec())); +/// assert_eq!(iter.next(), Some(b"z\0".to_vec())); +/// assert_eq!(iter.next(), None); +/// ``` +pub fn zlines(buf: B) -> ZLines { + ZLines { buf } +} + +/// An iterator over the zero-terminated lines of an instance of `BufRead`. +pub struct ZLines { + buf: B, +} + +impl Iterator for ZLines { + type Item = std::io::Result>; + + fn next(&mut self) -> Option>> { + let mut buf = Vec::new(); + match self.buf.read_until(ZERO, &mut buf) { + Ok(0) => None, + Ok(_) => Some(Ok(buf)), + Err(e) => Some(Err(e)), + } + } +} + +#[cfg(test)] +mod tests { + + use crate::lines::zlines; + use std::io::Cursor; + + #[test] + fn test_null_terminated() { + let cursor = Cursor::new(b"x\0y\0z\0"); + let mut iter = zlines(cursor).map(|l| l.unwrap()); + assert_eq!(iter.next(), Some(b"x\0".to_vec())); + assert_eq!(iter.next(), Some(b"y\0".to_vec())); + assert_eq!(iter.next(), Some(b"z\0".to_vec())); + assert_eq!(iter.next(), None); + } + + #[test] + fn test_not_null_terminated() { + let cursor = Cursor::new(b"x\0y\0z"); + let mut iter = zlines(cursor).map(|l| l.unwrap()); + assert_eq!(iter.next(), Some(b"x\0".to_vec())); + assert_eq!(iter.next(), Some(b"y\0".to_vec())); + assert_eq!(iter.next(), Some(b"z".to_vec())); + assert_eq!(iter.next(), None); + } +} diff --git a/src/uu/head/src/take.rs b/src/uu/head/src/take.rs new file mode 100644 index 000000000..94fa012be --- /dev/null +++ b/src/uu/head/src/take.rs @@ -0,0 +1,93 @@ +//! Take all but the last elements of an iterator. +use uucore::ringbuffer::RingBuffer; + +/// Create an iterator over all but the last `n` elements of `iter`. +/// +/// # Examples +/// +/// ```rust,ignore +/// let data = [1, 2, 3, 4, 5]; +/// let n = 2; +/// let mut iter = take_all_but(data.iter(), n); +/// assert_eq!(Some(4), iter.next()); +/// assert_eq!(Some(5), iter.next()); +/// assert_eq!(None, iter.next()); +/// ``` +pub fn take_all_but(iter: I, n: usize) -> TakeAllBut { + TakeAllBut::new(iter, n) +} + +/// An iterator that only iterates over the last elements of another iterator. +pub struct TakeAllBut { + iter: I, + buf: RingBuffer<::Item>, +} + +impl TakeAllBut { + pub fn new(mut iter: I, n: usize) -> TakeAllBut { + // Create a new ring buffer and fill it up. + // + // If there are fewer than `n` elements in `iter`, then we + // exhaust the iterator so that whenever `TakeAllBut::next()` is + // called, it will return `None`, as expected. + let mut buf = RingBuffer::new(n); + for _ in 0..n { + let value = match iter.next() { + None => { + break; + } + Some(x) => x, + }; + buf.push_back(value); + } + TakeAllBut { iter, buf } + } +} + +impl Iterator for TakeAllBut +where + I: Iterator, +{ + type Item = ::Item; + + fn next(&mut self) -> Option<::Item> { + match self.iter.next() { + Some(value) => self.buf.push_back(value), + None => None, + } + } +} + +#[cfg(test)] +mod tests { + + use crate::take::take_all_but; + + #[test] + fn test_fewer_elements() { + let mut iter = take_all_but([0, 1, 2].iter(), 2); + assert_eq!(Some(&0), iter.next()); + assert_eq!(None, iter.next()); + } + + #[test] + fn test_same_number_of_elements() { + let mut iter = take_all_but([0, 1].iter(), 2); + assert_eq!(None, iter.next()); + } + + #[test] + fn test_more_elements() { + let mut iter = take_all_but([0].iter(), 2); + assert_eq!(None, iter.next()); + } + + #[test] + fn test_zero_elements() { + let mut iter = take_all_but([0, 1, 2].iter(), 0); + assert_eq!(Some(&0), iter.next()); + assert_eq!(Some(&1), iter.next()); + assert_eq!(Some(&2), iter.next()); + assert_eq!(None, iter.next()); + } +} diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index d3f60e09b..273c67bb3 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -17,7 +17,7 @@ path = "src/tail.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["ringbuffer"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=["fileapi", "handleapi", "processthreadsapi", "synchapi", "winbase"] } diff --git a/src/uu/tail/src/ringbuffer.rs b/src/uu/tail/src/ringbuffer.rs deleted file mode 100644 index 86483b8ed..000000000 --- a/src/uu/tail/src/ringbuffer.rs +++ /dev/null @@ -1,61 +0,0 @@ -//! A fixed-size ring buffer. -use std::collections::VecDeque; - -/// A fixed-size ring buffer backed by a `VecDeque`. -/// -/// If the ring buffer is not full, then calling the [`push_back`] -/// method appends elements, as in a [`VecDeque`]. If the ring buffer -/// is full, then calling [`push_back`] removes the element at the -/// front of the buffer (in a first-in, first-out manner) before -/// appending the new element to the back of the buffer. -/// -/// Use [`from_iter`] to take the last `size` elements from an -/// iterator. -/// -/// # Examples -/// -/// After exceeding the size limit, the oldest elements are dropped in -/// favor of the newest element: -/// -/// ```rust,ignore -/// let buffer: RingBuffer = RingBuffer::new(2); -/// buffer.push_back(0); -/// buffer.push_back(1); -/// buffer.push_back(2); -/// assert_eq!(vec![1, 2], buffer.data); -/// ``` -/// -/// Take the last `n` elements from an iterator: -/// -/// ```rust,ignore -/// let iter = vec![0, 1, 2, 3].iter(); -/// assert_eq!(vec![2, 3], RingBuffer::from_iter(iter, 2).data); -/// ``` -pub struct RingBuffer { - pub data: VecDeque, - size: usize, -} - -impl RingBuffer { - pub fn new(size: usize) -> RingBuffer { - RingBuffer { - data: VecDeque::new(), - size, - } - } - - pub fn from_iter(iter: impl Iterator, size: usize) -> RingBuffer { - let mut ringbuf = RingBuffer::new(size); - for value in iter { - ringbuf.push_back(value); - } - ringbuf - } - - pub fn push_back(&mut self, value: T) { - if self.size <= self.data.len() { - self.data.pop_front(); - } - self.data.push_back(value) - } -} diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 06d0e6fdb..15a819d35 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -17,9 +17,7 @@ extern crate uucore; mod chunks; mod platform; -mod ringbuffer; use chunks::ReverseChunks; -use ringbuffer::RingBuffer; use clap::{App, Arg}; use std::collections::VecDeque; @@ -30,6 +28,7 @@ use std::io::{stdin, stdout, BufRead, BufReader, Read, Seek, SeekFrom, Write}; use std::path::Path; use std::thread::sleep; use std::time::Duration; +use uucore::ringbuffer::RingBuffer; pub mod options { pub mod verbosity { diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 85efe0434..482252680 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -47,6 +47,7 @@ mode = ["libc"] parse_time = [] perms = ["libc"] process = ["libc"] +ringbuffer = [] signals = [] utf8 = [] utmpx = ["time", "libc"] diff --git a/src/uucore/src/lib/features.rs b/src/uucore/src/lib/features.rs index 0287b9675..310a41fe1 100644 --- a/src/uucore/src/lib/features.rs +++ b/src/uucore/src/lib/features.rs @@ -8,6 +8,8 @@ pub mod fs; pub mod fsext; #[cfg(feature = "parse_time")] pub mod parse_time; +#[cfg(feature = "ringbuffer")] +pub mod ringbuffer; #[cfg(feature = "zero-copy")] pub mod zero_copy; diff --git a/src/uucore/src/lib/features/ringbuffer.rs b/src/uucore/src/lib/features/ringbuffer.rs new file mode 100644 index 000000000..60847df8f --- /dev/null +++ b/src/uucore/src/lib/features/ringbuffer.rs @@ -0,0 +1,134 @@ +//! A fixed-size ring buffer. +use std::collections::VecDeque; + +/// A fixed-size ring buffer backed by a `VecDeque`. +/// +/// If the ring buffer is not full, then calling the [`push_back`] +/// method appends elements, as in a [`VecDeque`]. If the ring buffer +/// is full, then calling [`push_back`] removes the element at the +/// front of the buffer (in a first-in, first-out manner) before +/// appending the new element to the back of the buffer. +/// +/// Use [`from_iter`] to take the last `size` elements from an +/// iterator. +/// +/// # Examples +/// +/// After exceeding the size limit, the oldest elements are dropped in +/// favor of the newest element: +/// +/// ```rust,ignore +/// let mut buffer: RingBuffer = RingBuffer::new(2); +/// buffer.push_back(0); +/// buffer.push_back(1); +/// buffer.push_back(2); +/// assert_eq!(vec![1, 2], buffer.data); +/// ``` +/// +/// Take the last `n` elements from an iterator: +/// +/// ```rust,ignore +/// let iter = [0, 1, 2].iter(); +/// let actual = RingBuffer::from_iter(iter, 2).data; +/// let expected = VecDeque::from_iter([1, 2].iter()); +/// assert_eq!(expected, actual); +/// ``` +pub struct RingBuffer { + pub data: VecDeque, + size: usize, +} + +impl RingBuffer { + pub fn new(size: usize) -> RingBuffer { + RingBuffer { + data: VecDeque::new(), + size, + } + } + + pub fn from_iter(iter: impl Iterator, size: usize) -> RingBuffer { + let mut ringbuf = RingBuffer::new(size); + for value in iter { + ringbuf.push_back(value); + } + ringbuf + } + + /// Append a value to the end of the ring buffer. + /// + /// If the ring buffer is not full, this method return [`None`]. If + /// the ring buffer is full, appending a new element will cause the + /// oldest element to be evicted. In that case this method returns + /// that element, or `None`. + /// + /// In the special case where the size limit is zero, each call to + /// this method with input `value` returns `Some(value)`, because + /// the input is immediately evicted. + /// + /// # Examples + /// + /// Appending an element when the buffer is full returns the oldest + /// element: + /// + /// ```rust,ignore + /// let mut buf = RingBuffer::new(3); + /// assert_eq!(None, buf.push_back(0)); + /// assert_eq!(None, buf.push_back(1)); + /// assert_eq!(None, buf.push_back(2)); + /// assert_eq!(Some(0), buf.push_back(3)); + /// ``` + /// + /// If the size limit is zero, then this method always returns the + /// input value: + /// + /// ```rust,ignore + /// let mut buf = RingBuffer::new(0); + /// assert_eq!(Some(0), buf.push_back(0)); + /// assert_eq!(Some(1), buf.push_back(1)); + /// assert_eq!(Some(2), buf.push_back(2)); + /// ``` + pub fn push_back(&mut self, value: T) -> Option { + if self.size == 0 { + return Some(value); + } + let result = if self.size <= self.data.len() { + self.data.pop_front() + } else { + None + }; + self.data.push_back(value); + result + } +} + +#[cfg(test)] +mod tests { + + use crate::ringbuffer::RingBuffer; + use std::collections::VecDeque; + use std::iter::FromIterator; + + #[test] + fn test_size_limit_zero() { + let mut buf = RingBuffer::new(0); + assert_eq!(Some(0), buf.push_back(0)); + assert_eq!(Some(1), buf.push_back(1)); + assert_eq!(Some(2), buf.push_back(2)); + } + + #[test] + fn test_evict_oldest() { + let mut buf = RingBuffer::new(2); + assert_eq!(None, buf.push_back(0)); + assert_eq!(None, buf.push_back(1)); + assert_eq!(Some(0), buf.push_back(2)); + } + + #[test] + fn test_from_iter() { + let iter = [0, 1, 2].iter(); + let actual = RingBuffer::from_iter(iter, 2).data; + let expected = VecDeque::from_iter([1, 2].iter()); + assert_eq!(expected, actual); + } +} diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 28bae08cb..eb630f53a 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -39,6 +39,8 @@ pub use crate::features::fs; pub use crate::features::fsext; #[cfg(feature = "parse_time")] pub use crate::features::parse_time; +#[cfg(feature = "ringbuffer")] +pub use crate::features::ringbuffer; #[cfg(feature = "zero-copy")] pub use crate::features::zero_copy; diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index 88df1f068..b2a3cf0cb 100755 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -129,6 +129,15 @@ fn test_zero_terminated_syntax_2() { .stdout_is("x\0y"); } +#[test] +fn test_zero_terminated_negative_lines() { + new_ucmd!() + .args(&["-z", "-n", "-1"]) + .pipe_in("x\0y\0z\0") + .run() + .stdout_is("x\0y\0"); +} + #[test] fn test_negative_byte_syntax() { new_ucmd!() From 1860e61f8344dc7bc7451ea67869190b8e0f21ee Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 23 May 2021 10:19:25 +0200 Subject: [PATCH 0669/1135] Workaround the Windows CI install issue. Fails trom time to time with: ``` info: installing component 'rustc' memory allocation of 16777216 bytes failed Error: The process 'C:\Rust\.cargo\bin\rustup.exe' failed with exit code 3221226505 ``` on Build (windows-latest, i686-pc-windows-gnu, feat_os_windows) --- .github/workflows/CICD.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index bb29355cf..977a86915 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -363,6 +363,10 @@ jobs: mkdir -p '${{ steps.vars.outputs.STAGING }}/dpkg' - 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" with: toolchain: ${{ steps.vars.outputs.TOOLCHAIN }} target: ${{ matrix.job.target }} From 218f523e1b813e9f1f8fa239d78690e72524b202 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sun, 23 May 2021 21:58:18 +0200 Subject: [PATCH 0670/1135] expr: make substr infallible Instead of returning an Err it should return the "null string" (in our case that's the empty string) when the offset or length is invalid. --- src/uu/expr/src/syntax_tree.rs | 36 ++++++++++++---------------------- tests/by-util/test_expr.rs | 29 +++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 24 deletions(-) diff --git a/src/uu/expr/src/syntax_tree.rs b/src/uu/expr/src/syntax_tree.rs index c81adf0c8..a75f4c742 100644 --- a/src/uu/expr/src/syntax_tree.rs +++ b/src/uu/expr/src/syntax_tree.rs @@ -153,7 +153,7 @@ impl AstNode { ":" | "match" => operator_match(&operand_values), "length" => Ok(prefix_operator_length(&operand_values)), "index" => Ok(prefix_operator_index(&operand_values)), - "substr" => prefix_operator_substr(&operand_values), + "substr" => Ok(prefix_operator_substr(&operand_values)), _ => Err(format!("operation not implemented: {}", op_type)), }, @@ -522,35 +522,23 @@ fn prefix_operator_index(values: &[String]) -> String { "0".to_string() } -fn prefix_operator_substr(values: &[String]) -> Result { +fn prefix_operator_substr(values: &[String]) -> String { assert!(values.len() == 3); let subj = &values[0]; - let mut idx = match values[1].parse::() { - Ok(i) => i, - Err(_) => return Err("expected integer as POS arg to 'substr'".to_string()), + let idx = match values[1] + .parse::() + .ok() + .and_then(|v| v.checked_sub(1)) + { + Some(i) => i, + None => return String::new(), }; - let mut len = match values[2].parse::() { + let len = match values[2].parse::() { Ok(i) => i, - Err(_) => return Err("expected integer as LENGTH arg to 'substr'".to_string()), + Err(_) => return String::new(), }; - if idx <= 0 || len <= 0 { - return Ok("".to_string()); - } - - let mut out_str = String::new(); - for ch in subj.chars() { - idx -= 1; - if idx <= 0 { - if len <= 0 { - break; - } - len -= 1; - - out_str.push(ch); - } - } - Ok(out_str) + subj.chars().skip(idx).take(len).collect() } fn bool_as_int(b: bool) -> i64 { diff --git a/tests/by-util/test_expr.rs b/tests/by-util/test_expr.rs index bb0760676..6a969b5e9 100644 --- a/tests/by-util/test_expr.rs +++ b/tests/by-util/test_expr.rs @@ -54,3 +54,32 @@ fn test_and() { new_ucmd!().args(&["", "&", "1"]).run().stdout_is("0\n"); } + +#[test] +fn test_substr() { + new_ucmd!() + .args(&["substr", "abc", "1", "1"]) + .succeeds() + .stdout_only("a\n"); +} + +#[test] +fn test_invalid_substr() { + new_ucmd!() + .args(&["substr", "abc", "0", "1"]) + .fails() + .status_code(1) + .stdout_only("\n"); + + new_ucmd!() + .args(&["substr", "abc", &(std::usize::MAX.to_string() + "0"), "1"]) + .fails() + .status_code(1) + .stdout_only("\n"); + + new_ucmd!() + .args(&["substr", "abc", "0", &(std::usize::MAX.to_string() + "0")]) + .fails() + .status_code(1) + .stdout_only("\n"); +} From 991fcc548cce95318c73629ecbf710deecad4589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ya=C4=9F=C4=B1z=20can=20De=C4=9Firmenci?= Date: Mon, 24 May 2021 21:07:45 +0300 Subject: [PATCH 0671/1135] fix: log error messages properly on permission errors --- src/uu/mv/src/mv.rs | 33 +++++++++++++++++++++++++-------- tests/by-util/test_mv.rs | 18 ++++++++++++++++++ 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index f57178a09..95b2fd423 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -291,12 +291,22 @@ fn exec(files: &[PathBuf], b: Behavior) -> i32 { return match rename(source, target, &b) { Err(e) => { - show_error!( - "cannot move ‘{}’ to ‘{}’: {}", - source.display(), - target.display(), - e - ); + let error_as_str = e.to_string(); + let is_perm_denied = error_as_str.contains("Permission denied"); + match e.kind() { + _ => { + show_error!( + "cannot move ‘{}’ to ‘{}’: {}", + source.display(), + target.display(), + if is_perm_denied { + "Permission denied".to_string() + } else { + e.to_string() + } + ); + } + } 1 } _ => 0, @@ -357,15 +367,22 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> i3 }; if let Err(e) = rename(sourcepath, &targetpath, b) { + let error_as_str = e.to_string(); + let is_perm_denied = error_as_str.contains("Permission denied"); show_error!( - "mv: cannot move ‘{}’ to ‘{}’: {}", + "cannot move ‘{}’ to ‘{}’: {}", sourcepath.display(), targetpath.display(), - e + if is_perm_denied { + "Permission denied".to_string() + } else { + e.to_string() + } ); all_successful = false; } } + if all_successful { 0 } else { diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index e8ba43282..47532e2e5 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -587,6 +587,24 @@ fn test_mv_verbose() { )); } +#[test] +fn test_mv_permission_error() { + let scene = TestScenario::new("mkdir"); + let folder1 = "bar"; + let folder2 = "foo"; + let folder_to_move = "bar/foo"; + scene.ucmd().arg("-m444").arg(folder1).succeeds(); + scene.ucmd().arg("-m777").arg(folder2).succeeds(); + + scene + .cmd_keepenv(util_name!()) + .arg(folder2) + .arg(folder_to_move) + .run() + .stderr_str() + .ends_with("Permission denied"); +} + // Todo: // $ at.touch a b From e5e7ca8dc5cc4f4a2cdb9cdc9d24bb24d24b3fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ya=C4=9F=C4=B1z=20can=20De=C4=9Firmenci?= Date: Mon, 24 May 2021 21:20:59 +0300 Subject: [PATCH 0672/1135] fix: simplify logic --- src/uu/mv/src/mv.rs | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 95b2fd423..a0ff1bcc6 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -291,22 +291,12 @@ fn exec(files: &[PathBuf], b: Behavior) -> i32 { return match rename(source, target, &b) { Err(e) => { - let error_as_str = e.to_string(); - let is_perm_denied = error_as_str.contains("Permission denied"); - match e.kind() { - _ => { - show_error!( - "cannot move ‘{}’ to ‘{}’: {}", - source.display(), - target.display(), - if is_perm_denied { - "Permission denied".to_string() - } else { - e.to_string() - } - ); - } - } + show_error!( + "cannot move ‘{}’ to ‘{}’: {}", + source.display(), + target.display(), + e.to_string() + ); 1 } _ => 0, @@ -367,17 +357,11 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> i3 }; if let Err(e) = rename(sourcepath, &targetpath, b) { - let error_as_str = e.to_string(); - let is_perm_denied = error_as_str.contains("Permission denied"); show_error!( "cannot move ‘{}’ to ‘{}’: {}", sourcepath.display(), targetpath.display(), - if is_perm_denied { - "Permission denied".to_string() - } else { - e.to_string() - } + e.to_string() ); all_successful = false; } @@ -469,7 +453,13 @@ fn rename_with_fallback(from: &Path, to: &Path) -> io::Result<()> { ..DirCopyOptions::new() }; if let Err(err) = move_dir(from, to, &options) { - return Err(io::Error::new(io::ErrorKind::Other, format!("{:?}", err))); + return match err.kind { + fs_extra::error::ErrorKind::PermissionDenied => Err(io::Error::new( + io::ErrorKind::PermissionDenied, + "Permission denied", + )), + _ => Err(io::Error::new(io::ErrorKind::Other, format!("{:?}", err))), + }; } } else { fs::copy(from, to).and_then(|_| fs::remove_file(from))?; From 962e4198b2a64b827d197b7ee011d986fe2da264 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 24 May 2021 22:32:23 +0200 Subject: [PATCH 0673/1135] gnu/ci: limit the number of factor runs --- util/build-gnu.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 667dc8e46..c2659ae11 100644 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -43,7 +43,8 @@ sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\ sed -i 's| tr | /usr/bin/tr |' tests/init.sh make # Generate the factor tests, so they can be fixed -for i in {00..36} +# Used to be 36. Reduced to 20 to decrease the log size +for i in {00..20} do make tests/factor/t${i}.sh done From 98f09a6b8b08b705dca590924101fd24e4bc2f76 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 24 May 2021 22:32:48 +0200 Subject: [PATCH 0674/1135] gnu/ci: don't run seq-precision - logs are too long --- util/build-gnu.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index c2659ae11..e8ab4e44d 100644 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -58,6 +58,10 @@ sed -i -e '/tests\/misc\/invalid-opt.pl/ D' \ -e '/tests\/misc\/help-version-getopt.sh/ D' \ Makefile +# logs are clotted because of this test +sed -i -e '/tests\/misc\/seq-precision.sh/ D' \ + Makefile + # printf doesn't limit the values used in its arg, so this produced ~2GB of output sed -i '/INT_OFLOW/ D' tests/misc/printf.sh From 97d15e34d984d3e73b4cc8f6102523c343ac9075 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 25 May 2021 14:58:56 +0200 Subject: [PATCH 0675/1135] Disable some factor tests --- util/build-gnu.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index e8ab4e44d..9d73450f6 100644 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -48,6 +48,14 @@ for i in {00..20} do make tests/factor/t${i}.sh done + +# strip the long stuff +for i in {21..36} +do + sed -i -e "s/\$(tf)\/t${i}.sh//g" Makefile +done + + grep -rl 'path_prepend_' tests/* | xargs sed -i 's|path_prepend_ ./src||' sed -i -e 's|^seq |/usr/bin/seq |' -e 's|sha1sum |/usr/bin/sha1sum |' tests/factor/t*sh From a77e92cc96ec6f7e93fdf0ef6f8d3ac904323e61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ya=C4=9F=C4=B1z=20can=20De=C4=9Firmenci?= Date: Wed, 26 May 2021 01:53:40 +0300 Subject: [PATCH 0676/1135] chore: delete unused macros --- src/uucore/src/lib/macros.rs | 56 ------------------------------------ 1 file changed, 56 deletions(-) diff --git a/src/uucore/src/lib/macros.rs b/src/uucore/src/lib/macros.rs index 637e91f8f..00bdf2939 100644 --- a/src/uucore/src/lib/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -176,13 +176,6 @@ macro_rules! msg_invalid_input { }; } -#[macro_export] -macro_rules! snippet_no_file_at_path { - ($path:expr) => { - format!("nonexistent path {}", $path) - }; -} - // -- message templates : invalid input : flag #[macro_export] @@ -229,55 +222,6 @@ macro_rules! msg_opt_invalid_should_be { }; } -// -- message templates : invalid input : args - -#[macro_export] -macro_rules! msg_arg_invalid_value { - ($expects:expr, $received:expr) => { - msg_invalid_input!(format!( - "expects its argument to be {}, but was provided {}", - $expects, $received - )) - }; -} - -#[macro_export] -macro_rules! msg_args_invalid_value { - ($expects:expr, $received:expr) => { - msg_invalid_input!(format!( - "expects its arguments to be {}, but was provided {}", - $expects, $received - )) - }; - ($msg:expr) => { - msg_invalid_input!($msg) - }; -} - -#[macro_export] -macro_rules! msg_args_nonexistent_file { - ($received:expr) => { - msg_args_invalid_value!("paths to files", snippet_no_file_at_path!($received)) - }; -} - -#[macro_export] -macro_rules! msg_wrong_number_of_arguments { - () => { - msg_args_invalid_value!("wrong number of arguments") - }; - ($min:expr, $max:expr) => { - msg_args_invalid_value!(format!("expects {}-{} arguments", $min, $max)) - }; - ($exact:expr) => { - if $exact == 1 { - msg_args_invalid_value!("expects 1 argument") - } else { - msg_args_invalid_value!(format!("expects {} arguments", $exact)) - } - }; -} - // -- message templates : invalid input : input combinations #[macro_export] From c78a7937f8debc78b4a0016ad4f1cecd759a3437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ya=C4=9F=C4=B1z=20can=20De=C4=9Firmenci?= Date: Wed, 26 May 2021 02:27:10 +0300 Subject: [PATCH 0677/1135] chore: delete show_info macro and replace with show_error --- src/uu/cat/src/cat.rs | 2 +- src/uu/chgrp/src/chgrp.rs | 24 ++++++++++++------------ src/uu/chmod/src/chmod.rs | 4 ++-- src/uu/chown/src/chown.rs | 26 +++++++++++++------------- src/uu/dircolors/src/dircolors.rs | 6 +++--- src/uu/install/src/install.rs | 20 ++++++++++---------- src/uu/install/src/mode.rs | 2 +- src/uu/mkdir/src/mkdir.rs | 4 ++-- src/uu/mknod/src/mknod.rs | 2 +- src/uu/mktemp/src/mktemp.rs | 6 +++--- src/uu/nohup/src/nohup.rs | 10 +++++----- src/uu/numfmt/src/numfmt.rs | 2 +- src/uu/stat/src/stat.rs | 6 +++--- src/uu/tee/src/tee.rs | 6 +++--- src/uucore/src/lib/macros.rs | 9 --------- 15 files changed, 60 insertions(+), 69 deletions(-) diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index 8dea096be..69ea902e6 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -347,7 +347,7 @@ fn cat_files(files: Vec, options: &OutputOptions) -> Result<(), u32> { for path in &files { if let Err(err) = cat_path(path, &options, &mut state) { - show_info!("{}: {}", path, err); + show_error!("{}: {}", path, err); error_count += 1; } } diff --git a/src/uu/chgrp/src/chgrp.rs b/src/uu/chgrp/src/chgrp.rs index 2afef7de0..f6afc2805 100644 --- a/src/uu/chgrp/src/chgrp.rs +++ b/src/uu/chgrp/src/chgrp.rs @@ -97,7 +97,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if recursive { if bit_flag == FTS_PHYSICAL { if derefer == 1 { - show_info!("-R --dereference requires -H or -L"); + show_error!("-R --dereference requires -H or -L"); return 1; } derefer = 0; @@ -132,7 +132,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { dest_gid = meta.gid(); } Err(e) => { - show_info!("failed to get attributes of '{}': {}", file, e); + show_error!("failed to get attributes of '{}': {}", file, e); return 1; } } @@ -143,7 +143,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { dest_gid = g; } _ => { - show_info!("invalid group: {}", matches.free[0].as_str()); + show_error!("invalid group: {}", matches.free[0].as_str()); return 1; } } @@ -235,8 +235,8 @@ impl Chgrper { if let Some(p) = may_exist { if p.parent().is_none() || self.is_bind_root(p) { - show_info!("it is dangerous to operate recursively on '/'"); - show_info!("use --no-preserve-root to override this failsafe"); + show_error!("it is dangerous to operate recursively on '/'"); + show_error!("use --no-preserve-root to override this failsafe"); return 1; } } @@ -250,12 +250,12 @@ impl Chgrper { self.verbosity.clone(), ) { Ok(n) => { - show_info!("{}", n); + show_error!("{}", n); 0 } Err(e) => { if self.verbosity != Verbosity::Silent { - show_info!("{}", e); + show_error!("{}", e); } 1 } @@ -275,7 +275,7 @@ impl Chgrper { for entry in WalkDir::new(root).follow_links(follow).min_depth(1) { let entry = unwrap!(entry, e, { ret = 1; - show_info!("{}", e); + show_error!("{}", e); continue; }); let path = entry.path(); @@ -290,13 +290,13 @@ impl Chgrper { ret = match wrap_chgrp(path, &meta, self.dest_gid, follow, self.verbosity.clone()) { Ok(n) => { if !n.is_empty() { - show_info!("{}", n); + show_error!("{}", n); } 0 } Err(e) => { if self.verbosity != Verbosity::Silent { - show_info!("{}", e); + show_error!("{}", e); } 1 } @@ -313,7 +313,7 @@ impl Chgrper { unwrap!(path.metadata(), e, { match self.verbosity { Silent => (), - _ => show_info!("cannot access '{}': {}", path.display(), e), + _ => show_error!("cannot access '{}': {}", path.display(), e), } return None; }) @@ -321,7 +321,7 @@ impl Chgrper { unwrap!(path.symlink_metadata(), e, { match self.verbosity { Silent => (), - _ => show_info!("cannot dereference '{}': {}", path.display(), e), + _ => show_error!("cannot dereference '{}': {}", path.display(), e), } return None; }) diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index 88e3403fe..9dea3c842 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -316,7 +316,7 @@ impl Chmoder { show_error!("{}", err); } if self.verbose { - show_info!( + show_error!( "failed to change mode of file '{}' from {:o} ({}) to {:o} ({})", file.display(), fperm, @@ -328,7 +328,7 @@ impl Chmoder { Err(1) } else { if self.verbose || self.changes { - show_info!( + show_error!( "mode of '{}' changed from {:o} ({}) to {:o} ({})", file.display(), fperm, diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index ff9c42dd0..3d0b25814 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -199,7 +199,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if recursive { if bit_flag == FTS_PHYSICAL { if derefer == 1 { - show_info!("-R --dereference requires -H or -L"); + show_error!("-R --dereference requires -H or -L"); return 1; } derefer = 0; @@ -227,7 +227,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Ok((Some(uid), Some(gid))) => IfFrom::UserGroup(uid, gid), Ok((None, None)) => IfFrom::All, Err(e) => { - show_info!("{}", e); + show_error!("{}", e); return 1; } } @@ -244,7 +244,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { dest_uid = Some(meta.uid()); } Err(e) => { - show_info!("failed to get attributes of '{}': {}", file, e); + show_error!("failed to get attributes of '{}': {}", file, e); return 1; } } @@ -255,7 +255,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { dest_gid = g; } Err(e) => { - show_info!("{}", e); + show_error!("{}", e); return 1; } } @@ -377,8 +377,8 @@ impl Chowner { if let Some(p) = may_exist { if p.parent().is_none() { - show_info!("it is dangerous to operate recursively on '/'"); - show_info!("use --no-preserve-root to override this failsafe"); + show_error!("it is dangerous to operate recursively on '/'"); + show_error!("use --no-preserve-root to override this failsafe"); return 1; } } @@ -395,13 +395,13 @@ impl Chowner { ) { Ok(n) => { if !n.is_empty() { - show_info!("{}", n); + show_error!("{}", n); } 0 } Err(e) => { if self.verbosity != Verbosity::Silent { - show_info!("{}", e); + show_error!("{}", e); } 1 } @@ -424,7 +424,7 @@ impl Chowner { for entry in WalkDir::new(root).follow_links(follow).min_depth(1) { let entry = unwrap!(entry, e, { ret = 1; - show_info!("{}", e); + show_error!("{}", e); continue; }); let path = entry.path(); @@ -450,13 +450,13 @@ impl Chowner { ) { Ok(n) => { if !n.is_empty() { - show_info!("{}", n); + show_error!("{}", n); } 0 } Err(e) => { if self.verbosity != Verbosity::Silent { - show_info!("{}", e); + show_error!("{}", e); } 1 } @@ -472,7 +472,7 @@ impl Chowner { unwrap!(path.metadata(), e, { match self.verbosity { Silent => (), - _ => show_info!("cannot access '{}': {}", path.display(), e), + _ => show_error!("cannot access '{}': {}", path.display(), e), } return None; }) @@ -480,7 +480,7 @@ impl Chowner { unwrap!(path.symlink_metadata(), e, { match self.verbosity { Silent => (), - _ => show_info!("cannot dereference '{}': {}", path.display(), e), + _ => show_error!("cannot dereference '{}': {}", path.display(), e), } return None; }) diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index a2d819620..b6942c2d2 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -105,7 +105,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if out_format == OutputFmt::Unknown { match guess_syntax() { OutputFmt::Unknown => { - show_info!("no SHELL environment variable, and no shell type option given"); + show_error!("no SHELL environment variable, and no shell type option given"); return 1; } fmt => out_format = fmt, @@ -130,7 +130,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) } Err(e) => { - show_info!("{}: {}", matches.free[0], e); + show_error!("{}: {}", matches.free[0], e); return 1; } } @@ -141,7 +141,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } Err(s) => { - show_info!("{}", s); + show_error!("{}", s); 1 } } diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 4ce665b80..bb51a7606 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -370,13 +370,13 @@ fn directory(paths: Vec, b: Behavior) -> i32 { // created ancestor directories will have the default mode. Hence it is safe to use // fs::create_dir_all and then only modify the target's dir mode. if let Err(e) = fs::create_dir_all(path) { - show_info!("{}: {}", path.display(), e); + show_error!("{}: {}", path.display(), e); all_successful = false; continue; } if b.verbose { - show_info!("creating directory '{}'", path.display()); + show_error!("creating directory '{}'", path.display()); } } @@ -461,7 +461,7 @@ fn copy_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> i3 let mut all_successful = true; for sourcepath in files.iter() { if !sourcepath.exists() { - show_info!( + show_error!( "cannot stat '{}': No such file or directory", sourcepath.display() ); @@ -471,7 +471,7 @@ fn copy_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> i3 } if sourcepath.is_dir() { - show_info!("omitting directory '{}'", sourcepath.display()); + show_error!("omitting directory '{}'", sourcepath.display()); all_successful = false; continue; } @@ -588,10 +588,10 @@ fn copy(from: &Path, to: &Path, b: &Behavior) -> Result<(), ()> { ) { Ok(n) => { if !n.is_empty() { - show_info!("{}", n); + show_error!("{}", n); } } - Err(e) => show_info!("{}", e), + Err(e) => show_error!("{}", e), } } @@ -608,10 +608,10 @@ fn copy(from: &Path, to: &Path, b: &Behavior) -> Result<(), ()> { match wrap_chgrp(to, &meta, group_id, false, Verbosity::Normal) { Ok(n) => { if !n.is_empty() { - show_info!("{}", n); + show_error!("{}", n); } } - Err(e) => show_info!("{}", e), + Err(e) => show_error!("{}", e), } } @@ -626,12 +626,12 @@ fn copy(from: &Path, to: &Path, b: &Behavior) -> Result<(), ()> { match set_file_times(to, accessed_time, modified_time) { Ok(_) => {} - Err(e) => show_info!("{}", e), + Err(e) => show_error!("{}", e), } } if b.verbose { - show_info!("'{}' -> '{}'", from.display(), to.display()); + show_error!("'{}' -> '{}'", from.display(), to.display()); } Ok(()) diff --git a/src/uu/install/src/mode.rs b/src/uu/install/src/mode.rs index a3de40c68..b8d5cd839 100644 --- a/src/uu/install/src/mode.rs +++ b/src/uu/install/src/mode.rs @@ -23,7 +23,7 @@ pub fn parse(mode_string: &str, considering_dir: bool) -> Result { pub fn chmod(path: &Path, mode: u32) -> Result<(), ()> { use std::os::unix::fs::PermissionsExt; fs::set_permissions(path, fs::Permissions::from_mode(mode)).map_err(|err| { - show_info!("{}: chmod failed with error {}", path.display(), err); + show_error!("{}: chmod failed with error {}", path.display(), err); }) } diff --git a/src/uu/mkdir/src/mkdir.rs b/src/uu/mkdir/src/mkdir.rs index 6b9fd68ea..861ef5075 100644 --- a/src/uu/mkdir/src/mkdir.rs +++ b/src/uu/mkdir/src/mkdir.rs @@ -101,7 +101,7 @@ fn exec(dirs: Vec, recursive: bool, mode: u16, verbose: bool) -> i32 { if !recursive { if let Some(parent) = path.parent() { if parent != empty && !parent.exists() { - show_info!( + show_error!( "cannot create directory '{}': No such file or directory", path.display() ); @@ -125,7 +125,7 @@ fn mkdir(path: &Path, recursive: bool, mode: u16, verbose: bool) -> i32 { fs::create_dir }; if let Err(e) = create_dir(path) { - show_info!("{}: {}", path.display(), e.to_string()); + show_error!("{}: {}", path.display(), e.to_string()); return 1; } diff --git a/src/uu/mknod/src/mknod.rs b/src/uu/mknod/src/mknod.rs index 5b6c2fa8c..e0cf62024 100644 --- a/src/uu/mknod/src/mknod.rs +++ b/src/uu/mknod/src/mknod.rs @@ -136,7 +136,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let mode = match get_mode(&matches) { Ok(mode) => mode, Err(err) => { - show_info!("{}", err); + show_error!("{}", err); return 1; } }; diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index ed767ffe0..112c2fb94 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -157,7 +157,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } if matches.is_present(OPT_TMPDIR) && PathBuf::from(prefix).is_absolute() { - show_info!( + show_error!( "invalid template, ‘{}’; with --tmpdir, it may not be absolute", template ); @@ -229,7 +229,7 @@ fn exec( } Err(e) => { if !quiet { - show_info!("{}: {}", e, tmpdir.display()); + show_error!("{}: {}", e, tmpdir.display()); } return 1; } @@ -244,7 +244,7 @@ fn exec( Ok(f) => f, Err(e) => { if !quiet { - show_info!("failed to create tempfile: {}", e); + show_error!("failed to create tempfile: {}", e); } return 1; } diff --git a/src/uu/nohup/src/nohup.rs b/src/uu/nohup/src/nohup.rs index 83153ad37..93d9b5e45 100644 --- a/src/uu/nohup/src/nohup.rs +++ b/src/uu/nohup/src/nohup.rs @@ -122,13 +122,13 @@ fn find_stdout() -> File { .open(Path::new(NOHUP_OUT)) { Ok(t) => { - show_info!("ignoring input and appending output to '{}'", NOHUP_OUT); + show_error!("ignoring input and appending output to '{}'", NOHUP_OUT); t } Err(e1) => { let home = match env::var("HOME") { Err(_) => { - show_info!("failed to open '{}': {}", NOHUP_OUT, e1); + show_error!("failed to open '{}': {}", NOHUP_OUT, e1); exit!(internal_failure_code) } Ok(h) => h, @@ -143,12 +143,12 @@ fn find_stdout() -> File { .open(&homeout) { Ok(t) => { - show_info!("ignoring input and appending output to '{}'", homeout_str); + show_error!("ignoring input and appending output to '{}'", homeout_str); t } Err(e2) => { - show_info!("failed to open '{}': {}", NOHUP_OUT, e1); - show_info!("failed to open '{}': {}", homeout_str, e2); + show_error!("failed to open '{}': {}", NOHUP_OUT, e1); + show_error!("failed to open '{}': {}", homeout_str, e2); exit!(internal_failure_code) } } diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index e9a476956..6eba699b2 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -216,7 +216,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { match result { Err(e) => { std::io::stdout().flush().expect("error flushing stdout"); - show_info!("{}", e); + show_error!("{}", e); 1 } _ => 0, diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 5bb0e5f12..582d59841 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -749,7 +749,7 @@ impl Stater { } } Err(e) => { - show_info!("cannot stat '{}': {}", file, e); + show_error!("cannot stat '{}': {}", file, e); return 1; } } @@ -842,7 +842,7 @@ impl Stater { } } Err(e) => { - show_info!("cannot read file system information for '{}': {}", file, e); + show_error!("cannot read file system information for '{}': {}", file, e); return 1; } } @@ -1001,7 +1001,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { match Stater::new(matches) { Ok(stater) => stater.exec(), Err(e) => { - show_info!("{}", e); + show_error!("{}", e); 1 } } diff --git a/src/uu/tee/src/tee.rs b/src/uu/tee/src/tee.rs index 7c6a86b4c..c21559b3b 100644 --- a/src/uu/tee/src/tee.rs +++ b/src/uu/tee/src/tee.rs @@ -166,7 +166,7 @@ impl Write for MultiWriter { let result = writer.write_all(buf); match result { Err(f) => { - show_info!("{}: {}", writer.name, f.to_string()); + show_error!("{}: {}", writer.name, f.to_string()); false } _ => true, @@ -180,7 +180,7 @@ impl Write for MultiWriter { let result = writer.flush(); match result { Err(f) => { - show_info!("{}: {}", writer.name, f.to_string()); + show_error!("{}: {}", writer.name, f.to_string()); false } _ => true, @@ -213,7 +213,7 @@ impl Read for NamedReader { fn read(&mut self, buf: &mut [u8]) -> Result { match self.inner.read(buf) { Err(f) => { - show_info!("{}: {}", Path::new("stdin").display(), f.to_string()); + show_error!("{}: {}", Path::new("stdin").display(), f.to_string()); Err(f) } okay => okay, diff --git a/src/uucore/src/lib/macros.rs b/src/uucore/src/lib/macros.rs index 637e91f8f..dde059131 100644 --- a/src/uucore/src/lib/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -47,15 +47,6 @@ macro_rules! show_warning( }) ); -/// Show an info message to stderr in a silimar style to GNU coreutils. -#[macro_export] -macro_rules! show_info( - ($($args:tt)+) => ({ - eprint!("{}: ", executable!()); - eprintln!($($args)+); - }) -); - /// Show a bad inocation help message in a similar style to GNU coreutils. #[macro_export] macro_rules! show_usage_error( From 898d2eb48956e38440b5a7328d0589b5d5793281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ya=C4=9F=C4=B1z=20can=20De=C4=9Firmenci?= Date: Wed, 26 May 2021 02:32:02 +0300 Subject: [PATCH 0678/1135] chore: delete 'error:' prefix on show_error --- src/uucore/src/lib/macros.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/src/lib/macros.rs b/src/uucore/src/lib/macros.rs index dde059131..616a1b57c 100644 --- a/src/uucore/src/lib/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -25,7 +25,7 @@ macro_rules! executable( #[macro_export] macro_rules! show_error( ($($args:tt)+) => ({ - eprint!("{}: error: ", executable!()); + eprint!("{}: ", executable!()); eprintln!($($args)+); }) ); From 7240b1289523a985f6bc9999b0fec4a0cd903557 Mon Sep 17 00:00:00 2001 From: Matt Blessed Date: Tue, 25 May 2021 16:38:34 -0400 Subject: [PATCH 0679/1135] uucore: implement backup control Most of these changes were sourced from mv's existing backup control implementation. A later commit will update the mv utility to use this new share backup control. --- src/uucore/src/lib/lib.rs | 1 + src/uucore/src/lib/mods.rs | 1 + src/uucore/src/lib/mods/backup_control.rs | 97 +++++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 src/uucore/src/lib/mods/backup_control.rs diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index eb630f53a..c17f14516 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -25,6 +25,7 @@ mod features; // feature-gated code modules mod mods; // core cross-platform modules // * cross-platform modules +pub use crate::mods::backup_control; pub use crate::mods::coreopts; pub use crate::mods::os; pub use crate::mods::panic; diff --git a/src/uucore/src/lib/mods.rs b/src/uucore/src/lib/mods.rs index 74725e141..2689361a0 100644 --- a/src/uucore/src/lib/mods.rs +++ b/src/uucore/src/lib/mods.rs @@ -1,5 +1,6 @@ // mods ~ cross-platforms modules (core/bundler file) +pub mod backup_control; pub mod coreopts; pub mod os; pub mod panic; diff --git a/src/uucore/src/lib/mods/backup_control.rs b/src/uucore/src/lib/mods/backup_control.rs new file mode 100644 index 000000000..6004ae84d --- /dev/null +++ b/src/uucore/src/lib/mods/backup_control.rs @@ -0,0 +1,97 @@ +use std::{ + env, + path::{Path, PathBuf}, +}; + +pub static BACKUP_CONTROL_VALUES: &[&str] = &[ + "simple", "never", "numbered", "t", "existing", "nil", "none", "off", +]; + +pub static BACKUP_CONTROL_LONG_HELP: &str = "The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX. Here are the version control values: + +none, off + never make backups (even if --backup is given) + +numbered, t + make numbered backups + +existing, nil + numbered if numbered backups exist, simple otherwise + +simple, never + always make simple backups"; + +#[derive(Debug, Clone, Copy, Eq, PartialEq)] +pub enum BackupMode { + NoBackup, + SimpleBackup, + NumberedBackup, + ExistingBackup, +} + +pub fn determine_backup_suffix(supplied_suffix: Option<&str>) -> String { + if let Some(suffix) = supplied_suffix { + String::from(suffix) + } else { + env::var("SIMPLE_BACKUP_SUFFIX").unwrap_or("~".to_owned()) + } +} + +pub fn determine_backup_mode(backup_opt_exists: bool, backup_opt: Option<&str>) -> BackupMode { + if backup_opt_exists { + match backup_opt.map(String::from) { + // default is existing, see: + // https://www.gnu.org/software/coreutils/manual/html_node/Backup-options.html + None => BackupMode::ExistingBackup, + Some(mode) => match &mode[..] { + "simple" | "never" => BackupMode::SimpleBackup, + "numbered" | "t" => BackupMode::NumberedBackup, + "existing" | "nil" => BackupMode::ExistingBackup, + "none" | "off" => BackupMode::NoBackup, + _ => panic!(), // cannot happen as it is managed by clap + }, + } + } else { + BackupMode::NoBackup + } +} + +pub fn get_backup_path( + backup_mode: BackupMode, + backup_path: &Path, + suffix: &str, +) -> Option { + match backup_mode { + BackupMode::NoBackup => None, + BackupMode::SimpleBackup => Some(simple_backup_path(backup_path, suffix)), + BackupMode::NumberedBackup => Some(numbered_backup_path(backup_path)), + BackupMode::ExistingBackup => Some(existing_backup_path(backup_path, suffix)), + } +} + +pub fn simple_backup_path(path: &Path, suffix: &str) -> PathBuf { + let mut p = path.to_string_lossy().into_owned(); + p.push_str(suffix); + PathBuf::from(p) +} + +pub fn numbered_backup_path(path: &Path) -> PathBuf { + for i in 1_u64.. { + let path_str = &format!("{}.~{}~", path.to_string_lossy(), i); + let path = Path::new(path_str); + if !path.exists() { + return path.to_path_buf(); + } + } + panic!("cannot create backup") +} + +pub fn existing_backup_path(path: &Path, suffix: &str) -> PathBuf { + let test_path_str = &format!("{}.~1~", path.to_string_lossy()); + let test_path = Path::new(test_path_str); + if test_path.exists() { + numbered_backup_path(path) + } else { + simple_backup_path(path, suffix) + } +} From 071899d24d3d1c21d65d4295292ec3b5600c8da4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ya=C4=9F=C4=B1z=20can=20De=C4=9Firmenci?= Date: Wed, 26 May 2021 02:45:53 +0300 Subject: [PATCH 0680/1135] tests: delete 'error:' prefix from the tests --- tests/by-util/test_base32.rs | 6 +-- tests/by-util/test_base64.rs | 6 +-- tests/by-util/test_basename.rs | 9 ++-- tests/by-util/test_chmod.rs | 2 +- tests/by-util/test_chroot.rs | 8 ++- tests/by-util/test_cksum.rs | 4 +- tests/by-util/test_csplit.rs | 98 +++++++++++++++++----------------- tests/by-util/test_cut.rs | 4 +- tests/by-util/test_du.rs | 2 +- tests/by-util/test_expr.rs | 4 +- tests/by-util/test_fmt.rs | 2 +- tests/by-util/test_id.rs | 2 +- tests/by-util/test_install.rs | 2 +- tests/by-util/test_join.rs | 4 +- tests/by-util/test_link.rs | 4 +- tests/by-util/test_ln.rs | 2 +- tests/by-util/test_logname.rs | 2 +- tests/by-util/test_ls.rs | 6 +-- tests/by-util/test_mkfifo.rs | 6 +-- tests/by-util/test_mktemp.rs | 2 +- tests/by-util/test_mv.rs | 4 +- tests/by-util/test_nice.rs | 2 +- tests/by-util/test_rm.rs | 2 +- tests/by-util/test_rmdir.rs | 8 +-- tests/by-util/test_sort.rs | 15 +++--- tests/by-util/test_stdbuf.rs | 11 ++-- tests/by-util/test_sum.rs | 6 +-- tests/by-util/test_uniq.rs | 2 +- tests/by-util/test_unlink.rs | 6 +-- tests/by-util/test_whoami.rs | 2 +- 30 files changed, 114 insertions(+), 119 deletions(-) diff --git a/tests/by-util/test_base32.rs b/tests/by-util/test_base32.rs index fd49aa951..e36c376be 100644 --- a/tests/by-util/test_base32.rs +++ b/tests/by-util/test_base32.rs @@ -98,7 +98,7 @@ fn test_wrap_bad_arg() { .arg(wrap_param) .arg("b") .fails() - .stderr_only("base32: error: Invalid wrap size: ‘b’: invalid digit found in string\n"); + .stderr_only("base32: Invalid wrap size: ‘b’: invalid digit found in string\n"); } } @@ -109,7 +109,7 @@ fn test_base32_extra_operand() { .arg("a.txt") .arg("a.txt") .fails() - .stderr_only("base32: error: extra operand ‘a.txt’"); + .stderr_only("base32: extra operand ‘a.txt’"); } #[test] @@ -117,5 +117,5 @@ fn test_base32_file_not_found() { new_ucmd!() .arg("a.txt") .fails() - .stderr_only("base32: error: a.txt: No such file or directory"); + .stderr_only("base32: a.txt: No such file or directory"); } diff --git a/tests/by-util/test_base64.rs b/tests/by-util/test_base64.rs index 8d9dc5639..89405d791 100644 --- a/tests/by-util/test_base64.rs +++ b/tests/by-util/test_base64.rs @@ -88,7 +88,7 @@ fn test_wrap_bad_arg() { .arg(wrap_param) .arg("b") .fails() - .stderr_only("base64: error: Invalid wrap size: ‘b’: invalid digit found in string\n"); + .stderr_only("base64: Invalid wrap size: ‘b’: invalid digit found in string\n"); } } @@ -99,7 +99,7 @@ fn test_base64_extra_operand() { .arg("a.txt") .arg("a.txt") .fails() - .stderr_only("base64: error: extra operand ‘a.txt’"); + .stderr_only("base64: extra operand ‘a.txt’"); } #[test] @@ -107,5 +107,5 @@ fn test_base64_file_not_found() { new_ucmd!() .arg("a.txt") .fails() - .stderr_only("base64: error: a.txt: No such file or directory"); + .stderr_only("base64: a.txt: No such file or directory"); } diff --git a/tests/by-util/test_basename.rs b/tests/by-util/test_basename.rs index baf15f78a..1d26a922a 100644 --- a/tests/by-util/test_basename.rs +++ b/tests/by-util/test_basename.rs @@ -109,7 +109,7 @@ fn test_no_args() { fn test_no_args_output() { new_ucmd!() .fails() - .stderr_is("basename: error: missing operand\nTry 'basename --help' for more information."); + .stderr_is("basename: missing operand\nTry 'basename --help' for more information."); } #[test] @@ -119,9 +119,10 @@ fn test_too_many_args() { #[test] fn test_too_many_args_output() { - new_ucmd!().args(&["a", "b", "c"]).fails().stderr_is( - "basename: error: extra operand 'c'\nTry 'basename --help' for more information.", - ); + new_ucmd!() + .args(&["a", "b", "c"]) + .fails() + .stderr_is("basename: extra operand 'c'\nTry 'basename --help' for more information."); } #[cfg(any(unix, target_os = "redox"))] diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index 3958c0a36..733722b7c 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -338,7 +338,7 @@ fn test_chmod_preserve_root() { .arg("755") .arg("/") .fails() - .stderr_contains(&"chmod: error: it is dangerous to operate recursively on '/'"); + .stderr_contains(&"chmod: it is dangerous to operate recursively on '/'"); } #[test] diff --git a/tests/by-util/test_chroot.rs b/tests/by-util/test_chroot.rs index e2e355e14..0479e7c3a 100644 --- a/tests/by-util/test_chroot.rs +++ b/tests/by-util/test_chroot.rs @@ -21,7 +21,7 @@ fn test_enter_chroot_fails() { assert!(result .stderr_str() - .starts_with("chroot: error: cannot chroot to jail: Operation not permitted (os error 1)")); + .starts_with("chroot: cannot chroot to jail: Operation not permitted (os error 1)")); } #[test] @@ -32,7 +32,7 @@ fn test_no_such_directory() { ucmd.arg("a") .fails() - .stderr_is("chroot: error: cannot change root directory to `a`: no such directory"); + .stderr_is("chroot: cannot change root directory to `a`: no such directory"); } #[test] @@ -43,9 +43,7 @@ fn test_invalid_user_spec() { let result = ucmd.arg("a").arg("--userspec=ARABA:").fails(); - assert!(result - .stderr_str() - .starts_with("chroot: error: invalid userspec")); + assert!(result.stderr_str().starts_with("chroot: invalid userspec")); } #[test] diff --git a/tests/by-util/test_cksum.rs b/tests/by-util/test_cksum.rs index 592e45c58..81ef4c177 100644 --- a/tests/by-util/test_cksum.rs +++ b/tests/by-util/test_cksum.rs @@ -66,7 +66,7 @@ fn test_invalid_file() { .arg(folder_name) .fails() .no_stdout() - .stderr_contains("cksum: error: 'asdf' No such file or directory"); + .stderr_contains("cksum: 'asdf' No such file or directory"); // Then check when the file is of an invalid type at.mkdir(folder_name); @@ -74,7 +74,7 @@ fn test_invalid_file() { .arg(folder_name) .fails() .no_stdout() - .stderr_contains("cksum: error: 'asdf' Is a directory"); + .stderr_contains("cksum: 'asdf' Is a directory"); } // Make sure crc is correct for files larger than 32 bytes diff --git a/tests/by-util/test_csplit.rs b/tests/by-util/test_csplit.rs index 51cab483c..ae0885ff8 100644 --- a/tests/by-util/test_csplit.rs +++ b/tests/by-util/test_csplit.rs @@ -208,7 +208,7 @@ fn test_up_to_match_repeat_over() { ucmd.args(&["numbers50.txt", "/9$/", "{50}"]) .fails() .stdout_is("16\n29\n30\n30\n30\n6\n") - .stderr_is("csplit: error: '/9$/': match not found on repetition 5"); + .stderr_is("csplit: '/9$/': match not found on repetition 5"); let count = glob(&at.plus_as_string("xx*")) .expect("there should be splits created") @@ -219,7 +219,7 @@ fn test_up_to_match_repeat_over() { ucmd.args(&["numbers50.txt", "/9$/", "{50}", "-k"]) .fails() .stdout_is("16\n29\n30\n30\n30\n6\n") - .stderr_is("csplit: error: '/9$/': match not found on repetition 5"); + .stderr_is("csplit: '/9$/': match not found on repetition 5"); let count = glob(&at.plus_as_string("xx*")) .expect("there should be splits created") @@ -365,7 +365,7 @@ fn test_option_keep() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["-k", "numbers50.txt", "/20/", "/nope/"]) .fails() - .stderr_is("csplit: error: '/nope/': match not found") + .stderr_is("csplit: '/nope/': match not found") .stdout_is("48\n93\n"); let count = glob(&at.plus_as_string("xx*")) @@ -541,7 +541,7 @@ fn test_up_to_match_context_overflow() { ucmd.args(&["numbers50.txt", "/45/+10"]) .fails() .stdout_is("141\n") - .stderr_is("csplit: error: '/45/+10': line number out of range"); + .stderr_is("csplit: '/45/+10': line number out of range"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -552,7 +552,7 @@ fn test_up_to_match_context_overflow() { ucmd.args(&["numbers50.txt", "/45/+10", "-k"]) .fails() .stdout_is("141\n") - .stderr_is("csplit: error: '/45/+10': line number out of range"); + .stderr_is("csplit: '/45/+10': line number out of range"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -567,7 +567,7 @@ fn test_skip_to_match_context_underflow() { ucmd.args(&["numbers50.txt", "%5%-10"]) .fails() .stdout_is("141\n") - .stderr_is("csplit: error: '%5%-10': line number out of range"); + .stderr_is("csplit: '%5%-10': line number out of range"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -578,7 +578,7 @@ fn test_skip_to_match_context_underflow() { ucmd.args(&["numbers50.txt", "%5%-10", "-k"]) .fails() .stdout_is("141\n") - .stderr_is("csplit: error: '%5%-10': line number out of range"); + .stderr_is("csplit: '%5%-10': line number out of range"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -592,7 +592,7 @@ fn test_skip_to_match_context_overflow() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "%45%+10"]) .fails() - .stderr_only("csplit: error: '%45%+10': line number out of range"); + .stderr_only("csplit: '%45%+10': line number out of range"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -602,7 +602,7 @@ fn test_skip_to_match_context_overflow() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "%45%+10", "-k"]) .fails() - .stderr_only("csplit: error: '%45%+10': line number out of range"); + .stderr_only("csplit: '%45%+10': line number out of range"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -616,7 +616,7 @@ fn test_up_to_no_match1() { ucmd.args(&["numbers50.txt", "/4/", "/nope/"]) .fails() .stdout_is("6\n135\n") - .stderr_is("csplit: error: '/nope/': match not found"); + .stderr_is("csplit: '/nope/': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -627,7 +627,7 @@ fn test_up_to_no_match1() { ucmd.args(&["numbers50.txt", "/4/", "/nope/", "-k"]) .fails() .stdout_is("6\n135\n") - .stderr_is("csplit: error: '/nope/': match not found"); + .stderr_is("csplit: '/nope/': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -643,7 +643,7 @@ fn test_up_to_no_match2() { ucmd.args(&["numbers50.txt", "/4/", "/nope/", "{50}"]) .fails() .stdout_is("6\n135\n") - .stderr_is("csplit: error: '/nope/': match not found"); + .stderr_is("csplit: '/nope/': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -654,7 +654,7 @@ fn test_up_to_no_match2() { ucmd.args(&["numbers50.txt", "/4/", "/nope/", "{50}", "-k"]) .fails() .stdout_is("6\n135\n") - .stderr_is("csplit: error: '/nope/': match not found"); + .stderr_is("csplit: '/nope/': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -670,7 +670,7 @@ fn test_up_to_no_match3() { ucmd.args(&["numbers50.txt", "/0$/", "{50}"]) .fails() .stdout_is("18\n30\n30\n30\n30\n3\n") - .stderr_is("csplit: error: '/0$/': match not found on repetition 5"); + .stderr_is("csplit: '/0$/': match not found on repetition 5"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -681,7 +681,7 @@ fn test_up_to_no_match3() { ucmd.args(&["numbers50.txt", "/0$/", "{50}", "-k"]) .fails() .stdout_is("18\n30\n30\n30\n30\n3\n") - .stderr_is("csplit: error: '/0$/': match not found on repetition 5"); + .stderr_is("csplit: '/0$/': match not found on repetition 5"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -701,7 +701,7 @@ fn test_up_to_no_match4() { ucmd.args(&["numbers50.txt", "/nope/", "/4/"]) .fails() .stdout_is("141\n") - .stderr_is("csplit: error: '/nope/': match not found"); + .stderr_is("csplit: '/nope/': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -712,7 +712,7 @@ fn test_up_to_no_match4() { ucmd.args(&["numbers50.txt", "/nope/", "/4/", "-k"]) .fails() .stdout_is("141\n") - .stderr_is("csplit: error: '/nope/': match not found"); + .stderr_is("csplit: '/nope/': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -741,7 +741,7 @@ fn test_up_to_no_match6() { ucmd.args(&["numbers50.txt", "/nope/-5"]) .fails() .stdout_is("141\n") - .stderr_is("csplit: error: '/nope/-5': match not found"); + .stderr_is("csplit: '/nope/-5': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -752,7 +752,7 @@ fn test_up_to_no_match6() { ucmd.args(&["numbers50.txt", "/nope/-5", "-k"]) .fails() .stdout_is("141\n") - .stderr_is("csplit: error: '/nope/-5': match not found"); + .stderr_is("csplit: '/nope/-5': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -767,7 +767,7 @@ fn test_up_to_no_match7() { ucmd.args(&["numbers50.txt", "/nope/+5"]) .fails() .stdout_is("141\n") - .stderr_is("csplit: error: '/nope/+5': match not found"); + .stderr_is("csplit: '/nope/+5': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -778,7 +778,7 @@ fn test_up_to_no_match7() { ucmd.args(&["numbers50.txt", "/nope/+5", "-k"]) .fails() .stdout_is("141\n") - .stderr_is("csplit: error: '/nope/+5': match not found"); + .stderr_is("csplit: '/nope/+5': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -792,7 +792,7 @@ fn test_skip_to_no_match1() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "%nope%"]) .fails() - .stderr_only("csplit: error: '%nope%': match not found"); + .stderr_only("csplit: '%nope%': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -805,7 +805,7 @@ fn test_skip_to_no_match2() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "%nope%", "{50}"]) .fails() - .stderr_only("csplit: error: '%nope%': match not found"); + .stderr_only("csplit: '%nope%': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -818,7 +818,7 @@ fn test_skip_to_no_match3() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "%0$%", "{50}"]) .fails() - .stderr_only("csplit: error: '%0$%': match not found on repetition 5"); + .stderr_only("csplit: '%0$%': match not found on repetition 5"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -831,7 +831,7 @@ fn test_skip_to_no_match4() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "%nope%", "/4/"]) .fails() - .stderr_only("csplit: error: '%nope%': match not found"); + .stderr_only("csplit: '%nope%': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -858,7 +858,7 @@ fn test_skip_to_no_match6() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "%nope%-5"]) .fails() - .stderr_only("csplit: error: '%nope%-5': match not found"); + .stderr_only("csplit: '%nope%-5': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -871,7 +871,7 @@ fn test_skip_to_no_match7() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "%nope%+5"]) .fails() - .stderr_only("csplit: error: '%nope%+5': match not found"); + .stderr_only("csplit: '%nope%+5': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -884,7 +884,7 @@ fn test_no_match() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "%nope%"]) .fails() - .stderr_only("csplit: error: '%nope%': match not found"); + .stderr_only("csplit: '%nope%': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -895,7 +895,7 @@ fn test_no_match() { ucmd.args(&["numbers50.txt", "/nope/"]) .fails() .stdout_is("141\n") - .stderr_is("csplit: error: '/nope/': match not found"); + .stderr_is("csplit: '/nope/': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -992,7 +992,7 @@ fn test_too_small_linenum_repeat() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "/20/", "10", "{*}"]) .fails() - .stderr_is("csplit: error: '10': line number out of range on repetition 5") + .stderr_is("csplit: '10': line number out of range on repetition 5") .stdout_is("48\n0\n0\n30\n30\n30\n3\n"); let count = glob(&at.plus_as_string("xx*")) @@ -1003,7 +1003,7 @@ fn test_too_small_linenum_repeat() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "/20/", "10", "{*}", "-k"]) .fails() - .stderr_is("csplit: error: '10': line number out of range on repetition 5") + .stderr_is("csplit: '10': line number out of range on repetition 5") .stdout_is("48\n0\n0\n30\n30\n30\n3\n"); let count = glob(&at.plus_as_string("xx*")) @@ -1025,7 +1025,7 @@ fn test_linenum_out_of_range1() { ucmd.args(&["numbers50.txt", "100"]) .fails() .stdout_is("141\n") - .stderr_is("csplit: error: '100': line number out of range"); + .stderr_is("csplit: '100': line number out of range"); let count = glob(&at.plus_as_string("xx*")) .expect("there should be splits created") @@ -1036,7 +1036,7 @@ fn test_linenum_out_of_range1() { ucmd.args(&["numbers50.txt", "100", "-k"]) .fails() .stdout_is("141\n") - .stderr_is("csplit: error: '100': line number out of range"); + .stderr_is("csplit: '100': line number out of range"); let count = glob(&at.plus_as_string("xx*")) .expect("there should be splits created") @@ -1051,7 +1051,7 @@ fn test_linenum_out_of_range2() { ucmd.args(&["numbers50.txt", "10", "100"]) .fails() .stdout_is("18\n123\n") - .stderr_is("csplit: error: '100': line number out of range"); + .stderr_is("csplit: '100': line number out of range"); let count = glob(&at.plus_as_string("xx*")) .expect("there should be splits created") @@ -1062,7 +1062,7 @@ fn test_linenum_out_of_range2() { ucmd.args(&["numbers50.txt", "10", "100", "-k"]) .fails() .stdout_is("18\n123\n") - .stderr_is("csplit: error: '100': line number out of range"); + .stderr_is("csplit: '100': line number out of range"); let count = glob(&at.plus_as_string("xx*")) .expect("there should be splits created") @@ -1078,7 +1078,7 @@ fn test_linenum_out_of_range3() { ucmd.args(&["numbers50.txt", "40", "{2}"]) .fails() .stdout_is("108\n33\n") - .stderr_is("csplit: error: '40': line number out of range on repetition 1"); + .stderr_is("csplit: '40': line number out of range on repetition 1"); let count = glob(&at.plus_as_string("xx*")) .expect("there should be splits created") @@ -1089,7 +1089,7 @@ fn test_linenum_out_of_range3() { ucmd.args(&["numbers50.txt", "40", "{2}", "-k"]) .fails() .stdout_is("108\n33\n") - .stderr_is("csplit: error: '40': line number out of range on repetition 1"); + .stderr_is("csplit: '40': line number out of range on repetition 1"); let count = glob(&at.plus_as_string("xx*")) .expect("there should be splits created") @@ -1105,7 +1105,7 @@ fn test_linenum_out_of_range4() { ucmd.args(&["numbers50.txt", "40", "{*}"]) .fails() .stdout_is("108\n33\n") - .stderr_is("csplit: error: '40': line number out of range on repetition 1"); + .stderr_is("csplit: '40': line number out of range on repetition 1"); let count = glob(&at.plus_as_string("xx*")) .expect("there should be splits created") @@ -1116,7 +1116,7 @@ fn test_linenum_out_of_range4() { ucmd.args(&["numbers50.txt", "40", "{*}", "-k"]) .fails() .stdout_is("108\n33\n") - .stderr_is("csplit: error: '40': line number out of range on repetition 1"); + .stderr_is("csplit: '40': line number out of range on repetition 1"); let count = glob(&at.plus_as_string("xx*")) .expect("there should be splits created") @@ -1132,7 +1132,7 @@ fn test_skip_to_match_negative_offset_before_a_match() { ucmd.args(&["numbers50.txt", "/20/-10", "/15/"]) .fails() .stdout_is("18\n123\n") - .stderr_is("csplit: error: '/15/': match not found"); + .stderr_is("csplit: '/15/': match not found"); let count = glob(&at.plus_as_string("xx*")) .expect("there should be splits created") @@ -1177,7 +1177,7 @@ fn test_corner_case2() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "/10/-5", "/10/"]) .fails() - .stderr_is("csplit: error: '/10/': match not found") + .stderr_is("csplit: '/10/': match not found") .stdout_is("8\n133\n"); let count = glob(&at.plus_as_string("xx*")) @@ -1191,7 +1191,7 @@ fn test_corner_case3() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "/15/-3", "14", "/15/"]) .fails() - .stderr_is("csplit: error: '/15/': match not found") + .stderr_is("csplit: '/15/': match not found") .stdout_is("24\n6\n111\n"); let count = glob(&at.plus_as_string("xx*")) @@ -1223,7 +1223,7 @@ fn test_up_to_match_context_underflow() { ucmd.args(&["numbers50.txt", "/5/-10"]) .fails() .stdout_is("0\n141\n") - .stderr_is("csplit: error: '/5/-10': line number out of range"); + .stderr_is("csplit: '/5/-10': line number out of range"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -1234,7 +1234,7 @@ fn test_up_to_match_context_underflow() { ucmd.args(&["numbers50.txt", "/5/-10", "-k"]) .fails() .stdout_is("0\n141\n") - .stderr_is("csplit: error: '/5/-10': line number out of range"); + .stderr_is("csplit: '/5/-10': line number out of range"); let count = glob(&at.plus_as_string("xx*")) .expect("counting splits") @@ -1251,7 +1251,7 @@ fn test_linenum_range_with_up_to_match1() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "10", "/12/-5"]) .fails() - .stderr_is("csplit: error: '/12/-5': line number out of range") + .stderr_is("csplit: '/12/-5': line number out of range") .stdout_is("18\n0\n123\n"); let count = glob(&at.plus_as_string("xx*")) @@ -1262,7 +1262,7 @@ fn test_linenum_range_with_up_to_match1() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "10", "/12/-5", "-k"]) .fails() - .stderr_is("csplit: error: '/12/-5': line number out of range") + .stderr_is("csplit: '/12/-5': line number out of range") .stdout_is("18\n0\n123\n"); let count = glob(&at.plus_as_string("xx*")) @@ -1281,7 +1281,7 @@ fn test_linenum_range_with_up_to_match2() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "10", "/12/-15"]) .fails() - .stderr_is("csplit: error: '/12/-15': line number out of range") + .stderr_is("csplit: '/12/-15': line number out of range") .stdout_is("18\n0\n123\n"); let count = glob(&at.plus_as_string("xx*")) @@ -1292,7 +1292,7 @@ fn test_linenum_range_with_up_to_match2() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "10", "/12/-15", "-k"]) .fails() - .stderr_is("csplit: error: '/12/-15': line number out of range") + .stderr_is("csplit: '/12/-15': line number out of range") .stdout_is("18\n0\n123\n"); let count = glob(&at.plus_as_string("xx*")) @@ -1310,7 +1310,7 @@ fn test_linenum_range_with_up_to_match3() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "10", "/10/", "-k"]) .fails() - .stderr_is("csplit: error: '/10/': match not found") + .stderr_is("csplit: '/10/': match not found") .stdout_is("18\n123\n"); let count = glob(&at.plus_as_string("xx*")) diff --git a/tests/by-util/test_cut.rs b/tests/by-util/test_cut.rs index 875317721..413b73154 100644 --- a/tests/by-util/test_cut.rs +++ b/tests/by-util/test_cut.rs @@ -149,11 +149,11 @@ fn test_directory_and_no_such_file() { ucmd.arg("-b1") .arg("some") .run() - .stderr_is("cut: error: some: Is a directory\n"); + .stderr_is("cut: some: Is a directory\n"); new_ucmd!() .arg("-b1") .arg("some") .run() - .stderr_is("cut: error: some: No such file or directory\n"); + .stderr_is("cut: some: No such file or directory\n"); } diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index c72bd02a6..15620be52 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -76,7 +76,7 @@ fn test_du_basics_bad_name() { new_ucmd!() .arg("bad_name") .succeeds() // TODO: replace with ".fails()" once `du` is fixed - .stderr_only("du: error: bad_name: No such file or directory\n"); + .stderr_only("du: bad_name: No such file or directory\n"); } #[test] diff --git a/tests/by-util/test_expr.rs b/tests/by-util/test_expr.rs index 6a969b5e9..f20739e13 100644 --- a/tests/by-util/test_expr.rs +++ b/tests/by-util/test_expr.rs @@ -17,11 +17,11 @@ fn test_complex_arithmetic() { .args(&["9223372036854775807", "+", "9223372036854775807"]) .run(); run.stdout_is(""); - run.stderr_is("expr: error: +: Numerical result out of range"); + run.stderr_is("expr: +: Numerical result out of range"); let run = new_ucmd!().args(&["9", "/", "0"]).run(); run.stdout_is(""); - run.stderr_is("expr: error: division by zero"); + run.stderr_is("expr: division by zero"); } #[test] diff --git a/tests/by-util/test_fmt.rs b/tests/by-util/test_fmt.rs index a83fae58e..0d6d9bb24 100644 --- a/tests/by-util/test_fmt.rs +++ b/tests/by-util/test_fmt.rs @@ -30,7 +30,7 @@ fn test_fmt_w_too_big() { //.stdout_is_fixture("call_graph.expected"); assert_eq!( result.stderr_str().trim(), - "fmt: error: invalid width: '2501': Numerical result out of range" + "fmt: invalid width: '2501': Numerical result out of range" ); } #[test] diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index 534736a32..1f8249aab 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -7,7 +7,7 @@ use crate::common::util::*; // From the Logs: "Build (ubuntu-18.04, x86_64-unknown-linux-gnu, feat_os_unix, use-cross)" // stderr: "whoami: cannot find name for user ID 1001" // Maybe: "adduser --uid 1001 username" can put things right? -// stderr = id: error: Could not find uid 1001: No such id: 1001 +// stderr = id: Could not find uid 1001: No such id: 1001 fn skipping_test_is_okay(result: &CmdResult, needle: &str) -> bool { if !result.succeeded() { println!("result.stdout = {}", result.stdout_str()); diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index fc4459072..68cd9700f 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -301,7 +301,7 @@ fn test_install_target_new_file_with_group() { .arg(format!("{}/{}", dir, file)) .run(); - if is_ci() && result.stderr_str().contains("error: no such group:") { + if is_ci() && result.stderr_str().contains("no such group:") { // In the CI, some server are failing to return the group. // As seems to be a configuration issue, ignoring it return; diff --git a/tests/by-util/test_join.rs b/tests/by-util/test_join.rs index b0311df84..a8f046851 100644 --- a/tests/by-util/test_join.rs +++ b/tests/by-util/test_join.rs @@ -148,7 +148,7 @@ fn multitab_character() { .arg("-t") .arg("э") .fails() - .stderr_is("join: error: multi-character tab э"); + .stderr_is("join: multi-character tab э"); } #[test] @@ -211,7 +211,7 @@ fn empty_format() { .arg("-o") .arg("") .fails() - .stderr_is("join: error: invalid file number in field spec: ''"); + .stderr_is("join: invalid file number in field spec: ''"); } #[test] diff --git a/tests/by-util/test_link.rs b/tests/by-util/test_link.rs index 99559a7fe..6ac3f35cc 100644 --- a/tests/by-util/test_link.rs +++ b/tests/by-util/test_link.rs @@ -23,7 +23,7 @@ fn test_link_no_circular() { ucmd.args(&[link, link]) .fails() - .stderr_is("link: error: No such file or directory (os error 2)\n"); + .stderr_is("link: No such file or directory (os error 2)\n"); assert!(!at.file_exists(link)); } @@ -35,7 +35,7 @@ fn test_link_nonexistent_file() { ucmd.args(&[file, link]) .fails() - .stderr_is("link: error: No such file or directory (os error 2)\n"); + .stderr_is("link: No such file or directory (os error 2)\n"); assert!(!at.file_exists(file)); assert!(!at.file_exists(link)); } diff --git a/tests/by-util/test_ln.rs b/tests/by-util/test_ln.rs index 646091b09..f2508ecbf 100644 --- a/tests/by-util/test_ln.rs +++ b/tests/by-util/test_ln.rs @@ -409,7 +409,7 @@ fn test_symlink_missing_destination() { at.touch(file); ucmd.args(&["-s", "-T", file]).fails().stderr_is(format!( - "ln: error: missing destination file operand after '{}'", + "ln: missing destination file operand after '{}'", file )); } diff --git a/tests/by-util/test_logname.rs b/tests/by-util/test_logname.rs index bd9d04a50..0e8125191 100644 --- a/tests/by-util/test_logname.rs +++ b/tests/by-util/test_logname.rs @@ -9,7 +9,7 @@ fn test_normal() { for (key, value) in env::vars() { println!("{}: {}", key, value); } - if (is_ci() || uucore::os::is_wsl_1()) && result.stderr_str().contains("error: no login name") { + if (is_ci() || uucore::os::is_wsl_1()) && result.stderr_str().contains("no login name") { // ToDO: investigate WSL failure // In the CI, some server are failing to return logname. // As seems to be a configuration issue, ignoring it diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 6d6c65194..2ae57ad7f 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -167,7 +167,7 @@ fn test_ls_width() { .ucmd() .args(&option.split(" ").collect::>()) .fails() - .stderr_only("ls: error: invalid line width: ‘1a’"); + .stderr_only("ls: invalid line width: ‘1a’"); } } @@ -875,7 +875,7 @@ fn test_ls_files_dirs() { .ucmd() .arg("doesntexist") .fails() - .stderr_contains(&"error: 'doesntexist': No such file or directory"); + .stderr_contains(&"'doesntexist': No such file or directory"); // One exists, the other doesn't scene @@ -883,7 +883,7 @@ fn test_ls_files_dirs() { .arg("a") .arg("doesntexist") .fails() - .stderr_contains(&"error: 'doesntexist': No such file or directory") + .stderr_contains(&"'doesntexist': No such file or directory") .stdout_contains(&"a:"); } diff --git a/tests/by-util/test_mkfifo.rs b/tests/by-util/test_mkfifo.rs index 23108d976..318a2ea5d 100644 --- a/tests/by-util/test_mkfifo.rs +++ b/tests/by-util/test_mkfifo.rs @@ -2,9 +2,7 @@ use crate::common::util::*; #[test] fn test_create_fifo_missing_operand() { - new_ucmd!() - .fails() - .stderr_is("mkfifo: error: missing operand"); + new_ucmd!().fails().stderr_is("mkfifo: missing operand"); } #[test] @@ -43,5 +41,5 @@ fn test_create_one_fifo_already_exists() { .arg("abcdef") .arg("abcdef") .fails() - .stderr_is("mkfifo: error: cannot create fifo 'abcdef': File exists"); + .stderr_is("mkfifo: cannot create fifo 'abcdef': File exists"); } diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index c273c407c..617f0fd06 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -120,7 +120,7 @@ fn test_mktemp_mktemp_t() { .arg(TEST_TEMPLATE8) .fails() .no_stdout() - .stderr_contains("error: suffix cannot contain any path separators"); + .stderr_contains("suffix cannot contain any path separators"); } #[test] diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index 47532e2e5..e0723a479 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -472,7 +472,7 @@ fn test_mv_overwrite_nonempty_dir() { at.touch(dummy); // Not same error as GNU; the error message is a rust builtin // TODO: test (and implement) correct error message (or at least decide whether to do so) - // Current: "mv: error: couldn't rename path (Directory not empty; from=a; to=b)" + // Current: "mv: couldn't rename path (Directory not empty; from=a; to=b)" // GNU: "mv: cannot move ‘a’ to ‘b’: Directory not empty" // Verbose output for the move should not be shown on failure @@ -539,7 +539,7 @@ fn test_mv_errors() { .arg(dir) .fails() .stderr_is(format!( - "mv: error: cannot overwrite directory ‘{}’ with non-directory\n", + "mv: cannot overwrite directory ‘{}’ with non-directory\n", dir )); diff --git a/tests/by-util/test_nice.rs b/tests/by-util/test_nice.rs index d3457c686..9e004b98b 100644 --- a/tests/by-util/test_nice.rs +++ b/tests/by-util/test_nice.rs @@ -25,7 +25,7 @@ fn test_adjustment_with_no_command_should_error() { new_ucmd!() .args(&["-n", "19"]) .run() - .stderr_is("nice: error: A command must be given with an adjustment.\nTry \"nice --help\" for more information.\n"); + .stderr_is("nice: A command must be given with an adjustment.\nTry \"nice --help\" for more information.\n"); } #[test] diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 9a068887c..2a87038d5 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -258,7 +258,7 @@ fn test_rm_no_operand() { let mut ucmd = new_ucmd!(); ucmd.fails() - .stderr_is("rm: error: missing an argument\nrm: error: for help, try 'rm --help'\n"); + .stderr_is("rm: missing an argument\nrm: for help, try 'rm --help'\n"); } #[test] diff --git a/tests/by-util/test_rmdir.rs b/tests/by-util/test_rmdir.rs index 34531cf22..eef2d50f5 100644 --- a/tests/by-util/test_rmdir.rs +++ b/tests/by-util/test_rmdir.rs @@ -39,7 +39,7 @@ fn test_rmdir_nonempty_directory_no_parents() { assert!(at.file_exists(file)); ucmd.arg(dir).fails().stderr_is( - "rmdir: error: failed to remove 'test_rmdir_nonempty_no_parents': Directory not \ + "rmdir: failed to remove 'test_rmdir_nonempty_no_parents': Directory not \ empty\n", ); @@ -59,9 +59,9 @@ fn test_rmdir_nonempty_directory_with_parents() { assert!(at.file_exists(file)); ucmd.arg("-p").arg(dir).fails().stderr_is( - "rmdir: error: failed to remove 'test_rmdir_nonempty/with/parents': Directory not \ - empty\nrmdir: error: failed to remove 'test_rmdir_nonempty/with': Directory not \ - empty\nrmdir: error: failed to remove 'test_rmdir_nonempty': Directory not \ + "rmdir: failed to remove 'test_rmdir_nonempty/with/parents': Directory not \ + empty\nrmdir: failed to remove 'test_rmdir_nonempty/with': Directory not \ + empty\nrmdir: failed to remove 'test_rmdir_nonempty': Directory not \ empty\n", ); diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index e4676b379..133dc0028 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -42,7 +42,7 @@ fn test_invalid_buffer_size() { .arg(invalid_buffer_size) .fails() .stderr_only(format!( - "sort: error: failed to parse buffer size `{}`: invalid digit found in string", + "sort: failed to parse buffer size `{}`: invalid digit found in string", invalid_buffer_size )); } @@ -471,7 +471,7 @@ fn test_keys_invalid_field() { new_ucmd!() .args(&["-k", "1."]) .fails() - .stderr_only("sort: error: failed to parse character index for key `1.`: cannot parse integer from empty string"); + .stderr_only("sort: failed to parse character index for key `1.`: cannot parse integer from empty string"); } #[test] @@ -479,7 +479,7 @@ fn test_keys_invalid_field_option() { new_ucmd!() .args(&["-k", "1.1x"]) .fails() - .stderr_only("sort: error: invalid option for key: `x`"); + .stderr_only("sort: invalid option for key: `x`"); } #[test] @@ -487,14 +487,15 @@ fn test_keys_invalid_field_zero() { new_ucmd!() .args(&["-k", "0.1"]) .fails() - .stderr_only("sort: error: field index was 0"); + .stderr_only("sort: field index was 0"); } #[test] fn test_keys_invalid_char_zero() { - new_ucmd!().args(&["-k", "1.0"]).fails().stderr_only( - "sort: error: invalid character index 0 in `1.0` for the start position of a field", - ); + new_ucmd!() + .args(&["-k", "1.0"]) + .fails() + .stderr_only("sort: invalid character index 0 in `1.0` for the start position of a field"); } #[test] diff --git a/tests/by-util/test_stdbuf.rs b/tests/by-util/test_stdbuf.rs index 4105cb7a2..4732d2def 100644 --- a/tests/by-util/test_stdbuf.rs +++ b/tests/by-util/test_stdbuf.rs @@ -26,7 +26,7 @@ fn test_stdbuf_line_buffered_stdout() { #[test] fn test_stdbuf_no_buffer_option_fails() { new_ucmd!().args(&["head"]).fails().stderr_is( - "error: The following required arguments were not provided:\n \ + "The following required arguments were not provided:\n \ --error \n \ --input \n \ --output \n\n\ @@ -49,10 +49,9 @@ fn test_stdbuf_trailing_var_arg() { #[cfg(not(target_os = "windows"))] #[test] fn test_stdbuf_line_buffering_stdin_fails() { - new_ucmd!() - .args(&["-i", "L", "head"]) - .fails() - .stderr_is("stdbuf: error: line buffering stdin is meaningless\nTry 'stdbuf --help' for more information."); + new_ucmd!().args(&["-i", "L", "head"]).fails().stderr_is( + "stdbuf: line buffering stdin is meaningless\nTry 'stdbuf --help' for more information.", + ); } #[cfg(not(target_os = "windows"))] @@ -61,5 +60,5 @@ fn test_stdbuf_invalid_mode_fails() { new_ucmd!() .args(&["-i", "1024R", "head"]) .fails() - .stderr_is("stdbuf: error: invalid mode 1024R\nTry 'stdbuf --help' for more information."); + .stderr_is("stdbuf: invalid mode 1024R\nTry 'stdbuf --help' for more information."); } diff --git a/tests/by-util/test_sum.rs b/tests/by-util/test_sum.rs index d12455749..f09ba9d00 100644 --- a/tests/by-util/test_sum.rs +++ b/tests/by-util/test_sum.rs @@ -59,9 +59,7 @@ fn test_invalid_file() { at.mkdir("a"); - ucmd.arg("a") - .fails() - .stderr_is("sum: error: 'a' Is a directory"); + ucmd.arg("a").fails().stderr_is("sum: 'a' Is a directory"); } #[test] @@ -70,5 +68,5 @@ fn test_invalid_metadata() { ucmd.arg("b") .fails() - .stderr_is("sum: error: 'b' No such file or directory"); + .stderr_is("sum: 'b' No such file or directory"); } diff --git a/tests/by-util/test_uniq.rs b/tests/by-util/test_uniq.rs index c1e53faf3..2645c38ca 100644 --- a/tests/by-util/test_uniq.rs +++ b/tests/by-util/test_uniq.rs @@ -145,7 +145,7 @@ fn test_invalid_utf8() { .arg("not-utf8-sequence.txt") .run() .failure() - .stderr_only("uniq: error: invalid utf-8 sequence of 1 bytes from index 0"); + .stderr_only("uniq: invalid utf-8 sequence of 1 bytes from index 0"); } #[test] diff --git a/tests/by-util/test_unlink.rs b/tests/by-util/test_unlink.rs index fa8f962c4..1999e965c 100644 --- a/tests/by-util/test_unlink.rs +++ b/tests/by-util/test_unlink.rs @@ -22,7 +22,7 @@ fn test_unlink_multiple_files() { at.touch(file_b); ucmd.arg(file_a).arg(file_b).fails().stderr_is( - "unlink: error: extra operand: 'test_unlink_multiple_file_b'\nTry 'unlink --help' \ + "unlink: extra operand: 'test_unlink_multiple_file_b'\nTry 'unlink --help' \ for more information.\n", ); } @@ -35,7 +35,7 @@ fn test_unlink_directory() { at.mkdir(dir); ucmd.arg(dir).fails().stderr_is( - "unlink: error: cannot unlink 'test_unlink_empty_directory': Not a regular file \ + "unlink: cannot unlink 'test_unlink_empty_directory': Not a regular file \ or symlink\n", ); } @@ -45,7 +45,7 @@ fn test_unlink_nonexistent() { let file = "test_unlink_nonexistent"; new_ucmd!().arg(file).fails().stderr_is( - "unlink: error: Cannot stat 'test_unlink_nonexistent': No such file or directory \ + "unlink: Cannot stat 'test_unlink_nonexistent': No such file or directory \ (os error 2)\n", ); } diff --git a/tests/by-util/test_whoami.rs b/tests/by-util/test_whoami.rs index dc6a1ceed..a98541b2d 100644 --- a/tests/by-util/test_whoami.rs +++ b/tests/by-util/test_whoami.rs @@ -5,7 +5,7 @@ use crate::common::util::*; // considered okay. If we are not inside the CI this calls assert!(result.success). // // From the Logs: "Build (ubuntu-18.04, x86_64-unknown-linux-gnu, feat_os_unix, use-cross)" -// stderr: "whoami: error: failed to get username" +// stderr: "whoami: failed to get username" // Maybe: "adduser --uid 1001 username" can put things right? fn skipping_test_is_okay(result: &CmdResult, needle: &str) -> bool { if !result.succeeded() { From 8fe34c72d2980f39d2d7664b92c776a9c66d1b48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ya=C4=9F=C4=B1z=20can=20De=C4=9Firmenci?= Date: Wed, 26 May 2021 03:07:49 +0300 Subject: [PATCH 0681/1135] test: fix tests --- tests/by-util/test_stdbuf.rs | 2 +- tests/by-util/test_sync.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_stdbuf.rs b/tests/by-util/test_stdbuf.rs index 4732d2def..2e09601ce 100644 --- a/tests/by-util/test_stdbuf.rs +++ b/tests/by-util/test_stdbuf.rs @@ -26,7 +26,7 @@ fn test_stdbuf_line_buffered_stdout() { #[test] fn test_stdbuf_no_buffer_option_fails() { new_ucmd!().args(&["head"]).fails().stderr_is( - "The following required arguments were not provided:\n \ + "error: The following required arguments were not provided:\n \ --error \n \ --input \n \ --output \n\n\ diff --git a/tests/by-util/test_sync.rs b/tests/by-util/test_sync.rs index 436bfdef3..033651910 100644 --- a/tests/by-util/test_sync.rs +++ b/tests/by-util/test_sync.rs @@ -37,5 +37,5 @@ fn test_sync_no_existing_files() { .arg("--data") .arg("do-no-exist") .fails() - .stderr_contains("error: cannot stat"); + .stderr_contains("cannot stat"); } From 12f207a6d6f002e5c4f0aafc17b95c9d403e75c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ya=C4=9F=C4=B1z=20can=20De=C4=9Firmenci?= Date: Wed, 26 May 2021 03:21:53 +0300 Subject: [PATCH 0682/1135] test: fix tests --- tests/by-util/test_install.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 68cd9700f..fb79454c1 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -328,7 +328,7 @@ fn test_install_target_new_file_with_owner() { .arg(format!("{}/{}", dir, file)) .run(); - if is_ci() && result.stderr_str().contains("error: no such user:") { + if is_ci() && result.stderr_str().contains("no such user:") { // In the CI, some server are failing to return the user id. // As seems to be a configuration issue, ignoring it return; From a8a1ec7faf7ef1994366f538f040dc866a2c9686 Mon Sep 17 00:00:00 2001 From: Matt Blessed Date: Tue, 25 May 2021 16:41:07 -0400 Subject: [PATCH 0683/1135] cp: implement backup control with tests --- src/uu/cp/src/cp.rs | 64 +++++++----- tests/by-util/test_cp.rs | 210 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 247 insertions(+), 27 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 3d6faf66a..7eaa21c11 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -47,6 +47,7 @@ use std::os::windows::ffi::OsStrExt; use std::path::{Path, PathBuf, StripPrefixError}; use std::str::FromStr; use std::string::ToString; +use uucore::backup_control::{self, BackupMode}; use uucore::fs::resolve_relative_path; use uucore::fs::{canonicalize, CanonicalizeMode}; use walkdir::WalkDir; @@ -169,14 +170,6 @@ pub enum TargetType { File, } -#[derive(Clone, Eq, PartialEq)] -pub enum BackupMode { - ExistingBackup, - NoBackup, - NumberedBackup, - SimpleBackup, -} - pub enum CopyMode { Link, SymLink, @@ -201,7 +194,7 @@ pub enum Attribute { #[allow(dead_code)] pub struct Options { attributes_only: bool, - backup: bool, + backup: BackupMode, copy_contents: bool, copy_mode: CopyMode, dereference: bool, @@ -222,6 +215,7 @@ pub struct Options { static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY."; +static LONG_HELP: &str = ""; static EXIT_OK: i32 = 0; static EXIT_ERR: i32 = 1; @@ -301,6 +295,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .version(VERSION) .about(ABOUT) + .after_help(&*format!("{}\n{}", LONG_HELP, backup_control::BACKUP_CONTROL_LONG_HELP)) .usage(&usage[..]) .arg(Arg::with_name(OPT_TARGET_DIRECTORY) .short("t") @@ -364,12 +359,17 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg(Arg::with_name(OPT_BACKUP) .short("b") .long(OPT_BACKUP) - .help("make a backup of each existing destination file")) + .help("make a backup of each existing destination file") + .takes_value(true) + .require_equals(true) + .min_values(0) + .possible_values(backup_control::BACKUP_CONTROL_VALUES) + .value_name("CONTROL") + ) .arg(Arg::with_name(OPT_SUFFIX) .short("S") .long(OPT_SUFFIX) .takes_value(true) - .default_value("~") .value_name("SUFFIX") .help("override the usual backup suffix")) .arg(Arg::with_name(OPT_UPDATE) @@ -585,7 +585,24 @@ impl Options { || matches.is_present(OPT_RECURSIVE_ALIAS) || matches.is_present(OPT_ARCHIVE); - let backup = matches.is_present(OPT_BACKUP) || (matches.occurrences_of(OPT_SUFFIX) > 0); + let backup_mode = backup_control::determine_backup_mode( + matches.is_present(OPT_BACKUP), + matches.value_of(OPT_BACKUP), + ); + let backup_suffix = backup_control::determine_backup_suffix(matches.value_of(OPT_SUFFIX)); + + let overwrite = OverwriteMode::from_matches(matches); + + if overwrite == OverwriteMode::NoClobber && backup_mode != BackupMode::NoBackup { + show_error!( + "options --backup and --no-clobber are mutually exclusive\n\ + Try '{} --help' for more information.", + executable!() + ); + return Err(Error::Error( + "options --backup and --no-clobber are mutually exclusive".to_owned(), + )); + } // Parse target directory options let no_target_dir = matches.is_present(OPT_NO_TARGET_DIRECTORY); @@ -631,9 +648,7 @@ impl Options { || matches.is_present(OPT_NO_DEREFERENCE_PRESERVE_LINKS) || matches.is_present(OPT_ARCHIVE), one_file_system: matches.is_present(OPT_ONE_FILE_SYSTEM), - overwrite: OverwriteMode::from_matches(matches), parents: matches.is_present(OPT_PARENTS), - backup_suffix: matches.value_of(OPT_SUFFIX).unwrap().to_string(), update: matches.is_present(OPT_UPDATE), verbose: matches.is_present(OPT_VERBOSE), strip_trailing_slashes: matches.is_present(OPT_STRIP_TRAILING_SLASHES), @@ -654,7 +669,9 @@ impl Options { ReflinkMode::Never } }, - backup, + backup: backup_mode, + backup_suffix: backup_suffix, + overwrite: overwrite, no_target_dir, preserve_attributes, recursive, @@ -1090,14 +1107,10 @@ fn context_for(src: &Path, dest: &Path) -> String { format!("'{}' -> '{}'", src.display(), dest.display()) } -/// Implements a relatively naive backup that is not as full featured -/// as GNU cp. No CONTROL version control method argument is taken -/// for backups. -/// TODO: Add version control methods -fn backup_file(path: &Path, suffix: &str) -> CopyResult { - let mut backup_path = path.to_path_buf().into_os_string(); - backup_path.push(suffix); - fs::copy(path, &backup_path)?; +/// Implements a simple backup copy for the destination file. +/// TODO: for the backup, should this function be replaced by `copy_file(...)`? +fn backup_dest(dest: &Path, backup_path: &PathBuf) -> CopyResult { + fs::copy(dest, &backup_path)?; Ok(backup_path.into()) } @@ -1108,8 +1121,9 @@ fn handle_existing_dest(source: &Path, dest: &Path, options: &Options) -> CopyRe options.overwrite.verify(dest)?; - if options.backup { - backup_file(dest, &options.backup_suffix)?; + let backup_path = backup_control::get_backup_path(options.backup, dest, &options.backup_suffix); + if let Some(backup_path) = backup_path { + backup_dest(dest, &backup_path)?; } match options.overwrite { diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 1e99da0fb..dddba595c 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -214,8 +214,8 @@ fn test_cp_arg_symlink() { fn test_cp_arg_no_clobber() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.arg(TEST_HELLO_WORLD_SOURCE) - .arg("--no-clobber") .arg(TEST_HOW_ARE_YOU_SOURCE) + .arg("--no-clobber") .succeeds(); assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "How are you?\n"); @@ -305,7 +305,23 @@ fn test_cp_arg_backup() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.arg(TEST_HELLO_WORLD_SOURCE) - .arg("--backup") + .arg(TEST_HOW_ARE_YOU_SOURCE) + .arg("-b") + .succeeds(); + + assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); + assert_eq!( + at.read(&*format!("{}~", TEST_HOW_ARE_YOU_SOURCE)), + "How are you?\n" + ); +} + +#[test] +fn test_cp_arg_backup_arg_first() { + let (at, mut ucmd) = at_and_ucmd!(); + + ucmd.arg("--backup") + .arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_HOW_ARE_YOU_SOURCE) .succeeds(); @@ -321,6 +337,7 @@ fn test_cp_arg_suffix() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.arg(TEST_HELLO_WORLD_SOURCE) + .arg("-b") .arg("--suffix") .arg(".bak") .arg(TEST_HOW_ARE_YOU_SOURCE) @@ -333,6 +350,195 @@ fn test_cp_arg_suffix() { ); } +#[test] +fn test_cp_custom_backup_suffix_via_env() { + let (at, mut ucmd) = at_and_ucmd!(); + let suffix = "super-suffix-of-the-century"; + + ucmd.arg("-b") + .env("SIMPLE_BACKUP_SUFFIX", suffix) + .arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_HOW_ARE_YOU_SOURCE) + .succeeds() + .no_stderr(); + + assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); + assert_eq!( + at.read(&*format!("{}{}", TEST_HOW_ARE_YOU_SOURCE, suffix)), + "How are you?\n" + ); +} + +#[test] +fn test_cp_backup_numbered_with_t() { + let (at, mut ucmd) = at_and_ucmd!(); + + ucmd.arg("--backup=t") + .arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_HOW_ARE_YOU_SOURCE) + .succeeds() + .no_stderr(); + + assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); + assert_eq!( + at.read(&*format!("{}.~1~", TEST_HOW_ARE_YOU_SOURCE)), + "How are you?\n" + ); +} + +#[test] +fn test_cp_backup_numbered() { + let (at, mut ucmd) = at_and_ucmd!(); + + ucmd.arg("--backup=numbered") + .arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_HOW_ARE_YOU_SOURCE) + .succeeds() + .no_stderr(); + + assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); + assert_eq!( + at.read(&*format!("{}.~1~", TEST_HOW_ARE_YOU_SOURCE)), + "How are you?\n" + ); +} + +#[test] +fn test_cp_backup_existing() { + let (at, mut ucmd) = at_and_ucmd!(); + + ucmd.arg("--backup=existing") + .arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_HOW_ARE_YOU_SOURCE) + .succeeds() + .no_stderr(); + + assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); + assert_eq!( + at.read(&*format!("{}~", TEST_HOW_ARE_YOU_SOURCE)), + "How are you?\n" + ); +} + +#[test] +fn test_cp_backup_nil() { + let (at, mut ucmd) = at_and_ucmd!(); + + ucmd.arg("--backup=nil") + .arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_HOW_ARE_YOU_SOURCE) + .succeeds() + .no_stderr(); + + assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); + assert_eq!( + at.read(&*format!("{}~", TEST_HOW_ARE_YOU_SOURCE)), + "How are you?\n" + ); +} + +#[test] +fn test_cp_numbered_if_existing_backup_existing() { + let (at, mut ucmd) = at_and_ucmd!(); + let existing_backup = &*format!("{}.~1~", TEST_HOW_ARE_YOU_SOURCE); + at.touch(existing_backup); + + ucmd.arg("--backup=existing") + .arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_HOW_ARE_YOU_SOURCE) + .succeeds() + .no_stderr(); + + assert!(at.file_exists(TEST_HOW_ARE_YOU_SOURCE)); + assert!(at.file_exists(existing_backup)); + assert_eq!( + at.read(&*format!("{}.~2~", TEST_HOW_ARE_YOU_SOURCE)), + "How are you?\n" + ); +} + +#[test] +fn test_cp_numbered_if_existing_backup_nil() { + let (at, mut ucmd) = at_and_ucmd!(); + let existing_backup = &*format!("{}.~1~", TEST_HOW_ARE_YOU_SOURCE); + + at.touch(existing_backup); + ucmd.arg("--backup=nil") + .arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_HOW_ARE_YOU_SOURCE) + .succeeds() + .no_stderr(); + + assert!(at.file_exists(TEST_HOW_ARE_YOU_SOURCE)); + assert!(at.file_exists(existing_backup)); + assert_eq!( + at.read(&*format!("{}.~2~", TEST_HOW_ARE_YOU_SOURCE)), + "How are you?\n" + ); +} + +#[test] +fn test_cp_backup_simple() { + let (at, mut ucmd) = at_and_ucmd!(); + + ucmd.arg("--backup=simple") + .arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_HOW_ARE_YOU_SOURCE) + .succeeds() + .no_stderr(); + + assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); + assert_eq!( + at.read(&*format!("{}~", TEST_HOW_ARE_YOU_SOURCE)), + "How are you?\n" + ); +} + +#[test] +fn test_cp_backup_never() { + let (at, mut ucmd) = at_and_ucmd!(); + + ucmd.arg("--backup=never") + .arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_HOW_ARE_YOU_SOURCE) + .succeeds() + .no_stderr(); + + assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); + assert_eq!( + at.read(&*format!("{}~", TEST_HOW_ARE_YOU_SOURCE)), + "How are you?\n" + ); +} + +#[test] +fn test_cp_backup_none() { + let (at, mut ucmd) = at_and_ucmd!(); + + ucmd.arg("--backup=none") + .arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_HOW_ARE_YOU_SOURCE) + .succeeds() + .no_stderr(); + + assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); + assert!(!at.file_exists(&format!("{}~", TEST_HOW_ARE_YOU_SOURCE))); +} + +#[test] +fn test_cp_backup_off() { + let (at, mut ucmd) = at_and_ucmd!(); + + ucmd.arg("--backup=off") + .arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_HOW_ARE_YOU_SOURCE) + .succeeds() + .no_stderr(); + + assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); + assert!(!at.file_exists(&format!("{}~", TEST_HOW_ARE_YOU_SOURCE))); +} + #[test] fn test_cp_deref_conflicting_options() { new_ucmd!() From eda72b52081c7b92d412735f578645a37bdf6490 Mon Sep 17 00:00:00 2001 From: Syukron Rifail M Date: Sat, 15 May 2021 21:29:45 +0700 Subject: [PATCH 0684/1135] du: replace getopts with clap --- Cargo.lock | 1 + src/uu/du/Cargo.toml | 1 + src/uu/du/src/du.rs | 371 +++++++++++++++++++++++++++---------------- 3 files changed, 234 insertions(+), 139 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0674d3de0..5e1470c88 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1986,6 +1986,7 @@ name = "uu_du" version = "0.0.6" dependencies = [ "chrono", + "clap", "uucore", "uucore_procs", "winapi 0.3.9", diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index 3ce9d8361..023c0a021 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/du.rs" [dependencies] +clap = "2.33" chrono = "0.4" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 89dd3f739..6bd4f23e4 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -12,6 +12,7 @@ extern crate uucore; use chrono::prelude::DateTime; use chrono::Local; +use clap::{App, Arg}; use std::collections::HashSet; use std::env; use std::fs; @@ -37,6 +38,27 @@ use winapi::um::winbase::GetFileInformationByHandleEx; #[cfg(windows)] use winapi::um::winnt::{FILE_ID_128, ULONGLONG}; +mod options { + pub const NULL: &str = "0"; + pub const ALL: &str = "all"; + pub const APPARENT_SIZE: &str = "apparent-size"; + pub const BLOCK_SIZE: &str = "B"; + pub const BYTES: &str = "b"; + pub const TOTAL: &str = "c"; + pub const MAX_DEPTH: &str = "d"; + pub const HUMAN_READABLE: &str = "h"; + pub const BLOCK_SIZE_1K: &str = "k"; + pub const COUNT_LINKS: &str = "l"; + pub const BLOCK_SIZE_1M: &str = "m"; + pub const SEPARATE_DIRS: &str = "S"; + pub const SUMMARIZE: &str = "s"; + pub const SI: &str = "si"; + pub const TIME: &str = "time"; + pub const TIME_STYLE: &str = "time-style"; + pub const FILE: &str = "FILE"; +} + +const VERSION: &str = env!("CARGO_PKG_VERSION"); const NAME: &str = "du"; const SUMMARY: &str = "estimate file space usage"; const LONG_HELP: &str = " @@ -220,14 +242,14 @@ fn unit_string_to_number(s: &str) -> Option { Some(number * multiple.pow(unit)) } -fn translate_to_pure_number(s: &Option) -> Option { +fn translate_to_pure_number(s: &Option<&str>) -> Option { match *s { Some(ref s) => unit_string_to_number(s), None => None, } } -fn read_block_size(s: Option) -> u64 { +fn read_block_size(s: Option<&str>) -> u64 { match translate_to_pure_number(&s) { Some(v) => v, None => { @@ -236,7 +258,8 @@ fn read_block_size(s: Option) -> u64 { }; for env_var in &["DU_BLOCK_SIZE", "BLOCK_SIZE", "BLOCKSIZE"] { - if let Some(quantity) = translate_to_pure_number(&env::var(env_var).ok()) { + let env_size = env::var(env_var).ok(); + if let Some(quantity) = translate_to_pure_number(&env_size.as_deref()) { return quantity; } } @@ -361,126 +384,189 @@ fn convert_size_other(size: u64, _multiplier: u64, block_size: u64) -> String { format!("{}", ((size as f64) / (block_size as f64)).ceil()) } +fn get_usage() -> String { + format!( + "{0} [OPTION]... [FILE]... + {0} [OPTION]... --files0-from=F", + executable!() + ) +} + #[allow(clippy::cognitive_complexity)] pub fn uumain(args: impl uucore::Args) -> i32 { let args = args .collect_str(InvalidEncodingHandling::Ignore) .accept_any(); - let syntax = format!( - "[OPTION]... [FILE]... - {0} [OPTION]... --files0-from=F", - NAME - ); - let matches = app!(&syntax, SUMMARY, LONG_HELP) - // In task - .optflag( - "a", - "all", - " write counts for all files, not just directories", - ) - // In main - .optflag( - "", - "apparent-size", - "print apparent sizes, rather than disk usage - although the apparent size is usually smaller, it may be larger due to holes - in ('sparse') files, internal fragmentation, indirect blocks, and the like", - ) - // In main - .optopt( - "B", - "block-size", - "scale sizes by SIZE before printing them. - E.g., '-BM' prints sizes in units of 1,048,576 bytes. See SIZE format below.", - "SIZE", - ) - // In main - .optflag( - "b", - "bytes", - "equivalent to '--apparent-size --block-size=1'", - ) - // In main - .optflag("c", "total", "produce a grand total") - // In task - // opts.optflag("D", "dereference-args", "dereference only symlinks that are listed - // on the command line"), - // In main - // opts.optopt("", "files0-from", "summarize disk usage of the NUL-terminated file - // names specified in file F; - // If F is - then read names from standard input", "F"), - // // In task - // opts.optflag("H", "", "equivalent to --dereference-args (-D)"), - // In main - .optflag( - "h", - "human-readable", - "print sizes in human readable format (e.g., 1K 234M 2G)", - ) - // In main - .optflag("", "si", "like -h, but use powers of 1000 not 1024") - // In main - .optflag("k", "", "like --block-size=1K") - // In task - .optflag("l", "count-links", "count sizes many times if hard linked") - // // In main - .optflag("m", "", "like --block-size=1M") - // // In task - // opts.optflag("L", "dereference", "dereference all symbolic links"), - // // In task - // opts.optflag("P", "no-dereference", "don't follow any symbolic links (this is the default)"), - // // In main - .optflag( - "0", - "null", - "end each output line with 0 byte rather than newline", - ) - // In main - .optflag( - "S", - "separate-dirs", - "do not include size of subdirectories", - ) - // In main - .optflag("s", "summarize", "display only a total for each argument") - // // In task - // opts.optflag("x", "one-file-system", "skip directories on different file systems"), - // // In task - // opts.optopt("X", "exclude-from", "exclude files that match any pattern in FILE", "FILE"), - // // In task - // opts.optopt("", "exclude", "exclude files that match PATTERN", "PATTERN"), - // In main - .optopt( - "d", - "max-depth", - "print the total for a directory (or file, with --all) - only if it is N or fewer levels below the command - line argument; --max-depth=0 is the same as --summarize", - "N", - ) - // In main - .optflagopt( - "", - "time", - "show time of the last modification of any file in the - directory, or any of its subdirectories. If WORD is given, show time as WORD instead - of modification time: atime, access, use, ctime or status", - "WORD", - ) - // In main - .optopt( - "", - "time-style", - "show times using style STYLE: - full-iso, long-iso, iso, +FORMAT FORMAT is interpreted like 'date'", - "STYLE", - ) - .parse(args); + let usage = get_usage(); - let summarize = matches.opt_present("summarize"); + let matches = App::new(executable!()) + .version(VERSION) + .about(SUMMARY) + .usage(&usage[..]) + .after_help(LONG_HELP) + .arg( + Arg::with_name(options::ALL) + .short("a") + .long(options::ALL) + .help("write counts for all files, not just directories"), + ) + .arg( + Arg::with_name(options::APPARENT_SIZE) + .long(options::APPARENT_SIZE) + .help( + "print apparent sizes, rather than disk usage \ + although the apparent size is usually smaller, it may be larger due to holes \ + in ('sparse') files, internal fragmentation, indirect blocks, and the like" + ) + ) + .arg( + Arg::with_name(options::BLOCK_SIZE) + .short("B") + .long("block-size") + .value_name("SIZE") + .help( + "scale sizes by SIZE before printing them. \ + E.g., '-BM' prints sizes in units of 1,048,576 bytes. See SIZE format below." + ) + ) + .arg( + Arg::with_name(options::BYTES) + .short("b") + .long("bytes") + .help("equivalent to '--apparent-size --block-size=1'") + ) + .arg( + Arg::with_name(options::TOTAL) + .long("total") + .short("c") + .help("produce a grand total") + ) + .arg( + Arg::with_name(options::MAX_DEPTH) + .short("d") + .long("max-depth") + .value_name("N") + .help( + "print the total for a directory (or file, with --all) \ + only if it is N or fewer levels below the command \ + line argument; --max-depth=0 is the same as --summarize" + ) + ) + .arg( + Arg::with_name(options::HUMAN_READABLE) + .long("human-readable") + .short("h") + .help("print sizes in human readable format (e.g., 1K 234M 2G)") + ) + .arg( + Arg::with_name("inodes") + .long("inodes") + .help( + "list inode usage information instead of block usage like --block-size=1K" + ) + ) + .arg( + Arg::with_name(options::BLOCK_SIZE_1K) + .short("k") + .help("like --block-size=1K") + ) + .arg( + Arg::with_name(options::COUNT_LINKS) + .short("l") + .long("count-links") + .help("count sizes many times if hard linked") + ) + // .arg( + // Arg::with_name("dereference") + // .short("L") + // .long("dereference") + // .help("dereference all symbolic links") + // ) + // .arg( + // Arg::with_name("no-dereference") + // .short("P") + // .long("no-dereference") + // .help("don't follow any symbolic links (this is the default)") + // ) + .arg( + Arg::with_name(options::BLOCK_SIZE_1M) + .short("m") + .help("like --block-size=1M") + ) + .arg( + Arg::with_name(options::NULL) + .short("0") + .long("null") + .help("end each output line with 0 byte rather than newline") + ) + .arg( + Arg::with_name(options::SEPARATE_DIRS) + .short("S") + .long("separate-dirs") + .help("do not include size of subdirectories") + ) + .arg( + Arg::with_name(options::SUMMARIZE) + .short("s") + .long("summarize") + .help("display only a total for each argument") + ) + .arg( + Arg::with_name(options::SI) + .long(options::SI) + .help("like -h, but use powers of 1000 not 1024") + ) + // .arg( + // Arg::with_name("one-file-system") + // .short("x") + // .long("one-file-system") + // .help("skip directories on different file systems") + // ) + // .arg( + // Arg::with_name("") + // .short("x") + // .long("exclude-from") + // .value_name("FILE") + // .help("exclude files that match any pattern in FILE") + // ) + // .arg( + // Arg::with_name("exclude") + // .long("exclude") + // .value_name("PATTERN") + // .help("exclude files that match PATTERN") + // ) + .arg( + Arg::with_name(options::TIME) + .long(options::TIME) + .value_name("WORD") + .require_equals(true) + .min_values(0) + .help( + "show time of the last modification of any file in the \ + directory, or any of its subdirectories. If WORD is given, show time as WORD instead \ + of modification time: atime, access, use, ctime or status" + ) + ) + .arg( + Arg::with_name(options::TIME_STYLE) + .long(options::TIME_STYLE) + .value_name("STYLE") + .help( + "show times using style STYLE: \ + full-iso, long-iso, iso, +FORMAT FORMAT is interpreted like 'date'" + ) + ) + .arg( + Arg::with_name(options::FILE) + .hidden(true) + .multiple(true) + ) + .get_matches_from(args); - let max_depth_str = matches.opt_str("max-depth"); + let summarize = matches.is_present(options::SUMMARIZE); + + let max_depth_str = matches.value_of(options::MAX_DEPTH); let max_depth = max_depth_str.as_ref().and_then(|s| s.parse::().ok()); match (max_depth_str, max_depth) { (Some(ref s), _) if summarize => { @@ -495,34 +581,35 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } let options = Options { - all: matches.opt_present("all"), + all: matches.is_present(options::ALL), program_name: NAME.to_owned(), max_depth, - total: matches.opt_present("total"), - separate_dirs: matches.opt_present("S"), + total: matches.is_present(options::TOTAL), + separate_dirs: matches.is_present(options::SEPARATE_DIRS), }; - let strs = if matches.free.is_empty() { - vec!["./".to_owned()] // TODO: gnu `du` doesn't use trailing "/" here - } else { - matches.free.clone() + let strs = match matches.value_of(options::FILE) { + Some(_) => matches.values_of(options::FILE).unwrap().collect(), + None => { + vec!["./"] // TODO: gnu `du` doesn't use trailing "/" here + } }; - let block_size = read_block_size(matches.opt_str("block-size")); + let block_size = read_block_size(matches.value_of(options::BLOCK_SIZE)); - let multiplier: u64 = if matches.opt_present("si") { + let multiplier: u64 = if matches.is_present(options::SI) { 1000 } else { 1024 }; let convert_size_fn = { - if matches.opt_present("human-readable") || matches.opt_present("si") { + if matches.is_present(options::HUMAN_READABLE) || matches.is_present(options::SI) { convert_size_human - } else if matches.opt_present("b") { + } else if matches.is_present(options::BYTES) { convert_size_b - } else if matches.opt_present("k") { + } else if matches.is_present(options::BLOCK_SIZE_1K) { convert_size_k - } else if matches.opt_present("m") { + } else if matches.is_present(options::BLOCK_SIZE_1M) { convert_size_m } else { convert_size_other @@ -530,8 +617,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; let convert_size = |size| convert_size_fn(size, multiplier, block_size); - let time_format_str = match matches.opt_str("time-style") { - Some(s) => match &s[..] { + let time_format_str = match matches.value_of("time-style") { + Some(s) => match s { "full-iso" => "%Y-%m-%d %H:%M:%S.%f %z", "long-iso" => "%Y-%m-%d %H:%M", "iso" => "%Y-%m-%d", @@ -552,7 +639,11 @@ Try '{} --help' for more information.", None => "%Y-%m-%d %H:%M", }; - let line_separator = if matches.opt_present("0") { "\0" } else { "\n" }; + let line_separator = if matches.is_present(options::NULL) { + "\0" + } else { + "\n" + }; let mut grand_total = 0; for path_str in strs { @@ -565,18 +656,20 @@ Try '{} --help' for more information.", let (_, len) = iter.size_hint(); let len = len.unwrap(); for (index, stat) in iter.enumerate() { - let size = if matches.opt_present("apparent-size") || matches.opt_present("b") { + let size = if matches.is_present(options::APPARENT_SIZE) + || matches.is_present(options::BYTES) + { stat.size } else { // C's stat is such that each block is assume to be 512 bytes // See: http://linux.die.net/man/2/stat stat.blocks * 512 }; - if matches.opt_present("time") { + if matches.is_present(options::TIME) { let tm = { let secs = { - match matches.opt_str("time") { - Some(s) => match &s[..] { + match matches.value_of(options::TIME) { + Some(s) => match s { "accessed" => stat.accessed, "created" => stat.created, "modified" => stat.modified, @@ -649,8 +742,8 @@ mod test_du { (Some("900KB".to_string()), Some(900 * 1000)), (Some("BAD_STRING".to_string()), None), ]; - for it in test_data.into_iter() { - assert_eq!(translate_to_pure_number(&it.0), it.1); + for it in test_data.iter() { + assert_eq!(translate_to_pure_number(&it.0.as_deref()), it.1); } } @@ -661,8 +754,8 @@ mod test_du { (None, 1024), (Some("BAD_STRING".to_string()), 1024), ]; - for it in test_data.into_iter() { - assert_eq!(read_block_size(it.0.clone()), it.1); + for it in test_data.iter() { + assert_eq!(read_block_size(it.0.as_deref()), it.1); } } } From afb1b9efb4ff31fb934d459555f22cb82d94b483 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 26 May 2021 12:53:11 +0200 Subject: [PATCH 0685/1135] tests/util: add AtPath::hard_link --- tests/common/util.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/common/util.rs b/tests/common/util.rs index 611baadd4..6f9f779ef 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -7,7 +7,7 @@ use std::env; #[cfg(not(windows))] use std::ffi::CString; use std::ffi::OsStr; -use std::fs::{self, File, OpenOptions}; +use std::fs::{self, hard_link, File, OpenOptions}; use std::io::{Read, Result, Write}; #[cfg(unix)] use std::os::unix::fs::{symlink as symlink_dir, symlink as symlink_file}; @@ -524,6 +524,14 @@ impl AtPath { } } + pub fn hard_link(&self, src: &str, dst: &str) { + log_info( + "hard_link", + &format!("{},{}", self.plus_as_string(src), self.plus_as_string(dst)), + ); + hard_link(&self.plus(src), &self.plus(dst)).unwrap(); + } + pub fn symlink_file(&self, src: &str, dst: &str) { log_info( "symlink", @@ -680,6 +688,10 @@ impl TestScenario { cmd } + /// Returns builder for invoking any system command. Paths given are treated + /// relative to the environment's unique temporary test directory. + /// Differs from the builder returned by `cmd` in that `cmd_keepenv` does not call + /// `Command::env_clear` (Clears the entire environment map for the child process.) pub fn cmd_keepenv>(&self, bin: S) -> UCommand { UCommand::new_from_tmp(bin, self.tmpd.clone(), false) } From 6a70d89e8ca43c979a3b8053ecc43122d8d23bf5 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 26 May 2021 12:55:53 +0200 Subject: [PATCH 0686/1135] tests/du: replace call to 'ln' with call to 'AtPath::hard_link' --- tests/by-util/test_du.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index c72bd02a6..04dbf9f37 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -129,11 +129,9 @@ fn _du_soft_link(s: &str) { #[test] fn test_du_hard_link() { let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; - let result_ln = scene.cmd("ln").arg(SUB_FILE).arg(SUB_LINK).run(); - if !result_ln.succeeded() { - scene.ccmd("ln").arg(SUB_FILE).arg(SUB_LINK).succeeds(); - } + at.hard_link(SUB_FILE, SUB_LINK); let result = scene.ucmd().arg(SUB_DIR_LINKS).succeeds(); From efd5921bdaade152a9a1d07d813f685980d13900 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 26 May 2021 13:07:04 +0200 Subject: [PATCH 0687/1135] tests/test: replace call to 'ln -s' with call to 'AtPath::symlink_file' --- tests/by-util/test_test.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/by-util/test_test.rs b/tests/by-util/test_test.rs index 0dfc0c620..3a55f772a 100644 --- a/tests/by-util/test_test.rs +++ b/tests/by-util/test_test.rs @@ -437,10 +437,9 @@ fn test_not_is_not_empty() { #[cfg(not(windows))] fn test_symlink_is_symlink() { let scenario = TestScenario::new(util_name!()); - let mut ln = scenario.cmd("ln"); + let at = &scenario.fixtures; - // creating symlinks requires admin on Windows - ln.args(&["-s", "regular_file", "symlink"]).succeeds(); + at.symlink_file("regular_file", "symlink"); // FIXME: implement on Windows scenario.ucmd().args(&["-h", "symlink"]).succeeds(); From fe25b51a6658dffb2288c1b409b1c5ca50322d71 Mon Sep 17 00:00:00 2001 From: Dean Li Date: Wed, 26 May 2021 21:34:02 +0800 Subject: [PATCH 0688/1135] chmod: match GNU error Related to #2260 Signed-off-by: Dean Li --- src/uu/chmod/src/chmod.rs | 4 +++- tests/by-util/test_chmod.rs | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index 9dea3c842..c4bf309d6 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -262,8 +262,10 @@ impl Chmoder { ); } return Ok(()); + } else if err.kind() == std::io::ErrorKind::PermissionDenied { + show_error!("'{}': Permission denied", file.display()); } else { - show_error!("{}: '{}'", err, file.display()); + show_error!("'{}': {}", file.display(), err); } return Err(1); } diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index 733722b7c..f20429a6e 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -282,6 +282,26 @@ fn test_chmod_reference_file() { run_single_test(&tests[0], at, ucmd); } +#[test] +fn test_permission_denied() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.mkdir("d/"); + at.mkdir("d/no-x"); + at.mkdir("d/no-x/y"); + + scene.ucmd().arg("u=rw").arg("d/no-x").succeeds(); + + scene + .ucmd() + .arg("-R") + .arg("o=r") + .arg("d") + .fails() + .stderr_is("chmod: 'd/no-x/y': Permission denied"); +} + #[test] fn test_chmod_recursive() { let _guard = UMASK_MUTEX.lock(); From 25ed5eeb0e470b7d1695f9caebee8a192efecc79 Mon Sep 17 00:00:00 2001 From: Matt Blessed Date: Wed, 26 May 2021 10:50:41 -0400 Subject: [PATCH 0689/1135] cp: move option check to uumain and use `show_usage_error` - add test for conflicting options `--backup` and `--no-clobber` --- src/uu/cp/src/cp.rs | 17 ++++++----------- tests/by-util/test_cp.rs | 12 ++++++++++++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 7eaa21c11..7e64a288c 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -463,6 +463,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .get_matches_from(args); let options = crash_if_err!(EXIT_ERR, Options::from_matches(&matches)); + + if options.overwrite == OverwriteMode::NoClobber && options.backup != BackupMode::NoBackup { + show_usage_error!("options --backup and --no-clobber are mutually exclusive"); + return 1; + } + let paths: Vec = matches .values_of(OPT_PATHS) .map(|v| v.map(ToString::to_string).collect()) @@ -593,17 +599,6 @@ impl Options { let overwrite = OverwriteMode::from_matches(matches); - if overwrite == OverwriteMode::NoClobber && backup_mode != BackupMode::NoBackup { - show_error!( - "options --backup and --no-clobber are mutually exclusive\n\ - Try '{} --help' for more information.", - executable!() - ); - return Err(Error::Error( - "options --backup and --no-clobber are mutually exclusive".to_owned(), - )); - } - // Parse target directory options let no_target_dir = matches.is_present(OPT_NO_TARGET_DIRECTORY); let target_dir = matches diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index dddba595c..d41d3f6ed 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -539,6 +539,18 @@ fn test_cp_backup_off() { assert!(!at.file_exists(&format!("{}~", TEST_HOW_ARE_YOU_SOURCE))); } +#[test] +fn test_cp_backup_no_clobber_conflicting_options() { + let (_, mut ucmd) = at_and_ucmd!(); + + ucmd.arg("--backup") + .arg("--no-clobber") + .arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_HOW_ARE_YOU_SOURCE) + .fails() + .stderr_is("cp: options --backup and --no-clobber are mutually exclusive\nTry 'cp --help' for more information."); +} + #[test] fn test_cp_deref_conflicting_options() { new_ucmd!() From 64598d9e26fd39820a03dc793273636928c03d4c Mon Sep 17 00:00:00 2001 From: Mikadore Date: Wed, 26 May 2021 22:15:28 +0200 Subject: [PATCH 0690/1135] Closing #1916 --- tests/common/util.rs | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/common/util.rs b/tests/common/util.rs index 611baadd4..d1c6259b6 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -62,54 +62,54 @@ pub struct CmdResult { /// see [`success`] success: bool, /// captured standard output after running the Command - stdout: String, + stdout: Vec, /// captured standard error after running the Command - stderr: String, + stderr: Vec, } impl CmdResult { /// Returns a reference to the program's standard output as a slice of bytes pub fn stdout(&self) -> &[u8] { - &self.stdout.as_bytes() + &self.stdout } /// Returns the program's standard output as a string slice pub fn stdout_str(&self) -> &str { - &self.stdout + std::str::from_utf8(&self.stdout).unwrap() } /// Returns the program's standard output as a string /// consumes self pub fn stdout_move_str(self) -> String { - self.stdout + String::from_utf8(self.stdout).unwrap() } /// Returns the program's standard output as a vec of bytes /// consumes self pub fn stdout_move_bytes(self) -> Vec { - Vec::from(self.stdout) + self.stdout } /// Returns a reference to the program's standard error as a slice of bytes pub fn stderr(&self) -> &[u8] { - &self.stderr.as_bytes() + &self.stderr } /// Returns the program's standard error as a string slice pub fn stderr_str(&self) -> &str { - &self.stderr + std::str::from_utf8(&self.stderr).unwrap() } /// Returns the program's standard error as a string /// consumes self pub fn stderr_move_str(self) -> String { - self.stderr + String::from_utf8(self.stderr).unwrap() } /// Returns the program's standard error as a vec of bytes /// consumes self pub fn stderr_move_bytes(self) -> Vec { - Vec::from(self.stderr) + self.stderr } /// Returns the program's exit code @@ -202,21 +202,21 @@ impl CmdResult { /// passed in value, trailing whitespace are kept to force strict comparison (#1235) /// stdout_only is a better choice unless stderr may or will be non-empty pub fn stdout_is>(&self, msg: T) -> &CmdResult { - assert_eq!(self.stdout, String::from(msg.as_ref())); + assert_eq!(self.stdout_str(), String::from(msg.as_ref())); self } /// Like `stdout_is` but newlines are normalized to `\n`. pub fn normalized_newlines_stdout_is>(&self, msg: T) -> &CmdResult { let msg = msg.as_ref().replace("\r\n", "\n"); - assert_eq!(self.stdout.replace("\r\n", "\n"), msg); + assert_eq!(self.stdout_str().replace("\r\n", "\n"), msg); self } /// asserts that the command resulted in stdout stream output, /// whose bytes equal those of the passed in slice pub fn stdout_is_bytes>(&self, msg: T) -> &CmdResult { - assert_eq!(self.stdout.as_bytes(), msg.as_ref()); + assert_eq!(self.stdout, msg.as_ref()); self } @@ -231,7 +231,7 @@ impl CmdResult { /// stderr_only is a better choice unless stdout may or will be non-empty pub fn stderr_is>(&self, msg: T) -> &CmdResult { assert_eq!( - self.stderr.trim_end(), + self.stderr_str().trim_end(), String::from(msg.as_ref()).trim_end() ); self @@ -240,7 +240,7 @@ impl CmdResult { /// asserts that the command resulted in stderr stream output, /// whose bytes equal those of the passed in slice pub fn stderr_is_bytes>(&self, msg: T) -> &CmdResult { - assert_eq!(self.stderr.as_bytes(), msg.as_ref()); + assert_eq!(self.stderr, msg.as_ref()); self } @@ -874,8 +874,8 @@ impl UCommand { tmpd: self.tmpd.clone(), code: prog.status.code(), success: prog.status.success(), - stdout: from_utf8(&prog.stdout).unwrap().to_string(), - stderr: from_utf8(&prog.stderr).unwrap().to_string(), + stdout: prog.stdout, + stderr: prog.stderr } } From 5e1d52d4be95d0f8cd09019dbc9f8f1196f002b6 Mon Sep 17 00:00:00 2001 From: Mikadore Date: Wed, 26 May 2021 22:20:16 +0200 Subject: [PATCH 0691/1135] cargo-fmt :DDD --- tests/common/util.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/common/util.rs b/tests/common/util.rs index d1c6259b6..94d0df851 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -875,7 +875,7 @@ impl UCommand { code: prog.status.code(), success: prog.status.success(), stdout: prog.stdout, - stderr: prog.stderr + stderr: prog.stderr, } } From f11f5f3abba82be1e4697f4c7a8a0c804b3cfb07 Mon Sep 17 00:00:00 2001 From: Matt Blessed Date: Tue, 25 May 2021 20:34:49 -0400 Subject: [PATCH 0692/1135] mv: refactor backup logic to use shared uucore backup control - add mv backup tests --- src/uu/mv/src/mv.rs | 95 ++++------------------- tests/by-util/test_mv.rs | 161 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 164 insertions(+), 92 deletions(-) diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index a0ff1bcc6..c61c7caf1 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -20,6 +20,7 @@ use std::os::unix; #[cfg(windows)] use std::os::windows; use std::path::{Path, PathBuf}; +use uucore::backup_control::{self, BackupMode}; use fs_extra::dir::{move_dir, CopyOptions as DirCopyOptions}; @@ -40,16 +41,9 @@ pub enum OverwriteMode { Force, } -#[derive(Clone, Copy, Eq, PartialEq)] -pub enum BackupMode { - NoBackup, - SimpleBackup, - NumberedBackup, - ExistingBackup, -} - static ABOUT: &str = "Move SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY."; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static LONG_HELP: &str = ""; static OPT_BACKUP: &str = "backup"; static OPT_BACKUP_NO_ARG: &str = "b"; @@ -80,20 +74,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .version(VERSION) .about(ABOUT) + .after_help(&*format!("{}\n{}", LONG_HELP, backup_control::BACKUP_CONTROL_LONG_HELP)) .usage(&usage[..]) .arg( Arg::with_name(OPT_BACKUP) .long(OPT_BACKUP) .help("make a backup of each existing destination file") .takes_value(true) - .possible_value("simple") - .possible_value("never") - .possible_value("numbered") - .possible_value("t") - .possible_value("existing") - .possible_value("nil") - .possible_value("none") - .possible_value("off") + .require_equals(true) + .min_values(0) + .possible_values(backup_control::BACKUP_CONTROL_VALUES) .value_name("CONTROL") ) .arg( @@ -172,18 +162,17 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .unwrap_or_default(); let overwrite_mode = determine_overwrite_mode(&matches); - let backup_mode = determine_backup_mode(&matches); + let backup_mode = backup_control::determine_backup_mode( + matches.is_present(OPT_BACKUP_NO_ARG) || matches.is_present(OPT_BACKUP), + matches.value_of(OPT_BACKUP), + ); if overwrite_mode == OverwriteMode::NoClobber && backup_mode != BackupMode::NoBackup { - show_error!( - "options --backup and --no-clobber are mutually exclusive\n\ - Try '{} --help' for more information.", - executable!() - ); + show_usage_error!("options --backup and --no-clobber are mutually exclusive"); return 1; } - let backup_suffix = determine_backup_suffix(backup_mode, &matches); + let backup_suffix = backup_control::determine_backup_suffix(matches.value_of(OPT_SUFFIX)); let behavior = Behavior { overwrite: overwrite_mode, @@ -227,37 +216,6 @@ fn determine_overwrite_mode(matches: &ArgMatches) -> OverwriteMode { } } -fn determine_backup_mode(matches: &ArgMatches) -> BackupMode { - if matches.is_present(OPT_BACKUP_NO_ARG) { - BackupMode::SimpleBackup - } else if matches.is_present(OPT_BACKUP) { - match matches.value_of(OPT_BACKUP).map(String::from) { - None => BackupMode::SimpleBackup, - Some(mode) => match &mode[..] { - "simple" | "never" => BackupMode::SimpleBackup, - "numbered" | "t" => BackupMode::NumberedBackup, - "existing" | "nil" => BackupMode::ExistingBackup, - "none" | "off" => BackupMode::NoBackup, - _ => panic!(), // cannot happen as it is managed by clap - }, - } - } else { - BackupMode::NoBackup - } -} - -fn determine_backup_suffix(backup_mode: BackupMode, matches: &ArgMatches) -> String { - if matches.is_present(OPT_SUFFIX) { - matches.value_of(OPT_SUFFIX).map(String::from).unwrap() - } else if let (Ok(s), BackupMode::SimpleBackup) = - (env::var("SIMPLE_BACKUP_SUFFIX"), backup_mode) - { - s - } else { - "~".to_owned() - } -} - fn exec(files: &[PathBuf], b: Behavior) -> i32 { if let Some(ref name) = b.target_dir { return move_files_into_dir(files, &PathBuf::from(name), &b); @@ -389,12 +347,7 @@ fn rename(from: &Path, to: &Path, b: &Behavior) -> io::Result<()> { OverwriteMode::Force => {} }; - backup_path = match b.backup { - BackupMode::NoBackup => None, - BackupMode::SimpleBackup => Some(simple_backup_path(to, &b.suffix)), - BackupMode::NumberedBackup => Some(numbered_backup_path(to)), - BackupMode::ExistingBackup => Some(existing_backup_path(to, &b.suffix)), - }; + backup_path = backup_control::get_backup_path(b.backup, to, &b.suffix); if let Some(ref backup_path) = backup_path { rename_with_fallback(to, backup_path)?; } @@ -514,28 +467,6 @@ fn read_yes() -> bool { } } -fn simple_backup_path(path: &Path, suffix: &str) -> PathBuf { - let mut p = path.to_string_lossy().into_owned(); - p.push_str(suffix); - PathBuf::from(p) -} - -fn numbered_backup_path(path: &Path) -> PathBuf { - (1_u64..) - .map(|i| path.with_extension(format!("~{}~", i))) - .find(|p| !p.exists()) - .expect("cannot create backup") -} - -fn existing_backup_path(path: &Path, suffix: &str) -> PathBuf { - let test_path = path.with_extension("~1~"); - if test_path.exists() { - numbered_backup_path(path) - } else { - simple_backup_path(path, suffix) - } -} - fn is_empty_dir(path: &Path) -> bool { match fs::read_dir(path) { Ok(contents) => contents.peekable().peek().is_none(), diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index e0723a479..e0bdd9ef3 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -251,6 +251,40 @@ fn test_mv_simple_backup() { assert!(at.file_exists(&format!("{}~", file_b))); } +#[test] +fn test_mv_simple_backup_with_file_extension() { + let (at, mut ucmd) = at_and_ucmd!(); + let file_a = "test_mv_simple_backup_file_a.txt"; + let file_b = "test_mv_simple_backup_file_b.txt"; + + at.touch(file_a); + at.touch(file_b); + ucmd.arg("-b") + .arg(file_a) + .arg(file_b) + .succeeds() + .no_stderr(); + + assert!(!at.file_exists(file_a)); + assert!(at.file_exists(file_b)); + assert!(at.file_exists(&format!("{}~", file_b))); +} + +#[test] +fn test_mv_arg_backup_arg_first() { + let (at, mut ucmd) = at_and_ucmd!(); + let file_a = "test_mv_simple_backup_file_a"; + let file_b = "test_mv_simple_backup_file_b"; + + at.touch(file_a); + at.touch(file_b); + ucmd.arg("--backup").arg(file_a).arg(file_b).succeeds(); + + assert!(!at.file_exists(file_a)); + assert!(at.file_exists(file_b)); + assert!(at.file_exists(&format!("{}~", file_b))); +} + #[test] fn test_mv_custom_backup_suffix() { let (at, mut ucmd) = at_and_ucmd!(); @@ -293,7 +327,7 @@ fn test_mv_custom_backup_suffix_via_env() { } #[test] -fn test_mv_backup_numbering() { +fn test_mv_backup_numbered_with_t() { let (at, mut ucmd) = at_and_ucmd!(); let file_a = "test_mv_backup_numbering_file_a"; let file_b = "test_mv_backup_numbering_file_b"; @@ -311,6 +345,25 @@ fn test_mv_backup_numbering() { assert!(at.file_exists(&format!("{}.~1~", file_b))); } +#[test] +fn test_mv_backup_numbered() { + let (at, mut ucmd) = at_and_ucmd!(); + let file_a = "test_mv_backup_numbering_file_a"; + let file_b = "test_mv_backup_numbering_file_b"; + + at.touch(file_a); + at.touch(file_b); + ucmd.arg("--backup=numbered") + .arg(file_a) + .arg(file_b) + .succeeds() + .no_stderr(); + + assert!(!at.file_exists(file_a)); + assert!(at.file_exists(file_b)); + assert!(at.file_exists(&format!("{}.~1~", file_b))); +} + #[test] fn test_mv_backup_existing() { let (at, mut ucmd) = at_and_ucmd!(); @@ -330,6 +383,67 @@ fn test_mv_backup_existing() { assert!(at.file_exists(&format!("{}~", file_b))); } +#[test] +fn test_mv_backup_nil() { + let (at, mut ucmd) = at_and_ucmd!(); + let file_a = "test_mv_backup_numbering_file_a"; + let file_b = "test_mv_backup_numbering_file_b"; + + at.touch(file_a); + at.touch(file_b); + ucmd.arg("--backup=nil") + .arg(file_a) + .arg(file_b) + .succeeds() + .no_stderr(); + + assert!(!at.file_exists(file_a)); + assert!(at.file_exists(file_b)); + assert!(at.file_exists(&format!("{}~", file_b))); +} + +#[test] +fn test_mv_numbered_if_existing_backup_existing() { + let (at, mut ucmd) = at_and_ucmd!(); + let file_a = "test_mv_backup_numbering_file_a"; + let file_b = "test_mv_backup_numbering_file_b"; + let file_b_backup = "test_mv_backup_numbering_file_b.~1~"; + + at.touch(file_a); + at.touch(file_b); + at.touch(file_b_backup); + ucmd.arg("--backup=existing") + .arg(file_a) + .arg(file_b) + .succeeds() + .no_stderr(); + + assert!(at.file_exists(file_b)); + assert!(at.file_exists(file_b_backup)); + assert!(at.file_exists(&*format!("{}.~2~", file_b))); +} + +#[test] +fn test_mv_numbered_if_existing_backup_nil() { + let (at, mut ucmd) = at_and_ucmd!(); + let file_a = "test_mv_backup_numbering_file_a"; + let file_b = "test_mv_backup_numbering_file_b"; + let file_b_backup = "test_mv_backup_numbering_file_b.~1~"; + + at.touch(file_a); + at.touch(file_b); + at.touch(file_b_backup); + ucmd.arg("--backup=nil") + .arg(file_a) + .arg(file_b) + .succeeds() + .no_stderr(); + + assert!(at.file_exists(file_b)); + assert!(at.file_exists(file_b_backup)); + assert!(at.file_exists(&*format!("{}.~2~", file_b))); +} + #[test] fn test_mv_backup_simple() { let (at, mut ucmd) = at_and_ucmd!(); @@ -349,6 +463,25 @@ fn test_mv_backup_simple() { assert!(at.file_exists(&format!("{}~", file_b))); } +#[test] +fn test_mv_backup_never() { + let (at, mut ucmd) = at_and_ucmd!(); + let file_a = "test_mv_backup_numbering_file_a"; + let file_b = "test_mv_backup_numbering_file_b"; + + at.touch(file_a); + at.touch(file_b); + ucmd.arg("--backup=never") + .arg(file_a) + .arg(file_b) + .succeeds() + .no_stderr(); + + assert!(!at.file_exists(file_a)); + assert!(at.file_exists(file_b)); + assert!(at.file_exists(&format!("{}~", file_b))); +} + #[test] fn test_mv_backup_none() { let (at, mut ucmd) = at_and_ucmd!(); @@ -369,17 +502,14 @@ fn test_mv_backup_none() { } #[test] -fn test_mv_existing_backup() { +fn test_mv_backup_off() { let (at, mut ucmd) = at_and_ucmd!(); - let file_a = "test_mv_existing_backup_file_a"; - let file_b = "test_mv_existing_backup_file_b"; - let file_b_backup = "test_mv_existing_backup_file_b.~1~"; - let resulting_backup = "test_mv_existing_backup_file_b.~2~"; + let file_a = "test_mv_backup_numbering_file_a"; + let file_b = "test_mv_backup_numbering_file_b"; at.touch(file_a); at.touch(file_b); - at.touch(file_b_backup); - ucmd.arg("--backup=nil") + ucmd.arg("--backup=off") .arg(file_a) .arg(file_b) .succeeds() @@ -387,8 +517,19 @@ fn test_mv_existing_backup() { assert!(!at.file_exists(file_a)); assert!(at.file_exists(file_b)); - assert!(at.file_exists(file_b_backup)); - assert!(at.file_exists(resulting_backup)); + assert!(!at.file_exists(&format!("{}~", file_b))); +} + +#[test] +fn test_mv_backup_no_clobber_conflicting_options() { + let (_, mut ucmd) = at_and_ucmd!(); + + ucmd.arg("--backup") + .arg("--no-clobber") + .arg("file1") + .arg("file2") + .fails() + .stderr_is("mv: options --backup and --no-clobber are mutually exclusive\nTry 'mv --help' for more information."); } #[test] From 41bea72f23da42f0b5dded9b1955a3782cd1c063 Mon Sep 17 00:00:00 2001 From: Matt Blessed Date: Wed, 26 May 2021 18:28:17 -0400 Subject: [PATCH 0693/1135] cp: fix regressed issue with `--backup` and `-b` - add test for regressed issue --- src/uu/cp/src/cp.rs | 8 ++++++-- tests/by-util/test_cp.rs | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 7e64a288c..fab1dfec1 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -232,6 +232,7 @@ fn get_usage() -> String { static OPT_ARCHIVE: &str = "archive"; static OPT_ATTRIBUTES_ONLY: &str = "attributes-only"; static OPT_BACKUP: &str = "backup"; +static OPT_BACKUP_NO_ARG: &str = "b"; static OPT_CLI_SYMBOLIC_LINKS: &str = "cli-symbolic-links"; static OPT_CONTEXT: &str = "context"; static OPT_COPY_CONTENTS: &str = "copy-contents"; @@ -357,7 +358,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("remove each existing destination file before attempting to open it \ (contrast with --force). On Windows, current only works for writeable files.")) .arg(Arg::with_name(OPT_BACKUP) - .short("b") .long(OPT_BACKUP) .help("make a backup of each existing destination file") .takes_value(true) @@ -366,6 +366,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .possible_values(backup_control::BACKUP_CONTROL_VALUES) .value_name("CONTROL") ) + .arg(Arg::with_name(OPT_BACKUP_NO_ARG) + .short(OPT_BACKUP_NO_ARG) + .help("like --backup but does not accept an argument") + ) .arg(Arg::with_name(OPT_SUFFIX) .short("S") .long(OPT_SUFFIX) @@ -592,7 +596,7 @@ impl Options { || matches.is_present(OPT_ARCHIVE); let backup_mode = backup_control::determine_backup_mode( - matches.is_present(OPT_BACKUP), + matches.is_present(OPT_BACKUP_NO_ARG) || matches.is_present(OPT_BACKUP), matches.value_of(OPT_BACKUP), ); let backup_suffix = backup_control::determine_backup_suffix(matches.value_of(OPT_SUFFIX)); diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index d41d3f6ed..d49219b04 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -316,6 +316,22 @@ fn test_cp_arg_backup() { ); } +#[test] +fn test_cp_arg_backup_with_other_args() { + let (at, mut ucmd) = at_and_ucmd!(); + + ucmd.arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_HOW_ARE_YOU_SOURCE) + .arg("-vbL") + .succeeds(); + + assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); + assert_eq!( + at.read(&*format!("{}~", TEST_HOW_ARE_YOU_SOURCE)), + "How are you?\n" + ); +} + #[test] fn test_cp_arg_backup_arg_first() { let (at, mut ucmd) = at_and_ucmd!(); From 29f6dd1f3583d954be7921dac9f3fbf8456f7ae5 Mon Sep 17 00:00:00 2001 From: Mikadore Date: Thu, 27 May 2021 16:55:14 +0200 Subject: [PATCH 0694/1135] Fixed warning --- tests/common/util.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/common/util.rs b/tests/common/util.rs index 94d0df851..ba4eed317 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -16,7 +16,6 @@ use std::os::windows::fs::{symlink_dir, symlink_file}; use std::path::{Path, PathBuf}; use std::process::{Child, Command, Stdio}; use std::rc::Rc; -use std::str::from_utf8; use std::thread::sleep; use std::time::Duration; use tempfile::TempDir; From 052ee22ce019faf7a7021f81430512df9c39b901 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 27 May 2021 18:20:15 +0200 Subject: [PATCH 0695/1135] Bump MSRV to 1.43.1 --- .github/workflows/CICD.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 977a86915..804720bea 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -11,7 +11,7 @@ env: PROJECT_NAME: coreutils PROJECT_DESC: "Core universal (cross-platform) utilities" PROJECT_AUTH: "uutils" - RUST_MIN_SRV: "1.40.0" ## v1.40.0 + 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 on: [push, pull_request] diff --git a/README.md b/README.md index 6b29fa854..1365bf7ce 100644 --- a/README.md +++ b/README.md @@ -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.40.0`. +The current oldest supported version of the Rust compiler is `1.43.1`. On both Windows and Redox, only the nightly version is tested currently. From 825476f57314565e306287e72e2f5c690a749567 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 27 May 2021 20:25:24 +0200 Subject: [PATCH 0696/1135] Update tempfile --- Cargo.lock | 79 ++++++++++++++++++++++++++++++++++++++++++++++-------- Cargo.toml | 4 +-- 2 files changed, 69 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5e1470c88..2060edfa2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -707,7 +707,18 @@ checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.10.2+wasi-snapshot-preview1", ] [[package]] @@ -1253,14 +1264,26 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", + "getrandom 0.1.16", "libc", - "rand_chacha", + "rand_chacha 0.2.2", "rand_core 0.5.1", - "rand_hc", + "rand_hc 0.2.0", "rand_pcg", ] +[[package]] +name = "rand" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +dependencies = [ + "libc", + "rand_chacha 0.3.0", + "rand_core 0.6.2", + "rand_hc 0.3.0", +] + [[package]] name = "rand_chacha" version = "0.2.2" @@ -1271,6 +1294,16 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.2", +] + [[package]] name = "rand_core" version = "0.3.1" @@ -1292,7 +1325,16 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +dependencies = [ + "getrandom 0.2.3", ] [[package]] @@ -1304,6 +1346,15 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_hc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +dependencies = [ + "rand_core 0.6.2", +] + [[package]] name = "rand_pcg" version = "0.2.1" @@ -1623,14 +1674,14 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", - "rand 0.7.3", - "redox_syscall 0.1.57", + "rand 0.8.3", + "redox_syscall 0.2.8", "remove_dir_all", "winapi 0.3.9", ] @@ -2053,7 +2104,7 @@ dependencies = [ "array-init", "criterion", "rand 0.7.3", - "rand_chacha", + "rand_chacha 0.2.2", "uu_factor", ] @@ -2877,6 +2928,12 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" + [[package]] name = "wasm-bindgen" version = "0.2.74" diff --git a/Cargo.toml b/Cargo.toml index 745393260..fdf45e484 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -342,9 +342,7 @@ pretty_assertions = "0.7.2" rand = "0.7" regex = "1.0" sha1 = { version="0.6", features=["std"] } -## tempfile 3.2 depends on recent version of rand which depends on getrandom v0.2 which has compiler errors for MinRustV v1.32.0 -## min dep for tempfile = Rustc 1.40 -tempfile = "= 3.1.0" +tempfile = "3.2.0" time = "0.1" unindent = "0.1" uucore = { version=">=0.0.8", package="uucore", path="src/uucore", features=["entries"] } From ebe6341ae37dee47ce94861960ddadc012a127bb Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 27 May 2021 22:47:03 +0200 Subject: [PATCH 0697/1135] chore: replace tempdir with tempfile --- Cargo.lock | 2 +- Cargo.toml | 1 - src/uu/sort/Cargo.toml | 2 +- src/uu/sort/src/ext_sort.rs | 4 ++-- tests/by-util/test_cat.rs | 3 +-- tests/by-util/test_ls.rs | 6 ++---- 6 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5e1470c88..547e9bc6e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2536,7 +2536,7 @@ dependencies = [ "rand 0.7.3", "rayon", "semver 0.9.0", - "tempdir", + "tempfile", "unicode-width", "uucore", "uucore_procs", diff --git a/Cargo.toml b/Cargo.toml index 745393260..9f499529b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -349,7 +349,6 @@ time = "0.1" unindent = "0.1" uucore = { version=">=0.0.8", package="uucore", path="src/uucore", features=["entries"] } walkdir = "2.2" -tempdir = "0.3" [target.'cfg(unix)'.dev-dependencies] rust-users = { version="0.10", package="users" } diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 724744dc4..f06610248 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -25,7 +25,7 @@ ouroboros = "0.9.3" rand = "0.7" rayon = "1.5" semver = "0.9.0" -tempdir = "0.3.7" +tempfile = "3" unicode-width = "0.1.8" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs index a304bf7c0..23a55aad0 100644 --- a/src/uu/sort/src/ext_sort.rs +++ b/src/uu/sort/src/ext_sort.rs @@ -23,7 +23,7 @@ use std::{ use itertools::Itertools; -use tempdir::TempDir; +use tempfile::TempDir; use crate::{ chunks::{self, Chunk}, @@ -34,7 +34,7 @@ const MIN_BUFFER_SIZE: usize = 8_000; /// Sort files by using auxiliary files for storing intermediate chunks (if needed), and output the result. pub fn ext_sort(files: &mut impl Iterator>, settings: &GlobalSettings) { - let tmp_dir = crash_if_err!(1, TempDir::new_in(&settings.tmp_dir, "uutils_sort")); + let tmp_dir = crash_if_err!(1, tempfile::Builder::new().prefix("uutils_sort").tempdir_in(&settings.tmp_dir)); let (sorted_sender, sorted_receiver) = std::sync::mpsc::sync_channel(1); let (recycled_sender, recycled_receiver) = std::sync::mpsc::sync_channel(1); thread::spawn({ diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index 4bb673b95..adda905b3 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -406,10 +406,9 @@ fn test_domain_socket() { use std::io::prelude::*; use std::sync::{Arc, Barrier}; use std::thread; - use tempdir::TempDir; use unix_socket::UnixListener; - let dir = TempDir::new("unix_socket").expect("failed to create dir"); + let dir = tempfile::Builder::new().prefix("unix_socket").tempdir().expect("failed to create dir"); let socket_path = dir.path().join("sock"); let listener = UnixListener::bind(&socket_path).expect("failed to create socket"); diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 2ae57ad7f..01c5ab5c4 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -19,9 +19,7 @@ use std::path::PathBuf; #[cfg(not(windows))] use std::sync::Mutex; #[cfg(not(windows))] -extern crate tempdir; -#[cfg(not(windows))] -use self::tempdir::TempDir; +extern crate tempfile; #[cfg(not(windows))] lazy_static! { @@ -1087,7 +1085,7 @@ fn test_ls_indicator_style() { { use self::unix_socket::UnixListener; - let dir = TempDir::new("unix_socket").expect("failed to create dir"); + let dir = tempfile::Builder::new().prefix("unix_socket").tempdir().expect("failed to create dir"); let socket_path = dir.path().join("sock"); let _listener = UnixListener::bind(&socket_path).expect("failed to create socket"); From 835a17d79f59891458d7701daad7c664576448d7 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 27 May 2021 22:48:10 +0200 Subject: [PATCH 0698/1135] mktemp: use tempfile instead of custom tempdir --- Cargo.lock | 33 ---------------- src/uu/mktemp/src/mktemp.rs | 76 ++++++++++++++++++------------------ src/uu/mktemp/src/tempdir.rs | 51 ------------------------ 3 files changed, 39 insertions(+), 121 deletions(-) delete mode 100644 src/uu/mktemp/src/tempdir.rs diff --git a/Cargo.lock b/Cargo.lock index 547e9bc6e..1d4cdca93 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -254,7 +254,6 @@ dependencies = [ "rand 0.7.3", "regex", "sha1", - "tempdir", "tempfile", "textwrap", "time", @@ -1221,19 +1220,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -dependencies = [ - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "rdrand", - "winapi 0.3.9", -] - [[package]] name = "rand" version = "0.5.6" @@ -1338,15 +1324,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] - [[package]] name = "redox_syscall" version = "0.1.57" @@ -1611,16 +1588,6 @@ dependencies = [ "unicode-xid 0.2.2", ] -[[package]] -name = "tempdir" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" -dependencies = [ - "rand 0.4.6", - "remove_dir_all", -] - [[package]] name = "tempfile" version = "3.1.0" diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index 112c2fb94..d66dd3d57 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -15,14 +15,11 @@ use clap::{App, Arg}; use std::env; use std::iter; -use std::mem::forget; use std::path::{is_separator, PathBuf}; use rand::Rng; use tempfile::Builder; -mod tempdir; - static ABOUT: &str = "create a temporary file or directory."; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -214,49 +211,54 @@ pub fn dry_exec(mut tmpdir: PathBuf, prefix: &str, rand: usize, suffix: &str) -> } fn exec( - tmpdir: PathBuf, + dir: PathBuf, prefix: &str, rand: usize, suffix: &str, make_dir: bool, quiet: bool, ) -> i32 { - if make_dir { - match tempdir::new_in(&tmpdir, prefix, rand, suffix) { - Ok(ref f) => { - println!("{}", f); - return 0; - } - Err(e) => { - if !quiet { - show_error!("{}: {}", e, tmpdir.display()); + let res = if make_dir { + let tmpdir = Builder::new() + .prefix(prefix) + .rand_bytes(rand) + .suffix(suffix) + .tempdir_in(&dir); + + // `into_path` consumes the TempDir without removing it + tmpdir.map(|d| d.into_path().to_string_lossy().to_string()) + } else { + let tmpfile = Builder::new() + .prefix(prefix) + .rand_bytes(rand) + .suffix(suffix) + .tempfile_in(&dir); + + match tmpfile { + Ok(f) => { + // `keep` ensures that the file is not deleted + match f.keep() { + Ok((_, p)) => Ok(p.to_string_lossy().to_string()), + Err(e) => { + show_error!("'{}': {}", dir.display(), e); + return 1; + } } - return 1; } - } - } - let tmpfile = Builder::new() - .prefix(prefix) - .rand_bytes(rand) - .suffix(suffix) - .tempfile_in(tmpdir); - let tmpfile = match tmpfile { - Ok(f) => f, - Err(e) => { - if !quiet { - show_error!("failed to create tempfile: {}", e); - } - return 1; + Err(x) => Err(x) } }; - let tmpname = tmpfile.path().to_string_lossy().to_string(); - - println!("{}", tmpname); - - // CAUTION: Not to call `drop` of tmpfile, which removes the tempfile, - // I call a dangerous function `forget`. - forget(tmpfile); - - 0 + match res { + Ok(ref f) => { + println!("{}", f); + 0 + } + Err(e) => { + if !quiet { + show_error!("{}: {}", e, dir.display()); + } + 1 + } + } } diff --git a/src/uu/mktemp/src/tempdir.rs b/src/uu/mktemp/src/tempdir.rs deleted file mode 100644 index 1b6c9d7b3..000000000 --- a/src/uu/mktemp/src/tempdir.rs +++ /dev/null @@ -1,51 +0,0 @@ -// spell-checker:ignore (ToDO) tempdir tmpdir - -// Mainly taken from crate `tempdir` - -use rand::distributions::Alphanumeric; -use rand::{thread_rng, Rng}; - -use std::io::Result as IOResult; -use std::io::{Error, ErrorKind}; -use std::path::Path; - -// How many times should we (re)try finding an unused random name? It should be -// enough that an attacker will run out of luck before we run out of patience. -const NUM_RETRIES: u32 = 1 << 31; - -#[cfg(any(unix, target_os = "redox"))] -fn create_dir>(path: P) -> IOResult<()> { - use std::fs::DirBuilder; - use std::os::unix::fs::DirBuilderExt; - - DirBuilder::new().mode(0o700).create(path) -} - -#[cfg(windows)] -fn create_dir>(path: P) -> IOResult<()> { - ::std::fs::create_dir(path) -} - -pub fn new_in>( - tmpdir: P, - prefix: &str, - rand: usize, - suffix: &str, -) -> IOResult { - let mut rng = thread_rng(); - for _ in 0..NUM_RETRIES { - let rand_chars: String = rng.sample_iter(&Alphanumeric).take(rand).collect(); - let leaf = format!("{}{}{}", prefix, rand_chars, suffix); - let path = tmpdir.as_ref().join(&leaf); - match create_dir(&path) { - Ok(_) => return Ok(path.to_string_lossy().into_owned()), - Err(ref e) if e.kind() == ErrorKind::AlreadyExists => {} - Err(e) => return Err(e), - } - } - - Err(Error::new( - ErrorKind::AlreadyExists, - "too many temporary directories already exist", - )) -} From 263b1225404c9e1bef299433093df761a13b1cb3 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 28 May 2021 17:48:48 +0200 Subject: [PATCH 0699/1135] maint: use the matches! macro when possible --- src/uu/csplit/src/csplit.rs | 7 +------ src/uu/expr/src/tokens.rs | 7 +------ src/uu/fmt/src/parasplit.rs | 16 ++++------------ src/uu/hashsum/src/hashsum.rs | 25 +++++++++++++++++-------- src/uu/od/src/parse_formats.rs | 7 +------ src/uu/rm/src/rm.rs | 7 +------ src/uu/sort/src/numeric_str_cmp.rs | 8 ++++---- src/uu/sort/src/sort.rs | 11 +++++------ src/uu/test/src/parser.rs | 8 +------- 9 files changed, 35 insertions(+), 61 deletions(-) diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index 9d2f81f43..f67f4958f 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -124,12 +124,7 @@ where // split the file based on patterns for pattern in patterns.into_iter() { let pattern_as_str = pattern.to_string(); - #[allow(clippy::match_like_matches_macro)] - let is_skip = if let patterns::Pattern::SkipToMatch(_, _, _) = pattern { - true - } else { - false - }; + let is_skip = matches!(pattern, patterns::Pattern::SkipToMatch(_, _, _)); match pattern { patterns::Pattern::UpToLine(n, ex) => { let mut up_to_line = n; diff --git a/src/uu/expr/src/tokens.rs b/src/uu/expr/src/tokens.rs index b65b0d482..6056e4ba1 100644 --- a/src/uu/expr/src/tokens.rs +++ b/src/uu/expr/src/tokens.rs @@ -63,12 +63,7 @@ impl Token { } } fn is_a_close_paren(&self) -> bool { - #[allow(clippy::match_like_matches_macro)] - // `matches!(...)` macro not stabilized until rust v1.42 - match *self { - Token::ParClose => true, - _ => false, - } + matches!(*self, Token::ParClose) } } diff --git a/src/uu/fmt/src/parasplit.rs b/src/uu/fmt/src/parasplit.rs index 950b3f66d..71b5f62ec 100644 --- a/src/uu/fmt/src/parasplit.rs +++ b/src/uu/fmt/src/parasplit.rs @@ -264,12 +264,9 @@ impl<'a> ParagraphStream<'a> { return false; } - #[allow(clippy::match_like_matches_macro)] - // `matches!(...)` macro not stabilized until rust v1.42 - l_slice[..colon_posn].chars().all(|x| match x as usize { - y if !(33..=126).contains(&y) => false, - _ => true, - }) + l_slice[..colon_posn] + .chars() + .all(|x| !matches!(x as usize, y if !(33..=126).contains(&y))) } } } @@ -541,12 +538,7 @@ impl<'a> WordSplit<'a> { } fn is_punctuation(c: char) -> bool { - #[allow(clippy::match_like_matches_macro)] - // `matches!(...)` macro not stabilized until rust v1.42 - match c { - '!' | '.' | '?' => true, - _ => false, - } + matches!(c, '!' | '.' | '?') } } diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index 2e31ddd25..b1ba3c217 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -51,14 +51,23 @@ struct Options { } fn is_custom_binary(program: &str) -> bool { - #[allow(clippy::match_like_matches_macro)] - // `matches!(...)` macro not stabilized until rust v1.42 - match program { - "md5sum" | "sha1sum" | "sha224sum" | "sha256sum" | "sha384sum" | "sha512sum" - | "sha3sum" | "sha3-224sum" | "sha3-256sum" | "sha3-384sum" | "sha3-512sum" - | "shake128sum" | "shake256sum" | "b2sum" => true, - _ => false, - } + matches!( + program, + "md5sum" + | "sha1sum" + | "sha224sum" + | "sha256sum" + | "sha384sum" + | "sha512sum" + | "sha3sum" + | "sha3-224sum" + | "sha3-256sum" + | "sha3-384sum" + | "sha3-512sum" + | "shake128sum" + | "shake256sum" + | "b2sum" + ) } #[allow(clippy::cognitive_complexity)] diff --git a/src/uu/od/src/parse_formats.rs b/src/uu/od/src/parse_formats.rs index 8b32d648c..abf05ea18 100644 --- a/src/uu/od/src/parse_formats.rs +++ b/src/uu/od/src/parse_formats.rs @@ -85,12 +85,7 @@ fn od_format_type(type_char: FormatType, byte_size: u8) -> Option bool { - #[allow(clippy::match_like_matches_macro)] - // `matches!(...)` macro not stabilized until rust v1.42 - match ch { - 'A' | 'j' | 'N' | 'S' | 'w' => true, - _ => false, - } + matches!(ch, 'A' | 'j' | 'N' | 'S' | 'w') } /// Parses format flags from command line diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 94626b4e7..8010988bb 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -386,13 +386,8 @@ fn prompt(msg: &str) -> bool { let stdin = stdin(); let mut stdin = stdin.lock(); - #[allow(clippy::match_like_matches_macro)] - // `matches!(...)` macro not stabilized until rust v1.42 match stdin.read_until(b'\n', &mut buf) { - Ok(x) if x > 0 => match buf[0] { - b'y' | b'Y' => true, - _ => false, - }, + Ok(x) if x > 0 => matches!(buf[0], b'y' | b'Y'), _ => false, } } diff --git a/src/uu/sort/src/numeric_str_cmp.rs b/src/uu/sort/src/numeric_str_cmp.rs index f8666b701..76dc81aeb 100644 --- a/src/uu/sort/src/numeric_str_cmp.rs +++ b/src/uu/sort/src/numeric_str_cmp.rs @@ -68,10 +68,10 @@ impl NumInfo { } first_char = false; - if parse_settings - .thousands_separator - .map_or(false, |c| c == char) - { + if matches!( + parse_settings.thousands_separator, + Some(c) if c == char, + ) { continue; } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 6d79e80fb..cc391af00 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -583,11 +583,10 @@ impl FieldSelector { is_default_selection: from.field == 1 && from.char == 1 && to.is_none() - // TODO: Once our MinRustV is 1.42 or higher, change this to the matches! macro - && match settings.mode { - SortMode::Numeric | SortMode::GeneralNumeric | SortMode::HumanNumeric => false, - _ => true, - }, + && !matches!( + settings.mode, + SortMode::Numeric | SortMode::GeneralNumeric | SortMode::HumanNumeric, + ), needs_tokens: from.field != 1 || from.char == 0 || to.is_some(), from, to, @@ -650,7 +649,7 @@ impl FieldSelector { tokens: Option<&[Field]>, position: &KeyPosition, ) -> Resolution { - if tokens.map_or(false, |fields| fields.len() < position.field) { + if matches!(tokens, Some(tokens) if tokens.len() < position.field) { Resolution::TooHigh } else if position.char == 0 { let end = tokens.unwrap()[position.field - 1].end; diff --git a/src/uu/test/src/parser.rs b/src/uu/test/src/parser.rs index aa44bc5f2..0fcb25bd5 100644 --- a/src/uu/test/src/parser.rs +++ b/src/uu/test/src/parser.rs @@ -121,13 +121,7 @@ impl Parser { /// Test if the next token in the stream is a BOOLOP (-a or -o), without /// removing the token from the stream. fn peek_is_boolop(&mut self) -> bool { - // TODO: change to `matches!(self.peek(), Symbol::BoolOp(_))` once MSRV is 1.42 - // #[allow(clippy::match_like_matches_macro)] // needs MSRV 1.43 - if let Symbol::BoolOp(_) = self.peek() { - true - } else { - false - } + matches!(self.peek(), Symbol::BoolOp(_)) } /// Parse an expression. From 59a42f1254a1c8f6f328f4b1ec9f6b4456950ff8 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 28 May 2021 17:49:11 +0200 Subject: [PATCH 0700/1135] maint: format recent changes --- src/uu/mktemp/src/mktemp.rs | 15 ++++----------- src/uu/sort/src/ext_sort.rs | 7 ++++++- src/uu/stdbuf/src/stdbuf.rs | 3 +-- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index d66dd3d57..f6c244bf2 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -210,21 +210,14 @@ pub fn dry_exec(mut tmpdir: PathBuf, prefix: &str, rand: usize, suffix: &str) -> 0 } -fn exec( - dir: PathBuf, - prefix: &str, - rand: usize, - suffix: &str, - make_dir: bool, - quiet: bool, -) -> i32 { +fn exec(dir: PathBuf, prefix: &str, rand: usize, suffix: &str, make_dir: bool, quiet: bool) -> i32 { let res = if make_dir { let tmpdir = Builder::new() .prefix(prefix) .rand_bytes(rand) .suffix(suffix) .tempdir_in(&dir); - + // `into_path` consumes the TempDir without removing it tmpdir.map(|d| d.into_path().to_string_lossy().to_string()) } else { @@ -233,7 +226,7 @@ fn exec( .rand_bytes(rand) .suffix(suffix) .tempfile_in(&dir); - + match tmpfile { Ok(f) => { // `keep` ensures that the file is not deleted @@ -245,7 +238,7 @@ fn exec( } } } - Err(x) => Err(x) + Err(x) => Err(x), } }; diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs index 23a55aad0..9b1845efa 100644 --- a/src/uu/sort/src/ext_sort.rs +++ b/src/uu/sort/src/ext_sort.rs @@ -34,7 +34,12 @@ const MIN_BUFFER_SIZE: usize = 8_000; /// Sort files by using auxiliary files for storing intermediate chunks (if needed), and output the result. pub fn ext_sort(files: &mut impl Iterator>, settings: &GlobalSettings) { - let tmp_dir = crash_if_err!(1, tempfile::Builder::new().prefix("uutils_sort").tempdir_in(&settings.tmp_dir)); + let tmp_dir = crash_if_err!( + 1, + tempfile::Builder::new() + .prefix("uutils_sort") + .tempdir_in(&settings.tmp_dir) + ); let (sorted_sender, sorted_receiver) = std::sync::mpsc::sync_channel(1); let (recycled_sender, recycled_receiver) = std::sync::mpsc::sync_channel(1); thread::spawn({ diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 485b3c70e..134247060 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -25,8 +25,7 @@ static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Run COMMAND, with modified buffering operations for its standard streams.\n\n\ Mandatory arguments to long options are mandatory for short options too."; -static LONG_HELP: &str = - "If MODE is 'L' the corresponding stream will be line buffered.\n\ +static LONG_HELP: &str = "If MODE is 'L' the corresponding stream will be line buffered.\n\ This option is invalid with standard input.\n\n\ If MODE is '0' the corresponding stream will be unbuffered.\n\n\ Otherwise MODE is a number which may be followed by one of the following:\n\n\ From a9e0208ee21f35e124ad089e240b933a68b248fb Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 28 May 2021 17:49:28 +0200 Subject: [PATCH 0701/1135] maint: remove obsolete attributes --- src/uucore_procs/src/lib.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/uucore_procs/src/lib.rs b/src/uucore_procs/src/lib.rs index 10368a5bd..e0d247c3f 100644 --- a/src/uucore_procs/src/lib.rs +++ b/src/uucore_procs/src/lib.rs @@ -1,6 +1,3 @@ -#![allow(dead_code)] // work-around for GH:rust-lang/rust#62127; maint: can be removed when MinSRV >= v1.38.0 -#![allow(unused_macros)] // work-around for GH:rust-lang/rust#62127; maint: can be removed when MinSRV >= v1.38.0 - // Copyright (C) ~ Roy Ivy III ; MIT license extern crate proc_macro; @@ -44,7 +41,6 @@ impl syn::parse::Parse for Tokens { } #[proc_macro] -#[cfg(not(test))] // work-around for GH:rust-lang/rust#62127; maint: can be removed when MinSRV >= v1.38.0 pub fn main(stream: proc_macro::TokenStream) -> proc_macro::TokenStream { let Tokens { expr } = syn::parse_macro_input!(stream as Tokens); proc_dbg!(&expr); From 6a9ffee54814b54b5ff367e53f4569b0b70fdded Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Fri, 28 May 2021 18:28:00 +0300 Subject: [PATCH 0702/1135] Moved factor to use clap Issue: https://github.com/uutils/coreutils/issues/2121 --- Cargo.lock | 1 + src/uu/factor/Cargo.toml | 1 + src/uu/factor/src/cli.rs | 36 ++++++++++++++++++++---------------- tests/by-util/test_factor.rs | 12 ++++++++++++ 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 461ce5487..ef22c052d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2054,6 +2054,7 @@ dependencies = [ name = "uu_factor" version = "0.0.6" dependencies = [ + "clap", "coz", "num-traits", "paste", diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index eb34519f1..eb977760f 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -21,6 +21,7 @@ rand = { version = "0.7", features = ["small_rng"] } smallvec = { version = "0.6.14, < 1.0" } uucore = { version = ">=0.0.8", package = "uucore", path = "../../uucore" } uucore_procs = { version = ">=0.0.5", package = "uucore_procs", path = "../../uucore_procs" } +clap = "2.33" [dev-dependencies] paste = "0.1.18" diff --git a/src/uu/factor/src/cli.rs b/src/uu/factor/src/cli.rs index ee4c8a4c4..69a368479 100644 --- a/src/uu/factor/src/cli.rs +++ b/src/uu/factor/src/cli.rs @@ -13,18 +13,21 @@ use std::error::Error; use std::io::{self, stdin, stdout, BufRead, Write}; mod factor; +use clap::{App, Arg}; pub use factor::*; -use uucore::InvalidEncodingHandling; mod miller_rabin; pub mod numeric; mod rho; pub mod table; -static SYNTAX: &str = "[OPTION] [NUMBER]..."; -static SUMMARY: &str = "Print the prime factors of the given number(s). - If none are specified, read from standard input."; -static LONG_HELP: &str = ""; +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static SUMMARY: &str = "Print the prime factors of the given NUMBER(s). +If none are specified, read from standard input."; + +mod options { + pub static NUMBER: &str = "NUMBER"; +} fn print_factors_str(num_str: &str, w: &mut impl io::Write) -> Result<(), Box> { num_str @@ -34,14 +37,21 @@ fn print_factors_str(num_str: &str, w: &mut impl io::Write) -> Result<(), Box i32 { - let matches = app!(SYNTAX, SUMMARY, LONG_HELP).parse( - args.collect_str(InvalidEncodingHandling::Ignore) - .accept_any(), - ); + let matches = App::new(executable!()) + .version(VERSION) + .about(SUMMARY) + .arg(Arg::with_name(options::NUMBER).multiple(true)) + .get_matches_from(args); let stdout = stdout(); let mut w = io::BufWriter::new(stdout.lock()); - if matches.free.is_empty() { + if let Some(values) = matches.values_of(options::NUMBER) { + for number in values { + if let Err(e) = print_factors_str(number, &mut w) { + show_warning!("{}: {}", number, e); + } + } + } else { let stdin = stdin(); for line in stdin.lock().lines() { @@ -51,12 +61,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } } - } else { - for number in &matches.free { - if let Err(e) = print_factors_str(number, &mut w) { - show_warning!("{}: {}", number, e); - } - } } if let Err(e) = w.flush() { diff --git a/tests/by-util/test_factor.rs b/tests/by-util/test_factor.rs index af2ff4ddb..7b856d1b8 100644 --- a/tests/by-util/test_factor.rs +++ b/tests/by-util/test_factor.rs @@ -39,6 +39,18 @@ fn test_first_100000_integers() { assert_eq!(hash_check, "4ed2d8403934fa1c76fe4b84c5d4b8850299c359"); } +#[test] +fn test_cli_args() { + // Make sure that factor works with CLI arguments as well. + new_ucmd!().args(&["3"]).succeeds().stdout_contains("3: 3"); + + new_ucmd!() + .args(&["3", "6"]) + .succeeds() + .stdout_contains("3: 3") + .stdout_contains("6: 2 3"); +} + #[test] fn test_random() { use conv::prelude::*; From b5cbd506bcd8516ea790ffd9e01252f8c02b6f15 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 28 May 2021 18:58:06 +0200 Subject: [PATCH 0703/1135] maint: remove trailing commas from matches Trailing commas are only supported starting from 1.48. --- src/uu/sort/src/numeric_str_cmp.rs | 2 +- src/uu/sort/src/sort.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/sort/src/numeric_str_cmp.rs b/src/uu/sort/src/numeric_str_cmp.rs index 76dc81aeb..2935f55e8 100644 --- a/src/uu/sort/src/numeric_str_cmp.rs +++ b/src/uu/sort/src/numeric_str_cmp.rs @@ -70,7 +70,7 @@ impl NumInfo { if matches!( parse_settings.thousands_separator, - Some(c) if c == char, + Some(c) if c == char ) { continue; } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index cc391af00..001e59c18 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -585,7 +585,7 @@ impl FieldSelector { && to.is_none() && !matches!( settings.mode, - SortMode::Numeric | SortMode::GeneralNumeric | SortMode::HumanNumeric, + SortMode::Numeric | SortMode::GeneralNumeric | SortMode::HumanNumeric ), needs_tokens: from.field != 1 || from.char == 0 || to.is_some(), from, From 0a2f74fd8e4035d14b23b204bbe7c25a87296c37 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 28 May 2021 19:43:03 +0200 Subject: [PATCH 0704/1135] More: update crossterm dependency --- src/uu/more/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index 613dcc37b..9b1a3d7b6 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -18,7 +18,7 @@ path = "src/more.rs" clap = "2.33" uucore = { version = ">=0.0.7", package = "uucore", path = "../../uucore" } uucore_procs = { version = ">=0.0.5", package = "uucore_procs", path = "../../uucore_procs" } -crossterm = "~0.17" +crossterm = ">=0.19" atty = "0.2.14" [target.'cfg(target_os = "redox")'.dependencies] From 80b9bfdd18a5b3b26b586fc7bfa5ae6d57fbe00b Mon Sep 17 00:00:00 2001 From: Jack O'Connor Date: Fri, 28 May 2021 14:08:46 -0400 Subject: [PATCH 0705/1135] switch from blake2-rfc to blake2b_simd --- Cargo.lock | 24 ++++++++++++++---------- src/uu/hashsum/Cargo.toml | 2 +- src/uu/hashsum/src/digest.rs | 9 ++++----- src/uu/hashsum/src/hashsum.rs | 9 ++++++--- 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5e1470c88..19d44e476 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -50,13 +50,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6945cc5422176fc5e602e590c2878d2c2acd9a4fe20a4baa7c28022521698ec6" [[package]] -name = "arrayvec" -version = "0.4.12" +name = "arrayref" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -dependencies = [ - "nodrop", -] +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "atty" @@ -106,11 +109,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] -name = "blake2-rfc" -version = "0.2.18" +name = "blake2b_simd" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" dependencies = [ + "arrayref", "arrayvec", "constant_time_eq", ] @@ -2098,7 +2102,7 @@ dependencies = [ name = "uu_hashsum" version = "0.0.6" dependencies = [ - "blake2-rfc", + "blake2b_simd", "clap", "digest", "hex", diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index 04a22cac7..11388ebf8 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -25,7 +25,7 @@ regex-syntax = "0.6.7" sha1 = "0.6.0" sha2 = "0.6.0" sha3 = "0.6.0" -blake2-rfc = "0.2.18" +blake2b_simd = "0.5.11" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/hashsum/src/digest.rs b/src/uu/hashsum/src/digest.rs index 218de0a36..25bc7f4c3 100644 --- a/src/uu/hashsum/src/digest.rs +++ b/src/uu/hashsum/src/digest.rs @@ -1,4 +1,3 @@ -extern crate blake2_rfc; extern crate digest; extern crate md5; extern crate sha1; @@ -49,9 +48,9 @@ impl Digest for md5::Context { } } -impl Digest for blake2_rfc::blake2b::Blake2b { +impl Digest for blake2b_simd::State { fn new() -> Self { - blake2_rfc::blake2b::Blake2b::new(64) + Self::new() } fn input(&mut self, input: &[u8]) { @@ -59,12 +58,12 @@ impl Digest for blake2_rfc::blake2b::Blake2b { } fn result(&mut self, out: &mut [u8]) { - let hash_result = &self.clone().finalize(); + let hash_result = &self.finalize(); out.copy_from_slice(&hash_result.as_bytes()); } fn reset(&mut self) { - *self = blake2_rfc::blake2b::Blake2b::new(64); + *self = Self::new(); } fn output_bits(&self) -> usize { diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index 2e31ddd25..e0014bb6a 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -19,7 +19,6 @@ mod digest; use self::digest::Digest; -use blake2_rfc::blake2b::Blake2b; use clap::{App, Arg, ArgMatches}; use hex::ToHex; use md5::Context as Md5; @@ -76,7 +75,11 @@ fn detect_algo<'a>( "sha256sum" => ("SHA256", Box::new(Sha256::new()) as Box, 256), "sha384sum" => ("SHA384", Box::new(Sha384::new()) as Box, 384), "sha512sum" => ("SHA512", Box::new(Sha512::new()) as Box, 512), - "b2sum" => ("BLAKE2", Box::new(Blake2b::new(64)) as Box, 512), + "b2sum" => ( + "BLAKE2", + Box::new(blake2b_simd::State::new()) as Box, + 512, + ), "sha3sum" => match matches.value_of("bits") { Some(bits_str) => match (&bits_str).parse::() { Ok(224) => ( @@ -178,7 +181,7 @@ fn detect_algo<'a>( set_or_crash("SHA512", Box::new(Sha512::new()), 512) } if matches.is_present("b2sum") { - set_or_crash("BLAKE2", Box::new(Blake2b::new(64)), 512) + set_or_crash("BLAKE2", Box::new(blake2b_simd::State::new()), 512) } if matches.is_present("sha3") { match matches.value_of("bits") { From 1c2540a61315e005244419791ef2894a63b239bc Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 28 May 2021 21:07:28 +0200 Subject: [PATCH 0706/1135] Add atty to dev-deps for more tests --- Cargo.lock | 44 ++++++++++++++++++++++++++++++-------------- Cargo.toml | 1 + 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fd6f127c6..b5c7d7c4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -547,9 +547,9 @@ dependencies = [ [[package]] name = "crossterm" -version = "0.17.7" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f4919d60f26ae233e14233cc39746c8c8bb8cd7b05840ace83604917b51b6c7" +checksum = "7c36c10130df424b2f3552fcc2ddcd9b28a27b1e54b358b45874f88d1ca6888c" dependencies = [ "bitflags", "crossterm_winapi", @@ -563,9 +563,9 @@ dependencies = [ [[package]] name = "crossterm_winapi" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2265c3f8e080075d9b6417aa72293fc71662f34b4af2612d8d1b074d29510db" +checksum = "0da8964ace4d3e4a044fd027919b2237000b24315a37c916f61809f1ff2140b9" dependencies = [ "winapi 0.3.9", ] @@ -818,6 +818,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" +[[package]] +name = "instant" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "ioctl-sys" version = "0.5.2" @@ -899,9 +908,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.3.4" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb" dependencies = [ "scopeguard", ] @@ -1137,24 +1146,25 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.10.2" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" +checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" dependencies = [ + "instant", "lock_api", "parking_lot_core", ] [[package]] name = "parking_lot_core" -version = "0.7.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" +checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" dependencies = [ - "cfg-if 0.1.10", - "cloudabi", + "cfg-if 1.0.0", + "instant", "libc", - "redox_syscall 0.1.57", + "redox_syscall 0.2.8", "smallvec 1.6.1", "winapi 0.3.9", ] @@ -1697,6 +1707,12 @@ dependencies = [ "maybe-uninit", ] +[[package]] +name = "smallvec" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" + [[package]] name = "socket2" version = "0.3.19" @@ -2169,7 +2185,7 @@ dependencies = [ "paste", "quickcheck", "rand 0.7.3", - "smallvec", + "smallvec 0.6.14", "uucore", "uucore_procs", ] diff --git a/Cargo.toml b/Cargo.toml index cc36199cc..920c0baa2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -347,6 +347,7 @@ time = "0.1" unindent = "0.1" uucore = { version=">=0.0.8", package="uucore", path="src/uucore", features=["entries"] } walkdir = "2.2" +atty = "0.2.14" [target.'cfg(unix)'.dev-dependencies] rust-users = { version="0.10", package="users" } From 0c502f587bf8db66b07fe614dbaca1bd3bf71a97 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 28 May 2021 17:02:25 +0200 Subject: [PATCH 0707/1135] uucore: add new module "parse_size" This adds a function to parse size strings, e.g. "2KiB" or "3MB". It is based on similar functions used by head/tail/truncate, etc. --- src/uucore/src/lib/lib.rs | 7 +- src/uucore/src/lib/parser.rs | 1 + src/uucore/src/lib/parser/parse_size.rs | 242 ++++++++++++++++++++++++ 3 files changed, 248 insertions(+), 2 deletions(-) create mode 100644 src/uucore/src/lib/parser.rs create mode 100644 src/uucore/src/lib/parser/parse_size.rs diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index c17f14516..a60af57fa 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -19,10 +19,10 @@ pub extern crate winapi; //## internal modules -mod macros; // crate macros (macro_rules-type; exported to `crate::...`) - mod features; // feature-gated code modules +mod macros; // crate macros (macro_rules-type; exported to `crate::...`) mod mods; // core cross-platform modules +mod parser; // string parsing moduls // * cross-platform modules pub use crate::mods::backup_control; @@ -31,6 +31,9 @@ pub use crate::mods::os; pub use crate::mods::panic; pub use crate::mods::ranges; +// * string parsing modules +pub use crate::parser::parse_size; + // * feature-gated modules #[cfg(feature = "encoding")] pub use crate::features::encoding; diff --git a/src/uucore/src/lib/parser.rs b/src/uucore/src/lib/parser.rs new file mode 100644 index 000000000..21adefa1a --- /dev/null +++ b/src/uucore/src/lib/parser.rs @@ -0,0 +1 @@ +pub mod parse_size; diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs new file mode 100644 index 000000000..a7260306c --- /dev/null +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -0,0 +1,242 @@ +use std::convert::TryFrom; +use std::error::Error; +use std::fmt; + +/// Parse a size string into a number of bytes. +/// +/// A size string comprises an integer and an optional unit. The unit +/// may be K, M, G, T, P, E, Z or Y (powers of 1024), or KB, MB, +/// etc. (powers of 1000), or b which is 512. +/// Binary prefixes can be used, too: KiB=K, MiB=M, and so on. +/// +/// # Errors +/// +/// Will return `ParseSizeError` if it’s not possible to parse this +/// string into a number, e.g. if the string does not begin with a +/// numeral, or if the unit is not one of the supported units described +/// in the preceding section. +/// +/// # Examples +/// +/// ```rust +/// use uucore::parse_size::parse_size; +/// assert_eq!(Ok(123), parse_size("123")); +/// assert_eq!(Ok(9 * 1000), parse_size("9kB")); // kB is 1000 +/// assert_eq!(Ok(2 * 1024), parse_size("2K")); // K is 1024 +/// ``` +pub fn parse_size(size: &str) -> Result { + if size.is_empty() { + return Err(ParseSizeError::parse_failure(size)); + } + // Get the numeric part of the size argument. For example, if the + // argument is "123K", then the numeric part is "123". + let numeric_string: String = size.chars().take_while(|c| c.is_digit(10)).collect(); + let number: usize = if !numeric_string.is_empty() { + match numeric_string.parse() { + Ok(n) => n, + Err(_) => return Err(ParseSizeError::parse_failure(size)), + } + } else { + 1 + }; + + // Get the alphabetic units part of the size argument and compute + // the factor it represents. For example, if the argument is "123K", + // then the unit part is "K" and the factor is 1024. This may be the + // empty string, in which case, the factor is 1. + let unit = &size[numeric_string.len()..]; + let (base, exponent): (u128, u32) = match unit { + "" => (1, 0), + "b" => (512, 1), // (`head` and `tail` use "b") + "KiB" | "K" | "k" => (1024, 1), + "MiB" | "M" | "m" => (1024, 2), + "GiB" | "G" | "g" => (1024, 3), + "TiB" | "T" | "t" => (1024, 4), + "PiB" | "P" | "p" => (1024, 5), + "EiB" | "E" | "e" => (1024, 6), + "ZiB" | "Z" | "z" => (1024, 7), + "YiB" | "Y" | "y" => (1024, 8), + "KB" | "kB" => (1000, 1), + "MB" | "mB" => (1000, 2), + "GB" | "gB" => (1000, 3), + "TB" | "tB" => (1000, 4), + "PB" | "pB" => (1000, 5), + "EB" | "eB" => (1000, 6), + "ZB" | "zB" => (1000, 7), + "YB" | "yB" => (1000, 8), + _ => return Err(ParseSizeError::parse_failure(size)), + }; + let factor = match usize::try_from(base.pow(exponent)) { + Ok(n) => n, + Err(_) => return Err(ParseSizeError::size_too_big(size)), + }; + match number.checked_mul(factor) { + Some(n) => Ok(n), + None => Err(ParseSizeError::size_too_big(size)), + } +} + +#[derive(Debug, PartialEq, Eq)] +pub enum ParseSizeError { + ParseFailure(String), // Syntax + SizeTooBig(String), // Overflow +} + +impl Error for ParseSizeError { + fn description(&self) -> &str { + match *self { + ParseSizeError::ParseFailure(ref s) => &*s, + ParseSizeError::SizeTooBig(ref s) => &*s, + } + } +} + +impl fmt::Display for ParseSizeError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + let s = match self { + ParseSizeError::ParseFailure(s) => s, + ParseSizeError::SizeTooBig(s) => s, + }; + write!(f, "{}", s) + } +} + +impl ParseSizeError { + fn parse_failure(s: &str) -> ParseSizeError { + // has to be handled in the respective uutils because strings differ, e.g. + // truncate: Invalid number: ‘fb’ + // tail: invalid number of bytes: ‘fb’ + ParseSizeError::ParseFailure(format!("‘{}’", s)) + } + + fn size_too_big(s: &str) -> ParseSizeError { + // has to be handled in the respective uutils because strings differ, e.g. + // truncate: Invalid number: ‘1Y’: Value too large to be stored in data type + // tail: invalid number of bytes: ‘1Y’: Value too large to be stored in data type + ParseSizeError::SizeTooBig(format!( + "‘{}’: Value too large to be stored in data type", + s + )) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn variant_eq(a: &ParseSizeError, b: &ParseSizeError) -> bool { + std::mem::discriminant(a) == std::mem::discriminant(b) + } + + #[test] + fn all_suffixes() { + // Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000). + // Binary prefixes can be used, too: KiB=K, MiB=M, and so on. + let suffixes = [ + ('K', 1u32), + ('M', 2u32), + ('G', 3u32), + ('T', 4u32), + ('P', 5u32), + ('E', 6u32), + #[cfg(target_pointer_width = "128")] + ('Z', 7u32), // ParseSizeError::SizeTooBig on x64 + #[cfg(target_pointer_width = "128")] + ('Y', 8u32), // ParseSizeError::SizeTooBig on x64 + ]; + + for &(c, exp) in &suffixes { + let s = format!("2{}B", c); // KB + assert_eq!(Ok((2 * (1000 as u128).pow(exp)) as usize), parse_size(&s)); + let s = format!("2{}", c); // K + assert_eq!(Ok((2 * (1024 as u128).pow(exp)) as usize), parse_size(&s)); + let s = format!("2{}iB", c); // KiB + assert_eq!(Ok((2 * (1024 as u128).pow(exp)) as usize), parse_size(&s)); + + // suffix only + let s = format!("{}B", c); // KB + assert_eq!(Ok(((1000 as u128).pow(exp)) as usize), parse_size(&s)); + let s = format!("{}", c); // K + assert_eq!(Ok(((1024 as u128).pow(exp)) as usize), parse_size(&s)); + let s = format!("{}iB", c); // KiB + assert_eq!(Ok(((1024 as u128).pow(exp)) as usize), parse_size(&s)); + } + } + + #[test] + #[cfg(not(target_pointer_width = "128"))] + fn overflow_x64() { + assert!(parse_size("10000000000000000000000").is_err()); + assert!(parse_size("1000000000T").is_err()); + assert!(parse_size("100000P").is_err()); + assert!(parse_size("100E").is_err()); + assert!(parse_size("1Z").is_err()); + assert!(parse_size("1Y").is_err()); + + assert!(variant_eq( + &parse_size("1Z").unwrap_err(), + &ParseSizeError::SizeTooBig(String::new()) + )); + + assert_eq!( + ParseSizeError::SizeTooBig( + "‘1Y’: Value too large to be stored in data type".to_string() + ), + parse_size("1Y").unwrap_err() + ); + } + + #[test] + #[cfg(target_pointer_width = "32")] + fn overflow_x32() { + assert!(variant_eq( + &parse_size("1T").unwrap_err(), + &ParseSizeError::SizeTooBig(String::new()) + )); + assert!(variant_eq( + &parse_size("1000G").unwrap_err(), + &ParseSizeError::SizeTooBig(String::new()) + )); + } + + #[test] + fn invalid_syntax() { + let test_strings = ["328hdsf3290", "5MiB nonsense", "5mib", "biB", "-", ""]; + for &test_string in &test_strings { + assert_eq!( + parse_size(test_string).unwrap_err(), + ParseSizeError::ParseFailure(format!("‘{}’", test_string)) + ); + } + } + + #[test] + fn b_suffix() { + assert_eq!(Ok(3 * 512), parse_size("3b")); // b is 512 + } + + #[test] + fn no_suffix() { + assert_eq!(Ok(1234), parse_size("1234")); + assert_eq!(Ok(0), parse_size("0")); + } + + #[test] + fn kilobytes_suffix() { + assert_eq!(Ok(123 * 1000), parse_size("123KB")); // KB is 1000 + assert_eq!(Ok(9 * 1000), parse_size("9kB")); // kB is 1000 + assert_eq!(Ok(2 * 1024), parse_size("2K")); // K is 1024 + assert_eq!(Ok(0), parse_size("0K")); + assert_eq!(Ok(0), parse_size("0KB")); + assert_eq!(Ok(1000), parse_size("KB")); + assert_eq!(Ok(1024), parse_size("K")); + } + + #[test] + fn megabytes_suffix() { + assert_eq!(Ok(123 * 1024 * 1024), parse_size("123M")); + assert_eq!(Ok(123 * 1000 * 1000), parse_size("123MB")); + assert_eq!(Ok(1024 * 1024), parse_size("M")); + assert_eq!(Ok(1000 * 1000), parse_size("MB")); + } +} From b1b3475e11ff4ef947dfbb8740c7e405ff7776b9 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 28 May 2021 19:57:50 +0200 Subject: [PATCH 0708/1135] truncate: use "parse_size" from uucore --- src/uu/truncate/src/truncate.rs | 101 ++---------------------- src/uucore/src/lib/parser/parse_size.rs | 5 ++ 2 files changed, 13 insertions(+), 93 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 03b18723c..86a0c9ffc 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -11,9 +11,11 @@ extern crate uucore; use clap::{App, Arg}; +use std::convert::TryFrom; use std::fs::{metadata, OpenOptions}; use std::io::ErrorKind; use std::path::Path; +use uucore::parse_size::parse_size; #[derive(Eq, PartialEq)] enum TruncateMode { @@ -159,14 +161,14 @@ fn truncate( }; let num_bytes = match parse_size(size_string) { Ok(b) => b, - Err(_) => crash!(1, "Invalid number: ‘{}’", size_string), + Err(e) => crash!(1, "Invalid number: {}", e.to_string()), }; (num_bytes, mode) } None => (0, TruncateMode::Reference), }; - let refsize = match reference { + let refsize: usize = match reference { Some(ref rfilename) => { match mode { // Only Some modes work with a reference @@ -176,7 +178,7 @@ fn truncate( _ => crash!(1, "you must specify a relative ‘--size’ with ‘--reference’"), }; match metadata(rfilename) { - Ok(meta) => meta.len(), + Ok(meta) => usize::try_from(meta.len()).unwrap(), Err(f) => match f.kind() { ErrorKind::NotFound => { crash!(1, "cannot stat '{}': No such file or directory", rfilename) @@ -199,14 +201,14 @@ fn truncate( let fsize = match reference { Some(_) => refsize, None => match metadata(filename) { - Ok(meta) => meta.len(), + Ok(meta) => usize::try_from(meta.len()).unwrap(), Err(f) => { show_warning!("{}", f.to_string()); continue; } }, }; - let tsize: u64 = match mode { + let tsize: usize = match mode { TruncateMode::Absolute => modsize, TruncateMode::Reference => fsize, TruncateMode::Extend => fsize + modsize, @@ -216,7 +218,7 @@ fn truncate( TruncateMode::RoundDown => fsize - fsize % modsize, TruncateMode::RoundUp => fsize + fsize % modsize, }; - match file.set_len(tsize) { + match file.set_len(u64::try_from(tsize).unwrap()) { Ok(_) => {} Err(f) => crash!(1, "{}", f.to_string()), }; @@ -225,90 +227,3 @@ fn truncate( } } } - -/// Parse a size string into a number of bytes. -/// -/// A size string comprises an integer and an optional unit. The unit -/// may be K, M, G, T, P, E, Z, or Y (powers of 1024) or KB, MB, -/// etc. (powers of 1000). -/// -/// # Errors -/// -/// This function returns an error if the string does not begin with a -/// numeral, or if the unit is not one of the supported units described -/// in the preceding section. -/// -/// # Examples -/// -/// ```rust,ignore -/// assert_eq!(parse_size("123").unwrap(), 123); -/// assert_eq!(parse_size("123K").unwrap(), 123 * 1024); -/// assert_eq!(parse_size("123KB").unwrap(), 123 * 1000); -/// ``` -fn parse_size(size: &str) -> Result { - // Get the numeric part of the size argument. For example, if the - // argument is "123K", then the numeric part is "123". - let numeric_string: String = size.chars().take_while(|c| c.is_digit(10)).collect(); - let number: u64 = match numeric_string.parse() { - Ok(n) => n, - Err(_) => return Err(()), - }; - - // Get the alphabetic units part of the size argument and compute - // the factor it represents. For example, if the argument is "123K", - // then the unit part is "K" and the factor is 1024. This may be the - // empty string, in which case, the factor is 1. - let n = numeric_string.len(); - let (base, exponent): (u64, u32) = match &size[n..] { - "" => (1, 0), - "K" | "k" => (1024, 1), - "M" | "m" => (1024, 2), - "G" | "g" => (1024, 3), - "T" | "t" => (1024, 4), - "P" | "p" => (1024, 5), - "E" | "e" => (1024, 6), - "Z" | "z" => (1024, 7), - "Y" | "y" => (1024, 8), - "KB" | "kB" => (1000, 1), - "MB" | "mB" => (1000, 2), - "GB" | "gB" => (1000, 3), - "TB" | "tB" => (1000, 4), - "PB" | "pB" => (1000, 5), - "EB" | "eB" => (1000, 6), - "ZB" | "zB" => (1000, 7), - "YB" | "yB" => (1000, 8), - _ => return Err(()), - }; - let factor = base.pow(exponent); - Ok(number * factor) -} - -#[cfg(test)] -mod tests { - use crate::parse_size; - - #[test] - fn test_parse_size_zero() { - assert_eq!(parse_size("0").unwrap(), 0); - assert_eq!(parse_size("0K").unwrap(), 0); - assert_eq!(parse_size("0KB").unwrap(), 0); - } - - #[test] - fn test_parse_size_without_factor() { - assert_eq!(parse_size("123").unwrap(), 123); - } - - #[test] - fn test_parse_size_kilobytes() { - assert_eq!(parse_size("123K").unwrap(), 123 * 1024); - assert_eq!(parse_size("123KB").unwrap(), 123 * 1000); - } - - #[test] - fn test_parse_size_megabytes() { - assert_eq!(parse_size("123").unwrap(), 123); - assert_eq!(parse_size("123M").unwrap(), 123 * 1024 * 1024); - assert_eq!(parse_size("123MB").unwrap(), 123 * 1000 * 1000); - } -} diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index a7260306c..e8ede8cad 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -1,3 +1,8 @@ +// * This file is part of the uutils coreutils package. +// * +// * For the full copyright and license information, please view the LICENSE +// * file that was distributed with this source code. + use std::convert::TryFrom; use std::error::Error; use std::fmt; From 0bf14da490c49bacfa078d8acfee14def48ed701 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 28 May 2021 21:12:03 +0200 Subject: [PATCH 0709/1135] tail: use "parse_size" from uucore --- src/uu/tail/src/tail.rs | 124 +++++-------------------------------- tests/by-util/test_tail.rs | 36 ----------- 2 files changed, 16 insertions(+), 144 deletions(-) diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 15a819d35..a4634714c 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -21,13 +21,13 @@ use chunks::ReverseChunks; use clap::{App, Arg}; use std::collections::VecDeque; -use std::error::Error; use std::fmt; use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, Read, Seek, SeekFrom, Write}; use std::path::Path; use std::thread::sleep; use std::time::Duration; +use uucore::parse_size::parse_size; use uucore::ringbuffer::RingBuffer; pub mod options { @@ -47,8 +47,8 @@ pub mod options { static ARG_FILES: &str = "files"; enum FilterMode { - Bytes(u64), - Lines(u64, u8), // (number of lines, delimiter) + Bytes(usize), + Lines(usize, u8), // (number of lines, delimiter) } struct Settings { @@ -174,31 +174,31 @@ pub fn uumain(args: impl uucore::Args) -> i32 { match matches.value_of(options::LINES) { Some(n) => { let mut slice: &str = n; - if slice.chars().next().unwrap_or('_') == '+' { - settings.beginning = true; + let c = slice.chars().next().unwrap_or('_'); + if c == '+' || c == '-' { slice = &slice[1..]; + if c == '+' { + settings.beginning = true; + } } match parse_size(slice) { Ok(m) => settings.mode = FilterMode::Lines(m, b'\n'), - Err(e) => { - show_error!("{}", e.to_string()); - return 1; - } + Err(e) => crash!(1, "invalid number of bytes: {}", e.to_string()), } } None => { if let Some(n) = matches.value_of(options::BYTES) { let mut slice: &str = n; - if slice.chars().next().unwrap_or('_') == '+' { - settings.beginning = true; + let c = slice.chars().next().unwrap_or('_'); + if c == '+' || c == '-' { slice = &slice[1..]; + if c == '+' { + settings.beginning = true; + } } match parse_size(slice) { Ok(m) => settings.mode = FilterMode::Bytes(m), - Err(e) => { - show_error!("{}", e.to_string()); - return 1; - } + Err(e) => crash!(1, "invalid number of bytes: {}", e.to_string()), } } } @@ -264,98 +264,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } -#[derive(Debug, PartialEq, Eq)] -pub enum ParseSizeErr { - ParseFailure(String), - SizeTooBig(String), -} - -impl Error for ParseSizeErr { - fn description(&self) -> &str { - match *self { - ParseSizeErr::ParseFailure(ref s) => &*s, - ParseSizeErr::SizeTooBig(ref s) => &*s, - } - } -} - -impl fmt::Display for ParseSizeErr { - fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - let s = match self { - ParseSizeErr::ParseFailure(s) => s, - ParseSizeErr::SizeTooBig(s) => s, - }; - write!(f, "{}", s) - } -} - -impl ParseSizeErr { - fn parse_failure(s: &str) -> ParseSizeErr { - ParseSizeErr::ParseFailure(format!("invalid size: '{}'", s)) - } - - fn size_too_big(s: &str) -> ParseSizeErr { - ParseSizeErr::SizeTooBig(format!( - "invalid size: '{}': Value too large to be stored in data type", - s - )) - } -} - -pub type ParseSizeResult = Result; - -pub fn parse_size(mut size_slice: &str) -> Result { - let mut base = if size_slice.chars().last().unwrap_or('_') == 'B' { - size_slice = &size_slice[..size_slice.len() - 1]; - 1000u64 - } else { - 1024u64 - }; - - let exponent = if !size_slice.is_empty() { - let mut has_suffix = true; - let exp = match size_slice.chars().last().unwrap_or('_') { - 'K' | 'k' => 1u64, - 'M' => 2u64, - 'G' => 3u64, - 'T' => 4u64, - 'P' => 5u64, - 'E' => 6u64, - 'Z' | 'Y' => { - return Err(ParseSizeErr::size_too_big(size_slice)); - } - 'b' => { - base = 512u64; - 1u64 - } - _ => { - has_suffix = false; - 0u64 - } - }; - if has_suffix { - size_slice = &size_slice[..size_slice.len() - 1]; - } - exp - } else { - 0u64 - }; - - let mut multiplier = 1u64; - for _ in 0u64..exponent { - multiplier *= base; - } - if base == 1000u64 && exponent == 0u64 { - // sole B is not a valid suffix - Err(ParseSizeErr::parse_failure(size_slice)) - } else { - let value: Option = size_slice.parse().ok(); - value - .map(|v| Ok((multiplier as i64 * v.abs()) as u64)) - .unwrap_or_else(|| Err(ParseSizeErr::parse_failure(size_slice))) - } -} - fn follow(readers: &mut [BufReader], filenames: &[String], settings: &Settings) { assert!(settings.follow); let mut last = readers.len() - 1; @@ -469,7 +377,7 @@ fn bounded_tail(file: &mut File, settings: &Settings) { /// If any element of `iter` is an [`Err`], then this function panics. fn unbounded_tail_collect( iter: impl Iterator>, - count: u64, + count: usize, beginning: bool, ) -> VecDeque where diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index f3c9a7b11..27e94a78f 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -1,6 +1,5 @@ extern crate tail; -use self::tail::parse_size; use crate::common::util::*; use std::char::from_digit; use std::io::Write; @@ -236,41 +235,6 @@ fn test_bytes_big() { } } -#[test] -fn test_parse_size() { - // No suffix. - assert_eq!(Ok(1234), parse_size("1234")); - - // kB is 1000 - assert_eq!(Ok(9 * 1000), parse_size("9kB")); - - // K is 1024 - assert_eq!(Ok(2 * 1024), parse_size("2K")); - - let suffixes = [ - ('M', 2u32), - ('G', 3u32), - ('T', 4u32), - ('P', 5u32), - ('E', 6u32), - ]; - - for &(c, exp) in &suffixes { - let s = format!("2{}B", c); - assert_eq!(Ok(2 * (1000 as u64).pow(exp)), parse_size(&s)); - - let s = format!("2{}", c); - assert_eq!(Ok(2 * (1024 as u64).pow(exp)), parse_size(&s)); - } - - // Sizes that are too big. - assert!(parse_size("1Z").is_err()); - assert!(parse_size("1Y").is_err()); - - // Bad number - assert!(parse_size("328hdsf3290").is_err()); -} - #[test] fn test_lines_with_size_suffix() { const FILE: &'static str = "test_lines_with_size_suffix.txt"; From e9656a6c32fb84a4f864dc88b34c7a537462769b Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 28 May 2021 22:38:29 +0200 Subject: [PATCH 0710/1135] sort: make GNU test sort-debug-keys pass (#2269) * sort: disable support for thousand separators In order to be compatible with GNU, we have to disable thousands separators. GNU does not enable them for the C locale, either. Once we add support for locales we can add this feature back. * sort: delete unused fixtures * sort: compare -0 and 0 equal I must have misunderstood this when implementing, but GNU considers -0, 0, and invalid numbers to be equal. * sort: strip blanks before applying the char index * sort: don't crash when key start is after key end * sort: add "no match" for months at the first non-whitespace char We should put the "^ no match for key" indicator at the first non-whitespace character of a field. * sort: improve support for e notation * sort: use maches! macros --- src/uu/sort/src/numeric_str_cmp.rs | 10 +- src/uu/sort/src/sort.rs | 92 ++++++++++++------- tests/by-util/test_sort.rs | 12 +++ .../fixtures/sort/exponents_general.expected | 9 ++ .../sort/exponents_general.expected.debug | 27 ++++++ tests/fixtures/sort/exponents_general.txt | 9 ++ tests/fixtures/sort/keys_blanks.expected | 3 + .../fixtures/sort/keys_blanks.expected.debug | 9 ++ tests/fixtures/sort/keys_blanks.txt | 3 + .../fixtures/sort/keys_negative_size.expected | 1 + .../sort/keys_negative_size.expected.debug | 3 + tests/fixtures/sort/keys_negative_size.txt | 1 + .../mixed_floats_ints_chars_numeric.expected | 4 +- ...d_floats_ints_chars_numeric.expected.debug | 12 +-- ...floats_ints_chars_numeric_reverse.expected | 30 ------ ...ints_chars_numeric_reverse_stable.expected | 30 ------ ...oats_ints_chars_numeric_reverse_stable.txt | 30 ------ ..._floats_ints_chars_numeric_stable.expected | 7 +- ...s_ints_chars_numeric_stable.expected.debug | 14 ++- ...mixed_floats_ints_chars_numeric_stable.txt | 3 + ..._floats_ints_chars_numeric_unique.expected | 3 +- ...s_ints_chars_numeric_unique.expected.debug | 6 +- ...ints_chars_numeric_unique_reverse.expected | 3 +- ...hars_numeric_unique_reverse.expected.debug | 6 +- ...ars_numeric_unique_reverse_stable.expected | 20 ---- ..._ints_chars_numeric_unique_stable.expected | 20 ---- ...loats_ints_chars_numeric_unique_stable.txt | 30 ------ tests/fixtures/sort/month_default.expected | 1 + .../sort/month_default.expected.debug | 3 + tests/fixtures/sort/month_default.txt | 1 + tests/fixtures/sort/month_stable.expected | 1 + .../fixtures/sort/month_stable.expected.debug | 2 + tests/fixtures/sort/month_stable.txt | 1 + .../sort/multiple_decimals_numeric.expected | 4 +- .../multiple_decimals_numeric.expected.debug | 12 +-- 35 files changed, 191 insertions(+), 231 deletions(-) create mode 100644 tests/fixtures/sort/keys_blanks.expected create mode 100644 tests/fixtures/sort/keys_blanks.expected.debug create mode 100644 tests/fixtures/sort/keys_blanks.txt create mode 100644 tests/fixtures/sort/keys_negative_size.expected create mode 100644 tests/fixtures/sort/keys_negative_size.expected.debug create mode 100644 tests/fixtures/sort/keys_negative_size.txt delete mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse.expected delete mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse_stable.expected delete mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse_stable.txt delete mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse_stable.expected delete mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_stable.expected delete mode 100644 tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_stable.txt diff --git a/src/uu/sort/src/numeric_str_cmp.rs b/src/uu/sort/src/numeric_str_cmp.rs index 2935f55e8..03806b0c8 100644 --- a/src/uu/sort/src/numeric_str_cmp.rs +++ b/src/uu/sort/src/numeric_str_cmp.rs @@ -174,7 +174,11 @@ impl NumInfo { pub fn numeric_str_cmp((a, a_info): (&str, &NumInfo), (b, b_info): (&str, &NumInfo)) -> Ordering { // check for a difference in the sign if a_info.sign != b_info.sign { - return a_info.sign.cmp(&b_info.sign); + return if a.is_empty() && b.is_empty() { + Ordering::Equal + } else { + a_info.sign.cmp(&b_info.sign) + }; } // check for a difference in the exponent @@ -419,8 +423,8 @@ mod tests { #[test] fn minus_zero() { // This matches GNU sort behavior. - test_helper("-0", "0", Ordering::Less); - test_helper("-0x", "0", Ordering::Less); + test_helper("-0", "0", Ordering::Equal); + test_helper("-0x", "0", Ordering::Equal); } #[test] fn double_minus() { diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 001e59c18..77be78390 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -99,10 +99,9 @@ static OPT_TMP_DIR: &str = "temporary-directory"; static ARG_FILES: &str = "files"; static DECIMAL_PT: char = '.'; -static THOUSANDS_SEP: char = ','; -static NEGATIVE: char = '-'; -static POSITIVE: char = '+'; +const NEGATIVE: char = '-'; +const POSITIVE: char = '+'; // Choosing a higher buffer size does not result in performance improvements // (at least not on my machine). TODO: In the future, we should also take the amount of @@ -330,8 +329,7 @@ impl<'a> Line<'a> { &self.line[selection.clone()], NumInfoParseSettings { accept_si_units: selector.settings.mode == SortMode::HumanNumeric, - thousands_separator: Some(THOUSANDS_SEP), - decimal_pt: Some(DECIMAL_PT), + ..Default::default() }, ); let initial_selection = selection.clone(); @@ -367,16 +365,24 @@ impl<'a> Line<'a> { SortMode::Month => { let initial_selection = &self.line[selection.clone()]; + let mut month_chars = initial_selection + .char_indices() + .skip_while(|(_, c)| c.is_whitespace()); + let month = if month_parse(initial_selection) == Month::Unknown { // We failed to parse a month, which is equivalent to matching nothing. - 0..0 + // Add the "no match for key" marker to the first non-whitespace character. + let first_non_whitespace = month_chars.next(); + first_non_whitespace.map_or( + initial_selection.len()..initial_selection.len(), + |(idx, _)| idx..idx, + ) } else { - // We parsed a month. Match the three first non-whitespace characters, which must be the month we parsed. - let mut chars = initial_selection - .char_indices() - .skip_while(|(_, c)| c.is_whitespace()); - chars.next().unwrap().0 - ..chars.nth(2).map_or(initial_selection.len(), |(idx, _)| idx) + // We parsed a month. Match the first three non-whitespace characters, which must be the month we parsed. + month_chars.next().unwrap().0 + ..month_chars + .nth(2) + .map_or(initial_selection.len(), |(idx, _)| idx) }; // Shorten selection to month. @@ -606,8 +612,7 @@ impl FieldSelector { range, NumInfoParseSettings { accept_si_units: self.settings.mode == SortMode::HumanNumeric, - thousands_separator: Some(THOUSANDS_SEP), - decimal_pt: Some(DECIMAL_PT), + ..Default::default() }, ); // Shorten the range to what we need to pass to numeric_str_cmp later. @@ -666,22 +671,21 @@ impl FieldSelector { } else { tokens.unwrap()[position.field - 1].start }; + // strip blanks if needed + if position.ignore_blanks { + idx += line[idx..] + .char_indices() + .find(|(_, c)| !c.is_whitespace()) + .map_or(line[idx..].len(), |(idx, _)| idx); + } + // apply the character index idx += line[idx..] .char_indices() .nth(position.char - 1) - .map_or(line.len(), |(idx, _)| idx); + .map_or(line[idx..].len(), |(idx, _)| idx); if idx >= line.len() { Resolution::TooHigh } else { - if position.ignore_blanks { - if let Some((not_whitespace, _)) = - line[idx..].char_indices().find(|(_, c)| !c.is_whitespace()) - { - idx += not_whitespace; - } else { - return Resolution::TooHigh; - } - } Resolution::StartOfChar(idx) } } @@ -691,8 +695,9 @@ impl FieldSelector { Resolution::StartOfChar(from) => { let to = self.to.as_ref().map(|to| resolve_index(line, tokens, &to)); - match to { + let mut range = match to { Some(Resolution::StartOfChar(mut to)) => { + // We need to include the character at `to`. to += line[to..].chars().next().map_or(1, |c| c.len_utf8()); from..to } @@ -703,7 +708,11 @@ impl FieldSelector { // If `to` is before the start of the line, report no match. // This can happen if the line starts with a separator. Some(Resolution::TooLow) => 0..0, + }; + if range.start > range.end { + range.end = range.start; } + range } Resolution::TooLow | Resolution::EndOfChar(_) => { unreachable!("This should only happen if the field start index is 0, but that should already have caused an error.") @@ -1202,6 +1211,8 @@ fn compare_by<'a>(a: &Line<'a>, b: &Line<'a>, global_settings: &GlobalSettings) fn get_leading_gen(input: &str) -> Range { let trimmed = input.trim_start(); let leading_whitespace_len = input.len() - trimmed.len(); + + // check for inf, -inf and nan for allowed_prefix in &["inf", "-inf", "nan"] { if trimmed.is_char_boundary(allowed_prefix.len()) && trimmed[..allowed_prefix.len()].eq_ignore_ascii_case(allowed_prefix) @@ -1210,11 +1221,11 @@ fn get_leading_gen(input: &str) -> Range { } } // Make this iter peekable to see if next char is numeric - let mut char_indices = trimmed.char_indices().peekable(); + let mut char_indices = itertools::peek_nth(trimmed.char_indices()); let first = char_indices.peek(); - if first.map_or(false, |&(_, c)| c == NEGATIVE || c == POSITIVE) { + if matches!(first, Some((_, NEGATIVE)) | Some((_, POSITIVE))) { char_indices.next(); } @@ -1224,16 +1235,29 @@ fn get_leading_gen(input: &str) -> Range { if c.is_ascii_digit() { continue; } - if c == DECIMAL_PT && !had_decimal_pt { + if c == DECIMAL_PT && !had_decimal_pt && !had_e_notation { had_decimal_pt = true; continue; } - let next_char_numeric = char_indices - .peek() - .map_or(false, |(_, c)| c.is_ascii_digit()); - if (c == 'e' || c == 'E') && !had_e_notation && next_char_numeric { - had_e_notation = true; - continue; + if (c == 'e' || c == 'E') && !had_e_notation { + // we can only consume the 'e' if what follow is either a digit, or a sign followed by a digit. + if let Some(&(_, next_char)) = char_indices.peek() { + if (next_char == '+' || next_char == '-') + && matches!( + char_indices.peek_nth(2), + Some((_, c)) if c.is_ascii_digit() + ) + { + // Consume the sign. The following digits will be consumed by the main loop. + char_indices.next(); + had_e_notation = true; + continue; + } + if next_char.is_ascii_digit() { + had_e_notation = true; + continue; + } + } } return leading_whitespace_len..(leading_whitespace_len + idx); } diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 133dc0028..624c002d0 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -526,6 +526,11 @@ fn test_keys_with_options_blanks_start() { } } +#[test] +fn test_keys_blanks_with_char_idx() { + test_helper("keys_blanks", &["-k 1.2b"]) +} + #[test] fn test_keys_with_options_blanks_end() { let input = "a b @@ -574,6 +579,13 @@ aaaa .stdout_only(input); } +#[test] +fn test_keys_negative_size_match() { + // If the end of a field is before its start, we should not crash. + // Debug output should report "no match for key" at the start position (i.e. the later position). + test_helper("keys_negative_size", &["-k 3,1"]); +} + #[test] fn test_zero_terminated() { test_helper("zero-terminated", &["-z"]); diff --git a/tests/fixtures/sort/exponents_general.expected b/tests/fixtures/sort/exponents_general.expected index 524b6e67f..308a82e1e 100644 --- a/tests/fixtures/sort/exponents_general.expected +++ b/tests/fixtures/sort/exponents_general.expected @@ -6,8 +6,15 @@ + -12e-5555.5 +0b10 // binary not supported +0x10 // hexadecimal not supported, but it should be +55e-20 +55e-20.10 5.5.5.5 10E +64e+ +99e- 1000EDKLD 10000K78 +100000 @@ -15,5 +22,7 @@ 100E6 100E6 10e10e10e10 +13e+10 +45e+10.5 50e10 50e10 diff --git a/tests/fixtures/sort/exponents_general.expected.debug b/tests/fixtures/sort/exponents_general.expected.debug index 4dea45c39..a7238d10e 100644 --- a/tests/fixtures/sort/exponents_general.expected.debug +++ b/tests/fixtures/sort/exponents_general.expected.debug @@ -22,12 +22,33 @@ ^ no match for key ^ no match for key + > -12e-5555.5 + _________ +______________ +0b10 // binary not supported +_ +____________________________ +0x10 // hexadecimal not supported, but it should be +_ +___________________________________________________ +55e-20 +______ +______ +55e-20.10 +______ +_________ 5.5.5.5 ___ _______ 10E __ ___ +64e+ +__ +____ +99e- +__ +____ 1000EDKLD ____ _________ @@ -49,6 +70,12 @@ _____ 10e10e10e10 _____ ___________ +13e+10 +______ +______ +45e+10.5 +______ +________ 50e10 _____ _____ diff --git a/tests/fixtures/sort/exponents_general.txt b/tests/fixtures/sort/exponents_general.txt index de2a6c31b..4a9bbba2e 100644 --- a/tests/fixtures/sort/exponents_general.txt +++ b/tests/fixtures/sort/exponents_general.txt @@ -4,16 +4,25 @@ +100000 10000K78 +0x10 // hexadecimal not supported, but it should be 10E +0b10 // binary not supported +64e+ +99e- +45e+10.5 1000EDKLD +13e+10 100E6 50e10 + -12e-5555.5 +100000 10e10e10e10 5.5.5.5 +55e-20 +55e-20.10 diff --git a/tests/fixtures/sort/keys_blanks.expected b/tests/fixtures/sort/keys_blanks.expected new file mode 100644 index 000000000..1789659c4 --- /dev/null +++ b/tests/fixtures/sort/keys_blanks.expected @@ -0,0 +1,3 @@ + cab + abc + bca diff --git a/tests/fixtures/sort/keys_blanks.expected.debug b/tests/fixtures/sort/keys_blanks.expected.debug new file mode 100644 index 000000000..bb09ea8a2 --- /dev/null +++ b/tests/fixtures/sort/keys_blanks.expected.debug @@ -0,0 +1,9 @@ +>cab + __ +____ +>abc + __ +____ +>bca + __ +____ diff --git a/tests/fixtures/sort/keys_blanks.txt b/tests/fixtures/sort/keys_blanks.txt new file mode 100644 index 000000000..7c4f313a3 --- /dev/null +++ b/tests/fixtures/sort/keys_blanks.txt @@ -0,0 +1,3 @@ + abc + cab + bca diff --git a/tests/fixtures/sort/keys_negative_size.expected b/tests/fixtures/sort/keys_negative_size.expected new file mode 100644 index 000000000..3774da60e --- /dev/null +++ b/tests/fixtures/sort/keys_negative_size.expected @@ -0,0 +1 @@ +a b c diff --git a/tests/fixtures/sort/keys_negative_size.expected.debug b/tests/fixtures/sort/keys_negative_size.expected.debug new file mode 100644 index 000000000..e392ec7f3 --- /dev/null +++ b/tests/fixtures/sort/keys_negative_size.expected.debug @@ -0,0 +1,3 @@ +a b c + ^ no match for key +_____ diff --git a/tests/fixtures/sort/keys_negative_size.txt b/tests/fixtures/sort/keys_negative_size.txt new file mode 100644 index 000000000..3774da60e --- /dev/null +++ b/tests/fixtures/sort/keys_negative_size.txt @@ -0,0 +1 @@ +a b c diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric.expected b/tests/fixtures/sort/mixed_floats_ints_chars_numeric.expected index a781a36bb..59541af32 100644 --- a/tests/fixtures/sort/mixed_floats_ints_chars_numeric.expected +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric.expected @@ -21,10 +21,10 @@ CARAvan 8.013 45 46.89 - 4567. - 37800 576,446.88800000 576,446.890 + 4567. + 37800 4798908.340000000000 4798908.45 4798908.8909800 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric.expected.debug b/tests/fixtures/sort/mixed_floats_ints_chars_numeric.expected.debug index dbe295a1c..b7b76e589 100644 --- a/tests/fixtures/sort/mixed_floats_ints_chars_numeric.expected.debug +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric.expected.debug @@ -67,18 +67,18 @@ __ 46.89 _____ _____ +576,446.88800000 +___ +________________ +576,446.890 +___ +___________ 4567. _____ ____________________ >>>>37800 _____ _________ -576,446.88800000 -________________ -________________ -576,446.890 -___________ -___________ 4798908.340000000000 ____________________ ____________________ diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse.expected b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse.expected deleted file mode 100644 index 6b024210b..000000000 --- a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse.expected +++ /dev/null @@ -1,30 +0,0 @@ -4798908.8909800 -4798908.45 -4798908.340000000000 -576,446.890 -576,446.88800000 - 37800 - 4567. -46.89 -45 -8.013 -1.58590 -1.444 -1.040000000 -1 -00000001 -CARAvan -000 - - - - - - - - --.05 --1 --8.90880 --896689 --2028789030 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse_stable.expected b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse_stable.expected deleted file mode 100644 index cb1028f0e..000000000 --- a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse_stable.expected +++ /dev/null @@ -1,30 +0,0 @@ -4798908.8909800 -4798908.45 -4798908.340000000000 -576,446.890 -576,446.88800000 - 37800 - 4567. -46.89 -45 -8.013 -1.58590 -1.444 -1.040000000 -1 -00000001 - - - - - -CARAvan - - - -000 --.05 --1 --8.90880 --896689 --2028789030 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse_stable.txt b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse_stable.txt deleted file mode 100644 index a5813ea3a..000000000 --- a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_reverse_stable.txt +++ /dev/null @@ -1,30 +0,0 @@ -576,446.890 -576,446.88800000 - - - 4567. -45 -46.89 --1 -1 -00000001 -4798908.340000000000 -4798908.45 -4798908.8909800 - - - 37800 - --2028789030 --896689 -CARAvan - --8.90880 --.05 -1.444 -1.58590 -1.040000000 - -8.013 - -000 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.expected b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.expected index 63a3e646d..0ccdd84c0 100644 --- a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.expected +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.expected @@ -8,11 +8,14 @@ +-0 CARAvan +-0 000 +-0 1 00000001 1.040000000 @@ -21,10 +24,10 @@ CARAvan 8.013 45 46.89 +576,446.890 +576,446.88800000 4567. 37800 -576,446.88800000 -576,446.890 4798908.340000000000 4798908.45 4798908.8909800 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.expected.debug b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.expected.debug index b2782d93d..66a98b208 100644 --- a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.expected.debug +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.expected.debug @@ -18,8 +18,12 @@ ____ ^ no match for key ^ no match for key +-0 +__ CARAvan ^ no match for key +-0 +__ ^ no match for key @@ -28,6 +32,8 @@ CARAvan ^ no match for key 000 ___ +-0 +__ 1 _ 00000001 @@ -44,14 +50,14 @@ _____ __ 46.89 _____ +576,446.890 +___ +576,446.88800000 +___ 4567. _____ >>>>37800 _____ -576,446.88800000 -________________ -576,446.890 -___________ 4798908.340000000000 ____________________ 4798908.45 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.txt b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.txt index a5813ea3a..44667ef03 100644 --- a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.txt +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_stable.txt @@ -17,7 +17,9 @@ -2028789030 -896689 +-0 CARAvan +-0 -8.90880 -.05 @@ -28,3 +30,4 @@ CARAvan 8.013 000 +-0 \ No newline at end of file diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.expected b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.expected index cb27c6664..cd4256c5f 100644 --- a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.expected +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.expected @@ -11,10 +11,9 @@ 8.013 45 46.89 +576,446.890 4567. 37800 -576,446.88800000 -576,446.890 4798908.340000000000 4798908.45 4798908.8909800 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.expected.debug b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.expected.debug index 782a77724..663a4b3a9 100644 --- a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.expected.debug +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique.expected.debug @@ -24,14 +24,12 @@ _____ __ 46.89 _____ +576,446.890 +___ 4567. _____ >>>>37800 _____ -576,446.88800000 -________________ -576,446.890 -___________ 4798908.340000000000 ____________________ 4798908.45 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.expected b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.expected index bbce16934..97e261f14 100644 --- a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.expected +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.expected @@ -1,10 +1,9 @@ 4798908.8909800 4798908.45 4798908.340000000000 -576,446.890 -576,446.88800000 37800 4567. +576,446.890 46.89 45 8.013 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.expected.debug b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.expected.debug index e0389c1d5..01f7abf5b 100644 --- a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.expected.debug +++ b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse.expected.debug @@ -4,14 +4,12 @@ _______________ __________ 4798908.340000000000 ____________________ -576,446.890 -___________ -576,446.88800000 -________________ >>>>37800 _____ 4567. _____ +576,446.890 +___ 46.89 _____ 45 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse_stable.expected b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse_stable.expected deleted file mode 100644 index bbce16934..000000000 --- a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_reverse_stable.expected +++ /dev/null @@ -1,20 +0,0 @@ -4798908.8909800 -4798908.45 -4798908.340000000000 -576,446.890 -576,446.88800000 - 37800 - 4567. -46.89 -45 -8.013 -1.58590 -1.444 -1.040000000 -1 - --.05 --1 --8.90880 --896689 --2028789030 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_stable.expected b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_stable.expected deleted file mode 100644 index bbce16934..000000000 --- a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_stable.expected +++ /dev/null @@ -1,20 +0,0 @@ -4798908.8909800 -4798908.45 -4798908.340000000000 -576,446.890 -576,446.88800000 - 37800 - 4567. -46.89 -45 -8.013 -1.58590 -1.444 -1.040000000 -1 - --.05 --1 --8.90880 --896689 --2028789030 diff --git a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_stable.txt b/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_stable.txt deleted file mode 100644 index a5813ea3a..000000000 --- a/tests/fixtures/sort/mixed_floats_ints_chars_numeric_unique_stable.txt +++ /dev/null @@ -1,30 +0,0 @@ -576,446.890 -576,446.88800000 - - - 4567. -45 -46.89 --1 -1 -00000001 -4798908.340000000000 -4798908.45 -4798908.8909800 - - - 37800 - --2028789030 --896689 -CARAvan - --8.90880 --.05 -1.444 -1.58590 -1.040000000 - -8.013 - -000 diff --git a/tests/fixtures/sort/month_default.expected b/tests/fixtures/sort/month_default.expected index dc51f5d5e..99baa235a 100644 --- a/tests/fixtures/sort/month_default.expected +++ b/tests/fixtures/sort/month_default.expected @@ -1,3 +1,4 @@ + asdf N/A Ut enim ad minim veniam, quis Jan Lorem ipsum dolor sit amet mar laboris nisi ut aliquip ex ea diff --git a/tests/fixtures/sort/month_default.expected.debug b/tests/fixtures/sort/month_default.expected.debug index 2c55a0e2a..f28ba1c48 100644 --- a/tests/fixtures/sort/month_default.expected.debug +++ b/tests/fixtures/sort/month_default.expected.debug @@ -1,3 +1,6 @@ + asdf + ^ no match for key +_____ N/A Ut enim ad minim veniam, quis ^ no match for key _________________________________ diff --git a/tests/fixtures/sort/month_default.txt b/tests/fixtures/sort/month_default.txt index 6d64bf4f8..c96bad300 100644 --- a/tests/fixtures/sort/month_default.txt +++ b/tests/fixtures/sort/month_default.txt @@ -8,3 +8,4 @@ mar laboris nisi ut aliquip ex ea Jul 2 these three lines Jul 1 should remain 2,1,3 Jul 3 if --stable is provided + asdf diff --git a/tests/fixtures/sort/month_stable.expected b/tests/fixtures/sort/month_stable.expected index 868728a18..cb3a8da8f 100644 --- a/tests/fixtures/sort/month_stable.expected +++ b/tests/fixtures/sort/month_stable.expected @@ -1,4 +1,5 @@ N/A Ut enim ad minim veniam, quis + asdf Jan Lorem ipsum dolor sit amet mar laboris nisi ut aliquip ex ea May sed do eiusmod tempor incididunt diff --git a/tests/fixtures/sort/month_stable.expected.debug b/tests/fixtures/sort/month_stable.expected.debug index 4163ba39a..740f9187c 100644 --- a/tests/fixtures/sort/month_stable.expected.debug +++ b/tests/fixtures/sort/month_stable.expected.debug @@ -1,5 +1,7 @@ N/A Ut enim ad minim veniam, quis ^ no match for key + asdf + ^ no match for key Jan Lorem ipsum dolor sit amet ___ mar laboris nisi ut aliquip ex ea diff --git a/tests/fixtures/sort/month_stable.txt b/tests/fixtures/sort/month_stable.txt index 6d64bf4f8..c96bad300 100644 --- a/tests/fixtures/sort/month_stable.txt +++ b/tests/fixtures/sort/month_stable.txt @@ -8,3 +8,4 @@ mar laboris nisi ut aliquip ex ea Jul 2 these three lines Jul 1 should remain 2,1,3 Jul 3 if --stable is provided + asdf diff --git a/tests/fixtures/sort/multiple_decimals_numeric.expected b/tests/fixtures/sort/multiple_decimals_numeric.expected index 3ef4d22e8..8f42e7ce5 100644 --- a/tests/fixtures/sort/multiple_decimals_numeric.expected +++ b/tests/fixtures/sort/multiple_decimals_numeric.expected @@ -21,6 +21,8 @@ CARAvan 8.013 45 46.89 +576,446.88800000 +576,446.890 4567..457 4567. 4567.1 @@ -28,8 +30,6 @@ CARAvan 37800 45670.89079.098 45670.89079.1 -576,446.88800000 -576,446.890 4798908.340000000000 4798908.45 4798908.8909800 diff --git a/tests/fixtures/sort/multiple_decimals_numeric.expected.debug b/tests/fixtures/sort/multiple_decimals_numeric.expected.debug index f40ade9aa..948c4869c 100644 --- a/tests/fixtures/sort/multiple_decimals_numeric.expected.debug +++ b/tests/fixtures/sort/multiple_decimals_numeric.expected.debug @@ -67,6 +67,12 @@ __ 46.89 _____ _____ +576,446.88800000 +___ +________________ +576,446.890 +___ +___________ >>>>>>>>>>4567..457 _____ ___________________ @@ -88,12 +94,6 @@ _____________________ >>>>>>45670.89079.1 ___________ ___________________ -576,446.88800000 -________________ -________________ -576,446.890 -___________ -___________ 4798908.340000000000 ____________________ ____________________ From bb268d1500eabc2bf8efa193de4fc4923a06b66a Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 28 May 2021 22:39:33 +0200 Subject: [PATCH 0711/1135] sort: crash when failing to open an input file (#2265) * sort: crash when failing to open an input file Instead of ignoring files we fail to open, crash. The error message does not exactly match gnu, but that would require more effort. * use split_whitespace instead of a manual implementation * fix expected error on windows * sort: update expected error message --- src/uu/sort/src/check.rs | 2 +- src/uu/sort/src/merge.rs | 2 +- src/uu/sort/src/sort.rs | 13 ++++++------- tests/by-util/test_sort.rs | 18 ++++++++++++++++-- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/uu/sort/src/check.rs b/src/uu/sort/src/check.rs index 01b5a25b5..d3b9d6669 100644 --- a/src/uu/sort/src/check.rs +++ b/src/uu/sort/src/check.rs @@ -26,7 +26,7 @@ use std::{ /// /// The code we should exit with. pub fn check(path: &str, settings: &GlobalSettings) -> i32 { - let file = open(path).expect("failed to open input file"); + let file = open(path); let (recycled_sender, recycled_receiver) = sync_channel(2); let (loaded_sender, loaded_receiver) = sync_channel(2); thread::spawn({ diff --git a/src/uu/sort/src/merge.rs b/src/uu/sort/src/merge.rs index 48d48ad40..696353829 100644 --- a/src/uu/sort/src/merge.rs +++ b/src/uu/sort/src/merge.rs @@ -29,7 +29,7 @@ pub fn merge<'a>(files: &[impl AsRef], settings: &'a GlobalSettings) -> F let (request_sender, request_receiver) = channel(); let mut reader_files = Vec::with_capacity(files.len()); let mut loaded_receivers = Vec::with_capacity(files.len()); - for (file_number, file) in files.iter().filter_map(open).enumerate() { + for (file_number, file) in files.iter().map(open).enumerate() { let (sender, receiver) = sync_channel(2); loaded_receivers.push(receiver); reader_files.push(ReaderFile { diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 77be78390..0efce00e6 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -955,7 +955,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let mut files = Vec::new(); for path in &files0_from { - let reader = open(path.as_str()).expect("Could not read from file specified."); + let reader = open(path.as_str()); let buf_reader = BufReader::new(reader); for line in buf_reader.split(b'\0').flatten() { files.push( @@ -1116,7 +1116,7 @@ fn exec(files: &[String], settings: &GlobalSettings) -> i32 { } return check::check(files.first().unwrap(), settings); } else { - let mut lines = files.iter().filter_map(open); + let mut lines = files.iter().map(open); ext_sort(&mut lines, &settings); } @@ -1413,18 +1413,17 @@ fn print_sorted<'a, T: Iterator>>(iter: T, settings: &Global } // from cat.rs -fn open(path: impl AsRef) -> Option> { +fn open(path: impl AsRef) -> Box { let path = path.as_ref(); if path == "-" { let stdin = stdin(); - return Some(Box::new(stdin) as Box); + return Box::new(stdin) as Box; } match File::open(Path::new(path)) { - Ok(f) => Some(Box::new(f) as Box), + Ok(f) => Box::new(f) as Box, Err(e) => { - show_error!("{0:?}: {1}", path, e.to_string()); - None + crash!(2, "cannot read: {0:?}: {1}", path, e); } } } diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 624c002d0..3c0af259f 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -4,14 +4,14 @@ fn test_helper(file_name: &str, possible_args: &[&str]) { for args in possible_args { new_ucmd!() .arg(format!("{}.txt", file_name)) - .args(&args.split(' ').collect::>()) + .args(&args.split_whitespace().collect::>()) .succeeds() .stdout_is_fixture(format!("{}.expected", file_name)); new_ucmd!() .arg(format!("{}.txt", file_name)) .arg("--debug") - .args(&args.split(' ').collect::>()) + .args(&args.split_whitespace().collect::>()) .succeeds() .stdout_is_fixture(format!("{}.expected.debug", file_name)); } @@ -723,3 +723,17 @@ fn test_trailing_separator() { .succeeds() .stdout_is("aax\naaa\n"); } + +#[test] +fn test_nonexistent_file() { + new_ucmd!() + .arg("nonexistent.txt") + .fails() + .status_code(2) + .stderr_only( + #[cfg(not(windows))] + "sort: cannot read: \"nonexistent.txt\": No such file or directory (os error 2)", + #[cfg(windows)] + "sort: cannot read: \"nonexistent.txt\": The system cannot find the file specified. (os error 2)", + ); +} From a2947f689780d526c760bd2b8ea7951c5b125876 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sat, 29 May 2021 00:46:25 +0200 Subject: [PATCH 0712/1135] fix clippy warning --- src/uu/basename/src/basename.rs | 2 +- src/uu/cp/src/cp.rs | 6 +++--- src/uu/csplit/src/csplit.rs | 9 +++++---- src/uu/ls/src/ls.rs | 3 +-- src/uu/od/src/parse_inputs.rs | 6 +++--- src/uu/printenv/src/printenv.rs | 9 +++++---- src/uu/ptx/src/ptx.rs | 11 +++++++---- src/uu/sort/src/sort.rs | 6 +++--- src/uucore/src/lib/lib.rs | 13 +++++++------ src/uucore/src/lib/mods/backup_control.rs | 2 +- 10 files changed, 36 insertions(+), 31 deletions(-) diff --git a/src/uu/basename/src/basename.rs b/src/uu/basename/src/basename.rs index c20561b30..e6476e436 100644 --- a/src/uu/basename/src/basename.rs +++ b/src/uu/basename/src/basename.rs @@ -136,7 +136,7 @@ fn basename(fullname: &str, suffix: &str) -> String { } } -#[allow(clippy::manual_strip)] // can be replaced with strip_suffix once the minimum rust version is 1.45 +// can be replaced with strip_suffix once the minimum rust version is 1.45 fn strip_suffix(name: &str, suffix: &str) -> String { if name == suffix { return name.to_owned(); diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index fab1dfec1..68ad3ed84 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -669,8 +669,8 @@ impl Options { } }, backup: backup_mode, - backup_suffix: backup_suffix, - overwrite: overwrite, + backup_suffix, + overwrite, no_target_dir, preserve_attributes, recursive, @@ -1089,7 +1089,7 @@ fn copy_attribute(source: &Path, dest: &Path, attribute: &Attribute) -> CopyResu } #[cfg(not(windows))] -#[allow(clippy::unnecessary_wraps)] // needed for windows version +#[allow(clippy::unnecessary_unwrap)] // needed for windows version fn symlink_file(source: &Path, dest: &Path, context: &str) -> CopyResult<()> { match std::os::unix::fs::symlink(source, dest).context(context) { Ok(_) => Ok(()), diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index f67f4958f..43f95fff5 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -483,10 +483,11 @@ where /// Shrink the buffer so that its length is equal to the set size, returning an iterator for /// the elements that were too much. fn shrink_buffer_to_size(&mut self) -> impl Iterator + '_ { - let mut shrink_offset = 0; - if self.buffer.len() > self.size { - shrink_offset = self.buffer.len() - self.size; - } + let shrink_offset = if self.buffer.len() > self.size { + self.buffer.len() - self.size + } else { + 0 + }; self.buffer .drain(..shrink_offset) .map(|(_, line)| line.unwrap()) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index d467d431a..17e0a16a8 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1614,7 +1614,7 @@ fn display_date(metadata: &Metadata, config: &Config) -> String { Some(time) => { //Date is recent if from past 6 months //According to GNU a Gregorian year has 365.2425 * 24 * 60 * 60 == 31556952 seconds on the average. - let recent = time + chrono::Duration::seconds(31556952 / 2) > chrono::Local::now(); + let recent = time + chrono::Duration::seconds(31_556_952 / 2) > chrono::Local::now(); match config.time_style { TimeStyle::FullIso => time.format("%Y-%m-%d %H:%M:%S.%f %z"), @@ -1696,7 +1696,6 @@ fn file_is_executable(md: &Metadata) -> bool { md.mode() & ((S_IXUSR | S_IXGRP | S_IXOTH) as u32) != 0 } -#[allow(clippy::clippy::collapsible_else_if)] fn classify_file(path: &PathData) -> Option { let file_type = path.file_type()?; diff --git a/src/uu/od/src/parse_inputs.rs b/src/uu/od/src/parse_inputs.rs index 533f4f106..288c0870f 100644 --- a/src/uu/od/src/parse_inputs.rs +++ b/src/uu/od/src/parse_inputs.rs @@ -76,7 +76,7 @@ pub fn parse_inputs(matches: &dyn CommandLineOpts) -> Result) -> Result CommandLineInputs::FileAndOffset(("-".to_string(), n, None)), _ => CommandLineInputs::FileNames( - input_strings.iter().map(|s| s.to_string()).collect(), + input_strings.iter().map(|&s| s.to_string()).collect(), ), }) } @@ -179,7 +179,7 @@ mod tests { impl<'a> MockOptions<'a> { fn new(inputs: Vec<&'a str>, option_names: Vec<&'a str>) -> MockOptions<'a> { MockOptions { - inputs: inputs.iter().map(|s| s.to_string()).collect::>(), + inputs: inputs.iter().map(|&s| s.to_string()).collect::>(), option_names, } } diff --git a/src/uu/printenv/src/printenv.rs b/src/uu/printenv/src/printenv.rs index 34571ddad..25cb58185 100644 --- a/src/uu/printenv/src/printenv.rs +++ b/src/uu/printenv/src/printenv.rs @@ -50,10 +50,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); - let mut separator = "\n"; - if matches.is_present(OPT_NULL) { - separator = "\x00"; - } + let separator = if matches.is_present(OPT_NULL) { + "\x00" + } else { + "\n" + }; if variables.is_empty() { for (env_var, value) in env::vars() { diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index d2aa619b4..a17f7c810 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -108,10 +108,13 @@ impl WordFilter { // Ignore empty string regex from cmd-line-args let arg_reg: Option = if matches.is_present(options::WORD_REGEXP) { match matches.value_of(options::WORD_REGEXP) { - Some(v) => match v.is_empty() { - true => None, - false => Some(v.to_string()), - }, + Some(v) => { + if v.is_empty() { + None + } else { + Some(v.to_string()) + } + } None => None, } } else { diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 0efce00e6..5fdaf32cf 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -296,10 +296,10 @@ impl<'a> Line<'a> { fn print(&self, writer: &mut impl Write, settings: &GlobalSettings) { if settings.zero_terminated && !settings.debug { crash_if_err!(1, writer.write_all(self.line.as_bytes())); - crash_if_err!(1, writer.write_all("\0".as_bytes())); + crash_if_err!(1, writer.write_all(b"\0")); } else if !settings.debug { crash_if_err!(1, writer.write_all(self.line.as_bytes())); - crash_if_err!(1, writer.write_all("\n".as_bytes())); + crash_if_err!(1, writer.write_all(b"\n")); } else { crash_if_err!(1, self.print_debug(settings, writer)); } @@ -1437,7 +1437,7 @@ mod tests { fn test_get_hash() { let a = "Ted".to_string(); - assert_eq!(2646829031758483623, get_hash(&a)); + assert_eq!(2_646_829_031_758_483_623, get_hash(&a)); } #[test] diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index c17f14516..e7f29e20c 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -146,15 +146,16 @@ pub trait Args: Iterator + Sized { InvalidEncodingHandling::Ignore => s.is_ok(), _ => true, }) - .map(|s| match s.is_ok() { - true => s.unwrap(), - false => s.unwrap_err(), + .map(|s| match s { + Ok(v) => v, + Err(e) => e, }) .collect(); - match full_conversion { - true => ConversionResult::Complete(result_vector), - false => ConversionResult::Lossy(result_vector), + if full_conversion { + ConversionResult::Complete(result_vector) + } else { + ConversionResult::Lossy(result_vector) } } diff --git a/src/uucore/src/lib/mods/backup_control.rs b/src/uucore/src/lib/mods/backup_control.rs index 6004ae84d..83268d351 100644 --- a/src/uucore/src/lib/mods/backup_control.rs +++ b/src/uucore/src/lib/mods/backup_control.rs @@ -33,7 +33,7 @@ pub fn determine_backup_suffix(supplied_suffix: Option<&str>) -> String { if let Some(suffix) = supplied_suffix { String::from(suffix) } else { - env::var("SIMPLE_BACKUP_SUFFIX").unwrap_or("~".to_owned()) + env::var("SIMPLE_BACKUP_SUFFIX").unwrap_or_else(|_| "~".to_owned()) } } From 714661774bd04d83f5c92c33ff2eef851f4c78a4 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sat, 29 May 2021 01:51:00 +0200 Subject: [PATCH 0713/1135] users: fix long_help text and clippy warning --- src/uu/users/src/users.rs | 21 +++++++++++++-------- tests/by-util/test_users.rs | 28 ++++++++++++---------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/uu/users/src/users.rs b/src/uu/users/src/users.rs index 4bb628441..99e06c1af 100644 --- a/src/uu/users/src/users.rs +++ b/src/uu/users/src/users.rs @@ -6,19 +6,14 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -/* last synced with: whoami (GNU coreutils) 8.22 */ -// Allow dead code here in order to keep all fields, constants here, for consistency. -#![allow(dead_code)] - #[macro_use] extern crate uucore; -use uucore::utmpx::*; - use clap::{App, Arg}; +use uucore::utmpx::{self, Utmpx}; -static ABOUT: &str = "Display who is currently logged in, according to FILE."; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Print the user names of users currently logged in to the current host"; static ARG_FILES: &str = "files"; @@ -26,13 +21,23 @@ fn get_usage() -> String { format!("{0} [FILE]", executable!()) } +fn get_long_usage() -> String { + format!( + "Output who is currently logged in according to FILE. +If FILE is not specified, use {}. /var/log/wtmp as FILE is common.", + utmpx::DEFAULT_FILE + ) +} + pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); + let after_help = get_long_usage(); let matches = App::new(executable!()) .version(VERSION) .about(ABOUT) .usage(&usage[..]) + .after_help(&after_help[..]) .arg(Arg::with_name(ARG_FILES).takes_value(true).max_values(1)) .get_matches_from(args); @@ -44,7 +49,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let filename = if !files.is_empty() { files[0].as_ref() } else { - DEFAULT_FILE + utmpx::DEFAULT_FILE }; let mut users = Utmpx::iter_all_records() diff --git a/tests/by-util/test_users.rs b/tests/by-util/test_users.rs index 3c5789820..89c3fdd0f 100644 --- a/tests/by-util/test_users.rs +++ b/tests/by-util/test_users.rs @@ -1,27 +1,23 @@ use crate::common::util::*; -use std::env; #[test] fn test_users_noarg() { new_ucmd!().succeeds(); } + #[test] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] fn test_users_check_name() { - let result = TestScenario::new(util_name!()).ucmd_keepenv().succeeds(); + #[cfg(target_os = "linux")] + let util_name = util_name!(); + #[cfg(target_vendor = "apple")] + let util_name = format!("g{}", util_name!()); - // Expectation: USER is often set - let key = "USER"; + let expected = TestScenario::new(&util_name) + .cmd_keepenv(util_name) + .env("LANGUAGE", "C") + .succeeds() + .stdout_move_str(); - match env::var(key) { - Err(e) => println!("Key {} isn't set. Found {}", &key, e), - Ok(username) => - // Check if "users" contains the name of the user - { - println!("username found {}", &username); - // println!("result.stdout {}", &result.stdout); - if !result.stdout_str().is_empty() { - result.stdout_contains(&username); - } - } - } + new_ucmd!().succeeds().stdout_is(&expected); } From 101e55702cd04e6758dfaa218b0a3edf1988e590 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 29 May 2021 12:23:10 +0200 Subject: [PATCH 0714/1135] more: simplify and fix logic for multiple files --- src/uu/more/src/more.rs | 80 +++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 48 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 2f8d179a8..3eb127ac6 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -136,7 +136,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if let Some(filenames) = matches.values_of(options::FILES) { let mut stdout = setup_term(); let length = filenames.len(); - for (idx, fname) in filenames.clone().enumerate() { + for (idx, fname) in filenames.enumerate() { let fname = Path::new(fname); if fname.is_dir() { terminal::disable_raw_mode().unwrap(); @@ -145,20 +145,19 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } if !fname.exists() { terminal::disable_raw_mode().unwrap(); - eprintln!( - "{}: cannot open {}: No such file or directory", - executable!(), + show_error!( + "cannot open {}: No such file or directory", fname.display() ); return 1; } - if filenames.len() > 1 { + if length > 1 { buff.push_str(&MULTI_FILE_TOP_PROMPT.replace("{}", fname.to_str().unwrap())); } let mut reader = BufReader::new(File::open(fname).unwrap()); reader.read_to_string(&mut buff).unwrap(); - let last = idx + 1 == length; - more(&buff, &mut stdout, last); + let is_last = idx + 1 == length; + more(&buff, &mut stdout, is_last); buff.clear(); } reset_term(&mut stdout); @@ -205,17 +204,9 @@ fn more(buff: &str, mut stdout: &mut Stdout, is_last: bool) { let lines = break_buff(buff, usize::from(cols)); let line_count: u16 = lines.len().try_into().unwrap(); - // Print everything and quit if line count is less than the availale rows - if line_count < rows { - println!("{}", buff); - return; - } - let mut upper_mark = 0; - // Number of lines left - let mut lines_left = line_count - (upper_mark + rows); - // Are we on the very last page and the next down arrow will return this function - let mut to_be_done = false; + let mut lines_left = line_count.saturating_sub(upper_mark + rows); + draw( &mut upper_mark, rows, @@ -224,6 +215,16 @@ fn more(buff: &str, mut stdout: &mut Stdout, is_last: bool) { line_count, ); + let mut to_be_done = false; + if lines_left == 0 && is_last { + if is_last { + return; + } else { + to_be_done = true; + } + } + + loop { if event::poll(Duration::from_millis(10)).unwrap() { match event::read().unwrap() { @@ -246,38 +247,21 @@ fn more(buff: &str, mut stdout: &mut Stdout, is_last: bool) { code: KeyCode::Char(' '), modifiers: KeyModifiers::NONE, }) => { - // If this is the last page but some text - // is still left that does not require a page of its own - // then this event will print the left lines - if lines_left < rows && !to_be_done { - for l in lines.iter().skip((line_count - upper_mark - rows).into()) { - stdout.write_all(format!("\r{}\n", l).as_bytes()).unwrap(); + upper_mark = upper_mark.saturating_add(rows.saturating_sub(1)); + lines_left = line_count.saturating_sub(upper_mark + rows); + draw( + &mut upper_mark, + rows, + &mut stdout, + lines.clone(), + line_count, + ); + + if lines_left == 0 { + if to_be_done || is_last { + return } - make_prompt_and_flush(&mut stdout, line_count, line_count); - // If this is not the last input file - // do not return, but the next down arrow must return - // because we have printed everyhing - if !is_last { - to_be_done = true; - } else { - // Else quit - reset_term(&mut stdout); - return; - } - // This handles the next arrow key to quit - } else if lines_left < rows && to_be_done { - return; - } else { - // Print a normal page - upper_mark = upper_mark.saturating_add(rows.saturating_sub(1)); - lines_left = line_count.saturating_sub(upper_mark + rows); - draw( - &mut upper_mark, - rows, - &mut stdout, - lines.clone(), - line_count, - ); + to_be_done = true; } } Event::Key(KeyEvent { From 40ee9023e85d59cf14a81c407b1f3349d31e2590 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 29 May 2021 12:42:46 +0200 Subject: [PATCH 0715/1135] more: simplify main loop --- src/uu/more/src/more.rs | 42 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 3eb127ac6..c6d1c6b40 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -215,6 +215,9 @@ fn more(buff: &str, mut stdout: &mut Stdout, is_last: bool) { line_count, ); + // Specifies whether we have reached the end of the file and should + // return on the next keypress. However, we immediately return when + // this is the last file. let mut to_be_done = false; if lines_left == 0 && is_last { if is_last { @@ -224,7 +227,6 @@ fn more(buff: &str, mut stdout: &mut Stdout, is_last: bool) { } } - loop { if event::poll(Duration::from_millis(10)).unwrap() { match event::read().unwrap() { @@ -248,37 +250,31 @@ fn more(buff: &str, mut stdout: &mut Stdout, is_last: bool) { modifiers: KeyModifiers::NONE, }) => { upper_mark = upper_mark.saturating_add(rows.saturating_sub(1)); - lines_left = line_count.saturating_sub(upper_mark + rows); - draw( - &mut upper_mark, - rows, - &mut stdout, - lines.clone(), - line_count, - ); - - if lines_left == 0 { - if to_be_done || is_last { - return - } - to_be_done = true; - } + } Event::Key(KeyEvent { code: KeyCode::Up, modifiers: KeyModifiers::NONE, }) => { upper_mark = upper_mark.saturating_sub(rows.saturating_sub(1)); - draw( - &mut upper_mark, - rows, - &mut stdout, - lines.clone(), - line_count, - ); } _ => continue, } + lines_left = line_count.saturating_sub(upper_mark + rows); + draw( + &mut upper_mark, + rows, + &mut stdout, + lines.clone(), + line_count, + ); + + if lines_left == 0 { + if to_be_done || is_last { + return + } + to_be_done = true; + } } } } From 9d17c1fddf1309a8d7567ec69322e1bdb5ff48f4 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 29 May 2021 12:45:12 +0200 Subject: [PATCH 0716/1135] more: add todo for unicode width --- src/uu/more/src/more.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index c6d1c6b40..b30c15fdd 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -316,6 +316,7 @@ fn break_buff(buff: &str, cols: usize) -> Vec { fn break_line(mut line: &str, cols: usize) -> Vec { let breaks = (line.len() / cols).saturating_add(1); let mut lines = Vec::with_capacity(breaks); + // TODO: Use unicode width instead of the length in bytes. if line.len() < cols { lines.push(line.to_string()); return lines; From 762da0bd3749fa699e4a4afbe3d9c74890a0ac75 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 29 May 2021 12:51:47 +0200 Subject: [PATCH 0717/1135] more: comment out unimplemented arguments --- src/uu/more/src/more.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index b30c15fdd..c4a13aa1b 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -50,6 +50,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .about("A file perusal filter for CRT viewing.") .version(env!("CARGO_PKG_VERSION")) + // The commented arguments below are unimplemented: + /* .arg( Arg::with_name(options::SILENT) .short("d") @@ -125,6 +127,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .help("Display file beginning from pattern match"), ) + */ .arg( Arg::with_name(options::FILES) .required(false) @@ -132,6 +135,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("Path to the files to be read"), ) .get_matches_from(args); + let mut buff = String::new(); if let Some(filenames) = matches.values_of(options::FILES) { let mut stdout = setup_term(); From 52ea9c4a485f7e5c1a95d739dfa61aa2a1ce49c7 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sat, 29 May 2021 14:21:32 +0200 Subject: [PATCH 0718/1135] CI: set MSRV and "--target" for clippy * add "clippy.toml" in order to set MSRV for clippy linting this works only if clippy is invoked with "+nightly" * add "--target" to clippy in order to also lint tests --- .github/workflows/CICD.yml | 2 +- clippy.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 clippy.toml diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 804720bea..8bc106e34 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -94,7 +94,7 @@ jobs: run: | # `clippy` testing # * convert any warnings to GHA UI annotations; ref: - S=$(cargo clippy ${{ 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:]]+(.*):([0-9]+):([0-9]+).*$/::warning file=\2,line=\3,col=\4::WARNING: \`cargo clippy\`: \1/p;" -e '}' ; } + S=$(cargo +nightly clippy --target=${{ matrix.job.target }} ${{ 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:]]+(.*):([0-9]+):([0-9]+).*$/::warning file=\2,line=\3,col=\4::WARNING: \`cargo clippy\`: \1/p;" -e '}' ; } min_version: name: MinRustV # Minimum supported rust version diff --git a/clippy.toml b/clippy.toml new file mode 100644 index 000000000..0a0a69a41 --- /dev/null +++ b/clippy.toml @@ -0,0 +1 @@ +msrv = "1.43.1" From fb812ff9d05c569c1b26ee0bb65a00a22e1a904b Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sat, 29 May 2021 14:29:46 +0200 Subject: [PATCH 0719/1135] Cargo.toml: remove factor_benches in order to be able to run clippy linting for all targets --- Cargo.lock | 316 +---------------------------------------------------- Cargo.toml | 3 +- 2 files changed, 6 insertions(+), 313 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 461ce5487..8f0b4efcd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "Inflector" version = "0.11.4" @@ -43,12 +45,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "array-init" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6945cc5422176fc5e602e590c2878d2c2acd9a4fe20a4baa7c28022521698ec6" - [[package]] name = "arrayvec" version = "0.4.12" @@ -134,15 +130,8 @@ dependencies = [ "lazy_static", "memchr 2.4.0", "regex-automata", - "serde", ] -[[package]] -name = "bumpalo" -version = "3.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" - [[package]] name = "byte-tools" version = "0.2.0" @@ -155,15 +144,6 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -[[package]] -name = "cast" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57cdfa5d50aad6cb4d44dcab6101a7f79925bd59d82ca42f38a9856a28865374" -dependencies = [ - "rustc_version", -] - [[package]] name = "cc" version = "1.0.67" @@ -284,7 +264,6 @@ dependencies = [ "uu_expand", "uu_expr", "uu_factor", - "uu_factor_benches", "uu_false", "uu_fmt", "uu_fold", @@ -463,42 +442,6 @@ dependencies = [ "unicode-xid 0.0.4", ] -[[package]] -name = "criterion" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" -dependencies = [ - "atty", - "cast", - "clap", - "criterion-plot", - "csv", - "itertools 0.10.0", - "lazy_static", - "num-traits", - "oorandom", - "plotters", - "rayon", - "regex", - "serde", - "serde_cbor", - "serde_derive", - "serde_json", - "tinytemplate", - "walkdir", -] - -[[package]] -name = "criterion-plot" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" -dependencies = [ - "cast", - "itertools 0.9.0", -] - [[package]] name = "crossbeam-channel" version = "0.5.1" @@ -544,28 +487,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "csv" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" -dependencies = [ - "bstr", - "csv-core", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "csv-core" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" -dependencies = [ - "memchr 2.4.0", -] - [[package]] name = "ctor" version = "0.1.20" @@ -807,15 +728,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.10.0" @@ -825,21 +737,6 @@ dependencies = [ "either", ] -[[package]] -name = "itoa" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" - -[[package]] -name = "js-sys" -version = "0.3.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062" -dependencies = [ - "wasm-bindgen", -] - [[package]] name = "kernel32-sys" version = "0.2.2" @@ -1031,12 +928,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "oorandom" -version = "11.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" - [[package]] name = "ouroboros" version = "0.9.3" @@ -1088,15 +979,6 @@ dependencies = [ "proc-macro-hack", ] -[[package]] -name = "pest" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" -dependencies = [ - "ucd-trie", -] - [[package]] name = "pkg-config" version = "0.3.19" @@ -1113,34 +995,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "plotters" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a3fd9ec30b9749ce28cd91f255d569591cdf937fe280c312143e3c4bad6f2a" -dependencies = [ - "num-traits", - "plotters-backend", - "plotters-svg", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "plotters-backend" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" - -[[package]] -name = "plotters-svg" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" -dependencies = [ - "plotters-backend", -] - [[package]] name = "ppv-lite86" version = "0.2.10" @@ -1446,21 +1300,6 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" -[[package]] -name = "rustc_version" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" -dependencies = [ - "semver 0.11.0", -] - -[[package]] -name = "ryu" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" - [[package]] name = "same-file" version = "1.0.6" @@ -1482,16 +1321,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser 0.7.0", -] - -[[package]] -name = "semver" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser 0.10.2", + "semver-parser", ] [[package]] @@ -1500,53 +1330,6 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] - -[[package]] -name = "serde" -version = "1.0.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" - -[[package]] -name = "serde_cbor" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -dependencies = [ - "half", - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" -dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" -dependencies = [ - "itoa", - "ryu", - "serde", -] - [[package]] name = "sha1" version = "0.6.0" @@ -1737,28 +1520,12 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "tinytemplate" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" -dependencies = [ - "serde", - "serde_json", -] - [[package]] name = "typenum" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" -[[package]] -name = "ucd-trie" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" - [[package]] name = "unicode-segmentation" version = "1.7.1" @@ -2064,17 +1831,6 @@ dependencies = [ "uucore_procs", ] -[[package]] -name = "uu_factor_benches" -version = "0.0.0" -dependencies = [ - "array-init", - "criterion", - "rand 0.7.3", - "rand_chacha 0.2.2", - "uu_factor", -] - [[package]] name = "uu_false" version = "0.0.6" @@ -2553,7 +2309,7 @@ dependencies = [ "ouroboros", "rand 0.7.3", "rayon", - "semver 0.9.0", + "semver", "tempfile", "unicode-width", "uucore", @@ -2901,70 +2657,6 @@ version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" -[[package]] -name = "wasm-bindgen" -version = "0.2.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" -dependencies = [ - "cfg-if 1.0.0", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote 1.0.9", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4" -dependencies = [ - "quote 1.0.9", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97" -dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" - -[[package]] -name = "web-sys" -version = "0.3.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e828417b379f3df7111d3a2a9e5753706cae29c41f7c4029ee9fd77f3e09e582" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "wild" version = "2.0.4" diff --git a/Cargo.toml b/Cargo.toml index cc36199cc..36d667d98 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -325,7 +325,8 @@ who = { optional=true, version="0.0.6", package="uu_who", path="src/uu/who" whoami = { optional=true, version="0.0.6", package="uu_whoami", path="src/uu/whoami" } yes = { optional=true, version="0.0.6", package="uu_yes", path="src/uu/yes" } -factor_benches = { optional = true, version = "0.0.0", package = "uu_factor_benches", path = "tests/benches/factor" } +# 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" } # # * pinned transitive dependencies From 0487360507a4204ca733b4351fa189fad55da159 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 29 May 2021 14:30:30 +0200 Subject: [PATCH 0720/1135] pr: make tests compile again --- Cargo.lock | 19 ++++++++++--------- src/uu/pr/Cargo.toml | 2 +- tests/common/util.rs | 4 ++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c59af5c06..069fd04dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -206,6 +206,7 @@ dependencies = [ name = "coreutils" version = "0.0.6" dependencies = [ + "chrono", "conv", "filetime", "glob 0.3.0", @@ -2152,16 +2153,16 @@ dependencies = [ [[package]] name = "uu_pr" -version = "0.0.4" +version = "0.0.6" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "chrono", + "getopts", + "itertools 0.10.0", + "quick-error", + "regex", + "time", + "uucore", + "uucore_procs", ] [[package]] diff --git a/src/uu/pr/Cargo.toml b/src/uu/pr/Cargo.toml index 0a86d3ac8..53f2a69b6 100644 --- a/src/uu/pr/Cargo.toml +++ b/src/uu/pr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pr" -version = "0.0.4" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "pr ~ (uutils) convert text files for printing" diff --git a/tests/common/util.rs b/tests/common/util.rs index fa6ae29c5..9b6942bac 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -205,8 +205,8 @@ impl CmdResult { } /// like stdout_is_fixture(...), but replaces the data in fixture file based on values provided in template_vars /// command output - pub fn stdout_is_templated_fixture>(&self, file_rel_path: T, template_vars: Vec<(&String, &String)>) -> Box<&CmdResult> { - let mut contents = read_scenario_fixture(&self.tmpd, file_rel_path); + pub fn stdout_is_templated_fixture>(&self, file_rel_path: T, template_vars: Vec<(&String, &String)>) -> &CmdResult { + let mut contents = String::from_utf8(read_scenario_fixture(&self.tmpd, file_rel_path)).unwrap(); for kv in template_vars { contents = contents.replace(kv.0, kv.1); } From d94ee87d15063c299135cc8e446c954c5c3c2c40 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 29 May 2021 14:42:24 +0200 Subject: [PATCH 0721/1135] pr: move options into mod --- src/uu/pr/src/pr.rs | 143 ++++++++++++++++++++++---------------------- 1 file changed, 73 insertions(+), 70 deletions(-) diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index 81a3dfe9a..aa9510690 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -12,7 +12,7 @@ extern crate quick_error; use chrono::offset::Local; use chrono::DateTime; use getopts::{HasArg, Occur}; -use getopts::{Matches, Options}; +use getopts::Matches; use itertools::structs::KMergeBy; use itertools::{GroupBy, Itertools}; use quick_error::ResultExt; @@ -35,25 +35,6 @@ static LINES_PER_PAGE: usize = 66; static LINES_PER_PAGE_FOR_FORM_FEED: usize = 63; static HEADER_LINES_PER_PAGE: usize = 5; static TRAILER_LINES_PER_PAGE: usize = 5; -static STRING_HEADER_OPTION: &str = "h"; -static DOUBLE_SPACE_OPTION: &str = "d"; -static NUMBERING_MODE_OPTION: &str = "n"; -static FIRST_LINE_NUMBER_OPTION: &str = "N"; -static PAGE_RANGE_OPTION: &str = "pages"; -static NO_HEADER_TRAILER_OPTION: &str = "t"; -static PAGE_LENGTH_OPTION: &str = "l"; -static SUPPRESS_PRINTING_ERROR: &str = "r"; -static FORM_FEED_OPTION: &str = "F"; -static FORM_FEED_OPTION_SMALL: &str = "f"; -static COLUMN_WIDTH_OPTION: &str = "w"; -static PAGE_WIDTH_OPTION: &str = "W"; -static ACROSS_OPTION: &str = "a"; -static COLUMN_OPTION: &str = "column"; -static COLUMN_CHAR_SEPARATOR_OPTION: &str = "s"; -static COLUMN_STRING_SEPARATOR_OPTION: &str = "S"; -static MERGE_FILES_PRINT: &str = "m"; -static OFFSET_SPACES_OPTION: &str = "o"; -static JOIN_LINES_OPTION: &str = "J"; static FILE_STDIN: &str = "-"; static READ_BUFFER_SIZE: usize = 1024 * 64; static DEFAULT_COLUMN_WIDTH: usize = 72; @@ -61,6 +42,28 @@ static DEFAULT_COLUMN_WIDTH_WITH_S_OPTION: usize = 512; static DEFAULT_COLUMN_SEPARATOR: &char = &TAB; static FF: u8 = 0x0C as u8; +mod options { + pub static STRING_HEADER_OPTION: &str = "h"; + pub static DOUBLE_SPACE_OPTION: &str = "d"; + pub static NUMBERING_MODE_OPTION: &str = "n"; + pub static FIRST_LINE_NUMBER_OPTION: &str = "N"; + pub static PAGE_RANGE_OPTION: &str = "pages"; + pub static NO_HEADER_TRAILER_OPTION: &str = "t"; + pub static PAGE_LENGTH_OPTION: &str = "l"; + pub static SUPPRESS_PRINTING_ERROR: &str = "r"; + pub static FORM_FEED_OPTION: &str = "F"; + pub static FORM_FEED_OPTION_SMALL: &str = "f"; + pub static COLUMN_WIDTH_OPTION: &str = "w"; + pub static PAGE_WIDTH_OPTION: &str = "W"; + pub static ACROSS_OPTION: &str = "a"; + pub static COLUMN_OPTION: &str = "column"; + pub static COLUMN_CHAR_SEPARATOR_OPTION: &str = "s"; + pub static COLUMN_STRING_SEPARATOR_OPTION: &str = "S"; + pub static MERGE_FILES_PRINT: &str = "m"; + pub static OFFSET_SPACES_OPTION: &str = "o"; + pub static JOIN_LINES_OPTION: &str = "J"; +} + struct OutputOptions { /// Line numbering mode number: Option, @@ -184,7 +187,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { opts.opt( "", - PAGE_RANGE_OPTION, + options::PAGE_RANGE_OPTION, "Begin and stop printing with page FIRST_PAGE[:LAST_PAGE]", "FIRST_PAGE[:LAST_PAGE]", HasArg::Yes, @@ -192,7 +195,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); opts.opt( - STRING_HEADER_OPTION, + options::STRING_HEADER_OPTION, "header", "Use the string header to replace the file name \ in the header line.", @@ -202,7 +205,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); opts.opt( - DOUBLE_SPACE_OPTION, + options::DOUBLE_SPACE_OPTION, "double-space", "Produce output that is double spaced. An extra character is output following every found in the input.", @@ -212,7 +215,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); opts.opt( - NUMBERING_MODE_OPTION, + options::NUMBERING_MODE_OPTION, "number-lines", "Provide width digit line numbering. The default for width, if not specified, is 5. The number occupies the first width column positions of each text column or each line of -m output. If char (any nondigit @@ -224,7 +227,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); opts.opt( - FIRST_LINE_NUMBER_OPTION, + options::FIRST_LINE_NUMBER_OPTION, "first-line-number", "start counting with NUMBER at 1st line of first page printed", "NUMBER", @@ -233,7 +236,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); opts.opt( - NO_HEADER_TRAILER_OPTION, + options::NO_HEADER_TRAILER_OPTION, "omit-header", "Write neither the five-line identifying header nor the five-line trailer usually supplied for each page. Quit writing after the last line of each file without spacing to the end of the page.", @@ -243,7 +246,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); opts.opt( - PAGE_LENGTH_OPTION, + options::PAGE_LENGTH_OPTION, "length", "Override the 66-line default (default number of lines of text 56, and with -F 63) and reset the page length to lines. If lines is not greater than the sum of both the header and trailer depths (in lines), the pr utility shall suppress both the header and trailer, as if the @@ -254,7 +257,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); opts.opt( - SUPPRESS_PRINTING_ERROR, + options::SUPPRESS_PRINTING_ERROR, "no-file-warnings", "omit warning when a file cannot be opened", "", @@ -263,7 +266,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); opts.opt( - FORM_FEED_OPTION, + options::FORM_FEED_OPTION, "form-feed", "Use a for new pages, instead of the default behavior that uses a sequence of s.", "", @@ -271,7 +274,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Occur::Optional, ); opts.opt( - FORM_FEED_OPTION_SMALL, + options::FORM_FEED_OPTION_SMALL, "form-feed", "Same as -F but pause before beginning the first page if standard output is a terminal.", @@ -282,7 +285,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { opts.opt( "", - COLUMN_OPTION, + options::COLUMN_OPTION, "Produce multi-column output that is arranged in column columns (the default shall be 1) and is written down each column in the order in which the text is received from the input file. This option should not be used with -m. The options -e and -i shall be assumed for multiple text-column output. Whether or not text columns are pro‐ @@ -294,7 +297,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); opts.opt( - COLUMN_WIDTH_OPTION, + options::COLUMN_WIDTH_OPTION, "width", "Set the width of the line to width column positions for multiple text-column output only. If the -w option is not specified and the -s option is not specified, the default width shall be 72. If the -w option is not speci‐ @@ -305,7 +308,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); opts.opt( - PAGE_WIDTH_OPTION, + options::PAGE_WIDTH_OPTION, "page-width", "set page width to PAGE_WIDTH (72) characters always, truncate lines, except -J option is set, no interference @@ -316,7 +319,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); opts.opt( - ACROSS_OPTION, + options::ACROSS_OPTION, "across", "Modify the effect of the - column option so that the columns are filled across the page in a round-robin order (for example, when column is 2, the first input line heads column 1, the second heads column 2, the third is the @@ -327,7 +330,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); opts.opt( - COLUMN_CHAR_SEPARATOR_OPTION, + options::COLUMN_CHAR_SEPARATOR_OPTION, "separator", "Separate text columns by the single character char instead of by the appropriate number of s (default for char is the character).", @@ -337,7 +340,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); opts.opt( - COLUMN_STRING_SEPARATOR_OPTION, + options::COLUMN_STRING_SEPARATOR_OPTION, "sep-string", "separate columns by STRING, without -S: Default separator with -J and @@ -348,7 +351,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); opts.opt( - MERGE_FILES_PRINT, + options::MERGE_FILES_PRINT, "merge", "Merge files. Standard output shall be formatted so the pr utility writes one line from each file specified by a file operand, side by side into text columns of equal fixed widths, in terms of the number of column positions. @@ -359,7 +362,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); opts.opt( - OFFSET_SPACES_OPTION, + options::OFFSET_SPACES_OPTION, "indent", "Each line of output shall be preceded by offset s. If the -o option is not specified, the default offset shall be zero. The space taken is in addition to the output line width (see the -w option below).", @@ -369,7 +372,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); opts.opt( - JOIN_LINES_OPTION, + options::JOIN_LINES_OPTION, "join-lines", "merge full lines, turns off -W line truncation, no column alignment, --sep-string[=STRING] sets separators", @@ -403,7 +406,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return print_usage(&mut opts, &matches); } - let file_groups: Vec> = if matches.opt_present(MERGE_FILES_PRINT) { + let file_groups: Vec> = if matches.opt_present(options::MERGE_FILES_PRINT) { vec![files] } else { files.into_iter().map(|i| vec![i]).collect() @@ -477,12 +480,12 @@ fn recreate_arguments(args: &Vec) -> Vec { } fn print_error(matches: &Matches, err: PrError) { - if !matches.opt_present(SUPPRESS_PRINTING_ERROR) { + if !matches.opt_present(options::SUPPRESS_PRINTING_ERROR) { eprintln!("{}", err); } } -fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { +fn print_usage(opts: &mut getopts::Options, matches: &Matches) -> i32 { println!("{} {} -- print files", NAME, VERSION); println!(); println!( @@ -517,7 +520,7 @@ fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { println!(" +page \t\tBegin output at page number page of the formatted input."); println!( " -column \t\tProduce multi-column output. Refer --{}", - COLUMN_OPTION + options::COLUMN_OPTION ); if matches.free.is_empty() { return 1; @@ -546,30 +549,30 @@ fn build_options( free_args: String, ) -> Result { let form_feed_used = - matches.opt_present(FORM_FEED_OPTION) || matches.opt_present(FORM_FEED_OPTION_SMALL); + matches.opt_present(options::FORM_FEED_OPTION) || matches.opt_present(options::FORM_FEED_OPTION_SMALL); - let is_merge_mode: bool = matches.opt_present(MERGE_FILES_PRINT); + let is_merge_mode: bool = matches.opt_present(options::MERGE_FILES_PRINT); - if is_merge_mode && matches.opt_present(COLUMN_OPTION) { + if is_merge_mode && matches.opt_present(options::COLUMN_OPTION) { let err_msg: String = String::from("cannot specify number of columns when printing in parallel"); return Err(PrError::EncounteredErrors(err_msg)); } - if is_merge_mode && matches.opt_present(ACROSS_OPTION) { + if is_merge_mode && matches.opt_present(options::ACROSS_OPTION) { let err_msg: String = String::from("cannot specify both printing across and printing in parallel"); return Err(PrError::EncounteredErrors(err_msg)); } - let merge_files_print: Option = if matches.opt_present(MERGE_FILES_PRINT) { + let merge_files_print: Option = if matches.opt_present(options::MERGE_FILES_PRINT) { Some(paths.len()) } else { None }; let header: String = matches - .opt_str(STRING_HEADER_OPTION) + .opt_str(options::STRING_HEADER_OPTION) .unwrap_or(if is_merge_mode { String::new() } else { @@ -582,10 +585,10 @@ fn build_options( let default_first_number: usize = NumberingMode::default().first_number; let first_number: usize = - parse_usize(matches, FIRST_LINE_NUMBER_OPTION).unwrap_or(Ok(default_first_number))?; + parse_usize(matches, options::FIRST_LINE_NUMBER_OPTION).unwrap_or(Ok(default_first_number))?; let number: Option = matches - .opt_str(NUMBERING_MODE_OPTION) + .opt_str(options::NUMBERING_MODE_OPTION) .map(|i| { let parse_result: Result = i.parse::(); @@ -610,14 +613,14 @@ fn build_options( } }) .or_else(|| { - if matches.opt_present(NUMBERING_MODE_OPTION) { + if matches.opt_present(options::NUMBERING_MODE_OPTION) { return Some(NumberingMode::default()); } None }); - let double_space: bool = matches.opt_present(DOUBLE_SPACE_OPTION); + let double_space: bool = matches.opt_present(options::DOUBLE_SPACE_OPTION); let content_line_separator: String = if double_space { "\n".repeat(2) @@ -662,14 +665,14 @@ fn build_options( }; let invalid_pages_map = |i: String| { - let unparsed_value: String = matches.opt_str(PAGE_RANGE_OPTION).unwrap(); + let unparsed_value: String = matches.opt_str(options::PAGE_RANGE_OPTION).unwrap(); i.parse::().map_err(|_e| { PrError::EncounteredErrors(format!("invalid --pages argument '{}'", unparsed_value)) }) }; let start_page: usize = match matches - .opt_str(PAGE_RANGE_OPTION) + .opt_str(options::PAGE_RANGE_OPTION) .map(|i| { let x: Vec<&str> = i.split(':').collect(); x[0].to_string() @@ -681,7 +684,7 @@ fn build_options( }; let end_page: Option = match matches - .opt_str(PAGE_RANGE_OPTION) + .opt_str(options::PAGE_RANGE_OPTION) .filter(|i: &String| i.contains(':')) .map(|i: String| { let x: Vec<&str> = i.split(':').collect(); @@ -708,12 +711,12 @@ fn build_options( }; let page_length: usize = - parse_usize(matches, PAGE_LENGTH_OPTION).unwrap_or(Ok(default_lines_per_page))?; + parse_usize(matches, options::PAGE_LENGTH_OPTION).unwrap_or(Ok(default_lines_per_page))?; let page_length_le_ht: bool = page_length < (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE); let display_header_and_trailer: bool = - !(page_length_le_ht) && !matches.opt_present(NO_HEADER_TRAILER_OPTION); + !(page_length_le_ht) && !matches.opt_present(options::NO_HEADER_TRAILER_OPTION); let content_lines_per_page: usize = if page_length_le_ht { page_length @@ -721,23 +724,23 @@ fn build_options( page_length - (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE) }; - let page_separator_char: String = if matches.opt_present(FORM_FEED_OPTION) { + let page_separator_char: String = if matches.opt_present(options::FORM_FEED_OPTION) { let bytes = vec![FF]; String::from_utf8(bytes).unwrap() } else { "\n".to_string() }; - let across_mode: bool = matches.opt_present(ACROSS_OPTION); + let across_mode: bool = matches.opt_present(options::ACROSS_OPTION); - let column_separator: String = match matches.opt_str(COLUMN_STRING_SEPARATOR_OPTION) { + let column_separator: String = match matches.opt_str(options::COLUMN_STRING_SEPARATOR_OPTION) { Some(x) => Some(x), - None => matches.opt_str(COLUMN_CHAR_SEPARATOR_OPTION), + None => matches.opt_str(options::COLUMN_CHAR_SEPARATOR_OPTION), } .unwrap_or(DEFAULT_COLUMN_SEPARATOR.to_string()); - let default_column_width = if matches.opt_present(COLUMN_WIDTH_OPTION) - && matches.opt_present(COLUMN_CHAR_SEPARATOR_OPTION) + let default_column_width = if matches.opt_present(options::COLUMN_WIDTH_OPTION) + && matches.opt_present(options::COLUMN_CHAR_SEPARATOR_OPTION) { DEFAULT_COLUMN_WIDTH_WITH_S_OPTION } else { @@ -745,12 +748,12 @@ fn build_options( }; let column_width: usize = - parse_usize(matches, COLUMN_WIDTH_OPTION).unwrap_or(Ok(default_column_width))?; + parse_usize(matches, options::COLUMN_WIDTH_OPTION).unwrap_or(Ok(default_column_width))?; - let page_width: Option = if matches.opt_present(JOIN_LINES_OPTION) { + let page_width: Option = if matches.opt_present(options::JOIN_LINES_OPTION) { None } else { - match parse_usize(matches, PAGE_WIDTH_OPTION) { + match parse_usize(matches, options::PAGE_WIDTH_OPTION) { Some(res) => Some(res?), None => None, } @@ -770,7 +773,7 @@ fn build_options( // --column has more priority than -column - let column_option_value: Option = match parse_usize(matches, COLUMN_OPTION) { + let column_option_value: Option = match parse_usize(matches, options::COLUMN_OPTION) { Some(res) => Some(res?), _ => start_column_option, }; @@ -786,8 +789,8 @@ fn build_options( }; let offset_spaces: String = - " ".repeat(parse_usize(matches, OFFSET_SPACES_OPTION).unwrap_or(Ok(0))?); - let join_lines: bool = matches.opt_present(JOIN_LINES_OPTION); + " ".repeat(parse_usize(matches, options::OFFSET_SPACES_OPTION).unwrap_or(Ok(0))?); + let join_lines: bool = matches.opt_present(options::JOIN_LINES_OPTION); let col_sep_for_printing = column_mode_options .as_ref() From 3aeccfd802f6c8edfbeda5cb31525326961b4b14 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sat, 29 May 2021 14:32:35 +0200 Subject: [PATCH 0722/1135] fix a lot of clippy warnings --- src/uu/basename/src/basename.rs | 3 +- src/uu/cp/src/cp.rs | 2 +- src/uu/factor/sieve.rs | 2 +- src/uu/head/src/parse.rs | 4 +- src/uu/install/src/install.rs | 1 + src/uu/ls/src/ls.rs | 1 + src/uu/sort/src/chunks.rs | 2 + src/uu/split/src/split.rs | 3 +- src/uu/sync/src/sync.rs | 1 + src/uu/test/src/parser.rs | 3 +- src/uu/touch/src/touch.rs | 9 +-- src/uu/tr/src/expand.rs | 2 +- src/uu/who/src/who.rs | 9 +-- src/uucore/src/lib/features/fsext.rs | 2 +- src/uucore/src/lib/features/process.rs | 1 + tests/by-util/test_base32.rs | 21 +++--- tests/by-util/test_base64.rs | 10 +-- tests/by-util/test_basename.rs | 17 +++-- tests/by-util/test_cat.rs | 23 ++++--- tests/by-util/test_chgrp.rs | 2 +- tests/by-util/test_chmod.rs | 12 +++- tests/by-util/test_chown.rs | 8 +-- tests/by-util/test_cksum.rs | 8 +-- tests/by-util/test_comm.rs | 2 +- tests/by-util/test_cp.rs | 4 +- tests/by-util/test_cut.rs | 16 ++--- tests/by-util/test_env.rs | 6 +- tests/by-util/test_factor.rs | 89 +++++++++++++------------- tests/by-util/test_head.rs | 2 +- tests/by-util/test_install.rs | 14 ++-- tests/by-util/test_ls.rs | 28 ++++---- tests/by-util/test_mkdir.rs | 14 ++-- tests/by-util/test_mktemp.rs | 20 +++--- tests/by-util/test_mv.rs | 2 +- tests/by-util/test_od.rs | 4 +- tests/by-util/test_paste.rs | 8 +-- tests/by-util/test_readlink.rs | 2 +- tests/by-util/test_relpath.rs | 1 + tests/by-util/test_shuf.rs | 22 +++---- tests/by-util/test_sort.rs | 10 +-- tests/by-util/test_split.rs | 9 +-- tests/by-util/test_stat.rs | 10 +-- tests/by-util/test_tail.rs | 26 ++++---- tests/by-util/test_touch.rs | 11 ++-- tests/by-util/test_truncate.rs | 4 +- tests/by-util/test_uniq.rs | 10 +-- tests/by-util/test_who.rs | 37 ++++++----- tests/common/util.rs | 22 +++---- 48 files changed, 269 insertions(+), 250 deletions(-) diff --git a/src/uu/basename/src/basename.rs b/src/uu/basename/src/basename.rs index e6476e436..ebd69de79 100644 --- a/src/uu/basename/src/basename.rs +++ b/src/uu/basename/src/basename.rs @@ -136,7 +136,8 @@ fn basename(fullname: &str, suffix: &str) -> String { } } -// can be replaced with strip_suffix once the minimum rust version is 1.45 +// can be replaced with strip_suffix once MSRV is 1.45 +#[allow(clippy::manual_strip)] fn strip_suffix(name: &str, suffix: &str) -> String { if name == suffix { return name.to_owned(); diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 68ad3ed84..4d9e5965e 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1108,7 +1108,7 @@ fn context_for(src: &Path, dest: &Path) -> String { /// Implements a simple backup copy for the destination file. /// TODO: for the backup, should this function be replaced by `copy_file(...)`? -fn backup_dest(dest: &Path, backup_path: &PathBuf) -> CopyResult { +fn backup_dest(dest: &Path, backup_path: &Path) -> CopyResult { fs::copy(dest, &backup_path)?; Ok(backup_path.into()) } diff --git a/src/uu/factor/sieve.rs b/src/uu/factor/sieve.rs index 41893699b..492c8159f 100644 --- a/src/uu/factor/sieve.rs +++ b/src/uu/factor/sieve.rs @@ -30,7 +30,7 @@ impl Iterator for Sieve { #[inline] fn next(&mut self) -> Option { - while let Some(n) = self.inner.next() { + for n in &mut self.inner { let mut prime = true; while let Some((next, inc)) = self.filts.peek() { // need to keep checking the min element of the heap diff --git a/src/uu/head/src/parse.rs b/src/uu/head/src/parse.rs index 470d821e0..0cf20be42 100644 --- a/src/uu/head/src/parse.rs +++ b/src/uu/head/src/parse.rs @@ -14,7 +14,7 @@ pub fn parse_obsolete(src: &str) -> Option let mut num_end = 0usize; let mut has_num = false; let mut last_char = 0 as char; - while let Some((n, c)) = chars.next() { + for (n, c) in &mut chars { if c.is_numeric() { has_num = true; num_end = n; @@ -109,7 +109,7 @@ pub fn parse_num(src: &str) -> Result<(usize, bool), ParseError> { let mut num_end = 0usize; let mut last_char = 0 as char; let mut num_count = 0usize; - while let Some((n, c)) = chars.next() { + for (n, c) in &mut chars { if c.is_numeric() { num_end = n; num_count += 1; diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index bb51a7606..7a4ad1fd1 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -520,6 +520,7 @@ fn copy_file_to_file(file: &Path, target: &Path, b: &Behavior) -> i32 { /// /// If the copy system call fails, we print a verbose error and return an empty error value. /// +#[allow(clippy::cognitive_complexity)] fn copy(from: &Path, to: &Path, b: &Behavior) -> Result<(), ()> { if b.compare && !need_copy(from, to, b) { return Ok(()); diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 17e0a16a8..60c076441 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -218,6 +218,7 @@ struct LongFormat { } impl Config { + #[allow(clippy::cognitive_complexity)] fn from(options: clap::ArgMatches) -> Config { let (mut format, opt) = if let Some(format_) = options.value_of(options::FORMAT) { ( diff --git a/src/uu/sort/src/chunks.rs b/src/uu/sort/src/chunks.rs index 6ec759211..23567833b 100644 --- a/src/uu/sort/src/chunks.rs +++ b/src/uu/sort/src/chunks.rs @@ -73,6 +73,7 @@ impl Chunk { /// * `lines`: The recycled vector to fill with lines. Must be empty. /// * `settings`: The global settings. #[allow(clippy::too_many_arguments)] +#[allow(clippy::borrowed_box)] pub fn read( sender_option: &mut Option>, mut buffer: Vec, @@ -164,6 +165,7 @@ fn parse_lines<'a>( /// The remaining bytes must be copied to the start of the buffer for the next invocation, /// if another invocation is necessary, which is determined by the other return value. /// * Whether this function should be called again. +#[allow(clippy::borrowed_box)] fn read_to_buffer( file: &mut Box, next_files: &mut impl Iterator>, diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index 726c9b8cd..39bd577cb 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -200,6 +200,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { split(&settings) } +#[allow(dead_code)] struct Settings { prefix: String, numeric_suffix: bool, @@ -210,7 +211,7 @@ struct Settings { filter: Option, strategy: String, strategy_param: String, - verbose: bool, + verbose: bool, // TODO: warning: field is never read: `verbose` } trait Splitter { diff --git a/src/uu/sync/src/sync.rs b/src/uu/sync/src/sync.rs index 985e7580d..59206db98 100644 --- a/src/uu/sync/src/sync.rs +++ b/src/uu/sync/src/sync.rs @@ -199,6 +199,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } + #[allow(clippy::if_same_then_else)] if matches.is_present(options::FILE_SYSTEM) { #[cfg(any(target_os = "linux", target_os = "windows"))] syncfs(files); diff --git a/src/uu/test/src/parser.rs b/src/uu/test/src/parser.rs index 0fcb25bd5..a77bfabb3 100644 --- a/src/uu/test/src/parser.rs +++ b/src/uu/test/src/parser.rs @@ -265,11 +265,10 @@ impl Parser { fn boolop(&mut self, op: Symbol) { if op == Symbol::BoolOp(OsString::from("-a")) { self.term(); - self.stack.push(op); } else { self.expr(); - self.stack.push(op); } + self.stack.push(op); } /// Parse a (possible) unary argument test (string length or file diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index b158fdc0e..00b936e55 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -145,14 +145,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { || matches.is_present(options::sources::CURRENT) { let timestamp = if matches.is_present(options::sources::DATE) { - parse_date(matches.value_of(options::sources::DATE).unwrap().as_ref()) + parse_date(matches.value_of(options::sources::DATE).unwrap()) } else { - parse_timestamp( - matches - .value_of(options::sources::CURRENT) - .unwrap() - .as_ref(), - ) + parse_timestamp(matches.value_of(options::sources::CURRENT).unwrap()) }; (timestamp, timestamp) } else { diff --git a/src/uu/tr/src/expand.rs b/src/uu/tr/src/expand.rs index 73612a065..7d0c61c30 100644 --- a/src/uu/tr/src/expand.rs +++ b/src/uu/tr/src/expand.rs @@ -110,7 +110,7 @@ impl<'a> Iterator for ExpandSet<'a> { fn next(&mut self) -> Option { // while the Range has elements, try to return chars from it // but make sure that they actually turn out to be Chars! - while let Some(n) = self.range.next() { + for n in &mut self.range { if let Some(c) = from_u32(n) { return Some(c); } diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index 19ae3addb..2cddbf2d0 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -551,10 +551,11 @@ impl Who { " ?".into() }; - let mut s = ut.host(); - if self.do_lookup { - s = safe_unwrap!(ut.canon_host()); - } + let s = if self.do_lookup { + safe_unwrap!(ut.canon_host()) + } else { + ut.host() + }; let hoststr = if s.is_empty() { s } else { format!("({})", s) }; self.print_line( diff --git a/src/uucore/src/lib/features/fsext.rs b/src/uucore/src/lib/features/fsext.rs index 19c634b0b..6343ecd50 100644 --- a/src/uucore/src/lib/features/fsext.rs +++ b/src/uucore/src/lib/features/fsext.rs @@ -179,7 +179,7 @@ impl MountInfo { /* for Irix 6.5 */ | "ignore" => self.dummy = true, _ => self.dummy = self.fs_type == "none" - && self.mount_option.find(MOUNT_OPT_BIND).is_none(), + && !self.mount_option.contains(MOUNT_OPT_BIND) } // set MountInfo::remote #[cfg(windows)] diff --git a/src/uucore/src/lib/features/process.rs b/src/uucore/src/lib/features/process.rs index 078b782f5..975123cf7 100644 --- a/src/uucore/src/lib/features/process.rs +++ b/src/uucore/src/lib/features/process.rs @@ -40,6 +40,7 @@ pub enum ExitStatus { Signal(i32), } +#[allow(clippy::trivially_copy_pass_by_ref)] impl ExitStatus { fn from_std_status(status: StdExitStatus) -> Self { #[cfg(unix)] diff --git a/tests/by-util/test_base32.rs b/tests/by-util/test_base32.rs index e36c376be..788b85efa 100644 --- a/tests/by-util/test_base32.rs +++ b/tests/by-util/test_base32.rs @@ -34,7 +34,7 @@ fn test_base32_encode_file() { #[test] fn test_decode() { - for decode_param in vec!["-d", "--decode"] { + for decode_param in &["-d", "--decode"] { let input = "JBSWY3DPFQQFO33SNRSCC===\n"; new_ucmd!() .arg(decode_param) @@ -56,7 +56,7 @@ fn test_garbage() { #[test] fn test_ignore_garbage() { - for ignore_garbage_param in vec!["-i", "--ignore-garbage"] { + for ignore_garbage_param in &["-i", "--ignore-garbage"] { let input = "JBSWY\x013DPFQ\x02QFO33SNRSCC===\n"; new_ucmd!() .arg("-d") @@ -69,7 +69,7 @@ fn test_ignore_garbage() { #[test] fn test_wrap() { - for wrap_param in vec!["-w", "--wrap"] { + for wrap_param in &["-w", "--wrap"] { let input = "The quick brown fox jumps over the lazy dog."; new_ucmd!() .arg(wrap_param) @@ -84,16 +84,21 @@ fn test_wrap() { #[test] fn test_wrap_no_arg() { - for wrap_param in vec!["-w", "--wrap"] { - new_ucmd!().arg(wrap_param).fails().stderr_only(format!( - "error: The argument '--wrap \' requires a value but none was supplied\n\nUSAGE:\n base32 [OPTION]... [FILE]\n\nFor more information try --help" - )); + for wrap_param in &["-w", "--wrap"] { + let expected_stderr = "error: The argument '--wrap \' requires a value but none was \ + supplied\n\nUSAGE:\n base32 [OPTION]... [FILE]\n\nFor more \ + information try --help" + .to_string(); + new_ucmd!() + .arg(wrap_param) + .fails() + .stderr_only(expected_stderr); } } #[test] fn test_wrap_bad_arg() { - for wrap_param in vec!["-w", "--wrap"] { + for wrap_param in &["-w", "--wrap"] { new_ucmd!() .arg(wrap_param) .arg("b") diff --git a/tests/by-util/test_base64.rs b/tests/by-util/test_base64.rs index 89405d791..75445c933 100644 --- a/tests/by-util/test_base64.rs +++ b/tests/by-util/test_base64.rs @@ -26,7 +26,7 @@ fn test_base64_encode_file() { #[test] fn test_decode() { - for decode_param in vec!["-d", "--decode"] { + for decode_param in &["-d", "--decode"] { let input = "aGVsbG8sIHdvcmxkIQ=="; new_ucmd!() .arg(decode_param) @@ -48,7 +48,7 @@ fn test_garbage() { #[test] fn test_ignore_garbage() { - for ignore_garbage_param in vec!["-i", "--ignore-garbage"] { + for ignore_garbage_param in &["-i", "--ignore-garbage"] { let input = "aGVsbG8sIHdvcmxkIQ==\0"; new_ucmd!() .arg("-d") @@ -61,7 +61,7 @@ fn test_ignore_garbage() { #[test] fn test_wrap() { - for wrap_param in vec!["-w", "--wrap"] { + for wrap_param in &["-w", "--wrap"] { let input = "The quick brown fox jumps over the lazy dog."; new_ucmd!() .arg(wrap_param) @@ -74,7 +74,7 @@ fn test_wrap() { #[test] fn test_wrap_no_arg() { - for wrap_param in vec!["-w", "--wrap"] { + for wrap_param in &["-w", "--wrap"] { new_ucmd!().arg(wrap_param).fails().stderr_contains( &"The argument '--wrap ' requires a value but none was supplied", ); @@ -83,7 +83,7 @@ fn test_wrap_no_arg() { #[test] fn test_wrap_bad_arg() { - for wrap_param in vec!["-w", "--wrap"] { + for wrap_param in &["-w", "--wrap"] { new_ucmd!() .arg(wrap_param) .arg("b") diff --git a/tests/by-util/test_basename.rs b/tests/by-util/test_basename.rs index 1d26a922a..50d22b2eb 100644 --- a/tests/by-util/test_basename.rs +++ b/tests/by-util/test_basename.rs @@ -4,7 +4,7 @@ use std::ffi::OsStr; #[test] fn test_help() { - for help_flg in vec!["-h", "--help"] { + for help_flg in &["-h", "--help"] { new_ucmd!() .arg(&help_flg) .succeeds() @@ -15,7 +15,7 @@ fn test_help() { #[test] fn test_version() { - for version_flg in vec!["-V", "--version"] { + for version_flg in &["-V", "--version"] { assert!(new_ucmd!() .arg(&version_flg) .succeeds() @@ -59,7 +59,7 @@ fn test_dont_remove_suffix() { #[test] fn test_multiple_param() { - for multiple_param in vec!["-a", "--multiple"] { + for &multiple_param in &["-a", "--multiple"] { let path = "/foo/bar/baz"; new_ucmd!() .args(&[multiple_param, path, path]) @@ -70,7 +70,7 @@ fn test_multiple_param() { #[test] fn test_suffix_param() { - for suffix_param in vec!["-s", "--suffix"] { + for &suffix_param in &["-s", "--suffix"] { let path = "/foo/bar/baz.exe"; new_ucmd!() .args(&[suffix_param, ".exe", path, path]) @@ -81,7 +81,7 @@ fn test_suffix_param() { #[test] fn test_zero_param() { - for zero_param in vec!["-z", "--zero"] { + for &zero_param in &["-z", "--zero"] { let path = "/foo/bar/baz"; new_ucmd!() .args(&[zero_param, "-a", path, path]) @@ -91,7 +91,12 @@ fn test_zero_param() { } fn expect_error(input: Vec<&str>) { - assert!(new_ucmd!().args(&input).fails().no_stdout().stderr().len() > 0); + assert!(!new_ucmd!() + .args(&input) + .fails() + .no_stdout() + .stderr_str() + .is_empty()); } #[test] diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index adda905b3..8ea5bbaae 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -237,7 +237,7 @@ fn test_numbered_lines_no_trailing_newline() { #[test] fn test_stdin_show_nonprinting() { - for same_param in vec!["-v", "--show-nonprinting"] { + for same_param in &["-v", "--show-nonprinting"] { new_ucmd!() .args(&[same_param]) .pipe_in("\t\0\n") @@ -248,7 +248,7 @@ fn test_stdin_show_nonprinting() { #[test] fn test_stdin_show_tabs() { - for same_param in vec!["-T", "--show-tabs"] { + for same_param in &["-T", "--show-tabs"] { new_ucmd!() .args(&[same_param]) .pipe_in("\t\0\n") @@ -259,7 +259,7 @@ fn test_stdin_show_tabs() { #[test] fn test_stdin_show_ends() { - for same_param in vec!["-E", "--show-ends"] { + for &same_param in &["-E", "--show-ends"] { new_ucmd!() .args(&[same_param, "-"]) .pipe_in("\t\0\n\t") @@ -270,7 +270,7 @@ fn test_stdin_show_ends() { #[test] fn test_stdin_show_all() { - for same_param in vec!["-A", "--show-all"] { + for same_param in &["-A", "--show-all"] { new_ucmd!() .args(&[same_param]) .pipe_in("\t\0\n") @@ -299,7 +299,7 @@ fn test_stdin_nonprinting_and_tabs() { #[test] fn test_stdin_squeeze_blank() { - for same_param in vec!["-s", "--squeeze-blank"] { + for same_param in &["-s", "--squeeze-blank"] { new_ucmd!() .arg(same_param) .pipe_in("\n\na\n\n\n\n\nb\n\n\n") @@ -310,7 +310,7 @@ fn test_stdin_squeeze_blank() { #[test] fn test_stdin_number_non_blank() { - for same_param in vec!["-b", "--number-nonblank"] { + for same_param in &["-b", "--number-nonblank"] { new_ucmd!() .arg(same_param) .arg("-") @@ -322,7 +322,7 @@ fn test_stdin_number_non_blank() { #[test] fn test_non_blank_overrides_number() { - for same_param in vec!["-b", "--number-nonblank"] { + for &same_param in &["-b", "--number-nonblank"] { new_ucmd!() .args(&[same_param, "-"]) .pipe_in("\na\nb\n\n\nc") @@ -333,7 +333,7 @@ fn test_non_blank_overrides_number() { #[test] fn test_squeeze_blank_before_numbering() { - for same_param in vec!["-s", "--squeeze-blank"] { + for &same_param in &["-s", "--squeeze-blank"] { new_ucmd!() .args(&[same_param, "-n", "-"]) .pipe_in("a\n\n\nb") @@ -408,7 +408,10 @@ fn test_domain_socket() { use std::thread; use unix_socket::UnixListener; - let dir = tempfile::Builder::new().prefix("unix_socket").tempdir().expect("failed to create dir"); + let dir = tempfile::Builder::new() + .prefix("unix_socket") + .tempdir() + .expect("failed to create dir"); let socket_path = dir.path().join("sock"); let listener = UnixListener::bind(&socket_path).expect("failed to create socket"); @@ -426,7 +429,7 @@ fn test_domain_socket() { let child = new_ucmd!().args(&[socket_path]).run_no_wait(); barrier.wait(); - let stdout = &child.wait_with_output().unwrap().stdout.clone(); + let stdout = &child.wait_with_output().unwrap().stdout; let output = String::from_utf8_lossy(&stdout); assert_eq!("a\tb", output); diff --git a/tests/by-util/test_chgrp.rs b/tests/by-util/test_chgrp.rs index a7848b1b6..c0fc503ae 100644 --- a/tests/by-util/test_chgrp.rs +++ b/tests/by-util/test_chgrp.rs @@ -6,7 +6,7 @@ fn test_invalid_option() { new_ucmd!().arg("-w").arg("/").fails(); } -static DIR: &'static str = "/tmp"; +static DIR: &str = "/tmp"; #[test] fn test_invalid_group() { diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index f20429a6e..4611d1b96 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -8,8 +8,8 @@ use self::chmod::strip_minus_from_mode; extern crate chmod; use self::libc::umask; -static TEST_FILE: &'static str = "file"; -static REFERENCE_FILE: &'static str = "reference"; +static TEST_FILE: &str = "file"; +static REFERENCE_FILE: &str = "reference"; static REFERENCE_PERMS: u32 = 0o247; lazy_static! { static ref UMASK_MUTEX: Mutex<()> = Mutex::new(()); @@ -69,6 +69,7 @@ fn run_tests(tests: Vec) { } #[test] +#[allow(clippy::unreadable_literal)] fn test_chmod_octal() { let tests = vec![ TestCase { @@ -121,6 +122,7 @@ fn test_chmod_octal() { } #[test] +#[allow(clippy::unreadable_literal)] fn test_chmod_ugoa() { let _guard = UMASK_MUTEX.lock(); @@ -216,6 +218,7 @@ fn test_chmod_ugoa() { } #[test] +#[allow(clippy::unreadable_literal)] fn test_chmod_ugo_copy() { let tests = vec![ TestCase { @@ -248,6 +251,7 @@ fn test_chmod_ugo_copy() { } #[test] +#[allow(clippy::unreadable_literal)] fn test_chmod_many_options() { let _guard = UMASK_MUTEX.lock(); @@ -264,6 +268,7 @@ fn test_chmod_many_options() { } #[test] +#[allow(clippy::unreadable_literal)] fn test_chmod_reference_file() { let tests = vec![ TestCase { @@ -303,6 +308,7 @@ fn test_permission_denied() { } #[test] +#[allow(clippy::unreadable_literal)] fn test_chmod_recursive() { let _guard = UMASK_MUTEX.lock(); @@ -477,7 +483,7 @@ fn test_chmod_strip_minus_from_mode() { ]; for test in tests { - let mut args: Vec = test.0.split(" ").map(|v| v.to_string()).collect(); + let mut args: Vec = test.0.split(' ').map(|v| v.to_string()).collect(); let _mode_had_minus_prefix = strip_minus_from_mode(&mut args); assert_eq!(test.1, args.join(" ")); } diff --git a/tests/by-util/test_chown.rs b/tests/by-util/test_chown.rs index 3d94632a6..a531fc7f3 100644 --- a/tests/by-util/test_chown.rs +++ b/tests/by-util/test_chown.rs @@ -39,7 +39,7 @@ mod test_passgrp { #[test] fn test_usr2uid() { assert_eq!(0, usr2uid("root").unwrap()); - assert!(usr2uid("88888888").is_err()); + assert!(usr2uid("88_888_888").is_err()); assert!(usr2uid("auserthatdoesntexist").is_err()); } @@ -50,14 +50,14 @@ mod test_passgrp { } else { assert_eq!(0, grp2gid("wheel").unwrap()); } - assert!(grp2gid("88888888").is_err()); + assert!(grp2gid("88_888_888").is_err()); assert!(grp2gid("agroupthatdoesntexist").is_err()); } #[test] fn test_uid2usr() { assert_eq!("root", uid2usr(0).unwrap()); - assert!(uid2usr(88888888).is_err()); + assert!(uid2usr(88_888_888).is_err()); } #[test] @@ -67,7 +67,7 @@ mod test_passgrp { } else { assert_eq!("wheel", gid2grp(0).unwrap()); } - assert!(gid2grp(88888888).is_err()); + assert!(gid2grp(88_888_888).is_err()); } } diff --git a/tests/by-util/test_cksum.rs b/tests/by-util/test_cksum.rs index 81ef4c177..0fd028781 100644 --- a/tests/by-util/test_cksum.rs +++ b/tests/by-util/test_cksum.rs @@ -85,12 +85,12 @@ fn test_crc_for_bigger_than_32_bytes() { let result = ucmd.arg("chars.txt").succeeds(); - let mut stdout_splitted = result.stdout_str().split(" "); + let mut stdout_splitted = result.stdout_str().split(' '); let cksum: i64 = stdout_splitted.next().unwrap().parse().unwrap(); let bytes_cnt: i64 = stdout_splitted.next().unwrap().parse().unwrap(); - assert_eq!(cksum, 586047089); + assert_eq!(cksum, 586_047_089); assert_eq!(bytes_cnt, 16); } @@ -100,11 +100,11 @@ fn test_stdin_larger_than_128_bytes() { let result = ucmd.arg("larger_than_2056_bytes.txt").succeeds(); - let mut stdout_splitted = result.stdout_str().split(" "); + let mut stdout_splitted = result.stdout_str().split(' '); let cksum: i64 = stdout_splitted.next().unwrap().parse().unwrap(); let bytes_cnt: i64 = stdout_splitted.next().unwrap().parse().unwrap(); - assert_eq!(cksum, 945881979); + assert_eq!(cksum, 945_881_979); assert_eq!(bytes_cnt, 2058); } diff --git a/tests/by-util/test_comm.rs b/tests/by-util/test_comm.rs index 23aeb8309..fa8c8beca 100644 --- a/tests/by-util/test_comm.rs +++ b/tests/by-util/test_comm.rs @@ -74,7 +74,7 @@ fn output_delimiter_require_arg() { #[cfg_attr(not(feature = "test_unimplemented"), ignore)] #[test] fn zero_terminated() { - for param in vec!["-z", "--zero-terminated"] { + for ¶m in &["-z", "--zero-terminated"] { new_ucmd!() .args(&[param, "a", "b"]) .fails() diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index d49219b04..e4d7fdea7 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -108,7 +108,7 @@ fn test_cp_multiple_files() { #[test] // FixME: for MacOS, this has intermittent failures; track repair progress at GH:uutils/coreutils/issues/1590 -#[cfg(not(macos))] +#[cfg(not(target_os = "macos"))] fn test_cp_recurse() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.arg("-r") @@ -132,7 +132,7 @@ fn test_cp_with_dirs_t() { #[test] // FixME: for MacOS, this has intermittent failures; track repair progress at GH:uutils/coreutils/issues/1590 -#[cfg(not(macos))] +#[cfg(not(target_os = "macos"))] fn test_cp_with_dirs() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; diff --git a/tests/by-util/test_cut.rs b/tests/by-util/test_cut.rs index 413b73154..8f81b94c1 100644 --- a/tests/by-util/test_cut.rs +++ b/tests/by-util/test_cut.rs @@ -1,13 +1,13 @@ use crate::common::util::*; -static INPUT: &'static str = "lists.txt"; +static INPUT: &str = "lists.txt"; struct TestedSequence<'b> { name: &'b str, sequence: &'b str, } -static EXAMPLE_SEQUENCES: &'static [TestedSequence<'static>] = &[ +static EXAMPLE_SEQUENCES: &[TestedSequence] = &[ TestedSequence { name: "singular", sequence: "2", @@ -34,14 +34,14 @@ static EXAMPLE_SEQUENCES: &'static [TestedSequence<'static>] = &[ }, ]; -static COMPLEX_SEQUENCE: &'static TestedSequence<'static> = &TestedSequence { +static COMPLEX_SEQUENCE: &TestedSequence = &TestedSequence { name: "", sequence: "9-,6-7,-2,4", }; #[test] fn test_byte_sequence() { - for param in vec!["-b", "--bytes"] { + for ¶m in &["-b", "--bytes"] { for example_seq in EXAMPLE_SEQUENCES { new_ucmd!() .args(&[param, example_seq.sequence, INPUT]) @@ -53,7 +53,7 @@ fn test_byte_sequence() { #[test] fn test_char_sequence() { - for param in vec!["-c", "--characters"] { + for ¶m in &["-c", "--characters"] { for example_seq in EXAMPLE_SEQUENCES { //as of coreutils 8.25 a char range is effectively the same as a byte range; there is no distinct treatment of utf8 chars. new_ucmd!() @@ -66,7 +66,7 @@ fn test_char_sequence() { #[test] fn test_field_sequence() { - for param in vec!["-f", "--fields"] { + for ¶m in &["-f", "--fields"] { for example_seq in EXAMPLE_SEQUENCES { new_ucmd!() .args(&[param, example_seq.sequence, INPUT]) @@ -78,7 +78,7 @@ fn test_field_sequence() { #[test] fn test_specify_delimiter() { - for param in vec!["-d", "--delimiter"] { + for ¶m in &["-d", "--delimiter"] { new_ucmd!() .args(&[param, ":", "-f", COMPLEX_SEQUENCE.sequence, INPUT]) .succeeds() @@ -122,7 +122,7 @@ fn test_zero_terminated() { #[test] fn test_only_delimited() { - for param in vec!["-s", "--only-delimited"] { + for param in &["-s", "--only-delimited"] { new_ucmd!() .args(&["-d_", param, "-f", "1"]) .pipe_in("91\n82\n7_3") diff --git a/tests/by-util/test_env.rs b/tests/by-util/test_env.rs index e86a41783..23bba57a9 100644 --- a/tests/by-util/test_env.rs +++ b/tests/by-util/test_env.rs @@ -118,7 +118,7 @@ fn test_null_delimiter() { let mut vars: Vec<_> = out.split('\0').collect(); assert_eq!(vars.len(), 3); - vars.sort(); + vars.sort_unstable(); assert_eq!(vars[0], ""); assert_eq!(vars[1], "ABC=xyz"); assert_eq!(vars[2], "FOO=bar"); @@ -135,7 +135,7 @@ fn test_unset_variable() { .succeeds() .stdout_move_str(); - assert_eq!(out.lines().any(|line| line.starts_with("HOME=")), false); + assert!(!out.lines().any(|line| line.starts_with("HOME="))); } #[test] @@ -196,7 +196,7 @@ fn test_change_directory() { fn test_fail_change_directory() { let scene = TestScenario::new(util_name!()); let some_non_existing_path = "some_nonexistent_path"; - assert_eq!(Path::new(some_non_existing_path).is_dir(), false); + assert!(!Path::new(some_non_existing_path).is_dir()); let out = scene .ucmd() diff --git a/tests/by-util/test_factor.rs b/tests/by-util/test_factor.rs index af2ff4ddb..963b82ed8 100644 --- a/tests/by-util/test_factor.rs +++ b/tests/by-util/test_factor.rs @@ -4,6 +4,7 @@ // // For the full copyright and license information, please view the LICENSE file // that was distributed with this source code. +#![allow(clippy::unreadable_literal)] use crate::common::util::*; use std::time::SystemTime; @@ -77,7 +78,7 @@ fn test_random() { }; } - factors.sort(); + factors.sort_unstable(); (product, factors) }; @@ -92,7 +93,7 @@ fn test_random() { for factor in factors { outstring.push_str(&(format!(" {}", factor))[..]); } - outstring.push_str("\n"); + outstring.push('\n'); } run(instring.as_bytes(), outstring.as_bytes()); @@ -131,7 +132,7 @@ fn test_random_big() { f_bits.push(extrarange.sample(&mut rng)); } f_bits.push(extrabits); - f_bits.sort(); + f_bits.sort_unstable(); // compute sequential differences here. We leave off the +14 bits // so we can just index PRIMES_BY_BITS @@ -160,7 +161,7 @@ fn test_random_big() { } assert_eq!(nbits, 64); - factors.sort(); + factors.sort_unstable(); (product, factors) }; @@ -174,7 +175,7 @@ fn test_random_big() { for factor in factors { outstring.push_str(&(format!(" {}", factor))[..]); } - outstring.push_str("\n"); + outstring.push('\n'); } run(instring.as_bytes(), outstring.as_bytes()); @@ -202,7 +203,7 @@ fn run(instring: &[u8], outstring: &[u8]) { .stdout_is(String::from_utf8(outstring.to_owned()).unwrap()); } -const PRIMES_BY_BITS: &'static [&'static [u64]] = &[ +const PRIMES_BY_BITS: &[&[u64]] = &[ PRIMES14, PRIMES15, PRIMES16, PRIMES17, PRIMES18, PRIMES19, PRIMES20, PRIMES21, PRIMES22, PRIMES23, PRIMES24, PRIMES25, PRIMES26, PRIMES27, PRIMES28, PRIMES29, PRIMES30, PRIMES31, PRIMES32, PRIMES33, PRIMES34, PRIMES35, PRIMES36, PRIMES37, PRIMES38, PRIMES39, PRIMES40, @@ -210,7 +211,7 @@ const PRIMES_BY_BITS: &'static [&'static [u64]] = &[ PRIMES50, ]; -const PRIMES64: &'static [u64] = &[ +const PRIMES64: &[u64] = &[ 18446744073709551557, 18446744073709551533, 18446744073709551521, @@ -262,7 +263,7 @@ const PRIMES64: &'static [u64] = &[ 18446744073709549571, ]; -const PRIMES14: &'static [u64] = &[ +const PRIMES14: &[u64] = &[ 16381, 16369, 16363, 16361, 16349, 16339, 16333, 16319, 16301, 16273, 16267, 16253, 16249, 16231, 16229, 16223, 16217, 16193, 16189, 16187, 16183, 16141, 16139, 16127, 16111, 16103, 16097, 16091, 16087, 16073, 16069, 16067, 16063, 16061, 16057, 16033, 16007, 16001, 15991, @@ -274,7 +275,7 @@ const PRIMES14: &'static [u64] = &[ 15373, ]; -const PRIMES15: &'static [u64] = &[ +const PRIMES15: &[u64] = &[ 32749, 32719, 32717, 32713, 32707, 32693, 32687, 32653, 32647, 32633, 32621, 32611, 32609, 32603, 32587, 32579, 32573, 32569, 32563, 32561, 32537, 32533, 32531, 32507, 32503, 32497, 32491, 32479, 32467, 32443, 32441, 32429, 32423, 32413, 32411, 32401, 32381, 32377, 32371, @@ -285,7 +286,7 @@ const PRIMES15: &'static [u64] = &[ 31847, 31817, 31799, 31793, 31771, 31769, 31751, ]; -const PRIMES16: &'static [u64] = &[ +const PRIMES16: &[u64] = &[ 65521, 65519, 65497, 65479, 65449, 65447, 65437, 65423, 65419, 65413, 65407, 65393, 65381, 65371, 65357, 65353, 65327, 65323, 65309, 65293, 65287, 65269, 65267, 65257, 65239, 65213, 65203, 65183, 65179, 65173, 65171, 65167, 65147, 65141, 65129, 65123, 65119, 65111, 65101, @@ -295,7 +296,7 @@ const PRIMES16: &'static [u64] = &[ 64627, 64621, 64613, 64609, 64601, 64591, 64579, 64577, 64567, 64553, ]; -const PRIMES17: &'static [u64] = &[ +const PRIMES17: &[u64] = &[ 131071, 131063, 131059, 131041, 131023, 131011, 131009, 130987, 130981, 130973, 130969, 130957, 130927, 130873, 130859, 130843, 130841, 130829, 130817, 130811, 130807, 130787, 130783, 130769, 130729, 130699, 130693, 130687, 130681, 130657, 130651, 130649, 130643, 130639, 130633, 130631, @@ -306,7 +307,7 @@ const PRIMES17: &'static [u64] = &[ 130073, 130069, 130057, 130051, ]; -const PRIMES18: &'static [u64] = &[ +const PRIMES18: &[u64] = &[ 262139, 262133, 262127, 262121, 262111, 262109, 262103, 262079, 262069, 262051, 262049, 262027, 262007, 261983, 261977, 261973, 261971, 261959, 261917, 261887, 261881, 261847, 261823, 261799, 261791, 261787, 261773, 261761, 261757, 261739, 261721, 261713, 261707, 261697, 261673, 261643, @@ -316,7 +317,7 @@ const PRIMES18: &'static [u64] = &[ 261169, 261167, 261127, ]; -const PRIMES19: &'static [u64] = &[ +const PRIMES19: &[u64] = &[ 524287, 524269, 524261, 524257, 524243, 524231, 524221, 524219, 524203, 524201, 524197, 524189, 524171, 524149, 524123, 524119, 524113, 524099, 524087, 524081, 524071, 524063, 524057, 524053, 524047, 523997, 523987, 523969, 523949, 523937, 523927, 523907, 523903, 523877, 523867, 523847, @@ -326,7 +327,7 @@ const PRIMES19: &'static [u64] = &[ 523403, 523387, 523357, 523351, 523349, 523333, 523307, 523297, ]; -const PRIMES20: &'static [u64] = &[ +const PRIMES20: &[u64] = &[ 1048573, 1048571, 1048559, 1048549, 1048517, 1048507, 1048447, 1048433, 1048423, 1048391, 1048387, 1048367, 1048361, 1048357, 1048343, 1048309, 1048291, 1048273, 1048261, 1048219, 1048217, 1048213, 1048193, 1048189, 1048139, 1048129, 1048127, 1048123, 1048063, 1048051, @@ -336,7 +337,7 @@ const PRIMES20: &'static [u64] = &[ 1047691, 1047689, 1047671, 1047667, 1047653, 1047649, 1047647, 1047589, 1047587, 1047559, ]; -const PRIMES21: &'static [u64] = &[ +const PRIMES21: &[u64] = &[ 2097143, 2097133, 2097131, 2097097, 2097091, 2097083, 2097047, 2097041, 2097031, 2097023, 2097013, 2096993, 2096987, 2096971, 2096959, 2096957, 2096947, 2096923, 2096911, 2096909, 2096893, 2096881, 2096873, 2096867, 2096851, 2096837, 2096807, 2096791, 2096789, 2096777, @@ -346,7 +347,7 @@ const PRIMES21: &'static [u64] = &[ 2096221, 2096209, 2096191, 2096183, 2096147, ]; -const PRIMES22: &'static [u64] = &[ +const PRIMES22: &[u64] = &[ 4194301, 4194287, 4194277, 4194271, 4194247, 4194217, 4194199, 4194191, 4194187, 4194181, 4194173, 4194167, 4194143, 4194137, 4194131, 4194107, 4194103, 4194023, 4194011, 4194007, 4193977, 4193971, 4193963, 4193957, 4193939, 4193929, 4193909, 4193869, 4193807, 4193803, @@ -356,7 +357,7 @@ const PRIMES22: &'static [u64] = &[ 4193297, ]; -const PRIMES23: &'static [u64] = &[ +const PRIMES23: &[u64] = &[ 8388593, 8388587, 8388581, 8388571, 8388547, 8388539, 8388473, 8388461, 8388451, 8388449, 8388439, 8388427, 8388421, 8388409, 8388377, 8388371, 8388319, 8388301, 8388287, 8388283, 8388277, 8388239, 8388209, 8388187, 8388113, 8388109, 8388091, 8388071, 8388059, 8388019, @@ -365,7 +366,7 @@ const PRIMES23: &'static [u64] = &[ 8387723, 8387707, 8387671, 8387611, 8387609, 8387591, ]; -const PRIMES24: &'static [u64] = &[ +const PRIMES24: &[u64] = &[ 16777213, 16777199, 16777183, 16777153, 16777141, 16777139, 16777127, 16777121, 16777099, 16777049, 16777027, 16776989, 16776973, 16776971, 16776967, 16776961, 16776941, 16776937, 16776931, 16776919, 16776901, 16776899, 16776869, 16776857, 16776839, 16776833, 16776817, @@ -375,7 +376,7 @@ const PRIMES24: &'static [u64] = &[ 16776317, 16776313, 16776289, 16776217, 16776211, ]; -const PRIMES25: &'static [u64] = &[ +const PRIMES25: &[u64] = &[ 33554393, 33554383, 33554371, 33554347, 33554341, 33554317, 33554291, 33554273, 33554267, 33554249, 33554239, 33554221, 33554201, 33554167, 33554159, 33554137, 33554123, 33554093, 33554083, 33554077, 33554051, 33554021, 33554011, 33554009, 33553999, 33553991, 33553969, @@ -385,7 +386,7 @@ const PRIMES25: &'static [u64] = &[ 33553519, 33553517, 33553511, 33553489, 33553463, 33553451, 33553417, ]; -const PRIMES26: &'static [u64] = &[ +const PRIMES26: &[u64] = &[ 67108859, 67108837, 67108819, 67108777, 67108763, 67108757, 67108753, 67108747, 67108739, 67108729, 67108721, 67108709, 67108693, 67108669, 67108667, 67108661, 67108649, 67108633, 67108597, 67108579, 67108529, 67108511, 67108507, 67108493, 67108471, 67108463, 67108453, @@ -396,7 +397,7 @@ const PRIMES26: &'static [u64] = &[ 67107863, ]; -const PRIMES27: &'static [u64] = &[ +const PRIMES27: &[u64] = &[ 134217689, 134217649, 134217617, 134217613, 134217593, 134217541, 134217529, 134217509, 134217497, 134217493, 134217487, 134217467, 134217439, 134217437, 134217409, 134217403, 134217401, 134217367, 134217361, 134217353, 134217323, 134217301, 134217277, 134217257, @@ -407,7 +408,7 @@ const PRIMES27: &'static [u64] = &[ 134216737, 134216729, ]; -const PRIMES28: &'static [u64] = &[ +const PRIMES28: &[u64] = &[ 268435399, 268435367, 268435361, 268435337, 268435331, 268435313, 268435291, 268435273, 268435243, 268435183, 268435171, 268435157, 268435147, 268435133, 268435129, 268435121, 268435109, 268435091, 268435067, 268435043, 268435039, 268435033, 268435019, 268435009, @@ -418,7 +419,7 @@ const PRIMES28: &'static [u64] = &[ 268434479, 268434461, ]; -const PRIMES29: &'static [u64] = &[ +const PRIMES29: &[u64] = &[ 536870909, 536870879, 536870869, 536870849, 536870839, 536870837, 536870819, 536870813, 536870791, 536870779, 536870767, 536870743, 536870729, 536870723, 536870717, 536870701, 536870683, 536870657, 536870641, 536870627, 536870611, 536870603, 536870599, 536870573, @@ -428,7 +429,7 @@ const PRIMES29: &'static [u64] = &[ 536870027, 536869999, 536869951, 536869943, 536869937, 536869919, 536869901, 536869891, ]; -const PRIMES30: &'static [u64] = &[ +const PRIMES30: &[u64] = &[ 1073741789, 1073741783, 1073741741, 1073741723, 1073741719, 1073741717, 1073741689, 1073741671, 1073741663, 1073741651, 1073741621, 1073741567, 1073741561, 1073741527, 1073741503, 1073741477, 1073741467, 1073741441, 1073741419, 1073741399, 1073741387, 1073741381, 1073741371, 1073741329, @@ -437,7 +438,7 @@ const PRIMES30: &'static [u64] = &[ 1073740853, 1073740847, 1073740819, 1073740807, ]; -const PRIMES31: &'static [u64] = &[ +const PRIMES31: &[u64] = &[ 2147483647, 2147483629, 2147483587, 2147483579, 2147483563, 2147483549, 2147483543, 2147483497, 2147483489, 2147483477, 2147483423, 2147483399, 2147483353, 2147483323, 2147483269, 2147483249, 2147483237, 2147483179, 2147483171, 2147483137, 2147483123, 2147483077, 2147483069, 2147483059, @@ -446,7 +447,7 @@ const PRIMES31: &'static [u64] = &[ 2147482763, 2147482739, 2147482697, 2147482693, 2147482681, 2147482663, 2147482661, ]; -const PRIMES32: &'static [u64] = &[ +const PRIMES32: &[u64] = &[ 4294967291, 4294967279, 4294967231, 4294967197, 4294967189, 4294967161, 4294967143, 4294967111, 4294967087, 4294967029, 4294966997, 4294966981, 4294966943, 4294966927, 4294966909, 4294966877, 4294966829, 4294966813, 4294966769, 4294966667, 4294966661, 4294966657, 4294966651, 4294966639, @@ -454,7 +455,7 @@ const PRIMES32: &'static [u64] = &[ 4294966373, 4294966367, 4294966337, 4294966297, ]; -const PRIMES33: &'static [u64] = &[ +const PRIMES33: &[u64] = &[ 8589934583, 8589934567, 8589934543, 8589934513, 8589934487, 8589934307, 8589934291, 8589934289, 8589934271, 8589934237, 8589934211, 8589934207, 8589934201, 8589934187, 8589934151, 8589934141, 8589934139, 8589934117, 8589934103, 8589934099, 8589934091, 8589934069, 8589934049, 8589934027, @@ -463,7 +464,7 @@ const PRIMES33: &'static [u64] = &[ 8589933647, 8589933641, 8589933637, 8589933631, 8589933629, 8589933619, 8589933601, 8589933581, ]; -const PRIMES34: &'static [u64] = &[ +const PRIMES34: &[u64] = &[ 17179869143, 17179869107, 17179869071, @@ -514,7 +515,7 @@ const PRIMES34: &'static [u64] = &[ 17179868183, ]; -const PRIMES35: &'static [u64] = &[ +const PRIMES35: &[u64] = &[ 34359738337, 34359738319, 34359738307, @@ -547,7 +548,7 @@ const PRIMES35: &'static [u64] = &[ 34359737371, ]; -const PRIMES36: &'static [u64] = &[ +const PRIMES36: &[u64] = &[ 68719476731, 68719476719, 68719476713, @@ -599,7 +600,7 @@ const PRIMES36: &'static [u64] = &[ 68719475729, ]; -const PRIMES37: &'static [u64] = &[ +const PRIMES37: &[u64] = &[ 137438953447, 137438953441, 137438953427, @@ -625,7 +626,7 @@ const PRIMES37: &'static [u64] = &[ 137438952491, ]; -const PRIMES38: &'static [u64] = &[ +const PRIMES38: &[u64] = &[ 274877906899, 274877906857, 274877906837, @@ -665,7 +666,7 @@ const PRIMES38: &'static [u64] = &[ 274877905931, ]; -const PRIMES39: &'static [u64] = &[ +const PRIMES39: &[u64] = &[ 549755813881, 549755813869, 549755813821, @@ -711,7 +712,7 @@ const PRIMES39: &'static [u64] = &[ 549755812867, ]; -const PRIMES40: &'static [u64] = &[ +const PRIMES40: &[u64] = &[ 1099511627689, 1099511627609, 1099511627581, @@ -741,7 +742,7 @@ const PRIMES40: &'static [u64] = &[ 1099511626771, ]; -const PRIMES41: &'static [u64] = &[ +const PRIMES41: &[u64] = &[ 2199023255531, 2199023255521, 2199023255497, @@ -780,7 +781,7 @@ const PRIMES41: &'static [u64] = &[ 2199023254567, ]; -const PRIMES42: &'static [u64] = &[ +const PRIMES42: &[u64] = &[ 4398046511093, 4398046511087, 4398046511071, @@ -820,7 +821,7 @@ const PRIMES42: &'static [u64] = &[ 4398046510093, ]; -const PRIMES43: &'static [u64] = &[ +const PRIMES43: &[u64] = &[ 8796093022151, 8796093022141, 8796093022091, @@ -855,7 +856,7 @@ const PRIMES43: &'static [u64] = &[ 8796093021269, ]; -const PRIMES44: &'static [u64] = &[ +const PRIMES44: &[u64] = &[ 17592186044399, 17592186044299, 17592186044297, @@ -888,7 +889,7 @@ const PRIMES44: &'static [u64] = &[ 17592186043409, ]; -const PRIMES45: &'static [u64] = &[ +const PRIMES45: &[u64] = &[ 35184372088777, 35184372088763, 35184372088751, @@ -929,7 +930,7 @@ const PRIMES45: &'static [u64] = &[ 35184372087869, ]; -const PRIMES46: &'static [u64] = &[ +const PRIMES46: &[u64] = &[ 70368744177643, 70368744177607, 70368744177601, @@ -964,7 +965,7 @@ const PRIMES46: &'static [u64] = &[ 70368744176711, ]; -const PRIMES47: &'static [u64] = &[ +const PRIMES47: &[u64] = &[ 140737488355213, 140737488355201, 140737488355181, @@ -986,7 +987,7 @@ const PRIMES47: &'static [u64] = &[ 140737488354329, ]; -const PRIMES48: &'static [u64] = &[ +const PRIMES48: &[u64] = &[ 281474976710597, 281474976710591, 281474976710567, @@ -1019,7 +1020,7 @@ const PRIMES48: &'static [u64] = &[ 281474976709637, ]; -const PRIMES49: &'static [u64] = &[ +const PRIMES49: &[u64] = &[ 562949953421231, 562949953421201, 562949953421189, @@ -1053,7 +1054,7 @@ const PRIMES49: &'static [u64] = &[ 562949953420297, ]; -const PRIMES50: &'static [u64] = &[ +const PRIMES50: &[u64] = &[ 1125899906842597, 1125899906842589, 1125899906842573, diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index b2a3cf0cb..cf7c9c2ee 100755 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -1,6 +1,6 @@ use crate::common::util::*; -static INPUT: &'static str = "lorem_ipsum.txt"; +static INPUT: &str = "lorem_ipsum.txt"; #[test] fn test_stdin_default() { diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index fb79454c1..6da357170 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -116,11 +116,11 @@ fn test_install_ancestors_mode_directories() { assert!(at.dir_exists(ancestor2)); assert!(at.dir_exists(target_dir)); - assert_ne!(0o40700 as u32, at.metadata(ancestor1).permissions().mode()); - assert_ne!(0o40700 as u32, at.metadata(ancestor2).permissions().mode()); + assert_ne!(0o40_700_u32, at.metadata(ancestor1).permissions().mode()); + assert_ne!(0o40_700_u32, at.metadata(ancestor2).permissions().mode()); // Expected mode only on the target_dir. - assert_eq!(0o40700 as u32, at.metadata(target_dir).permissions().mode()); + assert_eq!(0o40_700_u32, at.metadata(target_dir).permissions().mode()); } #[test] @@ -184,7 +184,7 @@ fn test_install_mode_numeric() { assert!(at.file_exists(file)); assert!(at.file_exists(dest_file)); let permissions = at.metadata(dest_file).permissions(); - assert_eq!(0o100333 as u32, PermissionsExt::mode(&permissions)); + assert_eq!(0o100_333_u32, PermissionsExt::mode(&permissions)); let mode_arg = "-m 0333"; at.mkdir(dir2); @@ -195,7 +195,7 @@ fn test_install_mode_numeric() { assert!(at.file_exists(file)); assert!(at.file_exists(dest_file)); let permissions = at.metadata(dest_file).permissions(); - assert_eq!(0o100333 as u32, PermissionsExt::mode(&permissions)); + assert_eq!(0o100_333_u32, PermissionsExt::mode(&permissions)); } #[test] @@ -213,7 +213,7 @@ fn test_install_mode_symbolic() { assert!(at.file_exists(file)); assert!(at.file_exists(dest_file)); let permissions = at.metadata(dest_file).permissions(); - assert_eq!(0o100003 as u32, PermissionsExt::mode(&permissions)); + assert_eq!(0o100_003_u32, PermissionsExt::mode(&permissions)); } #[test] @@ -251,7 +251,7 @@ fn test_install_mode_directories() { assert!(at.dir_exists(component)); let permissions = at.metadata(component).permissions(); - assert_eq!(0o040333 as u32, PermissionsExt::mode(&permissions)); + assert_eq!(0o040_333_u32, PermissionsExt::mode(&permissions)); } #[test] diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 01c5ab5c4..d884948e6 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -51,6 +51,7 @@ fn test_ls_a() { .unwrap(), ); + #[allow(clippy::trivial_regex)] let re_pwd = Regex::new(r"^\.\n").unwrap(); // Using the present working directory @@ -124,7 +125,7 @@ fn test_ls_width() { for option in &["-w 100", "-w=100", "--width=100", "--width 100"] { scene .ucmd() - .args(&option.split(" ").collect::>()) + .args(&option.split(' ').collect::>()) .succeeds() .stdout_only("test-width-1 test-width-2 test-width-3 test-width-4\n"); } @@ -132,7 +133,7 @@ fn test_ls_width() { for option in &["-w 50", "-w=50", "--width=50", "--width 50"] { scene .ucmd() - .args(&option.split(" ").collect::>()) + .args(&option.split(' ').collect::>()) .succeeds() .stdout_only("test-width-1 test-width-3\ntest-width-2 test-width-4\n"); } @@ -149,7 +150,7 @@ fn test_ls_width() { ] { scene .ucmd() - .args(&option.split(" ").collect::>()) + .args(&option.split(' ').collect::>()) .succeeds() .stdout_only("test-width-1\ntest-width-2\ntest-width-3\ntest-width-4\n"); } @@ -163,7 +164,7 @@ fn test_ls_width() { for option in &["-w 1a", "-w=1a", "--width=1a", "--width 1a"] { scene .ucmd() - .args(&option.split(" ").collect::>()) + .args(&option.split(' ').collect::>()) .fails() .stderr_only("ls: invalid line width: ‘1a’"); } @@ -417,7 +418,7 @@ fn test_ls_long_formats() { ] { let result = scene .ucmd() - .args(&arg.split(" ").collect::>()) + .args(&arg.split(' ').collect::>()) .arg("test-long-formats") .succeeds(); assert!(re_two.is_match(result.stdout_str())); @@ -427,7 +428,7 @@ fn test_ls_long_formats() { let result = scene .ucmd() .arg("-n") - .args(&arg.split(" ").collect::>()) + .args(&arg.split(' ').collect::>()) .arg("test-long-formats") .succeeds(); assert!(re_two_num.is_match(result.stdout_str())); @@ -446,7 +447,7 @@ fn test_ls_long_formats() { ] { let result = scene .ucmd() - .args(&arg.split(" ").collect::>()) + .args(&arg.split(' ').collect::>()) .arg("test-long-formats") .succeeds(); assert!(re_one.is_match(result.stdout_str())); @@ -456,7 +457,7 @@ fn test_ls_long_formats() { let result = scene .ucmd() .arg("-n") - .args(&arg.split(" ").collect::>()) + .args(&arg.split(' ').collect::>()) .arg("test-long-formats") .succeeds(); assert!(re_one_num.is_match(result.stdout_str())); @@ -478,7 +479,7 @@ fn test_ls_long_formats() { ] { let result = scene .ucmd() - .args(&arg.split(" ").collect::>()) + .args(&arg.split(' ').collect::>()) .arg("test-long-formats") .succeeds(); assert!(re_zero.is_match(result.stdout_str())); @@ -488,7 +489,7 @@ fn test_ls_long_formats() { let result = scene .ucmd() .arg("-n") - .args(&arg.split(" ").collect::>()) + .args(&arg.split(' ').collect::>()) .arg("test-long-formats") .succeeds(); assert!(re_zero.is_match(result.stdout_str())); @@ -1063,7 +1064,7 @@ fn test_ls_indicator_style() { for opt in options { scene .ucmd() - .arg(format!("{}", opt)) + .arg(opt.to_string()) .succeeds() .stdout_contains(&"/"); } @@ -1085,7 +1086,10 @@ fn test_ls_indicator_style() { { use self::unix_socket::UnixListener; - let dir = tempfile::Builder::new().prefix("unix_socket").tempdir().expect("failed to create dir"); + let dir = tempfile::Builder::new() + .prefix("unix_socket") + .tempdir() + .expect("failed to create dir"); let socket_path = dir.path().join("sock"); let _listener = UnixListener::bind(&socket_path).expect("failed to create socket"); diff --git a/tests/by-util/test_mkdir.rs b/tests/by-util/test_mkdir.rs index ef3226c41..54a6fe3c8 100644 --- a/tests/by-util/test_mkdir.rs +++ b/tests/by-util/test_mkdir.rs @@ -1,12 +1,12 @@ use crate::common::util::*; -static TEST_DIR1: &'static str = "mkdir_test1"; -static TEST_DIR2: &'static str = "mkdir_test2"; -static TEST_DIR3: &'static str = "mkdir_test3"; -static TEST_DIR4: &'static str = "mkdir_test4/mkdir_test4_1"; -static TEST_DIR5: &'static str = "mkdir_test5/mkdir_test5_1"; -static TEST_DIR6: &'static str = "mkdir_test6"; -static TEST_FILE7: &'static str = "mkdir_test7"; +static TEST_DIR1: &str = "mkdir_test1"; +static TEST_DIR2: &str = "mkdir_test2"; +static TEST_DIR3: &str = "mkdir_test3"; +static TEST_DIR4: &str = "mkdir_test4/mkdir_test4_1"; +static TEST_DIR5: &str = "mkdir_test5/mkdir_test5_1"; +static TEST_DIR6: &str = "mkdir_test6"; +static TEST_FILE7: &str = "mkdir_test7"; #[test] fn test_mkdir_mkdir() { diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index 617f0fd06..d0737764f 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -3,19 +3,19 @@ use crate::common::util::*; use std::path::PathBuf; use tempfile::tempdir; -static TEST_TEMPLATE1: &'static str = "tempXXXXXX"; -static TEST_TEMPLATE2: &'static str = "temp"; -static TEST_TEMPLATE3: &'static str = "tempX"; -static TEST_TEMPLATE4: &'static str = "tempXX"; -static TEST_TEMPLATE5: &'static str = "tempXXX"; -static TEST_TEMPLATE6: &'static str = "tempXXXlate"; -static TEST_TEMPLATE7: &'static str = "XXXtemplate"; +static TEST_TEMPLATE1: &str = "tempXXXXXX"; +static TEST_TEMPLATE2: &str = "temp"; +static TEST_TEMPLATE3: &str = "tempX"; +static TEST_TEMPLATE4: &str = "tempXX"; +static TEST_TEMPLATE5: &str = "tempXXX"; +static TEST_TEMPLATE6: &str = "tempXXXlate"; +static TEST_TEMPLATE7: &str = "XXXtemplate"; #[cfg(unix)] -static TEST_TEMPLATE8: &'static str = "tempXXXl/ate"; +static TEST_TEMPLATE8: &str = "tempXXXl/ate"; #[cfg(windows)] -static TEST_TEMPLATE8: &'static str = "tempXXXl\\ate"; +static TEST_TEMPLATE8: &str = "tempXXXl\\ate"; -const TMPDIR: &'static str = "TMPDIR"; +const TMPDIR: &str = "TMPDIR"; #[test] fn test_mktemp_mktemp() { diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index e0bdd9ef3..beb8f61b9 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -82,7 +82,7 @@ fn test_mv_strip_slashes() { let dir = "test_mv_strip_slashes_dir"; let file = "test_mv_strip_slashes_file"; let mut source = file.to_owned(); - source.push_str("/"); + source.push('/'); at.mkdir(dir); at.touch(file); diff --git a/tests/by-util/test_od.rs b/tests/by-util/test_od.rs index b49e6f0ca..fa947aa6e 100644 --- a/tests/by-util/test_od.rs +++ b/tests/by-util/test_od.rs @@ -9,7 +9,7 @@ use std::io::Write; use std::path::Path; // octal dump of 'abcdefghijklmnopqrstuvwxyz\n' -static ALPHA_OUT: &'static str = " +static ALPHA_OUT: &str = " 0000000 061141 062143 063145 064147 065151 066153 067155 070157 0000020 071161 072163 073165 074167 075171 000012 0000033 @@ -563,7 +563,7 @@ fn test_dec_offset() { #[test] fn test_no_offset() { let input = [0u8; 31]; - const LINE: &'static str = " 00000000 00000000 00000000 00000000\n"; + const LINE: &str = " 00000000 00000000 00000000 00000000\n"; let expected_output = [LINE, LINE, LINE, LINE].join(""); new_ucmd!() diff --git a/tests/by-util/test_paste.rs b/tests/by-util/test_paste.rs index 4604c5cf5..1afe84be8 100644 --- a/tests/by-util/test_paste.rs +++ b/tests/by-util/test_paste.rs @@ -7,7 +7,7 @@ struct TestData<'b> { out: &'b str, } -static EXAMPLE_DATA: &'static [TestData<'static>] = &[ +static EXAMPLE_DATA: &[TestData] = &[ // Ensure that paste properly handles files lacking a final newline. TestData { name: "no-nl-1", @@ -64,8 +64,8 @@ static EXAMPLE_DATA: &'static [TestData<'static>] = &[ #[test] fn test_combine_pairs_of_lines() { - for s in vec!["-s", "--serial"] { - for d in vec!["-d", "--delimiters"] { + for &s in &["-s", "--serial"] { + for &d in &["-d", "--delimiters"] { new_ucmd!() .args(&[s, d, "\t\n", "html_colors.txt"]) .run() @@ -76,7 +76,7 @@ fn test_combine_pairs_of_lines() { #[test] fn test_multi_stdin() { - for d in vec!["-d", "--delimiters"] { + for &d in &["-d", "--delimiters"] { new_ucmd!() .args(&[d, "\t\n", "-", "-"]) .pipe_in_fixture("html_colors.txt") diff --git a/tests/by-util/test_readlink.rs b/tests/by-util/test_readlink.rs index cae5eafee..51aebbed2 100644 --- a/tests/by-util/test_readlink.rs +++ b/tests/by-util/test_readlink.rs @@ -1,6 +1,6 @@ use crate::common::util::*; -static GIBBERISH: &'static str = "supercalifragilisticexpialidocious"; +static GIBBERISH: &str = "supercalifragilisticexpialidocious"; #[test] fn test_canonicalize() { diff --git a/tests/by-util/test_relpath.rs b/tests/by-util/test_relpath.rs index 70d9f2a5d..b9c07fb12 100644 --- a/tests/by-util/test_relpath.rs +++ b/tests/by-util/test_relpath.rs @@ -61,6 +61,7 @@ const TESTS: [TestCase; 10] = [ }, ]; +#[allow(clippy::needless_lifetimes)] fn convert_path<'a>(path: &'a str) -> Cow<'a, str> { #[cfg(windows)] return path.replace("/", "\\").into(); diff --git a/tests/by-util/test_shuf.rs b/tests/by-util/test_shuf.rs index f925f8357..106d80a39 100644 --- a/tests/by-util/test_shuf.rs +++ b/tests/by-util/test_shuf.rs @@ -14,11 +14,11 @@ fn test_output_is_random_permutation() { let mut result_seq: Vec = result .stdout_str() - .split("\n") + .split('\n') .filter(|x| !x.is_empty()) .map(|x| x.parse().unwrap()) .collect(); - result_seq.sort(); + result_seq.sort_unstable(); assert_ne!(result.stdout_str(), input, "Output is not randomised"); assert_eq!(result_seq, input_seq, "Output is not a permutation"); } @@ -31,11 +31,11 @@ fn test_zero_termination() { let mut result_seq: Vec = result .stdout_str() - .split("\0") + .split('\0') .filter(|x| !x.is_empty()) .map(|x| x.parse().unwrap()) .collect(); - result_seq.sort(); + result_seq.sort_unstable(); assert_eq!(result_seq, input_seq, "Output is not a permutation"); } @@ -55,11 +55,11 @@ fn test_echo() { let mut result_seq: Vec = result .stdout_str() - .split("\n") + .split('\n') .filter(|x| !x.is_empty()) .map(|x| x.parse().unwrap()) .collect(); - result_seq.sort(); + result_seq.sort_unstable(); assert_eq!(result_seq, input_seq, "Output is not a permutation"); } @@ -81,11 +81,11 @@ fn test_head_count() { let mut result_seq: Vec = result .stdout_str() - .split("\n") + .split('\n') .filter(|x| !x.is_empty()) .map(|x| x.parse().unwrap()) .collect(); - result_seq.sort(); + result_seq.sort_unstable(); assert_eq!(result_seq.len(), repeat_limit, "Output is not limited"); assert!( result_seq.iter().all(|x| input_seq.contains(x)), @@ -113,7 +113,7 @@ fn test_repeat() { let result_seq: Vec = result .stdout_str() - .split("\n") + .split('\n') .filter(|x| !x.is_empty()) .map(|x| x.parse().unwrap()) .collect(); @@ -141,11 +141,11 @@ fn test_file_input() { let mut result_seq: Vec = result .stdout_str() - .split("\n") + .split('\n') .filter(|x| !x.is_empty()) .map(|x| x.parse().unwrap()) .collect(); - result_seq.sort(); + result_seq.sort_unstable(); assert_eq!(result_seq, expected_seq, "Output is not a permutation"); } diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 3c0af259f..6a2350749 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -288,7 +288,7 @@ fn test_dictionary_order() { #[test] fn test_dictionary_order2() { - for non_dictionary_order2_param in vec!["-d"] { + for non_dictionary_order2_param in &["-d"] { new_ucmd!() .pipe_in("a👦🏻aa b\naaaa b") .arg(non_dictionary_order2_param) @@ -299,7 +299,7 @@ fn test_dictionary_order2() { #[test] fn test_non_printing_chars() { - for non_printing_chars_param in vec!["-i"] { + for non_printing_chars_param in &["-i"] { new_ucmd!() .pipe_in("a👦🏻aa\naaaa") .arg(non_printing_chars_param) @@ -361,7 +361,7 @@ fn test_mixed_floats_ints_chars_numeric_stable() { #[test] fn test_numeric_floats_and_ints2() { - for numeric_sort_param in vec!["-n", "--numeric-sort"] { + for numeric_sort_param in &["-n", "--numeric-sort"] { let input = "1.444\n8.013\n1\n-8\n1.04\n-1"; new_ucmd!() .arg(numeric_sort_param) @@ -373,7 +373,7 @@ fn test_numeric_floats_and_ints2() { #[test] fn test_numeric_floats2() { - for numeric_sort_param in vec!["-n", "--numeric-sort"] { + for numeric_sort_param in &["-n", "--numeric-sort"] { let input = "1.444\n8.013\n1.58590\n-8.90880\n1.040000000\n-.05"; new_ucmd!() .arg(numeric_sort_param) @@ -426,7 +426,7 @@ fn test_default_unsorted_ints2() { #[test] fn test_numeric_unique_ints2() { - for numeric_unique_sort_param in vec!["-nu"] { + for numeric_unique_sort_param in &["-nu"] { let input = "9\n9\n8\n1\n"; new_ucmd!() .arg(numeric_unique_sort_param) diff --git a/tests/by-util/test_split.rs b/tests/by-util/test_split.rs index d83de4323..1ff8bd8f2 100644 --- a/tests/by-util/test_split.rs +++ b/tests/by-util/test_split.rs @@ -98,7 +98,7 @@ impl RandomFile { let to_write = std::cmp::min(remaining_size, buffer.len()); let buf = &mut buffer[..to_write]; rng.fill(buf); - writer.write(buf).unwrap(); + writer.write_all(buf).unwrap(); remaining_size -= to_write; } @@ -179,6 +179,7 @@ fn test_split_bytes_prime_part_size() { let mut fns = glob.collect(); // glob.collect() is not guaranteed to return in sorted order, so we sort. fns.sort(); + #[allow(clippy::needless_range_loop)] for i in 0..5 { assert_eq!(glob.directory.metadata(&fns[i]).len(), 1753); } @@ -246,9 +247,9 @@ fn test_filter() { assert!( glob.collate().iter().find(|&&c| { // is not i - c != ('i' as u8) + c != (b'i') // is not newline - && c != ('\n' as u8) + && c != (b'\n') }) == None ); } @@ -271,7 +272,7 @@ fn test_filter_with_env_var_set() { let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]]$"); assert_eq!(glob.collate(), at.read_bytes(name)); - assert!(env::var("FILE").unwrap_or("var was unset".to_owned()) == env_var_value); + assert!(env::var("FILE").unwrap_or_else(|_| "var was unset".to_owned()) == env_var_value); } #[test] diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 44bce9cd8..6935cc7f9 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -97,13 +97,13 @@ fn test_invalid_option() { } #[cfg(any(target_os = "linux", target_vendor = "apple"))] -const NORMAL_FMTSTR: &'static str = +const NORMAL_FMTSTR: &str = "%a %A %b %B %d %D %f %F %g %G %h %i %m %n %o %s %u %U %x %X %y %Y %z %Z"; // avoid "%w %W" (birth/creation) due to `stat` limitations and linux kernel & rust version capability variations #[cfg(any(target_os = "linux"))] -const DEV_FMTSTR: &'static str = +const DEV_FMTSTR: &str = "%a %A %b %B %d %D %f %F %g %G %h %i %m %n %o %s (%t/%T) %u %U %w %W %x %X %y %Y %z %Z"; #[cfg(target_os = "linux")] -const FS_FMTSTR: &'static str = "%b %c %i %l %n %s %S %t %T"; // avoid "%a %d %f" which can cause test failure due to race conditions +const FS_FMTSTR: &str = "%b %c %i %l %n %s %S %t %T"; // avoid "%a %d %f" which can cause test failure due to race conditions #[test] #[cfg(target_os = "linux")] @@ -140,7 +140,7 @@ fn test_terse_normal_format() { assert!(!v_expect.is_empty()); // uu_stat does not support selinux - if v_actual.len() == v_expect.len() - 1 && v_expect[v_expect.len() - 1].contains(":") { + if v_actual.len() == v_expect.len() - 1 && v_expect[v_expect.len() - 1].contains(':') { // assume last element contains: `SELinux security context string` v_expect.pop(); } @@ -222,7 +222,7 @@ fn test_symlinks() { let mut tested: bool = false; // arbitrarily chosen symlinks with hope that the CI environment provides at least one of them - for file in vec![ + for file in &[ "/bin/sh", "/bin/sudoedit", "/usr/bin/ex", diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index f3c9a7b11..737d0cabf 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -5,9 +5,9 @@ use crate::common::util::*; use std::char::from_digit; use std::io::Write; -static FOOBAR_TXT: &'static str = "foobar.txt"; -static FOOBAR_2_TXT: &'static str = "foobar2.txt"; -static FOOBAR_WITH_NULL_TXT: &'static str = "foobar_with_null.txt"; +static FOOBAR_TXT: &str = "foobar.txt"; +static FOOBAR_2_TXT: &str = "foobar2.txt"; +static FOOBAR_WITH_NULL_TXT: &str = "foobar_with_null.txt"; #[test] fn test_stdin_default() { @@ -153,8 +153,8 @@ fn test_follow_with_pid() { #[test] fn test_single_big_args() { - const FILE: &'static str = "single_big_args.txt"; - const EXPECTED_FILE: &'static str = "single_big_args_expected.txt"; + const FILE: &str = "single_big_args.txt"; + const EXPECTED_FILE: &str = "single_big_args_expected.txt"; const LINES: usize = 1_000_000; const N_ARG: usize = 100_000; @@ -162,13 +162,13 @@ fn test_single_big_args() { let mut big_input = at.make_file(FILE); for i in 0..LINES { - write!(&mut big_input, "Line {}\n", i).expect("Could not write to FILE"); + writeln!(&mut big_input, "Line {}", i).expect("Could not write to FILE"); } big_input.flush().expect("Could not flush FILE"); let mut big_expected = at.make_file(EXPECTED_FILE); for i in (LINES - N_ARG)..LINES { - write!(&mut big_expected, "Line {}\n", i).expect("Could not write to EXPECTED_FILE"); + writeln!(&mut big_expected, "Line {}", i).expect("Could not write to EXPECTED_FILE"); } big_expected.flush().expect("Could not flush EXPECTED_FILE"); @@ -201,8 +201,8 @@ fn test_bytes_stdin() { #[test] fn test_bytes_big() { - const FILE: &'static str = "test_bytes_big.txt"; - const EXPECTED_FILE: &'static str = "test_bytes_big_expected.txt"; + const FILE: &str = "test_bytes_big.txt"; + const EXPECTED_FILE: &str = "test_bytes_big_expected.txt"; const BYTES: usize = 1_000_000; const N_ARG: usize = 100_000; @@ -257,10 +257,10 @@ fn test_parse_size() { for &(c, exp) in &suffixes { let s = format!("2{}B", c); - assert_eq!(Ok(2 * (1000 as u64).pow(exp)), parse_size(&s)); + assert_eq!(Ok(2 * (1000_u64).pow(exp)), parse_size(&s)); let s = format!("2{}", c); - assert_eq!(Ok(2 * (1024 as u64).pow(exp)), parse_size(&s)); + assert_eq!(Ok(2 * (1024_u64).pow(exp)), parse_size(&s)); } // Sizes that are too big. @@ -273,8 +273,8 @@ fn test_parse_size() { #[test] fn test_lines_with_size_suffix() { - const FILE: &'static str = "test_lines_with_size_suffix.txt"; - const EXPECTED_FILE: &'static str = "test_lines_with_size_suffix_expected.txt"; + const FILE: &str = "test_lines_with_size_suffix.txt"; + const EXPECTED_FILE: &str = "test_lines_with_size_suffix_expected.txt"; const LINES: usize = 3_000; const N_ARG: usize = 2 * 1024; diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index 40fbb8aa9..d4d2c058e 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -401,8 +401,8 @@ fn get_dstswitch_hour() -> Option { for _i in 0..(366 * 24) { if is_dst_switch_hour(ts) { let mut tm = time::at(ts); - tm.tm_hour = tm.tm_hour + 1; - let s = time::strftime("%Y%m%d%H%M", &tm).unwrap().to_string(); + tm.tm_hour += 1; + let s = time::strftime("%Y%m%d%H%M", &tm).unwrap(); return Some(s); } ts = ts + time::Duration::hours(1); @@ -415,10 +415,7 @@ fn test_touch_mtime_dst_fails() { let (_at, mut ucmd) = at_and_ucmd!(); let file = "test_touch_set_mtime_dst_fails"; - match get_dstswitch_hour() { - Some(s) => { - ucmd.args(&["-m", "-t", &s, file]).fails(); - } - None => (), + if let Some(s) = get_dstswitch_hour() { + ucmd.args(&["-m", "-t", &s, file]).fails(); } } diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index 120982e3c..34ba59094 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -1,8 +1,8 @@ use crate::common::util::*; use std::io::{Seek, SeekFrom, Write}; -static TFILE1: &'static str = "truncate_test_1"; -static TFILE2: &'static str = "truncate_test_2"; +static TFILE1: &str = "truncate_test_1"; +static TFILE2: &str = "truncate_test_2"; #[test] fn test_increase_file_size() { diff --git a/tests/by-util/test_uniq.rs b/tests/by-util/test_uniq.rs index 2645c38ca..c191ffcaf 100644 --- a/tests/by-util/test_uniq.rs +++ b/tests/by-util/test_uniq.rs @@ -1,10 +1,10 @@ use crate::common::util::*; -static INPUT: &'static str = "sorted.txt"; -static OUTPUT: &'static str = "sorted-output.txt"; -static SKIP_CHARS: &'static str = "skip-chars.txt"; -static SKIP_FIELDS: &'static str = "skip-fields.txt"; -static SORTED_ZERO_TERMINATED: &'static str = "sorted-zero-terminated.txt"; +static INPUT: &str = "sorted.txt"; +static OUTPUT: &str = "sorted-output.txt"; +static SKIP_CHARS: &str = "skip-chars.txt"; +static SKIP_FIELDS: &str = "skip-fields.txt"; +static SORTED_ZERO_TERMINATED: &str = "sorted-zero-terminated.txt"; #[test] fn test_stdin_default() { diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index 21b5eb93e..333b03f5b 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -3,7 +3,7 @@ use crate::common::util::*; #[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_count() { - for opt in vec!["-q", "--count"] { + for opt in &["-q", "--count"] { new_ucmd!() .arg(opt) .succeeds() @@ -14,7 +14,7 @@ fn test_count() { #[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_boot() { - for opt in vec!["-b", "--boot"] { + for opt in &["-b", "--boot"] { new_ucmd!() .arg(opt) .succeeds() @@ -25,7 +25,7 @@ fn test_boot() { #[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_heading() { - for opt in vec!["-H", "--heading"] { + for opt in &["-H", "--heading"] { // allow whitespace variation // * minor whitespace differences occur between platform built-in outputs; // specifically number of TABs between "TIME" and "COMMENT" may be variant @@ -42,7 +42,7 @@ fn test_heading() { #[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_short() { - for opt in vec!["-s", "--short"] { + for opt in &["-s", "--short"] { new_ucmd!() .arg(opt) .succeeds() @@ -53,7 +53,7 @@ fn test_short() { #[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_login() { - for opt in vec!["-l", "--login"] { + for opt in &["-l", "--login"] { new_ucmd!() .arg(opt) .succeeds() @@ -64,7 +64,7 @@ fn test_login() { #[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_m() { - for opt in vec!["-m"] { + for opt in &["-m"] { new_ucmd!() .arg(opt) .succeeds() @@ -75,7 +75,7 @@ fn test_m() { #[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_process() { - for opt in vec!["-p", "--process"] { + for opt in &["-p", "--process"] { new_ucmd!() .arg(opt) .succeeds() @@ -85,7 +85,7 @@ fn test_process() { #[test] fn test_runlevel() { - for opt in vec!["-r", "--runlevel"] { + for opt in &["-r", "--runlevel"] { #[cfg(any(target_vendor = "apple", target_os = "linux"))] new_ucmd!() .arg(opt) @@ -100,7 +100,7 @@ fn test_runlevel() { #[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_time() { - for opt in vec!["-t", "--time"] { + for opt in &["-t", "--time"] { new_ucmd!() .arg(opt) .succeeds() @@ -117,7 +117,7 @@ fn test_mesg() { // same as -T // --writable // same as -T - for opt in vec!["-T", "-w", "--mesg", "--message", "--writable"] { + for opt in &["-T", "-w", "--mesg", "--message", "--writable"] { new_ucmd!() .arg(opt) .succeeds() @@ -147,7 +147,7 @@ fn test_too_many_args() { #[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_users() { - for opt in vec!["-u", "--users"] { + for opt in &["-u", "--users"] { let actual = new_ucmd!().arg(opt).succeeds().stdout_move_str(); let expect = expected_result(&[opt]); println!("actual: {:?}", actual); @@ -172,18 +172,17 @@ fn test_users() { #[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_lookup() { - for opt in vec!["--lookup"] { - new_ucmd!() - .arg(opt) - .succeeds() - .stdout_is(expected_result(&[opt])); - } + let opt = "--lookup"; + new_ucmd!() + .arg(opt) + .succeeds() + .stdout_is(expected_result(&[opt])); } #[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_dead() { - for opt in vec!["-d", "--dead"] { + for opt in &["-d", "--dead"] { new_ucmd!() .arg(opt) .succeeds() @@ -222,7 +221,7 @@ fn test_all() { return; } - for opt in vec!["-a", "--all"] { + for opt in &["-a", "--all"] { new_ucmd!() .arg(opt) .succeeds() diff --git a/tests/common/util.rs b/tests/common/util.rs index 7580d7be8..9ce7f0537 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -1,7 +1,4 @@ #![allow(dead_code)] - -#[cfg(not(windows))] -use libc; use pretty_assertions::assert_eq; use std::env; #[cfg(not(windows))] @@ -39,7 +36,7 @@ static NO_STDIN_MEANINGLESS: &str = "Setting this flag has no effect if there is /// Test if the program is running under CI pub fn is_ci() -> bool { std::env::var("CI") - .unwrap_or(String::from("false")) + .unwrap_or_else(|_| String::from("false")) .eq_ignore_ascii_case("true") } @@ -464,7 +461,7 @@ impl AtPath { .append(true) .open(self.plus(name)) .unwrap(); - f.write(contents.as_bytes()) + f.write_all(contents.as_bytes()) .unwrap_or_else(|e| panic!("Couldn't write {}: {}", name, e)); } @@ -777,7 +774,7 @@ impl UCommand { if self.has_run { panic!("{}", ALREADY_RUN); } - self.comm_string.push_str(" "); + self.comm_string.push(' '); self.comm_string .push_str(arg.as_ref().to_str().unwrap_or_default()); self.raw.arg(arg.as_ref()); @@ -797,7 +794,7 @@ impl UCommand { .accept_any(); for s in strings { - self.comm_string.push_str(" "); + self.comm_string.push(' '); self.comm_string.push_str(&s); } @@ -853,9 +850,9 @@ impl UCommand { log_info("run", &self.comm_string); let mut child = self .raw - .stdin(self.stdin.take().unwrap_or_else(|| Stdio::piped())) - .stdout(self.stdout.take().unwrap_or_else(|| Stdio::piped())) - .stderr(self.stderr.take().unwrap_or_else(|| Stdio::piped())) + .stdin(self.stdin.take().unwrap_or_else(Stdio::piped)) + .stdout(self.stdout.take().unwrap_or_else(Stdio::piped)) + .stderr(self.stderr.take().unwrap_or_else(Stdio::piped)) .spawn() .unwrap(); @@ -929,10 +926,7 @@ pub fn read_size(child: &mut Child, size: usize) -> String { } pub fn vec_of_size(n: usize) -> Vec { - let mut result = Vec::new(); - for _ in 0..n { - result.push('a' as u8); - } + let result = vec![b'a'; n]; assert_eq!(result.len(), n); result } From e4aa8ee1593e24d5fc064e0cd2c83a000f3ec0d4 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sat, 29 May 2021 01:51:00 +0200 Subject: [PATCH 0723/1135] users: fix long_help text and clippy warning --- src/uu/users/src/users.rs | 21 +++++++++++++-------- tests/by-util/test_users.rs | 28 ++++++++++++---------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/uu/users/src/users.rs b/src/uu/users/src/users.rs index 4bb628441..99e06c1af 100644 --- a/src/uu/users/src/users.rs +++ b/src/uu/users/src/users.rs @@ -6,19 +6,14 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -/* last synced with: whoami (GNU coreutils) 8.22 */ -// Allow dead code here in order to keep all fields, constants here, for consistency. -#![allow(dead_code)] - #[macro_use] extern crate uucore; -use uucore::utmpx::*; - use clap::{App, Arg}; +use uucore::utmpx::{self, Utmpx}; -static ABOUT: &str = "Display who is currently logged in, according to FILE."; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Print the user names of users currently logged in to the current host"; static ARG_FILES: &str = "files"; @@ -26,13 +21,23 @@ fn get_usage() -> String { format!("{0} [FILE]", executable!()) } +fn get_long_usage() -> String { + format!( + "Output who is currently logged in according to FILE. +If FILE is not specified, use {}. /var/log/wtmp as FILE is common.", + utmpx::DEFAULT_FILE + ) +} + pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); + let after_help = get_long_usage(); let matches = App::new(executable!()) .version(VERSION) .about(ABOUT) .usage(&usage[..]) + .after_help(&after_help[..]) .arg(Arg::with_name(ARG_FILES).takes_value(true).max_values(1)) .get_matches_from(args); @@ -44,7 +49,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let filename = if !files.is_empty() { files[0].as_ref() } else { - DEFAULT_FILE + utmpx::DEFAULT_FILE }; let mut users = Utmpx::iter_all_records() diff --git a/tests/by-util/test_users.rs b/tests/by-util/test_users.rs index 3c5789820..89c3fdd0f 100644 --- a/tests/by-util/test_users.rs +++ b/tests/by-util/test_users.rs @@ -1,27 +1,23 @@ use crate::common::util::*; -use std::env; #[test] fn test_users_noarg() { new_ucmd!().succeeds(); } + #[test] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] fn test_users_check_name() { - let result = TestScenario::new(util_name!()).ucmd_keepenv().succeeds(); + #[cfg(target_os = "linux")] + let util_name = util_name!(); + #[cfg(target_vendor = "apple")] + let util_name = format!("g{}", util_name!()); - // Expectation: USER is often set - let key = "USER"; + let expected = TestScenario::new(&util_name) + .cmd_keepenv(util_name) + .env("LANGUAGE", "C") + .succeeds() + .stdout_move_str(); - match env::var(key) { - Err(e) => println!("Key {} isn't set. Found {}", &key, e), - Ok(username) => - // Check if "users" contains the name of the user - { - println!("username found {}", &username); - // println!("result.stdout {}", &result.stdout); - if !result.stdout_str().is_empty() { - result.stdout_contains(&username); - } - } - } + new_ucmd!().succeeds().stdout_is(&expected); } From 17b0939deed110944ff36239d5cb207cc33fe160 Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Fri, 28 May 2021 18:28:00 +0300 Subject: [PATCH 0724/1135] Moved factor to use clap Issue: https://github.com/uutils/coreutils/issues/2121 --- Cargo.lock | 1 + src/uu/factor/Cargo.toml | 1 + src/uu/factor/src/cli.rs | 36 ++++++++++++++++++++---------------- tests/by-util/test_factor.rs | 12 ++++++++++++ 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8f0b4efcd..6d2a47c84 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1821,6 +1821,7 @@ dependencies = [ name = "uu_factor" version = "0.0.6" dependencies = [ + "clap", "coz", "num-traits", "paste", diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index eb34519f1..eb977760f 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -21,6 +21,7 @@ rand = { version = "0.7", features = ["small_rng"] } smallvec = { version = "0.6.14, < 1.0" } uucore = { version = ">=0.0.8", package = "uucore", path = "../../uucore" } uucore_procs = { version = ">=0.0.5", package = "uucore_procs", path = "../../uucore_procs" } +clap = "2.33" [dev-dependencies] paste = "0.1.18" diff --git a/src/uu/factor/src/cli.rs b/src/uu/factor/src/cli.rs index ee4c8a4c4..69a368479 100644 --- a/src/uu/factor/src/cli.rs +++ b/src/uu/factor/src/cli.rs @@ -13,18 +13,21 @@ use std::error::Error; use std::io::{self, stdin, stdout, BufRead, Write}; mod factor; +use clap::{App, Arg}; pub use factor::*; -use uucore::InvalidEncodingHandling; mod miller_rabin; pub mod numeric; mod rho; pub mod table; -static SYNTAX: &str = "[OPTION] [NUMBER]..."; -static SUMMARY: &str = "Print the prime factors of the given number(s). - If none are specified, read from standard input."; -static LONG_HELP: &str = ""; +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static SUMMARY: &str = "Print the prime factors of the given NUMBER(s). +If none are specified, read from standard input."; + +mod options { + pub static NUMBER: &str = "NUMBER"; +} fn print_factors_str(num_str: &str, w: &mut impl io::Write) -> Result<(), Box> { num_str @@ -34,14 +37,21 @@ fn print_factors_str(num_str: &str, w: &mut impl io::Write) -> Result<(), Box i32 { - let matches = app!(SYNTAX, SUMMARY, LONG_HELP).parse( - args.collect_str(InvalidEncodingHandling::Ignore) - .accept_any(), - ); + let matches = App::new(executable!()) + .version(VERSION) + .about(SUMMARY) + .arg(Arg::with_name(options::NUMBER).multiple(true)) + .get_matches_from(args); let stdout = stdout(); let mut w = io::BufWriter::new(stdout.lock()); - if matches.free.is_empty() { + if let Some(values) = matches.values_of(options::NUMBER) { + for number in values { + if let Err(e) = print_factors_str(number, &mut w) { + show_warning!("{}: {}", number, e); + } + } + } else { let stdin = stdin(); for line in stdin.lock().lines() { @@ -51,12 +61,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } } - } else { - for number in &matches.free { - if let Err(e) = print_factors_str(number, &mut w) { - show_warning!("{}: {}", number, e); - } - } } if let Err(e) = w.flush() { diff --git a/tests/by-util/test_factor.rs b/tests/by-util/test_factor.rs index 963b82ed8..917d19a49 100644 --- a/tests/by-util/test_factor.rs +++ b/tests/by-util/test_factor.rs @@ -40,6 +40,18 @@ fn test_first_100000_integers() { assert_eq!(hash_check, "4ed2d8403934fa1c76fe4b84c5d4b8850299c359"); } +#[test] +fn test_cli_args() { + // Make sure that factor works with CLI arguments as well. + new_ucmd!().args(&["3"]).succeeds().stdout_contains("3: 3"); + + new_ucmd!() + .args(&["3", "6"]) + .succeeds() + .stdout_contains("3: 3") + .stdout_contains("6: 2 3"); +} + #[test] fn test_random() { use conv::prelude::*; From 4e73b919e9ff96472433d0380c53383e892b6d80 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Fri, 21 May 2021 18:20:05 -0400 Subject: [PATCH 0725/1135] truncate: add test for -r and -s options together Add a test for when the reference file is not found and both `-r` and `-s` options are given on the command-line. --- tests/by-util/test_truncate.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index 34ba59094..a28ce9451 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -262,3 +262,11 @@ fn test_reference_file_not_found() { .fails() .stderr_contains("cannot stat 'a': No such file or directory"); } + +#[test] +fn test_reference_with_size_file_not_found() { + new_ucmd!() + .args(&["-r", "a", "-s", "+1", "b"]) + .fails() + .stderr_contains("cannot stat 'a': No such file or directory"); +} From b898e54d7a35c5978ca707b903d04da13060471f Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Fri, 21 May 2021 18:23:50 -0400 Subject: [PATCH 0726/1135] truncate: remove read permissions from OpenOptions Remove "read" permissions from the `OpenOptions` when opening a new file just to truncate it. We will never read from the file, only write to it. (Specifically, we will only call `File::set_len()`.) --- src/uu/truncate/src/truncate.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 03b18723c..086e14858 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -189,12 +189,7 @@ fn truncate( }; for filename in &filenames { let path = Path::new(filename); - match OpenOptions::new() - .read(true) - .write(true) - .create(!no_create) - .open(path) - { + match OpenOptions::new().write(true).create(!no_create).open(path) { Ok(file) => { let fsize = match reference { Some(_) => refsize, From 005bc259da0cbd6128b9d803693096df49b79e78 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Fri, 21 May 2021 21:06:45 -0400 Subject: [PATCH 0727/1135] truncate: add parse_mode_and_size() helper func Add a helper function to contain the code for parsing the size and the modifier symbol, if any. This commit also changes the `TruncateMode` enum so that the parameter for each "mode" is stored along with the enumeration value. This is because the parameter has a different meaning in each mode. --- src/uu/truncate/src/truncate.rs | 136 ++++++++++++++++++++------------ 1 file changed, 85 insertions(+), 51 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 086e14858..9df775300 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -15,16 +15,16 @@ use std::fs::{metadata, OpenOptions}; use std::io::ErrorKind; use std::path::Path; -#[derive(Eq, PartialEq)] +#[derive(Debug, Eq, PartialEq)] enum TruncateMode { - Absolute, - Reference, - Extend, - Reduce, - AtMost, - AtLeast, - RoundDown, - RoundUp, + Reference(u64), + Absolute(u64), + Extend(u64), + Reduce(u64), + AtMost(u64), + AtLeast(u64), + RoundDown(u64), + RoundUp(u64), } static ABOUT: &str = "Shrink or extend the size of each file to the specified size."; @@ -133,46 +133,21 @@ fn truncate( size: Option, filenames: Vec, ) { - let (modsize, mode) = match size { - Some(size_string) => { - // Trim any whitespace. - let size_string = size_string.trim(); - - // Get the modifier character from the size string, if any. For - // example, if the argument is "+123", then the modifier is '+'. - let c = size_string.chars().next().unwrap(); - - let mode = match c { - '+' => TruncateMode::Extend, - '-' => TruncateMode::Reduce, - '<' => TruncateMode::AtMost, - '>' => TruncateMode::AtLeast, - '/' => TruncateMode::RoundDown, - '%' => TruncateMode::RoundUp, - _ => TruncateMode::Absolute, /* assume that the size is just a number */ - }; - - // If there was a modifier character, strip it. - let size_string = match mode { - TruncateMode::Absolute => size_string, - _ => &size_string[1..], - }; - let num_bytes = match parse_size(size_string) { - Ok(b) => b, - Err(_) => crash!(1, "Invalid number: ‘{}’", size_string), - }; - (num_bytes, mode) - } - None => (0, TruncateMode::Reference), + let mode = match size { + Some(size_string) => match parse_mode_and_size(&size_string) { + Ok(m) => m, + Err(_) => crash!(1, "Invalid number: ‘{}’", size_string), + }, + None => TruncateMode::Reference(0), }; let refsize = match reference { Some(ref rfilename) => { match mode { // Only Some modes work with a reference - TruncateMode::Reference => (), //No --size was given - TruncateMode::Extend => (), - TruncateMode::Reduce => (), + TruncateMode::Reference(_) => (), //No --size was given + TruncateMode::Extend(_) => (), + TruncateMode::Reduce(_) => (), _ => crash!(1, "you must specify a relative ‘--size’ with ‘--reference’"), }; match metadata(rfilename) { @@ -202,14 +177,14 @@ fn truncate( }, }; let tsize: u64 = match mode { - TruncateMode::Absolute => modsize, - TruncateMode::Reference => fsize, - TruncateMode::Extend => fsize + modsize, - TruncateMode::Reduce => fsize - modsize, - TruncateMode::AtMost => fsize.min(modsize), - TruncateMode::AtLeast => fsize.max(modsize), - TruncateMode::RoundDown => fsize - fsize % modsize, - TruncateMode::RoundUp => fsize + fsize % modsize, + TruncateMode::Absolute(modsize) => modsize, + TruncateMode::Reference(_) => fsize, + TruncateMode::Extend(modsize) => fsize + modsize, + TruncateMode::Reduce(modsize) => fsize - modsize, + TruncateMode::AtMost(modsize) => fsize.min(modsize), + TruncateMode::AtLeast(modsize) => fsize.max(modsize), + TruncateMode::RoundDown(modsize) => fsize - fsize % modsize, + TruncateMode::RoundUp(modsize) => fsize + fsize % modsize, }; match file.set_len(tsize) { Ok(_) => {} @@ -221,6 +196,52 @@ fn truncate( } } +/// Decide whether a character is one of the size modifiers, like '+' or '<'. +fn is_modifier(c: char) -> bool { + c == '+' || c == '-' || c == '<' || c == '>' || c == '/' || c == '%' +} + +/// Parse a size string with optional modifier symbol as its first character. +/// +/// A size string is as described in [`parse_size`]. The first character +/// of `size_string` might be a modifier symbol, like `'+'` or +/// `'<'`. The first element of the pair returned by this function +/// indicates which modifier symbol was present, or +/// [`TruncateMode::Absolute`] if none. +/// +/// # Panics +/// +/// If `size_string` is empty, or if no number could be parsed from the +/// given string (for example, if the string were `"abc"`). +/// +/// # Examples +/// +/// ```rust,ignore +/// assert_eq!(parse_mode_and_size("+123"), (TruncateMode::Extend, 123)); +/// ``` +fn parse_mode_and_size(size_string: &str) -> Result { + // Trim any whitespace. + let size_string = size_string.trim(); + + // Get the modifier character from the size string, if any. For + // example, if the argument is "+123", then the modifier is '+'. + let c = size_string.chars().next().unwrap(); + let size_string = if is_modifier(c) { + &size_string[1..] + } else { + size_string + }; + parse_size(size_string).map(match c { + '+' => TruncateMode::Extend, + '-' => TruncateMode::Reduce, + '<' => TruncateMode::AtMost, + '>' => TruncateMode::AtLeast, + '/' => TruncateMode::RoundDown, + '%' => TruncateMode::RoundUp, + _ => TruncateMode::Absolute, + }) +} + /// Parse a size string into a number of bytes. /// /// A size string comprises an integer and an optional unit. The unit @@ -280,7 +301,9 @@ fn parse_size(size: &str) -> Result { #[cfg(test)] mod tests { + use crate::parse_mode_and_size; use crate::parse_size; + use crate::TruncateMode; #[test] fn test_parse_size_zero() { @@ -306,4 +329,15 @@ mod tests { assert_eq!(parse_size("123M").unwrap(), 123 * 1024 * 1024); assert_eq!(parse_size("123MB").unwrap(), 123 * 1000 * 1000); } + + #[test] + fn test_parse_mode_and_size() { + assert_eq!(parse_mode_and_size("10"), Ok(TruncateMode::Absolute(10))); + assert_eq!(parse_mode_and_size("+10"), Ok(TruncateMode::Extend(10))); + assert_eq!(parse_mode_and_size("-10"), Ok(TruncateMode::Reduce(10))); + assert_eq!(parse_mode_and_size("<10"), Ok(TruncateMode::AtMost(10))); + assert_eq!(parse_mode_and_size(">10"), Ok(TruncateMode::AtLeast(10))); + assert_eq!(parse_mode_and_size("/10"), Ok(TruncateMode::RoundDown(10))); + assert_eq!(parse_mode_and_size("%10"), Ok(TruncateMode::RoundUp(10))); + } } From 5129114ddc9b7b29f5aac2e6d93b2dc44df60a6f Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Fri, 21 May 2021 21:09:33 -0400 Subject: [PATCH 0728/1135] truncate: create TruncateMode::to_size() method Create a method that computes the final target size in bytes for the file to truncate, given the reference file size and the parameter to the `TruncateMode`. --- src/uu/truncate/src/truncate.rs | 37 ++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 9df775300..c0f078458 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -27,6 +27,32 @@ enum TruncateMode { RoundUp(u64), } +impl TruncateMode { + /// Compute a target size in bytes for this truncate mode. + /// + /// `fsize` is the size of the reference file, in bytes. + /// + /// # Examples + /// + /// ```rust,ignore + /// let mode = TruncateMode::Extend(5); + /// let fsize = 10; + /// assert_eq!(mode.to_size(fsize), 15); + /// ``` + fn to_size(&self, fsize: u64) -> u64 { + match self { + TruncateMode::Absolute(modsize) => *modsize, + TruncateMode::Reference(_) => fsize, + TruncateMode::Extend(modsize) => fsize + modsize, + TruncateMode::Reduce(modsize) => fsize - modsize, + TruncateMode::AtMost(modsize) => fsize.min(*modsize), + TruncateMode::AtLeast(modsize) => fsize.max(*modsize), + TruncateMode::RoundDown(modsize) => fsize - fsize % modsize, + TruncateMode::RoundUp(modsize) => fsize + fsize % modsize, + } + } +} + static ABOUT: &str = "Shrink or extend the size of each file to the specified size."; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -176,16 +202,7 @@ fn truncate( } }, }; - let tsize: u64 = match mode { - TruncateMode::Absolute(modsize) => modsize, - TruncateMode::Reference(_) => fsize, - TruncateMode::Extend(modsize) => fsize + modsize, - TruncateMode::Reduce(modsize) => fsize - modsize, - TruncateMode::AtMost(modsize) => fsize.min(modsize), - TruncateMode::AtLeast(modsize) => fsize.max(modsize), - TruncateMode::RoundDown(modsize) => fsize - fsize % modsize, - TruncateMode::RoundUp(modsize) => fsize + fsize % modsize, - }; + let tsize = mode.to_size(fsize); match file.set_len(tsize) { Ok(_) => {} Err(f) => crash!(1, "{}", f.to_string()), From 0999b00ff9e78e93746605140c70bc022a43a374 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Fri, 21 May 2021 21:12:13 -0400 Subject: [PATCH 0729/1135] truncate: re-organize into one func for each mode Reorganize the code in `truncate.rs` into three distinct functions representing the three modes of operation of the `truncate` program. The three modes are - `truncate -r RFILE FILE`, which sets the length of `FILE` to match the length of `RFILE`, - `truncate -r RFILE -s NUM FILE`, which sets the length of `FILE` relative to the given `RFILE`, - `truncate -s NUM FILE`, which sets the length of `FILE` either absolutely or relative to its curent length. This organization of the code makes it more concise and easier to follow. --- src/uu/truncate/src/truncate.rs | 196 ++++++++++++++++++++++---------- 1 file changed, 139 insertions(+), 57 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index c0f078458..3a6077b3c 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -17,7 +17,6 @@ use std::path::Path; #[derive(Debug, Eq, PartialEq)] enum TruncateMode { - Reference(u64), Absolute(u64), Extend(u64), Reduce(u64), @@ -42,7 +41,6 @@ impl TruncateMode { fn to_size(&self, fsize: u64) -> u64 { match self { TruncateMode::Absolute(modsize) => *modsize, - TruncateMode::Reference(_) => fsize, TruncateMode::Extend(modsize) => fsize + modsize, TruncateMode::Reduce(modsize) => fsize - modsize, TruncateMode::AtMost(modsize) => fsize.min(*modsize), @@ -142,74 +140,158 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let no_create = matches.is_present(options::NO_CREATE); let reference = matches.value_of(options::REFERENCE).map(String::from); let size = matches.value_of(options::SIZE).map(String::from); - if reference.is_none() && size.is_none() { - crash!(1, "you must specify either --reference or --size"); - } else { - truncate(no_create, io_blocks, reference, size, files); + if let Err(e) = truncate(no_create, io_blocks, reference, size, files) { + match e.kind() { + ErrorKind::NotFound => { + // TODO Improve error-handling so that the error + // returned by `truncate()` provides the necessary + // parameter for formatting the error message. + let reference = matches.value_of(options::REFERENCE).map(String::from); + crash!( + 1, + "cannot stat '{}': No such file or directory", + reference.unwrap() + ); + } + _ => crash!(1, "{}", e.to_string()), + } } } 0 } +/// Truncate the named file to the specified size. +/// +/// If `create` is true, then the file will be created if it does not +/// already exist. If `size` is larger than the number of bytes in the +/// file, then the file will be padded with zeros. If `size` is smaller +/// than the number of bytes in the file, then the file will be +/// truncated and any bytes beyond `size` will be lost. +/// +/// # Errors +/// +/// If the file could not be opened, or there was a problem setting the +/// size of the file. +fn file_truncate(filename: &str, create: bool, size: u64) -> std::io::Result<()> { + let path = Path::new(filename); + let f = OpenOptions::new().write(true).create(create).open(path)?; + f.set_len(size) +} + +/// Truncate files to a size relative to a given file. +/// +/// `rfilename` is the name of the reference file. +/// +/// `size_string` gives the size relative to the reference file to which +/// to set the target files. For example, "+3K" means "set each file to +/// be three kilobytes larger than the size of the reference file". +/// +/// If `create` is true, then each file will be created if it does not +/// already exist. +/// +/// # Errors +/// +/// If the any file could not be opened, or there was a problem setting +/// the size of at least one file. +fn truncate_reference_and_size( + rfilename: &str, + size_string: &str, + filenames: Vec, + create: bool, +) -> std::io::Result<()> { + let mode = match parse_mode_and_size(size_string) { + Ok(m) => match m { + TruncateMode::Absolute(_) => { + crash!(1, "you must specify a relative ‘--size’ with ‘--reference’") + } + _ => m, + }, + Err(_) => crash!(1, "Invalid number: ‘{}’", size_string), + }; + let fsize = metadata(rfilename)?.len(); + let tsize = mode.to_size(fsize); + for filename in &filenames { + file_truncate(filename, create, tsize)?; + } + Ok(()) +} + +/// Truncate files to match the size of a given reference file. +/// +/// `rfilename` is the name of the reference file. +/// +/// If `create` is true, then each file will be created if it does not +/// already exist. +/// +/// # Errors +/// +/// If the any file could not be opened, or there was a problem setting +/// the size of at least one file. +fn truncate_reference_file_only( + rfilename: &str, + filenames: Vec, + create: bool, +) -> std::io::Result<()> { + let tsize = metadata(rfilename)?.len(); + for filename in &filenames { + file_truncate(filename, create, tsize)?; + } + Ok(()) +} + +/// Truncate files to a specified size. +/// +/// `size_string` gives either an absolute size or a relative size. A +/// relative size adjusts the size of each file relative to its current +/// size. For example, "3K" means "set each file to be three kilobytes" +/// whereas "+3K" means "set each file to be three kilobytes larger than +/// its current size". +/// +/// If `create` is true, then each file will be created if it does not +/// already exist. +/// +/// # Errors +/// +/// If the any file could not be opened, or there was a problem setting +/// the size of at least one file. +fn truncate_size_only( + size_string: &str, + filenames: Vec, + create: bool, +) -> std::io::Result<()> { + let mode = match parse_mode_and_size(size_string) { + Ok(m) => m, + Err(_) => crash!(1, "Invalid number: ‘{}’", size_string), + }; + for filename in &filenames { + let fsize = metadata(filename).map(|m| m.len()).unwrap_or(0); + let tsize = mode.to_size(fsize); + file_truncate(filename, create, tsize)?; + } + Ok(()) +} + fn truncate( no_create: bool, _: bool, reference: Option, size: Option, filenames: Vec, -) { - let mode = match size { - Some(size_string) => match parse_mode_and_size(&size_string) { - Ok(m) => m, - Err(_) => crash!(1, "Invalid number: ‘{}’", size_string), - }, - None => TruncateMode::Reference(0), - }; - - let refsize = match reference { - Some(ref rfilename) => { - match mode { - // Only Some modes work with a reference - TruncateMode::Reference(_) => (), //No --size was given - TruncateMode::Extend(_) => (), - TruncateMode::Reduce(_) => (), - _ => crash!(1, "you must specify a relative ‘--size’ with ‘--reference’"), - }; - match metadata(rfilename) { - Ok(meta) => meta.len(), - Err(f) => match f.kind() { - ErrorKind::NotFound => { - crash!(1, "cannot stat '{}': No such file or directory", rfilename) - } - _ => crash!(1, "{}", f.to_string()), - }, - } - } - None => 0, - }; - for filename in &filenames { - let path = Path::new(filename); - match OpenOptions::new().write(true).create(!no_create).open(path) { - Ok(file) => { - let fsize = match reference { - Some(_) => refsize, - None => match metadata(filename) { - Ok(meta) => meta.len(), - Err(f) => { - show_warning!("{}", f.to_string()); - continue; - } - }, - }; - let tsize = mode.to_size(fsize); - match file.set_len(tsize) { - Ok(_) => {} - Err(f) => crash!(1, "{}", f.to_string()), - }; - } - Err(f) => crash!(1, "{}", f.to_string()), +) -> std::io::Result<()> { + let create = !no_create; + // There are four possibilities + // - reference file given and size given, + // - reference file given but no size given, + // - no reference file given but size given, + // - no reference file given and no size given, + match (reference, size) { + (Some(rfilename), Some(size_string)) => { + truncate_reference_and_size(&rfilename, &size_string, filenames, create) } + (Some(rfilename), None) => truncate_reference_file_only(&rfilename, filenames, create), + (None, Some(size_string)) => truncate_size_only(&size_string, filenames, create), + (None, None) => crash!(1, "you must specify either --reference or --size"), } } From 12287fcc9cd616c86d9dd6e2af1852fea20faf10 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 29 May 2021 18:44:12 +0200 Subject: [PATCH 0730/1135] pr: fix clippy lints --- src/uu/pr/src/pr.rs | 107 ++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 63 deletions(-) diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index aa9510690..988327c63 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -11,20 +11,17 @@ extern crate quick_error; use chrono::offset::Local; use chrono::DateTime; -use getopts::{HasArg, Occur}; use getopts::Matches; -use itertools::structs::KMergeBy; -use itertools::{GroupBy, Itertools}; +use getopts::{HasArg, Occur}; +use itertools::Itertools; use quick_error::ResultExt; use regex::Regex; use std::convert::From; use std::fs::{metadata, File, Metadata}; use std::io::{stdin, stdout, BufRead, BufReader, Lines, Read, Stdin, Stdout, Write}; -use std::iter::{FlatMap, Map}; use std::num::ParseIntError; #[cfg(unix)] use std::os::unix::fs::FileTypeExt; -use std::vec::Vec; type IOError = std::io::Error; @@ -40,7 +37,7 @@ static READ_BUFFER_SIZE: usize = 1024 * 64; static DEFAULT_COLUMN_WIDTH: usize = 72; static DEFAULT_COLUMN_WIDTH_WITH_S_OPTION: usize = 512; static DEFAULT_COLUMN_SEPARATOR: &char = &TAB; -static FF: u8 = 0x0C as u8; +static FF: u8 = 0x0C_u8; mod options { pub static STRING_HEADER_OPTION: &str = "h"; @@ -448,16 +445,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { /// Removes -column and +page option as getopts cannot parse things like -3 etc /// # Arguments /// * `args` - Command line arguments -fn recreate_arguments(args: &Vec) -> Vec { +fn recreate_arguments(args: &[String]) -> Vec { let column_page_option = Regex::new(r"^[-+]\d+.*").unwrap(); let num_regex: Regex = Regex::new(r"(.\d+)|(\d+)|^[^-]$").unwrap(); //let a_file: Regex = Regex::new(r"^[^-+].*").unwrap(); let n_regex: Regex = Regex::new(r"^-n\s*$").unwrap(); - let mut arguments = args.clone(); + let mut arguments = args.to_owned(); let num_option: Option<(usize, &String)> = args.iter().find_position(|x| n_regex.is_match(x.trim())); - if num_option.is_some() { - let (pos, _value) = num_option.unwrap(); + if let Some((pos, _value)) = num_option { let num_val_opt = args.get(pos + 1); if num_val_opt.is_some() && !num_regex.is_match(num_val_opt.unwrap()) { let could_be_file = arguments.remove(pos + 1); @@ -545,11 +541,11 @@ fn parse_usize(matches: &Matches, opt: &str) -> Option> { fn build_options( matches: &Matches, - paths: &Vec, + paths: &[String], free_args: String, ) -> Result { - let form_feed_used = - matches.opt_present(options::FORM_FEED_OPTION) || matches.opt_present(options::FORM_FEED_OPTION_SMALL); + let form_feed_used = matches.opt_present(options::FORM_FEED_OPTION) + || matches.opt_present(options::FORM_FEED_OPTION_SMALL); let is_merge_mode: bool = matches.opt_present(options::MERGE_FILES_PRINT); @@ -571,21 +567,17 @@ fn build_options( None }; - let header: String = matches - .opt_str(options::STRING_HEADER_OPTION) - .unwrap_or(if is_merge_mode { + let header: String = matches.opt_str(options::STRING_HEADER_OPTION).unwrap_or( + if is_merge_mode || paths[0] == FILE_STDIN { String::new() } else { - if paths[0] == FILE_STDIN { - String::new() - } else { - paths[0].to_string() - } - }); + paths[0].to_string() + }, + ); let default_first_number: usize = NumberingMode::default().first_number; - let first_number: usize = - parse_usize(matches, options::FIRST_LINE_NUMBER_OPTION).unwrap_or(Ok(default_first_number))?; + let first_number: usize = parse_usize(matches, options::FIRST_LINE_NUMBER_OPTION) + .unwrap_or(Ok(default_first_number))?; let number: Option = matches .opt_str(options::NUMBERING_MODE_OPTION) @@ -598,12 +590,11 @@ fn build_options( NumberingMode::default().separator }; - let width: usize = if parse_result.is_err() { - i[1..] + let width: usize = match parse_result { + Ok(res) => res, + Err(_) => i[1..] .parse::() - .unwrap_or(NumberingMode::default().width) - } else { - parse_result.unwrap() + .unwrap_or(NumberingMode::default().width), }; NumberingMode { @@ -737,7 +728,7 @@ fn build_options( Some(x) => Some(x), None => matches.opt_str(options::COLUMN_CHAR_SEPARATOR_OPTION), } - .unwrap_or(DEFAULT_COLUMN_SEPARATOR.to_string()); + .unwrap_or_else(|| DEFAULT_COLUMN_SEPARATOR.to_string()); let default_column_width = if matches.opt_present(options::COLUMN_WIDTH_OPTION) && matches.opt_present(options::COLUMN_CHAR_SEPARATOR_OPTION) @@ -778,15 +769,13 @@ fn build_options( _ => start_column_option, }; - let column_mode_options: Option = match column_option_value { - Some(columns) => Some(ColumnModeOptions { + let column_mode_options: Option = + column_option_value.map(|columns| ColumnModeOptions { columns, width: column_width, column_separator, across_mode, - }), - _ => None, - }; + }); let offset_spaces: String = " ".repeat(parse_usize(matches, options::OFFSET_SPACES_OPTION).unwrap_or(Ok(0))?); @@ -795,14 +784,14 @@ fn build_options( let col_sep_for_printing = column_mode_options .as_ref() .map(|i| i.column_separator.clone()) - .unwrap_or( + .unwrap_or_else(|| { merge_files_print .map(|_k| DEFAULT_COLUMN_SEPARATOR.to_string()) - .unwrap_or(String::new()), - ); + .unwrap_or_default() + }); - let columns_to_print = - merge_files_print.unwrap_or(column_mode_options.as_ref().map(|i| i.columns).unwrap_or(1)); + let columns_to_print = merge_files_print + .unwrap_or_else(|| column_mode_options.as_ref().map(|i| i.columns).unwrap_or(1)); let line_width: Option = if join_lines { None @@ -864,7 +853,7 @@ fn open(path: &str) -> Result, PrError> { _ => Err(PrError::UnknownFiletype(path_string)), } }) - .unwrap_or(Err(PrError::NotExists(path.to_string()))) + .unwrap_or_else(|_| Err(PrError::NotExists(path.to_string()))) } fn split_lines_if_form_feed(file_content: Result) -> Vec { @@ -988,7 +977,7 @@ fn read_stream_and_create_pages( ) } -fn mpr(paths: &Vec, options: &OutputOptions) -> Result { +fn mpr(paths: &[String], options: &OutputOptions) -> Result { let nfiles = paths.len(); // Check if files exists @@ -996,11 +985,7 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { open(path)?; } - let file_line_groups: GroupBy< - usize, - KMergeBy)>>, _>, _, _>, _>, - _, - > = paths + let file_line_groups = paths .iter() .enumerate() .map(|indexed_path: (usize, &String)| { @@ -1018,9 +1003,9 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { group_key: page_number * nfiles + fl.file_id, ..fl }) - .collect() + .collect::>() }) - .flat_map(|x: Vec| x) + .flatten() }) .kmerge_by(|a: &FileLine, b: &FileLine| { if a.group_key == b.group_key { @@ -1055,11 +1040,7 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { Ok(0) } -fn print_page( - lines: &Vec, - options: &OutputOptions, - page: usize, -) -> Result { +fn print_page(lines: &[FileLine], options: &OutputOptions, page: usize) -> Result { let line_separator = options.line_separator.as_bytes(); let page_separator = options.page_separator_char.as_bytes(); @@ -1088,7 +1069,7 @@ fn print_page( } fn write_columns( - lines: &Vec, + lines: &[FileLine], options: &OutputOptions, out: &mut Stdout, ) -> Result { @@ -1100,7 +1081,9 @@ fn write_columns( options.content_lines_per_page }; - let columns = options.merge_files_print.unwrap_or(get_columns(options)); + let columns = options + .merge_files_print + .unwrap_or_else(|| get_columns(options)); let line_width: Option = options.line_width; let mut lines_printed = 0; let feed_line_present = options.form_feed_used; @@ -1123,9 +1106,9 @@ fn write_columns( break; } filled_lines.push(Some(line)); - offset += 1; inserted += 1; } + offset += inserted; for _i in inserted..content_lines_per_page { filled_lines.push(None); @@ -1279,18 +1262,16 @@ fn header_content(options: &OutputOptions, page: usize) -> Vec { } fn file_last_modified_time(path: &str) -> String { - let file_metadata = metadata(path); - return file_metadata + metadata(path) .map(|i| { - return i - .modified() + i.modified() .map(|x| { let datetime: DateTime = x.into(); datetime.format("%b %d %H:%M %Y").to_string() }) - .unwrap_or(String::new()); + .unwrap_or_default() }) - .unwrap_or(String::new()); + .unwrap_or_default() } /// Returns five empty lines as trailer content if displaying trailer From 0913a776673c9a6416ae170a1c2ea0a4a3d32c95 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 29 May 2021 18:58:23 +0200 Subject: [PATCH 0731/1135] pr: let type inference do its works --- src/uu/pr/src/pr.rs | 224 +++++++++++++++++++++----------------------- 1 file changed, 107 insertions(+), 117 deletions(-) diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index 988327c63..06e358898 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -17,9 +17,8 @@ use itertools::Itertools; use quick_error::ResultExt; use regex::Regex; use std::convert::From; -use std::fs::{metadata, File, Metadata}; -use std::io::{stdin, stdout, BufRead, BufReader, Lines, Read, Stdin, Stdout, Write}; -use std::num::ParseIntError; +use std::fs::{metadata, File}; +use std::io::{stdin, stdout, BufRead, BufReader, Lines, Read, Stdout, Write}; #[cfg(unix)] use std::os::unix::fs::FileTypeExt; @@ -381,7 +380,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { opts.optflag("", "help", "display this help and exit"); opts.optflag("V", "version", "output version information and exit"); - let opt_args: Vec = recreate_arguments(&args); + let opt_args = recreate_arguments(&args); let matches = match opts.parse(&opt_args[1..]) { Ok(m) => m, @@ -393,7 +392,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return 0; } - let mut files: Vec = matches.free.clone(); + let mut files = matches.free.clone(); if files.is_empty() { //For stdin files.insert(0, FILE_STDIN.to_owned()); @@ -403,30 +402,29 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return print_usage(&mut opts, &matches); } - let file_groups: Vec> = if matches.opt_present(options::MERGE_FILES_PRINT) { + let file_groups: Vec<_> = if matches.opt_present(options::MERGE_FILES_PRINT) { vec![files] } else { files.into_iter().map(|i| vec![i]).collect() }; for file_group in file_groups { - let result_options: Result = - build_options(&matches, &file_group, args.join(" ")); + let result_options = build_options(&matches, &file_group, args.join(" ")); if result_options.is_err() { print_error(&matches, result_options.err().unwrap()); return 1; } - let options: &OutputOptions = &result_options.unwrap(); + let options = &result_options.unwrap(); - let cmd_result: Result = if file_group.len() == 1 { + let cmd_result = if file_group.len() == 1 { pr(&file_group.get(0).unwrap(), options) } else { mpr(&file_group, options) }; - let status: i32 = match cmd_result { + let status = match cmd_result { Err(error) => { print_error(&matches, error); 1 @@ -447,12 +445,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { /// * `args` - Command line arguments fn recreate_arguments(args: &[String]) -> Vec { let column_page_option = Regex::new(r"^[-+]\d+.*").unwrap(); - let num_regex: Regex = Regex::new(r"(.\d+)|(\d+)|^[^-]$").unwrap(); + let num_regex = Regex::new(r"(.\d+)|(\d+)|^[^-]$").unwrap(); //let a_file: Regex = Regex::new(r"^[^-+].*").unwrap(); - let n_regex: Regex = Regex::new(r"^-n\s*$").unwrap(); + let n_regex = Regex::new(r"^-n\s*$").unwrap(); let mut arguments = args.to_owned(); - let num_option: Option<(usize, &String)> = - args.iter().find_position(|x| n_regex.is_match(x.trim())); + let num_option = args.iter().find_position(|x| n_regex.is_match(x.trim())); if let Some((pos, _value)) = num_option { let num_val_opt = args.get(pos + 1); if num_val_opt.is_some() && !num_regex.is_match(num_val_opt.unwrap()) { @@ -529,7 +526,7 @@ fn parse_usize(matches: &Matches, opt: &str) -> Option> { let from_parse_error_to_pr_error = |value_to_parse: (String, String)| { let i = value_to_parse.0; let option = value_to_parse.1; - i.parse::().map_err(|_e| { + i.parse().map_err(|_e| { PrError::EncounteredErrors(format!("invalid {} argument '{}'", option, i)) }) }; @@ -547,27 +544,25 @@ fn build_options( let form_feed_used = matches.opt_present(options::FORM_FEED_OPTION) || matches.opt_present(options::FORM_FEED_OPTION_SMALL); - let is_merge_mode: bool = matches.opt_present(options::MERGE_FILES_PRINT); + let is_merge_mode = matches.opt_present(options::MERGE_FILES_PRINT); if is_merge_mode && matches.opt_present(options::COLUMN_OPTION) { - let err_msg: String = - String::from("cannot specify number of columns when printing in parallel"); + let err_msg = String::from("cannot specify number of columns when printing in parallel"); return Err(PrError::EncounteredErrors(err_msg)); } if is_merge_mode && matches.opt_present(options::ACROSS_OPTION) { - let err_msg: String = - String::from("cannot specify both printing across and printing in parallel"); + let err_msg = String::from("cannot specify both printing across and printing in parallel"); return Err(PrError::EncounteredErrors(err_msg)); } - let merge_files_print: Option = if matches.opt_present(options::MERGE_FILES_PRINT) { + let merge_files_print = if matches.opt_present(options::MERGE_FILES_PRINT) { Some(paths.len()) } else { None }; - let header: String = matches.opt_str(options::STRING_HEADER_OPTION).unwrap_or( + let header = matches.opt_str(options::STRING_HEADER_OPTION).unwrap_or( if is_merge_mode || paths[0] == FILE_STDIN { String::new() } else { @@ -575,22 +570,22 @@ fn build_options( }, ); - let default_first_number: usize = NumberingMode::default().first_number; - let first_number: usize = parse_usize(matches, options::FIRST_LINE_NUMBER_OPTION) + let default_first_number = NumberingMode::default().first_number; + let first_number = parse_usize(matches, options::FIRST_LINE_NUMBER_OPTION) .unwrap_or(Ok(default_first_number))?; - let number: Option = matches + let number = matches .opt_str(options::NUMBERING_MODE_OPTION) .map(|i| { - let parse_result: Result = i.parse::(); + let parse_result = i.parse::(); - let separator: String = if parse_result.is_err() { + let separator = if parse_result.is_err() { i[0..1].to_string() } else { NumberingMode::default().separator }; - let width: usize = match parse_result { + let width = match parse_result { Ok(res) => res, Err(_) => i[1..] .parse::() @@ -605,24 +600,24 @@ fn build_options( }) .or_else(|| { if matches.opt_present(options::NUMBERING_MODE_OPTION) { - return Some(NumberingMode::default()); + Some(NumberingMode::default()) + } else { + None } - - None }); - let double_space: bool = matches.opt_present(options::DOUBLE_SPACE_OPTION); + let double_space = matches.opt_present(options::DOUBLE_SPACE_OPTION); - let content_line_separator: String = if double_space { + let content_line_separator = if double_space { "\n".repeat(2) } else { "\n".to_string() }; - let line_separator: String = "\n".to_string(); + let line_separator = "\n".to_string(); - let last_modified_time: String = if is_merge_mode || paths[0].eq(FILE_STDIN) { - let datetime: DateTime = Local::now(); + let last_modified_time = if is_merge_mode || paths[0].eq(FILE_STDIN) { + let datetime = Local::now(); datetime.format("%b %d %H:%M %Y").to_string() } else { file_last_modified_time(paths.get(0).unwrap()) @@ -630,9 +625,9 @@ fn build_options( // +page option is less priority than --pages let page_plus_re = Regex::new(r"\s*\+(\d+:*\d*)\s*").unwrap(); - let start_page_in_plus_option: usize = match page_plus_re.captures(&free_args).map(|i| { + let start_page_in_plus_option = match page_plus_re.captures(&free_args).map(|i| { let unparsed_num = i.get(1).unwrap().as_str().trim(); - let x: Vec<&str> = unparsed_num.split(':').collect(); + let x: Vec<_> = unparsed_num.split(':').collect(); x[0].to_string().parse::().map_err(|_e| { PrError::EncounteredErrors(format!("invalid {} argument '{}'", "+", unparsed_num)) }) @@ -641,12 +636,12 @@ fn build_options( _ => 1, }; - let end_page_in_plus_option: Option = match page_plus_re + let end_page_in_plus_option = match page_plus_re .captures(&free_args) .map(|i| i.get(1).unwrap().as_str().trim()) .filter(|i| i.contains(':')) .map(|unparsed_num| { - let x: Vec<&str> = unparsed_num.split(':').collect(); + let x: Vec<_> = unparsed_num.split(':').collect(); x[1].to_string().parse::().map_err(|_e| { PrError::EncounteredErrors(format!("invalid {} argument '{}'", "+", unparsed_num)) }) @@ -656,16 +651,16 @@ fn build_options( }; let invalid_pages_map = |i: String| { - let unparsed_value: String = matches.opt_str(options::PAGE_RANGE_OPTION).unwrap(); + let unparsed_value = matches.opt_str(options::PAGE_RANGE_OPTION).unwrap(); i.parse::().map_err(|_e| { PrError::EncounteredErrors(format!("invalid --pages argument '{}'", unparsed_value)) }) }; - let start_page: usize = match matches + let start_page = match matches .opt_str(options::PAGE_RANGE_OPTION) .map(|i| { - let x: Vec<&str> = i.split(':').collect(); + let x: Vec<_> = i.split(':').collect(); x[0].to_string() }) .map(invalid_pages_map) @@ -674,11 +669,11 @@ fn build_options( _ => start_page_in_plus_option, }; - let end_page: Option = match matches + let end_page = match matches .opt_str(options::PAGE_RANGE_OPTION) - .filter(|i: &String| i.contains(':')) - .map(|i: String| { - let x: Vec<&str> = i.split(':').collect(); + .filter(|i| i.contains(':')) + .map(|i| { + let x: Vec<_> = i.split(':').collect(); x[1].to_string() }) .map(invalid_pages_map) @@ -701,30 +696,30 @@ fn build_options( LINES_PER_PAGE }; - let page_length: usize = + let page_length = parse_usize(matches, options::PAGE_LENGTH_OPTION).unwrap_or(Ok(default_lines_per_page))?; - let page_length_le_ht: bool = page_length < (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE); + let page_length_le_ht = page_length < (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE); - let display_header_and_trailer: bool = + let display_header_and_trailer = !(page_length_le_ht) && !matches.opt_present(options::NO_HEADER_TRAILER_OPTION); - let content_lines_per_page: usize = if page_length_le_ht { + let content_lines_per_page = if page_length_le_ht { page_length } else { page_length - (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE) }; - let page_separator_char: String = if matches.opt_present(options::FORM_FEED_OPTION) { + let page_separator_char = if matches.opt_present(options::FORM_FEED_OPTION) { let bytes = vec![FF]; String::from_utf8(bytes).unwrap() } else { "\n".to_string() }; - let across_mode: bool = matches.opt_present(options::ACROSS_OPTION); + let across_mode = matches.opt_present(options::ACROSS_OPTION); - let column_separator: String = match matches.opt_str(options::COLUMN_STRING_SEPARATOR_OPTION) { + let column_separator = match matches.opt_str(options::COLUMN_STRING_SEPARATOR_OPTION) { Some(x) => Some(x), None => matches.opt_str(options::COLUMN_CHAR_SEPARATOR_OPTION), } @@ -738,10 +733,10 @@ fn build_options( DEFAULT_COLUMN_WIDTH }; - let column_width: usize = + let column_width = parse_usize(matches, options::COLUMN_WIDTH_OPTION).unwrap_or(Ok(default_column_width))?; - let page_width: Option = if matches.opt_present(options::JOIN_LINES_OPTION) { + let page_width = if matches.opt_present(options::JOIN_LINES_OPTION) { None } else { match parse_usize(matches, options::PAGE_WIDTH_OPTION) { @@ -752,7 +747,7 @@ fn build_options( let re_col = Regex::new(r"\s*-(\d+)\s*").unwrap(); - let start_column_option: Option = match re_col.captures(&free_args).map(|i| { + let start_column_option = match re_col.captures(&free_args).map(|i| { let unparsed_num = i.get(1).unwrap().as_str().trim(); unparsed_num.parse::().map_err(|_e| { PrError::EncounteredErrors(format!("invalid {} argument '{}'", "-", unparsed_num)) @@ -764,22 +759,21 @@ fn build_options( // --column has more priority than -column - let column_option_value: Option = match parse_usize(matches, options::COLUMN_OPTION) { + let column_option_value = match parse_usize(matches, options::COLUMN_OPTION) { Some(res) => Some(res?), _ => start_column_option, }; - let column_mode_options: Option = - column_option_value.map(|columns| ColumnModeOptions { - columns, - width: column_width, - column_separator, - across_mode, - }); + let column_mode_options = column_option_value.map(|columns| ColumnModeOptions { + columns, + width: column_width, + column_separator, + across_mode, + }); - let offset_spaces: String = + let offset_spaces = " ".repeat(parse_usize(matches, options::OFFSET_SPACES_OPTION).unwrap_or(Ok(0))?); - let join_lines: bool = matches.opt_present(options::JOIN_LINES_OPTION); + let join_lines = matches.opt_present(options::JOIN_LINES_OPTION); let col_sep_for_printing = column_mode_options .as_ref() @@ -793,7 +787,7 @@ fn build_options( let columns_to_print = merge_files_print .unwrap_or_else(|| column_mode_options.as_ref().map(|i| i.columns).unwrap_or(1)); - let line_width: Option = if join_lines { + let line_width = if join_lines { None } else if columns_to_print > 1 { Some( @@ -830,12 +824,12 @@ fn build_options( fn open(path: &str) -> Result, PrError> { if path == FILE_STDIN { - let stdin: Stdin = stdin(); + let stdin = stdin(); return Ok(Box::new(stdin) as Box); } metadata(path) - .map(|i: Metadata| { + .map(|i| { let path_string = path.to_string(); match i.file_type() { #[cfg(unix)] @@ -859,9 +853,9 @@ fn open(path: &str) -> Result, PrError> { fn split_lines_if_form_feed(file_content: Result) -> Vec { file_content .map(|content| { - let mut lines: Vec = Vec::new(); - let mut f_occurred: usize = 0; - let mut chunk: Vec = Vec::new(); + let mut lines = Vec::new(); + let mut f_occurred = 0; + let mut chunk = Vec::new(); for byte in content.as_bytes() { if byte == &FF { f_occurred += 1; @@ -897,11 +891,9 @@ fn split_lines_if_form_feed(file_content: Result) -> Vec Result { - let lines: Lines>> = - BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?).lines(); + let lines = BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?).lines(); - let pages: Box)>> = - read_stream_and_create_pages(options, lines, 0); + let pages = read_stream_and_create_pages(options, lines, 0); for page_with_page_number in pages { let page_number = page_with_page_number.0 + 1; @@ -917,24 +909,24 @@ fn read_stream_and_create_pages( lines: Lines>>, file_id: usize, ) -> Box)>> { - let start_page: usize = options.start_page; - let start_line_number: usize = get_start_line_number(options); - let last_page: Option = options.end_page; - let lines_needed_per_page: usize = lines_to_read_for_page(options); + let start_page = options.start_page; + let start_line_number = get_start_line_number(options); + let last_page = options.end_page; + let lines_needed_per_page = lines_to_read_for_page(options); Box::new( lines .map(split_lines_if_form_feed) .flatten() .enumerate() - .map(move |i: (usize, FileLine)| FileLine { - line_number: i.0 + start_line_number, + .map(move |(i, line)| FileLine { + line_number: i + start_line_number, file_id, - ..i.1 + ..line }) // Add line number and file_id .batching(move |it| { - let mut first_page: Vec = Vec::new(); - let mut page_with_lines: Vec> = Vec::new(); + let mut first_page = Vec::new(); + let mut page_with_lines = Vec::new(); for line in it { let form_feeds_after = line.form_feeds_after; first_page.push(line); @@ -961,15 +953,14 @@ fn read_stream_and_create_pages( }) // Create set of pages as form feeds could lead to empty pages .flatten() // Flatten to pages from page sets .enumerate() // Assign page number - .skip_while(move |x: &(usize, Vec)| { + .skip_while(move |(x, _)| { // Skip the not needed pages - let current_page = x.0 + 1; - + let current_page = x + 1; current_page < start_page }) - .take_while(move |x: &(usize, Vec)| { + .take_while(move |(x, _)| { // Take only the required pages - let current_page = x.0 + 1; + let current_page = x + 1; current_page >= start_page && (last_page.is_none() || current_page <= last_page.unwrap()) @@ -988,14 +979,13 @@ fn mpr(paths: &[String], options: &OutputOptions) -> Result { let file_line_groups = paths .iter() .enumerate() - .map(|indexed_path: (usize, &String)| { - let lines = - BufReader::with_capacity(READ_BUFFER_SIZE, open(indexed_path.1).unwrap()).lines(); + .map(|(i, path)| { + let lines = BufReader::with_capacity(READ_BUFFER_SIZE, open(path).unwrap()).lines(); - read_stream_and_create_pages(options, lines, indexed_path.0) - .map(move |x: (usize, Vec)| { - let file_line = x.1; - let page_number = x.0 + 1; + read_stream_and_create_pages(options, lines, i) + .map(move |(x, line)| { + let file_line = line; + let page_number = x + 1; file_line .into_iter() .map(|fl| FileLine { @@ -1007,17 +997,17 @@ fn mpr(paths: &[String], options: &OutputOptions) -> Result { }) .flatten() }) - .kmerge_by(|a: &FileLine, b: &FileLine| { + .kmerge_by(|a, b| { if a.group_key == b.group_key { a.line_number < b.line_number } else { a.group_key < b.group_key } }) - .group_by(|file_line: &FileLine| file_line.group_key); + .group_by(|file_line| file_line.group_key); - let start_page: usize = options.start_page; - let mut lines: Vec = Vec::new(); + let start_page = options.start_page; + let mut lines = Vec::new(); let mut page_counter = start_page; for (_key, file_line_group) in file_line_groups.into_iter() { @@ -1044,9 +1034,9 @@ fn print_page(lines: &[FileLine], options: &OutputOptions, page: usize) -> Resul let line_separator = options.line_separator.as_bytes(); let page_separator = options.page_separator_char.as_bytes(); - let header: Vec = header_content(options, page); - let trailer_content: Vec = trailer_content(options); - let out: &mut Stdout = &mut stdout(); + let header = header_content(options, page); + let trailer_content = trailer_content(options); + let out = &mut stdout(); out.lock(); for x in header { @@ -1057,7 +1047,7 @@ fn print_page(lines: &[FileLine], options: &OutputOptions, page: usize) -> Resul let lines_written = write_columns(lines, options, out)?; for index in 0..trailer_content.len() { - let x: &String = trailer_content.get(index).unwrap(); + let x = trailer_content.get(index).unwrap(); out.write_all(x.as_bytes())?; if index + 1 != trailer_content.len() { out.write_all(line_separator)?; @@ -1084,7 +1074,7 @@ fn write_columns( let columns = options .merge_files_print .unwrap_or_else(|| get_columns(options)); - let line_width: Option = options.line_width; + let line_width = options.line_width; let mut lines_printed = 0; let feed_line_present = options.form_feed_used; let mut not_found_break = false; @@ -1095,9 +1085,9 @@ fn write_columns( .map(|i| i.across_mode) .unwrap_or(false); - let mut filled_lines: Vec> = Vec::new(); + let mut filled_lines = Vec::new(); if options.merge_files_print.is_some() { - let mut offset: usize = 0; + let mut offset = 0; for col in 0..columns { let mut inserted = 0; for i in offset..lines.len() { @@ -1116,7 +1106,7 @@ fn write_columns( } } - let table: Vec>> = (0..content_lines_per_page) + let table: Vec> = (0..content_lines_per_page) .map(move |a| { (0..columns) .map(|i| { @@ -1134,7 +1124,7 @@ fn write_columns( }) .collect(); - let blank_line: FileLine = FileLine::default(); + let blank_line = FileLine::default(); for row in table { let indexes = row.len(); for (i, cell) in row.iter().enumerate() { @@ -1147,7 +1137,7 @@ fn write_columns( not_found_break = true; break; } else if cell.is_some() { - let file_line: &FileLine = cell.unwrap(); + let file_line = cell.unwrap(); out.write_all( get_line_for_printing(&options, file_line, columns, i, &line_width, indexes) @@ -1176,7 +1166,7 @@ fn get_line_for_printing( ) -> String { // Check this condition let blank_line = String::new(); - let fmtd_line_number: String = get_fmtd_line_number(&options, file_line.line_number, index); + let fmtd_line_number = get_fmtd_line_number(&options, file_line.line_number, index); let mut complete_line = format!( "{}{}", @@ -1184,9 +1174,9 @@ fn get_line_for_printing( file_line.line_content.as_ref().unwrap() ); - let offset_spaces: &String = &options.offset_spaces; + let offset_spaces = &options.offset_spaces; - let tab_count: usize = complete_line.chars().filter(|i| i == &TAB).count(); + let tab_count = complete_line.chars().filter(|i| i == &TAB).count(); let display_length = complete_line.len() + (tab_count * 7); @@ -1245,7 +1235,7 @@ fn get_fmtd_line_number(opts: &OutputOptions, line_number: usize, index: usize) /// * `page` - A reference to page number fn header_content(options: &OutputOptions, page: usize) -> Vec { if options.display_header_and_trailer { - let first_line: String = format!( + let first_line = format!( "{} {} Page {}", options.last_modified_time, options.header, page ); From 2e1035b3502dfcd90a8ff4e0e5c212ca787b41a1 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 29 May 2021 19:02:42 +0200 Subject: [PATCH 0732/1135] pr: static to const --- src/uu/pr/src/pr.rs | 64 ++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index 06e358898..425a72878 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -24,40 +24,40 @@ use std::os::unix::fs::FileTypeExt; type IOError = std::io::Error; -static NAME: &str = "pr"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); -static TAB: char = '\t'; -static LINES_PER_PAGE: usize = 66; -static LINES_PER_PAGE_FOR_FORM_FEED: usize = 63; -static HEADER_LINES_PER_PAGE: usize = 5; -static TRAILER_LINES_PER_PAGE: usize = 5; -static FILE_STDIN: &str = "-"; -static READ_BUFFER_SIZE: usize = 1024 * 64; -static DEFAULT_COLUMN_WIDTH: usize = 72; -static DEFAULT_COLUMN_WIDTH_WITH_S_OPTION: usize = 512; -static DEFAULT_COLUMN_SEPARATOR: &char = &TAB; -static FF: u8 = 0x0C_u8; +const NAME: &str = "pr"; +const VERSION: &str = env!("CARGO_PKG_VERSION"); +const TAB: char = '\t'; +const LINES_PER_PAGE: usize = 66; +const LINES_PER_PAGE_FOR_FORM_FEED: usize = 63; +const HEADER_LINES_PER_PAGE: usize = 5; +const TRAILER_LINES_PER_PAGE: usize = 5; +const FILE_STDIN: &str = "-"; +const READ_BUFFER_SIZE: usize = 1024 * 64; +const DEFAULT_COLUMN_WIDTH: usize = 72; +const DEFAULT_COLUMN_WIDTH_WITH_S_OPTION: usize = 512; +const DEFAULT_COLUMN_SEPARATOR: &char = &TAB; +const FF: u8 = 0x0C_u8; mod options { - pub static STRING_HEADER_OPTION: &str = "h"; - pub static DOUBLE_SPACE_OPTION: &str = "d"; - pub static NUMBERING_MODE_OPTION: &str = "n"; - pub static FIRST_LINE_NUMBER_OPTION: &str = "N"; - pub static PAGE_RANGE_OPTION: &str = "pages"; - pub static NO_HEADER_TRAILER_OPTION: &str = "t"; - pub static PAGE_LENGTH_OPTION: &str = "l"; - pub static SUPPRESS_PRINTING_ERROR: &str = "r"; - pub static FORM_FEED_OPTION: &str = "F"; - pub static FORM_FEED_OPTION_SMALL: &str = "f"; - pub static COLUMN_WIDTH_OPTION: &str = "w"; - pub static PAGE_WIDTH_OPTION: &str = "W"; - pub static ACROSS_OPTION: &str = "a"; - pub static COLUMN_OPTION: &str = "column"; - pub static COLUMN_CHAR_SEPARATOR_OPTION: &str = "s"; - pub static COLUMN_STRING_SEPARATOR_OPTION: &str = "S"; - pub static MERGE_FILES_PRINT: &str = "m"; - pub static OFFSET_SPACES_OPTION: &str = "o"; - pub static JOIN_LINES_OPTION: &str = "J"; + pub const STRING_HEADER_OPTION: &str = "h"; + pub const DOUBLE_SPACE_OPTION: &str = "d"; + pub const NUMBERING_MODE_OPTION: &str = "n"; + pub const FIRST_LINE_NUMBER_OPTION: &str = "N"; + pub const PAGE_RANGE_OPTION: &str = "pages"; + pub const NO_HEADER_TRAILER_OPTION: &str = "t"; + pub const PAGE_LENGTH_OPTION: &str = "l"; + pub const SUPPRESS_PRINTING_ERROR: &str = "r"; + pub const FORM_FEED_OPTION: &str = "F"; + pub const FORM_FEED_OPTION_SMALL: &str = "f"; + pub const COLUMN_WIDTH_OPTION: &str = "w"; + pub const PAGE_WIDTH_OPTION: &str = "W"; + pub const ACROSS_OPTION: &str = "a"; + pub const COLUMN_OPTION: &str = "column"; + pub const COLUMN_CHAR_SEPARATOR_OPTION: &str = "s"; + pub const COLUMN_STRING_SEPARATOR_OPTION: &str = "S"; + pub const MERGE_FILES_PRINT: &str = "m"; + pub const OFFSET_SPACES_OPTION: &str = "o"; + pub const JOIN_LINES_OPTION: &str = "J"; } struct OutputOptions { From 4744b3579685cb757a11baea893a8d286b7d425a Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 29 May 2021 19:09:50 +0200 Subject: [PATCH 0733/1135] pr: explicit none in match expressions --- src/uu/pr/src/pr.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index 425a72878..65fb20c19 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -633,7 +633,7 @@ fn build_options( }) }) { Some(res) => res?, - _ => 1, + None => 1, }; let end_page_in_plus_option = match page_plus_re @@ -647,7 +647,7 @@ fn build_options( }) }) { Some(res) => Some(res?), - _ => None, + None => None, }; let invalid_pages_map = |i: String| { @@ -666,7 +666,7 @@ fn build_options( .map(invalid_pages_map) { Some(res) => res?, - _ => start_page_in_plus_option, + None => start_page_in_plus_option, }; let end_page = match matches @@ -679,7 +679,7 @@ fn build_options( .map(invalid_pages_map) { Some(res) => Some(res?), - _ => end_page_in_plus_option, + None => end_page_in_plus_option, }; if end_page.is_some() && start_page > end_page.unwrap() { @@ -754,14 +754,14 @@ fn build_options( }) }) { Some(res) => Some(res?), - _ => None, + None => None, }; // --column has more priority than -column let column_option_value = match parse_usize(matches, options::COLUMN_OPTION) { Some(res) => Some(res?), - _ => start_column_option, + None => start_column_option, }; let column_mode_options = column_option_value.map(|columns| ColumnModeOptions { From b0bf3e7e0fc6d23ff26dbdeac56780169600cdee Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 29 May 2021 19:34:17 +0200 Subject: [PATCH 0734/1135] pr: rustfmt test_pr.rs and utils.rs --- tests/by-util/test_pr.rs | 7 +++++-- tests/common/util.rs | 11 ++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/by-util/test_pr.rs b/tests/by-util/test_pr.rs index 1cd8fbdc8..aae0cc058 100644 --- a/tests/by-util/test_pr.rs +++ b/tests/by-util/test_pr.rs @@ -1,7 +1,7 @@ use crate::common::util::*; -use std::fs::metadata; use chrono::offset::Local; use chrono::DateTime; +use std::fs::metadata; fn file_last_modified_time(ucmd: &UCommand, path: &str) -> String { let tmp_dir_path = ucmd.get_full_fixture_path(path); @@ -245,7 +245,10 @@ fn test_with_no_header_trailer_option() { scenario .args(&["-t", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![(&"{last_modified_time}".to_string(), &value)]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] diff --git a/tests/common/util.rs b/tests/common/util.rs index cbe33e950..722417acf 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -226,8 +226,13 @@ impl CmdResult { } /// like stdout_is_fixture(...), but replaces the data in fixture file based on values provided in template_vars /// command output - pub fn stdout_is_templated_fixture>(&self, file_rel_path: T, template_vars: Vec<(&String, &String)>) -> &CmdResult { - let mut contents = String::from_utf8(read_scenario_fixture(&self.tmpd, file_rel_path)).unwrap(); + pub fn stdout_is_templated_fixture>( + &self, + file_rel_path: T, + template_vars: Vec<(&String, &String)>, + ) -> &CmdResult { + let mut contents = + String::from_utf8(read_scenario_fixture(&self.tmpd, file_rel_path)).unwrap(); for kv in template_vars { contents = contents.replace(kv.0, kv.1); } @@ -923,7 +928,7 @@ impl UCommand { cmd_result } - pub fn get_full_fixture_path(&self, file_rel_path: &str) -> String{ + pub fn get_full_fixture_path(&self, file_rel_path: &str) -> String { let tmpdir_path = self.tmpd.as_ref().unwrap().path(); format!("{}/{}", tmpdir_path.to_str().unwrap(), file_rel_path) } From 4058caa3e60fba539a62ea47faa065e17639cd0e Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 29 May 2021 21:28:58 +0200 Subject: [PATCH 0735/1135] maint: add spell checker to CICD --- .github/workflows/CICD.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 804720bea..de7a31938 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -614,3 +614,20 @@ jobs: flags: ${{ steps.vars.outputs.CODECOV_FLAGS }} name: codecov-umbrella fail_ci_if_error: false + spellcheck: + name: Spell Check + runs-on: ${{ matrix.job.os }} + strategy: + matrix: + job: + - { os: ubuntu-latest } + steps: + - uses: actions/checkout@v1 + - name: Install/setup prerequisites + shell: bash + run: | + sudo apt-get -y update ; sudo apt-get -y install npm ; sudo npm install cspell -g; + - name: Run `cspell` + shell: bash + run: | + cspell --config .vscode/cSpell.json --no-summary --no-progress $( git ls-files | grep "\.\(rs\|md\)" ) | sed "s/\(.*\):\(.*\):\(.*\) - \(.*\)/::warning file=\1,line=\2,col=\3::cspell: \4/" || true From d821719c67a6f3a6f7d67d4f1c04527451dd7bb1 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 29 May 2021 23:25:23 +0200 Subject: [PATCH 0736/1135] expr: support arbitrary precision integers (#2271) * expr: support arbitrary precision integers Instead of i64s we now use BigInts for integer operations. This means that no result or input can be out of range. The representation of integer flags was changed from i64 to u8 to make their intention clearer. * expr: allow big numbers as arguments as well Also adds some tests * expr: use num-traits to check bigints for 0 and 1 * expr: remove obsolete refs match ergonomics made these avoidable. * formatting Co-authored-by: Sylvestre Ledru --- Cargo.lock | 13 ++++ src/uu/expr/Cargo.toml | 2 + src/uu/expr/src/syntax_tree.rs | 107 +++++++++++++++------------------ src/uu/expr/src/tokens.rs | 12 ++-- tests/by-util/test_expr.rs | 78 ++++++++++++++++++------ 5 files changed, 128 insertions(+), 84 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6d2a47c84..997e1f458 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -859,6 +859,17 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +[[package]] +name = "num-bigint" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e0d047c1062aa51e256408c560894e5251f08925980e53cf1aa5bd00eec6512" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-integer" version = "0.1.44" @@ -1812,6 +1823,8 @@ name = "uu_expr" version = "0.0.6" dependencies = [ "libc", + "num-bigint", + "num-traits", "onig", "uucore", "uucore_procs", diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index c535df7ce..ed992bf71 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -16,6 +16,8 @@ path = "src/expr.rs" [dependencies] libc = "0.2.42" +num-bigint = "0.4.0" +num-traits = "0.2.14" onig = "~4.3.2" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/expr/src/syntax_tree.rs b/src/uu/expr/src/syntax_tree.rs index a75f4c742..b72d78729 100644 --- a/src/uu/expr/src/syntax_tree.rs +++ b/src/uu/expr/src/syntax_tree.rs @@ -12,6 +12,8 @@ // spell-checker:ignore (ToDO) binop binops ints paren prec +use num_bigint::BigInt; +use num_traits::{One, Zero}; use onig::{Regex, RegexOptions, Syntax}; use crate::tokens::Token; @@ -39,20 +41,17 @@ impl AstNode { for _ in 0..depth { print!("\t",); } - match *self { - AstNode::Leaf { - ref token_idx, - ref value, - } => println!( + match self { + AstNode::Leaf { token_idx, value } => println!( "Leaf( {} ) at #{} ( evaluate -> {:?} )", value, token_idx, self.evaluate() ), AstNode::Node { - ref token_idx, - ref op_type, - ref operands, + token_idx, + op_type, + operands, } => { println!( "Node( {} ) at #{} (evaluate -> {:?})", @@ -81,36 +80,33 @@ impl AstNode { }) } pub fn evaluate(&self) -> Result { - match *self { - AstNode::Leaf { ref value, .. } => Ok(value.clone()), - AstNode::Node { ref op_type, .. } => match self.operand_values() { + match self { + AstNode::Leaf { value, .. } => Ok(value.clone()), + AstNode::Node { op_type, .. } => match self.operand_values() { Err(reason) => Err(reason), Ok(operand_values) => match op_type.as_ref() { - "+" => infix_operator_two_ints( - |a: i64, b: i64| checked_binop(|| a.checked_add(b), "+"), - &operand_values, - ), - "-" => infix_operator_two_ints( - |a: i64, b: i64| checked_binop(|| a.checked_sub(b), "-"), - &operand_values, - ), - "*" => infix_operator_two_ints( - |a: i64, b: i64| checked_binop(|| a.checked_mul(b), "*"), - &operand_values, - ), + "+" => { + infix_operator_two_ints(|a: BigInt, b: BigInt| Ok(a + b), &operand_values) + } + "-" => { + infix_operator_two_ints(|a: BigInt, b: BigInt| Ok(a - b), &operand_values) + } + "*" => { + infix_operator_two_ints(|a: BigInt, b: BigInt| Ok(a * b), &operand_values) + } "/" => infix_operator_two_ints( - |a: i64, b: i64| { - if b == 0 { + |a: BigInt, b: BigInt| { + if b.is_zero() { Err("division by zero".to_owned()) } else { - checked_binop(|| a.checked_div(b), "/") + Ok(a / b) } }, &operand_values, ), "%" => infix_operator_two_ints( - |a: i64, b: i64| { - if b == 0 { + |a: BigInt, b: BigInt| { + if b.is_zero() { Err("division by zero".to_owned()) } else { Ok(a % b) @@ -119,32 +115,32 @@ impl AstNode { &operand_values, ), "=" => infix_operator_two_ints_or_two_strings( - |a: i64, b: i64| Ok(bool_as_int(a == b)), + |a: BigInt, b: BigInt| Ok(bool_as_int(a == b)), |a: &String, b: &String| Ok(bool_as_string(a == b)), &operand_values, ), "!=" => infix_operator_two_ints_or_two_strings( - |a: i64, b: i64| Ok(bool_as_int(a != b)), + |a: BigInt, b: BigInt| Ok(bool_as_int(a != b)), |a: &String, b: &String| Ok(bool_as_string(a != b)), &operand_values, ), "<" => infix_operator_two_ints_or_two_strings( - |a: i64, b: i64| Ok(bool_as_int(a < b)), + |a: BigInt, b: BigInt| Ok(bool_as_int(a < b)), |a: &String, b: &String| Ok(bool_as_string(a < b)), &operand_values, ), ">" => infix_operator_two_ints_or_two_strings( - |a: i64, b: i64| Ok(bool_as_int(a > b)), + |a: BigInt, b: BigInt| Ok(bool_as_int(a > b)), |a: &String, b: &String| Ok(bool_as_string(a > b)), &operand_values, ), "<=" => infix_operator_two_ints_or_two_strings( - |a: i64, b: i64| Ok(bool_as_int(a <= b)), + |a: BigInt, b: BigInt| Ok(bool_as_int(a <= b)), |a: &String, b: &String| Ok(bool_as_string(a <= b)), &operand_values, ), ">=" => infix_operator_two_ints_or_two_strings( - |a: i64, b: i64| Ok(bool_as_int(a >= b)), + |a: BigInt, b: BigInt| Ok(bool_as_int(a >= b)), |a: &String, b: &String| Ok(bool_as_string(a >= b)), &operand_values, ), @@ -161,7 +157,7 @@ impl AstNode { } } pub fn operand_values(&self) -> Result, String> { - if let AstNode::Node { ref operands, .. } = *self { + if let AstNode::Node { operands, .. } = self { let mut out = Vec::with_capacity(operands.len()); for operand in operands { match operand.evaluate() { @@ -217,9 +213,9 @@ fn maybe_dump_ast(result: &Result, String>) { if let Ok(debug_var) = env::var("EXPR_DEBUG_AST") { if debug_var == "1" { println!("EXPR_DEBUG_AST"); - match *result { - Ok(ref ast) => ast.debug_dump(), - Err(ref reason) => println!("\terr: {:?}", reason), + match result { + Ok(ast) => ast.debug_dump(), + Err(reason) => println!("\terr: {:?}", reason), } } } @@ -304,7 +300,7 @@ fn push_token_to_either_stack( out_stack: &mut TokenStack, op_stack: &mut TokenStack, ) -> Result<(), String> { - let result = match *token { + let result = match token { Token::Value { .. } => { out_stack.push((token_idx, token.clone())); Ok(()) @@ -420,24 +416,14 @@ fn move_till_match_paren( } } -fn checked_binop Option, T>(cb: F, op: &str) -> Result { - match cb() { - Some(v) => Ok(v), - None => Err(format!("{}: Numerical result out of range", op)), - } -} - fn infix_operator_two_ints(f: F, values: &[String]) -> Result where - F: Fn(i64, i64) -> Result, + F: Fn(BigInt, BigInt) -> Result, { assert!(values.len() == 2); - if let Ok(left) = values[0].parse::() { - if let Ok(right) = values[1].parse::() { - return match f(left, right) { - Ok(result) => Ok(result.to_string()), - Err(reason) => Err(reason), - }; + if let Ok(left) = values[0].parse::() { + if let Ok(right) = values[1].parse::() { + return f(left, right).map(|big_int| big_int.to_string()); } } Err("Expected an integer operand".to_string()) @@ -449,13 +435,14 @@ fn infix_operator_two_ints_or_two_strings( values: &[String], ) -> Result where - FI: Fn(i64, i64) -> Result, + FI: Fn(BigInt, BigInt) -> Result, FS: Fn(&String, &String) -> Result, { assert!(values.len() == 2); - if let (Some(a_int), Some(b_int)) = - (values[0].parse::().ok(), values[1].parse::().ok()) - { + if let (Some(a_int), Some(b_int)) = ( + values[0].parse::().ok(), + values[1].parse::().ok(), + ) { match fi(a_int, b_int) { Ok(result) => Ok(result.to_string()), Err(reason) => Err(reason), @@ -541,7 +528,7 @@ fn prefix_operator_substr(values: &[String]) -> String { subj.chars().skip(idx).take(len).collect() } -fn bool_as_int(b: bool) -> i64 { +fn bool_as_int(b: bool) -> u8 { if b { 1 } else { @@ -559,8 +546,8 @@ fn value_as_bool(s: &str) -> bool { if s.is_empty() { return false; } - match s.parse::() { - Ok(n) => n != 0, + match s.parse::() { + Ok(n) => n.is_one(), Err(_) => true, } } diff --git a/src/uu/expr/src/tokens.rs b/src/uu/expr/src/tokens.rs index 6056e4ba1..6f2795588 100644 --- a/src/uu/expr/src/tokens.rs +++ b/src/uu/expr/src/tokens.rs @@ -18,6 +18,8 @@ // spell-checker:ignore (ToDO) paren +use num_bigint::BigInt; + #[derive(Debug, Clone)] pub enum Token { Value { @@ -51,14 +53,14 @@ impl Token { } fn is_infix_plus(&self) -> bool { - match *self { - Token::InfixOp { ref value, .. } => value == "+", + match self { + Token::InfixOp { value, .. } => value == "+", _ => false, } } fn is_a_number(&self) -> bool { - match *self { - Token::Value { ref value, .. } => value.parse::().is_ok(), + match self { + Token::Value { value, .. } => value.parse::().is_ok(), _ => false, } } @@ -142,7 +144,7 @@ fn push_token_if_not_escaped(acc: &mut Vec<(usize, Token)>, tok_idx: usize, toke // Smells heuristics... :( let prev_is_plus = match acc.last() { None => false, - Some(ref t) => t.1.is_infix_plus(), + Some(t) => t.1.is_infix_plus(), }; let should_use_as_escaped = if prev_is_plus && acc.len() >= 2 { let pre_prev = &acc[acc.len() - 2]; diff --git a/tests/by-util/test_expr.rs b/tests/by-util/test_expr.rs index f20739e13..30e3016a3 100644 --- a/tests/by-util/test_expr.rs +++ b/tests/by-util/test_expr.rs @@ -2,55 +2,95 @@ use crate::common::util::*; #[test] fn test_simple_arithmetic() { - new_ucmd!().args(&["1", "+", "1"]).run().stdout_is("2\n"); + new_ucmd!() + .args(&["1", "+", "1"]) + .succeeds() + .stdout_only("2\n"); - new_ucmd!().args(&["1", "-", "1"]).run().stdout_is("0\n"); + new_ucmd!() + .args(&["1", "-", "1"]) + .fails() + .status_code(1) + .stdout_only("0\n"); - new_ucmd!().args(&["3", "*", "2"]).run().stdout_is("6\n"); + new_ucmd!() + .args(&["3", "*", "2"]) + .succeeds() + .stdout_only("6\n"); - new_ucmd!().args(&["4", "/", "2"]).run().stdout_is("2\n"); + new_ucmd!() + .args(&["4", "/", "2"]) + .succeeds() + .stdout_only("2\n"); } #[test] fn test_complex_arithmetic() { - let run = new_ucmd!() + new_ucmd!() .args(&["9223372036854775807", "+", "9223372036854775807"]) - .run(); - run.stdout_is(""); - run.stderr_is("expr: +: Numerical result out of range"); + .succeeds() + .stdout_only("18446744073709551614\n"); - let run = new_ucmd!().args(&["9", "/", "0"]).run(); - run.stdout_is(""); - run.stderr_is("expr: division by zero"); + new_ucmd!() + .args(&[ + "92233720368547758076549841651981984981498415651", + "%", + "922337203685", + ]) + .succeeds() + .stdout_only("533691697086\n"); + + new_ucmd!() + .args(&[ + "92233720368547758076549841651981984981498415651", + "*", + "922337203685", + ]) + .succeeds() + .stdout_only("85070591730190566808700855121818604965830915152801178873935\n"); + + new_ucmd!() + .args(&[ + "92233720368547758076549841651981984981498415651", + "-", + "922337203685", + ]) + .succeeds() + .stdout_only("92233720368547758076549841651981984059161211966\n"); + + new_ucmd!() + .args(&["9", "/", "0"]) + .fails() + .stderr_only("expr: division by zero\n"); } #[test] fn test_parenthesis() { new_ucmd!() .args(&["(", "1", "+", "1", ")", "*", "2"]) - .run() - .stdout_is("4\n"); + .succeeds() + .stdout_only("4\n"); } #[test] fn test_or() { new_ucmd!() .args(&["0", "|", "foo"]) - .run() - .stdout_is("foo\n"); + .succeeds() + .stdout_only("foo\n"); new_ucmd!() .args(&["foo", "|", "bar"]) - .run() - .stdout_is("foo\n"); + .succeeds() + .stdout_only("foo\n"); } #[test] fn test_and() { new_ucmd!() .args(&["foo", "&", "1"]) - .run() - .stdout_is("foo\n"); + .succeeds() + .stdout_only("foo\n"); new_ucmd!().args(&["", "&", "1"]).run().stdout_is("0\n"); } From dc63133f1449b45d2068555935322101a0a4acff Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 29 May 2021 23:25:56 +0200 Subject: [PATCH 0737/1135] sort: correctly inherit global flags for keys (#2302) Closes #2254. We should only inherit global settings for keys when there are absolutely no options attached to the key. The default key (matching the whole line) is implicitly added only if no keys are supplied. Improved some error messages by including more context. --- src/uu/sort/BENCHMARKING.md | 2 +- src/uu/sort/src/sort.rs | 366 ++++++++++++------ tests/by-util/test_sort.rs | 57 ++- tests/fixtures/sort/blanks.expected | 5 + tests/fixtures/sort/blanks.expected.debug | 15 + tests/fixtures/sort/blanks.txt | 5 + tests/fixtures/sort/keys_ignore_flag.expected | 2 + .../sort/keys_ignore_flag.expected.debug | 6 + tests/fixtures/sort/keys_ignore_flag.txt | 2 + 9 files changed, 331 insertions(+), 129 deletions(-) create mode 100644 tests/fixtures/sort/blanks.expected create mode 100644 tests/fixtures/sort/blanks.expected.debug create mode 100644 tests/fixtures/sort/blanks.txt create mode 100644 tests/fixtures/sort/keys_ignore_flag.expected create mode 100644 tests/fixtures/sort/keys_ignore_flag.expected.debug create mode 100644 tests/fixtures/sort/keys_ignore_flag.txt diff --git a/src/uu/sort/BENCHMARKING.md b/src/uu/sort/BENCHMARKING.md index fd728c41d..560d6b438 100644 --- a/src/uu/sort/BENCHMARKING.md +++ b/src/uu/sort/BENCHMARKING.md @@ -2,7 +2,7 @@ Most of the time when sorting is spent comparing lines. The comparison functions however differ based on which arguments are passed to `sort`, therefore it is important to always benchmark multiple scenarios. -This is an overwiew over what was benchmarked, and if you make changes to `sort`, you are encouraged to check +This is an overview over what was benchmarked, and if you make changes to `sort`, you are encouraged to check how performance was affected for the workloads listed below. Feel free to add other workloads to the list that we should improve / make sure not to regress. diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 5fdaf32cf..a3b79e5d7 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -108,7 +108,7 @@ const POSITIVE: char = '+'; // available memory into consideration, instead of relying on this constant only. static DEFAULT_BUF_SIZE: usize = 1_000_000_000; // 1 GB -#[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy, Debug)] enum SortMode { Numeric, HumanNumeric, @@ -118,6 +118,21 @@ enum SortMode { Random, Default, } + +impl SortMode { + fn get_short_name(&self) -> Option { + match self { + SortMode::Numeric => Some('n'), + SortMode::HumanNumeric => Some('h'), + SortMode::GeneralNumeric => Some('g'), + SortMode::Month => Some('M'), + SortMode::Version => Some('V'), + SortMode::Random => Some('R'), + SortMode::Default => None, + } + } +} + #[derive(Clone)] pub struct GlobalSettings { mode: SortMode, @@ -211,7 +226,7 @@ impl Default for GlobalSettings { } } } -#[derive(Clone)] +#[derive(Clone, PartialEq, Debug)] struct KeySettings { mode: SortMode, ignore_blanks: bool, @@ -221,6 +236,60 @@ struct KeySettings { reverse: bool, } +impl KeySettings { + /// Checks if the supplied combination of `mode`, `ignore_non_printing` and `dictionary_order` is allowed. + fn check_compatibility( + mode: SortMode, + ignore_non_printing: bool, + dictionary_order: bool, + ) -> Result<(), String> { + if matches!( + mode, + SortMode::Numeric | SortMode::HumanNumeric | SortMode::GeneralNumeric | SortMode::Month + ) { + if dictionary_order { + return Err(format!( + "options '-{}{}' are incompatible", + 'd', + mode.get_short_name().unwrap() + )); + } else if ignore_non_printing { + return Err(format!( + "options '-{}{}' are incompatible", + 'i', + mode.get_short_name().unwrap() + )); + } + } + Ok(()) + } + + fn set_sort_mode(&mut self, mode: SortMode) -> Result<(), String> { + if self.mode != SortMode::Default { + return Err(format!( + "options '-{}{}' are incompatible", + self.mode.get_short_name().unwrap(), + mode.get_short_name().unwrap() + )); + } + Self::check_compatibility(mode, self.ignore_non_printing, self.dictionary_order)?; + self.mode = mode; + Ok(()) + } + + fn set_dictionary_order(&mut self) -> Result<(), String> { + Self::check_compatibility(self.mode, self.ignore_non_printing, true)?; + self.dictionary_order = true; + Ok(()) + } + + fn set_ignore_non_printing(&mut self) -> Result<(), String> { + Self::check_compatibility(self.mode, true, self.dictionary_order)?; + self.ignore_non_printing = true; + Ok(()) + } +} + impl From<&GlobalSettings> for KeySettings { fn from(settings: &GlobalSettings) -> Self { Self { @@ -234,6 +303,12 @@ impl From<&GlobalSettings> for KeySettings { } } +impl Default for KeySettings { + fn default() -> Self { + Self::from(&GlobalSettings::default()) + } +} + #[derive(Clone, Debug)] enum NumCache { AsF64(GeneralF64ParseResult), @@ -412,14 +487,18 @@ impl<'a> Line<'a> { } } } - if !(settings.mode == SortMode::Random - || settings.stable - || settings.unique - || !(settings.dictionary_order + if settings.mode != SortMode::Random + && !settings.stable + && !settings.unique + && (settings.dictionary_order || settings.ignore_blanks || settings.ignore_case || settings.ignore_non_printing - || settings.mode != SortMode::Default)) + || settings.mode != SortMode::Default + || settings + .selectors + .last() + .map_or(true, |selector| selector != &Default::default())) { // A last resort comparator is in use, underline the whole line. if self.line.is_empty() { @@ -483,7 +562,7 @@ fn tokenize_with_separator(line: &str, separator: char) -> Vec { tokens } -#[derive(Clone)] +#[derive(Clone, PartialEq, Debug)] struct KeyPosition { /// 1-indexed, 0 is invalid. field: usize, @@ -493,87 +572,45 @@ struct KeyPosition { } impl KeyPosition { - fn parse(key: &str, default_char_index: usize, settings: &mut KeySettings) -> Self { + fn new(key: &str, default_char_index: usize, ignore_blanks: bool) -> Result { let mut field_and_char = key.split('.'); - let mut field = field_and_char + + let field = field_and_char .next() - .unwrap_or_else(|| crash!(1, "invalid key `{}`", key)); - let mut char = field_and_char.next(); - - // If there is a char index, we expect options to appear after it. Otherwise we expect them after the field index. - let value_with_options = char.as_mut().unwrap_or(&mut field); - - let mut ignore_blanks = settings.ignore_blanks; - if let Some(options_start) = value_with_options.chars().position(char::is_alphabetic) { - for option in value_with_options[options_start..].chars() { - // valid options: MbdfghinRrV - match option { - 'M' => settings.mode = SortMode::Month, - 'b' => ignore_blanks = true, - 'd' => settings.dictionary_order = true, - 'f' => settings.ignore_case = true, - 'g' => settings.mode = SortMode::GeneralNumeric, - 'h' => settings.mode = SortMode::HumanNumeric, - 'i' => settings.ignore_non_printing = true, - 'n' => settings.mode = SortMode::Numeric, - 'R' => settings.mode = SortMode::Random, - 'r' => settings.reverse = true, - 'V' => settings.mode = SortMode::Version, - c => crash!(1, "invalid option for key: `{}`", c), - } - // All numeric sorts and month sort conflict with dictionary_order and ignore_non_printing. - // Instad of reporting an error, let them overwrite each other. - - // FIXME: This should only override if the overridden flag is a global flag. - // If conflicting flags are attached to the key, GNU sort crashes and we should probably too. - match option { - 'h' | 'n' | 'g' | 'M' => { - settings.dictionary_order = false; - settings.ignore_non_printing = false; - } - 'd' | 'i' => { - settings.mode = match settings.mode { - SortMode::Numeric - | SortMode::HumanNumeric - | SortMode::GeneralNumeric - | SortMode::Month => SortMode::Default, - // Only SortMode::Default and SortMode::Version work with dictionary_order and ignore_non_printing - m @ SortMode::Default - | m @ SortMode::Version - | m @ SortMode::Random => m, - } - } - _ => {} - } - } - // Strip away option characters from the original value so we can parse it later - *value_with_options = &value_with_options[..options_start]; - } + .ok_or_else(|| format!("invalid key `{}`", key))?; + let char = field_and_char.next(); let field = field .parse() - .unwrap_or_else(|e| crash!(1, "failed to parse field index for key `{}`: {}", key, e)); + .map_err(|e| format!("failed to parse field index `{}`: {}", field, e))?; if field == 0 { - crash!(1, "field index was 0"); + return Err("field index can not be 0".to_string()); } - let char = char.map_or(default_char_index, |char| { - char.parse().unwrap_or_else(|e| { - crash!( - 1, - "failed to parse character index for key `{}`: {}", - key, - e - ) - }) - }); - Self { + + let char = char.map_or(Ok(default_char_index), |char| { + char.parse() + .map_err(|e| format!("failed to parse character index `{}`: {}", char, e)) + })?; + + Ok(Self { field, char, ignore_blanks, + }) + } +} + +impl Default for KeyPosition { + fn default() -> Self { + KeyPosition { + field: 1, + char: 1, + ignore_blanks: false, } } } -#[derive(Clone)] + +#[derive(Clone, PartialEq, Debug)] struct FieldSelector { from: KeyPosition, to: Option, @@ -583,20 +620,120 @@ struct FieldSelector { is_default_selection: bool, } -impl FieldSelector { - fn new(from: KeyPosition, to: Option, settings: KeySettings) -> Self { +impl Default for FieldSelector { + fn default() -> Self { Self { - is_default_selection: from.field == 1 - && from.char == 1 - && to.is_none() - && !matches!( - settings.mode, - SortMode::Numeric | SortMode::GeneralNumeric | SortMode::HumanNumeric - ), - needs_tokens: from.field != 1 || from.char == 0 || to.is_some(), - from, - to, - settings, + from: Default::default(), + to: None, + settings: Default::default(), + needs_tokens: false, + is_default_selection: true, + } + } +} + +impl FieldSelector { + /// Splits this position into the actual position and the attached options. + fn split_key_options(position: &str) -> (&str, &str) { + if let Some((options_start, _)) = position.char_indices().find(|(_, c)| c.is_alphabetic()) { + position.split_at(options_start) + } else { + (position, "") + } + } + + fn parse(key: &str, global_settings: &GlobalSettings) -> Self { + let mut from_to = key.split(','); + let (from, from_options) = Self::split_key_options(from_to.next().unwrap()); + let to = from_to.next().map(|to| Self::split_key_options(to)); + let options_are_empty = from_options.is_empty() && matches!(to, None | Some((_, ""))); + crash_if_err!( + 2, + if options_are_empty { + // Inherit the global settings if there are no options attached to this key. + (|| { + // This would be ideal for a try block, I think. In the meantime this closure allows + // to use the `?` operator here. + Self::new( + KeyPosition::new(from, 1, global_settings.ignore_blanks)?, + to.map(|(to, _)| KeyPosition::new(to, 0, global_settings.ignore_blanks)) + .transpose()?, + KeySettings::from(global_settings), + ) + })() + } else { + // Do not inherit from `global_settings`, as there are options attached to this key. + Self::parse_with_options((from, from_options), to) + } + .map_err(|e| format!("failed to parse key `{}`: {}", key, e)) + ) + } + + fn parse_with_options( + (from, from_options): (&str, &str), + to: Option<(&str, &str)>, + ) -> Result { + /// Applies `options` to `key_settings`, returning if the 'b'-flag (ignore blanks) was present. + fn parse_key_settings( + options: &str, + key_settings: &mut KeySettings, + ) -> Result { + let mut ignore_blanks = false; + for option in options.chars() { + match option { + 'M' => key_settings.set_sort_mode(SortMode::Month)?, + 'b' => ignore_blanks = true, + 'd' => key_settings.set_dictionary_order()?, + 'f' => key_settings.ignore_case = true, + 'g' => key_settings.set_sort_mode(SortMode::GeneralNumeric)?, + 'h' => key_settings.set_sort_mode(SortMode::HumanNumeric)?, + 'i' => key_settings.set_ignore_non_printing()?, + 'n' => key_settings.set_sort_mode(SortMode::Numeric)?, + 'R' => key_settings.set_sort_mode(SortMode::Random)?, + 'r' => key_settings.reverse = true, + 'V' => key_settings.set_sort_mode(SortMode::Version)?, + c => return Err(format!("invalid option: `{}`", c)), + } + } + Ok(ignore_blanks) + } + + let mut key_settings = KeySettings::default(); + let from = parse_key_settings(from_options, &mut key_settings) + .map(|ignore_blanks| KeyPosition::new(from, 1, ignore_blanks))??; + let to = if let Some((to, to_options)) = to { + Some( + parse_key_settings(to_options, &mut key_settings) + .map(|ignore_blanks| KeyPosition::new(to, 0, ignore_blanks))??, + ) + } else { + None + }; + Self::new(from, to, key_settings) + } + + fn new( + from: KeyPosition, + to: Option, + settings: KeySettings, + ) -> Result { + if from.char == 0 { + Err("invalid character index 0 for the start position of a field".to_string()) + } else { + Ok(Self { + is_default_selection: from.field == 1 + && from.char == 1 + && to.is_none() + && !matches!( + settings.mode, + SortMode::Numeric | SortMode::GeneralNumeric | SortMode::HumanNumeric + ) + && !from.ignore_blanks, + needs_tokens: from.field != 1 || from.char == 0 || to.is_some(), + from, + to, + settings, + }) } } @@ -900,7 +1037,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_SEPARATOR) .help("custom separator for -k") .takes_value(true)) - .arg(Arg::with_name(OPT_ZERO_TERMINATED) + .arg( + Arg::with_name(OPT_ZERO_TERMINATED) .short("z") .long(OPT_ZERO_TERMINATED) .help("line delimiter is NUL, not newline"), @@ -1053,43 +1191,27 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if matches.is_present(OPT_KEY) { for key in &matches.args[OPT_KEY].vals { - let key = key.to_string_lossy(); - let mut from_to = key.split(','); - let mut key_settings = KeySettings::from(&settings); - let from = KeyPosition::parse( - from_to - .next() - .unwrap_or_else(|| crash!(1, "invalid key `{}`", key)), - 1, - &mut key_settings, - ); - if from.char == 0 { - crash!( - 1, - "invalid character index 0 in `{}` for the start position of a field", - key - ) - } - let to = from_to - .next() - .map(|to| KeyPosition::parse(to, 0, &mut key_settings)); - let field_selector = FieldSelector::new(from, to, key_settings); - settings.selectors.push(field_selector); + settings + .selectors + .push(FieldSelector::parse(&key.to_string_lossy(), &settings)); } } - if !settings.stable || !matches.is_present(OPT_KEY) { + if !matches.is_present(OPT_KEY) { // add a default selector matching the whole line let key_settings = KeySettings::from(&settings); - settings.selectors.push(FieldSelector::new( - KeyPosition { - field: 1, - char: 1, - ignore_blanks: key_settings.ignore_blanks, - }, - None, - key_settings, - )); + settings.selectors.push( + FieldSelector::new( + KeyPosition { + field: 1, + char: 1, + ignore_blanks: key_settings.ignore_blanks, + }, + None, + key_settings, + ) + .unwrap(), + ); } exec(&files, &settings) diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 6a2350749..588ce86bd 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -471,7 +471,7 @@ fn test_keys_invalid_field() { new_ucmd!() .args(&["-k", "1."]) .fails() - .stderr_only("sort: failed to parse character index for key `1.`: cannot parse integer from empty string"); + .stderr_only("sort: failed to parse key `1.`: failed to parse character index ``: cannot parse integer from empty string"); } #[test] @@ -479,7 +479,7 @@ fn test_keys_invalid_field_option() { new_ucmd!() .args(&["-k", "1.1x"]) .fails() - .stderr_only("sort: invalid option for key: `x`"); + .stderr_only("sort: failed to parse key `1.1x`: invalid option: `x`"); } #[test] @@ -487,7 +487,7 @@ fn test_keys_invalid_field_zero() { new_ucmd!() .args(&["-k", "0.1"]) .fails() - .stderr_only("sort: field index was 0"); + .stderr_only("sort: failed to parse key `0.1`: field index can not be 0"); } #[test] @@ -495,7 +495,7 @@ fn test_keys_invalid_char_zero() { new_ucmd!() .args(&["-k", "1.0"]) .fails() - .stderr_only("sort: invalid character index 0 in `1.0` for the start position of a field"); + .stderr_only("sort: failed to parse key `1.0`: invalid character index 0 for the start position of a field"); } #[test] @@ -586,6 +586,47 @@ fn test_keys_negative_size_match() { test_helper("keys_negative_size", &["-k 3,1"]); } +#[test] +fn test_keys_ignore_flag() { + test_helper("keys_ignore_flag", &["-k 1n -b"]) +} + +#[test] +fn test_doesnt_inherit_key_settings() { + let input = " 1 +2 + 10 +"; + new_ucmd!() + .args(&["-k", "1b", "-n"]) + .pipe_in(input) + .succeeds() + .stdout_only( + " 1 + 10 +2 +", + ); +} + +#[test] +fn test_inherits_key_settings() { + let input = " 1 +2 + 10 +"; + new_ucmd!() + .args(&["-k", "1", "-n"]) + .pipe_in(input) + .succeeds() + .stdout_only( + " 1 +2 + 10 +", + ); +} + #[test] fn test_zero_terminated() { test_helper("zero-terminated", &["-z"]); @@ -707,10 +748,9 @@ fn test_dictionary_and_nonprinting_conflicts() { .succeeds(); } for conflicting_arg in &conflicting_args { - // FIXME: this should ideally fail. new_ucmd!() .args(&["-k", &format!("1{},1{}", restricted_arg, conflicting_arg)]) - .succeeds(); + .fails(); } } } @@ -737,3 +777,8 @@ fn test_nonexistent_file() { "sort: cannot read: \"nonexistent.txt\": The system cannot find the file specified. (os error 2)", ); } + +#[test] +fn test_blanks() { + test_helper("blanks", &["-b", "--ignore-blanks"]); +} diff --git a/tests/fixtures/sort/blanks.expected b/tests/fixtures/sort/blanks.expected new file mode 100644 index 000000000..3469e434c --- /dev/null +++ b/tests/fixtures/sort/blanks.expected @@ -0,0 +1,5 @@ + a +b + x + x + z diff --git a/tests/fixtures/sort/blanks.expected.debug b/tests/fixtures/sort/blanks.expected.debug new file mode 100644 index 000000000..28c8fc960 --- /dev/null +++ b/tests/fixtures/sort/blanks.expected.debug @@ -0,0 +1,15 @@ + a + _ +___ +b +_ +_ + x + _ +__________ + x + _ +___ + z + _ +__ diff --git a/tests/fixtures/sort/blanks.txt b/tests/fixtures/sort/blanks.txt new file mode 100644 index 000000000..eb2f3c94e --- /dev/null +++ b/tests/fixtures/sort/blanks.txt @@ -0,0 +1,5 @@ +b + a + z + x + x diff --git a/tests/fixtures/sort/keys_ignore_flag.expected b/tests/fixtures/sort/keys_ignore_flag.expected new file mode 100644 index 000000000..964d04663 --- /dev/null +++ b/tests/fixtures/sort/keys_ignore_flag.expected @@ -0,0 +1,2 @@ + 1a +1A diff --git a/tests/fixtures/sort/keys_ignore_flag.expected.debug b/tests/fixtures/sort/keys_ignore_flag.expected.debug new file mode 100644 index 000000000..6d0da711f --- /dev/null +++ b/tests/fixtures/sort/keys_ignore_flag.expected.debug @@ -0,0 +1,6 @@ + 1a + _ +___ +1A +_ +__ diff --git a/tests/fixtures/sort/keys_ignore_flag.txt b/tests/fixtures/sort/keys_ignore_flag.txt new file mode 100644 index 000000000..964d04663 --- /dev/null +++ b/tests/fixtures/sort/keys_ignore_flag.txt @@ -0,0 +1,2 @@ + 1a +1A From a54fc7a4baf0ae345135b3c01a1d8401ee75ca9e Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 30 May 2021 00:28:44 +0200 Subject: [PATCH 0738/1135] pr: remove unused asref implementations --- src/uu/pr/src/pr.rs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index 8ac9e5bba..8df267959 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -91,12 +91,6 @@ struct FileLine { form_feeds_after: usize, } -impl AsRef for FileLine { - fn as_ref(&self) -> &FileLine { - self - } -} - struct ColumnModeOptions { width: usize, columns: usize, @@ -104,12 +98,6 @@ struct ColumnModeOptions { across_mode: bool, } -impl AsRef for OutputOptions { - fn as_ref(&self) -> &OutputOptions { - self - } -} - struct NumberingMode { /// Line numbering mode width: usize, From f9bc80e42c65e4f93d7be6dac55f4d56f8bf3240 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 30 May 2021 00:32:33 +0200 Subject: [PATCH 0739/1135] pr: remove comments that are obvious through types --- src/uu/pr/src/pr.rs | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index 8df267959..055a40d2f 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -98,8 +98,8 @@ struct ColumnModeOptions { across_mode: bool, } +/// Line numbering mode struct NumberingMode { - /// Line numbering mode width: usize, separator: String, first_number: usize, @@ -384,7 +384,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let mut files = matches.free.clone(); if files.is_empty() { - //For stdin files.insert(0, FILE_STDIN.to_owned()); } @@ -445,14 +444,7 @@ fn recreate_arguments(args: &[String]) -> Vec { if num_val_opt.is_some() && !num_regex.is_match(num_val_opt.unwrap()) { let could_be_file = arguments.remove(pos + 1); arguments.insert(pos + 1, format!("{}", NumberingMode::default().width)); - // FIXME: the following line replaces the block below that had the same - // code for both conditional branches. Figure this out. arguments.insert(pos + 2, could_be_file); - // if a_file.is_match(could_be_file.trim().as_ref()) { - // arguments.insert(pos + 2, could_be_file); - // } else { - // arguments.insert(pos + 2, could_be_file); - // } } } @@ -1154,7 +1146,6 @@ fn get_line_for_printing( line_width: &Option, indexes: usize, ) -> String { - // Check this condition let blank_line = String::new(); let fmtd_line_number = get_fmtd_line_number(&options, file_line.line_number, index); @@ -1220,9 +1211,6 @@ fn get_fmtd_line_number(opts: &OutputOptions, line_number: usize, index: usize) /// Returns a five line header content if displaying header is not disabled by /// using `NO_HEADER_TRAILER_OPTION` option. -/// # Arguments -/// * `options` - A reference to OutputOptions -/// * `page` - A reference to page number fn header_content(options: &OutputOptions, page: usize) -> Vec { if options.display_header_and_trailer { let first_line = format!( @@ -1256,8 +1244,6 @@ fn file_last_modified_time(path: &str) -> String { /// Returns five empty lines as trailer content if displaying trailer /// is not disabled by using `NO_HEADER_TRAILER_OPTION`option. -/// # Arguments -/// * `opts` - A reference to OutputOptions fn trailer_content(options: &OutputOptions) -> Vec { if options.display_header_and_trailer && !options.form_feed_used { vec![ @@ -1275,8 +1261,6 @@ fn trailer_content(options: &OutputOptions) -> Vec { /// Returns starting line number for the file to be printed. /// If -N is specified the first line number changes otherwise /// default is 1. -/// # Arguments -/// * `opts` - A reference to OutputOptions fn get_start_line_number(opts: &OutputOptions) -> usize { opts.number.as_ref().map(|i| i.first_number).unwrap_or(1) } @@ -1284,8 +1268,6 @@ fn get_start_line_number(opts: &OutputOptions) -> usize { /// Returns number of lines to read from input for constructing one page of pr output. /// If double space -d is used lines are halved. /// If columns --columns is used the lines are multiplied by the value. -/// # Arguments -/// * `opts` - A reference to OutputOptions fn lines_to_read_for_page(opts: &OutputOptions) -> usize { let content_lines_per_page = opts.content_lines_per_page; let columns = get_columns(opts); @@ -1297,8 +1279,6 @@ fn lines_to_read_for_page(opts: &OutputOptions) -> usize { } /// Returns number of columns to output -/// # Arguments -/// * `opts` - A reference to OutputOptions fn get_columns(opts: &OutputOptions) -> usize { opts.column_mode_options .as_ref() From 5b417e251d80a5d5652fea05ffcfccb9992243cf Mon Sep 17 00:00:00 2001 From: Dean Li Date: Sun, 30 May 2021 10:45:54 +0800 Subject: [PATCH 0740/1135] rmdir: match GNU error output Related to #2258 --- src/uu/rmdir/src/rmdir.rs | 6 ++++++ tests/by-util/test_rmdir.rs | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/uu/rmdir/src/rmdir.rs b/src/uu/rmdir/src/rmdir.rs index 7a7e8fc9b..6f0a2ffa9 100644 --- a/src/uu/rmdir/src/rmdir.rs +++ b/src/uu/rmdir/src/rmdir.rs @@ -20,6 +20,8 @@ static OPT_VERBOSE: &str = "verbose"; static ARG_DIRS: &str = "dirs"; +static ENOTDIR: i32 = 20; + fn get_usage() -> String { format!("{0} [OPTION]... DIRECTORY...", executable!()) } @@ -105,6 +107,10 @@ fn remove(dirs: Vec, ignore: bool, parents: bool, verbose: bool) -> Resu fn remove_dir(path: &Path, ignore: bool, verbose: bool) -> Result<(), i32> { let mut read_dir = match fs::read_dir(path) { Ok(m) => m, + Err(e) if e.raw_os_error() == Some(ENOTDIR) => { + show_error!("failed to remove '{}': Not a directory", path.display()); + return Err(1); + } Err(e) => { show_error!("reading directory '{}': {}", path.display(), e); return Err(1); diff --git a/tests/by-util/test_rmdir.rs b/tests/by-util/test_rmdir.rs index eef2d50f5..4b74b2522 100644 --- a/tests/by-util/test_rmdir.rs +++ b/tests/by-util/test_rmdir.rs @@ -108,3 +108,19 @@ fn test_rmdir_ignore_nonempty_directory_with_parents() { assert!(at.dir_exists(dir)); } + +#[test] +fn test_rmdir_remove_symlink_match_gnu_error() { + let (at, mut ucmd) = at_and_ucmd!(); + + let file = "file"; + let fl = "fl"; + at.touch(file); + assert!(at.file_exists(file)); + at.symlink_file(file, fl); + assert!(at.file_exists(fl)); + + ucmd.arg("fl/") + .fails() + .stderr_is("rmdir: failed to remove 'fl/': Not a directory"); +} From 83bb8795bd75aaae907d5b339e50ef64279ed82e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 30 May 2021 09:16:46 +0200 Subject: [PATCH 0741/1135] add a comment to explain the why --- src/uu/rmdir/src/rmdir.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uu/rmdir/src/rmdir.rs b/src/uu/rmdir/src/rmdir.rs index 6f0a2ffa9..6b6db0b65 100644 --- a/src/uu/rmdir/src/rmdir.rs +++ b/src/uu/rmdir/src/rmdir.rs @@ -108,6 +108,7 @@ fn remove_dir(path: &Path, ignore: bool, verbose: bool) -> Result<(), i32> { let mut read_dir = match fs::read_dir(path) { Ok(m) => m, Err(e) if e.raw_os_error() == Some(ENOTDIR) => { + // To match the GNU output show_error!("failed to remove '{}': Not a directory", path.display()); return Err(1); } From 3913731222ce263b3deb3991bfd36668eac610c2 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 30 May 2021 09:55:02 +0200 Subject: [PATCH 0742/1135] Revert "rmdir: match GNU error output" --- src/uu/rmdir/src/rmdir.rs | 7 ------- tests/by-util/test_rmdir.rs | 16 ---------------- 2 files changed, 23 deletions(-) diff --git a/src/uu/rmdir/src/rmdir.rs b/src/uu/rmdir/src/rmdir.rs index 6b6db0b65..7a7e8fc9b 100644 --- a/src/uu/rmdir/src/rmdir.rs +++ b/src/uu/rmdir/src/rmdir.rs @@ -20,8 +20,6 @@ static OPT_VERBOSE: &str = "verbose"; static ARG_DIRS: &str = "dirs"; -static ENOTDIR: i32 = 20; - fn get_usage() -> String { format!("{0} [OPTION]... DIRECTORY...", executable!()) } @@ -107,11 +105,6 @@ fn remove(dirs: Vec, ignore: bool, parents: bool, verbose: bool) -> Resu fn remove_dir(path: &Path, ignore: bool, verbose: bool) -> Result<(), i32> { let mut read_dir = match fs::read_dir(path) { Ok(m) => m, - Err(e) if e.raw_os_error() == Some(ENOTDIR) => { - // To match the GNU output - show_error!("failed to remove '{}': Not a directory", path.display()); - return Err(1); - } Err(e) => { show_error!("reading directory '{}': {}", path.display(), e); return Err(1); diff --git a/tests/by-util/test_rmdir.rs b/tests/by-util/test_rmdir.rs index 4b74b2522..eef2d50f5 100644 --- a/tests/by-util/test_rmdir.rs +++ b/tests/by-util/test_rmdir.rs @@ -108,19 +108,3 @@ fn test_rmdir_ignore_nonempty_directory_with_parents() { assert!(at.dir_exists(dir)); } - -#[test] -fn test_rmdir_remove_symlink_match_gnu_error() { - let (at, mut ucmd) = at_and_ucmd!(); - - let file = "file"; - let fl = "fl"; - at.touch(file); - assert!(at.file_exists(file)); - at.symlink_file(file, fl); - assert!(at.file_exists(fl)); - - ucmd.arg("fl/") - .fails() - .stderr_is("rmdir: failed to remove 'fl/': Not a directory"); -} From 141a92c9650046de7178e93008b77c3013a6dc34 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 30 May 2021 09:29:10 +0200 Subject: [PATCH 0743/1135] CI: set clippy targets to 'all' --- .github/workflows/CICD.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 72682ff03..5ac9295d4 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -84,7 +84,7 @@ jobs: - name: Install `rust` toolchain uses: actions-rs/toolchain@v1 with: - toolchain: stable + toolchain: nightly default: true profile: minimal # minimal component installation (ie, no documentation) components: clippy @@ -94,7 +94,7 @@ jobs: run: | # `clippy` testing # * convert any warnings to GHA UI annotations; ref: - S=$(cargo +nightly clippy --target=${{ matrix.job.target }} ${{ 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:]]+(.*):([0-9]+):([0-9]+).*$/::warning file=\2,line=\3,col=\4::WARNING: \`cargo clippy\`: \1/p;" -e '}' ; } + 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:]]+(.*):([0-9]+):([0-9]+).*$/::warning file=\2,line=\3,col=\4::WARNING: \`cargo clippy\`: \1/p;" -e '}' ; } min_version: name: MinRustV # Minimum supported rust version From cda04eb690520d938c1983c941209724d18f9d26 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 30 May 2021 12:42:46 +0200 Subject: [PATCH 0744/1135] docs: add note for clippy usage --- DEVELOPER_INSTRUCTIONS.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/DEVELOPER_INSTRUCTIONS.md b/DEVELOPER_INSTRUCTIONS.md index c3b20dd46..3aa8b5b12 100644 --- a/DEVELOPER_INSTRUCTIONS.md +++ b/DEVELOPER_INSTRUCTIONS.md @@ -21,7 +21,7 @@ if changes are not reflected in the report then run `cargo clean` and run the a ### Using Stable Rust -If you are using stable version of Rust that doesn't enable code coverage instrumentation by default +If you are using stable version of Rust that doesn't enable code coverage instrumentation by default then add `-Z-Zinstrument-coverage` flag to `RUSTFLAGS` env variable specified above. @@ -36,3 +36,7 @@ To use the provided hook: 2. Run `pre-commit install` while in the repository directory Your git commits will then automatically be checked. If a check fails, an error message will explain why, and your commit will be canceled. You can then make the suggested changes, and run `git commit ...` again. + +### Using Clippy + +The `msrv` key in the clippy configuration file `clippy.toml` is used to disable lints pertaining to newer features by specifying the minimum supported Rust version (MSRV). However, this key is only supported on `nightly`. To invoke clippy without errors, use `cargo +nightly clippy`. In order to also check tests and non-default crate features, use `cargo +nightly clippy --all-targets --all-features`. From 898d325aeabdbb8a76bfdcf33caf3dce134990ae Mon Sep 17 00:00:00 2001 From: Anup Mahindre Date: Sun, 30 May 2021 18:00:52 +0530 Subject: [PATCH 0745/1135] ls: Fix minor output mismatch When a single directory is passed to ls in recursive mode, uutils ls won't print the directory name ====================== GNU ls: z: ====================== ====================== uutils ls: ====================== This commit fixes this minor inconsistency and adds corresponding test. --- src/uu/ls/src/ls.rs | 2 +- tests/by-util/test_ls.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 60c076441..5846cb0aa 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1223,7 +1223,7 @@ fn list(locs: Vec, config: Config) -> i32 { sort_entries(&mut dirs, &config); for dir in dirs { - if locs.len() > 1 { + if locs.len() > 1 || config.recursive { let _ = writeln!(out, "\n{}:", dir.p_buf.display()); } enter_directory(&dir, &config, &mut out); diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index d884948e6..9614f561e 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -899,6 +899,12 @@ fn test_ls_recursive() { scene.ucmd().arg("a").succeeds(); scene.ucmd().arg("a/a").succeeds(); + scene + .ucmd() + .arg("z") + .arg("-R") + .succeeds() + .stdout_contains(&"z:"); let result = scene .ucmd() .arg("--color=never") From 69850942b6dd03ebf67c5f7217ff9fee59140dfa Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 30 May 2021 16:26:00 +0200 Subject: [PATCH 0746/1135] fix a clippy warning WARNING: `cargo clippy`: single-character string constant used as pattern --- tests/by-util/test_du.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index c5d262c3b..e4dca7a61 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -187,7 +187,7 @@ fn test_du_d_flag() { // TODO: gnu `du` doesn't use trailing "/" here // result.stdout_str(), result_reference.stdout_str() result.stdout_str().trim_end_matches("/\n"), - result_reference.stdout_str().trim_end_matches("\n") + result_reference.stdout_str().trim_end_matches('\n') ); return; } From b9863e1cc4637f2c3eaff16ac274dce1f2e1c890 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 30 May 2021 20:07:57 +0200 Subject: [PATCH 0747/1135] fix precommit for clippy nightly --- .pre-commit-config.yaml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 66d2a5f5a..177b6b8e3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,16 @@ -# https://pre-commit.com -repos: - - repo: https://github.com/doublify/pre-commit-rust - rev: v1.0 +- repo: local hooks: - - id: cargo-check - - id: clippy - - id: fmt + - id: rust-linting + name: Rust linting + description: Run cargo fmt on files included in the commit. + entry: cargo +nightly fmt -- + pass_filenames: true + types: [file, rust] + language: system + - id: rust-clippy + name: Rust clippy + description: Run cargo clippy on files included in the commit. + entry: cargo +nightly clippy --all-targets --all-features -- + pass_filenames: false + types: [file, rust] + language: system From 4a3703d218131d4319a90fb3a925cdff1f4602e3 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 30 May 2021 23:18:45 +0200 Subject: [PATCH 0748/1135] fix a warning it was showing: [WARNING] normalizing pre-commit configuration to a top-level map. support for top level list will be removed in a future version. run: `pre-commit migrate-config` to automatically fix this. --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 177b6b8e3..e3ad98ee3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,4 @@ +repos: - repo: local hooks: - id: rust-linting From f787326e70acc9a5d62de6f76b180bc048351aea Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 31 May 2021 00:15:24 +0200 Subject: [PATCH 0749/1135] pr: add to GNUMakefile --- GNUmakefile | 1 + 1 file changed, 1 insertion(+) diff --git a/GNUmakefile b/GNUmakefile index 409a527cd..e2c608c8f 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -82,6 +82,7 @@ PROGS := \ nproc \ od \ paste \ + pr \ printenv \ printf \ ptx \ From 1c41efd73290aea82994f08b40e7e35f97c8745c Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 31 May 2021 09:35:46 +0200 Subject: [PATCH 0750/1135] stdbuf: use "parse_size" from uucore --- src/uu/stdbuf/src/stdbuf.rs | 45 ++++-------------------------------- tests/by-util/test_stdbuf.rs | 9 +++++++- 2 files changed, 13 insertions(+), 41 deletions(-) diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 485b3c70e..e39af3816 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -19,14 +19,14 @@ use std::path::PathBuf; use std::process::Command; use tempfile::tempdir; use tempfile::TempDir; +use uucore::parse_size::parse_size; use uucore::InvalidEncodingHandling; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Run COMMAND, with modified buffering operations for its standard streams.\n\n\ Mandatory arguments to long options are mandatory for short options too."; -static LONG_HELP: &str = - "If MODE is 'L' the corresponding stream will be line buffered.\n\ +static LONG_HELP: &str = "If MODE is 'L' the corresponding stream will be line buffered.\n\ This option is invalid with standard input.\n\n\ If MODE is '0' the corresponding stream will be unbuffered.\n\n\ Otherwise MODE is a number which may be followed by one of the following:\n\n\ @@ -57,7 +57,7 @@ const STDBUF_INJECT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/libstdbuf enum BufferType { Default, Line, - Size(u64), + Size(usize), } struct ProgramOptions { @@ -106,41 +106,6 @@ fn preload_strings() -> (&'static str, &'static str) { crash!(1, "Command not supported for this operating system!") } -fn parse_size(size: &str) -> Option { - let ext = size.trim_start_matches(|c: char| c.is_digit(10)); - let num = size.trim_end_matches(char::is_alphabetic); - let mut recovered = num.to_owned(); - recovered.push_str(ext); - if recovered != size { - return None; - } - let buf_size: u64 = match num.parse().ok() { - Some(m) => m, - None => return None, - }; - let (power, base): (u32, u64) = match ext { - "" => (0, 0), - "KB" => (1, 1024), - "K" => (1, 1000), - "MB" => (2, 1024), - "M" => (2, 1000), - "GB" => (3, 1024), - "G" => (3, 1000), - "TB" => (4, 1024), - "T" => (4, 1000), - "PB" => (5, 1024), - "P" => (5, 1000), - "EB" => (6, 1024), - "E" => (6, 1000), - "ZB" => (7, 1024), - "Z" => (7, 1000), - "YB" => (8, 1024), - "Y" => (8, 1000), - _ => return None, - }; - Some(buf_size * base.pow(power)) -} - fn check_option(matches: &ArgMatches, name: &str) -> Result { match matches.value_of(name) { Some(value) => match value { @@ -155,8 +120,8 @@ fn check_option(matches: &ArgMatches, name: &str) -> Result { let size = match parse_size(x) { - Some(m) => m, - None => return Err(ProgramOptionsError(format!("invalid mode {}", x))), + Ok(m) => m, + Err(e) => return Err(ProgramOptionsError(format!("invalid mode {}", e))), }; Ok(BufferType::Size(size)) } diff --git a/tests/by-util/test_stdbuf.rs b/tests/by-util/test_stdbuf.rs index 2e09601ce..e5d784edb 100644 --- a/tests/by-util/test_stdbuf.rs +++ b/tests/by-util/test_stdbuf.rs @@ -57,8 +57,15 @@ fn test_stdbuf_line_buffering_stdin_fails() { #[cfg(not(target_os = "windows"))] #[test] fn test_stdbuf_invalid_mode_fails() { + // TODO: GNU's `stdbuf` (8.32) does not return "\nTry 'stdbuf --help' for more information." + // for invalid modes. new_ucmd!() .args(&["-i", "1024R", "head"]) .fails() - .stderr_is("stdbuf: invalid mode 1024R\nTry 'stdbuf --help' for more information."); + .stderr_contains("stdbuf: invalid mode ‘1024R’"); + #[cfg(not(target_pointer_width = "128"))] + new_ucmd!() + .args(&["--error", "1Y", "head"]) + .fails() + .stderr_contains("stdbuf: invalid mode ‘1Y’: Value too large to be stored in data type"); } From 6c4479f82de0961b32615b68334972219813776e Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 31 May 2021 09:39:11 +0200 Subject: [PATCH 0751/1135] pr: add to other list in GNUMakefile --- GNUmakefile | 1 + 1 file changed, 1 insertion(+) diff --git a/GNUmakefile b/GNUmakefile index e2c608c8f..7d91989e8 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -189,6 +189,7 @@ TEST_PROGS := \ paste \ pathchk \ pinky \ + pr \ printf \ ptx \ pwd \ From 3a6605844ffe0db223e086b77c408535a32ec078 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 31 May 2021 09:54:31 +0200 Subject: [PATCH 0752/1135] uucore: move 'parse_time' to 'parser' "parse_time" only uses stdlib and does not need to be feature gated. A more suitable place is the newly created "src/uucore/src/lib/parser/" --- src/uu/sleep/Cargo.toml | 2 +- src/uu/timeout/Cargo.toml | 2 +- src/uucore/Cargo.toml | 1 - src/uucore/src/lib/features.rs | 2 -- src/uucore/src/lib/lib.rs | 3 +-- src/uucore/src/lib/parser.rs | 1 + src/uucore/src/lib/{features => parser}/parse_time.rs | 0 7 files changed, 4 insertions(+), 7 deletions(-) rename src/uucore/src/lib/{features => parser}/parse_time.rs (100%) diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index fe7ee2941..618ea7e28 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -16,7 +16,7 @@ path = "src/sleep.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["parse_time"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index 206a98c08..5116a163c 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -18,7 +18,7 @@ path = "src/timeout.rs" clap = "2.33" getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["process", "signals"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 482252680..0c11d2c15 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -44,7 +44,6 @@ entries = ["libc"] fs = ["libc"] fsext = ["libc", "time"] mode = ["libc"] -parse_time = [] perms = ["libc"] process = ["libc"] ringbuffer = [] diff --git a/src/uucore/src/lib/features.rs b/src/uucore/src/lib/features.rs index 310a41fe1..c1e1ec31e 100644 --- a/src/uucore/src/lib/features.rs +++ b/src/uucore/src/lib/features.rs @@ -6,8 +6,6 @@ pub mod encoding; pub mod fs; #[cfg(feature = "fsext")] pub mod fsext; -#[cfg(feature = "parse_time")] -pub mod parse_time; #[cfg(feature = "ringbuffer")] pub mod ringbuffer; #[cfg(feature = "zero-copy")] diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index a60af57fa..69819fd05 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -33,6 +33,7 @@ pub use crate::mods::ranges; // * string parsing modules pub use crate::parser::parse_size; +pub use crate::parser::parse_time; // * feature-gated modules #[cfg(feature = "encoding")] @@ -41,8 +42,6 @@ pub use crate::features::encoding; pub use crate::features::fs; #[cfg(feature = "fsext")] pub use crate::features::fsext; -#[cfg(feature = "parse_time")] -pub use crate::features::parse_time; #[cfg(feature = "ringbuffer")] pub use crate::features::ringbuffer; #[cfg(feature = "zero-copy")] diff --git a/src/uucore/src/lib/parser.rs b/src/uucore/src/lib/parser.rs index 21adefa1a..d09777e10 100644 --- a/src/uucore/src/lib/parser.rs +++ b/src/uucore/src/lib/parser.rs @@ -1 +1,2 @@ pub mod parse_size; +pub mod parse_time; diff --git a/src/uucore/src/lib/features/parse_time.rs b/src/uucore/src/lib/parser/parse_time.rs similarity index 100% rename from src/uucore/src/lib/features/parse_time.rs rename to src/uucore/src/lib/parser/parse_time.rs From 9f1deb2df6d4e08cc39ee89ba370f01f831de513 Mon Sep 17 00:00:00 2001 From: Dean Li Date: Sun, 30 May 2021 10:45:54 +0800 Subject: [PATCH 0753/1135] rmdir: match GNU error output Related to #2258 --- src/uu/rmdir/src/rmdir.rs | 9 +++++++++ tests/by-util/test_rmdir.rs | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/uu/rmdir/src/rmdir.rs b/src/uu/rmdir/src/rmdir.rs index 7a7e8fc9b..bebb2844b 100644 --- a/src/uu/rmdir/src/rmdir.rs +++ b/src/uu/rmdir/src/rmdir.rs @@ -20,6 +20,11 @@ static OPT_VERBOSE: &str = "verbose"; static ARG_DIRS: &str = "dirs"; +#[cfg(unix)] +static ENOTDIR: i32 = 20; +#[cfg(windows)] +static ENOTDIR: i32 = 267; + fn get_usage() -> String { format!("{0} [OPTION]... DIRECTORY...", executable!()) } @@ -105,6 +110,10 @@ fn remove(dirs: Vec, ignore: bool, parents: bool, verbose: bool) -> Resu fn remove_dir(path: &Path, ignore: bool, verbose: bool) -> Result<(), i32> { let mut read_dir = match fs::read_dir(path) { Ok(m) => m, + Err(e) if e.raw_os_error() == Some(ENOTDIR) => { + show_error!("failed to remove '{}': Not a directory", path.display()); + return Err(1); + } Err(e) => { show_error!("reading directory '{}': {}", path.display(), e); return Err(1); diff --git a/tests/by-util/test_rmdir.rs b/tests/by-util/test_rmdir.rs index eef2d50f5..4b74b2522 100644 --- a/tests/by-util/test_rmdir.rs +++ b/tests/by-util/test_rmdir.rs @@ -108,3 +108,19 @@ fn test_rmdir_ignore_nonempty_directory_with_parents() { assert!(at.dir_exists(dir)); } + +#[test] +fn test_rmdir_remove_symlink_match_gnu_error() { + let (at, mut ucmd) = at_and_ucmd!(); + + let file = "file"; + let fl = "fl"; + at.touch(file); + assert!(at.file_exists(file)); + at.symlink_file(file, fl); + assert!(at.file_exists(fl)); + + ucmd.arg("fl/") + .fails() + .stderr_is("rmdir: failed to remove 'fl/': Not a directory"); +} From 77a0a077b89923b596b4e6ed910be2e55fd87f37 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 31 May 2021 14:48:12 +0200 Subject: [PATCH 0754/1135] pr: update dependencies --- Cargo.lock | 10 ++++++++-- src/uu/pr/Cargo.toml | 6 +++--- src/uu/pr/src/pr.rs | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a7fa8f23b..4af8b5c9e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1206,6 +1206,12 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + [[package]] name = "quickcheck" version = "0.9.2" @@ -1929,7 +1935,7 @@ dependencies = [ "filetime", "ioctl-sys", "libc", - "quick-error", + "quick-error 1.2.3", "uucore", "uucore_procs", "walkdir", @@ -2420,7 +2426,7 @@ dependencies = [ "chrono", "getopts", "itertools 0.10.0", - "quick-error", + "quick-error 2.0.1", "regex", "time", "uucore", diff --git a/src/uu/pr/Cargo.toml b/src/uu/pr/Cargo.toml index 53f2a69b6..6d9ec2304 100644 --- a/src/uu/pr/Cargo.toml +++ b/src/uu/pr/Cargo.toml @@ -6,7 +6,7 @@ license = "MIT" description = "pr ~ (uutils) convert text files for printing" homepage = "https://github.com/uutils/coreutils" -repository = "https://github.com/uutils/coreutils/tree/master/src/uu/pinky" +repository = "https://github.com/uutils/coreutils/tree/master/src/uu/pr" keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"] categories = ["command-line-utilities"] edition = "2018" @@ -20,8 +20,8 @@ uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_p getopts = "0.2.21" time = "0.1.41" # A higher version would cause a conflict with time -chrono = "0.4.11" -quick-error = "1.2.3" +chrono = "0.4.19" +quick-error = "2.0.1" itertools = "0.10" regex = "1.0" diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index 055a40d2f..266f605c5 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -140,7 +140,7 @@ quick_error! { Input(err: IOError, path: String) { context(path: &'a str, err: IOError) -> (err, path.to_owned()) display("pr: Reading from input {0} gave error", path) - cause(err) + source(err) } UnknownFiletype(path: String) { From 27c59417d67c1a7568ba09c55ef2961c850d2832 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Thu, 27 May 2021 17:47:26 -0500 Subject: [PATCH 0755/1135] maint/dev ~ update EditorConfig --- .editorconfig | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/.editorconfig b/.editorconfig index 95dfec676..d93fa7c0e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,22 +3,38 @@ # * top-most EditorConfig file root = true -# Unix-style newlines with a newline ending every file [*] +# default ~ utf-8, unix-style newlines with a newline ending every file, 4 space indentation charset = utf-8 end_of_line = lf indent_size = 4 indent_style = space insert_final_newline = true +max_line_length = 100 trim_trailing_whitespace = true -[*.{bat,cmd,[Bb][Aa][Tt],[Cc][Mm][Dd]}] -# DOS/Win requires BAT/CMD files to have CRLF EOLNs -end_of_line = crlf - -[[Mm]akefile{,.*}] -# TAB-style indentation +[[Mm]akefile{,.*}, *.{mk,[Mm][Kk]}] +# makefiles ~ TAB-style indentation indent_style = tab -[*.{yml,[Yy][Mm][Ll]}] +[*.{bat,cmd,[Bb][Aa][Tt],[Cc][Mm][Dd]}] +# BAT/CMD ~ DOS/Win requires BAT/CMD files to have CRLF EOLNs +end_of_line = crlf + +[*.go] +# go ~ TAB-style indentation (SPACE-style alignment); ref: @@ +indent_style = tab + +[*.{cjs,js,json,mjs,ts}] +# js/ts indent_size = 2 + +[*.{markdown,md,mkd,[Mm][Dd],[Mm][Kk][Dd],[Mm][Dd][Oo][Ww][Nn],[Mm][Kk][Dd][Oo][Ww][Nn],[Mm][Aa][Rr][Kk][Dd][Oo][Ww][Nn]}] +# markdown +indent_size = 2 +indent_style = space + +[*.{yaml,yml,[Yy][Mm][Ll],[Yy][Aa][Mm][Ll]}] +# YAML +indent_size = 2 +indent_style = space From 03260f065da3d40cecf7d563df219f3825c9fd67 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Thu, 27 May 2021 17:51:00 -0500 Subject: [PATCH 0756/1135] maint/dev ~ (VSCode) add cspell spell-checker extension to recommendations --- .vscode/extensions.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index cb28d8883..46b105d37 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,10 +1,12 @@ { - // See http://go.microsoft.com/fwlink/?LinkId=827846 - // for the documentation about the extensions.json format + // spell-checker:ignore (misc) matklad + // see for the documentation about the extensions.json format "recommendations": [ // Rust language support. "rust-lang.rust", // Provides support for rust-analyzer: novel LSP server for the Rust programming language. - "matklad.rust-analyzer" + "matklad.rust-analyzer", + // `cspell` spell-checker support + "streetsidesoftware.code-spell-checker" ] } From ecdf32d1bc1790c765614b53779a5c5f7bb21d92 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 29 May 2021 22:26:16 -0500 Subject: [PATCH 0757/1135] maint/dev ~ add codespell configuration --- .codespell.rc | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .codespell.rc diff --git a/.codespell.rc b/.codespell.rc new file mode 100644 index 000000000..914ca2951 --- /dev/null +++ b/.codespell.rc @@ -0,0 +1,3 @@ +[codespell] +ignore-words-list = crate +skip = ./.git/**,./.vscode/cspell.dictionaries/**,./target/**,./tests/fixtures/** From 1c62c912b44b2dbb9ea75ef373687731027f25a8 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Thu, 27 May 2021 20:47:17 -0500 Subject: [PATCH 0758/1135] docs/spell ~ reconfigure cspell (for workspace dictionaries) --- .vscode/cSpell.json | 365 ++------------------------------------------ 1 file changed, 16 insertions(+), 349 deletions(-) diff --git a/.vscode/cSpell.json b/.vscode/cSpell.json index 8561d69ad..9869923a4 100644 --- a/.vscode/cSpell.json +++ b/.vscode/cSpell.json @@ -1,352 +1,19 @@ // `cspell` settings { - "version": "0.1", // Version of the setting file. Always 0.1 - "language": "en", // language - current active spelling language - // ignoreWords - "ignoreWords": [ - // abbrev/acronyms - "Cygwin", - "FreeBSD", - "Gmail", - "GNUEABI", - "GNUEABIhf", - "Irix", - "MacOS", - "MinGW", - "Minix", - "MS-DOS", - "MSDOS", - "NetBSD", - "Novell", - "OpenBSD", - "POSIX", - "SELinux", - "Solaris", - "Xenix", - "flac", - "lzma", - // cargo - "cdylib", - "rlib", - // crates - "advapi", - "advapi32-sys", - "aho-corasick", - "backtrace", - "byteorder", - "chacha", - "chrono", - "conv", - "corasick", - "filetime", - "formatteriteminfo", - "getopts", - "itertools", - "memchr", - "multifilereader", - "onig", - "peekreader", - "quickcheck", - "rand_chacha", - "smallvec", - "tempfile", - "termion", - "termios", - "termsize", - "termwidth", - "textwrap", - "walkdir", - "winapi", - "xattr", - // jargon - "AST", // abstract syntax tree - "CPU", - "CPUs", - "FIFO", - "FIFOs", - "FQDN", // fully qualified domain name - "GID", // group ID - "GIDs", - "POSIXLY", - "RNG", // random number generator - "RNGs", - "UID", // user ID - "UIDs", - "UUID", // universally unique identifier - "arity", - "bitmask", - "canonicalization", - "canonicalize", - "colorizable", - "colorize", - "consts", - "dedup", - "demangle", - "deque", - "dequeue", - "enqueue", - "executable", - "executables", - "gibibytes", - "hardfloat", - "hardlink", - "hardlinks", - "hashsums", - "kibibytes", - "mebibytes", - "mergeable", - "multibyte", - "nonportable", - "peekable", - "precompiled", - "precompute", - "preload", - "prepend", - "prepended", - "primality", - "pseudoprime", - "pseudoprimes", - "procs", - "readonly", - "seedable", - "semver", - "shortcode", - "shortcodes", - "symlink", - "symlinks", - "syscall", - "toekenize", - "unbuffered", - "unportable", - "whitespace", - // names - "Akira Hayakawa", "Akira", "Hayakawa", - "Alan Andrade", "Alan", "Andrade", - "Alex Lyon", "Alex", "Lyon", - "Alexander Batischev", "Alexander", "Batischev", - "Aleksander Bielawski", "Aleksander", "Bielawski", - "Alexander Fomin", "Alexander", "Fomin", - "Anthony Deschamps", "Anthony", "Deschamps", - "Ben Eills", "Ben", "Eills", - "Ben Hirsch", "Ben", "Hirsch", - "Benoit Benedetti", "Benoit", "Benedetti", - "Boden Garman", "Boden", "Garman", - "Chirag B Jadwani", "Chirag", "Jadwani", - "Derek Chiang", "Derek", "Chiang", - "Dorota Kapturkiewicz", "Dorota", "Kapturkiewicz", - "Evgeniy Klyuchikov", "Evgeniy", "Klyuchikov", - "Fangxu Hu", "Fangxu", "Hu", - "Gil Cottle", "Gil", "Cottle", - "Haitao Li", "Haitao", "Li", - "Inokentiy Babushkin", "Inokentiy", "Babushkin", - "Joao Oliveira", "Joao", "Oliveira", - "Jeremiah Peschka", "Jeremiah", "Peschka", - "Jian Zeng", "Jian", "Zeng", - "Jimmy Lu", "Jimmy", "Lu", - "Jordi Boggiano", "Jordi", "Boggiano", - "Jordy Dickinson", "Jordy", "Dickinson", - "Joseph Crail", "Joseph", "Crail", - "Joshua S Miller", "Joshua", "Miller", - "KokaKiwi", - "Konstantin Pospelov", "Konstantin", "Pospelov", - "Mahkoh", - "Maciej Dziardziel", "Maciej", "Dziardziel", - "Michael Gehring", "Michael", "Gehring", - "Martin Kysel", "Martin", "Kysel", - "Morten Olsen Lysgaard", "Morten", "Olsen", "Lysgaard", - "Nicholas Juszczak", "Nicholas", "Juszczak", - "Nick Platt", "Nick", "Platt", - "Orvar Segerström", "Orvar", "Segerström", - "Peter Atashian", "Peter", "Atashian", - "Rolf Morel", "Rolf", "Morel", - "Roman Gafiyatullin", "Roman", "Gafiyatullin", - "Roy Ivy III", "Roy", "Ivy", "III", - "Sergey 'Shnatsel' Davidoff", "Sergey", "Shnatsel", "Davidoff", - "Sokovikov Evgeniy", "Sokovikov", "Evgeniy", - "Sunrin SHIMURA", "Sunrin", "SHIMURA", - "Smigle00", "Smigle", - "Sylvestre Ledru", "Sylvestre", "Ledru", - "T Jameson Little", "Jameson", "Little", - "Tobias Bohumir Schottdorf", "Tobias", "Bohumir", "Schottdorf", - "Virgile Andreani", "Virgile", "Andreani", - "Vsevolod Velichko", "Vsevolod", "Velichko", - "Wiktor Kuropatwa", "Wiktor", "Kuropatwa", - "Yury Krivopalov", "Yury", "Krivopalov", - "anonymousknight", - "kwantam", - "nicoo", - "rivy", - // rust - "clippy", - "concat", - "fract", - "powi", - "println", - "repr", - "rfind", - "rustc", - "rustfmt", - "struct", - "structs", - "substr", - "splitn", - "trunc", - // shell - "passwd", - "pipefail", - "tcsh", - // tags - "Maint", - // uutils - "chcon", - "chgrp", - "chmod", - "chown", - "chroot", - "cksum", - "csplit", - "dircolors", - "hashsum", - "hostid", - "logname", - "mkdir", - "mkfifo", - "mknod", - "mktemp", - "nohup", - "nproc", - "numfmt", - "pathchk", - "printenv", - "printf", - "readlink", - "realpath", - "relpath", - "rmdir", - "runcon", - "shuf", - "stdbuf", - "stty", - "tsort", - "uname", - "unexpand", - "whoami", - // vars/errno - "errno", - "EOPNOTSUPP", - // vars/fcntl - "F_GETFL", - "GETFL", - "fcntl", - "vmsplice", - // vars/libc - "FILENO", - "HOSTSIZE", - "IDSIZE", - "IFIFO", - "IFREG", - "IRGRP", - "IROTH", - "IRUSR", - "ISGID", - "ISUID", - "ISVTX", - "IWGRP", - "IWOTH", - "IWUSR", - "IXGRP", - "IXOTH", - "IXUSR", - "LINESIZE", - "NAMESIZE", - "USERSIZE", - "addrinfo", - "addrlen", - "canonname", - "chroot", - "freeaddrinfo", - "getaddrinfo", - "getegid", - "geteuid", - "getgid", - "getgrgid", - "getgrnam", - "getgrouplist", - "getgroups", - "getpwnam", - "getpwuid", - "getuid", - "inode", - "isatty", - "lchown", - "setgid", - "setgroups", - "setuid", - "socktype", - "umask", - "waitpid", - // vars/nix - "iovec", - "unistd", - // vars/signals - "SIGPIPE", - // vars/sync - "Condvar", - // vars/stat - "fstat", - "stat", - // vars/time - "Timespec", - "nsec", - "nsecs", - "strftime", - "usec", - "usecs", - // vars/utmpx - "endutxent", - "getutxent", - "getutxid", - "getutxline", - "pututxline", - "setutxent", - "utmp", - "utmpx", - "utmpxname", - // vars/winapi - "errhandlingapi", - "fileapi", - "handleapi", - "lmcons", - "minwindef", - "processthreadsapi", - "synchapi", - "sysinfoapi", - "winbase", - "winerror", - "winnt", - "winsock", - "DWORD", - "LPWSTR", - "WCHAR", - // uucore - "optflag", - "optflagmulti", - "optflagopt", - "optmulti", - "optopt", - // uutils - "coreopts", - "coreutils", - "libc", - "libstdbuf", - "musl", - "ucmd", - "utmpx", - "uucore", - "uucore_procs", - "uumain", - "uutils" - ], - // words - list of words to be always considered correct - "words": [] + "version": "0.1", // Version of the setting file. Always 0.1 + "language": "en", // language - current active spelling language + "dictionaries": ["acronyms+names", "jargon", "people", "shell", "workspace"], + "dictionaryDefinitions": [ + { "name": "acronyms+names", "path": "./cspell.dictionaries/acronyms+names.wordlist.txt" }, + { "name": "jargon", "path": "./cspell.dictionaries/jargon.wordlist.txt" }, + { "name": "people", "path": "./cspell.dictionaries/people.wordlist.txt" }, + { "name": "shell", "path": "./cspell.dictionaries/shell.wordlist.txt" }, + { "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/**"], + // 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 + "words": [] } From 7510b65d6bff1913197d97629149e68bd3628e7e Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Thu, 27 May 2021 20:47:39 -0500 Subject: [PATCH 0759/1135] docs/spell ~ add cspell workspace dictionaries --- .../acronyms+names.wordlist.txt | 64 ++++ .../cspell.dictionaries/jargon.wordlist.txt | 110 +++++++ .../cspell.dictionaries/people.wordlist.txt | 171 ++++++++++ .../cspell.dictionaries/shell.wordlist.txt | 93 ++++++ .../workspace.wordlist.txt | 295 ++++++++++++++++++ 5 files changed, 733 insertions(+) create mode 100644 .vscode/cspell.dictionaries/acronyms+names.wordlist.txt create mode 100644 .vscode/cspell.dictionaries/jargon.wordlist.txt create mode 100644 .vscode/cspell.dictionaries/people.wordlist.txt create mode 100644 .vscode/cspell.dictionaries/shell.wordlist.txt create mode 100644 .vscode/cspell.dictionaries/workspace.wordlist.txt diff --git a/.vscode/cspell.dictionaries/acronyms+names.wordlist.txt b/.vscode/cspell.dictionaries/acronyms+names.wordlist.txt new file mode 100644 index 000000000..3956d1d8a --- /dev/null +++ b/.vscode/cspell.dictionaries/acronyms+names.wordlist.txt @@ -0,0 +1,64 @@ +# * abbreviations / acronyms +AIX +ASLR # address space layout randomization +AST # abstract syntax tree +CICD # continuous integration/deployment +CPU +CPUs +DevOps +Ext3 +FIFO +FIFOs +FQDN # fully qualified domain name +GID # group ID +GIDs +GNUEABI +GNUEABIhf +JFS +MSRV # minimum supported rust version +MSVC +NixOS +POSIX +POSIXLY +RISC +RISCV +RNG # random number generator +RNGs +ReiserFS +Solaris +UID # user ID +UIDs +UUID # universally unique identifier +WASI +WASM +XFS +aarch +flac +lzma + +# * names +BusyBox +BusyTest +Codacy +Cygwin +Deno +EditorConfig +FreeBSD +Gmail +Irix +MS-DOS +MSDOS +MacOS +MinGW +Minix +NetBSD +Novell +OpenBSD +POSIX +PowerPC +SELinux +SkyPack +Solaris +SysV +Xenix +Yargs diff --git a/.vscode/cspell.dictionaries/jargon.wordlist.txt b/.vscode/cspell.dictionaries/jargon.wordlist.txt new file mode 100644 index 000000000..89af1b153 --- /dev/null +++ b/.vscode/cspell.dictionaries/jargon.wordlist.txt @@ -0,0 +1,110 @@ +arity +autogenerate +autogenerated +autogenerates +bitmask +bitwise +bytewise +canonicalization +canonicalize +canonicalizing +colorizable +colorize +coprime +consts +cyclomatic +dedup +deduplication +demangle +denoland +deque +dequeue +dev +devs +discoverability +duplicative +enqueue +errored +executable +executables +exponentiate +eval +falsey +flamegraph +gibibytes +glob +globbing +hardfloat +hardlink +hardlinks +hasher +hashsums +kibi +kibibytes +mebi +mebibytes +mergeable +microbenchmark +microbenchmarks +microbenchmarking +multibyte +multicall +nonportable +nonprinting +peekable +performant +precompiled +precompute +preload +prepend +prepended +primality +pseudoprime +pseudoprimes +quantiles +readonly +reparse +seedable +semver +semiprime +semiprimes +shortcode +shortcodes +subcommand +subexpression +submodule +symlink +symlinks +syscall +syscalls +tokenize +truthy +unbuffered +unescape +unintuitive +unprefixed +unportable +unsync +whitespace +wordlist +wordlists + +# * abbreviations +consts +deps +dev +maint +proc +procs + +# * constants +xffff + +# * variables +delim +errno +progname +retval +subdir +val +vals diff --git a/.vscode/cspell.dictionaries/people.wordlist.txt b/.vscode/cspell.dictionaries/people.wordlist.txt new file mode 100644 index 000000000..01cfa4a3e --- /dev/null +++ b/.vscode/cspell.dictionaries/people.wordlist.txt @@ -0,0 +1,171 @@ +Akira Hayakawa + Akira + Hayakawa +Alan Andrade + Alan + Andrade +Aleksander Bielawski + Aleksander + Bielawski +Alex Lyon + Alex + Lyon +Alexander Batischev + Alexander + Batischev +Alexander Fomin + Alexander + Fomin +Anthony Deschamps + Anthony + Deschamps +Árni Dagur + Árni + Dagur +Ben Eills + Ben + Eills +Ben Hirsch + Ben + Hirsch +Benoit Benedetti + Benoit + Benedetti +Boden Garman + Boden + Garman +Chirag B Jadwani + Chirag + Jadwani +Derek Chiang + Derek + Chiang +Dorota Kapturkiewicz + Dorota + Kapturkiewicz +Evgeniy Klyuchikov + Evgeniy + Klyuchikov +Fangxu Hu + Fangxu + Hu +Gil Cottle + Gil + Cottle +Haitao Li + Haitao + Li +Inokentiy Babushkin + Inokentiy + Babushkin +Jeremiah Peschka + Jeremiah + Peschka +Jian Zeng + Jian + Zeng +Jimmy Lu + Jimmy + Lu +Joao Oliveira + Joao + Oliveira +Jordi Boggiano + Jordi + Boggiano +Jordy Dickinson + Jordy + Dickinson +Joseph Crail + Joseph + Crail +Joshua S Miller + Joshua + Miller +Konstantin Pospelov + Konstantin + Pospelov +Maciej Dziardziel + Maciej + Dziardziel +Martin Kysel + Martin + Kysel +Michael Debertol + Michael + Debertol +Michael Gehring + Michael + Gehring +Morten Olsen Lysgaard + Morten + Olsen + Lysgaard +Nicholas Juszczak + Nicholas + Juszczak +Nick Platt + Nick + Platt +Orvar Segerström + Orvar + Segerström +Peter Atashian + Peter + Atashian +Robert Swinford + Robert + Swinford +Rolf Morel + Rolf + Morel +Roman Gafiyatullin + Roman + Gafiyatullin +Roy Ivy III * rivy + Roy + Ivy + III + rivy +Sergey "Shnatsel" Davidoff + Sergey Shnatsel Davidoff + Sergey + Shnatsel + Davidoff +Sokovikov Evgeniy + Sokovikov + Evgeniy +Sunrin SHIMURA + Sunrin + SHIMURA +Sylvestre Ledru + Sylvestre + Ledru +T Jameson Little + Jameson + Little +Tobias Bohumir Schottdorf + Tobias + Bohumir + Schottdorf +Virgile Andreani + Virgile + Andreani +Vsevolod Velichko + Vsevolod + Velichko +Wiktor Kuropatwa + Wiktor + Kuropatwa +Yury Krivopalov + Yury + Krivopalov + +KokaKiwi +Mahkoh +Smigle00 + Smigle00 + Smigle +anonymousknight +kwantam +nicoo diff --git a/.vscode/cspell.dictionaries/shell.wordlist.txt b/.vscode/cspell.dictionaries/shell.wordlist.txt new file mode 100644 index 000000000..d8f297d21 --- /dev/null +++ b/.vscode/cspell.dictionaries/shell.wordlist.txt @@ -0,0 +1,93 @@ +# * Mac +clonefile + +# * POSIX +TMPDIR +adduser +csh +globstar +inotify +localtime +mountinfo +mountpoint +mtab +nullglob +passwd +pipefail +popd +ptmx +pushd +setarch +sh +sudo +sudoedit +tcsh +tzselect +urandom +wtmp +zsh + +# * Windows +APPDATA +COMSPEC +HKCU +HKLM +HOMEDRIVE +HOMEPATH +LOCALAPPDATA +PATHEXT +PATHEXT +SYSTEMROOT +USERDOMAIN +USERNAME +USERPROFILE +procmon + +# * `git` +gitattributes +gitignore + +# * `make` (`gmake`) +CURDIR +GNUMAKEFLAGS +GNUMakefile +LIBPATTERNS +MAKECMDGOALS +MAKEFILES +MAKEFLAGS +MAKELEVEL +MAKESHELL +SHELLSTATUS +VPATH +abspath +addprefix +addsuffix +endef +firstword +ifeq +ifneq +lastword +notdir +patsubst + + +# * `npm` +preversion + +# * utilities +cachegrind +chglog +codespell +commitlint +dprint +dtrace +gcov +gmake +grcov +grep +markdownlint +rerast +rollup +sed +wslpath +xargs diff --git a/.vscode/cspell.dictionaries/workspace.wordlist.txt b/.vscode/cspell.dictionaries/workspace.wordlist.txt new file mode 100644 index 000000000..b567a6c21 --- /dev/null +++ b/.vscode/cspell.dictionaries/workspace.wordlist.txt @@ -0,0 +1,295 @@ +# * cargo +cdylib +rlib + +# * crates +advapi +advapi32-sys +aho-corasick +backtrace +bstr +byteorder +chacha +chrono +conv +corasick +crossterm +filetime +formatteriteminfo +fsext +getopts +getrandom +globset +itertools +lscolors +memchr +multifilereader +onig +ouroboros +peekreader +quickcheck +rand_chacha +ringbuffer +smallvec +tempdir +tempfile +termion +termios +termsize +termwidth +textwrap +thiserror +walkdir +winapi +xattr + +# * rust/rustc +RUSTDOCFLAGS +RUSTFLAGS +bitxor # BitXor trait function +clippy +concat +fract +powi +println +repr +rfind +rustc +rustfmt +struct +structs +substr +splitn +trunc + +# * uutils +chcon +chgrp +chmod +chown +chroot +cksum +csplit +dircolors +hashsum +hostid +logname +mkdir +mkfifo +mknod +mktemp +nohup +nproc +numfmt +pathchk +printenv +printf +readlink +realpath +relpath +rmdir +runcon +shuf +sprintf +stdbuf +stty +tsort +uname +unexpand +whoami + +# * vars/errno +errno +EEXIST +ENOENT +ENOSYS +EPERM +EOPNOTSUPP + +# * vars/fcntl +F_GETFL + GETFL +fcntl +vmsplice + +# * vars/libc +FILENO +HOSTSIZE +IDSIZE +IFBLK +IFCHR +IFDIR +IFIFO +IFLNK +IFMT +IFREG +IFSOCK +IRGRP +IROTH +IRUSR +ISGID +ISUID +ISVTX +IWGRP +IWOTH +IWUSR +IXGRP +IXOTH +IXUSR +LINESIZE +NAMESIZE +RTLD_NEXT + RTLD +SIGINT +SIGKILL +SIGTERM +SYS_fdatasync +SYS_syncfs +USERSIZE +addrinfo +addrlen +blocksize +canonname +chroot +dlsym +fdatasync +freeaddrinfo +getaddrinfo +getegid +geteuid +getgid +getgrgid +getgrnam +getgrouplist +getgroups +getpwnam +getpwuid +getuid +inode +inodes +isatty +lchown +setgid +setgroups +settime +setuid +socktype +statfs +statvfs +strcmp +strerror +syncfs +umask +waitpid +wcslen + +# * vars/nix +iovec +unistd + +# * vars/signals +SIGPIPE + +# * vars/std +CString +pathbuf + +# * vars/stat +bavail +bfree +bsize +ffree +frsize +fsid +fstat +fstype +namelen +# unix::fs::MetadataExt +atime # access time +blksize # blocksize for file system I/O +blocks # number of blocks allocated to file +ctime # creation time +dev # ID of device containing the file +gid # group ID of file owner +ino # inode number +mode # permissions +mtime # modification time +nlink # number of hard links to file +rdev # device ID if file is a character/block special file +size # total size of file in bytes +uid # user ID of file owner +nsec # nanosecond measurement scale +# freebsd::MetadataExt +iosize + +# * vars/time +Timespec +isdst +nanos +nsec +nsecs +strftime +strptime +subsec +usec +usecs +utcoff + +# * vars/utmpx +endutxent +getutxent +getutxid +getutxline +pututxline +setutxent +utmp +utmpx +utmpxname + +# * vars/winapi +DWORD +SYSTEMTIME +LPVOID +LPWSTR +ULONG +ULONGLONG +UNLEN +WCHAR +errhandlingapi +fileapi +handleapi +lmcons +minwinbase +minwindef +processthreadsapi +synchapi +sysinfoapi +winbase +winerror +winnt +winsock + +# * vars/uucore +optflag +optflagmulti +optflagopt +optmulti +optopt + +# * uutils +ccmd +coreopts +coreutils +keepenv +libc +libstdbuf +musl +tmpd +ucmd +ucommand +utmpx +uucore +uucore_procs +uumain +uutil +uutils From 9c0c8eb59f337ca878078946f7474742fa486002 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 29 May 2021 22:19:41 -0500 Subject: [PATCH 0760/1135] change ~ remove 'main.rs' spell-checker exceptions --- src/uu/arch/src/main.rs | 2 +- src/uu/base32/src/main.rs | 2 +- src/uu/base64/src/main.rs | 2 +- src/uu/basename/src/main.rs | 2 +- src/uu/cat/src/main.rs | 2 +- src/uu/chgrp/src/main.rs | 2 +- src/uu/chmod/src/main.rs | 2 +- src/uu/chown/src/main.rs | 2 +- src/uu/chroot/src/main.rs | 2 +- src/uu/cksum/src/main.rs | 2 +- src/uu/comm/src/main.rs | 2 +- src/uu/cp/src/main.rs | 2 +- src/uu/csplit/src/main.rs | 2 +- src/uu/cut/src/main.rs | 2 +- src/uu/date/src/main.rs | 2 +- src/uu/df/src/main.rs | 2 +- src/uu/dircolors/src/main.rs | 2 +- src/uu/dirname/src/main.rs | 2 +- src/uu/du/src/du.rs | 2 -- src/uu/du/src/main.rs | 2 +- src/uu/echo/src/main.rs | 2 +- src/uu/env/src/main.rs | 2 +- src/uu/expand/src/main.rs | 2 +- src/uu/expr/src/main.rs | 2 +- src/uu/factor/src/main.rs | 2 +- src/uu/false/src/main.rs | 2 +- src/uu/fmt/src/main.rs | 2 +- src/uu/fold/src/main.rs | 2 +- src/uu/groups/src/main.rs | 2 +- src/uu/hashsum/src/main.rs | 2 +- src/uu/head/src/main.rs | 2 +- src/uu/hostid/src/main.rs | 2 +- src/uu/hostname/src/main.rs | 2 +- src/uu/id/src/main.rs | 2 +- src/uu/install/src/main.rs | 2 +- src/uu/join/src/main.rs | 2 +- src/uu/kill/src/main.rs | 2 +- src/uu/link/src/main.rs | 2 +- src/uu/ln/src/main.rs | 2 +- src/uu/logname/src/main.rs | 2 +- src/uu/ls/src/main.rs | 2 +- src/uu/mkdir/src/main.rs | 2 +- src/uu/mkfifo/src/main.rs | 2 +- src/uu/mknod/src/main.rs | 2 +- src/uu/mktemp/src/main.rs | 2 +- src/uu/more/src/main.rs | 2 +- src/uu/mv/src/main.rs | 2 +- src/uu/nice/src/main.rs | 2 +- src/uu/nl/src/main.rs | 2 +- src/uu/nohup/src/main.rs | 2 +- src/uu/nproc/src/main.rs | 2 +- src/uu/numfmt/src/main.rs | 2 +- src/uu/od/src/main.rs | 2 +- src/uu/paste/src/main.rs | 2 +- src/uu/pathchk/src/main.rs | 2 +- src/uu/pinky/src/main.rs | 2 +- src/uu/printenv/src/main.rs | 2 +- src/uu/printf/src/main.rs | 2 +- src/uu/ptx/src/main.rs | 2 +- src/uu/pwd/src/main.rs | 2 +- src/uu/readlink/src/main.rs | 2 +- src/uu/realpath/src/main.rs | 2 +- src/uu/relpath/src/main.rs | 2 +- src/uu/rm/src/main.rs | 2 +- src/uu/rmdir/src/main.rs | 2 +- src/uu/seq/src/main.rs | 2 +- src/uu/shred/src/main.rs | 2 +- src/uu/shuf/src/main.rs | 2 +- src/uu/sleep/src/main.rs | 2 +- src/uu/sort/src/main.rs | 2 +- src/uu/split/src/main.rs | 2 +- src/uu/stat/src/main.rs | 2 +- src/uu/stdbuf/src/main.rs | 2 +- src/uu/sum/src/main.rs | 2 +- src/uu/sync/src/main.rs | 2 +- src/uu/tac/src/main.rs | 2 +- src/uu/tail/src/main.rs | 2 +- src/uu/tee/src/main.rs | 2 +- src/uu/test/src/main.rs | 2 +- src/uu/timeout/src/main.rs | 2 +- src/uu/touch/src/main.rs | 2 +- src/uu/tr/src/main.rs | 2 +- src/uu/true/src/main.rs | 2 +- src/uu/truncate/src/main.rs | 2 +- src/uu/tsort/src/main.rs | 2 +- src/uu/tty/src/main.rs | 2 +- src/uu/uname/src/main.rs | 2 +- src/uu/unexpand/src/main.rs | 2 +- src/uu/uniq/src/main.rs | 2 +- src/uu/unlink/src/main.rs | 2 +- src/uu/uptime/src/main.rs | 2 +- src/uu/users/src/main.rs | 2 +- src/uu/wc/src/main.rs | 2 +- src/uu/who/src/main.rs | 2 +- src/uu/whoami/src/main.rs | 2 +- src/uu/yes/src/main.rs | 2 +- 96 files changed, 95 insertions(+), 97 deletions(-) diff --git a/src/uu/arch/src/main.rs b/src/uu/arch/src/main.rs index 43e0af5bf..e2668864c 100644 --- a/src/uu/arch/src/main.rs +++ b/src/uu/arch/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_arch); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_arch); diff --git a/src/uu/base32/src/main.rs b/src/uu/base32/src/main.rs index b59cb89f0..83a0b6607 100644 --- a/src/uu/base32/src/main.rs +++ b/src/uu/base32/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_base32); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_base32); diff --git a/src/uu/base64/src/main.rs b/src/uu/base64/src/main.rs index 07ed34256..cae6cb3c4 100644 --- a/src/uu/base64/src/main.rs +++ b/src/uu/base64/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_base64); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_base64); diff --git a/src/uu/basename/src/main.rs b/src/uu/basename/src/main.rs index d1aa19f2b..aa452f750 100644 --- a/src/uu/basename/src/main.rs +++ b/src/uu/basename/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_basename); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_basename); diff --git a/src/uu/cat/src/main.rs b/src/uu/cat/src/main.rs index 2b7969473..1adab666b 100644 --- a/src/uu/cat/src/main.rs +++ b/src/uu/cat/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_cat); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_cat); diff --git a/src/uu/chgrp/src/main.rs b/src/uu/chgrp/src/main.rs index 2faba7ba4..ee6f70a8b 100644 --- a/src/uu/chgrp/src/main.rs +++ b/src/uu/chgrp/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_chgrp); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_chgrp); diff --git a/src/uu/chmod/src/main.rs b/src/uu/chmod/src/main.rs index 604bd9a7d..adaf887f8 100644 --- a/src/uu/chmod/src/main.rs +++ b/src/uu/chmod/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_chmod); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_chmod); diff --git a/src/uu/chown/src/main.rs b/src/uu/chown/src/main.rs index ee5aeeba0..b3ed39970 100644 --- a/src/uu/chown/src/main.rs +++ b/src/uu/chown/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_chown); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_chown); diff --git a/src/uu/chroot/src/main.rs b/src/uu/chroot/src/main.rs index a177c9301..0ca88cfaf 100644 --- a/src/uu/chroot/src/main.rs +++ b/src/uu/chroot/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_chroot); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_chroot); diff --git a/src/uu/cksum/src/main.rs b/src/uu/cksum/src/main.rs index 50f424f41..b8a8f6b33 100644 --- a/src/uu/cksum/src/main.rs +++ b/src/uu/cksum/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_cksum); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_cksum); diff --git a/src/uu/comm/src/main.rs b/src/uu/comm/src/main.rs index 149098c3c..07ac07544 100644 --- a/src/uu/comm/src/main.rs +++ b/src/uu/comm/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_comm); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_comm); diff --git a/src/uu/cp/src/main.rs b/src/uu/cp/src/main.rs index 425d490e7..acfcfd1b2 100644 --- a/src/uu/cp/src/main.rs +++ b/src/uu/cp/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_cp); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_cp); diff --git a/src/uu/csplit/src/main.rs b/src/uu/csplit/src/main.rs index 97aeb3821..b0b144e8c 100644 --- a/src/uu/csplit/src/main.rs +++ b/src/uu/csplit/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_csplit); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_csplit); diff --git a/src/uu/cut/src/main.rs b/src/uu/cut/src/main.rs index 065a01f40..8822335f6 100644 --- a/src/uu/cut/src/main.rs +++ b/src/uu/cut/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_cut); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_cut); diff --git a/src/uu/date/src/main.rs b/src/uu/date/src/main.rs index 13edc0fba..9064c7f67 100644 --- a/src/uu/date/src/main.rs +++ b/src/uu/date/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_date); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_date); diff --git a/src/uu/df/src/main.rs b/src/uu/df/src/main.rs index 6062603db..a6d403782 100644 --- a/src/uu/df/src/main.rs +++ b/src/uu/df/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_df); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_df); diff --git a/src/uu/dircolors/src/main.rs b/src/uu/dircolors/src/main.rs index 10c96ecd9..a6a820bd9 100644 --- a/src/uu/dircolors/src/main.rs +++ b/src/uu/dircolors/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_dircolors); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_dircolors); diff --git a/src/uu/dirname/src/main.rs b/src/uu/dirname/src/main.rs index e4be3372a..bf923e86a 100644 --- a/src/uu/dirname/src/main.rs +++ b/src/uu/dirname/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_dirname); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_dirname); diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 6bd4f23e4..b0940d93d 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -5,8 +5,6 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// spell-checker:ignore (ToDO) BLOCKSIZE inode inodes ment strs - #[macro_use] extern crate uucore; diff --git a/src/uu/du/src/main.rs b/src/uu/du/src/main.rs index de1967bc8..de9bfc1a5 100644 --- a/src/uu/du/src/main.rs +++ b/src/uu/du/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_du); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_du); diff --git a/src/uu/echo/src/main.rs b/src/uu/echo/src/main.rs index 00b84e983..b8d3b4b32 100644 --- a/src/uu/echo/src/main.rs +++ b/src/uu/echo/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_echo); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_echo); diff --git a/src/uu/env/src/main.rs b/src/uu/env/src/main.rs index 8b654eb00..9c19a3ab4 100644 --- a/src/uu/env/src/main.rs +++ b/src/uu/env/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_env); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_env); diff --git a/src/uu/expand/src/main.rs b/src/uu/expand/src/main.rs index d80b6090f..a154b36be 100644 --- a/src/uu/expand/src/main.rs +++ b/src/uu/expand/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_expand); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_expand); diff --git a/src/uu/expr/src/main.rs b/src/uu/expr/src/main.rs index 4268865df..6fdd6be14 100644 --- a/src/uu/expr/src/main.rs +++ b/src/uu/expr/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_expr); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_expr); diff --git a/src/uu/factor/src/main.rs b/src/uu/factor/src/main.rs index b251716b5..4d8b281b6 100644 --- a/src/uu/factor/src/main.rs +++ b/src/uu/factor/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_factor); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_factor); diff --git a/src/uu/false/src/main.rs b/src/uu/false/src/main.rs index 0cede3b5e..382a16fc7 100644 --- a/src/uu/false/src/main.rs +++ b/src/uu/false/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_false); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_false); diff --git a/src/uu/fmt/src/main.rs b/src/uu/fmt/src/main.rs index d7e883ba7..35531a8b4 100644 --- a/src/uu/fmt/src/main.rs +++ b/src/uu/fmt/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_fmt); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_fmt); diff --git a/src/uu/fold/src/main.rs b/src/uu/fold/src/main.rs index abdf80211..1802f2cf8 100644 --- a/src/uu/fold/src/main.rs +++ b/src/uu/fold/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_fold); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_fold); diff --git a/src/uu/groups/src/main.rs b/src/uu/groups/src/main.rs index 0a37ec7f4..6efe64b54 100644 --- a/src/uu/groups/src/main.rs +++ b/src/uu/groups/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_groups); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_groups); diff --git a/src/uu/hashsum/src/main.rs b/src/uu/hashsum/src/main.rs index 12bd3b393..bc4e2f3be 100644 --- a/src/uu/hashsum/src/main.rs +++ b/src/uu/hashsum/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_hashsum); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_hashsum); diff --git a/src/uu/head/src/main.rs b/src/uu/head/src/main.rs index fbeb3381e..3e66a50d0 100644 --- a/src/uu/head/src/main.rs +++ b/src/uu/head/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_head); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_head); diff --git a/src/uu/hostid/src/main.rs b/src/uu/hostid/src/main.rs index 12b1178ec..9645ed4a6 100644 --- a/src/uu/hostid/src/main.rs +++ b/src/uu/hostid/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_hostid); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_hostid); diff --git a/src/uu/hostname/src/main.rs b/src/uu/hostname/src/main.rs index a483a8b1a..1d6e6733e 100644 --- a/src/uu/hostname/src/main.rs +++ b/src/uu/hostname/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_hostname); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_hostname); diff --git a/src/uu/id/src/main.rs b/src/uu/id/src/main.rs index 389e2deff..c8f6fe6aa 100644 --- a/src/uu/id/src/main.rs +++ b/src/uu/id/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_id); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_id); diff --git a/src/uu/install/src/main.rs b/src/uu/install/src/main.rs index 289079daf..d296ec4a2 100644 --- a/src/uu/install/src/main.rs +++ b/src/uu/install/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_install); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_install); diff --git a/src/uu/join/src/main.rs b/src/uu/join/src/main.rs index 75be18875..5114252cd 100644 --- a/src/uu/join/src/main.rs +++ b/src/uu/join/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_join); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_join); diff --git a/src/uu/kill/src/main.rs b/src/uu/kill/src/main.rs index c9f639967..91d0a28f0 100644 --- a/src/uu/kill/src/main.rs +++ b/src/uu/kill/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_kill); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_kill); diff --git a/src/uu/link/src/main.rs b/src/uu/link/src/main.rs index d837b4278..ccc565fed 100644 --- a/src/uu/link/src/main.rs +++ b/src/uu/link/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_link); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_link); diff --git a/src/uu/ln/src/main.rs b/src/uu/ln/src/main.rs index de14d10bd..060001972 100644 --- a/src/uu/ln/src/main.rs +++ b/src/uu/ln/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_ln); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_ln); diff --git a/src/uu/logname/src/main.rs b/src/uu/logname/src/main.rs index 48a4063f1..f9cf6160e 100644 --- a/src/uu/logname/src/main.rs +++ b/src/uu/logname/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_logname); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_logname); diff --git a/src/uu/ls/src/main.rs b/src/uu/ls/src/main.rs index f45314577..d867c3843 100644 --- a/src/uu/ls/src/main.rs +++ b/src/uu/ls/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_ls); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_ls); diff --git a/src/uu/mkdir/src/main.rs b/src/uu/mkdir/src/main.rs index 3850113b9..fa6855c93 100644 --- a/src/uu/mkdir/src/main.rs +++ b/src/uu/mkdir/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_mkdir); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_mkdir); diff --git a/src/uu/mkfifo/src/main.rs b/src/uu/mkfifo/src/main.rs index 489dc8ffd..3ad5a3bed 100644 --- a/src/uu/mkfifo/src/main.rs +++ b/src/uu/mkfifo/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_mkfifo); // spell-checker:ignore procs uucore mkfifo +uucore_procs::main!(uu_mkfifo); diff --git a/src/uu/mknod/src/main.rs b/src/uu/mknod/src/main.rs index f3878199b..b65a20cd4 100644 --- a/src/uu/mknod/src/main.rs +++ b/src/uu/mknod/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_mknod); // spell-checker:ignore procs uucore mknod +uucore_procs::main!(uu_mknod); diff --git a/src/uu/mktemp/src/main.rs b/src/uu/mktemp/src/main.rs index 217f09372..020284655 100644 --- a/src/uu/mktemp/src/main.rs +++ b/src/uu/mktemp/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_mktemp); // spell-checker:ignore procs uucore mktemp +uucore_procs::main!(uu_mktemp); diff --git a/src/uu/more/src/main.rs b/src/uu/more/src/main.rs index 1f3137265..15fbf51f9 100644 --- a/src/uu/more/src/main.rs +++ b/src/uu/more/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_more); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_more); diff --git a/src/uu/mv/src/main.rs b/src/uu/mv/src/main.rs index c7e321234..49f7956e8 100644 --- a/src/uu/mv/src/main.rs +++ b/src/uu/mv/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_mv); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_mv); diff --git a/src/uu/nice/src/main.rs b/src/uu/nice/src/main.rs index 25da035aa..039f40d9d 100644 --- a/src/uu/nice/src/main.rs +++ b/src/uu/nice/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_nice); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_nice); diff --git a/src/uu/nl/src/main.rs b/src/uu/nl/src/main.rs index fac355069..072fad504 100644 --- a/src/uu/nl/src/main.rs +++ b/src/uu/nl/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_nl); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_nl); diff --git a/src/uu/nohup/src/main.rs b/src/uu/nohup/src/main.rs index d46ceb7cb..2007711f6 100644 --- a/src/uu/nohup/src/main.rs +++ b/src/uu/nohup/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_nohup); // spell-checker:ignore procs uucore nohup +uucore_procs::main!(uu_nohup); diff --git a/src/uu/nproc/src/main.rs b/src/uu/nproc/src/main.rs index 7650cce09..356c2101f 100644 --- a/src/uu/nproc/src/main.rs +++ b/src/uu/nproc/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_nproc); // spell-checker:ignore procs uucore nproc +uucore_procs::main!(uu_nproc); diff --git a/src/uu/numfmt/src/main.rs b/src/uu/numfmt/src/main.rs index 084d494f2..f4d991727 100644 --- a/src/uu/numfmt/src/main.rs +++ b/src/uu/numfmt/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_numfmt); // spell-checker:ignore procs uucore numfmt +uucore_procs::main!(uu_numfmt); diff --git a/src/uu/od/src/main.rs b/src/uu/od/src/main.rs index d5e96180c..3f30d15e8 100644 --- a/src/uu/od/src/main.rs +++ b/src/uu/od/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_od); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_od); diff --git a/src/uu/paste/src/main.rs b/src/uu/paste/src/main.rs index bb9b25a68..1d4458b9e 100644 --- a/src/uu/paste/src/main.rs +++ b/src/uu/paste/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_paste); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_paste); diff --git a/src/uu/pathchk/src/main.rs b/src/uu/pathchk/src/main.rs index e16353196..2b7c3b3ee 100644 --- a/src/uu/pathchk/src/main.rs +++ b/src/uu/pathchk/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_pathchk); // spell-checker:ignore procs uucore pathchk +uucore_procs::main!(uu_pathchk); diff --git a/src/uu/pinky/src/main.rs b/src/uu/pinky/src/main.rs index 1bf1e618a..5414c42cc 100644 --- a/src/uu/pinky/src/main.rs +++ b/src/uu/pinky/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_pinky); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_pinky); diff --git a/src/uu/printenv/src/main.rs b/src/uu/printenv/src/main.rs index 328c3b485..b61cbe90a 100644 --- a/src/uu/printenv/src/main.rs +++ b/src/uu/printenv/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_printenv); // spell-checker:ignore procs uucore printenv +uucore_procs::main!(uu_printenv); diff --git a/src/uu/printf/src/main.rs b/src/uu/printf/src/main.rs index aa9a45be5..9def7dafe 100644 --- a/src/uu/printf/src/main.rs +++ b/src/uu/printf/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_printf); // spell-checker:ignore procs uucore printf +uucore_procs::main!(uu_printf); diff --git a/src/uu/ptx/src/main.rs b/src/uu/ptx/src/main.rs index 0b235443a..b627b801f 100644 --- a/src/uu/ptx/src/main.rs +++ b/src/uu/ptx/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_ptx); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_ptx); diff --git a/src/uu/pwd/src/main.rs b/src/uu/pwd/src/main.rs index 4445b7891..c5716d2c9 100644 --- a/src/uu/pwd/src/main.rs +++ b/src/uu/pwd/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_pwd); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_pwd); diff --git a/src/uu/readlink/src/main.rs b/src/uu/readlink/src/main.rs index e5aab3cb6..651fd73ca 100644 --- a/src/uu/readlink/src/main.rs +++ b/src/uu/readlink/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_readlink); // spell-checker:ignore procs uucore readlink +uucore_procs::main!(uu_readlink); diff --git a/src/uu/realpath/src/main.rs b/src/uu/realpath/src/main.rs index 3a74bc5f6..8b8a8dc5e 100644 --- a/src/uu/realpath/src/main.rs +++ b/src/uu/realpath/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_realpath); // spell-checker:ignore procs uucore realpath +uucore_procs::main!(uu_realpath); diff --git a/src/uu/relpath/src/main.rs b/src/uu/relpath/src/main.rs index a5f866bb2..22aa68d53 100644 --- a/src/uu/relpath/src/main.rs +++ b/src/uu/relpath/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_relpath); // spell-checker:ignore procs uucore relpath +uucore_procs::main!(uu_relpath); diff --git a/src/uu/rm/src/main.rs b/src/uu/rm/src/main.rs index ebb998c39..960867359 100644 --- a/src/uu/rm/src/main.rs +++ b/src/uu/rm/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_rm); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_rm); diff --git a/src/uu/rmdir/src/main.rs b/src/uu/rmdir/src/main.rs index ab1939b4a..92ff22c07 100644 --- a/src/uu/rmdir/src/main.rs +++ b/src/uu/rmdir/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_rmdir); // spell-checker:ignore procs uucore rmdir +uucore_procs::main!(uu_rmdir); diff --git a/src/uu/seq/src/main.rs b/src/uu/seq/src/main.rs index c984ed61a..266ac5d11 100644 --- a/src/uu/seq/src/main.rs +++ b/src/uu/seq/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_seq); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_seq); diff --git a/src/uu/shred/src/main.rs b/src/uu/shred/src/main.rs index 2880499eb..ea7a42f65 100644 --- a/src/uu/shred/src/main.rs +++ b/src/uu/shred/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_shred); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_shred); diff --git a/src/uu/shuf/src/main.rs b/src/uu/shuf/src/main.rs index 1ecff5d21..fc6e2b4ae 100644 --- a/src/uu/shuf/src/main.rs +++ b/src/uu/shuf/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_shuf); // spell-checker:ignore procs uucore shuf +uucore_procs::main!(uu_shuf); diff --git a/src/uu/sleep/src/main.rs b/src/uu/sleep/src/main.rs index 46ecd0969..16c3100aa 100644 --- a/src/uu/sleep/src/main.rs +++ b/src/uu/sleep/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_sleep); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_sleep); diff --git a/src/uu/sort/src/main.rs b/src/uu/sort/src/main.rs index a59375b2f..ab463776d 100644 --- a/src/uu/sort/src/main.rs +++ b/src/uu/sort/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_sort); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_sort); diff --git a/src/uu/split/src/main.rs b/src/uu/split/src/main.rs index 2f0640db4..87f15f529 100644 --- a/src/uu/split/src/main.rs +++ b/src/uu/split/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_split); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_split); diff --git a/src/uu/stat/src/main.rs b/src/uu/stat/src/main.rs index 6e483c850..839eff7de 100644 --- a/src/uu/stat/src/main.rs +++ b/src/uu/stat/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_stat); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_stat); diff --git a/src/uu/stdbuf/src/main.rs b/src/uu/stdbuf/src/main.rs index c020a7a07..1989a3b8d 100644 --- a/src/uu/stdbuf/src/main.rs +++ b/src/uu/stdbuf/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_stdbuf); // spell-checker:ignore procs uucore stdbuf +uucore_procs::main!(uu_stdbuf); diff --git a/src/uu/sum/src/main.rs b/src/uu/sum/src/main.rs index 64b0d4254..85f4d0079 100644 --- a/src/uu/sum/src/main.rs +++ b/src/uu/sum/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_sum); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_sum); diff --git a/src/uu/sync/src/main.rs b/src/uu/sync/src/main.rs index 06d85b278..9786fc371 100644 --- a/src/uu/sync/src/main.rs +++ b/src/uu/sync/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_sync); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_sync); diff --git a/src/uu/tac/src/main.rs b/src/uu/tac/src/main.rs index 93d91e2b7..018821c73 100644 --- a/src/uu/tac/src/main.rs +++ b/src/uu/tac/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_tac); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_tac); diff --git a/src/uu/tail/src/main.rs b/src/uu/tail/src/main.rs index 52818fad6..dd89ce2c7 100644 --- a/src/uu/tail/src/main.rs +++ b/src/uu/tail/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_tail); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_tail); diff --git a/src/uu/tee/src/main.rs b/src/uu/tee/src/main.rs index 1314f353e..2b483d9d8 100644 --- a/src/uu/tee/src/main.rs +++ b/src/uu/tee/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_tee); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_tee); diff --git a/src/uu/test/src/main.rs b/src/uu/test/src/main.rs index 5018a5c8c..9f4e6985f 100644 --- a/src/uu/test/src/main.rs +++ b/src/uu/test/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_test); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_test); diff --git a/src/uu/timeout/src/main.rs b/src/uu/timeout/src/main.rs index 20c4271d9..2479f91c1 100644 --- a/src/uu/timeout/src/main.rs +++ b/src/uu/timeout/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_timeout); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_timeout); diff --git a/src/uu/touch/src/main.rs b/src/uu/touch/src/main.rs index bad67efd4..e8a2729a2 100644 --- a/src/uu/touch/src/main.rs +++ b/src/uu/touch/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_touch); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_touch); diff --git a/src/uu/tr/src/main.rs b/src/uu/tr/src/main.rs index 8bed990e5..9118c3628 100644 --- a/src/uu/tr/src/main.rs +++ b/src/uu/tr/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_tr); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_tr); diff --git a/src/uu/true/src/main.rs b/src/uu/true/src/main.rs index 7e009be8a..b30f4d4cb 100644 --- a/src/uu/true/src/main.rs +++ b/src/uu/true/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_true); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_true); diff --git a/src/uu/truncate/src/main.rs b/src/uu/truncate/src/main.rs index 91fe70b6d..46e65faea 100644 --- a/src/uu/truncate/src/main.rs +++ b/src/uu/truncate/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_truncate); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_truncate); diff --git a/src/uu/tsort/src/main.rs b/src/uu/tsort/src/main.rs index 6b108cc5e..0694678d4 100644 --- a/src/uu/tsort/src/main.rs +++ b/src/uu/tsort/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_tsort); // spell-checker:ignore procs uucore tsort +uucore_procs::main!(uu_tsort); diff --git a/src/uu/tty/src/main.rs b/src/uu/tty/src/main.rs index 8cb1cbb4b..01a01e5ca 100644 --- a/src/uu/tty/src/main.rs +++ b/src/uu/tty/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_tty); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_tty); diff --git a/src/uu/uname/src/main.rs b/src/uu/uname/src/main.rs index f40104670..5252f4716 100644 --- a/src/uu/uname/src/main.rs +++ b/src/uu/uname/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_uname); // spell-checker:ignore procs uucore uname +uucore_procs::main!(uu_uname); diff --git a/src/uu/unexpand/src/main.rs b/src/uu/unexpand/src/main.rs index 82d11dd95..2e7b1d967 100644 --- a/src/uu/unexpand/src/main.rs +++ b/src/uu/unexpand/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_unexpand); // spell-checker:ignore procs uucore unexpand +uucore_procs::main!(uu_unexpand); diff --git a/src/uu/uniq/src/main.rs b/src/uu/uniq/src/main.rs index dd4b6da1a..361c39f14 100644 --- a/src/uu/uniq/src/main.rs +++ b/src/uu/uniq/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_uniq); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_uniq); diff --git a/src/uu/unlink/src/main.rs b/src/uu/unlink/src/main.rs index f01b6bac3..b03d4a675 100644 --- a/src/uu/unlink/src/main.rs +++ b/src/uu/unlink/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_unlink); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_unlink); diff --git a/src/uu/uptime/src/main.rs b/src/uu/uptime/src/main.rs index 352703eb3..be5d5ab01 100644 --- a/src/uu/uptime/src/main.rs +++ b/src/uu/uptime/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_uptime); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_uptime); diff --git a/src/uu/users/src/main.rs b/src/uu/users/src/main.rs index f065c633c..f30a01ecb 100644 --- a/src/uu/users/src/main.rs +++ b/src/uu/users/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_users); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_users); diff --git a/src/uu/wc/src/main.rs b/src/uu/wc/src/main.rs index ce5629e51..b58b9cac7 100644 --- a/src/uu/wc/src/main.rs +++ b/src/uu/wc/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_wc); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_wc); diff --git a/src/uu/who/src/main.rs b/src/uu/who/src/main.rs index bc0015a80..a093201a1 100644 --- a/src/uu/who/src/main.rs +++ b/src/uu/who/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_who); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_who); diff --git a/src/uu/whoami/src/main.rs b/src/uu/whoami/src/main.rs index 0439923ee..40de26564 100644 --- a/src/uu/whoami/src/main.rs +++ b/src/uu/whoami/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_whoami); // spell-checker:ignore procs uucore whoami +uucore_procs::main!(uu_whoami); diff --git a/src/uu/yes/src/main.rs b/src/uu/yes/src/main.rs index 597eb5b57..dc5bf6a0c 100644 --- a/src/uu/yes/src/main.rs +++ b/src/uu/yes/src/main.rs @@ -1 +1 @@ -uucore_procs::main!(uu_yes); // spell-checker:ignore procs uucore +uucore_procs::main!(uu_yes); From 48e509546a88604529650dc563f8b89489867220 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 18:38:33 -0500 Subject: [PATCH 0761/1135] refactor/uucore ~ polish spelling (comments, names, and exceptions) --- src/uucore/src/lib/features/fsext.rs | 73 +++++++++++++---------- src/uucore/src/lib/features/perms.rs | 12 ++-- src/uucore/src/lib/features/ringbuffer.rs | 6 +- src/uucore/src/lib/features/utmpx.rs | 4 +- src/uucore/src/lib/lib.rs | 4 +- src/uucore/src/lib/macros.rs | 6 +- src/uucore/src/lib/mods/os.rs | 3 + 7 files changed, 61 insertions(+), 47 deletions(-) diff --git a/src/uucore/src/lib/features/fsext.rs b/src/uucore/src/lib/features/fsext.rs index 6343ecd50..e1cb67097 100644 --- a/src/uucore/src/lib/features/fsext.rs +++ b/src/uucore/src/lib/features/fsext.rs @@ -7,7 +7,7 @@ // For the full copyright and license information, please view the LICENSE file // that was distributed with this source code. -// spell-checker:ignore (ToDO) strerror IFBLK IFCHR IFDIR IFLNK IFIFO IFMT IFREG IFSOCK subsec nanos gnulib statfs Sstatfs bitrig statvfs iosize blksize fnodes fsid namelen bsize bfree bavail ffree frsize namemax errno fstype adfs acfs aufs affs autofs befs bdevfs binfmt ceph cgroups cifs configfs cramfs cgroupfs debugfs devfs devpts ecryptfs btrfs efivarfs exofs fhgfs fuseblk fusectl futexfs gpfs hfsx hostfs hpfs inodefs ibrix inotifyfs isofs jffs logfs hugetlbfs mqueue nsfs ntfs ocfs panfs pipefs ramfs romfs nfsd nilfs pstorefs reiserfs securityfs smackfs snfs sockfs squashfs sysfs sysv tempfs tracefs ubifs usbdevfs vmhgfs tmpfs vxfs wslfs xenfs vzfs openprom overlayfs +// spell-checker:ignore (arch) bitrig ; (fs) cifs smbfs extern crate time; @@ -88,7 +88,7 @@ use std::time::UNIX_EPOCH; target_os = "android", target_os = "freebsd" ))] -pub use libc::statfs as Sstatfs; +pub use libc::statfs as StatFs; #[cfg(any( target_os = "openbsd", target_os = "netbsd", @@ -96,7 +96,7 @@ pub use libc::statfs as Sstatfs; target_os = "bitrig", target_os = "dragonfly" ))] -pub use libc::statvfs as Sstatfs; +pub use libc::statvfs as StatFs; #[cfg(any( target_os = "linux", @@ -168,6 +168,7 @@ impl MountInfo { } } // set MountInfo::dummy + // spell-checker:disable match self.fs_type.as_ref() { "autofs" | "proc" | "subfs" /* for Linux 2.6/3.x */ @@ -181,6 +182,7 @@ impl MountInfo { _ => self.dummy = self.fs_type == "none" && !self.mount_option.contains(MOUNT_OPT_BIND) } + // spell-checker:enable // set MountInfo::remote #[cfg(windows)] { @@ -203,6 +205,7 @@ impl MountInfo { #[cfg(target_os = "linux")] fn new(file_name: &str, raw: Vec<&str>) -> Option { match file_name { + // spell-checker:ignore (word) noatime // Format: 36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue // "man proc" for more details LINUX_MOUNTINFO => { @@ -307,21 +310,24 @@ impl MountInfo { #[cfg(any(target_vendor = "apple", target_os = "freebsd"))] use std::ffi::CStr; #[cfg(any(target_os = "freebsd", target_vendor = "apple"))] -impl From for MountInfo { - fn from(statfs: Sstatfs) -> Self { +impl From for MountInfo { + fn from(statfs: StatFs) -> Self { let mut info = MountInfo { dev_id: "".to_string(), dev_name: unsafe { + // spell-checker:disable-next-line CStr::from_ptr(&statfs.f_mntfromname[0]) .to_string_lossy() .into_owned() }, fs_type: unsafe { + // spell-checker:disable-next-line CStr::from_ptr(&statfs.f_fstypename[0]) .to_string_lossy() .into_owned() }, mount_dir: unsafe { + // spell-checker:disable-next-line CStr::from_ptr(&statfs.f_mntonname[0]) .to_string_lossy() .into_owned() @@ -341,14 +347,15 @@ use libc::c_int; #[cfg(any(target_os = "freebsd", target_vendor = "apple"))] extern "C" { #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))] - #[link_name = "getmntinfo$INODE64"] - fn getmntinfo(mntbufp: *mut *mut Sstatfs, flags: c_int) -> c_int; + #[link_name = "getmntinfo$INODE64"] // spell-checker:disable-line + fn get_mount_info(mount_buffer_p: *mut *mut StatFs, flags: c_int) -> c_int; #[cfg(any( all(target_os = "freebsd"), all(target_vendor = "apple", target_arch = "aarch64") ))] - fn getmntinfo(mntbufp: *mut *mut Sstatfs, flags: c_int) -> c_int; + #[link_name = "getmntinfo"] // spell-checker:disable-line + fn get_mount_info(mount_buffer_p: *mut *mut StatFs, flags: c_int) -> c_int; } #[cfg(target_os = "linux")] @@ -363,11 +370,11 @@ use std::slice; pub fn read_fs_list() -> Vec { #[cfg(target_os = "linux")] { - let (file_name, fobj) = File::open(LINUX_MOUNTINFO) + let (file_name, f) = File::open(LINUX_MOUNTINFO) .map(|f| (LINUX_MOUNTINFO, f)) .or_else(|_| File::open(LINUX_MTAB).map(|f| (LINUX_MTAB, f))) .expect("failed to find mount list files"); - let reader = BufReader::new(fobj); + let reader = BufReader::new(f); reader .lines() .filter_map(|line| line.ok()) @@ -379,12 +386,12 @@ pub fn read_fs_list() -> Vec { } #[cfg(any(target_os = "freebsd", target_vendor = "apple"))] { - let mut mptr: *mut Sstatfs = ptr::null_mut(); - let len = unsafe { getmntinfo(&mut mptr, 1_i32) }; + let mut mount_buffer_ptr: *mut StatFs = ptr::null_mut(); + let len = unsafe { get_mount_info(&mut mount_buffer_ptr, 1_i32) }; if len < 0 { - crash!(1, "getmntinfo failed"); + crash!(1, "get_mount_info() failed"); } - let mounts = unsafe { slice::from_raw_parts(mptr, len as usize) }; + let mounts = unsafe { slice::from_raw_parts(mount_buffer_ptr, len as usize) }; mounts .iter() .map(|m| MountInfo::from(*m)) @@ -446,7 +453,7 @@ pub struct FsUsage { impl FsUsage { #[cfg(unix)] - pub fn new(statvfs: Sstatfs) -> FsUsage { + pub fn new(statvfs: StatFs) -> FsUsage { { FsUsage { blocksize: statvfs.f_bsize as u64, // or `statvfs.f_frsize` ? @@ -523,20 +530,20 @@ impl FsUsage { #[cfg(unix)] pub trait FsMeta { fn fs_type(&self) -> i64; - fn iosize(&self) -> u64; - fn blksize(&self) -> i64; + fn io_size(&self) -> u64; + fn block_size(&self) -> i64; fn total_blocks(&self) -> u64; fn free_blocks(&self) -> u64; fn avail_blocks(&self) -> u64; - fn total_fnodes(&self) -> u64; - fn free_fnodes(&self) -> u64; + fn total_file_nodes(&self) -> u64; + fn free_file_nodes(&self) -> u64; fn fsid(&self) -> u64; fn namelen(&self) -> u64; } #[cfg(unix)] -impl FsMeta for Sstatfs { - fn blksize(&self) -> i64 { +impl FsMeta for StatFs { + fn block_size(&self) -> i64 { self.f_bsize as i64 } fn total_blocks(&self) -> u64 { @@ -548,10 +555,10 @@ impl FsMeta for Sstatfs { fn avail_blocks(&self) -> u64 { self.f_bavail as u64 } - fn total_fnodes(&self) -> u64 { + fn total_file_nodes(&self) -> u64 { self.f_files as u64 } - fn free_fnodes(&self) -> u64 { + fn free_file_nodes(&self) -> u64 { self.f_ffree as u64 } #[cfg(any(target_os = "linux", target_vendor = "apple", target_os = "freebsd"))] @@ -565,16 +572,16 @@ impl FsMeta for Sstatfs { } #[cfg(target_os = "linux")] - fn iosize(&self) -> u64 { + fn io_size(&self) -> u64 { self.f_frsize as u64 } #[cfg(any(target_vendor = "apple", target_os = "freebsd"))] - fn iosize(&self) -> u64 { + fn io_size(&self) -> u64 { self.f_iosize as u64 } // XXX: dunno if this is right #[cfg(not(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux")))] - fn iosize(&self) -> u64 { + fn io_size(&self) -> u64 { self.f_bsize as u64 } @@ -605,23 +612,23 @@ impl FsMeta for Sstatfs { } #[cfg(target_os = "freebsd")] fn namelen(&self) -> u64 { - self.f_namemax as u64 + self.f_namemax as u64 // spell-checker:disable-line } // XXX: should everything just use statvfs? #[cfg(not(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux")))] fn namelen(&self) -> u64 { - self.f_namemax as u64 + self.f_namemax as u64 // spell-checker:disable-line } } #[cfg(unix)] -pub fn statfs>(path: P) -> Result +pub fn statfs>(path: P) -> Result where Vec: From

, { match CString::new(path) { Ok(p) => { - let mut buffer: Sstatfs = unsafe { mem::zeroed() }; + let mut buffer: StatFs = unsafe { mem::zeroed() }; unsafe { match statfs_fn(p.as_ptr(), &mut buffer) { 0 => Ok(buffer), @@ -667,12 +674,13 @@ pub fn pretty_filetype<'a>(mode: mode_t, size: u64) -> &'a str { S_IFIFO => "fifo", S_IFSOCK => "socket", // TODO: Other file types - // See coreutils/gnulib/lib/file-type.c + // See coreutils/gnulib/lib/file-type.c // spell-checker:disable-line _ => "weird file", } } pub fn pretty_fstype<'a>(fstype: i64) -> Cow<'a, str> { + // spell-checker:disable match fstype { 0x6163_6673 => "acfs".into(), 0xADF5 => "adfs".into(), @@ -790,6 +798,7 @@ pub fn pretty_fstype<'a>(fstype: i64) -> Cow<'a, str> { 0x2FC1_2FC1 => "zfs".into(), other => format!("UNKNOWN ({:#x})", other).into(), } + // spell-checker:enable } #[cfg(test)] @@ -808,6 +817,7 @@ mod tests { #[test] fn test_fs_type() { + // spell-checker:disable assert_eq!("ext2/ext3", pretty_fstype(0xEF53)); assert_eq!("tmpfs", pretty_fstype(0x01021994)); assert_eq!("nfs", pretty_fstype(0x6969)); @@ -817,5 +827,6 @@ mod tests { assert_eq!("ntfs", pretty_fstype(0x5346544e)); assert_eq!("fat", pretty_fstype(0x4006)); assert_eq!("UNKNOWN (0x1234)", pretty_fstype(0x1234)); + // spell-checker:enable } } diff --git a/src/uucore/src/lib/features/perms.rs b/src/uucore/src/lib/features/perms.rs index 36f56206d..eb6cca102 100644 --- a/src/uucore/src/lib/features/perms.rs +++ b/src/uucore/src/lib/features/perms.rs @@ -26,14 +26,14 @@ pub enum Verbosity { } /// Actually perform the change of group on a path -fn chgrp>(path: P, dgid: gid_t, follow: bool) -> IOResult<()> { +fn chgrp>(path: P, gid: gid_t, follow: bool) -> IOResult<()> { let path = path.as_ref(); let s = CString::new(path.as_os_str().as_bytes()).unwrap(); let ret = unsafe { if follow { - libc::chown(s.as_ptr(), 0_u32.wrapping_sub(1), dgid) + libc::chown(s.as_ptr(), 0_u32.wrapping_sub(1), gid) } else { - lchown(s.as_ptr(), 0_u32.wrapping_sub(1), dgid) + lchown(s.as_ptr(), 0_u32.wrapping_sub(1), gid) } }; if ret == 0 { @@ -100,14 +100,14 @@ pub fn wrap_chgrp>( } /// Actually perform the change of owner on a path -fn chown>(path: P, duid: uid_t, dgid: gid_t, follow: bool) -> IOResult<()> { +fn chown>(path: P, uid: uid_t, gid: gid_t, follow: bool) -> IOResult<()> { let path = path.as_ref(); let s = CString::new(path.as_os_str().as_bytes()).unwrap(); let ret = unsafe { if follow { - libc::chown(s.as_ptr(), duid, dgid) + libc::chown(s.as_ptr(), uid, gid) } else { - lchown(s.as_ptr(), duid, dgid) + lchown(s.as_ptr(), uid, gid) } }; if ret == 0 { diff --git a/src/uucore/src/lib/features/ringbuffer.rs b/src/uucore/src/lib/features/ringbuffer.rs index 60847df8f..1cb0d2b0d 100644 --- a/src/uucore/src/lib/features/ringbuffer.rs +++ b/src/uucore/src/lib/features/ringbuffer.rs @@ -47,11 +47,11 @@ impl RingBuffer { } pub fn from_iter(iter: impl Iterator, size: usize) -> RingBuffer { - let mut ringbuf = RingBuffer::new(size); + let mut ring_buffer = RingBuffer::new(size); for value in iter { - ringbuf.push_back(value); + ring_buffer.push_back(value); } - ringbuf + ring_buffer } /// Append a value to the end of the ring buffer. diff --git a/src/uucore/src/lib/features/utmpx.rs b/src/uucore/src/lib/features/utmpx.rs index 826831ba6..a794b01da 100644 --- a/src/uucore/src/lib/features/utmpx.rs +++ b/src/uucore/src/lib/features/utmpx.rs @@ -238,8 +238,8 @@ impl UtmpxIter { /// If not set, default record file will be used(file path depends on the target OS) pub fn read_from(self, f: &str) -> Self { let res = unsafe { - let cstr = CString::new(f).unwrap(); - utmpxname(cstr.as_ptr()) + let cstring = CString::new(f).unwrap(); + utmpxname(cstring.as_ptr()) }; if res != 0 { show_warning!("utmpxname: {}", IOError::last_os_error()); diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index e7f29e20c..0b0d0fddf 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -130,7 +130,7 @@ pub trait Args: Iterator + Sized { full_conversion = false; let lossy_conversion = s_ret.to_string_lossy(); eprintln!( - "Input with broken encoding occured! (s = '{}') ", + "Input with broken encoding occurred! (s = '{}') ", &lossy_conversion ); match handling { @@ -159,7 +159,7 @@ pub trait Args: Iterator + Sized { } } - /// convience function for a more slim interface + /// convenience function for a more slim interface fn collect_str_lossy(self) -> ConversionResult { self.collect_str(InvalidEncodingHandling::ConvertLossy) } diff --git a/src/uucore/src/lib/macros.rs b/src/uucore/src/lib/macros.rs index 438fec960..07d47eed8 100644 --- a/src/uucore/src/lib/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -21,7 +21,7 @@ macro_rules! executable( }) ); -/// Show an error to stderr in a silimar style to GNU coreutils. +/// Show an error to stderr in a similar style to GNU coreutils. #[macro_export] macro_rules! show_error( ($($args:tt)+) => ({ @@ -30,7 +30,7 @@ macro_rules! show_error( }) ); -/// Show a warning to stderr in a silimar style to GNU coreutils. +/// Show a warning to stderr in a similar style to GNU coreutils. #[macro_export] macro_rules! show_error_custom_description ( ($err:expr,$($args:tt)+) => ({ @@ -47,7 +47,7 @@ macro_rules! show_warning( }) ); -/// Show a bad inocation help message in a similar style to GNU coreutils. +/// Show a bad invocation help message in a similar style to GNU coreutils. #[macro_export] macro_rules! show_usage_error( ($($args:tt)+) => ({ diff --git a/src/uucore/src/lib/mods/os.rs b/src/uucore/src/lib/mods/os.rs index da2002161..dd06f4739 100644 --- a/src/uucore/src/lib/mods/os.rs +++ b/src/uucore/src/lib/mods/os.rs @@ -1,5 +1,8 @@ /// Test if the program is running under WSL // ref: @@ + +// spell-checker:ignore (path) osrelease + pub fn is_wsl_1() -> bool { #[cfg(target_os = "linux")] { From 43f5c13a7ff7860bfc4c5684699ba8f30854210f Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 20:43:33 -0500 Subject: [PATCH 0762/1135] refactor/chmod ~ polish spelling (comments, names, and exceptions) --- src/uu/chmod/src/chmod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index c4bf309d6..62faacffe 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -112,7 +112,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(options::MODE) .required_unless(options::REFERENCE) .takes_value(true), - // It would be nice if clap could parse with delimeter, e.g. "g-x,u+x", + // It would be nice if clap could parse with delimiter, e.g. "g-x,u+x", // however .multiple(true) cannot be used here because FILE already needs that. // Only one positional argument with .multiple(true) set is allowed per command ) From fc5451b5e7ab48755dbab4cbd5708aa0c54c1e8c Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 00:01:36 -0500 Subject: [PATCH 0763/1135] refactor/cksum ~ polish spelling (comments, names, and exceptions) --- src/uu/cksum/src/cksum.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index 1d45c1332..b6f798d5e 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -99,15 +99,15 @@ const fn crc_entry(input: u8) -> u32 { // i += 1; //} unroll!(8, |_i| { - let if_cond = crc & 0x8000_0000; + let if_condition = crc & 0x8000_0000; let if_body = (crc << 1) ^ 0x04c1_1db7; let else_body = crc << 1; // NOTE: i feel like this is easier to understand than emulating an if statement in bitwise // ops - let cond_table = [else_body, if_body]; + let condition_table = [else_body, if_body]; - crc = cond_table[(if_cond != 0) as usize]; + crc = condition_table[(if_condition != 0) as usize]; }); crc From 1b1086146ba820a0e48c38a452711ae26cfbfe18 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 20:43:23 -0500 Subject: [PATCH 0764/1135] refactor/cp ~ polish spelling (comments, names, and exceptions) --- src/uu/cp/src/cp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 4d9e5965e..b7c64928f 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1335,7 +1335,7 @@ fn copy_on_write_macos(source: &Path, dest: &Path, mode: ReflinkMode) -> CopyRes } if raw_pfn.is_null() || error != 0 { - // clonefile(2) is not supported or it error'ed out (possibly because the FS does not + // clonefile(2) is either not supported or it errored out (possibly because the FS does not // support COW). match mode { ReflinkMode::Always => { From dfe594e91883b17b7c7bf972bb43f7b1f9fed5e3 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 20:43:11 -0500 Subject: [PATCH 0765/1135] refactor/date ~ polish spelling (comments, names, and exceptions) --- src/uu/date/src/date.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index 1fe80c03f..02aa7a60d 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -6,8 +6,7 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// spell-checker:ignore (format) MMDDhhmm -// spell-checker:ignore (ToDO) DATEFILE +// spell-checker:ignore (chrono) Datelike Timelike ; (format) DATEFILE MMDDhhmm ; (vars) datetime datetimes #[macro_use] extern crate uucore; From 6e1bd6027adb0b8b05a53b860cdf2ed797bba8d1 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 29 May 2021 22:23:11 -0500 Subject: [PATCH 0766/1135] refactor/du ~ polish spelling (comments, names, and exceptions) --- src/uu/df/src/df.rs | 30 ++++++++++++++---------------- src/uu/du/src/du.rs | 23 +++++++++++------------ 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index 8219b0a27..07f8b0214 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -6,9 +6,6 @@ // For the full copyright and license information, please view the LICENSE file // that was distributed with this source code. -// spell-checker:ignore (ToDO) mountinfo BLOCKSIZE fobj mptr noatime Iused overmounted -// spell-checker:ignore (libc/fs) asyncreads asyncwrites autofs bavail bfree bsize charspare cifs debugfs devfs devpts ffree frsize fsid fstypename fusectl inode inodes iosize kernfs mntbufp mntfromname mntonname mqueue namemax pipefs smbfs statvfs subfs syncreads syncwrites sysfs wcslen - #[macro_use] extern crate uucore; #[cfg(unix)] @@ -78,7 +75,7 @@ struct Options { #[derive(Debug, Clone)] struct Filesystem { - mountinfo: MountInfo, + mount_info: MountInfo, usage: FsUsage, } @@ -131,19 +128,19 @@ impl Options { } impl Filesystem { - // TODO: resolve uuid in `mountinfo.dev_name` if exists - fn new(mountinfo: MountInfo) -> Option { - let _stat_path = if !mountinfo.mount_dir.is_empty() { - mountinfo.mount_dir.clone() + // TODO: resolve uuid in `mount_info.dev_name` if exists + fn new(mount_info: MountInfo) -> Option { + let _stat_path = if !mount_info.mount_dir.is_empty() { + mount_info.mount_dir.clone() } else { #[cfg(unix)] { - mountinfo.dev_name.clone() + mount_info.dev_name.clone() } #[cfg(windows)] { // On windows, we expect the volume id - mountinfo.dev_id.clone() + mount_info.dev_id.clone() } }; #[cfg(unix)] @@ -154,14 +151,14 @@ impl Filesystem { None } else { Some(Filesystem { - mountinfo, + mount_info, usage: FsUsage::new(statvfs), }) } } #[cfg(windows)] Some(Filesystem { - mountinfo, + mount_info, usage: FsUsage::new(Path::new(&_stat_path)), }) } @@ -205,7 +202,7 @@ fn filter_mount_list(vmi: Vec, paths: &[String], opt: &Options) -> Ve if (!mi.dev_name.starts_with('/') || seen.dev_name.starts_with('/')) // let points towards the root of the device win. && (!target_nearer_root || source_below_root) - // let an entry overmounted on a new device win... + // let an entry over-mounted on a new device win... && (seen.dev_name == mi.dev_name /* ... but only when matching an existing mnt point, to avoid problematic replacement when given @@ -431,6 +428,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { header.push("Type"); } header.extend_from_slice(&if opt.show_inode_instead { + // spell-checker:disable-next-line ["Inodes", "Iused", "IFree", "IUses%"] } else { [ @@ -462,9 +460,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } println!(); for fs in fs_list.iter() { - print!("{0: <16} ", fs.mountinfo.dev_name); + print!("{0: <16} ", fs.mount_info.dev_name); if opt.show_fs_type { - print!("{0: <5} ", fs.mountinfo.fs_type); + print!("{0: <5} ", fs.mount_info.fs_type); } if opt.show_inode_instead { print!( @@ -508,7 +506,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } print!("{0: >5} ", use_size(free_size, total_size)); } - print!("{0: <16}", fs.mountinfo.mount_dir); + print!("{0: <16}", fs.mount_info.mount_dir); println!(); } diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index b0940d93d..0bc8b30c8 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -60,14 +60,13 @@ const VERSION: &str = env!("CARGO_PKG_VERSION"); const NAME: &str = "du"; const SUMMARY: &str = "estimate file space usage"; const LONG_HELP: &str = " - Display values are in units of the first available SIZE from - --block-size, and the DU_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environ‐ - ment variables. Otherwise, units default to 1024 bytes (or 512 if - POSIXLY_CORRECT is set). +Display values are in units of the first available SIZE from --block-size, +and the DU_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables. +Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set). - SIZE is an integer and optional unit (example: 10M is 10*1024*1024). - Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (pow‐ - ers of 1000). +SIZE is an integer and optional unit (example: 10M is 10*1024*1024). +Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB,... (powers +of 1000). "; // TODO: Support Z & Y (currently limited by size of u64) @@ -586,7 +585,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { separate_dirs: matches.is_present(options::SEPARATE_DIRS), }; - let strs = match matches.value_of(options::FILE) { + let files = match matches.value_of(options::FILE) { Some(_) => matches.values_of(options::FILE).unwrap().collect(), None => { vec!["./"] // TODO: gnu `du` doesn't use trailing "/" here @@ -644,8 +643,8 @@ Try '{} --help' for more information.", }; let mut grand_total = 0; - for path_str in strs { - let path = PathBuf::from(&path_str); + for path_string in files { + let path = PathBuf::from(&path_string); match Stat::new(path) { Ok(stat) => { let mut inodes: HashSet = HashSet::new(); @@ -707,13 +706,13 @@ Try '{} --help' for more information.", } if options.total && index == (len - 1) { // The last element will be the total size of the the path under - // path_str. We add it to the grand total. + // path_string. We add it to the grand total. grand_total += size; } } } Err(_) => { - show_error!("{}: {}", path_str, "No such file or directory"); + show_error!("{}: {}", path_string, "No such file or directory"); } } } From ba7939e142dd0aeb6c4078521b820b26fc9e5b3f Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 20:43:03 -0500 Subject: [PATCH 0767/1135] refactor/env ~ polish spelling (comments, names, and exceptions) --- src/uu/env/src/env.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/env/src/env.rs b/src/uu/env/src/env.rs index 83927b160..50a327260 100644 --- a/src/uu/env/src/env.rs +++ b/src/uu/env/src/env.rs @@ -7,7 +7,7 @@ /* last synced with: env (GNU coreutils) 8.13 */ -// spell-checker:ignore (ToDO) execvp progname subcommand subcommands unsets +// spell-checker:ignore (ToDO) chdir execvp progname subcommand subcommands unsets #[macro_use] extern crate clap; From 1a37d502d113e411c0fabeb9e8efcca9ee733b81 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 00:09:01 -0500 Subject: [PATCH 0768/1135] refactor/factor ~ polish spelling (comments, names, and exceptions) --- src/uu/factor/BENCHMARKING.md | 16 +++++++++------- src/uu/factor/build.rs | 18 ++++++++---------- src/uu/factor/src/factor.rs | 2 ++ src/uu/factor/src/miller_rabin.rs | 5 +++-- src/uu/factor/src/numeric/gcd.rs | 2 +- src/uu/factor/src/numeric/modular_inverse.rs | 20 ++++++++++---------- src/uu/factor/src/numeric/montgomery.rs | 8 ++++---- src/uu/factor/src/table.rs | 4 ++-- 8 files changed, 39 insertions(+), 36 deletions(-) diff --git a/src/uu/factor/BENCHMARKING.md b/src/uu/factor/BENCHMARKING.md index e174d62b7..7b611db4b 100644 --- a/src/uu/factor/BENCHMARKING.md +++ b/src/uu/factor/BENCHMARKING.md @@ -1,5 +1,7 @@ # Benchmarking `factor` + + The benchmarks for `factor` are located under `tests/benches/factor` and can be invoked with `cargo bench` in that directory. @@ -13,7 +15,7 @@ a newer version of `rustc`. We currently use [`criterion`] to benchmark deterministic functions, such as `gcd` and `table::factor`. -However, µbenchmarks are by nature unstable: not only are they specific to +However, microbenchmarks are by nature unstable: not only are they specific to the hardware, operating system version, etc., but they are noisy and affected by other tasks on the system (browser, compile jobs, etc.), which can cause `criterion` to report spurious performance improvements and regressions. @@ -33,13 +35,13 @@ as possible: [`criterion`]: https://bheisler.github.io/criterion.rs/book/index.html [lemire]: https://lemire.me/blog/2018/01/16/microbenchmarking-calls-for-idealized-conditions/ [isolate a **physical** core]: https://pyperf.readthedocs.io/en/latest/system.html#isolate-cpus-on-linux -[frequency stays constant]: XXXTODO +[frequency stays constant]: ... -### Guidance for designing µbenchmarks +### Guidance for designing microbenchmarks *Note:* this guidance is specific to `factor` and takes its application domain -into account; do not expect it to generalise to other projects. It is based +into account; do not expect it to generalize to other projects. It is based on Daniel Lemire's [*Microbenchmarking calls for idealized conditions*][lemire], which I recommend reading if you want to add benchmarks to `factor`. @@ -71,7 +73,7 @@ which I recommend reading if you want to add benchmarks to `factor`. ### Configurable statistical estimators -`criterion` always uses the arithmetic average as estimator; in µbenchmarks, +`criterion` always uses the arithmetic average as estimator; in microbenchmarks, where the code under test is fully deterministic and the measurements are subject to additive, positive noise, [the minimum is more appropriate][lemire]. @@ -81,10 +83,10 @@ subject to additive, positive noise, [the minimum is more appropriate][lemire]. Measuring performance on real hardware is important, as it relates directly to what users of `factor` experience; however, such measurements are subject to the constraints of the real-world, and aren't perfectly reproducible. -Moreover, the mitigations for it (described above) aren't achievable in +Moreover, the mitigation for it (described above) isn't achievable in virtualized, multi-tenant environments such as CI. -Instead, we could run the µbenchmarks in a simulated CPU with [`cachegrind`], +Instead, we could run the microbenchmarks in a simulated CPU with [`cachegrind`], measure execution “time” in that model (in CI), and use it to detect and report performance improvements and regressions. diff --git a/src/uu/factor/build.rs b/src/uu/factor/build.rs index eff21ae2f..32640d61a 100644 --- a/src/uu/factor/build.rs +++ b/src/uu/factor/build.rs @@ -13,8 +13,6 @@ //! 2 has no multiplicative inverse mode 2^64 because 2 | 2^64, //! and in any case divisibility by two is trivial by checking the LSB. -// spell-checker:ignore (ToDO) invs newr newrp newtp outstr - #![cfg_attr(test, allow(dead_code))] use std::env::{self, args}; @@ -60,13 +58,13 @@ fn main() { let mut x = primes.next().unwrap(); for next in primes { // format the table - let outstr = format!("({}, {}, {}),", x, modular_inverse(x), std::u64::MAX / x); - if cols + outstr.len() > MAX_WIDTH { - write!(file, "\n {}", outstr).unwrap(); - cols = 4 + outstr.len(); + let output = format!("({}, {}, {}),", x, modular_inverse(x), std::u64::MAX / x); + if cols + output.len() > MAX_WIDTH { + write!(file, "\n {}", output).unwrap(); + cols = 4 + output.len(); } else { - write!(file, " {}", outstr).unwrap(); - cols += 1 + outstr.len(); + write!(file, " {}", output).unwrap(); + cols += 1 + output.len(); } x = next; @@ -81,7 +79,7 @@ fn main() { } #[test] -fn test_generator_isprime() { +fn test_generator_is_prime() { assert_eq!(Sieve::odd_primes.take(10_000).all(is_prime)); } @@ -106,5 +104,5 @@ const PREAMBLE: &str = r##"/* // re-run src/factor/gen_tables.rs. #[allow(clippy::unreadable_literal)] -pub const P_INVS_U64: &[(u64, u64, u64)] = &[ +pub const PRIME_INVERSIONS_U64: &[(u64, u64, u64)] = &[ "##; diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index b279de7fc..54ad0bdd4 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -17,6 +17,7 @@ type Exponent = u8; #[derive(Clone, Debug)] struct Decomposition(SmallVec<[(u64, Exponent); NUM_FACTORS_INLINE]>); +// spell-checker:ignore (names) Erdős–Kac * Erdős Kac // The number of factors to inline directly into a `Decomposition` object. // As a consequence of the Erdős–Kac theorem, the average number of prime factors // of integers < 10²⁵ ≃ 2⁸³ is 4, so we can use a slightly higher value. @@ -250,6 +251,7 @@ impl Distribution for Standard { let mut g = 1u64; let mut n = u64::MAX; + // spell-checker:ignore (names) Adam Kalai * Kalai's // Adam Kalai's algorithm for generating uniformly-distributed // integers and their factorization. // diff --git a/src/uu/factor/src/miller_rabin.rs b/src/uu/factor/src/miller_rabin.rs index 2a3b7bdf1..ec6d81c0f 100644 --- a/src/uu/factor/src/miller_rabin.rs +++ b/src/uu/factor/src/miller_rabin.rs @@ -21,6 +21,7 @@ impl Basis for Montgomery { } impl Basis for Montgomery { + // spell-checker:ignore (names) Steve Worley // Small set of bases for the Miller-Rabin prime test, valid for all 32b integers; // discovered by Steve Worley on 2013-05-27, see miller-rabin.appspot.com #[allow(clippy::unreadable_literal)] @@ -121,8 +122,8 @@ mod tests { } fn odd_primes() -> impl Iterator { - use crate::table::{NEXT_PRIME, P_INVS_U64}; - P_INVS_U64 + use crate::table::{NEXT_PRIME, PRIME_INVERSIONS_U64}; + PRIME_INVERSIONS_U64 .iter() .map(|(p, _, _)| *p) .chain(iter::once(NEXT_PRIME)) diff --git a/src/uu/factor/src/numeric/gcd.rs b/src/uu/factor/src/numeric/gcd.rs index 36ad833a6..004ef1515 100644 --- a/src/uu/factor/src/numeric/gcd.rs +++ b/src/uu/factor/src/numeric/gcd.rs @@ -93,7 +93,7 @@ mod tests { gcd(a, gcd(b, c)) == gcd(gcd(a, b), c) } - fn scalar_mult(a: u64, b: u64, k: u64) -> bool { + fn scalar_multiplication(a: u64, b: u64, k: u64) -> bool { gcd(k * a, k * b) == k * gcd(a, b) } diff --git a/src/uu/factor/src/numeric/modular_inverse.rs b/src/uu/factor/src/numeric/modular_inverse.rs index 763ee90a0..e4827a3ee 100644 --- a/src/uu/factor/src/numeric/modular_inverse.rs +++ b/src/uu/factor/src/numeric/modular_inverse.rs @@ -16,11 +16,11 @@ pub(crate) fn modular_inverse(a: T) -> T { debug_assert!(a % (one + one) == one, "{:?} is not odd", a); let mut t = zero; - let mut newt = one; + let mut new_t = one; let mut r = zero; - let mut newr = a; + let mut new_r = a; - while newr != zero { + while new_r != zero { let quot = if r == zero { // special case when we're just starting out // This works because we know that @@ -28,15 +28,15 @@ pub(crate) fn modular_inverse(a: T) -> T { T::max_value() } else { r - } / newr; + } / new_r; - let newtp = t.wrapping_sub(".wrapping_mul(&newt)); - t = newt; - newt = newtp; + let new_tp = t.wrapping_sub(".wrapping_mul(&new_t)); + t = new_t; + new_t = new_tp; - let newrp = r.wrapping_sub(".wrapping_mul(&newr)); - r = newr; - newr = newrp; + let new_rp = r.wrapping_sub(".wrapping_mul(&new_r)); + r = new_r; + new_r = new_rp; } debug_assert_eq!(r, one); diff --git a/src/uu/factor/src/numeric/montgomery.rs b/src/uu/factor/src/numeric/montgomery.rs index 8c38464bc..485025d87 100644 --- a/src/uu/factor/src/numeric/montgomery.rs +++ b/src/uu/factor/src/numeric/montgomery.rs @@ -69,7 +69,7 @@ impl Montgomery { let t_bits = T::zero().count_zeros() as usize; debug_assert!(x < (self.n.as_double_width()) << t_bits); - // TODO: optimiiiiiiise + // TODO: optimize let Montgomery { a, n } = self; let m = T::from_double_width(x).wrapping_mul(a); let nm = (n.as_double_width()) * (m.as_double_width()); @@ -138,7 +138,7 @@ impl Arithmetic for Montgomery { r + self.n.wrapping_neg() }; - // Normalise to [0; n[ + // Normalize to [0; n[ let r = if r < self.n { r } else { r - self.n }; // Check that r (reduced back to the usual representation) equals @@ -200,7 +200,7 @@ mod tests { } parametrized_check!(test_add); - fn test_mult() { + fn test_multiplication() { for n in 0..100 { let n = 2 * n + 1; let m = Montgomery::::new(n); @@ -213,7 +213,7 @@ mod tests { } } } - parametrized_check!(test_mult); + parametrized_check!(test_multiplication); fn test_roundtrip() { for n in 0..100 { diff --git a/src/uu/factor/src/table.rs b/src/uu/factor/src/table.rs index 518d4f241..6d4047e49 100644 --- a/src/uu/factor/src/table.rs +++ b/src/uu/factor/src/table.rs @@ -13,7 +13,7 @@ use crate::Factors; include!(concat!(env!("OUT_DIR"), "/prime_table.rs")); pub fn factor(num: &mut u64, factors: &mut Factors) { - for &(prime, inv, ceil) in P_INVS_U64 { + for &(prime, inv, ceil) in PRIME_INVERSIONS_U64 { if *num == 1 { break; } @@ -45,7 +45,7 @@ pub fn factor(num: &mut u64, factors: &mut Factors) { pub const CHUNK_SIZE: usize = 8; pub fn factor_chunk(n_s: &mut [u64; CHUNK_SIZE], f_s: &mut [Factors; CHUNK_SIZE]) { - for &(prime, inv, ceil) in P_INVS_U64 { + for &(prime, inv, ceil) in PRIME_INVERSIONS_U64 { if n_s[0] == 1 && n_s[1] == 1 && n_s[2] == 1 && n_s[3] == 1 { break; } From a481e8230be2bee019e62a6c11fde1dbe4d5bdc9 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 18:31:07 -0500 Subject: [PATCH 0769/1135] refactor/hashsum ~ polish spelling (comments, names, and exceptions) --- src/uu/hashsum/src/hashsum.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index b1ba3c217..b39b5788c 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -370,7 +370,7 @@ pub fn uumain(mut args: impl uucore::Args) -> i32 { ); if !is_custom_binary(&binary_name) { - let algos = &[ + let algorithms = &[ ("md5", "work with MD5"), ("sha1", "work with SHA1"), ("sha224", "work with SHA224"), @@ -393,7 +393,7 @@ pub fn uumain(mut args: impl uucore::Args) -> i32 { ("b2sum", "work with BLAKE2"), ]; - for (name, desc) in algos { + for (name, desc) in algorithms { app = app.arg(Arg::with_name(name).long(name).help(desc)); } } From 785343db7f042525aff9666fabe40bdfe212203f Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 18:31:55 -0500 Subject: [PATCH 0770/1135] refactor/head ~ polish spelling (comments, names, and exceptions) --- src/uu/head/src/head.rs | 60 +++++++++++++++++++++------------------- src/uu/head/src/lines.rs | 2 ++ src/uu/head/src/parse.rs | 6 ++-- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 3602b4a73..ff5ef2355 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (vars) zlines + use clap::{App, Arg}; use std::convert::TryFrom; use std::ffi::OsString; @@ -210,7 +212,7 @@ impl Default for HeadOptions { } } -fn rbuf_n_bytes(input: R, n: usize) -> std::io::Result<()> +fn read_n_bytes(input: R, n: usize) -> std::io::Result<()> where R: Read, { @@ -226,7 +228,7 @@ where Ok(()) } -fn rbuf_n_lines(input: &mut impl std::io::BufRead, n: usize, zero: bool) -> std::io::Result<()> { +fn read_n_lines(input: &mut impl std::io::BufRead, n: usize, zero: bool) -> std::io::Result<()> { if n == 0 { return Ok(()); } @@ -249,18 +251,18 @@ fn rbuf_n_lines(input: &mut impl std::io::BufRead, n: usize, zero: bool) -> std: }) } -fn rbuf_but_last_n_bytes(input: &mut impl std::io::BufRead, n: usize) -> std::io::Result<()> { +fn read_but_last_n_bytes(input: &mut impl std::io::BufRead, n: usize) -> std::io::Result<()> { if n == 0 { //prints everything - return rbuf_n_bytes(input, std::usize::MAX); + return read_n_bytes(input, std::usize::MAX); } let stdout = std::io::stdout(); let mut stdout = stdout.lock(); - let mut ringbuf = vec![0u8; n]; + let mut ring_buffer = vec![0u8; n]; // first we fill the ring buffer - if let Err(e) = input.read_exact(&mut ringbuf) { + if let Err(e) = input.read_exact(&mut ring_buffer) { if e.kind() == ErrorKind::UnexpectedEof { return Ok(()); } else { @@ -281,22 +283,22 @@ fn rbuf_but_last_n_bytes(input: &mut impl std::io::BufRead, n: usize) -> std::io if read == 0 { return Ok(()); } else if read >= n { - stdout.write_all(&ringbuf)?; + stdout.write_all(&ring_buffer)?; stdout.write_all(&buffer[..read - n])?; for i in 0..n { - ringbuf[i] = buffer[read - n + i]; + ring_buffer[i] = buffer[read - n + i]; } } else { - stdout.write_all(&ringbuf[..read])?; + stdout.write_all(&ring_buffer[..read])?; for i in 0..n - read { - ringbuf[i] = ringbuf[read + i]; + ring_buffer[i] = ring_buffer[read + i]; } - ringbuf[n - read..].copy_from_slice(&buffer[..read]); + ring_buffer[n - read..].copy_from_slice(&buffer[..read]); } } } -fn rbuf_but_last_n_lines( +fn read_but_last_n_lines( input: impl std::io::BufRead, n: usize, zero: bool, @@ -325,7 +327,7 @@ fn head_backwards_file(input: &mut std::fs::File, options: &HeadOptions) -> std: return Ok(()); } else { input.seek(SeekFrom::Start(0))?; - rbuf_n_bytes( + read_n_bytes( &mut std::io::BufReader::with_capacity(BUF_SIZE, input), size - n, )?; @@ -364,7 +366,7 @@ fn head_backwards_file(input: &mut std::fs::File, options: &HeadOptions) -> std: } }; input.seek(SeekFrom::Start(0))?; - rbuf_n_bytes( + read_n_bytes( &mut std::io::BufReader::with_capacity(BUF_SIZE, input), size - found, )?; @@ -379,9 +381,9 @@ fn head_file(input: &mut std::fs::File, options: &HeadOptions) -> std::io::Resul } else { match options.mode { Modes::Bytes(n) => { - rbuf_n_bytes(&mut std::io::BufReader::with_capacity(BUF_SIZE, input), n) + read_n_bytes(&mut std::io::BufReader::with_capacity(BUF_SIZE, input), n) } - Modes::Lines(n) => rbuf_n_lines( + Modes::Lines(n) => read_n_lines( &mut std::io::BufReader::with_capacity(BUF_SIZE, input), n, options.zeroed, @@ -393,8 +395,8 @@ fn head_file(input: &mut std::fs::File, options: &HeadOptions) -> std::io::Resul fn uu_head(options: &HeadOptions) -> Result<(), u32> { let mut error_count = 0; let mut first = true; - for fname in &options.files { - let res = match fname.as_str() { + for file in &options.files { + let res = match file.as_str() { "-" => { if (options.files.len() > 1 && !options.quiet) || options.verbose { if !first { @@ -407,16 +409,16 @@ fn uu_head(options: &HeadOptions) -> Result<(), u32> { match options.mode { Modes::Bytes(n) => { if options.all_but_last { - rbuf_but_last_n_bytes(&mut stdin, n) + read_but_last_n_bytes(&mut stdin, n) } else { - rbuf_n_bytes(&mut stdin, n) + read_n_bytes(&mut stdin, n) } } Modes::Lines(n) => { if options.all_but_last { - rbuf_but_last_n_lines(&mut stdin, n, options.zeroed) + read_but_last_n_lines(&mut stdin, n, options.zeroed) } else { - rbuf_n_lines(&mut stdin, n, options.zeroed) + read_n_lines(&mut stdin, n, options.zeroed) } } } @@ -451,10 +453,10 @@ fn uu_head(options: &HeadOptions) -> Result<(), u32> { } }; if res.is_err() { - let name = if fname.as_str() == "-" { + let name = if file.as_str() == "-" { "standard input" } else { - fname + file }; let prefix = format!("error reading {}", name); show_error_custom_description!(prefix, "Input/output error"); @@ -502,7 +504,7 @@ mod tests { } #[test] fn test_gnu_compatibility() { - let args = options("-n 1 -c 1 -n 5 -c kiB -vqvqv").unwrap(); + let args = options("-n 1 -c 1 -n 5 -c kiB -vqvqv").unwrap(); // spell-checker:disable-line assert!(args.mode == Modes::Bytes(1024)); assert!(args.verbose); assert_eq!(options("-5").unwrap().mode, Modes::Lines(5)); @@ -584,7 +586,7 @@ mod tests { ); //test that the obsolete syntax is unrolled assert_eq!( - arg_outputs("head -123qvqvqzc"), + arg_outputs("head -123qvqvqzc"), // spell-checker:disable-line Ok("head -q -z -c 123".to_owned()) ); //test that bad obsoletes are an error @@ -604,9 +606,9 @@ mod tests { ); } #[test] - fn rbuf_early_exit() { + fn read_early_exit() { let mut empty = std::io::BufReader::new(std::io::Cursor::new(Vec::new())); - assert!(rbuf_n_bytes(&mut empty, 0).is_ok()); - assert!(rbuf_n_lines(&mut empty, 0, false).is_ok()); + assert!(read_n_bytes(&mut empty, 0).is_ok()); + assert!(read_n_lines(&mut empty, 0, false).is_ok()); } } diff --git a/src/uu/head/src/lines.rs b/src/uu/head/src/lines.rs index dcae27bc8..118aba17f 100644 --- a/src/uu/head/src/lines.rs +++ b/src/uu/head/src/lines.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (vars) zline zlines + //! Iterate over zero-terminated lines. use std::io::BufRead; diff --git a/src/uu/head/src/parse.rs b/src/uu/head/src/parse.rs index 0cf20be42..f1c97561d 100644 --- a/src/uu/head/src/parse.rs +++ b/src/uu/head/src/parse.rs @@ -7,7 +7,7 @@ pub enum ParseError { Overflow, } /// Parses obsolete syntax -/// head -NUM[kmzv] +/// head -NUM[kmzv] // spell-checker:disable-line pub fn parse_obsolete(src: &str) -> Option, ParseError>> { let mut chars = src.char_indices(); if let Some((_, '-')) = chars.next() { @@ -242,7 +242,7 @@ mod tests { assert_eq!(obsolete("-1mmk"), obsolete_result(&["-c", "1024"])); assert_eq!(obsolete("-1vz"), obsolete_result(&["-v", "-z", "-n", "1"])); assert_eq!( - obsolete("-1vzqvq"), + obsolete("-1vzqvq"), // spell-checker:disable-line obsolete_result(&["-q", "-z", "-n", "1"]) ); assert_eq!(obsolete("-1vzc"), obsolete_result(&["-v", "-z", "-c", "1"])); @@ -257,7 +257,7 @@ mod tests { assert_eq!(obsolete("-5c5"), Some(Err(ParseError::Syntax))); } #[test] - fn test_parse_obsolete_nomatch() { + fn test_parse_obsolete_no_match() { assert_eq!(obsolete("-k"), None); assert_eq!(obsolete("asd"), None); } From 96faa4efb6ba845099ffc802709553152d598e57 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 18:32:20 -0500 Subject: [PATCH 0771/1135] refactor/ln ~ polish spelling (comments, names, and exceptions) --- src/uu/ln/src/ln.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index 04358a415..2a14f3c9c 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -371,21 +371,21 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings) } fn relative_path<'a>(src: &Path, dst: &Path) -> Result> { - let abssrc = canonicalize(src, CanonicalizeMode::Normal)?; - let absdst = canonicalize(dst, CanonicalizeMode::Normal)?; - let suffix_pos = abssrc + let src_abs = canonicalize(src, CanonicalizeMode::Normal)?; + let dst_abs = canonicalize(dst, CanonicalizeMode::Normal)?; + let suffix_pos = src_abs .components() - .zip(absdst.components()) + .zip(dst_abs.components()) .take_while(|(s, d)| s == d) .count(); - let srciter = abssrc.components().skip(suffix_pos).map(|x| x.as_os_str()); + let src_iter = src_abs.components().skip(suffix_pos).map(|x| x.as_os_str()); - let result: PathBuf = absdst + let result: PathBuf = dst_abs .components() .skip(suffix_pos + 1) .map(|_| OsStr::new("..")) - .chain(srciter) + .chain(src_iter) .collect(); Ok(result.into()) } From 5942ba05ef3a12c522d4610a106763cf78452b99 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 18:32:40 -0500 Subject: [PATCH 0772/1135] refactor/ls ~ polish spelling (comments, names, and exceptions) --- src/uu/ls/src/ls.rs | 19 ++++++++++--------- src/uu/ls/src/quoting_style.rs | 2 ++ src/uu/ls/src/version_cmp.rs | 3 ++- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 5846cb0aa..3e8e908dd 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -60,7 +60,7 @@ fn get_usage() -> String { pub mod options { pub mod format { - pub static ONELINE: &str = "1"; + pub static ONE_LINE: &str = "1"; pub static LONG: &str = "long"; pub static COLUMNS: &str = "C"; pub static ACROSS: &str = "x"; @@ -248,7 +248,7 @@ impl Config { // -og should hide both owner and group. Furthermore, they are not // reset if -l or --format=long is used. So these should just show the // group: -gl or "-g --format=long". Finally, they are also not reset - // when switching to a different format option inbetween like this: + // when switching to a different format option in-between like this: // -ogCl or "-og --format=vertical --format=long". // // -1 has a similar issue: it does nothing if the format is long. This @@ -275,7 +275,7 @@ impl Config { .any(|i| i >= idx) { format = Format::Long; - } else if let Some(mut indices) = options.indices_of(options::format::ONELINE) { + } else if let Some(mut indices) = options.indices_of(options::format::ONE_LINE) { if indices.any(|i| i > idx) { format = Format::OneLine; } @@ -636,8 +636,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // ls -1g1 // even though `ls -11` and `ls -1 -g -1` work. .arg( - Arg::with_name(options::format::ONELINE) - .short(options::format::ONELINE) + Arg::with_name(options::format::ONE_LINE) + .short(options::format::ONE_LINE) .help("List one file per line.") .multiple(true) ) @@ -1130,7 +1130,7 @@ impl PathData { let display_name = if let Some(name) = file_name { name } else { - let display_osstr = if command_line { + let display_os_str = if command_line { p_buf.as_os_str() } else { p_buf @@ -1138,7 +1138,7 @@ impl PathData { .unwrap_or_else(|| p_buf.iter().next_back().unwrap()) }; - display_osstr.to_string_lossy().into_owned() + display_os_str.to_string_lossy().into_owned() }; let must_dereference = match &config.dereference { Dereference::All => true, @@ -1624,6 +1624,7 @@ fn display_date(metadata: &Metadata, config: &Config) -> String { TimeStyle::Locale => { let fmt = if recent { "%b %e %H:%M" } else { "%b %e %Y" }; + // spell-checker:ignore (word) datetime //In this version of chrono translating can be done //The function is chrono::datetime::DateTime::format_localized //However it's currently still hard to get the current pure-rust-locale @@ -1678,7 +1679,7 @@ fn display_size_or_rdev(metadata: &Metadata, config: &Config) -> String { } fn display_size(size: u64, config: &Config) -> String { - // NOTE: The human-readable behaviour deviates from the GNU ls. + // NOTE: The human-readable behavior deviates from the GNU ls. // The GNU ls uses binary prefixes by default. match config.size_format { SizeFormat::Binary => format_prefixed(NumberPrefix::binary(size as f64)), @@ -1692,7 +1693,7 @@ fn file_is_executable(md: &Metadata) -> bool { // Mode always returns u32, but the flags might not be, based on the platform // e.g. linux has u32, mac has u16. // S_IXUSR -> user has execute permission - // S_IXGRP -> group has execute persmission + // S_IXGRP -> group has execute permission // S_IXOTH -> other users have execute permission md.mode() & ((S_IXUSR | S_IXGRP | S_IXOTH) as u32) != 0 } diff --git a/src/uu/ls/src/quoting_style.rs b/src/uu/ls/src/quoting_style.rs index 01bffa7ec..f9ba55f7b 100644 --- a/src/uu/ls/src/quoting_style.rs +++ b/src/uu/ls/src/quoting_style.rs @@ -304,6 +304,8 @@ pub(super) fn escape_name(name: &str, style: &QuotingStyle) -> String { #[cfg(test)] mod tests { + // spell-checker:ignore (tests/words) one\'two one'two + use crate::quoting_style::{escape_name, Quotes, QuotingStyle}; fn get_style(s: &str) -> QuotingStyle { match s { diff --git a/src/uu/ls/src/version_cmp.rs b/src/uu/ls/src/version_cmp.rs index 4cd39f916..e3f7e29e3 100644 --- a/src/uu/ls/src/version_cmp.rs +++ b/src/uu/ls/src/version_cmp.rs @@ -83,7 +83,7 @@ pub(crate) fn version_cmp(a: &Path, b: &Path) -> Ordering { Ordering::Equal => {} x => return x, }, - // Otherise, we compare the options (because None < Some(_)) + // Otherwise, we compare the options (because None < Some(_)) (a_opt, b_opt) => match a_opt.cmp(&b_opt) { // If they are completely equal except for leading zeroes, we use the leading zeroes. Ordering::Equal => return leading_zeroes, @@ -203,6 +203,7 @@ mod tests { ); assert_eq!( + // spell-checker:disable-next-line version_cmp(&PathBuf::from("file1000"), &PathBuf::from("fileapple")), Ordering::Less, "Numbers in the middle of the name are sorted before other characters" From e3784eff471905a7492edc1ceaef0d087a1ccb21 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 20:42:15 -0500 Subject: [PATCH 0773/1135] refactor/mknod ~ polish spelling (comments, names, and exceptions) --- src/uu/mknod/src/mknod.rs | 10 +++++----- src/uu/mknod/src/parsemode.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/uu/mknod/src/mknod.rs b/src/uu/mknod/src/mknod.rs index e0cf62024..57bdd3052 100644 --- a/src/uu/mknod/src/mknod.rs +++ b/src/uu/mknod/src/mknod.rs @@ -50,12 +50,12 @@ fn makedev(maj: u64, min: u64) -> dev_t { } #[cfg(windows)] -fn _makenod(file_name: &str, mode: mode_t, dev: dev_t) -> i32 { +fn _mknod(file_name: &str, mode: mode_t, dev: dev_t) -> i32 { panic!("Unsupported for windows platform") } #[cfg(unix)] -fn _makenod(file_name: &str, mode: mode_t, dev: dev_t) -> i32 { +fn _mknod(file_name: &str, mode: mode_t, dev: dev_t) -> i32 { let c_str = CString::new(file_name).expect("Failed to convert to CString"); // the user supplied a mode @@ -158,7 +158,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { eprintln!("Try '{} --help' for more information.", NAME); 1 } else { - _makenod(file_name, S_IFIFO | mode, 0) + _mknod(file_name, S_IFIFO | mode, 0) } } else { match (matches.value_of("major"), matches.value_of("minor")) { @@ -174,10 +174,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let dev = makedev(major, minor); if ch == 'b' { // block special file - _makenod(file_name, S_IFBLK | mode, dev) + _mknod(file_name, S_IFBLK | mode, dev) } else if ch == 'c' || ch == 'u' { // char special file - _makenod(file_name, S_IFCHR | mode, dev) + _mknod(file_name, S_IFCHR | mode, dev) } else { unreachable!("{} was validated to be only b, c or u", ch); } diff --git a/src/uu/mknod/src/parsemode.rs b/src/uu/mknod/src/parsemode.rs index 026fc4a56..2767cb303 100644 --- a/src/uu/mknod/src/parsemode.rs +++ b/src/uu/mknod/src/parsemode.rs @@ -1,4 +1,4 @@ -// spell-checker:ignore (ToDO) fperm +// spell-checker:ignore (path) osrelease use libc::{mode_t, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR}; From 57e342d2b222e1261dee4c1090b4294eb85625cd Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 18:33:06 -0500 Subject: [PATCH 0774/1135] refactor/mktemp ~ polish spelling (comments, names, and exceptions) --- src/uu/mktemp/src/mktemp.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index f6c244bf2..f7c87495c 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -6,7 +6,7 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// spell-checker:ignore (ToDO) tempfile tempdir SUFF TMPDIR tmpname +// spell-checker:ignore (paths) GPGHome #[macro_use] extern crate uucore; @@ -67,10 +67,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(OPT_SUFFIX) .long(OPT_SUFFIX) .help( - "append SUFF to TEMPLATE; SUFF must not contain a path separator. \ + "append SUFFIX to TEMPLATE; SUFFIX must not contain a path separator. \ This option is implied if TEMPLATE does not end with X.", ) - .value_name("SUFF"), + .value_name("SUFFIX"), ) .arg( Arg::with_name(OPT_TMPDIR) From f9a088cecf4beb8138a61849ed5273bdd2b3a428 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 31 May 2021 15:22:37 +0200 Subject: [PATCH 0775/1135] du: use "parse_size" from uucore * fix stderr to be the same than GNU's `du` in case of invalid SIZE --- src/uu/du/src/du.rs | 101 +++++++++++---------------------------- tests/by-util/test_du.rs | 17 +++++++ 2 files changed, 45 insertions(+), 73 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 6bd4f23e4..8394741cc 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -14,6 +14,7 @@ use chrono::prelude::DateTime; use chrono::Local; use clap::{App, Arg}; use std::collections::HashSet; +use std::convert::TryFrom; use std::env; use std::fs; use std::io::{stderr, ErrorKind, Result, Write}; @@ -26,6 +27,7 @@ use std::os::windows::fs::MetadataExt; use std::os::windows::io::AsRawHandle; use std::path::PathBuf; use std::time::{Duration, UNIX_EPOCH}; +use uucore::parse_size::{parse_size, ParseSizeError}; use uucore::InvalidEncodingHandling; #[cfg(windows)] use winapi::shared::minwindef::{DWORD, LPVOID}; @@ -211,64 +213,31 @@ fn get_file_info(path: &PathBuf) -> Option { result } -fn unit_string_to_number(s: &str) -> Option { - let mut offset = 0; - let mut s_chars = s.chars().rev(); - - let (mut ch, multiple) = match s_chars.next() { - Some('B') | Some('b') => ('B', 1000u64), - Some(ch) => (ch, 1024u64), - None => return None, - }; - if ch == 'B' { - ch = s_chars.next()?; - offset += 1; - } - ch = ch.to_ascii_uppercase(); - - let unit = UNITS - .iter() - .rev() - .find(|&&(unit_ch, _)| unit_ch == ch) - .map(|&(_, val)| { - // we found a match, so increment offset - offset += 1; - val - }) - .or_else(|| if multiple == 1024 { Some(0) } else { None })?; - - let number = s[..s.len() - offset].parse::().ok()?; - - Some(number * multiple.pow(unit)) -} - -fn translate_to_pure_number(s: &Option<&str>) -> Option { - match *s { - Some(ref s) => unit_string_to_number(s), - None => None, - } -} - -fn read_block_size(s: Option<&str>) -> u64 { - match translate_to_pure_number(&s) { - Some(v) => v, - None => { - if let Some(value) = s { - show_error!("invalid --block-size argument '{}'", value); - }; - - for env_var in &["DU_BLOCK_SIZE", "BLOCK_SIZE", "BLOCKSIZE"] { - let env_size = env::var(env_var).ok(); - if let Some(quantity) = translate_to_pure_number(&env_size.as_deref()) { - return quantity; +fn read_block_size(s: Option<&str>) -> usize { + if let Some(size_arg) = s { + match parse_size(size_arg) { + Ok(v) => v, + Err(e) => match e { + ParseSizeError::ParseFailure(_) => { + crash!(1, "invalid suffix in --block-size argument '{}'", size_arg) + } + ParseSizeError::SizeTooBig(_) => { + crash!(1, "--block-size argument '{}' too large", size_arg) + } + }, + } + } else { + for env_var in &["DU_BLOCK_SIZE", "BLOCK_SIZE", "BLOCKSIZE"] { + if let Ok(env_size) = env::var(env_var) { + if let Ok(v) = parse_size(&env_size) { + return v; } } - - if env::var("POSIXLY_CORRECT").is_ok() { - 512 - } else { - 1024 - } + } + if env::var("POSIXLY_CORRECT").is_ok() { + 512 + } else { + 1024 } } } @@ -595,7 +564,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } }; - let block_size = read_block_size(matches.value_of(options::BLOCK_SIZE)); + let block_size = u64::try_from(read_block_size(matches.value_of(options::BLOCK_SIZE))).unwrap(); let multiplier: u64 = if matches.is_present(options::SI) { 1000 @@ -733,26 +702,12 @@ mod test_du { #[allow(unused_imports)] use super::*; - #[test] - fn test_translate_to_pure_number() { - let test_data = [ - (Some("10".to_string()), Some(10)), - (Some("10K".to_string()), Some(10 * 1024)), - (Some("5M".to_string()), Some(5 * 1024 * 1024)), - (Some("900KB".to_string()), Some(900 * 1000)), - (Some("BAD_STRING".to_string()), None), - ]; - for it in test_data.iter() { - assert_eq!(translate_to_pure_number(&it.0.as_deref()), it.1); - } - } - #[test] fn test_read_block_size() { let test_data = [ - (Some("10".to_string()), 10), + (Some("1024".to_string()), 1024), + (Some("K".to_string()), 1024), (None, 1024), - (Some("BAD_STRING".to_string()), 1024), ]; for it in test_data.iter() { assert_eq!(read_block_size(it.0.as_deref()), it.1); diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index c5d262c3b..a8a3049f7 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -71,6 +71,23 @@ fn _du_basics_subdir(s: &str) { } } +#[test] +fn test_du_invalid_size() { + new_ucmd!() + .arg("--block-size=1fb4t") + .arg("/tmp") + .fails() + .code_is(1) + .stderr_only("du: invalid suffix in --block-size argument '1fb4t'"); + #[cfg(not(target_pointer_width = "128"))] + new_ucmd!() + .arg("--block-size=1Y") + .arg("/tmp") + .fails() + .code_is(1) + .stderr_only("du: --block-size argument '1Y' too large"); +} + #[test] fn test_du_basics_bad_name() { new_ucmd!() From 00c02505a1ddf95175332ecc0cdee5adac68c327 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Mon, 31 May 2021 08:11:06 -0500 Subject: [PATCH 0776/1135] refactor/more ~ polish spelling (comments, names, and exceptions) --- src/uu/more/src/more.rs | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index c4a13aa1b..482c5491d 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -5,7 +5,7 @@ // * For the full copyright and license information, please view the LICENSE file // * that was distributed with this source code. -// spell-checker:ignore (ToDO) lflag ICANON tcgetattr tcsetattr TCSADRAIN +// spell-checker:ignore (methods) isnt #[macro_use] extern crate uucore; @@ -100,7 +100,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::LINES) .value_name("number") .takes_value(true) - .help("The number of lines per screenful"), + .help("The number of lines per screen full"), ) .arg( Arg::with_name(options::NUMBER) @@ -135,30 +135,27 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("Path to the files to be read"), ) .get_matches_from(args); - + let mut buff = String::new(); - if let Some(filenames) = matches.values_of(options::FILES) { + if let Some(files) = matches.values_of(options::FILES) { let mut stdout = setup_term(); - let length = filenames.len(); - for (idx, fname) in filenames.enumerate() { - let fname = Path::new(fname); - if fname.is_dir() { + let length = files.len(); + for (idx, file) in files.enumerate() { + let file = Path::new(file); + if file.is_dir() { terminal::disable_raw_mode().unwrap(); - show_usage_error!("'{}' is a directory.", fname.display()); + show_usage_error!("'{}' is a directory.", file.display()); return 1; } - if !fname.exists() { + if !file.exists() { terminal::disable_raw_mode().unwrap(); - show_error!( - "cannot open {}: No such file or directory", - fname.display() - ); + show_error!("cannot open {}: No such file or directory", file.display()); return 1; } if length > 1 { - buff.push_str(&MULTI_FILE_TOP_PROMPT.replace("{}", fname.to_str().unwrap())); + buff.push_str(&MULTI_FILE_TOP_PROMPT.replace("{}", file.to_str().unwrap())); } - let mut reader = BufReader::new(File::open(fname).unwrap()); + let mut reader = BufReader::new(File::open(file).unwrap()); reader.read_to_string(&mut buff).unwrap(); let is_last = idx + 1 == length; more(&buff, &mut stdout, is_last); @@ -220,7 +217,7 @@ fn more(buff: &str, mut stdout: &mut Stdout, is_last: bool) { ); // Specifies whether we have reached the end of the file and should - // return on the next keypress. However, we immediately return when + // return on the next key press. However, we immediately return when // this is the last file. let mut to_be_done = false; if lines_left == 0 && is_last { @@ -230,7 +227,7 @@ fn more(buff: &str, mut stdout: &mut Stdout, is_last: bool) { to_be_done = true; } } - + loop { if event::poll(Duration::from_millis(10)).unwrap() { match event::read().unwrap() { @@ -254,7 +251,6 @@ fn more(buff: &str, mut stdout: &mut Stdout, is_last: bool) { modifiers: KeyModifiers::NONE, }) => { upper_mark = upper_mark.saturating_add(rows.saturating_sub(1)); - } Event::Key(KeyEvent { code: KeyCode::Up, @@ -275,7 +271,7 @@ fn more(buff: &str, mut stdout: &mut Stdout, is_last: bool) { if lines_left == 0 { if to_be_done || is_last { - return + return; } to_be_done = true; } From 5079972ba674ede5517cab8cc88c17ccb18152a6 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 20:41:53 -0500 Subject: [PATCH 0777/1135] refactor/nl ~ polish spelling (comments, names, and exceptions) --- src/uu/nl/src/helper.rs | 4 ++-- src/uu/nl/src/nl.rs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/uu/nl/src/helper.rs b/src/uu/nl/src/helper.rs index e31477c62..562cdeb93 100644 --- a/src/uu/nl/src/helper.rs +++ b/src/uu/nl/src/helper.rs @@ -29,7 +29,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> // This vector holds error messages encountered. let mut errs: Vec = vec![]; settings.renumber = !opts.is_present(options::NO_RENUMBER); - match opts.value_of(options::NUMER_SEPARATOR) { + match opts.value_of(options::NUMBER_SEPARATOR) { None => {} Some(val) => { settings.number_separator = val.to_owned(); @@ -118,7 +118,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> } } } - match opts.value_of(options::STARTING_LINE_NUMER) { + match opts.value_of(options::STARTING_LINE_NUMBER) { None => {} Some(val) => { let conv: Option = val.parse().ok(); diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 7c5f01811..69adbed41 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -79,8 +79,8 @@ pub mod options { pub const JOIN_BLANK_LINES: &str = "join-blank-lines"; pub const NUMBER_FORMAT: &str = "number-format"; pub const NO_RENUMBER: &str = "no-renumber"; - pub const NUMER_SEPARATOR: &str = "number-separator"; - pub const STARTING_LINE_NUMER: &str = "starting-line-number"; + pub const NUMBER_SEPARATOR: &str = "number-separator"; + pub const STARTING_LINE_NUMBER: &str = "starting-line-number"; pub const NUMBER_WIDTH: &str = "number-width"; } @@ -150,16 +150,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("do not reset line numbers at logical pages"), ) .arg( - Arg::with_name(options::NUMER_SEPARATOR) + Arg::with_name(options::NUMBER_SEPARATOR) .short("s") - .long(options::NUMER_SEPARATOR) + .long(options::NUMBER_SEPARATOR) .help("add STRING after (possible) line number") .value_name("STRING"), ) .arg( - Arg::with_name(options::STARTING_LINE_NUMER) + Arg::with_name(options::STARTING_LINE_NUMBER) .short("v") - .long(options::STARTING_LINE_NUMER) + .long(options::STARTING_LINE_NUMBER) .help("first line number on each logical page") .value_name("NUMBER"), ) From aa385cf23cb30cdd1a0ac943b30d1beede94260a Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 18:33:37 -0500 Subject: [PATCH 0778/1135] refactor/od ~ polish spelling (comments, names, and exceptions) --- src/uu/od/src/od.rs | 3 +- src/uu/od/src/prn_char.rs | 20 +++++------ src/uu/od/src/prn_int.rs | 76 +++++++++++++++++++-------------------- 3 files changed, 48 insertions(+), 51 deletions(-) diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 571ca543d..7359047b2 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -5,6 +5,7 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. +// spell-checker:ignore (clap) DontDelimitTrailingValues // spell-checker:ignore (ToDO) formatteriteminfo inputdecoder inputoffset mockstream nrofbytes partialreader odfunc multifile exitcode #[macro_use] @@ -455,7 +456,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ]); let clap_matches = clap_opts - .clone() // Clone to reuse clap_otps to print help + .clone() // Clone to reuse clap_opts to print help .get_matches_from(args.clone()); if clap_matches.is_present(options::VERSION) { diff --git a/src/uu/od/src/prn_char.rs b/src/uu/od/src/prn_char.rs index cbbb370ce..742229dd7 100644 --- a/src/uu/od/src/prn_char.rs +++ b/src/uu/od/src/prn_char.rs @@ -1,5 +1,3 @@ -// spell-checker:ignore (ToDO) CHRS itembytes MUTF - use std::str::from_utf8; use crate::formatteriteminfo::*; @@ -16,7 +14,7 @@ pub static FORMAT_ITEM_C: FormatterItemInfo = FormatterItemInfo { formatter: FormatWriter::MultibyteWriter(format_item_c), }; -static A_CHRS: [&str; 128] = [ +static A_CHARS: [&str; 128] = [ "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", "bs", "ht", "nl", "vt", "ff", "cr", "so", "si", "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb", "can", "em", "sub", "esc", "fs", "gs", "rs", "us", "sp", "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-", @@ -28,12 +26,12 @@ static A_CHRS: [&str; 128] = [ ]; fn format_item_a(p: u64) -> String { - // itembytes == 1 + // item-bytes == 1 let b = (p & 0x7f) as u8; - format!("{:>4}", A_CHRS.get(b as usize).unwrap_or(&"??")) + format!("{:>4}", A_CHARS.get(b as usize).unwrap_or(&"??")) } -static C_CHRS: [&str; 128] = [ +static C_CHARS: [&str; 128] = [ "\\0", "001", "002", "003", "004", "005", "006", "\\a", "\\b", "\\t", "\\n", "\\v", "\\f", "\\r", "016", "017", "020", "021", "022", "023", "024", "025", "026", "027", "030", "031", "032", "033", "034", "035", "036", "037", " ", "!", "\"", "#", "$", "%", "&", "'", "(", ")", @@ -45,11 +43,11 @@ static C_CHRS: [&str; 128] = [ ]; fn format_item_c(bytes: &[u8]) -> String { - // itembytes == 1 + // item-bytes == 1 let b = bytes[0]; if b & 0x80 == 0x00 { - match C_CHRS.get(b as usize) { + match C_CHARS.get(b as usize) { Some(s) => format!("{:>4}", s), None => format!("{:>4}", b), } @@ -86,7 +84,7 @@ pub fn format_ascii_dump(bytes: &[u8]) -> String { result.push('>'); for c in bytes.iter() { if *c >= 0x20 && *c <= 0x7e { - result.push_str(C_CHRS[*c as usize]); + result.push_str(C_CHARS[*c as usize]); } else { result.push('.'); } @@ -136,12 +134,12 @@ fn test_format_item_c() { format_item_c(&[0xf0, 0x9f, 0x92, 0x96, 0x21]) ); - assert_eq!(" 300", format_item_c(&[0xc0, 0x80])); // invalid utf-8 (MUTF-8 null) + assert_eq!(" 300", format_item_c(&[0xc0, 0x80])); // invalid utf-8 (UTF-8 null) assert_eq!(" 301", format_item_c(&[0xc1, 0xa1])); // invalid utf-8 assert_eq!(" 303", format_item_c(&[0xc3, 0xc3])); // invalid utf-8 assert_eq!(" 360", format_item_c(&[0xf0, 0x82, 0x82, 0xac])); // invalid utf-8 (overlong) assert_eq!(" 360", format_item_c(&[0xf0, 0x9f, 0x92])); // invalid utf-8 (missing octet) - assert_eq!(" \u{10FFFD}", format_item_c(&[0xf4, 0x8f, 0xbf, 0xbd])); // largest valid utf-8 + assert_eq!(" \u{10FFFD}", format_item_c(&[0xf4, 0x8f, 0xbf, 0xbd])); // largest valid utf-8 // spell-checker:ignore 10FFFD FFFD assert_eq!(" 364", format_item_c(&[0xf4, 0x90, 0x00, 0x00])); // invalid utf-8 assert_eq!(" 365", format_item_c(&[0xf5, 0x80, 0x80, 0x80])); // invalid utf-8 assert_eq!(" 377", format_item_c(&[0xff])); // invalid utf-8 diff --git a/src/uu/od/src/prn_int.rs b/src/uu/od/src/prn_int.rs index b8397b01b..5e31da9dd 100644 --- a/src/uu/od/src/prn_int.rs +++ b/src/uu/od/src/prn_int.rs @@ -1,5 +1,3 @@ -// spell-checker:ignore (ToDO) itembytes - use crate::formatteriteminfo::*; /// format string to print octal using `int_writer_unsigned` @@ -60,9 +58,9 @@ macro_rules! int_writer_signed { }; } -/// Extends a signed number in `item` of `itembytes` bytes into a (signed) i64 -fn sign_extend(item: u64, itembytes: usize) -> i64 { - let shift = 64 - itembytes * 8; +/// Extends a signed number in `item` of `item_bytes` bytes into a (signed) i64 +fn sign_extend(item: u64, item_bytes: usize) -> i64 { + let shift = 64 - item_bytes * 8; (item << shift) as i64 >> shift } @@ -89,46 +87,46 @@ int_writer_signed!(FORMAT_ITEM_DEC64S, 8, 21, format_item_dec_s64, DEC!()); // m #[test] fn test_sign_extend() { assert_eq!( - 0xffffffffffffff80u64 as i64, - sign_extend(0x0000000000000080, 1) + 0xffff_ffff_ffff_ff80u64 as i64, + sign_extend(0x0000_0000_0000_0080, 1) ); assert_eq!( - 0xffffffffffff8000u64 as i64, - sign_extend(0x0000000000008000, 2) + 0xffff_ffff_ffff_8000u64 as i64, + sign_extend(0x0000_0000_0000_8000, 2) ); assert_eq!( - 0xffffffffff800000u64 as i64, - sign_extend(0x0000000000800000, 3) + 0xffff_ffff_ff80_0000u64 as i64, + sign_extend(0x0000_0000_0080_0000, 3) ); assert_eq!( - 0xffffffff80000000u64 as i64, - sign_extend(0x0000000080000000, 4) + 0xffff_ffff_8000_0000u64 as i64, + sign_extend(0x0000_0000_8000_0000, 4) ); assert_eq!( - 0xffffff8000000000u64 as i64, - sign_extend(0x0000008000000000, 5) + 0xffff_ff80_0000_0000u64 as i64, + sign_extend(0x0000_0080_0000_0000, 5) ); assert_eq!( - 0xffff800000000000u64 as i64, - sign_extend(0x0000800000000000, 6) + 0xffff_8000_0000_0000u64 as i64, + sign_extend(0x0000_8000_0000_0000, 6) ); assert_eq!( - 0xff80000000000000u64 as i64, - sign_extend(0x0080000000000000, 7) + 0xff80_0000_0000_0000u64 as i64, + sign_extend(0x0080_0000_0000_0000, 7) ); assert_eq!( - 0x8000000000000000u64 as i64, - sign_extend(0x8000000000000000, 8) + 0x8000_0000_0000_0000u64 as i64, + sign_extend(0x8000_0000_0000_0000, 8) ); - assert_eq!(0x000000000000007f, sign_extend(0x000000000000007f, 1)); - assert_eq!(0x0000000000007fff, sign_extend(0x0000000000007fff, 2)); - assert_eq!(0x00000000007fffff, sign_extend(0x00000000007fffff, 3)); - assert_eq!(0x000000007fffffff, sign_extend(0x000000007fffffff, 4)); - assert_eq!(0x0000007fffffffff, sign_extend(0x0000007fffffffff, 5)); - assert_eq!(0x00007fffffffffff, sign_extend(0x00007fffffffffff, 6)); - assert_eq!(0x007fffffffffffff, sign_extend(0x007fffffffffffff, 7)); - assert_eq!(0x7fffffffffffffff, sign_extend(0x7fffffffffffffff, 8)); + assert_eq!(0x0000_0000_0000_007f, sign_extend(0x0000_0000_0000_007f, 1)); + assert_eq!(0x0000_0000_0000_7fff, sign_extend(0x0000_0000_0000_7fff, 2)); + assert_eq!(0x0000_0000_007f_ffff, sign_extend(0x0000_0000_007f_ffff, 3)); + assert_eq!(0x0000_0000_7fff_ffff, sign_extend(0x0000_0000_7fff_ffff, 4)); + assert_eq!(0x0000_007f_ffff_ffff, sign_extend(0x0000_007f_ffff_ffff, 5)); + assert_eq!(0x0000_7fff_ffff_ffff, sign_extend(0x0000_7fff_ffff_ffff, 6)); + assert_eq!(0x007f_ffff_ffff_ffff, sign_extend(0x007f_ffff_ffff_ffff, 7)); + assert_eq!(0x7fff_ffff_ffff_ffff, sign_extend(0x7fff_ffff_ffff_ffff, 8)); } #[test] @@ -138,11 +136,11 @@ fn test_format_item_oct() { assert_eq!(" 000000", format_item_oct16(0)); assert_eq!(" 177777", format_item_oct16(0xffff)); assert_eq!(" 00000000000", format_item_oct32(0)); - assert_eq!(" 37777777777", format_item_oct32(0xffffffff)); + assert_eq!(" 37777777777", format_item_oct32(0xffff_ffff)); assert_eq!(" 0000000000000000000000", format_item_oct64(0)); assert_eq!( " 1777777777777777777777", - format_item_oct64(0xffffffffffffffff) + format_item_oct64(0xffff_ffff_ffff_ffff) ); } @@ -153,9 +151,9 @@ fn test_format_item_hex() { assert_eq!(" 0000", format_item_hex16(0)); assert_eq!(" ffff", format_item_hex16(0xffff)); assert_eq!(" 00000000", format_item_hex32(0)); - assert_eq!(" ffffffff", format_item_hex32(0xffffffff)); + assert_eq!(" ffffffff", format_item_hex32(0xffff_ffff)); assert_eq!(" 0000000000000000", format_item_hex64(0)); - assert_eq!(" ffffffffffffffff", format_item_hex64(0xffffffffffffffff)); + assert_eq!(" ffffffffffffffff", format_item_hex64(0xffff_ffff_ffff_ffff)); } #[test] @@ -165,11 +163,11 @@ fn test_format_item_dec_u() { assert_eq!(" 0", format_item_dec_u16(0)); assert_eq!(" 65535", format_item_dec_u16(0xffff)); assert_eq!(" 0", format_item_dec_u32(0)); - assert_eq!(" 4294967295", format_item_dec_u32(0xffffffff)); + assert_eq!(" 4294967295", format_item_dec_u32(0xffff_ffff)); assert_eq!(" 0", format_item_dec_u64(0)); assert_eq!( " 18446744073709551615", - format_item_dec_u64(0xffffffffffffffff) + format_item_dec_u64(0xffff_ffff_ffff_ffff) ); } @@ -182,15 +180,15 @@ fn test_format_item_dec_s() { assert_eq!(" 32767", format_item_dec_s16(0x7fff)); assert_eq!(" -32768", format_item_dec_s16(0x8000)); assert_eq!(" 0", format_item_dec_s32(0)); - assert_eq!(" 2147483647", format_item_dec_s32(0x7fffffff)); - assert_eq!(" -2147483648", format_item_dec_s32(0x80000000)); + assert_eq!(" 2147483647", format_item_dec_s32(0x7fff_ffff)); + assert_eq!(" -2147483648", format_item_dec_s32(0x8000_0000)); assert_eq!(" 0", format_item_dec_s64(0)); assert_eq!( " 9223372036854775807", - format_item_dec_s64(0x7fffffffffffffff) + format_item_dec_s64(0x7fff_ffff_ffff_ffff) ); assert_eq!( " -9223372036854775808", - format_item_dec_s64(0x8000000000000000) + format_item_dec_s64(0x8000_0000_0000_0000) ); } From 324605c78c08c83d03e7b04e7734441d93ae453b Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 18:34:39 -0500 Subject: [PATCH 0779/1135] refactor/printf ~ polish spelling (comments, names, and exceptions) --- .../src/tokenize/num_format/format_field.rs | 2 +- .../src/tokenize/num_format/formatter.rs | 5 +- .../num_format/formatters/base_conv/mod.rs | 2 +- .../num_format/formatters/base_conv/tests.rs | 4 +- .../formatters/cninetyninehexfloatf.rs | 29 ++++---- .../tokenize/num_format/formatters/decf.rs | 30 ++++----- .../num_format/formatters/float_common.rs | 29 ++++---- .../tokenize/num_format/formatters/floatf.rs | 13 ++-- .../tokenize/num_format/formatters/intf.rs | 67 ++++++++++--------- .../src/tokenize/num_format/formatters/mod.rs | 2 +- .../tokenize/num_format/formatters/scif.rs | 12 ++-- .../src/tokenize/num_format/num_format.rs | 52 +++++++------- src/uu/printf/src/tokenize/sub.rs | 8 +-- 13 files changed, 130 insertions(+), 125 deletions(-) diff --git a/src/uu/printf/src/tokenize/num_format/format_field.rs b/src/uu/printf/src/tokenize/num_format/format_field.rs index 68786e815..02998cde5 100644 --- a/src/uu/printf/src/tokenize/num_format/format_field.rs +++ b/src/uu/printf/src/tokenize/num_format/format_field.rs @@ -1,4 +1,4 @@ -// spell-checker:ignore (ToDO) conv intf strf floatf scif charf fieldtype vals subparser unescaping submodule Cninety inprefix hexifying glibc floatnum rten rhex arrnum fprim interp +// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety //! Primitives used by Sub Tokenizer //! and num_format modules diff --git a/src/uu/printf/src/tokenize/num_format/formatter.rs b/src/uu/printf/src/tokenize/num_format/formatter.rs index 35faff2a9..9fd5954ed 100644 --- a/src/uu/printf/src/tokenize/num_format/formatter.rs +++ b/src/uu/printf/src/tokenize/num_format/formatter.rs @@ -1,4 +1,3 @@ -// spell-checker:ignore (ToDO) inprefix for conv //! Primitives used by num_format and sub_modules. //! never dealt with above (e.g. Sub Tokenizer never uses these) @@ -41,7 +40,7 @@ pub enum Base { // information from the beginning of a numeric argument // the precedes the beginning of a numeric value -pub struct InPrefix { +pub struct InitialPrefix { pub radix_in: Base, pub sign: i8, pub offset: usize, @@ -54,7 +53,7 @@ pub trait Formatter { fn get_primitive( &self, field: &FormatField, - inprefix: &InPrefix, + in_prefix: &InitialPrefix, str_in: &str, ) -> Option; // return a string from a FormatPrimitive, diff --git a/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs b/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs index 7d1d805c6..a20f03a95 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/base_conv/mod.rs @@ -1,4 +1,4 @@ -// spell-checker:ignore (ToDO) arrnum mult basenum bufferval refd vals arrfloat conv intermed addl +// spell-checker:ignore (ToDO) arrnum arr_num mult basenum bufferval refd vals arrfloat conv intermed addl pub fn arrnum_int_mult(arr_num: &[u8], basenum: u8, base_ten_int_fact: u8) -> Vec { let mut carry: u16 = 0; diff --git a/src/uu/printf/src/tokenize/num_format/formatters/base_conv/tests.rs b/src/uu/printf/src/tokenize/num_format/formatters/base_conv/tests.rs index fcac4392e..7945d41ac 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/base_conv/tests.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/base_conv/tests.rs @@ -1,4 +1,4 @@ -// spell-checker:ignore (ToDO) conv arrnum mult shortcircuit +// spell-checker:ignore (ToDO) arrnum mult #[cfg(test)] use super::*; @@ -29,7 +29,7 @@ fn test_arrnum_int_non_base_10() { } #[test] -fn test_arrnum_int_div_shortcircuit() { +fn test_arrnum_int_div_short_circuit() { // ( let arrnum: Vec = vec![5, 5, 5, 5, 0]; let base_num = 10; diff --git a/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs b/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs index 870e64712..104e55ef3 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs @@ -1,8 +1,9 @@ -// spell-checker:ignore (ToDO) conv intf strf floatf scif charf fieldtype vals subparser unescaping submodule Cninety inprefix hexifying glibc floatnum rten rhex arrnum +// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety +// spell-checker:ignore (ToDO) arrnum //! formatter for %a %F C99 Hex-floating-point subs use super::super::format_field::FormatField; -use super::super::formatter::{FormatPrimitive, Formatter, InPrefix}; +use super::super::formatter::{FormatPrimitive, Formatter, InitialPrefix}; use super::base_conv; use super::base_conv::RadixDef; use super::float_common::{primitive_to_str_common, FloatAnalysis}; @@ -20,15 +21,15 @@ impl Formatter for CninetyNineHexFloatf { fn get_primitive( &self, field: &FormatField, - inprefix: &InPrefix, + initial_prefix: &InitialPrefix, str_in: &str, ) -> Option { let second_field = field.second_field.unwrap_or(6) + 1; let analysis = - FloatAnalysis::analyze(&str_in, inprefix, Some(second_field as usize), None, true); + FloatAnalysis::analyze(&str_in, initial_prefix, Some(second_field as usize), None, true); let f = get_primitive_hex( - inprefix, - &str_in[inprefix.offset..], + initial_prefix, + &str_in[initial_prefix.offset..], &analysis, second_field as usize, *field.field_char == 'A', @@ -44,13 +45,13 @@ impl Formatter for CninetyNineHexFloatf { // on the todo list is to have a trait for get_primitive that is implemented by each float formatter and can override a default. when that happens we can take the parts of get_primitive_dec specific to dec and spin them out to their own functions that can be overridden. fn get_primitive_hex( - inprefix: &InPrefix, + initial_prefix: &InitialPrefix, _str_in: &str, _analysis: &FloatAnalysis, _last_dec_place: usize, capitalized: bool, ) -> FormatPrimitive { - let prefix = Some(String::from(if inprefix.sign == -1 { "-0x" } else { "0x" })); + let prefix = Some(String::from(if initial_prefix.sign == -1 { "-0x" } else { "0x" })); // TODO actual conversion, make sure to get back mantissa. // for hex to hex, it's really just a matter of moving the @@ -63,7 +64,7 @@ fn get_primitive_hex( // the difficult part of this (arrnum_int_div_step) is already implemented. // the hex float name may be a bit misleading in terms of how to go about the - // conversion. The best way to do it is to just convert the floatnum + // conversion. The best way to do it is to just convert the float number // directly to base 2 and then at the end translate back to hex. let mantissa = 0; let suffix = Some({ @@ -82,15 +83,15 @@ fn get_primitive_hex( } fn to_hex(src: &str, before_decimal: bool) -> String { - let rten = base_conv::RadixTen; - let rhex = base_conv::RadixHex; + let radix_ten = base_conv::RadixTen; + let radix_hex = base_conv::RadixHex; if before_decimal { - base_conv::base_conv_str(src, &rten, &rhex) + base_conv::base_conv_str(src, &radix_ten, &radix_hex) } else { - let as_arrnum_ten = base_conv::str_to_arrnum(src, &rten); + let as_arrnum_ten = base_conv::str_to_arrnum(src, &radix_ten); let s = format!( "{}", - base_conv::base_conv_float(&as_arrnum_ten, rten.get_max(), rhex.get_max()) + base_conv::base_conv_float(&as_arrnum_ten, radix_ten.get_max(), radix_hex.get_max()) ); if s.len() > 2 { String::from(&s[2..]) diff --git a/src/uu/printf/src/tokenize/num_format/formatters/decf.rs b/src/uu/printf/src/tokenize/num_format/formatters/decf.rs index 448771f22..4d729f0ce 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/decf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/decf.rs @@ -1,22 +1,22 @@ -// spell-checker:ignore (ToDO) conv intf strf floatf scif charf fieldtype vals subparser unescaping submodule Cninety inprefix hexifying glibc floatnum rten rhex arrnum fprim interp +// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety //! formatter for %g %G decimal subs use super::super::format_field::FormatField; -use super::super::formatter::{FormatPrimitive, Formatter, InPrefix}; +use super::super::formatter::{FormatPrimitive, Formatter, InitialPrefix}; use super::float_common::{get_primitive_dec, primitive_to_str_common, FloatAnalysis}; -fn get_len_fprim(fprim: &FormatPrimitive) -> usize { +fn get_len_fmt_primitive(fmt: &FormatPrimitive) -> usize { let mut len = 0; - if let Some(ref s) = fprim.prefix { + if let Some(ref s) = fmt.prefix { len += s.len(); } - if let Some(ref s) = fprim.pre_decimal { + if let Some(ref s) = fmt.pre_decimal { len += s.len(); } - if let Some(ref s) = fprim.post_decimal { + if let Some(ref s) = fmt.post_decimal { len += s.len(); } - if let Some(ref s) = fprim.suffix { + if let Some(ref s) = fmt.suffix { len += s.len(); } len @@ -33,22 +33,22 @@ impl Formatter for Decf { fn get_primitive( &self, field: &FormatField, - inprefix: &InPrefix, + initial_prefix: &InitialPrefix, str_in: &str, ) -> Option { let second_field = field.second_field.unwrap_or(6) + 1; - // default to scif interp. so as to not truncate input vals + // default to scif interpretation so as to not truncate input vals // (that would be displayed in scif) based on relation to decimal place let analysis = FloatAnalysis::analyze( str_in, - inprefix, + initial_prefix, Some(second_field as usize + 1), None, false, ); let mut f_sci = get_primitive_dec( - inprefix, - &str_in[inprefix.offset..], + initial_prefix, + &str_in[initial_prefix.offset..], &analysis, second_field as usize, Some(*field.field_char == 'G'), @@ -70,13 +70,13 @@ impl Formatter for Decf { } } let f_fl = get_primitive_dec( - inprefix, - &str_in[inprefix.offset..], + initial_prefix, + &str_in[initial_prefix.offset..], &analysis, second_field as usize, None, ); - Some(if get_len_fprim(&f_fl) >= get_len_fprim(&f_sci) { + Some(if get_len_fmt_primitive(&f_fl) >= get_len_fmt_primitive(&f_sci) { f_sci } else { f_fl diff --git a/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs b/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs index a107078ae..4cbb496e4 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs @@ -1,7 +1,8 @@ -// spell-checker:ignore (ToDO) conv intf strf floatf scif charf fieldtype vals subparser unescaping submodule Cninety inprefix hexifying glibc floatnum rten rhex arrnum +// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety +// spell-checker:ignore (ToDO) arrnum use super::super::format_field::FormatField; -use super::super::formatter::{get_it_at, warn_incomplete_conv, Base, FormatPrimitive, InPrefix}; +use super::super::formatter::{get_it_at, warn_incomplete_conv, Base, FormatPrimitive, InitialPrefix}; use super::base_conv; use super::base_conv::RadixDef; @@ -39,7 +40,7 @@ fn has_enough_digits( impl FloatAnalysis { pub fn analyze( str_in: &str, - inprefix: &InPrefix, + initial_prefix: &InitialPrefix, max_sd_opt: Option, max_after_dec_opt: Option, hex_output: bool, @@ -47,13 +48,13 @@ impl FloatAnalysis { // this fn assumes // the input string // has no leading spaces or 0s - let str_it = get_it_at(inprefix.offset, str_in); + let str_it = get_it_at(initial_prefix.offset, str_in); let mut ret = FloatAnalysis { len_important: 0, decimal_pos: None, follow: None, }; - let hex_input = match inprefix.radix_in { + let hex_input = match initial_prefix.radix_in { Base::Hex => true, Base::Ten => false, Base::Octal => { @@ -126,15 +127,15 @@ impl FloatAnalysis { } fn de_hex(src: &str, before_decimal: bool) -> String { - let rten = base_conv::RadixTen; - let rhex = base_conv::RadixHex; + let radix_ten = base_conv::RadixTen; + let radix_hex = base_conv::RadixHex; if before_decimal { - base_conv::base_conv_str(src, &rhex, &rten) + base_conv::base_conv_str(src, &radix_hex, &radix_ten) } else { - let as_arrnum_hex = base_conv::str_to_arrnum(src, &rhex); + let as_arrnum_hex = base_conv::str_to_arrnum(src, &radix_hex); let s = format!( "{}", - base_conv::base_conv_float(&as_arrnum_hex, rhex.get_max(), rten.get_max()) + base_conv::base_conv_float(&as_arrnum_hex, radix_hex.get_max(), radix_ten.get_max()) ); if s.len() > 2 { String::from(&s[2..]) @@ -200,7 +201,7 @@ fn round_terminal_digit( } pub fn get_primitive_dec( - inprefix: &InPrefix, + initial_prefix: &InitialPrefix, str_in: &str, analysis: &FloatAnalysis, last_dec_place: usize, @@ -209,7 +210,7 @@ pub fn get_primitive_dec( let mut f: FormatPrimitive = Default::default(); // add negative sign section - if inprefix.sign == -1 { + if initial_prefix.sign == -1 { f.prefix = Some(String::from("-")); } @@ -223,8 +224,8 @@ pub fn get_primitive_dec( if first_segment_raw.is_empty() { first_segment_raw = "0"; } - // convert to string, de_hexifying if input is in hex. - let (first_segment, second_segment) = match inprefix.radix_in { + // convert to string, de_hexifying if input is in hex // spell-checker:disable-line + let (first_segment, second_segment) = match initial_prefix.radix_in { Base::Hex => ( de_hex(first_segment_raw, true), de_hex(second_segment_raw, false), diff --git a/src/uu/printf/src/tokenize/num_format/formatters/floatf.rs b/src/uu/printf/src/tokenize/num_format/formatters/floatf.rs index b3de2f98a..79bb51fb8 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/floatf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/floatf.rs @@ -1,8 +1,9 @@ -// spell-checker:ignore (ToDO) floatf inprefix +// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety +// spell-checker:ignore (ToDO) arrnum //! formatter for %f %F common-notation floating-point subs use super::super::format_field::FormatField; -use super::super::formatter::{FormatPrimitive, Formatter, InPrefix}; +use super::super::formatter::{FormatPrimitive, Formatter, InitialPrefix}; use super::float_common::{get_primitive_dec, primitive_to_str_common, FloatAnalysis}; pub struct Floatf; @@ -15,15 +16,15 @@ impl Formatter for Floatf { fn get_primitive( &self, field: &FormatField, - inprefix: &InPrefix, + initial_prefix: &InitialPrefix, str_in: &str, ) -> Option { let second_field = field.second_field.unwrap_or(6) + 1; let analysis = - FloatAnalysis::analyze(&str_in, inprefix, None, Some(second_field as usize), false); + FloatAnalysis::analyze(&str_in, initial_prefix, None, Some(second_field as usize), false); let f = get_primitive_dec( - inprefix, - &str_in[inprefix.offset..], + initial_prefix, + &str_in[initial_prefix.offset..], &analysis, second_field as usize, None, diff --git a/src/uu/printf/src/tokenize/num_format/formatters/intf.rs b/src/uu/printf/src/tokenize/num_format/formatters/intf.rs index 2e4e67047..1e9e25560 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/intf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/intf.rs @@ -1,11 +1,12 @@ -// spell-checker:ignore (ToDO) fchar conv decr inprefix intf ints finalstr +// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety +// spell-checker:ignore (ToDO) arrnum //! formatter for unsigned and signed int subs -//! unsigned ints: %X %x (hex u64) %o (octal u64) %u (base ten u64) -//! signed ints: %i %d (both base ten i64) +//! unsigned int: %X %x (hex u64) %o (octal u64) %u (base ten u64) +//! signed int: %i %d (both base ten i64) use super::super::format_field::FormatField; use super::super::formatter::{ - get_it_at, warn_incomplete_conv, Base, FormatPrimitive, Formatter, InPrefix, + get_it_at, warn_incomplete_conv, Base, FormatPrimitive, Formatter, InitialPrefix, }; use std::i64; use std::u64; @@ -38,19 +39,19 @@ impl Intf { // is_zero: true if number is zero, false otherwise // len_digits: length of digits used to create the int // important, for example, if we run into a non-valid character - fn analyze(str_in: &str, signed_out: bool, inprefix: &InPrefix) -> IntAnalysis { + fn analyze(str_in: &str, signed_out: bool, initial_prefix: &InitialPrefix) -> IntAnalysis { // the maximum number of digits we could conceivably // have before the decimal point without exceeding the // max - let mut str_it = get_it_at(inprefix.offset, str_in); + let mut str_it = get_it_at(initial_prefix.offset, str_in); let max_sd_in = if signed_out { - match inprefix.radix_in { + match initial_prefix.radix_in { Base::Ten => 19, Base::Octal => 21, Base::Hex => 16, } } else { - match inprefix.radix_in { + match initial_prefix.radix_in { Base::Ten => 20, Base::Octal => 22, Base::Hex => 16, @@ -118,13 +119,13 @@ impl Intf { } // get a FormatPrimitive of the maximum value for the field char // and given sign - fn get_max(fchar: char, sign: i8) -> FormatPrimitive { - let mut fmt_prim: FormatPrimitive = Default::default(); - fmt_prim.pre_decimal = Some(String::from(match fchar { + fn get_max(field_char: char, sign: i8) -> FormatPrimitive { + let mut fmt_primitive: FormatPrimitive = Default::default(); + fmt_primitive.pre_decimal = Some(String::from(match field_char { 'd' | 'i' => match sign { 1 => "9223372036854775807", _ => { - fmt_prim.prefix = Some(String::from("-")); + fmt_primitive.prefix = Some(String::from("-")); "9223372036854775808" } }, @@ -132,7 +133,7 @@ impl Intf { 'o' => "1777777777777777777777", /* 'u' | */ _ => "18446744073709551615", })); - fmt_prim + fmt_primitive } // conv_from_segment contract: // 1. takes @@ -149,8 +150,8 @@ impl Intf { // - if the string falls outside bounds: // for i64 output, the int minimum or int max (depending on sign) // for u64 output, the u64 max in the output radix - fn conv_from_segment(segment: &str, radix_in: Base, fchar: char, sign: i8) -> FormatPrimitive { - match fchar { + fn conv_from_segment(segment: &str, radix_in: Base, field_char: char, sign: i8) -> FormatPrimitive { + match field_char { 'i' | 'd' => match i64::from_str_radix(segment, radix_in as u32) { Ok(i) => { let mut fmt_prim: FormatPrimitive = Default::default(); @@ -160,13 +161,13 @@ impl Intf { fmt_prim.pre_decimal = Some(format!("{}", i)); fmt_prim } - Err(_) => Intf::get_max(fchar, sign), + Err(_) => Intf::get_max(field_char, sign), }, _ => match u64::from_str_radix(segment, radix_in as u32) { Ok(u) => { let mut fmt_prim: FormatPrimitive = Default::default(); let u_f = if sign == -1 { u64::MAX - (u - 1) } else { u }; - fmt_prim.pre_decimal = Some(match fchar { + fmt_prim.pre_decimal = Some(match field_char { 'X' => format!("{:X}", u_f), 'x' => format!("{:x}", u_f), 'o' => format!("{:o}", u_f), @@ -174,7 +175,7 @@ impl Intf { }); fmt_prim } - Err(_) => Intf::get_max(fchar, sign), + Err(_) => Intf::get_max(field_char, sign), }, } } @@ -183,17 +184,17 @@ impl Formatter for Intf { fn get_primitive( &self, field: &FormatField, - inprefix: &InPrefix, + initial_prefix: &InitialPrefix, str_in: &str, ) -> Option { - let begin = inprefix.offset; + let begin = initial_prefix.offset; // get information about the string. see Intf::Analyze // def above. let convert_hints = Intf::analyze( str_in, *field.field_char == 'i' || *field.field_char == 'd', - inprefix, + initial_prefix, ); // We always will have a format primitive to return Some(if convert_hints.len_digits == 0 || convert_hints.is_zero { @@ -209,22 +210,22 @@ impl Formatter for Intf { 'x' | 'X' => Base::Hex, /* 'o' | */ _ => Base::Octal, }; - let radix_mismatch = !radix_out.eq(&inprefix.radix_in); - let decr_from_max: bool = inprefix.sign == -1 && *field.field_char != 'i'; + let radix_mismatch = !radix_out.eq(&initial_prefix.radix_in); + let decrease_from_max: bool = initial_prefix.sign == -1 && *field.field_char != 'i'; let end = begin + convert_hints.len_digits as usize; // convert to int if any one of these is true: // - number of digits in int indicates it may be past max // - we're subtracting from the max // - we're converting the base - if convert_hints.check_past_max || decr_from_max || radix_mismatch { + if convert_hints.check_past_max || decrease_from_max || radix_mismatch { // radix of in and out is the same. let segment = String::from(&str_in[begin..end]); Intf::conv_from_segment( &segment, - inprefix.radix_in.clone(), + initial_prefix.radix_in.clone(), *field.field_char, - inprefix.sign, + initial_prefix.sign, ) } else { // otherwise just do a straight string copy. @@ -233,20 +234,20 @@ impl Formatter for Intf { // this is here and not earlier because // zero doesn't get a sign, and conv_from_segment // creates its format primitive separately - if inprefix.sign == -1 && *field.field_char == 'i' { + if initial_prefix.sign == -1 && *field.field_char == 'i' { fmt_prim.prefix = Some(String::from("-")); } fmt_prim.pre_decimal = Some(String::from(&str_in[begin..end])); fmt_prim } } else { - Intf::get_max(*field.field_char, inprefix.sign) + Intf::get_max(*field.field_char, initial_prefix.sign) }) } fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String { - let mut finalstr: String = String::new(); + let mut final_str: String = String::new(); if let Some(ref prefix) = prim.prefix { - finalstr.push_str(&prefix); + final_str.push_str(&prefix); } // integral second fields is zero-padded minimum-width // which gets handled before general minimum-width @@ -256,11 +257,11 @@ impl Formatter for Intf { let mut i = min; let len = pre_decimal.len() as u32; while i > len { - finalstr.push('0'); + final_str.push('0'); i -= 1; } } - finalstr.push_str(&pre_decimal); + final_str.push_str(&pre_decimal); } None => { panic!( @@ -269,6 +270,6 @@ impl Formatter for Intf { ); } } - finalstr + final_str } } diff --git a/src/uu/printf/src/tokenize/num_format/formatters/mod.rs b/src/uu/printf/src/tokenize/num_format/formatters/mod.rs index ccbcdb1e7..e23230071 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/mod.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/mod.rs @@ -1,4 +1,4 @@ -// spell-checker:ignore (ToDO) conv cninetyninehexfloatf floatf intf scif +// spell-checker:ignore (vars) charf cninetyninehexfloatf decf floatf intf scif strf Cninety mod base_conv; pub mod cninetyninehexfloatf; diff --git a/src/uu/printf/src/tokenize/num_format/formatters/scif.rs b/src/uu/printf/src/tokenize/num_format/formatters/scif.rs index ebac1565e..c46c7d423 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/scif.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/scif.rs @@ -1,8 +1,8 @@ -// spell-checker:ignore (ToDO) conv intf strf floatf scif charf fieldtype vals subparser unescaping submodule Cninety inprefix +// spell-checker:ignore (vars) charf cninetyninehexfloatf decf floatf intf scif strf Cninety //! formatter for %e %E scientific notation subs use super::super::format_field::FormatField; -use super::super::formatter::{FormatPrimitive, Formatter, InPrefix}; +use super::super::formatter::{FormatPrimitive, Formatter, InitialPrefix}; use super::float_common::{get_primitive_dec, primitive_to_str_common, FloatAnalysis}; pub struct Scif; @@ -16,20 +16,20 @@ impl Formatter for Scif { fn get_primitive( &self, field: &FormatField, - inprefix: &InPrefix, + initial_prefix: &InitialPrefix, str_in: &str, ) -> Option { let second_field = field.second_field.unwrap_or(6) + 1; let analysis = FloatAnalysis::analyze( str_in, - inprefix, + initial_prefix, Some(second_field as usize + 1), None, false, ); let f = get_primitive_dec( - inprefix, - &str_in[inprefix.offset..], + initial_prefix, + &str_in[initial_prefix.offset..], &analysis, second_field as usize, Some(*field.field_char == 'E'), diff --git a/src/uu/printf/src/tokenize/num_format/num_format.rs b/src/uu/printf/src/tokenize/num_format/num_format.rs index 812f51b5a..a8a60cc57 100644 --- a/src/uu/printf/src/tokenize/num_format/num_format.rs +++ b/src/uu/printf/src/tokenize/num_format/num_format.rs @@ -1,12 +1,14 @@ -// spell-checker:ignore (ToDO) conv intf strf floatf scif charf fieldtype vals subparser unescaping submodule Cninety qchar topchar structs fmtr fchar inprefix devs octals cninetyninehexfloatf +// spell-checker:ignore (vars) charf cninetyninehexfloatf decf floatf intf scif strf Cninety //! handles creating printed output for numeric substitutions +// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety + use std::env; use std::vec::Vec; use super::format_field::{FieldType, FormatField}; -use super::formatter::{Base, FormatPrimitive, Formatter, InPrefix}; +use super::formatter::{Base, FormatPrimitive, Formatter, InitialPrefix}; use super::formatters::cninetyninehexfloatf::CninetyNineHexFloatf; use super::formatters::decf::Decf; use super::formatters::floatf::Floatf; @@ -46,8 +48,8 @@ fn get_provided(str_in_opt: Option<&String>) -> Option { match str_in_opt { Some(str_in) => { let mut byte_it = str_in.bytes(); - if let Some(qchar) = byte_it.next() { - match qchar { + if let Some(ch) = byte_it.next() { + match ch { C_S_QUOTE | C_D_QUOTE => { Some(match byte_it.next() { Some(second_byte) => { @@ -62,7 +64,7 @@ fn get_provided(str_in_opt: Option<&String>) -> Option { } // no byte after quote None => { - let so_far = (qchar as u8 as char).to_string(); + let so_far = (ch as u8 as char).to_string(); warn_expected_numeric(&so_far); 0_u8 } @@ -84,30 +86,30 @@ fn get_provided(str_in_opt: Option<&String>) -> Option { // a base, // and an offset for index after all // initial spacing, sign, base prefix, and leading zeroes -fn get_inprefix(str_in: &str, field_type: &FieldType) -> InPrefix { +fn get_initial_prefix(str_in: &str, field_type: &FieldType) -> InitialPrefix { let mut str_it = str_in.chars(); - let mut ret = InPrefix { + let mut ret = InitialPrefix { radix_in: Base::Ten, sign: 1, offset: 0, }; - let mut topchar = str_it.next(); - // skip spaces and ensure topchar is the first non-space char + let mut top_char = str_it.next(); + // skip spaces and ensure top_char is the first non-space char // (or None if none exists) - while let Some(' ') = topchar { + while let Some(' ') = top_char { ret.offset += 1; - topchar = str_it.next(); + top_char = str_it.next(); } // parse sign - match topchar { + match top_char { Some('+') => { ret.offset += 1; - topchar = str_it.next(); + top_char = str_it.next(); } Some('-') => { ret.sign = -1; ret.offset += 1; - topchar = str_it.next(); + top_char = str_it.next(); } _ => {} } @@ -125,7 +127,7 @@ fn get_inprefix(str_in: &str, field_type: &FieldType) -> InPrefix { // final offset. If the zero could be before // a decimal point we don't move past the zero. let mut is_hex = false; - if Some('0') == topchar { + if Some('0') == top_char { if let Some(base) = str_it.next() { // lead zeroes can only exist in // octal and hex base @@ -152,7 +154,7 @@ fn get_inprefix(str_in: &str, field_type: &FieldType) -> InPrefix { let mut first = true; for ch_zero in str_it { // see notes on offset above: - // this is why the offset for octals and decimals + // this is why the offset for octal and decimal numbers // that reach this branch is 1 even though // they have already eaten the characters '00' // this is also why when hex encounters its @@ -194,21 +196,21 @@ fn get_inprefix(str_in: &str, field_type: &FieldType) -> InPrefix { // if it is a numeric field, passing the field details // and an iterator to the argument pub fn num_format(field: &FormatField, in_str_opt: Option<&String>) -> Option { - let fchar = field.field_char; + let field_char = field.field_char; // num format mainly operates by further delegating to one of // several Formatter structs depending on the field // see formatter.rs for more details // to do switch to static dispatch - let fmtr: Box = match *field.field_type { + let formatter: Box = match *field.field_type { FieldType::Intf => Box::new(Intf::new()), FieldType::Floatf => Box::new(Floatf::new()), FieldType::CninetyNineHexFloatf => Box::new(CninetyNineHexFloatf::new()), FieldType::Scif => Box::new(Scif::new()), FieldType::Decf => Box::new(Decf::new()), _ => { - panic!("asked to do num format with non-num fieldtype"); + panic!("asked to do num format with non-num field type"); } }; let prim_opt= @@ -216,7 +218,7 @@ pub fn num_format(field: &FormatField, in_str_opt: Option<&String>) -> Option { tmp.pre_decimal = Some( format!("{}", provided_num)); @@ -231,11 +233,11 @@ pub fn num_format(field: &FormatField, in_str_opt: Option<&String>) -> Option { let as_str = format!("{}", provided_num); - let inprefix = get_inprefix( + let initial_prefix = get_initial_prefix( &as_str, &field.field_type ); - tmp=fmtr.get_primitive(field, &inprefix, &as_str) + tmp=formatter.get_primitive(field, &initial_prefix, &as_str) .expect("err during default provided num"); }, _ => { @@ -254,14 +256,14 @@ pub fn num_format(field: &FormatField, in_str_opt: Option<&String>) -> Option FieldType::Charf, _ => { // should be unreachable. - println!("Invalid fieldtype"); + println!("Invalid field type"); exit(cli::EXIT_ERR); } }; @@ -130,7 +130,7 @@ impl SubParser { } } fn build_token(parser: SubParser) -> Box { - // not a self method so as to allow move of subparser vals. + // not a self method so as to allow move of sub-parser vals. // return new Sub struct as token let t: Box = Box::new(Sub::new( if parser.min_width_is_asterisk { @@ -354,7 +354,7 @@ impl token::Token for Sub { // field char let pre_min_width_opt: Option = match *field.field_type { // if %s just return arg - // if %b use UnescapedText module's unescaping-fn + // if %b use UnescapedText module's unescape-fn // if %c return first char of arg FieldType::Strf | FieldType::Charf => { match pf_arg { From 13561cb5ae412e9671c6062cc85b67ec7518f310 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 18:35:46 -0500 Subject: [PATCH 0780/1135] refactor/ptx ~ polish spelling (comments, names, and exceptions) --- src/uu/ptx/src/ptx.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index a17f7c810..5b0c35093 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -246,7 +246,7 @@ fn read_input(input_files: &[String], config: &Config) -> FileMap { file_map } -/// Go through every lines in the input files and record each match occurance as a `WordRef`. +/// Go through every lines in the input files and record each match occurrence as a `WordRef`. fn create_word_set(config: &Config, filter: &WordFilter, file_map: &FileMap) -> BTreeSet { let reg = Regex::new(&filter.word_regex).unwrap(); let ref_reg = Regex::new(&config.context_regex).unwrap(); @@ -412,7 +412,7 @@ fn get_output_chunks( 0, ) as usize; - // the tail chunk takes text starting from where the after chunk ends (with whitespaces trimmed). + // the tail chunk takes text starting from where the after chunk ends (with whitespace trimmed). let (tail_beg, _) = trim_idx(all_after, after_end, all_after.len()); // end = begin + max length @@ -493,10 +493,10 @@ fn format_tex_line( output.push_str(&format!("\\{} ", config.macro_name)); let all_before = if config.input_ref { let before = &line[0..word_ref.position]; - let before_start_trimoff = + let before_start_trim_offset = word_ref.position - before.trim_start_matches(reference).trim_start().len(); let before_end_index = before.len(); - &chars_line[before_start_trimoff..cmp::max(before_end_index, before_start_trimoff)] + &chars_line[before_start_trim_offset..cmp::max(before_end_index, before_start_trim_offset)] } else { let before_chars_trim_idx = (0, word_ref.position); &chars_line[before_chars_trim_idx.0..before_chars_trim_idx.1] @@ -536,10 +536,10 @@ fn format_roff_line( output.push_str(&format!(".{}", config.macro_name)); let all_before = if config.input_ref { let before = &line[0..word_ref.position]; - let before_start_trimoff = + let before_start_trim_offset = word_ref.position - before.trim_start_matches(reference).trim_start().len(); let before_end_index = before.len(); - &chars_line[before_start_trimoff..cmp::max(before_end_index, before_start_trimoff)] + &chars_line[before_start_trim_offset..cmp::max(before_end_index, before_start_trim_offset)] } else { let before_chars_trim_idx = (0, word_ref.position); &chars_line[before_chars_trim_idx.0..before_chars_trim_idx.1] From a15f8af99ffbe2234b6981af1c712c2c1a4f9430 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 18:36:05 -0500 Subject: [PATCH 0781/1135] refactor/shred ~ polish spelling (comments, names, and exceptions) --- src/uu/shred/src/shred.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 15a4eff26..e371ad6b2 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -6,7 +6,7 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// spell-checker:ignore (ToDO) NAMESET FILESIZE fstab coeff journaling writeback REiser journaled +// spell-checker:ignore (words) writeback wipesync use clap::{App, Arg}; use rand::{Rng, ThreadRng}; @@ -25,7 +25,7 @@ extern crate uucore; static NAME: &str = "shred"; static VERSION_STR: &str = "1.0.0"; const BLOCK_SIZE: usize = 512; -const NAMESET: &str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_."; +const NAME_CHARSET: &str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_."; // Patterns as shown in the GNU coreutils shred implementation const PATTERNS: [&[u8]; 22] = [ @@ -59,10 +59,10 @@ enum PassType<'a> { Random, } -// Used to generate all possible filenames of a certain length using NAMESET as an alphabet +// Used to generate all possible filenames of a certain length using NAME_CHARSET as an alphabet struct FilenameGenerator { name_len: usize, - nameset_indices: RefCell>, // Store the indices of the letters of our filename in NAMESET + name_charset_indices: RefCell>, // Store the indices of the letters of our filename in NAME_CHARSET exhausted: Cell, } @@ -71,7 +71,7 @@ impl FilenameGenerator { let indices: Vec = vec![0; name_len]; FilenameGenerator { name_len, - nameset_indices: RefCell::new(indices), + name_charset_indices: RefCell::new(indices), exhausted: Cell::new(false), } } @@ -85,25 +85,25 @@ impl Iterator for FilenameGenerator { return None; } - let mut nameset_indices = self.nameset_indices.borrow_mut(); + let mut name_charset_indices = self.name_charset_indices.borrow_mut(); // Make the return value, then increment let mut ret = String::new(); - for i in nameset_indices.iter() { - let c: char = NAMESET.chars().nth(*i).unwrap(); + for i in name_charset_indices.iter() { + let c: char = NAME_CHARSET.chars().nth(*i).unwrap(); ret.push(c); } - if nameset_indices[0] == NAMESET.len() - 1 { + if name_charset_indices[0] == NAME_CHARSET.len() - 1 { self.exhausted.set(true) } // Now increment the least significant index for i in (0..self.name_len).rev() { - if nameset_indices[i] == NAMESET.len() - 1 { - nameset_indices[i] = 0; // Carry the 1 + if name_charset_indices[i] == NAME_CHARSET.len() - 1 { + name_charset_indices[i] = 0; // Carry the 1 continue; } else { - nameset_indices[i] += 1; + name_charset_indices[i] += 1; break; } } @@ -233,7 +233,7 @@ static AFTER_HELP: &str = assumption. The following are examples of file systems on which shred is\n\ not effective, or is not guaranteed to be effective in all file system modes:\n\ \n\ - * log-structured or journaled file systems, such as those supplied with\n\ + * log-structured or journal file systems, such as those supplied with\n\ AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)\n\ \n\ * file systems that write redundant data and carry on even if some writes\n\ @@ -250,7 +250,7 @@ static AFTER_HELP: &str = and shred is thus of limited effectiveness) only in data=journal mode,\n\ which journals file data in addition to just metadata. In both the\n\ data=ordered (default) and data=writeback modes, shred works as usual.\n\ - Ext3 journaling modes can be changed by adding the data=something option\n\ + Ext3 journal modes can be changed by adding the data=something option\n\ to the mount options for a particular file system in the /etc/fstab file,\n\ as documented in the mount man page (man mount).\n\ \n\ @@ -412,7 +412,7 @@ fn get_size(size_str_opt: Option) -> Option { _ => 1u64, }; - let coeff = match size_str.parse::() { + let coefficient = match size_str.parse::() { Ok(u) => u, Err(_) => { println!("{}: {}: Invalid file size", NAME, size_str_opt.unwrap()); @@ -420,7 +420,7 @@ fn get_size(size_str_opt: Option) -> Option { } }; - Some(coeff * unit) + Some(coefficient * unit) } fn pass_name(pass_type: PassType) -> String { From f8e04c562b59fbdf2dd1a2a4b353d0d7e51c8777 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 18:36:19 -0500 Subject: [PATCH 0782/1135] refactor/sort ~ polish spelling (comments, names, and exceptions) --- src/uu/sort/BENCHMARKING.md | 4 +++- src/uu/sort/src/sort.rs | 11 ++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/uu/sort/BENCHMARKING.md b/src/uu/sort/BENCHMARKING.md index 560d6b438..77186318a 100644 --- a/src/uu/sort/BENCHMARKING.md +++ b/src/uu/sort/BENCHMARKING.md @@ -1,5 +1,7 @@ # Benchmarking sort + + Most of the time when sorting is spent comparing lines. The comparison functions however differ based on which arguments are passed to `sort`, therefore it is important to always benchmark multiple scenarios. This is an overview over what was benchmarked, and if you make changes to `sort`, you are encouraged to check @@ -96,7 +98,7 @@ When invoked with -c, we simply check if the input is already ordered. The input Try to run the above benchmarks by piping the input through stdin (standard input) and redirect the output through stdout (standard output): -- Remove the input file from the arguments and add `cat [inputfile] | ` at the beginning. +- Remove the input file from the arguments and add `cat [input_file] | ` at the beginning. - Remove `-o output.txt` and add `> output.txt` at the end. Example: `hyperfine "target/release/coreutils sort shuffled_numbers.txt -n -o output.txt"` becomes diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index a3b79e5d7..ab3b06451 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -11,7 +11,8 @@ // https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sort.html // https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html -// spell-checker:ignore (ToDO) outfile nondictionary +// spell-checker:ignore (misc) HFKJFK Mbdfhn + #[macro_use] extern crate uucore; @@ -143,7 +144,7 @@ pub struct GlobalSettings { ignore_non_printing: bool, merge: bool, reverse: bool, - outfile: Option, + output_file: Option, stable: bool, unique: bool, check: bool, @@ -187,7 +188,7 @@ impl GlobalSettings { } fn out_writer(&self) -> BufWriter> { - match self.outfile { + match self.output_file { Some(ref filename) => match File::create(Path::new(&filename)) { Ok(f) => BufWriter::new(Box::new(f) as Box), Err(e) => { @@ -211,7 +212,7 @@ impl Default for GlobalSettings { ignore_non_printing: false, merge: false, reverse: false, - outfile: None, + output_file: None, stable: false, unique: false, check: false, @@ -1168,7 +1169,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.ignore_blanks = matches.is_present(OPT_IGNORE_BLANKS); - settings.outfile = matches.value_of(OPT_OUTPUT).map(String::from); + settings.output_file = matches.value_of(OPT_OUTPUT).map(String::from); settings.reverse = matches.is_present(OPT_REVERSE); settings.stable = matches.is_present(OPT_STABLE); settings.unique = matches.is_present(OPT_UNIQUE); From 00a2e17c8032f9dc40eb511e00ef7fd314c92a77 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 00:07:01 -0500 Subject: [PATCH 0783/1135] refactor/splice ~ polish spelling (comments, names, and exceptions) --- src/uu/cat/src/splice.rs | 2 +- src/uu/csplit/src/csplit.rs | 6 +++--- src/uu/csplit/src/patterns.rs | 4 +++- .../csplit/src/{splitname.rs => split_name.rs} | 16 ++++++++++------ 4 files changed, 17 insertions(+), 11 deletions(-) rename src/uu/csplit/src/{splitname.rs => split_name.rs} (98%) diff --git a/src/uu/cat/src/splice.rs b/src/uu/cat/src/splice.rs index bd6be60f1..0b46fc662 100644 --- a/src/uu/cat/src/splice.rs +++ b/src/uu/cat/src/splice.rs @@ -9,7 +9,7 @@ const BUF_SIZE: usize = 1024 * 16; /// This function is called from `write_fast()` on Linux and Android. The /// function `splice()` is used to move data between two file descriptors -/// without copying between kernel- and userspace. This results in a large +/// without copying between kernel and user spaces. This results in a large /// speedup. /// /// The `bool` in the result value indicates if we need to fall back to normal diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index 43f95fff5..a2eb8604a 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -13,10 +13,10 @@ use std::{ mod csplit_error; mod patterns; -mod splitname; +mod split_name; use crate::csplit_error::CsplitError; -use crate::splitname::SplitName; +use crate::split_name::SplitName; use uucore::InvalidEncodingHandling; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -77,7 +77,7 @@ impl CsplitOptions { /// # Errors /// /// - [`io::Error`] if there is some problem reading/writing from/to a file. -/// - [`::CsplitError::LineOutOfRange`] if the linenum pattern is larger than the number of input +/// - [`::CsplitError::LineOutOfRange`] if the line number pattern is larger than the number of input /// lines. /// - [`::CsplitError::LineOutOfRangeOnRepetition`], like previous but after applying the pattern /// more than once. diff --git a/src/uu/csplit/src/patterns.rs b/src/uu/csplit/src/patterns.rs index d2f14578a..5621d18a3 100644 --- a/src/uu/csplit/src/patterns.rs +++ b/src/uu/csplit/src/patterns.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (regex) SKIPTO UPTO ; (vars) ntimes + use crate::csplit_error::CsplitError; use regex::Regex; @@ -167,7 +169,7 @@ fn validate_line_numbers(patterns: &[Pattern]) -> Result<(), CsplitError> { .try_fold(0, |prev_ln, ¤t_ln| match (prev_ln, current_ln) { // a line number cannot be zero (_, 0) => Err(CsplitError::LineNumberIsZero), - // two consecutifs numbers should not be equal + // two consecutive numbers should not be equal (n, m) if n == m => { show_warning!("line number '{}' is the same as preceding line number", n); Ok(n) diff --git a/src/uu/csplit/src/splitname.rs b/src/uu/csplit/src/split_name.rs similarity index 98% rename from src/uu/csplit/src/splitname.rs rename to src/uu/csplit/src/split_name.rs index 66b17ba67..6db781e9b 100644 --- a/src/uu/csplit/src/splitname.rs +++ b/src/uu/csplit/src/split_name.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (regex) diuox + use regex::Regex; use crate::csplit_error::CsplitError; @@ -225,6 +227,8 @@ impl SplitName { #[cfg(test)] mod tests { + // spell-checker:ignore (path) xxcst + use super::*; #[test] @@ -319,13 +323,13 @@ mod tests { } #[test] - fn zero_padding_lower_hexa() { + fn zero_padding_lower_hex() { let split_name = SplitName::new(None, Some(String::from("cst-%03x-")), None).unwrap(); assert_eq!(split_name.get(42), "xxcst-02a-"); } #[test] - fn zero_padding_upper_hexa() { + fn zero_padding_upper_hex() { let split_name = SplitName::new(None, Some(String::from("cst-%03X-")), None).unwrap(); assert_eq!(split_name.get(42), "xxcst-02A-"); } @@ -337,13 +341,13 @@ mod tests { } #[test] - fn alternate_form_lower_hexa() { + fn alternate_form_lower_hex() { let split_name = SplitName::new(None, Some(String::from("cst-%#10x-")), None).unwrap(); assert_eq!(split_name.get(42), "xxcst- 0x2a-"); } #[test] - fn alternate_form_upper_hexa() { + fn alternate_form_upper_hex() { let split_name = SplitName::new(None, Some(String::from("cst-%#10X-")), None).unwrap(); assert_eq!(split_name.get(42), "xxcst- 0x2A-"); } @@ -373,13 +377,13 @@ mod tests { } #[test] - fn left_adjusted_lower_hexa() { + fn left_adjusted_lower_hex() { let split_name = SplitName::new(None, Some(String::from("cst-%-10x-")), None).unwrap(); assert_eq!(split_name.get(42), "xxcst-0x2a -"); } #[test] - fn left_adjusted_upper_hexa() { + fn left_adjusted_upper_hex() { let split_name = SplitName::new(None, Some(String::from("cst-%-10X-")), None).unwrap(); assert_eq!(split_name.get(42), "xxcst-0x2A -"); } From 451110bba017bd278f7d2b2bbe637410ffb0bf29 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 20:41:19 -0500 Subject: [PATCH 0784/1135] refactor/split ~ polish spelling (comments, names, and exceptions) --- src/uu/split/src/split.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index 39bd577cb..85ed5f183 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -157,13 +157,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.verbose = matches.occurrences_of("verbose") > 0; // check that the user is not specifying more than one strategy - // note: right now, this exact behaviour cannot be handled by ArgGroup since ArgGroup + // note: right now, this exact behavior cannot be handled by ArgGroup since ArgGroup // considers a default value Arg as "defined" let explicit_strategies = vec![OPT_LINE_BYTES, OPT_LINES, OPT_BYTES] .into_iter() - .fold(0, |count, strat| { - if matches.occurrences_of(strat) > 0 { + .fold(0, |count, strategy| { + if matches.occurrences_of(strategy) > 0 { count + 1 } else { count @@ -177,10 +177,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.strategy = String::from(OPT_LINES); settings.strategy_param = matches.value_of(OPT_LINES).unwrap().to_owned(); // take any (other) defined strategy - for strat in vec![OPT_LINE_BYTES, OPT_BYTES].into_iter() { - if matches.occurrences_of(strat) > 0 { - settings.strategy = String::from(strat); - settings.strategy_param = matches.value_of(strat).unwrap().to_owned(); + for strategy in vec![OPT_LINE_BYTES, OPT_BYTES].into_iter() { + if matches.occurrences_of(strategy) > 0 { + settings.strategy = String::from(strategy); + settings.strategy_param = matches.value_of(strategy).unwrap().to_owned(); } } From 8e824742a120ab0f93e18a1eb7d6cf4399a26b69 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 18:36:46 -0500 Subject: [PATCH 0785/1135] refactor/stat ~ polish spelling (comments, names, and exceptions) --- src/uu/stat/src/stat.rs | 199 ++++++++++++++++++++-------------------- 1 file changed, 98 insertions(+), 101 deletions(-) diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 582d59841..83567e447 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -5,8 +5,6 @@ // For the full copyright and license information, please view the LICENSE file // that was distributed with this source code. -// spell-checker:ignore (ToDO) showfs otype fmtstr prec ftype blocksize nlink rdev fnodes fsid namelen blksize inodes fstype iosize statfs gnulib NBLOCKSIZE - #[macro_use] extern crate uucore; use uucore::entries; @@ -208,7 +206,7 @@ pub fn group_num(s: &str) -> Cow { pub struct Stater { follow: bool, - showfs: bool, + show_fs: bool, from_user: bool, files: Vec, mount_list: Option>, @@ -217,7 +215,7 @@ pub struct Stater { } #[allow(clippy::cognitive_complexity)] -fn print_it(arg: &str, otype: OutputType, flag: u8, width: usize, precision: i32) { +fn print_it(arg: &str, output_type: OutputType, flag: u8, width: usize, precision: i32) { // If the precision is given as just '.', the precision is taken to be zero. // A negative precision is taken as if the precision were omitted. // This gives the minimum number of digits to appear for d, i, o, u, x, and X conversions, @@ -248,7 +246,7 @@ fn print_it(arg: &str, otype: OutputType, flag: u8, width: usize, precision: i32 // By default, a sign is used only for negative numbers. // A + overrides a space if both are used. - if otype == OutputType::Unknown { + if output_type == OutputType::Unknown { return print!("?"); } @@ -262,7 +260,7 @@ fn print_it(arg: &str, otype: OutputType, flag: u8, width: usize, precision: i32 let has_sign = has!(flag, F_SIGN) || has!(flag, F_SPACE); let should_alter = has!(flag, F_ALTER); - let prefix = match otype { + let prefix = match output_type { OutputType::UnsignedOct => "0", OutputType::UnsignedHex => "0x", OutputType::Integer => { @@ -275,7 +273,7 @@ fn print_it(arg: &str, otype: OutputType, flag: u8, width: usize, precision: i32 _ => "", }; - match otype { + match output_type { OutputType::Str => { let limit = cmp::min(precision, arg.len() as i32); let s: &str = if limit >= 0 { @@ -334,10 +332,10 @@ fn print_it(arg: &str, otype: OutputType, flag: u8, width: usize, precision: i32 } impl Stater { - pub fn generate_tokens(fmtstr: &str, use_printf: bool) -> Result, String> { + pub fn generate_tokens(format_str: &str, use_printf: bool) -> Result, String> { let mut tokens = Vec::new(); - let bound = fmtstr.len(); - let chars = fmtstr.chars().collect::>(); + let bound = format_str.len(); + let chars = format_str.chars().collect::>(); let mut i = 0_usize; while i < bound { match chars[i] { @@ -370,32 +368,32 @@ impl Stater { } i += 1; } - check_bound!(fmtstr, bound, old, i); + check_bound!(format_str, bound, old, i); let mut width = 0_usize; let mut precision = -1_i32; let mut j = i; - if let Some((field_width, offset)) = fmtstr[j..].scan_num::() { + if let Some((field_width, offset)) = format_str[j..].scan_num::() { width = field_width; j += offset; } - check_bound!(fmtstr, bound, old, j); + check_bound!(format_str, bound, old, j); if chars[j] == '.' { j += 1; - check_bound!(fmtstr, bound, old, j); + check_bound!(format_str, bound, old, j); - match fmtstr[j..].scan_num::() { - Some((prec, offset)) => { - if prec >= 0 { - precision = prec; + match format_str[j..].scan_num::() { + Some((value, offset)) => { + if value >= 0 { + precision = value; } j += offset; } None => precision = 0, } - check_bound!(fmtstr, bound, old, j); + check_bound!(format_str, bound, old, j); } i = j; @@ -418,7 +416,7 @@ impl Stater { } match chars[i] { 'x' if i + 1 < bound => { - if let Some((c, offset)) = fmtstr[i + 1..].scan_char(16) { + if let Some((c, offset)) = format_str[i + 1..].scan_char(16) { tokens.push(Token::Char(c)); i += offset; } else { @@ -427,7 +425,7 @@ impl Stater { } } '0'..='7' => { - let (c, offset) = fmtstr[i..].scan_char(8).unwrap(); + let (c, offset) = format_str[i..].scan_char(8).unwrap(); tokens.push(Token::Char(c)); i += offset - 1; } @@ -452,7 +450,7 @@ impl Stater { } i += 1; } - if !use_printf && !fmtstr.ends_with('\n') { + if !use_printf && !format_str.ends_with('\n') { tokens.push(Token::Char('\n')); } Ok(tokens) @@ -464,7 +462,7 @@ impl Stater { .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); - let fmtstr = if matches.is_present(options::PRINTF) { + let format_str = if matches.is_present(options::PRINTF) { matches .value_of(options::PRINTF) .expect("Invalid format string") @@ -474,17 +472,17 @@ impl Stater { let use_printf = matches.is_present(options::PRINTF); let terse = matches.is_present(options::TERSE); - let showfs = matches.is_present(options::FILE_SYSTEM); + let show_fs = matches.is_present(options::FILE_SYSTEM); - let default_tokens = if fmtstr.is_empty() { - Stater::generate_tokens(&Stater::default_fmt(showfs, terse, false), use_printf).unwrap() + let default_tokens = if format_str.is_empty() { + Stater::generate_tokens(&Stater::default_format(show_fs, terse, false), use_printf).unwrap() } else { - Stater::generate_tokens(&fmtstr, use_printf)? + Stater::generate_tokens(&format_str, use_printf)? }; let default_dev_tokens = - Stater::generate_tokens(&Stater::default_fmt(showfs, terse, true), use_printf).unwrap(); + Stater::generate_tokens(&Stater::default_format(show_fs, terse, true), use_printf).unwrap(); - let mount_list = if showfs { + let mount_list = if show_fs { // mount points aren't displayed when showing filesystem information None } else { @@ -500,8 +498,8 @@ impl Stater { Ok(Stater { follow: matches.is_present(options::DEREFERENCE), - showfs, - from_user: !fmtstr.is_empty(), + show_fs, + from_user: !format_str.is_empty(), files, default_tokens, default_dev_tokens, @@ -533,7 +531,7 @@ impl Stater { } fn do_stat(&self, file: &str) -> i32 { - if !self.showfs { + if !self.show_fs { let result = if self.follow { fs::metadata(file) } else { @@ -541,9 +539,9 @@ impl Stater { }; match result { Ok(meta) => { - let ftype = meta.file_type(); + let file_type = meta.file_type(); let tokens = - if self.from_user || !(ftype.is_char_device() || ftype.is_block_device()) { + if self.from_user || !(file_type.is_char_device() || file_type.is_block_device()) { &self.default_tokens } else { &self.default_dev_tokens @@ -559,91 +557,91 @@ impl Stater { format, } => { let arg: String; - let otype: OutputType; + let output_type: OutputType; match format { // access rights in octal 'a' => { arg = format!("{:o}", 0o7777 & meta.mode()); - otype = OutputType::UnsignedOct; + output_type = OutputType::UnsignedOct; } // access rights in human readable form 'A' => { arg = display_permissions(&meta, true); - otype = OutputType::Str; + output_type = OutputType::Str; } // number of blocks allocated (see %B) 'b' => { arg = format!("{}", meta.blocks()); - otype = OutputType::Unsigned; + output_type = OutputType::Unsigned; } // the size in bytes of each block reported by %b // FIXME: blocksize differs on various platform - // See coreutils/gnulib/lib/stat-size.h ST_NBLOCKSIZE + // See coreutils/gnulib/lib/stat-size.h ST_NBLOCKSIZE // spell-checker:disable-line 'B' => { // the size in bytes of each block reported by %b arg = format!("{}", 512); - otype = OutputType::Unsigned; + output_type = OutputType::Unsigned; } // device number in decimal 'd' => { arg = format!("{}", meta.dev()); - otype = OutputType::Unsigned; + output_type = OutputType::Unsigned; } // device number in hex 'D' => { arg = format!("{:x}", meta.dev()); - otype = OutputType::UnsignedHex; + output_type = OutputType::UnsignedHex; } // raw mode in hex 'f' => { arg = format!("{:x}", meta.mode()); - otype = OutputType::UnsignedHex; + output_type = OutputType::UnsignedHex; } // file type 'F' => { arg = pretty_filetype(meta.mode() as mode_t, meta.len()) .to_owned(); - otype = OutputType::Str; + output_type = OutputType::Str; } // group ID of owner 'g' => { arg = format!("{}", meta.gid()); - otype = OutputType::Unsigned; + output_type = OutputType::Unsigned; } // group name of owner 'G' => { arg = entries::gid2grp(meta.gid()) .unwrap_or_else(|_| "UNKNOWN".to_owned()); - otype = OutputType::Str; + output_type = OutputType::Str; } // number of hard links 'h' => { arg = format!("{}", meta.nlink()); - otype = OutputType::Unsigned; + output_type = OutputType::Unsigned; } // inode number 'i' => { arg = format!("{}", meta.ino()); - otype = OutputType::Unsigned; + output_type = OutputType::Unsigned; } // mount point 'm' => { arg = self.find_mount_point(file).unwrap(); - otype = OutputType::Str; + output_type = OutputType::Str; } // file name 'n' => { arg = file.to_owned(); - otype = OutputType::Str; + output_type = OutputType::Str; } // quoted file name with dereference if symbolic link 'N' => { - if ftype.is_symlink() { + if file_type.is_symlink() { let dst = match fs::read_link(file) { Ok(path) => path, Err(e) => { @@ -659,91 +657,91 @@ impl Stater { } else { arg = file.to_string(); } - otype = OutputType::Str; + output_type = OutputType::Str; } // optimal I/O transfer size hint 'o' => { arg = format!("{}", meta.blksize()); - otype = OutputType::Unsigned; + output_type = OutputType::Unsigned; } // total size, in bytes 's' => { arg = format!("{}", meta.len()); - otype = OutputType::Integer; + output_type = OutputType::Integer; } // major device type in hex, for character/block device special // files 't' => { arg = format!("{:x}", meta.rdev() >> 8); - otype = OutputType::UnsignedHex; + output_type = OutputType::UnsignedHex; } // minor device type in hex, for character/block device special // files 'T' => { arg = format!("{:x}", meta.rdev() & 0xff); - otype = OutputType::UnsignedHex; + output_type = OutputType::UnsignedHex; } // user ID of owner 'u' => { arg = format!("{}", meta.uid()); - otype = OutputType::Unsigned; + output_type = OutputType::Unsigned; } // user name of owner 'U' => { arg = entries::uid2usr(meta.uid()) .unwrap_or_else(|_| "UNKNOWN".to_owned()); - otype = OutputType::Str; + output_type = OutputType::Str; } // time of file birth, human-readable; - if unknown 'w' => { arg = meta.pretty_birth(); - otype = OutputType::Str; + output_type = OutputType::Str; } // time of file birth, seconds since Epoch; 0 if unknown 'W' => { arg = meta.birth(); - otype = OutputType::Integer; + output_type = OutputType::Integer; } // time of last access, human-readable 'x' => { arg = pretty_time(meta.atime(), meta.atime_nsec()); - otype = OutputType::Str; + output_type = OutputType::Str; } // time of last access, seconds since Epoch 'X' => { arg = format!("{}", meta.atime()); - otype = OutputType::Integer; + output_type = OutputType::Integer; } // time of last data modification, human-readable 'y' => { arg = pretty_time(meta.mtime(), meta.mtime_nsec()); - otype = OutputType::Str; + output_type = OutputType::Str; } // time of last data modification, seconds since Epoch 'Y' => { arg = format!("{}", meta.mtime()); - otype = OutputType::Str; + output_type = OutputType::Str; } // time of last status change, human-readable 'z' => { arg = pretty_time(meta.ctime(), meta.ctime_nsec()); - otype = OutputType::Str; + output_type = OutputType::Str; } // time of last status change, seconds since Epoch 'Z' => { arg = format!("{}", meta.ctime()); - otype = OutputType::Integer; + output_type = OutputType::Integer; } _ => { arg = "?".to_owned(); - otype = OutputType::Unknown; + output_type = OutputType::Unknown; } } - print_it(&arg, otype, flag, width, precision); + print_it(&arg, output_type, flag, width, precision); } } } @@ -768,75 +766,75 @@ impl Stater { format, } => { let arg: String; - let otype: OutputType; + let output_type: OutputType; match format { // free blocks available to non-superuser 'a' => { arg = format!("{}", meta.avail_blocks()); - otype = OutputType::Integer; + output_type = OutputType::Integer; } // total data blocks in file system 'b' => { arg = format!("{}", meta.total_blocks()); - otype = OutputType::Integer; + output_type = OutputType::Integer; } // total file nodes in file system 'c' => { - arg = format!("{}", meta.total_fnodes()); - otype = OutputType::Unsigned; + arg = format!("{}", meta.total_file_nodes()); + output_type = OutputType::Unsigned; } // free file nodes in file system 'd' => { - arg = format!("{}", meta.free_fnodes()); - otype = OutputType::Integer; + arg = format!("{}", meta.free_file_nodes()); + output_type = OutputType::Integer; } // free blocks in file system 'f' => { arg = format!("{}", meta.free_blocks()); - otype = OutputType::Integer; + output_type = OutputType::Integer; } // file system ID in hex 'i' => { arg = format!("{:x}", meta.fsid()); - otype = OutputType::UnsignedHex; + output_type = OutputType::UnsignedHex; } // maximum length of filenames 'l' => { arg = format!("{}", meta.namelen()); - otype = OutputType::Unsigned; + output_type = OutputType::Unsigned; } // file name 'n' => { arg = file.to_owned(); - otype = OutputType::Str; + output_type = OutputType::Str; } // block size (for faster transfers) 's' => { - arg = format!("{}", meta.iosize()); - otype = OutputType::Unsigned; + arg = format!("{}", meta.io_size()); + output_type = OutputType::Unsigned; } // fundamental block size (for block counts) 'S' => { - arg = format!("{}", meta.blksize()); - otype = OutputType::Unsigned; + arg = format!("{}", meta.block_size()); + output_type = OutputType::Unsigned; } // file system type in hex 't' => { arg = format!("{:x}", meta.fs_type()); - otype = OutputType::UnsignedHex; + output_type = OutputType::UnsignedHex; } // file system type in human readable form 'T' => { arg = pretty_fstype(meta.fs_type()).into_owned(); - otype = OutputType::Str; + output_type = OutputType::Str; } _ => { arg = "?".to_owned(); - otype = OutputType::Unknown; + output_type = OutputType::Unknown; } } - print_it(&arg, otype, flag, width, precision); + print_it(&arg, output_type, flag, width, precision); } } } @@ -850,34 +848,33 @@ impl Stater { 0 } - // taken from coreutils/src/stat.c - fn default_fmt(showfs: bool, terse: bool, dev: bool) -> String { + fn default_format(show_fs: bool, terse: bool, show_dev_type: bool) -> String { // SELinux related format is *ignored* - let mut fmtstr = String::with_capacity(36); - if showfs { + let mut format_str = String::with_capacity(36); + if show_fs { if terse { - fmtstr.push_str("%n %i %l %t %s %S %b %f %a %c %d\n"); + format_str.push_str("%n %i %l %t %s %S %b %f %a %c %d\n"); } else { - fmtstr.push_str( + format_str.push_str( " File: \"%n\"\n ID: %-8i Namelen: %-7l Type: %T\nBlock \ size: %-10s Fundamental block size: %S\nBlocks: Total: %-10b \ Free: %-10f Available: %a\nInodes: Total: %-10c Free: %d\n", ); } } else if terse { - fmtstr.push_str("%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %W %o\n"); + format_str.push_str("%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %W %o\n"); } else { - fmtstr.push_str(" File: %N\n Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"); - if dev { - fmtstr.push_str("Device: %Dh/%dd\tInode: %-10i Links: %-5h Device type: %t,%T\n"); + format_str.push_str(" File: %N\n Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"); + if show_dev_type { + format_str.push_str("Device: %Dh/%dd\tInode: %-10i Links: %-5h Device type: %t,%T\n"); } else { - fmtstr.push_str("Device: %Dh/%dd\tInode: %-10i Links: %h\n"); + format_str.push_str("Device: %Dh/%dd\tInode: %-10i Links: %h\n"); } - fmtstr.push_str("Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"); - fmtstr.push_str("Access: %x\nModify: %y\nChange: %z\n Birth: %w\n"); + format_str.push_str("Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"); + format_str.push_str("Access: %x\nModify: %y\nChange: %z\n Birth: %w\n"); } - fmtstr + format_str } } From 879ac263bd378316525fb073d3fd122fbf429d22 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 18:37:45 -0500 Subject: [PATCH 0786/1135] refactor/test ~ polish spelling (comments, names, and exceptions) --- src/uu/test/src/parser.rs | 2 ++ src/uu/test/src/test.rs | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/uu/test/src/parser.rs b/src/uu/test/src/parser.rs index a77bfabb3..d4302bd67 100644 --- a/src/uu/test/src/parser.rs +++ b/src/uu/test/src/parser.rs @@ -5,6 +5,8 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +// spell-checker:ignore (grammar) BOOLOP STRLEN FILETEST FILEOP INTOP STRINGOP ; (vars) LParen StrlenOp + use std::ffi::OsString; use std::iter::Peekable; diff --git a/src/uu/test/src/test.rs b/src/uu/test/src/test.rs index 86950ecc2..acf0f7eca 100644 --- a/src/uu/test/src/test.rs +++ b/src/uu/test/src/test.rs @@ -6,7 +6,7 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// spell-checker:ignore (ToDO) retval paren prec subprec cond +// spell-checker:ignore (vars) FiletestOp StrlenOp mod parser; @@ -122,7 +122,7 @@ fn eval(stack: &mut Vec) -> Result { } } -fn integers(a: &OsStr, b: &OsStr, cond: &OsStr) -> Result { +fn integers(a: &OsStr, b: &OsStr, op: &OsStr) -> Result { let format_err = |value| format!("invalid integer ‘{}’", value); let a = a.to_string_lossy(); @@ -131,15 +131,15 @@ fn integers(a: &OsStr, b: &OsStr, cond: &OsStr) -> Result { let b = b.to_string_lossy(); let b: i64 = b.parse().map_err(|_| format_err(b))?; - let cond = cond.to_string_lossy(); - Ok(match cond.as_ref() { + let operator = op.to_string_lossy(); + Ok(match operator.as_ref() { "-eq" => a == b, "-ne" => a != b, "-gt" => a > b, "-ge" => a >= b, "-lt" => a < b, "-le" => a <= b, - _ => return Err(format!("unknown operator ‘{}’", cond)), + _ => return Err(format!("unknown operator ‘{}’", operator)), }) } @@ -177,7 +177,7 @@ enum PathCondition { } #[cfg(not(windows))] -fn path(path: &OsStr, cond: PathCondition) -> bool { +fn path(path: &OsStr, condition: PathCondition) -> bool { use std::fs::{self, Metadata}; use std::os::unix::fs::{FileTypeExt, MetadataExt}; @@ -208,7 +208,7 @@ fn path(path: &OsStr, cond: PathCondition) -> bool { } }; - let metadata = if cond == PathCondition::SymLink { + let metadata = if condition == PathCondition::SymLink { fs::symlink_metadata(path) } else { fs::metadata(path) @@ -223,7 +223,7 @@ fn path(path: &OsStr, cond: PathCondition) -> bool { let file_type = metadata.file_type(); - match cond { + match condition { PathCondition::BlockSpecial => file_type.is_block_device(), PathCondition::CharacterSpecial => file_type.is_char_device(), PathCondition::Directory => file_type.is_dir(), @@ -242,7 +242,7 @@ fn path(path: &OsStr, cond: PathCondition) -> bool { } #[cfg(windows)] -fn path(path: &OsStr, cond: PathCondition) -> bool { +fn path(path: &OsStr, condition: PathCondition) -> bool { use std::fs::metadata; let stat = match metadata(path) { @@ -250,7 +250,7 @@ fn path(path: &OsStr, cond: PathCondition) -> bool { _ => return false, }; - match cond { + match condition { PathCondition::BlockSpecial => false, PathCondition::CharacterSpecial => false, PathCondition::Directory => stat.is_dir(), From b1a2f6e044c3d1c98854435c6455679071da171f Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 20:41:09 -0500 Subject: [PATCH 0787/1135] refactor/tee ~ polish spelling (comments, names, and exceptions) --- src/uu/tee/src/tee.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/tee/src/tee.rs b/src/uu/tee/src/tee.rs index c21559b3b..82a06daa2 100644 --- a/src/uu/tee/src/tee.rs +++ b/src/uu/tee/src/tee.rs @@ -119,7 +119,7 @@ fn tee(options: Options) -> Result<()> { // TODO: replaced generic 'copy' call to be able to stop copying // if all outputs are closed (due to errors) - if copy(input, &mut output).is_err() || output.flush().is_err() || output.error_occured() { + if copy(input, &mut output).is_err() || output.flush().is_err() || output.error_occurred() { Err(Error::new(ErrorKind::Other, "")) } else { Ok(()) @@ -155,7 +155,7 @@ impl MultiWriter { writers, } } - fn error_occured(&self) -> bool { + fn error_occurred(&self) -> bool { self.writers.len() != self.initial_len } } From f6a079a77fe99d6769c1ddec68dd8e8beab507e3 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 18:38:03 -0500 Subject: [PATCH 0788/1135] refactor/timeout ~ polish spelling (comments, names, and exceptions) --- src/uu/timeout/src/timeout.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index 7d557f1ce..dc8979143 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -159,8 +159,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) } -/// TODO: Improve exit codes, and make them consistent with the GNU Coreutil -/// exit codes. +/// TODO: Improve exit codes, and make them consistent with the GNU Coreutils exit codes. fn timeout( cmdname: &str, From 954b3436d940e31954ec60f074fd3170ecbcdd20 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 11:53:40 -0500 Subject: [PATCH 0789/1135] refactor/truncate ~ polish spelling (comments, names, and exceptions) --- src/uu/truncate/src/truncate.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 3a6077b3c..50ab5c45e 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -40,13 +40,13 @@ impl TruncateMode { /// ``` fn to_size(&self, fsize: u64) -> u64 { match self { - TruncateMode::Absolute(modsize) => *modsize, - TruncateMode::Extend(modsize) => fsize + modsize, - TruncateMode::Reduce(modsize) => fsize - modsize, - TruncateMode::AtMost(modsize) => fsize.min(*modsize), - TruncateMode::AtLeast(modsize) => fsize.max(*modsize), - TruncateMode::RoundDown(modsize) => fsize - fsize % modsize, - TruncateMode::RoundUp(modsize) => fsize + fsize % modsize, + TruncateMode::Absolute(size) => *size, + TruncateMode::Extend(size) => fsize + size, + TruncateMode::Reduce(size) => fsize - size, + TruncateMode::AtMost(size) => fsize.min(*size), + TruncateMode::AtLeast(size) => fsize.max(*size), + TruncateMode::RoundDown(size) => fsize - fsize % size, + TruncateMode::RoundUp(size) => fsize + fsize % size, } } } From 40e136d0923275af260ab10640812f2bc854a2a8 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 29 May 2021 22:25:46 -0500 Subject: [PATCH 0790/1135] refactor/uucore ~ polish spelling (comments, names, and exceptions) --- src/uucore/src/lib/features/fs.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index afaa07af1..38cdbef94 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -390,8 +390,8 @@ mod tests { test: "C:/you/later", }, NormalizePathTestCase { - path: "\\networkshare/a//foo//./bar", - test: "\\networkshare/a/foo/bar", + path: "\\networkShare/a//foo//./bar", + test: "\\networkShare/a/foo/bar", }, ]; @@ -411,6 +411,7 @@ mod tests { #[cfg(unix)] #[test] fn test_display_permissions() { + // spell-checker:ignore (perms) brwsr drwxr rwxr assert_eq!( "drwxr-xr-x", display_permissions_unix(S_IFDIR | 0o755, true) From 3d42454ebc52578a8e797a15fc56bbb736fefc48 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 18:38:16 -0500 Subject: [PATCH 0791/1135] refactor/users ~ polish spelling (comments, names, and exceptions) --- src/uu/users/src/users.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/uu/users/src/users.rs b/src/uu/users/src/users.rs index 99e06c1af..664ff55f3 100644 --- a/src/uu/users/src/users.rs +++ b/src/uu/users/src/users.rs @@ -6,6 +6,8 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. +// spell-checker:ignore (paths) wtmp + #[macro_use] extern crate uucore; From dff33a0edbb7f406652047a0e689c23cdcc14167 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 11:59:16 -0500 Subject: [PATCH 0792/1135] refactor/wc ~ polish spelling (comments, names, and exceptions) --- src/uu/wc/src/wc.rs | 6 ++---- src/uu/wc/src/{wordcount.rs => word_count.rs} | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) rename src/uu/wc/src/{wordcount.rs => word_count.rs} (98%) diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 6e95254ee..d990c6679 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -5,17 +5,15 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// spell-checker:ignore (ToDO) fpath - #[macro_use] extern crate uucore; mod count_bytes; mod countable; -mod wordcount; +mod word_count; use count_bytes::count_bytes_fast; use countable::WordCountable; -use wordcount::{TitledWordCount, WordCount}; +use word_count::{TitledWordCount, WordCount}; use clap::{App, Arg, ArgMatches}; use thiserror::Error; diff --git a/src/uu/wc/src/wordcount.rs b/src/uu/wc/src/word_count.rs similarity index 98% rename from src/uu/wc/src/wordcount.rs rename to src/uu/wc/src/word_count.rs index 9e2a81fca..bdb510f58 100644 --- a/src/uu/wc/src/wordcount.rs +++ b/src/uu/wc/src/word_count.rs @@ -123,7 +123,7 @@ impl WordCount { /// This struct supplements the actual word count with an optional title that is /// displayed to the user at the end of the program. /// The reason we don't simply include title in the `WordCount` struct is that -/// it would result in unneccesary copying of `String`. +/// it would result in unnecessary copying of `String`. #[derive(Debug, Default, Clone)] pub struct TitledWordCount<'a> { pub title: Option<&'a str>, From 5c9b474cc8438a1df83990bfe5f6747d9e514b4f Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 29 May 2021 22:24:30 -0500 Subject: [PATCH 0793/1135] refactor/whoami ~ polish spelling (comments, names, and exceptions) --- src/uu/whoami/src/platform/mod.rs | 4 ++-- src/uu/whoami/src/platform/unix.rs | 2 +- src/uu/whoami/src/platform/windows.rs | 4 +--- src/uu/whoami/src/whoami.rs | 4 +--- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/uu/whoami/src/platform/mod.rs b/src/uu/whoami/src/platform/mod.rs index ab0b856e6..b5064a8d2 100644 --- a/src/uu/whoami/src/platform/mod.rs +++ b/src/uu/whoami/src/platform/mod.rs @@ -10,10 +10,10 @@ // spell-checker:ignore (ToDO) getusername #[cfg(unix)] -pub use self::unix::getusername; +pub use self::unix::get_username; #[cfg(windows)] -pub use self::windows::getusername; +pub use self::windows::get_username; #[cfg(unix)] mod unix; diff --git a/src/uu/whoami/src/platform/unix.rs b/src/uu/whoami/src/platform/unix.rs index 33bfa6025..3d5fc6f54 100644 --- a/src/uu/whoami/src/platform/unix.rs +++ b/src/uu/whoami/src/platform/unix.rs @@ -14,7 +14,7 @@ use std::io::Result; use uucore::entries::uid2usr; use uucore::libc::geteuid; -pub unsafe fn getusername() -> Result { +pub unsafe fn get_username() -> Result { // Get effective user id let uid = geteuid(); uid2usr(uid) diff --git a/src/uu/whoami/src/platform/windows.rs b/src/uu/whoami/src/platform/windows.rs index 1d65281bd..5d648877b 100644 --- a/src/uu/whoami/src/platform/windows.rs +++ b/src/uu/whoami/src/platform/windows.rs @@ -7,8 +7,6 @@ * file that was distributed with this source code. */ -// spell-checker:ignore (ToDO) advapi lmcons winnt getusername WCHAR UNLEN - extern crate winapi; use self::winapi::shared::lmcons; @@ -18,7 +16,7 @@ use std::io::{Error, Result}; use std::mem; use uucore::wide::FromWide; -pub unsafe fn getusername() -> Result { +pub unsafe fn get_username() -> Result { #[allow(deprecated)] let mut buffer: [winnt::WCHAR; lmcons::UNLEN as usize + 1] = mem::uninitialized(); let mut len = buffer.len() as minwindef::DWORD; diff --git a/src/uu/whoami/src/whoami.rs b/src/uu/whoami/src/whoami.rs index 21e170dec..383fb40b5 100644 --- a/src/uu/whoami/src/whoami.rs +++ b/src/uu/whoami/src/whoami.rs @@ -7,8 +7,6 @@ /* last synced with: whoami (GNU coreutils) 8.21 */ -// spell-checker:ignore (ToDO) getusername - #[macro_use] extern crate clap; #[macro_use] @@ -38,7 +36,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { pub fn exec() { unsafe { - match platform::getusername() { + match platform::get_username() { Ok(username) => println!("{}", username), Err(err) => match err.raw_os_error() { Some(0) | None => crash!(1, "failed to get username"), From 4e20dedf584daba1fa62b2ebeebac6706a5dcf89 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 00:10:54 -0500 Subject: [PATCH 0794/1135] tests ~ refactor/polish spelling (comments, names, and exceptions) --- tests/benches/factor/benches/gcd.rs | 2 +- tests/benches/factor/benches/table.rs | 4 +- tests/by-util/test_base32.rs | 14 +-- tests/by-util/test_base64.rs | 13 +-- tests/by-util/test_basename.rs | 8 +- tests/by-util/test_cat.rs | 22 +++-- tests/by-util/test_chgrp.rs | 2 + tests/by-util/test_chmod.rs | 24 +++--- tests/by-util/test_chown.rs | 2 + tests/by-util/test_chroot.rs | 2 + tests/by-util/test_cksum.rs | 18 ++-- tests/by-util/test_comm.rs | 14 +-- tests/by-util/test_cp.rs | 12 +-- tests/by-util/test_csplit.rs | 28 +++--- tests/by-util/test_date.rs | 2 +- tests/by-util/test_dircolors.rs | 6 +- tests/by-util/test_du.rs | 2 + tests/by-util/test_echo.rs | 6 +- tests/by-util/test_env.rs | 2 + tests/by-util/test_factor.rs | 86 ++++++++++--------- tests/by-util/test_fold.rs | 16 ++-- tests/by-util/test_head.rs | 2 + tests/by-util/test_install.rs | 2 + tests/by-util/test_join.rs | 4 +- tests/by-util/test_kill.rs | 3 +- tests/by-util/test_ln.rs | 8 +- tests/by-util/test_ls.rs | 4 +- tests/by-util/test_mktemp.rs | 6 +- tests/by-util/test_more.rs | 2 +- tests/by-util/test_mv.rs | 2 +- tests/by-util/test_nice.rs | 2 +- tests/by-util/test_nl.rs | 4 +- tests/by-util/test_numfmt.rs | 4 +- tests/by-util/test_od.rs | 40 +++++---- tests/by-util/test_pinky.rs | 18 ++-- tests/by-util/test_printf.rs | 36 ++++---- tests/by-util/test_ptx.rs | 20 ++--- tests/by-util/test_pwd.rs | 2 +- tests/by-util/test_relpath.rs | 8 +- tests/by-util/test_rm.rs | 2 +- tests/by-util/test_shuf.rs | 2 +- tests/by-util/test_sort.rs | 20 +++-- tests/by-util/test_split.rs | 4 +- tests/by-util/test_stat.rs | 28 +++--- tests/by-util/test_tail.rs | 8 +- tests/by-util/test_test.rs | 26 +++--- tests/by-util/test_timeout.rs | 2 +- tests/by-util/test_touch.rs | 10 ++- tests/by-util/test_tr.rs | 22 ++--- tests/by-util/test_truncate.rs | 62 ++++++------- tests/by-util/test_uname.rs | 2 +- tests/by-util/test_unexpand.rs | 6 +- tests/by-util/test_uptime.rs | 2 +- tests/by-util/test_users.rs | 2 +- tests/by-util/test_wc.rs | 2 + tests/by-util/test_who.rs | 2 + tests/common/util.rs | 10 ++- ...ctories_and_file_and_stdin.stderr.expected | 2 +- ..._ext_disabled_rightward_auto_ref.expected} | 0 ...ext_disabled_rightward_input_ref.expected} | 0 ...nu_ext_disabled_rightward_no_ref.expected} | 0 ...ard_no_ref_word_regexp_exc_space.expected} | 0 .../foobar_follow_multiple_appended.expected | 4 +- 63 files changed, 368 insertions(+), 302 deletions(-) rename tests/fixtures/ptx/{gnu_ext_disabled_roff_auto_ref.expected => gnu_ext_disabled_rightward_auto_ref.expected} (100%) rename tests/fixtures/ptx/{gnu_ext_disabled_roff_input_ref.expected => gnu_ext_disabled_rightward_input_ref.expected} (100%) rename tests/fixtures/ptx/{gnu_ext_disabled_roff_no_ref.expected => gnu_ext_disabled_rightward_no_ref.expected} (100%) rename tests/fixtures/ptx/{gnu_ext_disabled_roff_no_ref_word_regexp_exc_space.expected => gnu_ext_disabled_rightward_no_ref_word_regexp_exc_space.expected} (100%) diff --git a/tests/benches/factor/benches/gcd.rs b/tests/benches/factor/benches/gcd.rs index 803c37d3c..f2bae51c7 100644 --- a/tests/benches/factor/benches/gcd.rs +++ b/tests/benches/factor/benches/gcd.rs @@ -3,7 +3,7 @@ use uu_factor::numeric; fn gcd(c: &mut Criterion) { let inputs = { - // Deterministic RNG; use an explicitely-named RNG to guarantee stability + // Deterministic RNG; use an explicitly-named RNG to guarantee stability use rand::{RngCore, SeedableRng}; use rand_chacha::ChaCha8Rng; const SEED: u64 = 0xa_b4d_1dea_dead_cafe; diff --git a/tests/benches/factor/benches/table.rs b/tests/benches/factor/benches/table.rs index 0b31b2b4c..d8859d940 100644 --- a/tests/benches/factor/benches/table.rs +++ b/tests/benches/factor/benches/table.rs @@ -15,10 +15,10 @@ fn table(c: &mut Criterion) { CHUNK_SIZE ); let inputs = { - // Deterministic RNG; use an explicitely-named RNG to guarantee stability + // Deterministic RNG; use an explicitly-named RNG to guarantee stability use rand::{RngCore, SeedableRng}; use rand_chacha::ChaCha8Rng; - const SEED: u64 = 0xdead_bebe_ea75_cafe; + const SEED: u64 = 0xdead_bebe_ea75_cafe; // spell-checker:disable-line let mut rng = ChaCha8Rng::seed_from_u64(SEED); std::iter::repeat_with(move || array_init::<_, _, INPUT_SIZE>(|_| rng.next_u64())) diff --git a/tests/by-util/test_base32.rs b/tests/by-util/test_base32.rs index 788b85efa..8e3e780c5 100644 --- a/tests/by-util/test_base32.rs +++ b/tests/by-util/test_base32.rs @@ -14,14 +14,14 @@ fn test_encode() { new_ucmd!() .pipe_in(input) .succeeds() - .stdout_only("JBSWY3DPFQQFO33SNRSCC===\n"); + .stdout_only("JBSWY3DPFQQFO33SNRSCC===\n"); // spell-checker:disable-line // Using '-' as our file new_ucmd!() .arg("-") .pipe_in(input) .succeeds() - .stdout_only("JBSWY3DPFQQFO33SNRSCC===\n"); + .stdout_only("JBSWY3DPFQQFO33SNRSCC===\n"); // spell-checker:disable-line } #[test] @@ -29,13 +29,13 @@ fn test_base32_encode_file() { new_ucmd!() .arg("input-simple.txt") .succeeds() - .stdout_only("JBSWY3DPFQQFO33SNRSCCCQ=\n"); + .stdout_only("JBSWY3DPFQQFO33SNRSCCCQ=\n"); // spell-checker:disable-line } #[test] fn test_decode() { for decode_param in &["-d", "--decode"] { - let input = "JBSWY3DPFQQFO33SNRSCC===\n"; + let input = "JBSWY3DPFQQFO33SNRSCC===\n"; // spell-checker:disable-line new_ucmd!() .arg(decode_param) .pipe_in(input) @@ -46,7 +46,7 @@ fn test_decode() { #[test] fn test_garbage() { - let input = "aGVsbG8sIHdvcmxkIQ==\0"; + let input = "aGVsbG8sIHdvcmxkIQ==\0"; // spell-checker:disable-line new_ucmd!() .arg("-d") .pipe_in(input) @@ -57,7 +57,7 @@ fn test_garbage() { #[test] fn test_ignore_garbage() { for ignore_garbage_param in &["-i", "--ignore-garbage"] { - let input = "JBSWY\x013DPFQ\x02QFO33SNRSCC===\n"; + let input = "JBSWY\x013DPFQ\x02QFO33SNRSCC===\n"; // spell-checker:disable-line new_ucmd!() .arg("-d") .arg(ignore_garbage_param) @@ -77,7 +77,7 @@ fn test_wrap() { .pipe_in(input) .succeeds() .stdout_only( - "KRUGKIDROVUWG2ZAMJZG\n653OEBTG66BANJ2W24DT\nEBXXMZLSEB2GQZJANRQX\nU6JAMRXWOLQ=\n", + "KRUGKIDROVUWG2ZAMJZG\n653OEBTG66BANJ2W24DT\nEBXXMZLSEB2GQZJANRQX\nU6JAMRXWOLQ=\n", // spell-checker:disable-line ); } } diff --git a/tests/by-util/test_base64.rs b/tests/by-util/test_base64.rs index 75445c933..459845ccf 100644 --- a/tests/by-util/test_base64.rs +++ b/tests/by-util/test_base64.rs @@ -6,14 +6,14 @@ fn test_encode() { new_ucmd!() .pipe_in(input) .succeeds() - .stdout_only("aGVsbG8sIHdvcmxkIQ==\n"); + .stdout_only("aGVsbG8sIHdvcmxkIQ==\n"); // spell-checker:disable-line // Using '-' as our file new_ucmd!() .arg("-") .pipe_in(input) .succeeds() - .stdout_only("aGVsbG8sIHdvcmxkIQ==\n"); + .stdout_only("aGVsbG8sIHdvcmxkIQ==\n"); // spell-checker:disable-line } #[test] @@ -21,13 +21,13 @@ fn test_base64_encode_file() { new_ucmd!() .arg("input-simple.txt") .succeeds() - .stdout_only("SGVsbG8sIFdvcmxkIQo=\n"); + .stdout_only("SGVsbG8sIFdvcmxkIQo=\n"); // spell-checker:disable-line } #[test] fn test_decode() { for decode_param in &["-d", "--decode"] { - let input = "aGVsbG8sIHdvcmxkIQ=="; + let input = "aGVsbG8sIHdvcmxkIQ=="; // spell-checker:disable-line new_ucmd!() .arg(decode_param) .pipe_in(input) @@ -38,7 +38,7 @@ fn test_decode() { #[test] fn test_garbage() { - let input = "aGVsbG8sIHdvcmxkIQ==\0"; + let input = "aGVsbG8sIHdvcmxkIQ==\0"; // spell-checker:disable-line new_ucmd!() .arg("-d") .pipe_in(input) @@ -49,7 +49,7 @@ fn test_garbage() { #[test] fn test_ignore_garbage() { for ignore_garbage_param in &["-i", "--ignore-garbage"] { - let input = "aGVsbG8sIHdvcmxkIQ==\0"; + let input = "aGVsbG8sIHdvcmxkIQ==\0"; // spell-checker:disable-line new_ucmd!() .arg("-d") .arg(ignore_garbage_param) @@ -68,6 +68,7 @@ fn test_wrap() { .arg("20") .pipe_in(input) .succeeds() + // spell-checker:disable-next-line .stdout_only("VGhlIHF1aWNrIGJyb3du\nIGZveCBqdW1wcyBvdmVy\nIHRoZSBsYXp5IGRvZy4=\n"); } } diff --git a/tests/by-util/test_basename.rs b/tests/by-util/test_basename.rs index 50d22b2eb..d9632106e 100644 --- a/tests/by-util/test_basename.rs +++ b/tests/by-util/test_basename.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (words) reallylongexecutable + use crate::common::util::*; #[cfg(any(unix, target_os = "redox"))] use std::ffi::OsStr; @@ -50,7 +52,7 @@ fn test_remove_suffix() { } #[test] -fn test_dont_remove_suffix() { +fn test_do_not_remove_suffix() { new_ucmd!() .args(&["/foo/bar/baz", "baz"]) .succeeds() @@ -64,7 +66,7 @@ fn test_multiple_param() { new_ucmd!() .args(&[multiple_param, path, path]) .succeeds() - .stdout_only("baz\nbaz\n"); + .stdout_only("baz\nbaz\n"); // spell-checker:disable-line } } @@ -75,7 +77,7 @@ fn test_suffix_param() { new_ucmd!() .args(&[suffix_param, ".exe", path, path]) .succeeds() - .stdout_only("baz\nbaz\n"); + .stdout_only("baz\nbaz\n"); // spell-checker:disable-line } } diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index 8ea5bbaae..b00c58dc1 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -9,11 +9,12 @@ fn test_output_simple() { new_ucmd!() .args(&["alpha.txt"]) .succeeds() - .stdout_only("abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); + .stdout_only("abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); // spell-checker:disable-line } #[test] fn test_no_options() { + // spell-checker:disable-next-line for fixture in &["empty.txt", "alpha.txt", "nonewline.txt"] { // Give fixture through command line file argument new_ucmd!() @@ -66,8 +67,8 @@ fn test_fifo_symlink() { assert!(s.fixtures.is_fifo("dir/pipe")); // Make cat read the pipe through a symlink - s.fixtures.symlink_file("dir/pipe", "sympipe"); - let proc = s.ucmd().args(&["sympipe"]).run_no_wait(); + s.fixtures.symlink_file("dir/pipe", "sympipe"); // spell-checker:disable-line + let proc = s.ucmd().args(&["sympipe"]).run_no_wait(); // spell-checker:disable-line let data = vec_of_size(128 * 1024); let data2 = data.clone(); @@ -110,7 +111,7 @@ fn test_piped_to_regular_file() { .succeeds(); } let contents = read_to_string(&file_path).unwrap(); - assert_eq!(contents, "abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); + assert_eq!(contents, "abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); // spell-checker:disable-line } } @@ -169,6 +170,7 @@ fn test_directory() { fn test_directory_and_file() { let s = TestScenario::new(util_name!()); s.fixtures.mkdir("test_directory2"); + // spell-checker:disable-next-line for fixture in &["empty.txt", "alpha.txt", "nonewline.txt"] { s.ucmd() .args(&["test_directory2", fixture]) @@ -190,8 +192,8 @@ fn test_three_directories_and_file_and_stdin() { "test_directory3/test_directory4", "alpha.txt", "-", - "filewhichdoesnotexist.txt", - "nonewline.txt", + "file_which_does_not_exist.txt", + "nonewline.txt", // spell-checker:disable-line "test_directory3/test_directory5", "test_directory3/../test_directory3/test_directory5", "test_directory3", @@ -200,12 +202,13 @@ fn test_three_directories_and_file_and_stdin() { .fails() .stderr_is_fixture("three_directories_and_file_and_stdin.stderr.expected") .stdout_is( - "abcde\nfghij\nklmno\npqrst\nuvwxyz\nstdout bytestext without a trailing newline", + "abcde\nfghij\nklmno\npqrst\nuvwxyz\nstdout bytestext without a trailing newline", // spell-checker:disable-line ); } #[test] fn test_output_multi_files_print_all_chars() { + // spell-checker:disable new_ucmd!() .args(&["alpha.txt", "256.txt", "-A", "-n"]) .succeeds() @@ -222,10 +225,12 @@ fn test_output_multi_files_print_all_chars() { M-VM-WM-XM-YM-ZM-[M-\\M-]M-^M-_M-`M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-\ pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-zM-{M-|M-}M-~M-^?", ); + // spell-checker:enable } #[test] fn test_numbered_lines_no_trailing_newline() { + // spell-checker:disable new_ucmd!() .args(&["nonewline.txt", "alpha.txt", "-n"]) .succeeds() @@ -233,6 +238,7 @@ fn test_numbered_lines_no_trailing_newline() { " 1\ttext without a trailing newlineabcde\n 2\tfghij\n \ 3\tklmno\n 4\tpqrst\n 5\tuvwxyz\n", ); + // spell-checker:enable } #[test] @@ -310,6 +316,7 @@ fn test_stdin_squeeze_blank() { #[test] fn test_stdin_number_non_blank() { + // spell-checker:disable-next-line for same_param in &["-b", "--number-nonblank"] { new_ucmd!() .arg(same_param) @@ -322,6 +329,7 @@ fn test_stdin_number_non_blank() { #[test] fn test_non_blank_overrides_number() { + // spell-checker:disable-next-line for &same_param in &["-b", "--number-nonblank"] { new_ucmd!() .args(&[same_param, "-"]) diff --git a/tests/by-util/test_chgrp.rs b/tests/by-util/test_chgrp.rs index c0fc503ae..45380b80b 100644 --- a/tests/by-util/test_chgrp.rs +++ b/tests/by-util/test_chgrp.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (words) nosuchgroup + use crate::common::util::*; use rust_users::*; diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index 4611d1b96..186c645e5 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -21,7 +21,7 @@ struct TestCase { after: u32, } -fn mkfile(file: &str, mode: u32) { +fn make_file(file: &str, mode: u32) { OpenOptions::new() .mode(mode) .create(true) @@ -34,7 +34,7 @@ fn mkfile(file: &str, mode: u32) { } fn run_single_test(test: &TestCase, at: AtPath, mut ucmd: UCommand) { - mkfile(&at.plus_as_string(TEST_FILE), test.before); + make_file(&at.plus_as_string(TEST_FILE), test.before); let perms = at.metadata(TEST_FILE).permissions().mode(); if perms != test.before { panic!( @@ -123,6 +123,7 @@ fn test_chmod_octal() { #[test] #[allow(clippy::unreadable_literal)] +// spell-checker:disable-next-line fn test_chmod_ugoa() { let _guard = UMASK_MUTEX.lock(); @@ -283,7 +284,7 @@ fn test_chmod_reference_file() { }, ]; let (at, ucmd) = at_and_ucmd!(); - mkfile(&at.plus_as_string(REFERENCE_FILE), REFERENCE_PERMS); + make_file(&at.plus_as_string(REFERENCE_FILE), REFERENCE_PERMS); run_single_test(&tests[0], at, ucmd); } @@ -318,10 +319,10 @@ fn test_chmod_recursive() { at.mkdir("a/b"); at.mkdir("a/b/c"); at.mkdir("z"); - mkfile(&at.plus_as_string("a/a"), 0o100444); - mkfile(&at.plus_as_string("a/b/b"), 0o100444); - mkfile(&at.plus_as_string("a/b/c/c"), 0o100444); - mkfile(&at.plus_as_string("z/y"), 0o100444); + make_file(&at.plus_as_string("a/a"), 0o100444); + make_file(&at.plus_as_string("a/b/b"), 0o100444); + make_file(&at.plus_as_string("a/b/c/c"), 0o100444); + make_file(&at.plus_as_string("z/y"), 0o100444); ucmd.arg("-R") .arg("--verbose") @@ -351,9 +352,9 @@ fn test_chmod_non_existing_file() { .arg("-R") .arg("--verbose") .arg("-r,a+w") - .arg("dont-exist") + .arg("does-not-exist") .fails() - .stderr_contains(&"cannot access 'dont-exist': No such file or directory"); + .stderr_contains(&"cannot access 'does-not-exist': No such file or directory"); } #[test] @@ -432,6 +433,7 @@ fn test_chmod_symlink_non_existing_file_recursive() { .no_stdout(); let expected_stdout = &format!( + // spell-checker:disable-next-line "mode of '{}' retained as 0755 (rwxr-xr-x)\nneither symbolic link '{}/{}' nor referent has been changed", test_directory, test_directory, test_symlink ); @@ -473,8 +475,8 @@ fn test_chmod_strip_minus_from_mode() { ("chmod -c -R +w FILE ", "chmod -c -R +w FILE "), ("chmod a=r,=xX FILE", "chmod a=r,=xX FILE"), ( - "chmod -v --reference RFILE -R FILE", - "chmod -v --reference RFILE -R FILE", + "chmod -v --reference REF_FILE -R FILE", + "chmod -v --reference REF_FILE -R FILE", ), ("chmod -Rvc -w-x FILE", "chmod -Rvc w-x FILE"), ("chmod 755 -v FILE", "chmod 755 -v FILE"), diff --git a/tests/by-util/test_chown.rs b/tests/by-util/test_chown.rs index a531fc7f3..c8a8ea538 100644 --- a/tests/by-util/test_chown.rs +++ b/tests/by-util/test_chown.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (words) agroupthatdoesntexist auserthatdoesntexist groupname notexisting passgrp + use crate::common::util::*; #[cfg(target_os = "linux")] use rust_users::get_effective_uid; diff --git a/tests/by-util/test_chroot.rs b/tests/by-util/test_chroot.rs index 0479e7c3a..3bac07d44 100644 --- a/tests/by-util/test_chroot.rs +++ b/tests/by-util/test_chroot.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (words) araba newroot userspec + use crate::common::util::*; #[test] diff --git a/tests/by-util/test_cksum.rs b/tests/by-util/test_cksum.rs index 0fd028781..9590c1ac5 100644 --- a/tests/by-util/test_cksum.rs +++ b/tests/by-util/test_cksum.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (words) asdf + use crate::common::util::*; #[test] @@ -40,7 +42,7 @@ fn test_empty() { #[test] fn test_arg_overrides_stdin() { let (at, mut ucmd) = at_and_ucmd!(); - let input = "foobarfoobar"; + let input = "foobarfoobar"; // spell-checker:disable-line at.touch("a"); @@ -78,17 +80,17 @@ fn test_invalid_file() { } // Make sure crc is correct for files larger than 32 bytes -// but <128 bytes (1 fold pclmul) +// but <128 bytes (1 fold pclmul) // spell-checker:disable-line #[test] fn test_crc_for_bigger_than_32_bytes() { let (_, mut ucmd) = at_and_ucmd!(); let result = ucmd.arg("chars.txt").succeeds(); - let mut stdout_splitted = result.stdout_str().split(' '); + let mut stdout_split = result.stdout_str().split(' '); - let cksum: i64 = stdout_splitted.next().unwrap().parse().unwrap(); - let bytes_cnt: i64 = stdout_splitted.next().unwrap().parse().unwrap(); + let cksum: i64 = stdout_split.next().unwrap().parse().unwrap(); + let bytes_cnt: i64 = stdout_split.next().unwrap().parse().unwrap(); assert_eq!(cksum, 586_047_089); assert_eq!(bytes_cnt, 16); @@ -100,10 +102,10 @@ fn test_stdin_larger_than_128_bytes() { let result = ucmd.arg("larger_than_2056_bytes.txt").succeeds(); - let mut stdout_splitted = result.stdout_str().split(' '); + let mut stdout_split = result.stdout_str().split(' '); - let cksum: i64 = stdout_splitted.next().unwrap().parse().unwrap(); - let bytes_cnt: i64 = stdout_splitted.next().unwrap().parse().unwrap(); + let cksum: i64 = stdout_split.next().unwrap().parse().unwrap(); + let bytes_cnt: i64 = stdout_split.next().unwrap().parse().unwrap(); assert_eq!(cksum, 945_881_979); assert_eq!(bytes_cnt, 2058); diff --git a/tests/by-util/test_comm.rs b/tests/by-util/test_comm.rs index fa8c8beca..ba26f6819 100644 --- a/tests/by-util/test_comm.rs +++ b/tests/by-util/test_comm.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (words) defaultcheck nocheck + use crate::common::util::*; #[test] @@ -33,19 +35,19 @@ fn ab_dash_three() { } #[test] -fn aempty() { +fn a_empty() { new_ucmd!() .args(&["a", "empty"]) .succeeds() - .stdout_only_fixture("aempty.expected"); + .stdout_only_fixture("aempty.expected"); // spell-checker:disable-line } #[test] -fn emptyempty() { +fn empty_empty() { new_ucmd!() .args(&["empty", "empty"]) .succeeds() - .stdout_only_fixture("emptyempty.expected"); + .stdout_only_fixture("emptyempty.expected"); // spell-checker:disable-line } #[cfg_attr(not(feature = "test_unimplemented"), ignore)] @@ -68,8 +70,8 @@ fn output_delimiter_require_arg() { // even though (info) documentation suggests this is an option // in latest GNU Coreutils comm, it actually is not. -// this test is essentially an alarm in case someone well-intendingly -// implements it. +// this test is essentially an alarm in case some well-intending +// developer implements it. //marked as unimplemented as error message not set yet. #[cfg_attr(not(feature = "test_unimplemented"), ignore)] #[test] diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index e4d7fdea7..e995cc56c 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (flags) reflink (fs) tmpfs + use crate::common::util::*; #[cfg(not(windows))] use std::fs::set_permissions; @@ -926,7 +928,7 @@ fn test_cp_archive() { let (at, mut ucmd) = at_and_ucmd!(); let ts = time::now().to_timespec(); let previous = FileTime::from_unix_time(ts.sec as i64 - 3600, ts.nsec as u32); - // set the file creation/modif an hour ago + // set the file creation/modification an hour ago filetime::set_file_times( at.plus_as_string(TEST_HELLO_WORLD_SOURCE), previous, @@ -1055,7 +1057,7 @@ fn test_cp_preserve_timestamps() { let (at, mut ucmd) = at_and_ucmd!(); let ts = time::now().to_timespec(); let previous = FileTime::from_unix_time(ts.sec as i64 - 3600, ts.nsec as u32); - // set the file creation/modif an hour ago + // set the file creation/modification an hour ago filetime::set_file_times( at.plus_as_string(TEST_HELLO_WORLD_SOURCE), previous, @@ -1084,11 +1086,11 @@ fn test_cp_preserve_timestamps() { #[test] #[cfg(target_os = "linux")] -fn test_cp_dont_preserve_timestamps() { +fn test_cp_no_preserve_timestamps() { let (at, mut ucmd) = at_and_ucmd!(); let ts = time::now().to_timespec(); let previous = FileTime::from_unix_time(ts.sec as i64 - 3600, ts.nsec as u32); - // set the file creation/modif an hour ago + // set the file creation/modification an hour ago filetime::set_file_times( at.plus_as_string(TEST_HELLO_WORLD_SOURCE), previous, @@ -1181,7 +1183,7 @@ fn test_cp_one_file_system() { scene.cmd("umount").arg(mountpoint_path).succeeds(); assert!(!at_dst.file_exists(TEST_MOUNT_OTHER_FILESYSTEM_FILE)); - // Check if the other files were copied from the source folder hirerarchy + // Check if the other files were copied from the source folder hierarchy for entry in WalkDir::new(at_src.as_string()) { let entry = entry.unwrap(); let relative_src = entry diff --git a/tests/by-util/test_csplit.rs b/tests/by-util/test_csplit.rs index ae0885ff8..7eeb584eb 100644 --- a/tests/by-util/test_csplit.rs +++ b/tests/by-util/test_csplit.rs @@ -904,7 +904,7 @@ fn test_no_match() { } #[test] -fn test_too_small_linenum() { +fn test_too_small_line_num() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "/20/", "10", "/40/"]) .succeeds() @@ -921,7 +921,7 @@ fn test_too_small_linenum() { } #[test] -fn test_too_small_linenum_equal() { +fn test_too_small_line_num_equal() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "/20/", "20"]) .succeeds() @@ -937,7 +937,7 @@ fn test_too_small_linenum_equal() { } #[test] -fn test_too_small_linenum_elided() { +fn test_too_small_line_num_elided() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "-z", "/20/", "10", "/40/"]) .succeeds() @@ -953,7 +953,7 @@ fn test_too_small_linenum_elided() { } #[test] -fn test_too_small_linenum_negative_offset() { +fn test_too_small_line_num_negative_offset() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "/20/-5", "10", "/40/"]) .succeeds() @@ -970,7 +970,7 @@ fn test_too_small_linenum_negative_offset() { } #[test] -fn test_too_small_linenum_twice() { +fn test_too_small_line_num_twice() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "/20/", "10", "15", "/40/"]) .succeeds() @@ -988,7 +988,7 @@ fn test_too_small_linenum_twice() { } #[test] -fn test_too_small_linenum_repeat() { +fn test_too_small_line_num_repeat() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "/20/", "10", "{*}"]) .fails() @@ -1020,7 +1020,7 @@ fn test_too_small_linenum_repeat() { } #[test] -fn test_linenum_out_of_range1() { +fn test_line_num_out_of_range1() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "100"]) .fails() @@ -1046,7 +1046,7 @@ fn test_linenum_out_of_range1() { } #[test] -fn test_linenum_out_of_range2() { +fn test_line_num_out_of_range2() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "10", "100"]) .fails() @@ -1073,7 +1073,7 @@ fn test_linenum_out_of_range2() { } #[test] -fn test_linenum_out_of_range3() { +fn test_line_num_out_of_range3() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "40", "{2}"]) .fails() @@ -1100,7 +1100,7 @@ fn test_linenum_out_of_range3() { } #[test] -fn test_linenum_out_of_range4() { +fn test_line_num_out_of_range4() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "40", "{*}"]) .fails() @@ -1141,7 +1141,7 @@ fn test_skip_to_match_negative_offset_before_a_match() { } #[test] -fn test_skip_to_match_negative_offset_before_a_linenum() { +fn test_skip_to_match_negative_offset_before_a_line_num() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "/20/-10", "15"]) .succeeds() @@ -1247,7 +1247,7 @@ fn test_up_to_match_context_underflow() { // the offset is out of range because of the first pattern // NOTE: output different than gnu's: the empty split is written but the rest of the input file is not #[test] -fn test_linenum_range_with_up_to_match1() { +fn test_line_num_range_with_up_to_match1() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "10", "/12/-5"]) .fails() @@ -1277,7 +1277,7 @@ fn test_linenum_range_with_up_to_match1() { // the offset is out of range because more lines are needed than physically available // NOTE: output different than gnu's: the empty split is not written but the rest of the input file is #[test] -fn test_linenum_range_with_up_to_match2() { +fn test_line_num_range_with_up_to_match2() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "10", "/12/-15"]) .fails() @@ -1306,7 +1306,7 @@ fn test_linenum_range_with_up_to_match2() { // NOTE: output different than gnu's: the pattern /10/ is matched but should not #[test] -fn test_linenum_range_with_up_to_match3() { +fn test_line_num_range_with_up_to_match3() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.args(&["numbers50.txt", "10", "/10/", "-k"]) .fails() diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index f4990566a..9689ff49e 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -181,7 +181,7 @@ fn test_date_set_valid_2() { if get_effective_uid() == 0 { let result = new_ucmd!() .arg("--set") - .arg("Sat 20 Mar 2021 14:53:01 AWST") + .arg("Sat 20 Mar 2021 14:53:01 AWST") // spell-checker:disable-line .fails(); result.no_stdout(); assert!(result.stderr_str().starts_with("date: invalid date ")); diff --git a/tests/by-util/test_dircolors.rs b/tests/by-util/test_dircolors.rs index f28074075..86b72d23b 100644 --- a/tests/by-util/test_dircolors.rs +++ b/tests/by-util/test_dircolors.rs @@ -30,14 +30,14 @@ fn test_shell_syntax() { } #[test] -fn test_strutils() { +fn test_str_utils() { let s = " asd#zcv #hk\t\n "; assert_eq!("asd#zcv", s.purify()); let s = "con256asd"; - assert!(s.fnmatch("*[2][3-6][5-9]?sd")); + assert!(s.fnmatch("*[2][3-6][5-9]?sd")); // spell-checker:disable-line - let s = "zxc \t\nqwe jlk hjl"; + let s = "zxc \t\nqwe jlk hjl"; // spell-checker:disable-line let (k, v) = s.split_two(); assert_eq!("zxc", k); assert_eq!("qwe jlk hjl", v); diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index e4dca7a61..9e585b03e 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (paths) sublink subwords + use crate::common::util::*; const SUB_DIR: &str = "subdir/deeper"; diff --git a/tests/by-util/test_echo.rs b/tests/by-util/test_echo.rs index 5d1b68e6c..483ad99f5 100644 --- a/tests/by-util/test_echo.rs +++ b/tests/by-util/test_echo.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (words) araba merci + use crate::common::util::*; #[test] @@ -185,9 +187,9 @@ fn test_multiple_hyphen_values() { #[test] fn test_hyphen_values_inside_string() { new_ucmd!() - .arg("'\"\n'CXXFLAGS=-g -O2'\n\"'") + .arg("'\"\n'CXXFLAGS=-g -O2'\n\"'") // spell-checker:disable-line .succeeds() - .stdout_contains("CXXFLAGS"); + .stdout_contains("CXXFLAGS"); // spell-checker:disable-line } #[test] diff --git a/tests/by-util/test_env.rs b/tests/by-util/test_env.rs index 23bba57a9..4db3b59bd 100644 --- a/tests/by-util/test_env.rs +++ b/tests/by-util/test_env.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (words) bamf chdir + #[cfg(not(windows))] use std::fs; diff --git a/tests/by-util/test_factor.rs b/tests/by-util/test_factor.rs index 917d19a49..063cf0e4f 100644 --- a/tests/by-util/test_factor.rs +++ b/tests/by-util/test_factor.rs @@ -6,6 +6,8 @@ // that was distributed with this source code. #![allow(clippy::unreadable_literal)] +// spell-checker:ignore (methods) hexdigest + use crate::common::util::*; use std::time::SystemTime; @@ -27,13 +29,13 @@ fn test_first_100000_integers() { extern crate sha1; let n_integers = 100_000; - let mut instring = String::new(); + let mut input_string = String::new(); for i in 0..=n_integers { - instring.push_str(&(format!("{} ", i))[..]); + input_string.push_str(&(format!("{} ", i))[..]); } - println!("STDIN='{}'", instring); - let result = new_ucmd!().pipe_in(instring.as_bytes()).succeeds(); + println!("STDIN='{}'", input_string); + let result = new_ucmd!().pipe_in(input_string.as_bytes()).succeeds(); // `seq 0 100000 | factor | sha1sum` => "4ed2d8403934fa1c76fe4b84c5d4b8850299c359" let hash_check = sha1::Sha1::from(result.stdout()).hexdigest(); @@ -95,20 +97,20 @@ fn test_random() { }; // build an input and expected output string from factor - let mut instring = String::new(); - let mut outstring = String::new(); + let mut input_string = String::new(); + let mut output_string = String::new(); for _ in 0..NUM_TESTS { let (product, factors) = rand_gt(1 << 63); - instring.push_str(&(format!("{} ", product))[..]); + input_string.push_str(&(format!("{} ", product))[..]); - outstring.push_str(&(format!("{}:", product))[..]); + output_string.push_str(&(format!("{}:", product))[..]); for factor in factors { - outstring.push_str(&(format!(" {}", factor))[..]); + output_string.push_str(&(format!(" {}", factor))[..]); } - outstring.push('\n'); + output_string.push('\n'); } - run(instring.as_bytes(), outstring.as_bytes()); + run(input_string.as_bytes(), output_string.as_bytes()); } #[test] @@ -120,30 +122,30 @@ fn test_random_big() { println!("rng_seed={:?}", rng_seed); let mut rng = SmallRng::seed_from_u64(rng_seed); - let bitrange_1 = Uniform::new(14_usize, 51); + let bit_range_1 = Uniform::new(14_usize, 51); let mut rand_64 = move || { // first, choose a random number of bits for the first factor - let f_bit_1 = bitrange_1.sample(&mut rng); + let f_bit_1 = bit_range_1.sample(&mut rng); // how many more bits do we need? let rem = 64 - f_bit_1; - // we will have a number of additional factors equal to nfacts + 1 - // where nfacts is in [0, floor(rem/14) ) NOTE half-open interval + // we will have a number of additional factors equal to n_facts + 1 + // where n_facts is in [0, floor(rem/14) ) NOTE half-open interval // Each prime factor is at least 14 bits, hence floor(rem/14) - let nfacts = Uniform::new(0_usize, rem / 14).sample(&mut rng); - // we have to distribute extrabits among the (nfacts + 1) values - let extrabits = rem - (nfacts + 1) * 14; + let n_factors = Uniform::new(0_usize, rem / 14).sample(&mut rng); + // we have to distribute extra_bits among the (n_facts + 1) values + let extra_bits = rem - (n_factors + 1) * 14; // (remember, a Range is a half-open interval) - let extrarange = Uniform::new(0_usize, extrabits + 1); + let extra_range = Uniform::new(0_usize, extra_bits + 1); // to generate an even split of this range, generate n-1 random elements // in the range, add the desired total value to the end, sort this list, // and then compute the sequential differences. let mut f_bits = Vec::new(); - for _ in 0..nfacts { - f_bits.push(extrarange.sample(&mut rng)); + for _ in 0..n_factors { + f_bits.push(extra_range.sample(&mut rng)); } - f_bits.push(extrabits); + f_bits.push(extra_bits); f_bits.sort_unstable(); // compute sequential differences here. We leave off the +14 bits @@ -160,59 +162,59 @@ fn test_random_big() { f_bits.push(f_bit_1 - 14); // index of f_bit_1 in PRIMES_BY_BITS let f_bits = f_bits; - let mut nbits = 0; + let mut n_bits = 0; let mut product = 1_u64; let mut factors = Vec::new(); for bit in f_bits { assert!(bit < 37); - nbits += 14 + bit; + n_bits += 14 + bit; let elm = Uniform::new(0, PRIMES_BY_BITS[bit].len()).sample(&mut rng); let factor = PRIMES_BY_BITS[bit][elm]; factors.push(factor); product *= factor; } - assert_eq!(nbits, 64); + assert_eq!(n_bits, 64); factors.sort_unstable(); (product, factors) }; - let mut instring = String::new(); - let mut outstring = String::new(); + let mut input_string = String::new(); + let mut output_string = String::new(); for _ in 0..NUM_TESTS { let (product, factors) = rand_64(); - instring.push_str(&(format!("{} ", product))[..]); + input_string.push_str(&(format!("{} ", product))[..]); - outstring.push_str(&(format!("{}:", product))[..]); + output_string.push_str(&(format!("{}:", product))[..]); for factor in factors { - outstring.push_str(&(format!(" {}", factor))[..]); + output_string.push_str(&(format!(" {}", factor))[..]); } - outstring.push('\n'); + output_string.push('\n'); } - run(instring.as_bytes(), outstring.as_bytes()); + run(input_string.as_bytes(), output_string.as_bytes()); } #[test] fn test_big_primes() { - let mut instring = String::new(); - let mut outstring = String::new(); + let mut input_string = String::new(); + let mut output_string = String::new(); for prime in PRIMES64 { - instring.push_str(&(format!("{} ", prime))[..]); - outstring.push_str(&(format!("{0}: {0}\n", prime))[..]); + input_string.push_str(&(format!("{} ", prime))[..]); + output_string.push_str(&(format!("{0}: {0}\n", prime))[..]); } - run(instring.as_bytes(), outstring.as_bytes()); + run(input_string.as_bytes(), output_string.as_bytes()); } -fn run(instring: &[u8], outstring: &[u8]) { - println!("STDIN='{}'", String::from_utf8_lossy(instring)); - println!("STDOUT(expected)='{}'", String::from_utf8_lossy(outstring)); +fn run(input_string: &[u8], output_string: &[u8]) { + println!("STDIN='{}'", String::from_utf8_lossy(input_string)); + println!("STDOUT(expected)='{}'", String::from_utf8_lossy(output_string)); // now run factor new_ucmd!() - .pipe_in(instring) + .pipe_in(input_string) .run() - .stdout_is(String::from_utf8(outstring.to_owned()).unwrap()); + .stdout_is(String::from_utf8(output_string.to_owned()).unwrap()); } const PRIMES_BY_BITS: &[&[u64]] = &[ diff --git a/tests/by-util/test_fold.rs b/tests/by-util/test_fold.rs index 5224a50dc..62a2bddf3 100644 --- a/tests/by-util/test_fold.rs +++ b/tests/by-util/test_fold.rs @@ -282,7 +282,7 @@ fn test_backspace_is_not_word_boundary() { .args(&["-w10", "-s"]) .pipe_in("foobar\x086789abcdef") .succeeds() - .stdout_is("foobar\x086789a\nbcdef"); + .stdout_is("foobar\x086789a\nbcdef"); // spell-checker:disable-line } #[test] @@ -291,7 +291,7 @@ fn test_carriage_return_should_be_preserved() { } #[test] -fn test_carriage_return_overwrriten_char_should_be_preserved() { +fn test_carriage_return_overwritten_char_should_be_preserved() { new_ucmd!().pipe_in("x\ry").succeeds().stdout_is("x\ry"); } @@ -308,9 +308,9 @@ fn test_carriage_return_should_reset_column_count() { fn test_carriage_return_is_not_word_boundary() { new_ucmd!() .args(&["-w6", "-s"]) - .pipe_in("fizz\rbuzz\rfizzbuzz") + .pipe_in("fizz\rbuzz\rfizzbuzz") // spell-checker:disable-line .succeeds() - .stdout_is("fizz\rbuzz\rfizzbu\nzz"); + .stdout_is("fizz\rbuzz\rfizzbu\nzz"); // spell-checker:disable-line } // @@ -496,7 +496,7 @@ fn test_bytewise_backspace_is_not_word_boundary() { .args(&["-w10", "-s", "-b"]) .pipe_in("foobar\x0889abcdef") .succeeds() - .stdout_is("foobar\x0889a\nbcdef"); + .stdout_is("foobar\x0889a\nbcdef"); // spell-checker:disable-line } #[test] @@ -509,7 +509,7 @@ fn test_bytewise_carriage_return_should_be_preserved() { } #[test] -fn test_bytewise_carriage_return_overwrriten_char_should_be_preserved() { +fn test_bytewise_carriage_return_overwritten_char_should_be_preserved() { new_ucmd!() .arg("-b") .pipe_in("x\ry") @@ -530,9 +530,9 @@ fn test_bytewise_carriage_return_should_not_reset_column_count() { fn test_bytewise_carriage_return_is_not_word_boundary() { new_ucmd!() .args(&["-w6", "-s", "-b"]) - .pipe_in("fizz\rbuzz\rfizzbuzz") + .pipe_in("fizz\rbuzz\rfizzbuzz") // spell-checker:disable-line .succeeds() - .stdout_is("fizz\rb\nuzz\rfi\nzzbuzz"); + .stdout_is("fizz\rb\nuzz\rfi\nzzbuzz"); // spell-checker:disable-line } #[test] fn test_obsolete_syntax() { diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index cf7c9c2ee..7daa80e3a 100755 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (words) bogusfile emptyfile + use crate::common::util::*; static INPUT: &str = "lorem_ipsum.txt"; diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 6da357170..3ab5cbdfb 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (words) helloworld objdump + use crate::common::util::*; use filetime::FileTime; use rust_users::*; diff --git a/tests/by-util/test_join.rs b/tests/by-util/test_join.rs index a8f046851..8dbdadba7 100644 --- a/tests/by-util/test_join.rs +++ b/tests/by-util/test_join.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (words) autoformat + use crate::common::util::*; #[test] @@ -141,7 +143,7 @@ fn new_line_separated() { } #[test] -fn multitab_character() { +fn tab_multi_character() { new_ucmd!() .arg("semicolon_fields_1.txt") .arg("semicolon_fields_2.txt") diff --git a/tests/by-util/test_kill.rs b/tests/by-util/test_kill.rs index 637aea9a2..886445109 100644 --- a/tests/by-util/test_kill.rs +++ b/tests/by-util/test_kill.rs @@ -79,9 +79,10 @@ fn test_kill_list_one_signal_from_name() { #[test] fn test_kill_set_bad_signal_name() { + // spell-checker:disable-line new_ucmd!() .arg("-s") - .arg("IAMNOTASIGNAL") + .arg("IAMNOTASIGNAL") // spell-checker:disable-line .fails() .stderr_contains("unknown signal"); } diff --git a/tests/by-util/test_ln.rs b/tests/by-util/test_ln.rs index f2508ecbf..4dc50566b 100644 --- a/tests/by-util/test_ln.rs +++ b/tests/by-util/test_ln.rs @@ -65,10 +65,10 @@ fn test_symlink_circular() { } #[test] -fn test_symlink_dont_overwrite() { +fn test_symlink_do_not_overwrite() { let (at, mut ucmd) = at_and_ucmd!(); - let file = "test_symlink_dont_overwrite"; - let link = "test_symlink_dont_overwrite_link"; + let file = "test_symlink_do_not_overwrite"; + let link = "test_symlink_do_not_overwrite_link"; at.touch(file); at.touch(link); @@ -120,7 +120,7 @@ fn test_symlink_interactive() { scene .ucmd() .args(&["-i", "-s", file, link]) - .pipe_in("Yesh") + .pipe_in("Yesh") // spell-checker:disable-line .succeeds() .no_stderr(); diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 9614f561e..dd6e4a85d 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (words) READMECAREFULLY birthtime doesntexist oneline somebackup somefile somegroup somehiddenbackup somehiddenfile + #[cfg(unix)] extern crate unix_socket; use crate::common::util::*; @@ -939,7 +941,7 @@ fn test_ls_color() { let a_with_colors = "\x1b[1;34ma\x1b[0m"; let z_with_colors = "\x1b[1;34mz\x1b[0m"; - let nested_dir_with_colors = "\x1b[1;34mnested_dir\x1b[0m"; + let nested_dir_with_colors = "\x1b[1;34mnested_dir\x1b[0m"; // spell-checker:disable-line // Color is disabled by default let result = scene.ucmd().succeeds(); diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index d0737764f..e61d45428 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (words) gpghome + use crate::common::util::*; use std::path::PathBuf; @@ -8,8 +10,8 @@ static TEST_TEMPLATE2: &str = "temp"; static TEST_TEMPLATE3: &str = "tempX"; static TEST_TEMPLATE4: &str = "tempXX"; static TEST_TEMPLATE5: &str = "tempXXX"; -static TEST_TEMPLATE6: &str = "tempXXXlate"; -static TEST_TEMPLATE7: &str = "XXXtemplate"; +static TEST_TEMPLATE6: &str = "tempXXXlate"; // spell-checker:disable-line +static TEST_TEMPLATE7: &str = "XXXtemplate"; // spell-checker:disable-line #[cfg(unix)] static TEST_TEMPLATE8: &str = "tempXXXl/ate"; #[cfg(windows)] diff --git a/tests/by-util/test_more.rs b/tests/by-util/test_more.rs index cc778f0b4..69499ccfe 100644 --- a/tests/by-util/test_more.rs +++ b/tests/by-util/test_more.rs @@ -10,7 +10,7 @@ fn test_more_no_arg() { #[test] fn test_more_dir_arg() { - // Run the test only if there's a valud terminal, else do nothing + // Run the test only if there's a valid terminal, else do nothing // Maybe we could capture the error, i.e. "Device not found" in that case // but I am leaving this for later if atty::is(atty::Stream::Stdout) { diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index beb8f61b9..2782ac246 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -171,7 +171,7 @@ fn test_mv_interactive() { .arg("-i") .arg(file_a) .arg(file_b) - .pipe_in("Yesh") + .pipe_in("Yesh") // spell-checker:disable-line .succeeds() .no_stderr(); diff --git a/tests/by-util/test_nice.rs b/tests/by-util/test_nice.rs index 9e004b98b..005651c52 100644 --- a/tests/by-util/test_nice.rs +++ b/tests/by-util/test_nice.rs @@ -17,7 +17,7 @@ fn test_negative_adjustment() { let res = new_ucmd!().args(&["-n", "-1", "true"]).run(); assert!(res .stderr_str() - .starts_with("nice: warning: setpriority: Permission denied")); + .starts_with("nice: warning: setpriority: Permission denied")); // spell-checker:disable-line } #[test] diff --git a/tests/by-util/test_nl.rs b/tests/by-util/test_nl.rs index 3ca039d19..ce3014311 100644 --- a/tests/by-util/test_nl.rs +++ b/tests/by-util/test_nl.rs @@ -1,7 +1,7 @@ use crate::common::util::*; #[test] -fn test_stdin_nonewline() { +fn test_stdin_no_newline() { new_ucmd!() .pipe_in("No Newline") .run() @@ -41,6 +41,7 @@ fn test_padding_with_overflow() { #[test] fn test_sections_and_styles() { + // spell-checker:disable for &(fixture, output) in &[ ( "section.txt", @@ -63,4 +64,5 @@ fn test_sections_and_styles() { .run() .stdout_is(output); } + // spell-checker:enable } diff --git a/tests/by-util/test_numfmt.rs b/tests/by-util/test_numfmt.rs index b52dbc359..bb29d431e 100644 --- a/tests/by-util/test_numfmt.rs +++ b/tests/by-util/test_numfmt.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (paths) gnutest + use crate::common::util::*; #[test] @@ -231,7 +233,7 @@ fn test_should_skip_leading_space_from_stdin() { .run() .stdout_is("2048\n"); - // multiline + // multi-line new_ucmd!() .args(&["--from=auto"]) .pipe_in("\t1Ki\n 2K") diff --git a/tests/by-util/test_od.rs b/tests/by-util/test_od.rs index fa947aa6e..6b1c39d63 100644 --- a/tests/by-util/test_od.rs +++ b/tests/by-util/test_od.rs @@ -8,7 +8,7 @@ use std::fs::File; use std::io::Write; use std::path::Path; -// octal dump of 'abcdefghijklmnopqrstuvwxyz\n' +// octal dump of 'abcdefghijklmnopqrstuvwxyz\n' // spell-checker:disable-line static ALPHA_OUT: &str = " 0000000 061141 062143 063145 064147 065151 066153 067155 070157 0000020 071161 072163 073165 074167 075171 000012 @@ -16,7 +16,7 @@ static ALPHA_OUT: &str = " "; // XXX We could do a better job of ensuring that we have a fresh temp dir to ourselves, -// not a general one full of other proc's leftovers. +// not a general one full of other process leftovers. // Test that od can read one file and dump with default format #[test] @@ -29,6 +29,7 @@ fn test_file() { { let mut f = File::create(&file).unwrap(); + // spell-checker:disable-next-line if f.write_all(b"abcdefghijklmnopqrstuvwxyz\n").is_err() { panic!("Test setup failed - could not write file"); } @@ -55,6 +56,7 @@ fn test_2files() { println!("number: {} letter:{}", n, a); } + // spell-checker:disable-next-line for &(path, data) in &[(&file1, "abcdefghijklmnop"), (&file2, "qrstuvwxyz\n")] { let mut f = File::create(&path).unwrap(); if f.write_all(data.as_bytes()).is_err() { @@ -79,7 +81,7 @@ fn test_2files() { fn test_no_file() { let temp = env::temp_dir(); let tmpdir = Path::new(&temp); - let file = tmpdir.join("}surely'none'would'thus'a'file'name"); + let file = tmpdir.join("}surely'none'would'thus'a'file'name"); // spell-checker:disable-line new_ucmd!().arg(file.as_os_str()).fails(); } @@ -87,7 +89,7 @@ fn test_no_file() { // Test that od reads from stdin instead of a file #[test] fn test_from_stdin() { - let input = "abcdefghijklmnopqrstuvwxyz\n"; + let input = "abcdefghijklmnopqrstuvwxyz\n"; // spell-checker:disable-line new_ucmd!() .arg("--endian=little") .run_piped_stdin(input.as_bytes()) @@ -104,6 +106,7 @@ fn test_from_mixed() { let file1 = tmpdir.join("test-1"); let file3 = tmpdir.join("test-3"); + // spell-checker:disable-next-line let (data1, data2, data3) = ("abcdefg", "hijklmnop", "qrstuvwxyz\n"); for &(path, data) in &[(&file1, data1), (&file3, data3)] { let mut f = File::create(&path).unwrap(); @@ -125,7 +128,7 @@ fn test_from_mixed() { #[test] fn test_multiple_formats() { - let input = "abcdefghijklmnopqrstuvwxyz\n"; + let input = "abcdefghijklmnopqrstuvwxyz\n"; // spell-checker:disable-line new_ucmd!() .arg("-c") .arg("-b") @@ -145,6 +148,7 @@ fn test_multiple_formats() { #[test] fn test_dec() { + // spell-checker:ignore (words) 0xffu8 xffu let input = [ 0u8, 0u8, 1u8, 0u8, 2u8, 0u8, 3u8, 0u8, 0xffu8, 0x7fu8, 0x00u8, 0x80u8, 0x01u8, 0x80u8, ]; @@ -166,12 +170,14 @@ fn test_dec() { #[test] fn test_hex16() { let input: [u8; 9] = [0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xff]; + // spell-checker:disable let expected_output = unindent( " 0000000 2301 6745 ab89 efcd 00ff 0000011 ", ); + // spell-checker:enable new_ucmd!() .arg("--endian=little") .arg("-x") @@ -288,7 +294,7 @@ fn test_multibyte() { new_ucmd!() .arg("-c") .arg("-w12") - .run_piped_stdin("Universität Tübingen \u{1B000}".as_bytes()) + .run_piped_stdin("Universität Tübingen \u{1B000}".as_bytes()) // spell-checker:disable-line .success() .no_stderr() .stdout_is(unindent( @@ -487,7 +493,7 @@ fn test_alignment_Fx() { } #[test] -fn test_maxuint() { +fn test_max_uint() { let input = [0xFFu8; 8]; let expected_output = unindent( " @@ -505,7 +511,7 @@ fn test_maxuint() { new_ucmd!() .arg("--format=o8") - .arg("-Oobtu8") + .arg("-Oobtu8") // spell-checker:disable-line .arg("-Dd") .arg("--format=u1") .run_piped_stdin(&input[..]) @@ -583,7 +589,7 @@ fn test_invalid_offset() { #[test] fn test_skip_bytes() { - let input = "abcdefghijklmnopq"; + let input = "abcdefghijklmnopq"; // spell-checker:disable-line new_ucmd!() .arg("-c") .arg("--skip-bytes=5") @@ -609,7 +615,7 @@ fn test_skip_bytes_error() { #[test] fn test_read_bytes() { - let input = "abcdefghijklmnopqrstuvwxyz\n12345678"; + let input = "abcdefghijklmnopqrstuvwxyz\n12345678"; // spell-checker:disable-line new_ucmd!() .arg("--endian=little") .arg("--read-bytes=27") @@ -626,7 +632,7 @@ fn test_ascii_dump() { 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0xff, ]; new_ucmd!() - .arg("-tx1zacz") + .arg("-tx1zacz") // spell-checker:disable-line .run_piped_stdin(&input[..]) .no_stderr() .success() @@ -645,7 +651,7 @@ fn test_ascii_dump() { #[test] fn test_filename_parsing() { - // files "a" and "x" both exists, but are no filenames in the commandline below + // files "a" and "x" both exists, but are no filenames in the command line below // "-f" must be treated as a filename, it contains the text: minus lowercase f // so "-f" should not be interpreted as a formatting option. new_ucmd!() @@ -668,7 +674,7 @@ fn test_filename_parsing() { #[test] fn test_stdin_offset() { - let input = "abcdefghijklmnopq"; + let input = "abcdefghijklmnopq"; // spell-checker:disable-line new_ucmd!() .arg("-c") .arg("+5") @@ -703,7 +709,7 @@ fn test_file_offset() { #[test] fn test_traditional() { // note gnu od does not align both lines - let input = "abcdefghijklmnopq"; + let input = "abcdefghijklmnopq"; // spell-checker:disable-line new_ucmd!() .arg("--traditional") .arg("-a") @@ -726,7 +732,7 @@ fn test_traditional() { #[test] fn test_traditional_with_skip_bytes_override() { // --skip-bytes is ignored in this case - let input = "abcdefghijklmnop"; + let input = "abcdefghijklmnop"; // spell-checker:disable-line new_ucmd!() .arg("--traditional") .arg("--skip-bytes=10") @@ -746,7 +752,7 @@ fn test_traditional_with_skip_bytes_override() { #[test] fn test_traditional_with_skip_bytes_non_override() { // no offset specified in the traditional way, so --skip-bytes is used - let input = "abcdefghijklmnop"; + let input = "abcdefghijklmnop"; // spell-checker:disable-line new_ucmd!() .arg("--traditional") .arg("--skip-bytes=10") @@ -776,7 +782,7 @@ fn test_traditional_error() { #[test] fn test_traditional_only_label() { - let input = "abcdefghijklmnopqrstuvwxyz"; + let input = "abcdefghijklmnopqrstuvwxyz"; // spell-checker:disable-line new_ucmd!() .arg("-An") .arg("--traditional") diff --git a/tests/by-util/test_pinky.rs b/tests/by-util/test_pinky.rs index ccabb7345..c3c9ea2e4 100644 --- a/tests/by-util/test_pinky.rs +++ b/tests/by-util/test_pinky.rs @@ -9,24 +9,24 @@ pub use self::pinky::*; #[test] fn test_capitalize() { - assert_eq!("Zbnmasd", "zbnmasd".capitalize()); - assert_eq!("Abnmasd", "Abnmasd".capitalize()); - assert_eq!("1masd", "1masd".capitalize()); + assert_eq!("Zbnmasd", "zbnmasd".capitalize()); // spell-checker:disable-line + assert_eq!("Abnmasd", "Abnmasd".capitalize()); // spell-checker:disable-line + assert_eq!("1masd", "1masd".capitalize()); // spell-checker:disable-line assert_eq!("", "".capitalize()); } #[test] fn test_long_format() { - let ulogin = "root"; - let pw: Passwd = Passwd::locate(ulogin).unwrap(); + let login = "root"; + let pw: Passwd = Passwd::locate(login).unwrap(); let real_name = pw.user_info().replace("&", &pw.name().capitalize()); new_ucmd!() .arg("-l") - .arg(ulogin) + .arg(login) .succeeds() .stdout_is(format!( "Login name: {:<28}In real life: {}\nDirectory: {:<29}Shell: {}\n\n", - ulogin, + login, real_name, pw.user_dir(), pw.user_shell() @@ -34,11 +34,11 @@ fn test_long_format() { new_ucmd!() .arg("-lb") - .arg(ulogin) + .arg(login) .succeeds() .stdout_is(format!( "Login name: {:<28}In real life: {1}\n\n", - ulogin, real_name + login, real_name )); } diff --git a/tests/by-util/test_printf.rs b/tests/by-util/test_printf.rs index 1e3e21d0c..40e91ef4f 100644 --- a/tests/by-util/test_printf.rs +++ b/tests/by-util/test_printf.rs @@ -43,12 +43,12 @@ fn escaped_octal() { } #[test] -fn escaped_unicode_fourdigit() { +fn escaped_unicode_four_digit() { new_ucmd!().args(&["\\u0125"]).succeeds().stdout_only("ĥ"); } #[test] -fn escaped_unicode_eightdigit() { +fn escaped_unicode_eight_digit() { new_ucmd!() .args(&["\\U00000125"]) .succeeds() @@ -77,7 +77,7 @@ fn sub_string() { } #[test] -fn sub_multifield() { +fn sub_multi_field() { new_ucmd!() .args(&["%s %s", "hello", "world"]) .succeeds() @@ -85,7 +85,7 @@ fn sub_multifield() { } #[test] -fn sub_repeat_formatstr() { +fn sub_repeat_format_str() { new_ucmd!() .args(&["%s.", "hello", "world"]) .succeeds() @@ -101,7 +101,7 @@ fn sub_string_ignore_escapes() { } #[test] -fn sub_bstring_handle_escapes() { +fn sub_b_string_handle_escapes() { new_ucmd!() .args(&["hello %b", "\\tworld"]) .succeeds() @@ -109,7 +109,7 @@ fn sub_bstring_handle_escapes() { } #[test] -fn sub_bstring_ignore_subs() { +fn sub_b_string_ignore_subs() { new_ucmd!() .args(&["hello %b", "world %% %i"]) .succeeds() @@ -133,7 +133,7 @@ fn sub_num_int() { } #[test] -fn sub_num_int_minwidth() { +fn sub_num_int_min_width() { new_ucmd!() .args(&["twenty is %1i", "20"]) .succeeds() @@ -181,11 +181,11 @@ fn sub_num_int_hex_in_neg() { } #[test] -fn sub_num_int_charconst_in() { +fn sub_num_int_char_const_in() { new_ucmd!() - .args(&["ninetyseven is %i", "'a"]) + .args(&["ninety seven is %i", "'a"]) .succeeds() - .stdout_only("ninetyseven is 97"); + .stdout_only("ninety seven is 97"); } #[test] @@ -287,7 +287,7 @@ fn sub_num_hex_float_upper() { } #[test] -fn sub_minwidth() { +fn sub_min_width() { new_ucmd!() .args(&["hello %7s", "world"]) .succeeds() @@ -295,7 +295,7 @@ fn sub_minwidth() { } #[test] -fn sub_minwidth_negative() { +fn sub_min_width_negative() { new_ucmd!() .args(&["hello %-7s", "world"]) .succeeds() @@ -327,7 +327,7 @@ fn sub_int_leading_zeroes() { } #[test] -fn sub_int_leading_zeroes_prio() { +fn sub_int_leading_zeroes_padded() { new_ucmd!() .args(&["%5.4i", "11"]) .succeeds() @@ -359,7 +359,7 @@ fn sub_float_no_octal_in() { } #[test] -fn sub_any_asterisk_firstparam() { +fn sub_any_asterisk_first_param() { new_ucmd!() .args(&["%*i", "3", "11", "4", "12"]) .succeeds() @@ -401,7 +401,7 @@ fn sub_any_asterisk_hex_arg() { #[test] fn sub_any_specifiers_no_params() { new_ucmd!() - .args(&["%ztlhLji", "3"]) + .args(&["%ztlhLji", "3"]) //spell-checker:disable-line .succeeds() .stdout_only("3"); } @@ -409,7 +409,7 @@ fn sub_any_specifiers_no_params() { #[test] fn sub_any_specifiers_after_first_param() { new_ucmd!() - .args(&["%0ztlhLji", "3"]) + .args(&["%0ztlhLji", "3"]) //spell-checker:disable-line .succeeds() .stdout_only("3"); } @@ -417,7 +417,7 @@ fn sub_any_specifiers_after_first_param() { #[test] fn sub_any_specifiers_after_period() { new_ucmd!() - .args(&["%0.ztlhLji", "3"]) + .args(&["%0.ztlhLji", "3"]) //spell-checker:disable-line .succeeds() .stdout_only("3"); } @@ -425,7 +425,7 @@ fn sub_any_specifiers_after_period() { #[test] fn sub_any_specifiers_after_second_param() { new_ucmd!() - .args(&["%0.0ztlhLji", "3"]) + .args(&["%0.0ztlhLji", "3"]) //spell-checker:disable-line .succeeds() .stdout_only("3"); } diff --git a/tests/by-util/test_ptx.rs b/tests/by-util/test_ptx.rs index e44943bfa..c17d473f5 100644 --- a/tests/by-util/test_ptx.rs +++ b/tests/by-util/test_ptx.rs @@ -1,43 +1,43 @@ use crate::common::util::*; #[test] -fn gnu_ext_disabled_roff_no_ref() { +fn gnu_ext_disabled_rightward_no_ref() { new_ucmd!() .args(&["-G", "-R", "input"]) .succeeds() - .stdout_only_fixture("gnu_ext_disabled_roff_no_ref.expected"); + .stdout_only_fixture("gnu_ext_disabled_rightward_no_ref.expected"); } #[test] -fn gnu_ext_disabled_roff_no_ref_empty_word_regexp() { +fn gnu_ext_disabled_rightward_no_ref_empty_word_regexp() { new_ucmd!() .args(&["-G", "-R", "-W", "", "input"]) .succeeds() - .stdout_only_fixture("gnu_ext_disabled_roff_no_ref.expected"); + .stdout_only_fixture("gnu_ext_disabled_rightward_no_ref.expected"); } #[test] -fn gnu_ext_disabled_roff_no_ref_word_regexp_exc_space() { +fn gnu_ext_disabled_rightward_no_ref_word_regexp_exc_space() { new_ucmd!() .args(&["-G", "-R", "-W", "[^\t\n]+", "input"]) .succeeds() - .stdout_only_fixture("gnu_ext_disabled_roff_no_ref_word_regexp_exc_space.expected"); + .stdout_only_fixture("gnu_ext_disabled_rightward_no_ref_word_regexp_exc_space.expected"); } #[test] -fn gnu_ext_disabled_roff_input_ref() { +fn gnu_ext_disabled_rightward_input_ref() { new_ucmd!() .args(&["-G", "-r", "-R", "input"]) .succeeds() - .stdout_only_fixture("gnu_ext_disabled_roff_input_ref.expected"); + .stdout_only_fixture("gnu_ext_disabled_rightward_input_ref.expected"); } #[test] -fn gnu_ext_disabled_roff_auto_ref() { +fn gnu_ext_disabled_rightward_auto_ref() { new_ucmd!() .args(&["-G", "-A", "-R", "input"]) .succeeds() - .stdout_only_fixture("gnu_ext_disabled_roff_auto_ref.expected"); + .stdout_only_fixture("gnu_ext_disabled_rightward_auto_ref.expected"); } #[test] diff --git a/tests/by-util/test_pwd.rs b/tests/by-util/test_pwd.rs index b6a6c87a4..2779b9e62 100644 --- a/tests/by-util/test_pwd.rs +++ b/tests/by-util/test_pwd.rs @@ -9,5 +9,5 @@ fn test_default() { #[test] fn test_failed() { let (_at, mut ucmd) = at_and_ucmd!(); - ucmd.arg("willfail").fails(); + ucmd.arg("will-fail").fails(); } diff --git a/tests/by-util/test_relpath.rs b/tests/by-util/test_relpath.rs index b9c07fb12..051f46084 100644 --- a/tests/by-util/test_relpath.rs +++ b/tests/by-util/test_relpath.rs @@ -115,12 +115,12 @@ fn test_relpath_with_from_with_d() { #[cfg(not(windows))] assert!(Path::new(&_result_stdout).is_relative()); - // d is not part of subpath -> expect absolut path + // d is not part of subpath -> expect absolute path _result_stdout = scene .ucmd() .arg(to) .arg(from) - .arg("-dnon_existing") + .arg("-dnon_existing") // spell-checker:disable-line .succeeds() .stdout_move_str(); assert!(Path::new(&_result_stdout).is_absolute()); @@ -166,11 +166,11 @@ fn test_relpath_no_from_with_d() { #[cfg(not(windows))] assert!(Path::new(&_result_stdout).is_relative()); - // d is not part of subpath -> expect absolut path + // d is not part of subpath -> expect absolute path let result_stdout = scene .ucmd() .arg(to) - .arg("-dnon_existing") + .arg("-dnon_existing") // spell-checker:disable-line .succeeds() .stdout_move_str(); assert!(Path::new(&result_stdout).is_absolute()); diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 2a87038d5..64259d02c 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -65,7 +65,7 @@ fn test_rm_interactive() { .arg("-i") .arg(file_a) .arg(file_b) - .pipe_in("Yesh") + .pipe_in("Yesh") // spell-checker:disable-line .succeeds(); assert!(!at.file_exists(file_a)); diff --git a/tests/by-util/test_shuf.rs b/tests/by-util/test_shuf.rs index 106d80a39..cbc01f8cd 100644 --- a/tests/by-util/test_shuf.rs +++ b/tests/by-util/test_shuf.rs @@ -19,7 +19,7 @@ fn test_output_is_random_permutation() { .map(|x| x.parse().unwrap()) .collect(); result_seq.sort_unstable(); - assert_ne!(result.stdout_str(), input, "Output is not randomised"); + assert_ne!(result.stdout_str(), input, "Output is not randomized"); assert_eq!(result_seq, input_seq, "Output is not a permutation"); } diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 588ce86bd..c31d44110 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (words) ints + use crate::common::util::*; fn test_helper(file_name: &str, possible_args: &[&str]) { @@ -61,7 +63,7 @@ fn test_ext_sort_stable() { } #[test] -fn test_extsort_zero_terminated() { +fn test_ext_sort_zero_terminated() { new_ucmd!() .arg("-z") .arg("-S") @@ -96,7 +98,7 @@ fn test_human_numeric_whitespace() { // This tests where serde often fails when reading back JSON // if it finds a null value #[test] -fn test_extsort_as64_bailout() { +fn test_ext_sort_as64_bailout() { new_ucmd!() .arg("-g") .arg("-S 5K") @@ -290,10 +292,10 @@ fn test_dictionary_order() { fn test_dictionary_order2() { for non_dictionary_order2_param in &["-d"] { new_ucmd!() - .pipe_in("a👦🏻aa b\naaaa b") - .arg(non_dictionary_order2_param) + .pipe_in("a👦🏻aa b\naaaa b") // spell-checker:disable-line + .arg(non_dictionary_order2_param) // spell-checker:disable-line .succeeds() - .stdout_only("a👦🏻aa b\naaaa b\n"); + .stdout_only("a👦🏻aa b\naaaa b\n"); // spell-checker:disable-line } } @@ -301,10 +303,10 @@ fn test_dictionary_order2() { fn test_non_printing_chars() { for non_printing_chars_param in &["-i"] { new_ucmd!() - .pipe_in("a👦🏻aa\naaaa") - .arg(non_printing_chars_param) + .pipe_in("a👦🏻aa\naaaa") // spell-checker:disable-line + .arg(non_printing_chars_param) // spell-checker:disable-line .succeeds() - .stdout_only("a👦🏻aa\naaaa\n"); + .stdout_only("a👦🏻aa\naaaa\n"); // spell-checker:disable-line } } @@ -592,7 +594,7 @@ fn test_keys_ignore_flag() { } #[test] -fn test_doesnt_inherit_key_settings() { +fn test_does_not_inherit_key_settings() { let input = " 1 2 10 diff --git a/tests/by-util/test_split.rs b/tests/by-util/test_split.rs index 1ff8bd8f2..85b28326b 100644 --- a/tests/by-util/test_split.rs +++ b/tests/by-util/test_split.rs @@ -242,7 +242,7 @@ fn test_filter() { .succeeds(); // assert all characters are 'i' / no character is not 'i' - // (assert that command succeded) + // (assert that command succeeded) let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]]$"); assert!( glob.collate().iter().find(|&&c| { @@ -265,7 +265,7 @@ fn test_filter_with_env_var_set() { let n_lines = 3; RandomFile::new(&at, name).add_lines(n_lines); - let env_var_value = "somevalue"; + let env_var_value = "some-value"; env::set_var("FILE", &env_var_value); ucmd.args(&[format!("--filter={}", "cat > $FILE").as_str(), name]) .succeeds(); diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 6935cc7f9..5c8d9d185 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -6,20 +6,20 @@ extern crate stat; pub use self::stat::*; #[test] -fn test_scanutil() { +fn test_scanners() { assert_eq!(Some((-5, 2)), "-5zxc".scan_num::()); assert_eq!(Some((51, 2)), "51zxc".scan_num::()); assert_eq!(Some((192, 4)), "+192zxc".scan_num::()); assert_eq!(None, "z192zxc".scan_num::()); assert_eq!(Some(('a', 3)), "141zxc".scan_char(8)); - assert_eq!(Some(('\n', 2)), "12qzxc".scan_char(8)); - assert_eq!(Some(('\r', 1)), "dqzxc".scan_char(16)); - assert_eq!(None, "z2qzxc".scan_char(8)); + assert_eq!(Some(('\n', 2)), "12qzxc".scan_char(8)); // spell-checker:disable-line + assert_eq!(Some(('\r', 1)), "dqzxc".scan_char(16)); // spell-checker:disable-line + assert_eq!(None, "z2qzxc".scan_char(8)); // spell-checker:disable-line } #[test] -fn test_groupnum() { +fn test_group_num() { assert_eq!("12,379,821,234", group_num("12379821234")); assert_eq!("21,234", group_num("21234")); assert_eq!("821,234", group_num("821234")); @@ -97,13 +97,13 @@ fn test_invalid_option() { } #[cfg(any(target_os = "linux", target_vendor = "apple"))] -const NORMAL_FMTSTR: &str = +const NORMAL_FORMAT_STR: &str = "%a %A %b %B %d %D %f %F %g %G %h %i %m %n %o %s %u %U %x %X %y %Y %z %Z"; // avoid "%w %W" (birth/creation) due to `stat` limitations and linux kernel & rust version capability variations #[cfg(any(target_os = "linux"))] -const DEV_FMTSTR: &str = +const DEV_FORMAT_STR: &str = "%a %A %b %B %d %D %f %F %g %G %h %i %m %n %o %s (%t/%T) %u %U %w %W %x %X %y %Y %z %Z"; #[cfg(target_os = "linux")] -const FS_FMTSTR: &str = "%b %c %i %l %n %s %S %t %T"; // avoid "%a %d %f" which can cause test failure due to race conditions +const FS_FORMAT_STR: &str = "%b %c %i %l %n %s %S %t %T"; // avoid "%a %d %f" which can cause test failure due to race conditions #[test] #[cfg(target_os = "linux")] @@ -118,7 +118,7 @@ fn test_terse_fs_format() { #[test] #[cfg(target_os = "linux")] fn test_fs_format() { - let args = ["-f", "-c", FS_FMTSTR, "/dev/shm"]; + let args = ["-f", "-c", FS_FORMAT_STR, "/dev/shm"]; new_ucmd!() .args(&args) .run() @@ -207,7 +207,7 @@ fn test_format_created_seconds() { #[cfg(any(target_os = "linux", target_vendor = "apple"))] #[test] fn test_normal_format() { - let args = ["-c", NORMAL_FMTSTR, "/bin"]; + let args = ["-c", NORMAL_FORMAT_STR, "/bin"]; new_ucmd!() .args(&args) .succeeds() @@ -231,14 +231,14 @@ fn test_symlinks() { ] { if at.file_exists(file) && at.is_symlink(file) { tested = true; - let args = ["-c", NORMAL_FMTSTR, file]; + let args = ["-c", NORMAL_FORMAT_STR, file]; scene .ucmd() .args(&args) .succeeds() .stdout_is(expected_result(&args)); // -L, --dereference follow links - let args = ["-L", "-c", NORMAL_FMTSTR, file]; + let args = ["-L", "-c", NORMAL_FORMAT_STR, file]; scene .ucmd() .args(&args) @@ -261,7 +261,7 @@ fn test_char() { let args = [ "-c", #[cfg(target_os = "linux")] - DEV_FMTSTR, + DEV_FORMAT_STR, #[cfg(target_os = "linux")] "/dev/pts/ptmx", #[cfg(any(target_vendor = "apple"))] @@ -280,7 +280,7 @@ fn test_char() { fn test_multi_files() { let args = [ "-c", - NORMAL_FMTSTR, + NORMAL_FORMAT_STR, "/dev", "/usr/lib", #[cfg(target_os = "linux")] diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 737d0cabf..0e3092562 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -78,7 +78,7 @@ fn test_follow_multiple() { at.append(FOOBAR_2_TXT, first_append); assert_eq!(read_size(&mut child, first_append.len()), first_append); - let second_append = "doce\ntrece\n"; + let second_append = "twenty\nthirty\n"; let expected = at.read("foobar_follow_multiple_appended.expected"); at.append(FOOBAR_TXT, second_append); assert_eq!(read_size(&mut child, expected.len()), expected); @@ -95,7 +95,7 @@ fn test_follow_stdin() { .stdout_is_fixture("follow_stdin.expected"); } -// FixME: test PASSES for usual windows builds, but fails for coverage testing builds (likely related to the specific RUSTFLAGS '-Zpanic_abort_tests -Cpanic=abort') This test also breaks tty settings under bash requiring a 'stty sane' or reset. +// FixME: test PASSES for usual windows builds, but fails for coverage testing builds (likely related to the specific RUSTFLAGS '-Zpanic_abort_tests -Cpanic=abort') This test also breaks tty settings under bash requiring a 'stty sane' or reset. // spell-checker:disable-line #[cfg(disable_until_fixed)] #[test] fn test_follow_with_pid() { @@ -130,7 +130,7 @@ fn test_follow_with_pid() { at.append(FOOBAR_2_TXT, first_append); assert_eq!(read_size(&mut child, first_append.len()), first_append); - let second_append = "doce\ntrece\n"; + let second_append = "twenty\nthirty\n"; let expected = at.read("foobar_follow_multiple_appended.expected"); at.append(FOOBAR_TXT, second_append); assert_eq!(read_size(&mut child, expected.len()), expected); @@ -268,7 +268,7 @@ fn test_parse_size() { assert!(parse_size("1Y").is_err()); // Bad number - assert!(parse_size("328hdsf3290").is_err()); + assert!(parse_size("328hdsf3290").is_err()); // spell-checker:disable-line } #[test] diff --git a/tests/by-util/test_test.rs b/tests/by-util/test_test.rs index 3a55f772a..a29c4f6c6 100644 --- a/tests/by-util/test_test.rs +++ b/tests/by-util/test_test.rs @@ -8,6 +8,8 @@ // file that was distributed with this source code. // +// spell-checker:ignore (words) pseudofloat + use crate::common::util::*; #[test] @@ -73,13 +75,13 @@ fn test_negated_or() { } #[test] -fn test_strlen_of_nothing() { +fn test_string_length_of_nothing() { // odd but matches GNU, which must interpret -n as a literal here new_ucmd!().arg("-n").succeeds(); } #[test] -fn test_strlen_of_empty() { +fn test_string_length_of_empty() { new_ucmd!().args(&["-n", ""]).run().status_code(1); // STRING equivalent to -n STRING @@ -98,7 +100,7 @@ fn test_zero_len_of_empty() { } #[test] -fn test_solo_paren_is_literal() { +fn test_solo_parenthesis_is_literal() { let scenario = TestScenario::new(util_name!()); let tests = [["("], [")"]]; @@ -167,7 +169,7 @@ fn test_dangling_string_comparison_is_error() { } #[test] -fn test_stringop_is_literal_after_bang() { +fn test_string_operator_is_literal_after_bang() { let scenario = TestScenario::new(util_name!()); let tests = [ ["!", "="], @@ -208,7 +210,7 @@ fn test_pseudofloat_not_equal() { #[test] fn test_negative_arg_is_a_string() { new_ucmd!().arg("-12345").succeeds(); - new_ucmd!().arg("--qwert").succeeds(); + new_ucmd!().arg("--qwert").succeeds(); // spell-checker:disable-line } #[test] @@ -475,12 +477,12 @@ fn test_nonexistent_file_is_not_symlink() { } #[test] -fn test_op_prec_and_or_1() { +fn test_op_precedence_and_or_1() { new_ucmd!().args(&[" ", "-o", "", "-a", ""]).succeeds(); } #[test] -fn test_op_prec_and_or_1_overridden_by_parentheses() { +fn test_op_precedence_and_or_1_overridden_by_parentheses() { new_ucmd!() .args(&["(", " ", "-o", "", ")", "-a", ""]) .run() @@ -488,14 +490,14 @@ fn test_op_prec_and_or_1_overridden_by_parentheses() { } #[test] -fn test_op_prec_and_or_2() { +fn test_op_precedence_and_or_2() { new_ucmd!() .args(&["", "-a", "", "-o", " ", "-a", " "]) .succeeds(); } #[test] -fn test_op_prec_and_or_2_overridden_by_parentheses() { +fn test_op_precedence_and_or_2_overridden_by_parentheses() { new_ucmd!() .args(&["", "-a", "(", "", "-o", " ", ")", "-a", " "]) .run() @@ -529,7 +531,7 @@ fn test_negated_boolean_precedence() { } #[test] -fn test_bang_boolop_precedence() { +fn test_bang_bool_op_precedence() { // For a Boolean combination of two literals, bang inverts the entire expression new_ucmd!().args(&["!", "", "-a", ""]).succeeds(); new_ucmd!().args(&["!", "", "-o", ""]).succeeds(); @@ -564,7 +566,7 @@ fn test_bang_boolop_precedence() { } #[test] -fn test_inverted_parenthetical_boolop_precedence() { +fn test_inverted_parenthetical_bool_op_precedence() { // For a Boolean combination of two literals, bang inverts the entire expression new_ucmd!() .args(&["!", "a value", "-o", "another value"]) @@ -618,6 +620,6 @@ fn test_or_as_filename() { #[test] #[ignore = "GNU considers this an error"] -fn test_strlen_and_nothing() { +fn test_string_length_and_nothing() { new_ucmd!().args(&["-n", "a", "-a"]).run().status_code(2); } diff --git a/tests/by-util/test_timeout.rs b/tests/by-util/test_timeout.rs index 592516cca..28273e00f 100644 --- a/tests/by-util/test_timeout.rs +++ b/tests/by-util/test_timeout.rs @@ -4,7 +4,7 @@ use crate::common::util::*; // the best solution is probably to generate some test binaries that we can call for any // utility that requires executing another program (kill, for instance) #[test] -fn test_subcommand_retcode() { +fn test_subcommand_return_code() { new_ucmd!().arg("1").arg("true").succeeds(); new_ucmd!().arg("1").arg("false").run().status_code(1); diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index d4d2c058e..14718fc0a 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (formats) cymdhm cymdhms mdhm mdhms ymdhm ymdhms + extern crate touch; use self::touch::filetime::{self, FileTime}; @@ -383,13 +385,13 @@ fn is_dst_switch_hour(ts: time::Timespec) -> bool { tm_after.tm_hour == tm.tm_hour + 2 } -// get_dstswitch_hour returns date string for which touch -m -t fails. +// get_dst_switch_hour returns date string for which touch -m -t fails. // For example, in EST (UTC-5), that will be "202003080200" so -// touch -m -t 202003080200 somefile +// touch -m -t 202003080200 file // fails (that date/time does not exist). // In other locales it will be a different date/time, and in some locales // it doesn't exist at all, in which case this function will return None. -fn get_dstswitch_hour() -> Option { +fn get_dst_switch_hour() -> Option { let now = time::now(); // Start from January 1, 2020, 00:00. let mut tm = time::strptime("20200101-0000", "%Y%m%d-%H%M").unwrap(); @@ -415,7 +417,7 @@ fn test_touch_mtime_dst_fails() { let (_at, mut ucmd) = at_and_ucmd!(); let file = "test_touch_set_mtime_dst_fails"; - if let Some(s) = get_dstswitch_hour() { + if let Some(s) = get_dst_switch_hour() { ucmd.args(&["-m", "-t", &s, file]).fails(); } } diff --git a/tests/by-util/test_tr.rs b/tests/by-util/test_tr.rs index 29712b44a..4ddaff573 100644 --- a/tests/by-util/test_tr.rs +++ b/tests/by-util/test_tr.rs @@ -1,7 +1,7 @@ use crate::common::util::*; #[test] -fn test_toupper() { +fn test_to_upper() { new_ucmd!() .args(&["a-z", "A-Z"]) .pipe_in("!abcd!") @@ -80,10 +80,10 @@ fn test_complement2() { #[test] fn test_complement3() { new_ucmd!() - .args(&["-c", "abcdefgh", "123"]) + .args(&["-c", "abcdefgh", "123"]) // spell-checker:disable-line .pipe_in("the cat and the bat") .run() - .stdout_is("3he3ca33a3d33he3ba3"); + .stdout_is("3he3ca33a3d33he3ba3"); // spell-checker:disable-line } #[test] @@ -140,9 +140,9 @@ fn test_translate_and_squeeze() { fn test_translate_and_squeeze_multiple_lines() { new_ucmd!() .args(&["-s", "x", "y"]) - .pipe_in("xxaax\nxaaxx") + .pipe_in("xxaax\nxaaxx") // spell-checker:disable-line .run() - .stdout_is("yaay\nyaay"); + .stdout_is("yaay\nyaay"); // spell-checker:disable-line } #[test] @@ -169,7 +169,7 @@ fn test_set1_longer_than_set2() { .args(&["abc", "xy"]) .pipe_in("abcde") .run() - .stdout_is("xyyde"); + .stdout_is("xyyde"); // spell-checker:disable-line } #[test] @@ -178,7 +178,7 @@ fn test_set1_shorter_than_set2() { .args(&["ab", "xyz"]) .pipe_in("abcde") .run() - .stdout_is("xycde"); + .stdout_is("xycde"); // spell-checker:disable-line } #[test] @@ -187,7 +187,7 @@ fn test_truncate() { .args(&["-t", "abc", "xy"]) .pipe_in("abcde") .run() - .stdout_is("xycde"); + .stdout_is("xycde"); // spell-checker:disable-line } #[test] @@ -196,7 +196,7 @@ fn test_truncate_with_set1_shorter_than_set2() { .args(&["-t", "ab", "xyz"]) .pipe_in("abcde") .run() - .stdout_is("xycde"); + .stdout_is("xycde"); // spell-checker:disable-line } #[test] @@ -216,8 +216,8 @@ fn missing_required_second_arg_fails() { #[test] fn test_interpret_backslash_escapes() { new_ucmd!() - .args(&["abfnrtv", r"\a\b\f\n\r\t\v"]) - .pipe_in("abfnrtv") + .args(&["abfnrtv", r"\a\b\f\n\r\t\v"]) // spell-checker:disable-line + .pipe_in("abfnrtv") // spell-checker:disable-line .succeeds() .stdout_is("\u{7}\u{8}\u{c}\n\r\t\u{b}"); } diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index a28ce9451..f98027127 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -1,15 +1,15 @@ use crate::common::util::*; use std::io::{Seek, SeekFrom, Write}; -static TFILE1: &str = "truncate_test_1"; -static TFILE2: &str = "truncate_test_2"; +static FILE1: &str = "truncate_test_1"; +static FILE2: &str = "truncate_test_2"; #[test] fn test_increase_file_size() { let expected = 5 * 1024; let (at, mut ucmd) = at_and_ucmd!(); - let mut file = at.make_file(TFILE1); - ucmd.args(&["-s", "+5K", TFILE1]).succeeds(); + let mut file = at.make_file(FILE1); + ucmd.args(&["-s", "+5K", FILE1]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); @@ -25,8 +25,8 @@ fn test_increase_file_size() { fn test_increase_file_size_kb() { let expected = 5 * 1000; let (at, mut ucmd) = at_and_ucmd!(); - let mut file = at.make_file(TFILE1); - ucmd.args(&["-s", "+5KB", TFILE1]).succeeds(); + let mut file = at.make_file(FILE1); + ucmd.args(&["-s", "+5KB", FILE1]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); @@ -43,15 +43,15 @@ fn test_reference() { let expected = 5 * 1000; let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; - let mut file = at.make_file(TFILE2); + let mut file = at.make_file(FILE2); - scene.ucmd().arg("-s").arg("+5KB").arg(TFILE1).run(); + scene.ucmd().arg("-s").arg("+5KB").arg(FILE1).run(); scene .ucmd() .arg("--reference") - .arg(TFILE1) - .arg(TFILE2) + .arg(FILE1) + .arg(FILE2) .run(); file.seek(SeekFrom::End(0)).unwrap(); @@ -68,9 +68,9 @@ fn test_reference() { fn test_decrease_file_size() { let expected = 6; let (at, mut ucmd) = at_and_ucmd!(); - let mut file = at.make_file(TFILE2); + let mut file = at.make_file(FILE2); file.write_all(b"1234567890").unwrap(); - ucmd.args(&["--size=-4", TFILE2]).succeeds(); + ucmd.args(&["--size=-4", FILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); assert!( @@ -85,9 +85,9 @@ fn test_decrease_file_size() { fn test_space_in_size() { let expected = 4; let (at, mut ucmd) = at_and_ucmd!(); - let mut file = at.make_file(TFILE2); + let mut file = at.make_file(FILE2); file.write_all(b"1234567890").unwrap(); - ucmd.args(&["--size", " 4", TFILE2]).succeeds(); + ucmd.args(&["--size", " 4", FILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); assert!( @@ -106,22 +106,22 @@ fn test_failed() { #[test] fn test_failed_2() { let (_at, mut ucmd) = at_and_ucmd!(); - ucmd.args(&[TFILE1]).fails(); + ucmd.args(&[FILE1]).fails(); } #[test] fn test_failed_incorrect_arg() { let (_at, mut ucmd) = at_and_ucmd!(); - ucmd.args(&["-s", "+5A", TFILE1]).fails(); + ucmd.args(&["-s", "+5A", FILE1]).fails(); } #[test] fn test_at_most_shrinks() { let expected = 4; let (at, mut ucmd) = at_and_ucmd!(); - let mut file = at.make_file(TFILE2); + let mut file = at.make_file(FILE2); file.write_all(b"1234567890").unwrap(); - ucmd.args(&["--size", "<4", TFILE2]).succeeds(); + ucmd.args(&["--size", "<4", FILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); assert!( @@ -136,9 +136,9 @@ fn test_at_most_shrinks() { fn test_at_most_no_change() { let expected = 10; let (at, mut ucmd) = at_and_ucmd!(); - let mut file = at.make_file(TFILE2); + let mut file = at.make_file(FILE2); file.write_all(b"1234567890").unwrap(); - ucmd.args(&["--size", "<40", TFILE2]).succeeds(); + ucmd.args(&["--size", "<40", FILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); assert!( @@ -153,9 +153,9 @@ fn test_at_most_no_change() { fn test_at_least_grows() { let expected = 15; let (at, mut ucmd) = at_and_ucmd!(); - let mut file = at.make_file(TFILE2); + let mut file = at.make_file(FILE2); file.write_all(b"1234567890").unwrap(); - ucmd.args(&["--size", ">15", TFILE2]).succeeds(); + ucmd.args(&["--size", ">15", FILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); assert!( @@ -170,9 +170,9 @@ fn test_at_least_grows() { fn test_at_least_no_change() { let expected = 10; let (at, mut ucmd) = at_and_ucmd!(); - let mut file = at.make_file(TFILE2); + let mut file = at.make_file(FILE2); file.write_all(b"1234567890").unwrap(); - ucmd.args(&["--size", ">4", TFILE2]).succeeds(); + ucmd.args(&["--size", ">4", FILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); assert!( @@ -187,9 +187,9 @@ fn test_at_least_no_change() { fn test_round_down() { let expected = 8; let (at, mut ucmd) = at_and_ucmd!(); - let mut file = at.make_file(TFILE2); + let mut file = at.make_file(FILE2); file.write_all(b"1234567890").unwrap(); - ucmd.args(&["--size", "/4", TFILE2]).succeeds(); + ucmd.args(&["--size", "/4", FILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); assert!( @@ -204,9 +204,9 @@ fn test_round_down() { fn test_round_up() { let expected = 12; let (at, mut ucmd) = at_and_ucmd!(); - let mut file = at.make_file(TFILE2); + let mut file = at.make_file(FILE2); file.write_all(b"1234567890").unwrap(); - ucmd.args(&["--size", "%4", TFILE2]).succeeds(); + ucmd.args(&["--size", "%4", FILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); assert!( @@ -221,10 +221,10 @@ fn test_round_up() { fn test_size_and_reference() { let expected = 15; let (at, mut ucmd) = at_and_ucmd!(); - let mut file1 = at.make_file(TFILE1); - let mut file2 = at.make_file(TFILE2); + let mut file1 = at.make_file(FILE1); + let mut file2 = at.make_file(FILE2); file1.write_all(b"1234567890").unwrap(); - ucmd.args(&["--reference", TFILE1, "--size", "+5", TFILE2]) + ucmd.args(&["--reference", FILE1, "--size", "+5", FILE2]) .succeeds(); file2.seek(SeekFrom::End(0)).unwrap(); let actual = file2.seek(SeekFrom::Current(0)).unwrap(); diff --git a/tests/by-util/test_uname.rs b/tests/by-util/test_uname.rs index d878ed7ac..de3f42a6b 100644 --- a/tests/by-util/test_uname.rs +++ b/tests/by-util/test_uname.rs @@ -17,7 +17,7 @@ fn test_uname_processor() { } #[test] -fn test_uname_hwplatform() { +fn test_uname_hardware_platform() { let result = new_ucmd!().arg("-i").succeeds(); assert_eq!(result.stdout_str().trim_end(), "unknown"); } diff --git a/tests/by-util/test_unexpand.rs b/tests/by-util/test_unexpand.rs index e8b880287..692599361 100644 --- a/tests/by-util/test_unexpand.rs +++ b/tests/by-util/test_unexpand.rs @@ -38,7 +38,7 @@ fn unexpand_init_list_1() { } #[test] -fn unexpand_aflag_0() { +fn unexpand_flag_a_0() { new_ucmd!() .args(&["--"]) .pipe_in("e E\nf F\ng G\nh H\n") @@ -47,7 +47,7 @@ fn unexpand_aflag_0() { } #[test] -fn unexpand_aflag_1() { +fn unexpand_flag_a_1() { new_ucmd!() .args(&["-a"]) .pipe_in("e E\nf F\ng G\nh H\n") @@ -56,7 +56,7 @@ fn unexpand_aflag_1() { } #[test] -fn unexpand_aflag_2() { +fn unexpand_flag_a_2() { new_ucmd!() .args(&["-t8"]) .pipe_in("e E\nf F\ng G\nh H\n") diff --git a/tests/by-util/test_uptime.rs b/tests/by-util/test_uptime.rs index d20ad90c9..4dc90eb31 100644 --- a/tests/by-util/test_uptime.rs +++ b/tests/by-util/test_uptime.rs @@ -22,5 +22,5 @@ fn test_uptime_since() { #[test] fn test_failed() { - new_ucmd!().arg("willfail").fails(); + new_ucmd!().arg("will-fail").fails(); } diff --git a/tests/by-util/test_users.rs b/tests/by-util/test_users.rs index 89c3fdd0f..8ceb0eeb8 100644 --- a/tests/by-util/test_users.rs +++ b/tests/by-util/test_users.rs @@ -1,7 +1,7 @@ use crate::common::util::*; #[test] -fn test_users_noarg() { +fn test_users_no_arg() { new_ucmd!().succeeds(); } diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index 1203c0b1d..88c65c997 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -1,5 +1,7 @@ use crate::common::util::*; +// spell-checker:ignore (flags) lwmcL clmwL ; (path) bogusfile emptyfile manyemptylines moby notrailingnewline onelongemptyline onelongword + #[test] fn test_count_bytes_large_stdin() { for &n in &[ diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index 333b03f5b..16444b0cb 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -1,5 +1,7 @@ use crate::common::util::*; +// spell-checker:ignore (flags) runlevel mesg + #[cfg(any(target_vendor = "apple", target_os = "linux"))] #[test] fn test_count() { diff --git a/tests/common/util.rs b/tests/common/util.rs index 9ce7f0537..cd2633f0d 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -632,7 +632,7 @@ impl TestScenario { let tmpd = Rc::new(TempDir::new().unwrap()); let ts = TestScenario { bin_path: { - // Instead of hardcoding the path relative to the current + // Instead of hard coding the path relative to the current // directory, use Cargo's OUT_DIR to find path to executable. // This allows tests to be run using profiles other than debug. let target_dir = path_concat!(env!("OUT_DIR"), "..", "..", "..", PROGNAME); @@ -722,9 +722,10 @@ impl UCommand { cmd.current_dir(curdir.as_ref()); if env_clear { if cfg!(windows) { + // spell-checker:ignore (dll) rsaenh // %SYSTEMROOT% is required on Windows to initialize crypto provider // ... and crypto provider is required for std::rand - // From procmon: RegQueryValue HKLM\SOFTWARE\Microsoft\Cryptography\Defaults\Provider\Microsoft Strong Cryptographic Provider\Image Path + // From `procmon`: RegQueryValue HKLM\SOFTWARE\Microsoft\Cryptography\Defaults\Provider\Microsoft Strong Cryptographic Provider\Image Path // SUCCESS Type: REG_SZ, Length: 66, Data: %SystemRoot%\system32\rsaenh.dll" for (key, _) in env::vars_os() { if key.as_os_str() != "SYSTEMROOT" { @@ -802,7 +803,7 @@ impl UCommand { self } - /// provides stdinput to feed in to the command when spawned + /// provides standard input to feed in to the command when spawned pub fn pipe_in>>(&mut self, input: T) -> &mut UCommand { if self.bytes_into_stdin.is_some() { panic!("{}", MULTIPLE_STDIN_MEANINGLESS); @@ -934,6 +935,7 @@ pub fn vec_of_size(n: usize) -> Vec { /// Sanity checks for test utils #[cfg(test)] mod tests { + // spell-checker:ignore (tests) asdfsadfa use super::*; #[test] @@ -1012,7 +1014,7 @@ mod tests { } #[test] - fn test_no_std_errout() { + fn test_no_stderr_output() { let res = CmdResult { tmpd: None, code: None, diff --git a/tests/fixtures/cat/three_directories_and_file_and_stdin.stderr.expected b/tests/fixtures/cat/three_directories_and_file_and_stdin.stderr.expected index 1a8a33d77..04a2d4be8 100644 --- a/tests/fixtures/cat/three_directories_and_file_and_stdin.stderr.expected +++ b/tests/fixtures/cat/three_directories_and_file_and_stdin.stderr.expected @@ -1,5 +1,5 @@ cat: test_directory3/test_directory4: Is a directory -cat: filewhichdoesnotexist.txt: No such file or directory (os error 2) +cat: file_which_does_not_exist.txt: No such file or directory (os error 2) cat: test_directory3/test_directory5: Is a directory cat: test_directory3/../test_directory3/test_directory5: Is a directory cat: test_directory3: Is a directory diff --git a/tests/fixtures/ptx/gnu_ext_disabled_roff_auto_ref.expected b/tests/fixtures/ptx/gnu_ext_disabled_rightward_auto_ref.expected similarity index 100% rename from tests/fixtures/ptx/gnu_ext_disabled_roff_auto_ref.expected rename to tests/fixtures/ptx/gnu_ext_disabled_rightward_auto_ref.expected diff --git a/tests/fixtures/ptx/gnu_ext_disabled_roff_input_ref.expected b/tests/fixtures/ptx/gnu_ext_disabled_rightward_input_ref.expected similarity index 100% rename from tests/fixtures/ptx/gnu_ext_disabled_roff_input_ref.expected rename to tests/fixtures/ptx/gnu_ext_disabled_rightward_input_ref.expected diff --git a/tests/fixtures/ptx/gnu_ext_disabled_roff_no_ref.expected b/tests/fixtures/ptx/gnu_ext_disabled_rightward_no_ref.expected similarity index 100% rename from tests/fixtures/ptx/gnu_ext_disabled_roff_no_ref.expected rename to tests/fixtures/ptx/gnu_ext_disabled_rightward_no_ref.expected diff --git a/tests/fixtures/ptx/gnu_ext_disabled_roff_no_ref_word_regexp_exc_space.expected b/tests/fixtures/ptx/gnu_ext_disabled_rightward_no_ref_word_regexp_exc_space.expected similarity index 100% rename from tests/fixtures/ptx/gnu_ext_disabled_roff_no_ref_word_regexp_exc_space.expected rename to tests/fixtures/ptx/gnu_ext_disabled_rightward_no_ref_word_regexp_exc_space.expected diff --git a/tests/fixtures/tail/foobar_follow_multiple_appended.expected b/tests/fixtures/tail/foobar_follow_multiple_appended.expected index 0896d3743..891eb6920 100644 --- a/tests/fixtures/tail/foobar_follow_multiple_appended.expected +++ b/tests/fixtures/tail/foobar_follow_multiple_appended.expected @@ -1,4 +1,4 @@ ==> foobar.txt <== -doce -trece +twenty +thirty From 3fb8a37aceddd6805b4e14571a5f7e46630c9dcd Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 20:43:59 -0500 Subject: [PATCH 0795/1135] refactor ~ (bin/coreutils) polish spelling (comments, names, and exceptions) --- src/bin/coreutils.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/coreutils.rs b/src/bin/coreutils.rs index 7fc494020..2e703b682 100644 --- a/src/bin/coreutils.rs +++ b/src/bin/coreutils.rs @@ -58,7 +58,7 @@ fn main() { // binary name equals prefixed util name? // * prefix/stem may be any string ending in a non-alphanumeric character - let utilname = if let Some(util) = utils.keys().find(|util| { + let util_name = if let Some(util) = utils.keys().find(|util| { binary_as_util.ends_with(*util) && !(&binary_as_util[..binary_as_util.len() - (*util).len()]) .ends_with(char::is_alphanumeric) @@ -71,7 +71,7 @@ fn main() { }; // 0th argument equals util name? - if let Some(util_os) = utilname { + if let Some(util_os) = util_name { let util = util_os.as_os_str().to_string_lossy(); match utils.get(&util[..]) { From b418f19c2dbb1ab194ae225c1fd6d5b374940db8 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 18:28:33 -0500 Subject: [PATCH 0796/1135] docs/date ~ convert usage text document to a markdown text segment --- src/uu/date/{usage.txt => date-usage.mkd} | 6 ++++++ 1 file changed, 6 insertions(+) rename src/uu/date/{usage.txt => date-usage.mkd} (97%) diff --git a/src/uu/date/usage.txt b/src/uu/date/date-usage.mkd similarity index 97% rename from src/uu/date/usage.txt rename to src/uu/date/date-usage.mkd index 12df1a03c..829001095 100644 --- a/src/uu/date/usage.txt +++ b/src/uu/date/date-usage.mkd @@ -1,3 +1,8 @@ +# `date` usage + + + +``` text FORMAT controls the output. Interpreted sequences are: %% a literal % @@ -70,3 +75,4 @@ Show the time on the west coast of the US (use tzselect(1) to find TZ) Show the local time for 9AM next Friday on the west coast of the US $ date --date='TZ="America/Los_Angeles" 09:00 next Fri' +``` From 1ca44fbbc3c6ac792df635ca3fae967215dbbbc0 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 00:23:12 -0500 Subject: [PATCH 0797/1135] docs/factor ~ fix markdownlint complaints --- src/uu/factor/BENCHMARKING.md | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/uu/factor/BENCHMARKING.md b/src/uu/factor/BENCHMARKING.md index 7b611db4b..6bf9cbf90 100644 --- a/src/uu/factor/BENCHMARKING.md +++ b/src/uu/factor/BENCHMARKING.md @@ -9,7 +9,6 @@ They are located outside the `uu_factor` crate, as they do not comply with the project's minimum supported Rust version, *i.e.* may require a newer version of `rustc`. - ## Microbenchmarking deterministic functions We currently use [`criterion`] to benchmark deterministic functions, @@ -20,8 +19,9 @@ the hardware, operating system version, etc., but they are noisy and affected by other tasks on the system (browser, compile jobs, etc.), which can cause `criterion` to report spurious performance improvements and regressions. -This can be mitigated by getting as close to [idealised conditions][lemire] +This can be mitigated by getting as close to [idealized conditions][lemire] as possible: + - minimize the amount of computation and I/O running concurrently to the benchmark, *i.e.* close your browser and IM clients, don't compile at the same time, etc. ; @@ -29,15 +29,13 @@ as possible: - [isolate a **physical** core], set it to `nohz_full`, and pin the benchmark to it, so it won't be preempted in the middle of a measurement ; - disable ASLR by running `setarch -R cargo bench`, so we can compare results - across multiple executions. - + across multiple executions. [`criterion`]: https://bheisler.github.io/criterion.rs/book/index.html [lemire]: https://lemire.me/blog/2018/01/16/microbenchmarking-calls-for-idealized-conditions/ [isolate a **physical** core]: https://pyperf.readthedocs.io/en/latest/system.html#isolate-cpus-on-linux [frequency stays constant]: ... - ### Guidance for designing microbenchmarks *Note:* this guidance is specific to `factor` and takes its application domain @@ -45,30 +43,29 @@ into account; do not expect it to generalize to other projects. It is based on Daniel Lemire's [*Microbenchmarking calls for idealized conditions*][lemire], which I recommend reading if you want to add benchmarks to `factor`. -1. Select a small, self-contained, deterministic component +1. Select a small, self-contained, deterministic component `gcd` and `table::factor` are good example of such: - no I/O or access to external data structures ; - no call into other components ; - - behaviour is deterministic: no RNG, no concurrency, ... ; + - behavior is deterministic: no RNG, no concurrency, ... ; - the test's body is *fast* (~100ns for `gcd`, ~10µs for `factor::table`), so each sample takes a very short time, minimizing variability and maximizing the numbers of samples we can take in a given time. -2. Benchmarks are immutable (once merged in `uutils`) +2. Benchmarks are immutable (once merged in `uutils`) Modifying a benchmark means previously-collected values cannot meaningfully be compared, silently giving nonsensical results. If you must modify an existing benchmark, rename it. -3. Test common cases +3. Test common cases We are interested in overall performance, rather than specific edge-cases; - use **reproducibly-randomised inputs**, sampling from either all possible + use **reproducibly-randomized inputs**, sampling from either all possible input values or some subset of interest. -4. Use [`criterion`], `criterion::black_box`, ... +4. Use [`criterion`], `criterion::black_box`, ... `criterion` isn't perfect, but it is also much better than ad-hoc solutions in each benchmark. - ## Wishlist ### Configurable statistical estimators @@ -77,7 +74,6 @@ which I recommend reading if you want to add benchmarks to `factor`. where the code under test is fully deterministic and the measurements are subject to additive, positive noise, [the minimum is more appropriate][lemire]. - ### CI & reproducible performance testing Measuring performance on real hardware is important, as it relates directly @@ -95,19 +91,17 @@ performance improvements and regressions. [`cachegrind`]: https://www.valgrind.org/docs/manual/cg-manual.html [`iai`]: https://bheisler.github.io/criterion.rs/book/iai/iai.html - -### Comparing randomised implementations across multiple inputs +### Comparing randomized implementations across multiple inputs `factor` is a challenging target for system benchmarks as it combines two characteristics: -1. integer factoring algorithms are randomised, with large variance in +1. integer factoring algorithms are randomized, with large variance in execution time ; 2. various inputs also have large differences in factoring time, that corresponds to no natural, linear ordering of the inputs. - If (1) was untrue (i.e. if execution time wasn't random), we could faithfully compare 2 implementations (2 successive versions, or `uutils` and GNU) using a scatter plot, where each axis corresponds to the perf. of one implementation. From ceda51dd5c82e0336b1b3ce8d8ca875ba20440d3 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 20:42:43 -0500 Subject: [PATCH 0798/1135] docs/ls ~ fix spelling + whitespace --- src/uu/ls/BENCHMARKING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/ls/BENCHMARKING.md b/src/uu/ls/BENCHMARKING.md index b009b703a..6bc157805 100644 --- a/src/uu/ls/BENCHMARKING.md +++ b/src/uu/ls/BENCHMARKING.md @@ -1,7 +1,7 @@ # Benchmarking ls ls majorly involves fetching a lot of details (depending upon what details are requested, eg. time/date, inode details, etc) for each path using system calls. Ideally, any system call should be done only once for each of the paths - not adhering to this principle leads to a lot of system call overhead multiplying and bubbling up, especially for recursive ls, therefore it is important to always benchmark multiple scenarios. -This is an overwiew over what was benchmarked, and if you make changes to `ls`, you are encouraged to check +This is an overview over what was benchmarked, and if you make changes to `ls`, you are encouraged to check how performance was affected for the workloads listed below. Feel free to add other workloads to the list that we should improve / make sure not to regress. @@ -55,5 +55,5 @@ However, if the `-R` option is given, the output becomes pretty much useless due #!/bin/bash cargo build --release --no-default-features --features ls perf record target/release/coreutils ls "$@" -perf script | uniq | inferno-collapse-perf | inferno-flamegraph > flamegraph.svg -``` \ No newline at end of file +perf script | uniq | inferno-collapse-perf | inferno-flamegraph > flamegraph.svg +``` From 98aff50d4b1405193fbbd8168f9f560527d9278b Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 18:37:28 -0500 Subject: [PATCH 0799/1135] docs/tail ~ fix markdownlint complaints --- src/uu/tail/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/uu/tail/README.md b/src/uu/tail/README.md index 53936a609..b7f92f8e4 100644 --- a/src/uu/tail/README.md +++ b/src/uu/tail/README.md @@ -2,17 +2,17 @@ - Rudimentary tail implementation. -## Missing features: +## Missing features ### Flags with features -* [ ] `--max-unchanged-stats` : with `--follow=name`, reopen a FILE which has not changed size after N (default 5) iterations to see if it has been unlinked or renamed (this is the usual case of rotated log files). With inotify, this option is rarely useful. -* [ ] `--retry` : keep trying to open a file even when it is or becomes inaccessible; useful when follow‐ing by name, i.e., with `--follow=name` +- [ ] `--max-unchanged-stats` : with `--follow=name`, reopen a FILE which has not changed size after N (default 5) iterations to see if it has been unlinked or renamed (this is the usual case of rotated log files). With `inotify`, this option is rarely useful. +- [ ] `--retry` : keep trying to open a file even when it is or becomes inaccessible; useful when follow‐ing by name, i.e., with `--follow=name` ### Others - [ ] The current implementation does not handle `-` as an alias for stdin. -## Possible optimizations: +## Possible optimizations -* [ ] Don't read the whole file if not using `-f` and input is regular file. Read in chunks from the end going backwards, reading each individual chunk forward. +- [ ] Don't read the whole file if not using `-f` and input is regular file. Read in chunks from the end going backwards, reading each individual chunk forward. From 5182365f8f9d533e4ef122053a632f9ff1acc11b Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 13:40:59 -0500 Subject: [PATCH 0800/1135] docs/polish ~ (GH/stale) add spell-checker exceptions --- .github/stale.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/stale.yml b/.github/stale.yml index e0988d0bd..b614226dc 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -1,4 +1,5 @@ -# Number of days of inactivity before an issue/PR becomes stale +# spell-checker:ignore (labels) wontfix + # Number of days of inactivity before an issue/PR becomes stale daysUntilStale: 365 # Number of days of inactivity before a stale issue/PR is closed daysUntilClose: 365 From 6232c76451d6db2aaece8cad170a184a634a8487 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 13:42:55 -0500 Subject: [PATCH 0801/1135] docs/README ~ fix spelling + add spell-checker exceptions --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1365bf7ce..0455e86d1 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ ----------------------------------------------- - + uutils is an attempt at writing universal (as in cross-platform) CLI utilities in [Rust](http://www.rust-lang.org). This repository is intended to @@ -300,13 +300,13 @@ $ make UTILS='UTILITY_1 UTILITY_2' SPEC=y test This testing functionality is only available on *nix operating systems and requires `make`. -To run busybox's tests for all utilities for which busybox has tests +To run busybox tests for all utilities for which busybox has tests ```bash $ make busytest ``` -To run busybox's tests for a few of the available utilities +To run busybox tests for a few of the available utilities ```bash $ make UTILS='UTILITY_1 UTILITY_2' busytest From d65eecc034b8147b7366d908210356b5b4a186e3 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 13:43:21 -0500 Subject: [PATCH 0802/1135] docs/README ~ fix markdownlint complaints --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0455e86d1..e6aaa71a6 100644 --- a/README.md +++ b/README.md @@ -323,6 +323,7 @@ $ make UTILS='UTILITY_1 UTILITY_2' RUNTEST_ARGS='-v' busytest ![Evolution over time](https://github.com/uutils/coreutils-tracking/blob/main/gnu-results.png?raw=true) To run locally: + ```bash $ bash util/build-gnu.sh $ bash util/run-gnu-test.sh From 3140be7c1b58dba05daf75d1bb4bd5655732db0f Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 21:54:51 -0500 Subject: [PATCH 0803/1135] docs/CICD ~ add spell-checker exceptions --- .github/workflows/CICD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 5ac9295d4..4092d28d0 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -5,7 +5,7 @@ name: CICD # spell-checker:ignore (jargon) SHAs deps softprops 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 coreutils gnueabihf issuecomment maint nullglob onexitbegin onexitend tempfile uutils +# spell-checker:ignore (misc) aarch alnum armhf bindir busytest coreutils gnueabihf issuecomment maint nullglob onexitbegin onexitend tempfile testsuite uutils env: PROJECT_NAME: coreutils From 23ed32afe9f88cebde811b0b1aad12c105152946 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 21:55:48 -0500 Subject: [PATCH 0804/1135] docs/meta ~ fix spelling + add spell-checker exceptions --- CODE_OF_CONDUCT.md | 2 +- DEVELOPER_INSTRUCTIONS.md | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 6c50b811d..d196c6e95 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -5,7 +5,7 @@ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender -identity and expression, level of experience, education, socio-economic status, +identity and expression, level of experience, education, socioeconomic status, nationality, personal appearance, race, religion, or sexual identity and orientation. diff --git a/DEVELOPER_INSTRUCTIONS.md b/DEVELOPER_INSTRUCTIONS.md index 3aa8b5b12..e0a5cf001 100644 --- a/DEVELOPER_INSTRUCTIONS.md +++ b/DEVELOPER_INSTRUCTIONS.md @@ -1,6 +1,8 @@ Code Coverage Report Generation --------------------------------- + + Code coverage report can be generated using [grcov](https://github.com/mozilla/grcov). ### Using Nightly Rust @@ -17,7 +19,7 @@ $ grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-exist $ # open target/debug/coverage/index.html in browser ``` -if changes are not reflected in the report then run `cargo clean` and run the above commands. +if changes are not reflected in the report then run `cargo clean` and run the above commands. ### Using Stable Rust From 06c53d97fc83bbfed4c3ab4cfdde203428d3ff3f Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 21:57:20 -0500 Subject: [PATCH 0805/1135] refactor ~ (utils) fix spelling + add spell-checker exceptions --- util/build-gnu.sh | 4 +++- util/rewrite_rules.rs | 2 +- util/run-gnu-test.sh | 1 + util/update-version.sh | 4 +--- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 9d73450f6..64329bd0c 100644 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -1,4 +1,7 @@ #!/bin/bash + +# spell-checker:ignore (paths) abmon deref discrim getlimits getopt ginstall gnulib inacc infloop inotify reflink ; (misc) INT_OFLOW OFLOW ; (vars/env) BUILDDIR SRCDIR + set -e if test ! -d ../gnu; then echo "Could not find ../gnu" @@ -96,4 +99,3 @@ sed -i 's|seq \$|/usr/bin/timeout 0.1 seq \$|' tests/misc/seq-precision.sh tests sed -i 's|cat |/usr/bin/timeout 0.1 cat |' tests/misc/cat-self.sh test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" - diff --git a/util/rewrite_rules.rs b/util/rewrite_rules.rs index 8b29bbe92..3d680e24c 100644 --- a/util/rewrite_rules.rs +++ b/util/rewrite_rules.rs @@ -1,4 +1,4 @@ -//! Rules to update the codebase using Rerast +//! Rules to update the codebase using `rerast` /// Converts try!() to ? fn try_to_question_mark>(r: Result) -> Result { diff --git a/util/run-gnu-test.sh b/util/run-gnu-test.sh index b9948ccd3..61034e015 100644 --- a/util/run-gnu-test.sh +++ b/util/run-gnu-test.sh @@ -1,4 +1,5 @@ #!/bin/bash +# spell-checker:ignore (env/vars) BUILDDIR GNULIB SUBDIRS set -e BUILDDIR="${PWD}/uutils/target/release" GNULIB_DIR="${PWD}/gnulib" diff --git a/util/update-version.sh b/util/update-version.sh index 042d43b71..c71467fc4 100644 --- a/util/update-version.sh +++ b/util/update-version.sh @@ -14,7 +14,7 @@ PROGS=$(ls -1d src/uu/*/Cargo.toml src/uu/stdbuf/src/libstdbuf/Cargo.toml Cargo. # update the version of all programs sed -i -e "s|version = \"$FROM\"|version = \"$TO\"|" $PROGS -# Update the stbuff stuff +# Update the stdbuf stuff sed -i -e "s|libstdbuf = { version=\"$FROM\"|libstdbuf = { version=\"$TO\"|" src/uu/stdbuf/Cargo.toml sed -i -e "s|= { optional=true, version=\"$FROM\", package=\"uu_|= { optional=true, version=\"$TO\", package=\"uu_|g" Cargo.toml @@ -22,5 +22,3 @@ sed -i -e "s|= { optional=true, version=\"$FROM\", package=\"uu_|= { optional=tr #sed -i -e "s|version = \"$UUCORE_FROM\"|version = \"$UUCORE_TO\"|" src/uucore/Cargo.toml # Update crates using uucore #sed -i -e "s|uucore = { version=\">=$UUCORE_FROM\",|uucore = { version=\">=$UUCORE_TO\",|" $PROGS - - From 0b20997d10f069299e73912b50d0425aa5d9b5f1 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 21:58:57 -0500 Subject: [PATCH 0806/1135] refactor ~ (docs) fix spelling + add spell-checker exceptions --- docs/GNUmakefile | 3 ++- docs/Makefile | 6 +++--- docs/compiles_table.py | 4 +++- docs/conf.py | 4 +++- docs/index.rst | 7 +++++-- docs/make.bat | 5 ++++- 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/docs/GNUmakefile b/docs/GNUmakefile index 894a53be0..49d827da8 100644 --- a/docs/GNUmakefile +++ b/docs/GNUmakefile @@ -1,5 +1,6 @@ +# spell-checker:ignore (vars/env) SPHINXOPTS SPHINXBUILD SPHINXPROJ SOURCEDIR BUILDDIR + # Minimal makefile for Sphinx documentation -# # You can set these variables from the command line. SPHINXOPTS = diff --git a/docs/Makefile b/docs/Makefile index 044aaa770..f56df90fb 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,5 +1,5 @@ -USEGNU=gmake $* +UseGNU=gmake $* all: - @$(USEGNU) + @$(UseGNU) .DEFAULT: - @$(USEGNU) + @$(UseGNU) diff --git a/docs/compiles_table.py b/docs/compiles_table.py index a051287c9..aa1b8703c 100644 --- a/docs/compiles_table.py +++ b/docs/compiles_table.py @@ -10,6 +10,8 @@ from pathlib import Path # third party dependencies from tqdm import tqdm +# spell-checker:ignore (libs) tqdm imap ; (shell/mac) xcrun ; (vars) nargs + BINS_PATH=Path("../src/uu") CACHE_PATH=Path("compiles_table.csv") TARGETS = [ @@ -50,7 +52,7 @@ TARGETS = [ class Target(str): def __new__(cls, content): obj = super().__new__(cls, content) - obj.arch, obj.platfrom, obj.os = Target.parse(content) + obj.arch, obj.platform, obj.os = Target.parse(content) return obj @staticmethod diff --git a/docs/conf.py b/docs/conf.py index 74e5e1fb8..5a1213627 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -21,6 +21,8 @@ # import sys # sys.path.insert(0, os.path.abspath('.')) +# spell-checker:ignore (words) howto htbp imgmath toctree todos uutilsdoc + import glob import os import re @@ -180,6 +182,6 @@ for name in glob.glob('*.rst'): # dir menu entry, description, category) texinfo_documents = [ (master_doc, 'uutils', 'uutils Documentation', - author, 'uutils', 'A cross-platform reimplementation of GNU coreutils in Rust.', + author, 'uutils', 'A cross-platform implementation of GNU coreutils, written in Rust.', 'Miscellaneous'), ] diff --git a/docs/index.rst b/docs/index.rst index 4d70d4368..7f782b12a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,8 +3,11 @@ You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to uutils's documentation! -================================== +.. + spell-checker:ignore (directives) genindex maxdepth modindex toctree ; (misc) quickstart + +Welcome to uutils' documentation! +================================= .. toctree:: :maxdepth: 2 diff --git a/docs/make.bat b/docs/make.bat index 1e8ea10a0..6e63e3baa 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -1,5 +1,8 @@ +@setLocal @ECHO OFF +rem spell-checker:ignore (vars/env) BUILDDIR SOURCEDIR SPHINXBUILD SPHINXOPTS SPHINXPROJ + pushd %~dp0 REM Command file for Sphinx documentation @@ -14,7 +17,7 @@ set SPHINXPROJ=uutils if "%1" == "" goto help %SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( +if ErrorLevel 9009 ( echo. echo.The 'sphinx-build' command was not found. Make sure you have Sphinx echo.installed, then set the SPHINXBUILD environment variable to point From ec982bb695686b1391b241142003b4c95fac0d63 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 21:59:38 -0500 Subject: [PATCH 0807/1135] refactor ~ (makefiles) fix spelling + add spell-checker exceptions --- GNUmakefile | 4 +++- Makefile | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 409a527cd..b6a4e5c56 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,3 +1,5 @@ +# spell-checker:ignore (misc) testsuite runtest (targets) busytest distclean manpages pkgs ; (vars/env) BINDIR BUILDDIR CARGOFLAGS DESTDIR DOCSDIR INSTALLDIR INSTALLEES MANDIR MULTICALL + # Config options PROFILE ?= debug MULTICALL ?= n @@ -274,7 +276,7 @@ busybox-src: $(BUILDDIR)/.config: $(BASEDIR)/.busybox-config cp $< $@ -# Test under the busybox testsuite +# Test under the busybox test suite $(BUILDDIR)/busybox: busybox-src build-coreutils $(BUILDDIR)/.config cp $(BUILDDIR)/coreutils $(BUILDDIR)/busybox; \ chmod +x $@; diff --git a/Makefile b/Makefile index 044aaa770..f56df90fb 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -USEGNU=gmake $* +UseGNU=gmake $* all: - @$(USEGNU) + @$(UseGNU) .DEFAULT: - @$(USEGNU) + @$(UseGNU) From c392cd1cb452fb1dc7521b35f3fed3d8117b6fae Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 22:19:03 -0500 Subject: [PATCH 0808/1135] maint/CICD ~ `cspell`-check all repository files --- .github/workflows/CICD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 4092d28d0..78048adff 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -630,4 +630,4 @@ jobs: - name: Run `cspell` shell: bash run: | - cspell --config .vscode/cSpell.json --no-summary --no-progress $( git ls-files | grep "\.\(rs\|md\)" ) | sed "s/\(.*\):\(.*\):\(.*\) - \(.*\)/::warning file=\1,line=\2,col=\3::cspell: \4/" || true + cspell --config .vscode/cSpell.json --no-summary --no-progress **/* | sed "s/\(.*\):\(.*\):\(.*\) - \(.*\)/::warning file=\1,line=\2,col=\3::cspell: \4/" || true From 3f35e0a4218521c37f21f49007befc175c402767 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 22:55:28 -0500 Subject: [PATCH 0809/1135] refactor ~ `cargo make format` --- src/uu/od/src/prn_int.rs | 5 +++- .../src/tokenize/num_format/formatter.rs | 1 - .../formatters/cninetyninehexfloatf.rs | 15 +++++++++--- .../tokenize/num_format/formatters/decf.rs | 12 ++++++---- .../num_format/formatters/float_common.rs | 4 +++- .../tokenize/num_format/formatters/floatf.rs | 9 +++++-- .../tokenize/num_format/formatters/intf.rs | 7 +++++- src/uu/stat/src/stat.rs | 22 ++++++++++------- src/uucore/src/lib/features/fsext.rs | 4 ++-- tests/benches/factor/benches/table.rs | 2 +- tests/by-util/test_base64.rs | 4 ++-- tests/by-util/test_cat.rs | 12 +++++----- tests/by-util/test_comm.rs | 2 +- tests/by-util/test_date.rs | 2 +- tests/by-util/test_dircolors.rs | 4 ++-- tests/by-util/test_echo.rs | 2 +- tests/by-util/test_factor.rs | 5 +++- tests/by-util/test_fold.rs | 8 +++---- tests/by-util/test_kill.rs | 2 +- tests/by-util/test_ln.rs | 2 +- tests/by-util/test_ls.rs | 2 +- tests/by-util/test_mktemp.rs | 4 ++-- tests/by-util/test_more.rs | 6 +++-- tests/by-util/test_mv.rs | 2 +- tests/by-util/test_nice.rs | 2 +- tests/by-util/test_od.rs | 24 +++++++++---------- tests/by-util/test_pinky.rs | 6 ++--- tests/by-util/test_printf.rs | 8 +++---- tests/by-util/test_relpath.rs | 4 ++-- tests/by-util/test_rm.rs | 2 +- tests/by-util/test_sort.rs | 12 +++++----- tests/by-util/test_stat.rs | 6 ++--- tests/by-util/test_tail.rs | 2 +- tests/by-util/test_test.rs | 2 +- tests/by-util/test_tr.rs | 16 ++++++------- tests/by-util/test_truncate.rs | 7 +----- 36 files changed, 129 insertions(+), 100 deletions(-) diff --git a/src/uu/od/src/prn_int.rs b/src/uu/od/src/prn_int.rs index 5e31da9dd..0946824c1 100644 --- a/src/uu/od/src/prn_int.rs +++ b/src/uu/od/src/prn_int.rs @@ -153,7 +153,10 @@ fn test_format_item_hex() { assert_eq!(" 00000000", format_item_hex32(0)); assert_eq!(" ffffffff", format_item_hex32(0xffff_ffff)); assert_eq!(" 0000000000000000", format_item_hex64(0)); - assert_eq!(" ffffffffffffffff", format_item_hex64(0xffff_ffff_ffff_ffff)); + assert_eq!( + " ffffffffffffffff", + format_item_hex64(0xffff_ffff_ffff_ffff) + ); } #[test] diff --git a/src/uu/printf/src/tokenize/num_format/formatter.rs b/src/uu/printf/src/tokenize/num_format/formatter.rs index 9fd5954ed..f5f5d71b1 100644 --- a/src/uu/printf/src/tokenize/num_format/formatter.rs +++ b/src/uu/printf/src/tokenize/num_format/formatter.rs @@ -1,4 +1,3 @@ - //! Primitives used by num_format and sub_modules. //! never dealt with above (e.g. Sub Tokenizer never uses these) diff --git a/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs b/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs index 104e55ef3..f96a991b5 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs @@ -25,8 +25,13 @@ impl Formatter for CninetyNineHexFloatf { str_in: &str, ) -> Option { let second_field = field.second_field.unwrap_or(6) + 1; - let analysis = - FloatAnalysis::analyze(&str_in, initial_prefix, Some(second_field as usize), None, true); + let analysis = FloatAnalysis::analyze( + &str_in, + initial_prefix, + Some(second_field as usize), + None, + true, + ); let f = get_primitive_hex( initial_prefix, &str_in[initial_prefix.offset..], @@ -51,7 +56,11 @@ fn get_primitive_hex( _last_dec_place: usize, capitalized: bool, ) -> FormatPrimitive { - let prefix = Some(String::from(if initial_prefix.sign == -1 { "-0x" } else { "0x" })); + let prefix = Some(String::from(if initial_prefix.sign == -1 { + "-0x" + } else { + "0x" + })); // TODO actual conversion, make sure to get back mantissa. // for hex to hex, it's really just a matter of moving the diff --git a/src/uu/printf/src/tokenize/num_format/formatters/decf.rs b/src/uu/printf/src/tokenize/num_format/formatters/decf.rs index 4d729f0ce..5798eadcb 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/decf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/decf.rs @@ -76,11 +76,13 @@ impl Formatter for Decf { second_field as usize, None, ); - Some(if get_len_fmt_primitive(&f_fl) >= get_len_fmt_primitive(&f_sci) { - f_sci - } else { - f_fl - }) + Some( + if get_len_fmt_primitive(&f_fl) >= get_len_fmt_primitive(&f_sci) { + f_sci + } else { + f_fl + }, + ) } fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String { primitive_to_str_common(prim, &field) diff --git a/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs b/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs index 4cbb496e4..dd8259233 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs @@ -2,7 +2,9 @@ // spell-checker:ignore (ToDO) arrnum use super::super::format_field::FormatField; -use super::super::formatter::{get_it_at, warn_incomplete_conv, Base, FormatPrimitive, InitialPrefix}; +use super::super::formatter::{ + get_it_at, warn_incomplete_conv, Base, FormatPrimitive, InitialPrefix, +}; use super::base_conv; use super::base_conv::RadixDef; diff --git a/src/uu/printf/src/tokenize/num_format/formatters/floatf.rs b/src/uu/printf/src/tokenize/num_format/formatters/floatf.rs index 79bb51fb8..aed50f18e 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/floatf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/floatf.rs @@ -20,8 +20,13 @@ impl Formatter for Floatf { str_in: &str, ) -> Option { let second_field = field.second_field.unwrap_or(6) + 1; - let analysis = - FloatAnalysis::analyze(&str_in, initial_prefix, None, Some(second_field as usize), false); + let analysis = FloatAnalysis::analyze( + &str_in, + initial_prefix, + None, + Some(second_field as usize), + false, + ); let f = get_primitive_dec( initial_prefix, &str_in[initial_prefix.offset..], diff --git a/src/uu/printf/src/tokenize/num_format/formatters/intf.rs b/src/uu/printf/src/tokenize/num_format/formatters/intf.rs index 1e9e25560..02c59211b 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/intf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/intf.rs @@ -150,7 +150,12 @@ impl Intf { // - if the string falls outside bounds: // for i64 output, the int minimum or int max (depending on sign) // for u64 output, the u64 max in the output radix - fn conv_from_segment(segment: &str, radix_in: Base, field_char: char, sign: i8) -> FormatPrimitive { + fn conv_from_segment( + segment: &str, + radix_in: Base, + field_char: char, + sign: i8, + ) -> FormatPrimitive { match field_char { 'i' | 'd' => match i64::from_str_radix(segment, radix_in as u32) { Ok(i) => { diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 83567e447..403134b4b 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -475,12 +475,14 @@ impl Stater { let show_fs = matches.is_present(options::FILE_SYSTEM); let default_tokens = if format_str.is_empty() { - Stater::generate_tokens(&Stater::default_format(show_fs, terse, false), use_printf).unwrap() + Stater::generate_tokens(&Stater::default_format(show_fs, terse, false), use_printf) + .unwrap() } else { Stater::generate_tokens(&format_str, use_printf)? }; let default_dev_tokens = - Stater::generate_tokens(&Stater::default_format(show_fs, terse, true), use_printf).unwrap(); + Stater::generate_tokens(&Stater::default_format(show_fs, terse, true), use_printf) + .unwrap(); let mount_list = if show_fs { // mount points aren't displayed when showing filesystem information @@ -540,12 +542,13 @@ impl Stater { match result { Ok(meta) => { let file_type = meta.file_type(); - let tokens = - if self.from_user || !(file_type.is_char_device() || file_type.is_block_device()) { - &self.default_tokens - } else { - &self.default_dev_tokens - }; + let tokens = if self.from_user + || !(file_type.is_char_device() || file_type.is_block_device()) + { + &self.default_tokens + } else { + &self.default_dev_tokens + }; for t in tokens.iter() { match *t { @@ -867,7 +870,8 @@ impl Stater { } else { format_str.push_str(" File: %N\n Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"); if show_dev_type { - format_str.push_str("Device: %Dh/%dd\tInode: %-10i Links: %-5h Device type: %t,%T\n"); + format_str + .push_str("Device: %Dh/%dd\tInode: %-10i Links: %-5h Device type: %t,%T\n"); } else { format_str.push_str("Device: %Dh/%dd\tInode: %-10i Links: %h\n"); } diff --git a/src/uucore/src/lib/features/fsext.rs b/src/uucore/src/lib/features/fsext.rs index e1cb67097..d3eec468a 100644 --- a/src/uucore/src/lib/features/fsext.rs +++ b/src/uucore/src/lib/features/fsext.rs @@ -612,12 +612,12 @@ impl FsMeta for StatFs { } #[cfg(target_os = "freebsd")] fn namelen(&self) -> u64 { - self.f_namemax as u64 // spell-checker:disable-line + self.f_namemax as u64 // spell-checker:disable-line } // XXX: should everything just use statvfs? #[cfg(not(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux")))] fn namelen(&self) -> u64 { - self.f_namemax as u64 // spell-checker:disable-line + self.f_namemax as u64 // spell-checker:disable-line } } diff --git a/tests/benches/factor/benches/table.rs b/tests/benches/factor/benches/table.rs index d8859d940..9090c7d51 100644 --- a/tests/benches/factor/benches/table.rs +++ b/tests/benches/factor/benches/table.rs @@ -18,7 +18,7 @@ fn table(c: &mut Criterion) { // Deterministic RNG; use an explicitly-named RNG to guarantee stability use rand::{RngCore, SeedableRng}; use rand_chacha::ChaCha8Rng; - const SEED: u64 = 0xdead_bebe_ea75_cafe; // spell-checker:disable-line + const SEED: u64 = 0xdead_bebe_ea75_cafe; // spell-checker:disable-line let mut rng = ChaCha8Rng::seed_from_u64(SEED); std::iter::repeat_with(move || array_init::<_, _, INPUT_SIZE>(|_| rng.next_u64())) diff --git a/tests/by-util/test_base64.rs b/tests/by-util/test_base64.rs index 459845ccf..236f53fb1 100644 --- a/tests/by-util/test_base64.rs +++ b/tests/by-util/test_base64.rs @@ -38,7 +38,7 @@ fn test_decode() { #[test] fn test_garbage() { - let input = "aGVsbG8sIHdvcmxkIQ==\0"; // spell-checker:disable-line + let input = "aGVsbG8sIHdvcmxkIQ==\0"; // spell-checker:disable-line new_ucmd!() .arg("-d") .pipe_in(input) @@ -49,7 +49,7 @@ fn test_garbage() { #[test] fn test_ignore_garbage() { for ignore_garbage_param in &["-i", "--ignore-garbage"] { - let input = "aGVsbG8sIHdvcmxkIQ==\0"; // spell-checker:disable-line + let input = "aGVsbG8sIHdvcmxkIQ==\0"; // spell-checker:disable-line new_ucmd!() .arg("-d") .arg(ignore_garbage_param) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index b00c58dc1..fadf378ab 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -9,7 +9,7 @@ fn test_output_simple() { new_ucmd!() .args(&["alpha.txt"]) .succeeds() - .stdout_only("abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); // spell-checker:disable-line + .stdout_only("abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); // spell-checker:disable-line } #[test] @@ -67,8 +67,8 @@ fn test_fifo_symlink() { assert!(s.fixtures.is_fifo("dir/pipe")); // Make cat read the pipe through a symlink - s.fixtures.symlink_file("dir/pipe", "sympipe"); // spell-checker:disable-line - let proc = s.ucmd().args(&["sympipe"]).run_no_wait(); // spell-checker:disable-line + s.fixtures.symlink_file("dir/pipe", "sympipe"); // spell-checker:disable-line + let proc = s.ucmd().args(&["sympipe"]).run_no_wait(); // spell-checker:disable-line let data = vec_of_size(128 * 1024); let data2 = data.clone(); @@ -111,7 +111,7 @@ fn test_piped_to_regular_file() { .succeeds(); } let contents = read_to_string(&file_path).unwrap(); - assert_eq!(contents, "abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); // spell-checker:disable-line + assert_eq!(contents, "abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); // spell-checker:disable-line } } @@ -193,7 +193,7 @@ fn test_three_directories_and_file_and_stdin() { "alpha.txt", "-", "file_which_does_not_exist.txt", - "nonewline.txt", // spell-checker:disable-line + "nonewline.txt", // spell-checker:disable-line "test_directory3/test_directory5", "test_directory3/../test_directory3/test_directory5", "test_directory3", @@ -202,7 +202,7 @@ fn test_three_directories_and_file_and_stdin() { .fails() .stderr_is_fixture("three_directories_and_file_and_stdin.stderr.expected") .stdout_is( - "abcde\nfghij\nklmno\npqrst\nuvwxyz\nstdout bytestext without a trailing newline", // spell-checker:disable-line + "abcde\nfghij\nklmno\npqrst\nuvwxyz\nstdout bytestext without a trailing newline", // spell-checker:disable-line ); } diff --git a/tests/by-util/test_comm.rs b/tests/by-util/test_comm.rs index ba26f6819..01cdcc985 100644 --- a/tests/by-util/test_comm.rs +++ b/tests/by-util/test_comm.rs @@ -39,7 +39,7 @@ fn a_empty() { new_ucmd!() .args(&["a", "empty"]) .succeeds() - .stdout_only_fixture("aempty.expected"); // spell-checker:disable-line + .stdout_only_fixture("aempty.expected"); // spell-checker:disable-line } #[test] diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 9689ff49e..72747fa66 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -181,7 +181,7 @@ fn test_date_set_valid_2() { if get_effective_uid() == 0 { let result = new_ucmd!() .arg("--set") - .arg("Sat 20 Mar 2021 14:53:01 AWST") // spell-checker:disable-line + .arg("Sat 20 Mar 2021 14:53:01 AWST") // spell-checker:disable-line .fails(); result.no_stdout(); assert!(result.stderr_str().starts_with("date: invalid date ")); diff --git a/tests/by-util/test_dircolors.rs b/tests/by-util/test_dircolors.rs index 86b72d23b..fac4161f3 100644 --- a/tests/by-util/test_dircolors.rs +++ b/tests/by-util/test_dircolors.rs @@ -35,9 +35,9 @@ fn test_str_utils() { assert_eq!("asd#zcv", s.purify()); let s = "con256asd"; - assert!(s.fnmatch("*[2][3-6][5-9]?sd")); // spell-checker:disable-line + assert!(s.fnmatch("*[2][3-6][5-9]?sd")); // spell-checker:disable-line - let s = "zxc \t\nqwe jlk hjl"; // spell-checker:disable-line + let s = "zxc \t\nqwe jlk hjl"; // spell-checker:disable-line let (k, v) = s.split_two(); assert_eq!("zxc", k); assert_eq!("qwe jlk hjl", v); diff --git a/tests/by-util/test_echo.rs b/tests/by-util/test_echo.rs index 483ad99f5..09ed9658f 100644 --- a/tests/by-util/test_echo.rs +++ b/tests/by-util/test_echo.rs @@ -189,7 +189,7 @@ fn test_hyphen_values_inside_string() { new_ucmd!() .arg("'\"\n'CXXFLAGS=-g -O2'\n\"'") // spell-checker:disable-line .succeeds() - .stdout_contains("CXXFLAGS"); // spell-checker:disable-line + .stdout_contains("CXXFLAGS"); // spell-checker:disable-line } #[test] diff --git a/tests/by-util/test_factor.rs b/tests/by-util/test_factor.rs index 063cf0e4f..a3f06ea8a 100644 --- a/tests/by-util/test_factor.rs +++ b/tests/by-util/test_factor.rs @@ -209,7 +209,10 @@ fn test_big_primes() { fn run(input_string: &[u8], output_string: &[u8]) { println!("STDIN='{}'", String::from_utf8_lossy(input_string)); - println!("STDOUT(expected)='{}'", String::from_utf8_lossy(output_string)); + println!( + "STDOUT(expected)='{}'", + String::from_utf8_lossy(output_string) + ); // now run factor new_ucmd!() .pipe_in(input_string) diff --git a/tests/by-util/test_fold.rs b/tests/by-util/test_fold.rs index 62a2bddf3..1acdadac1 100644 --- a/tests/by-util/test_fold.rs +++ b/tests/by-util/test_fold.rs @@ -282,7 +282,7 @@ fn test_backspace_is_not_word_boundary() { .args(&["-w10", "-s"]) .pipe_in("foobar\x086789abcdef") .succeeds() - .stdout_is("foobar\x086789a\nbcdef"); // spell-checker:disable-line + .stdout_is("foobar\x086789a\nbcdef"); // spell-checker:disable-line } #[test] @@ -308,9 +308,9 @@ fn test_carriage_return_should_reset_column_count() { fn test_carriage_return_is_not_word_boundary() { new_ucmd!() .args(&["-w6", "-s"]) - .pipe_in("fizz\rbuzz\rfizzbuzz") // spell-checker:disable-line + .pipe_in("fizz\rbuzz\rfizzbuzz") // spell-checker:disable-line .succeeds() - .stdout_is("fizz\rbuzz\rfizzbu\nzz"); // spell-checker:disable-line + .stdout_is("fizz\rbuzz\rfizzbu\nzz"); // spell-checker:disable-line } // @@ -530,7 +530,7 @@ fn test_bytewise_carriage_return_should_not_reset_column_count() { fn test_bytewise_carriage_return_is_not_word_boundary() { new_ucmd!() .args(&["-w6", "-s", "-b"]) - .pipe_in("fizz\rbuzz\rfizzbuzz") // spell-checker:disable-line + .pipe_in("fizz\rbuzz\rfizzbuzz") // spell-checker:disable-line .succeeds() .stdout_is("fizz\rb\nuzz\rfi\nzzbuzz"); // spell-checker:disable-line } diff --git a/tests/by-util/test_kill.rs b/tests/by-util/test_kill.rs index 886445109..fe5d4557a 100644 --- a/tests/by-util/test_kill.rs +++ b/tests/by-util/test_kill.rs @@ -82,7 +82,7 @@ fn test_kill_set_bad_signal_name() { // spell-checker:disable-line new_ucmd!() .arg("-s") - .arg("IAMNOTASIGNAL") // spell-checker:disable-line + .arg("IAMNOTASIGNAL") // spell-checker:disable-line .fails() .stderr_contains("unknown signal"); } diff --git a/tests/by-util/test_ln.rs b/tests/by-util/test_ln.rs index 4dc50566b..e475e3608 100644 --- a/tests/by-util/test_ln.rs +++ b/tests/by-util/test_ln.rs @@ -120,7 +120,7 @@ fn test_symlink_interactive() { scene .ucmd() .args(&["-i", "-s", file, link]) - .pipe_in("Yesh") // spell-checker:disable-line + .pipe_in("Yesh") // spell-checker:disable-line .succeeds() .no_stderr(); diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index dd6e4a85d..20c6b913d 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -941,7 +941,7 @@ fn test_ls_color() { let a_with_colors = "\x1b[1;34ma\x1b[0m"; let z_with_colors = "\x1b[1;34mz\x1b[0m"; - let nested_dir_with_colors = "\x1b[1;34mnested_dir\x1b[0m"; // spell-checker:disable-line + let nested_dir_with_colors = "\x1b[1;34mnested_dir\x1b[0m"; // spell-checker:disable-line // Color is disabled by default let result = scene.ucmd().succeeds(); diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index e61d45428..d601bad5b 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -10,8 +10,8 @@ static TEST_TEMPLATE2: &str = "temp"; static TEST_TEMPLATE3: &str = "tempX"; static TEST_TEMPLATE4: &str = "tempXX"; static TEST_TEMPLATE5: &str = "tempXXX"; -static TEST_TEMPLATE6: &str = "tempXXXlate"; // spell-checker:disable-line -static TEST_TEMPLATE7: &str = "XXXtemplate"; // spell-checker:disable-line +static TEST_TEMPLATE6: &str = "tempXXXlate"; // spell-checker:disable-line +static TEST_TEMPLATE7: &str = "XXXtemplate"; // spell-checker:disable-line #[cfg(unix)] static TEST_TEMPLATE8: &str = "tempXXXl/ate"; #[cfg(windows)] diff --git a/tests/by-util/test_more.rs b/tests/by-util/test_more.rs index 69499ccfe..9b28ee24e 100644 --- a/tests/by-util/test_more.rs +++ b/tests/by-util/test_more.rs @@ -5,7 +5,8 @@ fn test_more_no_arg() { // Reading from stdin is now supported, so this must succeed if atty::is(atty::Stream::Stdout) { new_ucmd!().succeeds(); - } else {} + } else { + } } #[test] @@ -19,5 +20,6 @@ fn test_more_dir_arg() { const EXPECTED_ERROR_MESSAGE: &str = "more: '.' is a directory.\nTry 'more --help' for more information."; assert_eq!(result.stderr_str().trim(), EXPECTED_ERROR_MESSAGE); - } else {} + } else { + } } diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index 2782ac246..2f35bf5eb 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -171,7 +171,7 @@ fn test_mv_interactive() { .arg("-i") .arg(file_a) .arg(file_b) - .pipe_in("Yesh") // spell-checker:disable-line + .pipe_in("Yesh") // spell-checker:disable-line .succeeds() .no_stderr(); diff --git a/tests/by-util/test_nice.rs b/tests/by-util/test_nice.rs index 005651c52..25886de78 100644 --- a/tests/by-util/test_nice.rs +++ b/tests/by-util/test_nice.rs @@ -17,7 +17,7 @@ fn test_negative_adjustment() { let res = new_ucmd!().args(&["-n", "-1", "true"]).run(); assert!(res .stderr_str() - .starts_with("nice: warning: setpriority: Permission denied")); // spell-checker:disable-line + .starts_with("nice: warning: setpriority: Permission denied")); // spell-checker:disable-line } #[test] diff --git a/tests/by-util/test_od.rs b/tests/by-util/test_od.rs index 6b1c39d63..c21c683dc 100644 --- a/tests/by-util/test_od.rs +++ b/tests/by-util/test_od.rs @@ -81,7 +81,7 @@ fn test_2files() { fn test_no_file() { let temp = env::temp_dir(); let tmpdir = Path::new(&temp); - let file = tmpdir.join("}surely'none'would'thus'a'file'name"); // spell-checker:disable-line + let file = tmpdir.join("}surely'none'would'thus'a'file'name"); // spell-checker:disable-line new_ucmd!().arg(file.as_os_str()).fails(); } @@ -89,7 +89,7 @@ fn test_no_file() { // Test that od reads from stdin instead of a file #[test] fn test_from_stdin() { - let input = "abcdefghijklmnopqrstuvwxyz\n"; // spell-checker:disable-line + let input = "abcdefghijklmnopqrstuvwxyz\n"; // spell-checker:disable-line new_ucmd!() .arg("--endian=little") .run_piped_stdin(input.as_bytes()) @@ -128,7 +128,7 @@ fn test_from_mixed() { #[test] fn test_multiple_formats() { - let input = "abcdefghijklmnopqrstuvwxyz\n"; // spell-checker:disable-line + let input = "abcdefghijklmnopqrstuvwxyz\n"; // spell-checker:disable-line new_ucmd!() .arg("-c") .arg("-b") @@ -294,7 +294,7 @@ fn test_multibyte() { new_ucmd!() .arg("-c") .arg("-w12") - .run_piped_stdin("Universität Tübingen \u{1B000}".as_bytes()) // spell-checker:disable-line + .run_piped_stdin("Universität Tübingen \u{1B000}".as_bytes()) // spell-checker:disable-line .success() .no_stderr() .stdout_is(unindent( @@ -511,7 +511,7 @@ fn test_max_uint() { new_ucmd!() .arg("--format=o8") - .arg("-Oobtu8") // spell-checker:disable-line + .arg("-Oobtu8") // spell-checker:disable-line .arg("-Dd") .arg("--format=u1") .run_piped_stdin(&input[..]) @@ -589,7 +589,7 @@ fn test_invalid_offset() { #[test] fn test_skip_bytes() { - let input = "abcdefghijklmnopq"; // spell-checker:disable-line + let input = "abcdefghijklmnopq"; // spell-checker:disable-line new_ucmd!() .arg("-c") .arg("--skip-bytes=5") @@ -615,7 +615,7 @@ fn test_skip_bytes_error() { #[test] fn test_read_bytes() { - let input = "abcdefghijklmnopqrstuvwxyz\n12345678"; // spell-checker:disable-line + let input = "abcdefghijklmnopqrstuvwxyz\n12345678"; // spell-checker:disable-line new_ucmd!() .arg("--endian=little") .arg("--read-bytes=27") @@ -674,7 +674,7 @@ fn test_filename_parsing() { #[test] fn test_stdin_offset() { - let input = "abcdefghijklmnopq"; // spell-checker:disable-line + let input = "abcdefghijklmnopq"; // spell-checker:disable-line new_ucmd!() .arg("-c") .arg("+5") @@ -709,7 +709,7 @@ fn test_file_offset() { #[test] fn test_traditional() { // note gnu od does not align both lines - let input = "abcdefghijklmnopq"; // spell-checker:disable-line + let input = "abcdefghijklmnopq"; // spell-checker:disable-line new_ucmd!() .arg("--traditional") .arg("-a") @@ -732,7 +732,7 @@ fn test_traditional() { #[test] fn test_traditional_with_skip_bytes_override() { // --skip-bytes is ignored in this case - let input = "abcdefghijklmnop"; // spell-checker:disable-line + let input = "abcdefghijklmnop"; // spell-checker:disable-line new_ucmd!() .arg("--traditional") .arg("--skip-bytes=10") @@ -752,7 +752,7 @@ fn test_traditional_with_skip_bytes_override() { #[test] fn test_traditional_with_skip_bytes_non_override() { // no offset specified in the traditional way, so --skip-bytes is used - let input = "abcdefghijklmnop"; // spell-checker:disable-line + let input = "abcdefghijklmnop"; // spell-checker:disable-line new_ucmd!() .arg("--traditional") .arg("--skip-bytes=10") @@ -782,7 +782,7 @@ fn test_traditional_error() { #[test] fn test_traditional_only_label() { - let input = "abcdefghijklmnopqrstuvwxyz"; // spell-checker:disable-line + let input = "abcdefghijklmnopqrstuvwxyz"; // spell-checker:disable-line new_ucmd!() .arg("-An") .arg("--traditional") diff --git a/tests/by-util/test_pinky.rs b/tests/by-util/test_pinky.rs index c3c9ea2e4..0813e5e1b 100644 --- a/tests/by-util/test_pinky.rs +++ b/tests/by-util/test_pinky.rs @@ -9,9 +9,9 @@ pub use self::pinky::*; #[test] fn test_capitalize() { - assert_eq!("Zbnmasd", "zbnmasd".capitalize()); // spell-checker:disable-line - assert_eq!("Abnmasd", "Abnmasd".capitalize()); // spell-checker:disable-line - assert_eq!("1masd", "1masd".capitalize()); // spell-checker:disable-line + assert_eq!("Zbnmasd", "zbnmasd".capitalize()); // spell-checker:disable-line + assert_eq!("Abnmasd", "Abnmasd".capitalize()); // spell-checker:disable-line + assert_eq!("1masd", "1masd".capitalize()); // spell-checker:disable-line assert_eq!("", "".capitalize()); } diff --git a/tests/by-util/test_printf.rs b/tests/by-util/test_printf.rs index 40e91ef4f..b5c9dc3ed 100644 --- a/tests/by-util/test_printf.rs +++ b/tests/by-util/test_printf.rs @@ -401,7 +401,7 @@ fn sub_any_asterisk_hex_arg() { #[test] fn sub_any_specifiers_no_params() { new_ucmd!() - .args(&["%ztlhLji", "3"]) //spell-checker:disable-line + .args(&["%ztlhLji", "3"]) //spell-checker:disable-line .succeeds() .stdout_only("3"); } @@ -409,7 +409,7 @@ fn sub_any_specifiers_no_params() { #[test] fn sub_any_specifiers_after_first_param() { new_ucmd!() - .args(&["%0ztlhLji", "3"]) //spell-checker:disable-line + .args(&["%0ztlhLji", "3"]) //spell-checker:disable-line .succeeds() .stdout_only("3"); } @@ -417,7 +417,7 @@ fn sub_any_specifiers_after_first_param() { #[test] fn sub_any_specifiers_after_period() { new_ucmd!() - .args(&["%0.ztlhLji", "3"]) //spell-checker:disable-line + .args(&["%0.ztlhLji", "3"]) //spell-checker:disable-line .succeeds() .stdout_only("3"); } @@ -425,7 +425,7 @@ fn sub_any_specifiers_after_period() { #[test] fn sub_any_specifiers_after_second_param() { new_ucmd!() - .args(&["%0.0ztlhLji", "3"]) //spell-checker:disable-line + .args(&["%0.0ztlhLji", "3"]) //spell-checker:disable-line .succeeds() .stdout_only("3"); } diff --git a/tests/by-util/test_relpath.rs b/tests/by-util/test_relpath.rs index 051f46084..44a685c90 100644 --- a/tests/by-util/test_relpath.rs +++ b/tests/by-util/test_relpath.rs @@ -120,7 +120,7 @@ fn test_relpath_with_from_with_d() { .ucmd() .arg(to) .arg(from) - .arg("-dnon_existing") // spell-checker:disable-line + .arg("-dnon_existing") // spell-checker:disable-line .succeeds() .stdout_move_str(); assert!(Path::new(&_result_stdout).is_absolute()); @@ -170,7 +170,7 @@ fn test_relpath_no_from_with_d() { let result_stdout = scene .ucmd() .arg(to) - .arg("-dnon_existing") // spell-checker:disable-line + .arg("-dnon_existing") // spell-checker:disable-line .succeeds() .stdout_move_str(); assert!(Path::new(&result_stdout).is_absolute()); diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 64259d02c..0592be244 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -65,7 +65,7 @@ fn test_rm_interactive() { .arg("-i") .arg(file_a) .arg(file_b) - .pipe_in("Yesh") // spell-checker:disable-line + .pipe_in("Yesh") // spell-checker:disable-line .succeeds(); assert!(!at.file_exists(file_a)); diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index c31d44110..d2b447925 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -292,10 +292,10 @@ fn test_dictionary_order() { fn test_dictionary_order2() { for non_dictionary_order2_param in &["-d"] { new_ucmd!() - .pipe_in("a👦🏻aa b\naaaa b") // spell-checker:disable-line - .arg(non_dictionary_order2_param) // spell-checker:disable-line + .pipe_in("a👦🏻aa b\naaaa b") // spell-checker:disable-line + .arg(non_dictionary_order2_param) // spell-checker:disable-line .succeeds() - .stdout_only("a👦🏻aa b\naaaa b\n"); // spell-checker:disable-line + .stdout_only("a👦🏻aa b\naaaa b\n"); // spell-checker:disable-line } } @@ -303,10 +303,10 @@ fn test_dictionary_order2() { fn test_non_printing_chars() { for non_printing_chars_param in &["-i"] { new_ucmd!() - .pipe_in("a👦🏻aa\naaaa") // spell-checker:disable-line - .arg(non_printing_chars_param) // spell-checker:disable-line + .pipe_in("a👦🏻aa\naaaa") // spell-checker:disable-line + .arg(non_printing_chars_param) // spell-checker:disable-line .succeeds() - .stdout_only("a👦🏻aa\naaaa\n"); // spell-checker:disable-line + .stdout_only("a👦🏻aa\naaaa\n"); // spell-checker:disable-line } } diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 5c8d9d185..89dd96752 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -13,9 +13,9 @@ fn test_scanners() { assert_eq!(None, "z192zxc".scan_num::()); assert_eq!(Some(('a', 3)), "141zxc".scan_char(8)); - assert_eq!(Some(('\n', 2)), "12qzxc".scan_char(8)); // spell-checker:disable-line - assert_eq!(Some(('\r', 1)), "dqzxc".scan_char(16)); // spell-checker:disable-line - assert_eq!(None, "z2qzxc".scan_char(8)); // spell-checker:disable-line + assert_eq!(Some(('\n', 2)), "12qzxc".scan_char(8)); // spell-checker:disable-line + assert_eq!(Some(('\r', 1)), "dqzxc".scan_char(16)); // spell-checker:disable-line + assert_eq!(None, "z2qzxc".scan_char(8)); // spell-checker:disable-line } #[test] diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 0e3092562..b31344c34 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -268,7 +268,7 @@ fn test_parse_size() { assert!(parse_size("1Y").is_err()); // Bad number - assert!(parse_size("328hdsf3290").is_err()); // spell-checker:disable-line + assert!(parse_size("328hdsf3290").is_err()); // spell-checker:disable-line } #[test] diff --git a/tests/by-util/test_test.rs b/tests/by-util/test_test.rs index a29c4f6c6..aaf09d657 100644 --- a/tests/by-util/test_test.rs +++ b/tests/by-util/test_test.rs @@ -210,7 +210,7 @@ fn test_pseudofloat_not_equal() { #[test] fn test_negative_arg_is_a_string() { new_ucmd!().arg("-12345").succeeds(); - new_ucmd!().arg("--qwert").succeeds(); // spell-checker:disable-line + new_ucmd!().arg("--qwert").succeeds(); // spell-checker:disable-line } #[test] diff --git a/tests/by-util/test_tr.rs b/tests/by-util/test_tr.rs index 4ddaff573..936af2ca8 100644 --- a/tests/by-util/test_tr.rs +++ b/tests/by-util/test_tr.rs @@ -140,9 +140,9 @@ fn test_translate_and_squeeze() { fn test_translate_and_squeeze_multiple_lines() { new_ucmd!() .args(&["-s", "x", "y"]) - .pipe_in("xxaax\nxaaxx") // spell-checker:disable-line + .pipe_in("xxaax\nxaaxx") // spell-checker:disable-line .run() - .stdout_is("yaay\nyaay"); // spell-checker:disable-line + .stdout_is("yaay\nyaay"); // spell-checker:disable-line } #[test] @@ -169,7 +169,7 @@ fn test_set1_longer_than_set2() { .args(&["abc", "xy"]) .pipe_in("abcde") .run() - .stdout_is("xyyde"); // spell-checker:disable-line + .stdout_is("xyyde"); // spell-checker:disable-line } #[test] @@ -178,7 +178,7 @@ fn test_set1_shorter_than_set2() { .args(&["ab", "xyz"]) .pipe_in("abcde") .run() - .stdout_is("xycde"); // spell-checker:disable-line + .stdout_is("xycde"); // spell-checker:disable-line } #[test] @@ -187,7 +187,7 @@ fn test_truncate() { .args(&["-t", "abc", "xy"]) .pipe_in("abcde") .run() - .stdout_is("xycde"); // spell-checker:disable-line + .stdout_is("xycde"); // spell-checker:disable-line } #[test] @@ -196,7 +196,7 @@ fn test_truncate_with_set1_shorter_than_set2() { .args(&["-t", "ab", "xyz"]) .pipe_in("abcde") .run() - .stdout_is("xycde"); // spell-checker:disable-line + .stdout_is("xycde"); // spell-checker:disable-line } #[test] @@ -216,8 +216,8 @@ fn missing_required_second_arg_fails() { #[test] fn test_interpret_backslash_escapes() { new_ucmd!() - .args(&["abfnrtv", r"\a\b\f\n\r\t\v"]) // spell-checker:disable-line - .pipe_in("abfnrtv") // spell-checker:disable-line + .args(&["abfnrtv", r"\a\b\f\n\r\t\v"]) // spell-checker:disable-line + .pipe_in("abfnrtv") // spell-checker:disable-line .succeeds() .stdout_is("\u{7}\u{8}\u{c}\n\r\t\u{b}"); } diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index f98027127..bb0f4a596 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -47,12 +47,7 @@ fn test_reference() { scene.ucmd().arg("-s").arg("+5KB").arg(FILE1).run(); - scene - .ucmd() - .arg("--reference") - .arg(FILE1) - .arg(FILE2) - .run(); + scene.ucmd().arg("--reference").arg(FILE1).arg(FILE2).run(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); From 691f03b9aed62ae980f284e4aea153e34614a810 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 23:18:46 -0500 Subject: [PATCH 0810/1135] maint/CICD ~ improve visibility of spell check during testing --- .github/workflows/CICD.yml | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 78048adff..4ce9e556d 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -58,6 +58,24 @@ jobs: # * convert any warnings to GHA UI annotations; ref: S=$(find tests -name "*.rs" -print0 | xargs -0 cargo fmt -- --check) && printf "%s\n" "$S" || { printf "%s\n" "$S" | sed -E -n "s/^Diff[[:space:]]+in[[:space:]]+${PWD//\//\\/}\/(.*)[[:space:]]+at[[:space:]]+[^0-9]+([0-9]+).*$/::warning file=\1,line=\2::WARNING: \`cargo fmt\`: style violation/p" ; } + code_spellcheck: + name: Style/spelling + runs-on: ${{ matrix.job.os }} + strategy: + matrix: + job: + - { os: ubuntu-latest } + steps: + - uses: actions/checkout@v1 + - name: Install/setup prerequisites + shell: bash + run: | + sudo apt-get -y update ; sudo apt-get -y install npm ; sudo npm install cspell -g; + - name: Run `cspell` + shell: bash + run: | + cspell --config .vscode/cSpell.json --no-summary --no-progress **/* | sed "s/\(.*\):\(.*\):\(.*\) - \(.*\)/::warning file=\1,line=\2,col=\3::cspell: \4/" || true + code_warnings: name: Style/warnings runs-on: ${{ matrix.job.os }} @@ -614,20 +632,3 @@ jobs: flags: ${{ steps.vars.outputs.CODECOV_FLAGS }} name: codecov-umbrella fail_ci_if_error: false - spellcheck: - name: Spell Check - runs-on: ${{ matrix.job.os }} - strategy: - matrix: - job: - - { os: ubuntu-latest } - steps: - - uses: actions/checkout@v1 - - name: Install/setup prerequisites - shell: bash - run: | - sudo apt-get -y update ; sudo apt-get -y install npm ; sudo npm install cspell -g; - - name: Run `cspell` - shell: bash - run: | - cspell --config .vscode/cSpell.json --no-summary --no-progress **/* | sed "s/\(.*\):\(.*\):\(.*\) - \(.*\)/::warning file=\1,line=\2,col=\3::cspell: \4/" || true From 9d8e7b9acbb0b0a41fc6488687a0293b6f696aef Mon Sep 17 00:00:00 2001 From: Dean Li Date: Mon, 31 May 2021 20:13:58 +0800 Subject: [PATCH 0811/1135] Fix touch parse date error Now it can parse `touch -d 2000-01-23 file` and add test for parse date error. Related to #2311 --- Cargo.lock | 24 +----------------------- src/uu/touch/src/touch.rs | 10 +++++++--- tests/by-util/test_touch.rs | 28 ++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1365049a9..21bd5950b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -513,28 +513,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "csv" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" -dependencies = [ - "bstr", - "csv-core", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "csv-core" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" -dependencies = [ - "memchr 2.4.0", -] - [[package]] name = "ctor" version = "0.1.20" @@ -954,7 +932,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" dependencies = [ "winapi 0.3.9", - ] +] [[package]] name = "num-bigint" diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 00b936e55..b76e04b7a 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -238,10 +238,14 @@ fn parse_date(str: &str) -> FileTime { // be any simple specification for what format this parameter allows and I'm // not about to implement GNU parse_datetime. // http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=lib/parse-datetime.y - match time::strptime(str, "%c") { - Ok(tm) => local_tm_to_filetime(to_local(tm)), - Err(e) => panic!("Unable to parse date\n{}", e), + let formats = vec!["%c", "%F"]; + for f in formats { + if let Ok(tm) = time::strptime(str, f) { + return local_tm_to_filetime(to_local(tm)); + } } + show_error!("Unable to parse date: {}\n", str); + process::exit(1); } fn parse_timestamp(s: &str) -> FileTime { diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index d4d2c058e..ecd56ab71 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -354,6 +354,34 @@ fn test_touch_set_date() { assert_eq!(mtime, start_of_year); } +#[test] +fn test_touch_set_date2() { + let (at, mut ucmd) = at_and_ucmd!(); + let file = "test_touch_set_date"; + + ucmd.args(&["-d", "2000-01-23", file]) + .succeeds() + .no_stderr(); + + assert!(at.file_exists(file)); + + let start_of_year = str_to_filetime("%Y%m%d%H%M", "200001230000"); + let (atime, mtime) = get_file_times(&at, file); + assert_eq!(atime, mtime); + assert_eq!(atime, start_of_year); + assert_eq!(mtime, start_of_year); +} + +#[test] +fn test_touch_set_date_wrong_format() { + let (_at, mut ucmd) = at_and_ucmd!(); + let file = "test_touch_set_date_wrong_format"; + + ucmd.args(&["-d", "2005-43-21", file]) + .fails() + .stderr_contains("Unable to parse date: 2005-43-21"); +} + #[test] fn test_touch_mtime_dst_succeeds() { let (at, mut ucmd) = at_and_ucmd!(); From 6ccc3055136d9347e16db5b8d7ec5854cca611df Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Mon, 31 May 2021 20:49:02 +0200 Subject: [PATCH 0812/1135] seq: implement integer sequences If we notice that we can represent all arguments as BigInts, take a different code path. Just like GNU seq this means we can print an infinite amount of numbers in this case. --- Cargo.lock | 2 + src/uu/seq/Cargo.toml | 2 + src/uu/seq/src/seq.rs | 137 ++++++++++++++++++++++++++++++-------- tests/by-util/test_seq.rs | 61 +++++++++++++++++ 4 files changed, 173 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 21bd5950b..ca963674a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2402,6 +2402,8 @@ name = "uu_seq" version = "0.0.6" dependencies = [ "clap", + "num-bigint", + "num-traits", "uucore", "uucore_procs", ] diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index 96c629c68..32f2bbac8 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -16,6 +16,8 @@ path = "src/seq.rs" [dependencies] clap = "2.33" +num-bigint = "0.4.0" +num-traits = "0.2.14" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index c3bba1c78..fc72efc5a 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -7,8 +7,13 @@ extern crate uucore; use clap::{App, AppSettings, Arg}; +use num_bigint::BigInt; +use num_traits::One; +use num_traits::Zero; +use num_traits::{Num, ToPrimitive}; use std::cmp; use std::io::{stdout, Write}; +use std::str::FromStr; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Display numbers from FIRST to LAST, in steps of INCREMENT."; @@ -33,16 +38,46 @@ struct SeqOptions { widths: bool, } -fn parse_float(mut s: &str) -> Result { - if s.starts_with('+') { - s = &s[1..]; +enum Number { + BigInt(BigInt), + F64(f64), +} + +impl Number { + fn is_zero(&self) -> bool { + match self { + Number::BigInt(n) => n.is_zero(), + Number::F64(n) => n.is_zero(), + } } - match s.parse() { - Ok(n) => Ok(n), - Err(e) => Err(format!( - "seq: invalid floating point argument `{}`: {}", - s, e - )), + + fn into_f64(self) -> f64 { + match self { + // BigInt::to_f64() can not return None. + Number::BigInt(n) => n.to_f64().unwrap(), + Number::F64(n) => n, + } + } +} + +impl FromStr for Number { + type Err = String; + /// Tries to parse this string as a BigInt, or if that fails as an f64. + fn from_str(mut s: &str) -> Result { + if s.starts_with('+') { + s = &s[1..]; + } + + match s.parse::() { + Ok(n) => Ok(Number::BigInt(n)), + Err(_) => match s.parse::() { + Ok(n) => Ok(Number::F64(n)), + Err(e) => Err(format!( + "seq: invalid floating point argument `{}`: {}", + s, e + )), + }, + } } } @@ -107,7 +142,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let dec = slice.find('.').unwrap_or(len); largest_dec = len - dec; padding = dec; - match parse_float(slice) { + match slice.parse() { Ok(n) => n, Err(s) => { show_error!("{}", s); @@ -115,7 +150,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } } else { - 1.0 + Number::BigInt(BigInt::one()) }; let increment = if numbers.len() > 2 { let slice = numbers[1]; @@ -123,7 +158,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let dec = slice.find('.').unwrap_or(len); largest_dec = cmp::max(largest_dec, len - dec); padding = cmp::max(padding, dec); - match parse_float(slice) { + match slice.parse() { Ok(n) => n, Err(s) => { show_error!("{}", s); @@ -131,16 +166,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } } else { - 1.0 + Number::BigInt(BigInt::one()) }; - if increment == 0.0 { + if increment.is_zero() { show_error!("increment value: '{}'", numbers[1]); return 1; } let last = { let slice = numbers[numbers.len() - 1]; padding = cmp::max(padding, slice.find('.').unwrap_or_else(|| slice.len())); - match parse_float(slice) { + match slice.parse::() { Ok(n) => n, Err(s) => { show_error!("{}", s); @@ -156,28 +191,42 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Some(term) => escape_sequences(&term[..]), None => separator.clone(), }; - print_seq( - first, - increment, - last, - largest_dec, - separator, - terminator, - options.widths, - padding, - ); + match (first, last, increment) { + (Number::BigInt(first), Number::BigInt(last), Number::BigInt(increment)) => { + print_seq_integers( + first, + increment, + last, + separator, + terminator, + options.widths, + padding, + ) + } + (first, last, increment) => print_seq( + first.into_f64(), + increment.into_f64(), + last.into_f64(), + largest_dec, + separator, + terminator, + options.widths, + padding, + ), + } 0 } -fn done_printing(next: f64, increment: f64, last: f64) -> bool { - if increment >= 0f64 { +fn done_printing(next: &T, increment: &T, last: &T) -> bool { + if increment >= &T::zero() { next > last } else { next < last } } +/// Floating point based code path #[allow(clippy::too_many_arguments)] fn print_seq( first: f64, @@ -191,7 +240,7 @@ fn print_seq( ) { let mut i = 0isize; let mut value = first + i as f64 * increment; - while !done_printing(value, increment, last) { + while !done_printing(&value, &increment, &last) { let istr = format!("{:.*}", largest_dec, value); let ilen = istr.len(); let before_dec = istr.find('.').unwrap_or(ilen); @@ -203,7 +252,7 @@ fn print_seq( print!("{}", istr); i += 1; value = first + i as f64 * increment; - if !done_printing(value, increment, last) { + if !done_printing(&value, &increment, &last) { print!("{}", separator); } } @@ -212,3 +261,33 @@ fn print_seq( } crash_if_err!(1, stdout().flush()); } + +/// BigInt based code path +fn print_seq_integers( + first: BigInt, + increment: BigInt, + last: BigInt, + separator: String, + terminator: String, + pad: bool, + padding: usize, +) { + let mut value = first; + let mut is_first_iteration = true; + while !done_printing(&value, &increment, &last) { + if !is_first_iteration { + print!("{}", separator); + } + is_first_iteration = false; + if pad { + print!("{number:>0width$}", number = value, width = padding); + } else { + print!("{}", value); + } + value += &increment; + } + + if !is_first_iteration { + print!("{}", terminator); + } +} diff --git a/tests/by-util/test_seq.rs b/tests/by-util/test_seq.rs index a74938377..3da1a84ca 100644 --- a/tests/by-util/test_seq.rs +++ b/tests/by-util/test_seq.rs @@ -1,5 +1,7 @@ use crate::common::util::*; +// ---- Tests for the big integer based path ---- + #[test] fn test_count_up() { new_ucmd!() @@ -45,3 +47,62 @@ fn test_seq_wrong_arg() { fn test_zero_step() { new_ucmd!().args(&["10", "0", "32"]).fails(); } + +#[test] +fn test_big_numbers() { + new_ucmd!() + .args(&[ + "1000000000000000000000000000", + "1000000000000000000000000001", + ]) + .succeeds() + .stdout_only("1000000000000000000000000000\n1000000000000000000000000001\n"); +} + +// ---- Tests for the floating point based path ---- + +#[test] +fn test_count_up_floats() { + new_ucmd!() + .args(&["10.0"]) + .run() + .stdout_is("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n"); +} + +#[test] +fn test_count_down_floats() { + new_ucmd!() + .args(&["--", "5", "-1.0", "1"]) + .run() + .stdout_is("5.0\n4.0\n3.0\n2.0\n1.0\n"); + new_ucmd!() + .args(&["5", "-1", "1.0"]) + .run() + .stdout_is("5\n4\n3\n2\n1\n"); +} + +#[test] +fn test_separator_and_terminator_floats() { + new_ucmd!() + .args(&["-s", ",", "-t", "!", "2.0", "6"]) + .run() + .stdout_is("2.0,3.0,4.0,5.0,6.0!"); +} + +#[test] +fn test_equalize_widths_floats() { + new_ucmd!() + .args(&["-w", "5", "10.0"]) + .run() + .stdout_is("05\n06\n07\n08\n09\n10\n"); +} + +#[test] +fn test_seq_wrong_arg_floats() { + new_ucmd!().args(&["-w", "5", "10.0", "33", "32"]).fails(); +} + +#[test] +fn test_zero_step_floats() { + new_ucmd!().args(&["10.0", "0", "32"]).fails(); +} From c78cc65421eb8089dab043079046cfffa6f2820c Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Mon, 31 May 2021 20:53:25 +0200 Subject: [PATCH 0813/1135] seq: make arguments required Right now seq panics when invoked without args. --- src/uu/seq/src/seq.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index fc72efc5a..4737fe872 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -119,7 +119,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .multiple(true) .takes_value(true) .allow_hyphen_values(true) - .max_values(3), + .max_values(3) + .required(true), ) .get_matches_from(args); From 4cf18e96f3113c07d179fee2bf966bc933e3ab80 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Mon, 31 May 2021 21:19:19 +0200 Subject: [PATCH 0814/1135] seq: change default value for -t and remove dubious escape sequences GNU seq does not support -t, but always outputs a newline at the end. Therefore, our default for -t should be \n. Also removes support for escape sequences (interpreting a literal "\n" as a newline). This is not what GNU seq is doing, and unexpected. --- src/uu/seq/src/seq.rs | 32 ++++++++++---------------------- tests/by-util/test_seq.rs | 12 ++++++++++++ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index 4737fe872..bdab044c5 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -34,7 +34,7 @@ fn get_usage() -> String { #[derive(Clone)] struct SeqOptions { separator: String, - terminator: Option, + terminator: String, widths: bool, } @@ -81,10 +81,6 @@ impl FromStr for Number { } } -fn escape_sequences(s: &str) -> String { - s.replace("\\n", "\n").replace("\\t", "\t") -} - pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) @@ -104,7 +100,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(OPT_TERMINATOR) .short("t") .long("terminator") - .help("Terminator character (defaults to separator)") + .help("Terminator character (defaults to \\n)") .takes_value(true) .number_of_values(1), ) @@ -126,14 +122,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let numbers = matches.values_of(ARG_NUMBERS).unwrap().collect::>(); - let mut options = SeqOptions { - separator: "\n".to_owned(), - terminator: None, - widths: false, + let options = SeqOptions { + separator: matches.value_of(OPT_SEPARATOR).unwrap_or("\n").to_string(), + terminator: matches.value_of(OPT_TERMINATOR).unwrap_or("\n").to_string(), + widths: matches.is_present(OPT_WIDTHS), }; - options.separator = matches.value_of(OPT_SEPARATOR).unwrap_or("\n").to_string(); - options.terminator = matches.value_of(OPT_TERMINATOR).map(String::from); - options.widths = matches.is_present(OPT_WIDTHS); let mut largest_dec = 0; let mut padding = 0; @@ -187,11 +180,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if largest_dec > 0 { largest_dec -= 1; } - let separator = escape_sequences(&options.separator[..]); - let terminator = match options.terminator { - Some(term) => escape_sequences(&term[..]), - None => separator.clone(), - }; match (first, last, increment) { (Number::BigInt(first), Number::BigInt(last), Number::BigInt(increment)) => { @@ -199,8 +187,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { first, increment, last, - separator, - terminator, + options.separator, + options.terminator, options.widths, padding, ) @@ -210,8 +198,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { increment.into_f64(), last.into_f64(), largest_dec, - separator, - terminator, + options.separator, + options.terminator, options.widths, padding, ), diff --git a/tests/by-util/test_seq.rs b/tests/by-util/test_seq.rs index 3da1a84ca..98eb23598 100644 --- a/tests/by-util/test_seq.rs +++ b/tests/by-util/test_seq.rs @@ -28,6 +28,18 @@ fn test_separator_and_terminator() { .args(&["-s", ",", "-t", "!", "2", "6"]) .run() .stdout_is("2,3,4,5,6!"); + new_ucmd!() + .args(&["-s", ",", "2", "6"]) + .run() + .stdout_is("2,3,4,5,6\n"); + new_ucmd!() + .args(&["-s", "\n", "2", "6"]) + .run() + .stdout_is("2\n3\n4\n5\n6\n"); + new_ucmd!() + .args(&["-s", "\\n", "2", "6"]) + .run() + .stdout_is("2\\n3\\n4\\n5\\n6\n"); } #[test] From 7b7185f91673a2c649bbc61cba34d0e4e47d331b Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 31 May 2021 21:20:55 +0200 Subject: [PATCH 0815/1135] Fix clippy warnings in the pr tests --- tests/by-util/test_pr.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/by-util/test_pr.rs b/tests/by-util/test_pr.rs index aae0cc058..584b15108 100644 --- a/tests/by-util/test_pr.rs +++ b/tests/by-util/test_pr.rs @@ -6,17 +6,16 @@ use std::fs::metadata; fn file_last_modified_time(ucmd: &UCommand, path: &str) -> String { let tmp_dir_path = ucmd.get_full_fixture_path(path); let file_metadata = metadata(tmp_dir_path); - return file_metadata + file_metadata .map(|i| { - return i - .modified() + i.modified() .map(|x| { let datetime: DateTime = x.into(); datetime.format("%b %d %H:%M %Y").to_string() }) - .unwrap_or(String::new()); + .unwrap_or_default() }) - .unwrap_or(String::new()); + .unwrap_or_default() } fn now_time() -> String { From 8de42ed18e1b14c8d8686e9b3a2519e1e1fa0f98 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Mon, 31 May 2021 22:23:40 +0200 Subject: [PATCH 0816/1135] maint: actually run spellcheck on all files **/* must be quoted, otherwise it is expanded by the shell and not literally passed to cspell. --- .github/workflows/CICD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 4ce9e556d..32c3537c2 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -74,7 +74,7 @@ jobs: - name: Run `cspell` shell: bash run: | - cspell --config .vscode/cSpell.json --no-summary --no-progress **/* | sed "s/\(.*\):\(.*\):\(.*\) - \(.*\)/::warning file=\1,line=\2,col=\3::cspell: \4/" || true + cspell --config .vscode/cSpell.json --no-summary --no-progress "**/*" | sed "s/\(.*\):\(.*\):\(.*\) - \(.*\)/::warning file=\1,line=\2,col=\3::cspell: \4/" || true code_warnings: name: Style/warnings From 41878f1bf4340644b0198b745c8420c3274de986 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Mon, 31 May 2021 22:38:53 +0200 Subject: [PATCH 0817/1135] refactor/pr: polish spelling --- src/uu/pr/src/pr.rs | 42 +++++++++++++++++++++------------------- tests/by-util/test_pr.rs | 6 ++++-- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index 266f605c5..486cedc00 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -6,6 +6,8 @@ // that was distributed with this source code. // +// spell-checker:ignore (ToDO) adFfmprt, kmerge + #[macro_use] extern crate quick_error; @@ -204,7 +206,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::NUMBERING_MODE_OPTION, "number-lines", "Provide width digit line numbering. The default for width, if not specified, is 5. The number occupies - the first width column positions of each text column or each line of -m output. If char (any nondigit + the first width column positions of each text column or each line of -m output. If char (any non-digit character) is given, it is appended to the line number to separate it from whatever follows. The default for char is a . Line numbers longer than width columns are truncated.", "[char][width]", @@ -274,8 +276,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::COLUMN_OPTION, "Produce multi-column output that is arranged in column columns (the default shall be 1) and is written down each column in the order in which the text is received from the input file. This option should not be used with -m. - The options -e and -i shall be assumed for multiple text-column output. Whether or not text columns are pro‐ - duced with identical vertical lengths is unspecified, but a text column shall never exceed the length of the + The options -e and -i shall be assumed for multiple text-column output. Whether or not text columns are produced + with identical vertical lengths is unspecified, but a text column shall never exceed the length of the page (see the -l option). When used with -t, use the minimum number of lines to write the output.", "[column]", HasArg::Yes, @@ -285,9 +287,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { opts.opt( options::COLUMN_WIDTH_OPTION, "width", - "Set the width of the line to width column positions for multiple text-column output only. If the -w option is - not specified and the -s option is not specified, the default width shall be 72. If the -w option is not speci‐ - fied and the -s option is specified, the default width shall be 512.", + "Set the width of the line to width column positions for multiple text-column output only. If the -w option is + not specified and the -s option is not specified, the default width shall be 72. If the -w option is not specified + and the -s option is specified, the default width shall be 512.", "[width]", HasArg::Yes, Occur::Optional, @@ -472,9 +474,9 @@ fn print_usage(opts: &mut getopts::Options, matches: &Matches) -> i32 { ); println!(); let usage: &str = "The pr utility is a printing and pagination filter - for text files. When multiple input files are spec- - ified, each is read, formatted, and written to stan- - dard output. By default, the input is separated + for text files. When multiple input files are specified, + each is read, formatted, and written to standard + output. By default, the input is separated into 66-line pages, each with o A 5-line header with the page number, date, @@ -486,8 +488,8 @@ fn print_usage(opts: &mut getopts::Options, matches: &Matches) -> i32 { diagnostic messages are suppressed until the pr utility has completed processing. - When multiple column output is specified, text col- - umns are of equal width. By default text columns + When multiple column output is specified, text columns + are of equal width. By default text columns are separated by at least one . Input lines that do not fit into a text column are truncated. Lines are not truncated under single column output."; @@ -599,8 +601,8 @@ fn build_options( let line_separator = "\n".to_string(); let last_modified_time = if is_merge_mode || paths[0].eq(FILE_STDIN) { - let datetime = Local::now(); - datetime.format("%b %d %H:%M %Y").to_string() + let date_time = Local::now(); + date_time.format("%b %d %H:%M %Y").to_string() } else { file_last_modified_time(paths.get(0).unwrap()) }; @@ -951,7 +953,7 @@ fn read_stream_and_create_pages( } fn mpr(paths: &[String], options: &OutputOptions) -> Result { - let nfiles = paths.len(); + let n_files = paths.len(); // Check if files exists for path in paths { @@ -972,7 +974,7 @@ fn mpr(paths: &[String], options: &OutputOptions) -> Result { .into_iter() .map(|fl| FileLine { page_number, - group_key: page_number * nfiles + fl.file_id, + group_key: page_number * n_files + fl.file_id, ..fl }) .collect::>() @@ -1147,11 +1149,11 @@ fn get_line_for_printing( indexes: usize, ) -> String { let blank_line = String::new(); - let fmtd_line_number = get_fmtd_line_number(&options, file_line.line_number, index); + let formatted_line_number = get_formatted_line_number(&options, file_line.line_number, index); let mut complete_line = format!( "{}{}", - fmtd_line_number, + formatted_line_number, file_line.line_content.as_ref().unwrap() ); @@ -1186,7 +1188,7 @@ fn get_line_for_printing( ) } -fn get_fmtd_line_number(opts: &OutputOptions, line_number: usize, index: usize) -> String { +fn get_formatted_line_number(opts: &OutputOptions, line_number: usize, index: usize) -> String { let should_show_line_number = opts.number.is_some() && (opts.merge_files_print.is_none() || index == 0); if should_show_line_number && line_number != 0 { @@ -1234,8 +1236,8 @@ fn file_last_modified_time(path: &str) -> String { .map(|i| { i.modified() .map(|x| { - let datetime: DateTime = x.into(); - datetime.format("%b %d %H:%M %Y").to_string() + let date_time: DateTime = x.into(); + date_time.format("%b %d %H:%M %Y").to_string() }) .unwrap_or_default() }) diff --git a/tests/by-util/test_pr.rs b/tests/by-util/test_pr.rs index aae0cc058..d4d21a6f4 100644 --- a/tests/by-util/test_pr.rs +++ b/tests/by-util/test_pr.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (ToDO) Sdivide + use crate::common::util::*; use chrono::offset::Local; use chrono::DateTime; @@ -11,8 +13,8 @@ fn file_last_modified_time(ucmd: &UCommand, path: &str) -> String { return i .modified() .map(|x| { - let datetime: DateTime = x.into(); - datetime.format("%b %d %H:%M %Y").to_string() + let date_time: DateTime = x.into(); + date_time.format("%b %d %H:%M %Y").to_string() }) .unwrap_or(String::new()); }) From 46470fc60750c5a144a2500e87ed5a61b1de7baf Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Mon, 31 May 2021 22:39:03 +0200 Subject: [PATCH 0818/1135] refactor/rmdir: polish spelling --- src/uu/rmdir/src/rmdir.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/uu/rmdir/src/rmdir.rs b/src/uu/rmdir/src/rmdir.rs index bebb2844b..d39c33f77 100644 --- a/src/uu/rmdir/src/rmdir.rs +++ b/src/uu/rmdir/src/rmdir.rs @@ -5,6 +5,8 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. +// spell-checker:ignore (ToDO) ENOTDIR + #[macro_use] extern crate uucore; From 84f2bff778b93dcc7a8ae401db1eb62aa723f8a2 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Tue, 1 Jun 2021 09:30:43 +0200 Subject: [PATCH 0819/1135] head: use "parse_size" from uucore --- src/uu/head/src/head.rs | 9 +-- src/uu/head/src/parse.rs | 135 +++++-------------------------------- tests/by-util/test_head.rs | 25 +++++++ 3 files changed, 42 insertions(+), 127 deletions(-) diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 3602b4a73..78d769020 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -107,12 +107,7 @@ where { match parse::parse_num(src) { Ok((n, last)) => Ok((closure(n), last)), - Err(reason) => match reason { - parse::ParseError::Syntax => Err(format!("'{}'", src)), - parse::ParseError::Overflow => { - Err(format!("'{}': Value too large for defined datatype", src)) - } - }, + Err(e) => Err(e.to_string()), } } @@ -473,7 +468,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let args = match HeadOptions::get_from(args) { Ok(o) => o, Err(s) => { - crash!(EXIT_FAILURE, "head: {}", s); + crash!(EXIT_FAILURE, "{}", s); } }; match uu_head(&args) { diff --git a/src/uu/head/src/parse.rs b/src/uu/head/src/parse.rs index 0cf20be42..3b788f819 100644 --- a/src/uu/head/src/parse.rs +++ b/src/uu/head/src/parse.rs @@ -1,5 +1,5 @@ -use std::convert::TryFrom; use std::ffi::OsString; +use uucore::parse_size::{parse_size, ParseSizeError}; #[derive(PartialEq, Debug)] pub enum ParseError { @@ -92,92 +92,25 @@ pub fn parse_obsolete(src: &str) -> Option } /// Parses an -c or -n argument, /// the bool specifies whether to read from the end -pub fn parse_num(src: &str) -> Result<(usize, bool), ParseError> { - let mut num_start = 0; - let mut chars = src.char_indices(); - let (mut chars, all_but_last) = match chars.next() { - Some((_, c)) => { - if c == '-' { - num_start += 1; - (chars, true) - } else { - (src.char_indices(), false) - } - } - None => return Err(ParseError::Syntax), - }; - let mut num_end = 0usize; - let mut last_char = 0 as char; - let mut num_count = 0usize; - for (n, c) in &mut chars { - if c.is_numeric() { - num_end = n; - num_count += 1; - } else { - last_char = c; - break; +pub fn parse_num(src: &str) -> Result<(usize, bool), ParseSizeError> { + let mut size_string = src.trim(); + let mut all_but_last = false; + + if let Some(c) = size_string.chars().next() { + if c == '-' { + size_string = &size_string[1..]; + all_but_last = true; } + } else { + return Err(ParseSizeError::ParseFailure(src.to_string())); } - let num = if num_count > 0 { - match src[num_start..=num_end].parse::() { - Ok(n) => Some(n), - Err(_) => return Err(ParseError::Overflow), - } - } else { - None - }; - - if last_char == 0 as char { - if let Some(n) = num { - Ok((n, all_but_last)) - } else { - Err(ParseError::Syntax) - } - } else { - let base: u128 = match chars.next() { - Some((_, c)) => { - let b = match c { - 'B' if last_char != 'b' => 1000, - 'i' if last_char != 'b' => { - if let Some((_, 'B')) = chars.next() { - 1024 - } else { - return Err(ParseError::Syntax); - } - } - _ => return Err(ParseError::Syntax), - }; - if chars.next().is_some() { - return Err(ParseError::Syntax); - } else { - b - } - } - None => 1024, - }; - let mul = match last_char.to_lowercase().next().unwrap() { - 'b' => 512, - 'k' => base.pow(1), - 'm' => base.pow(2), - 'g' => base.pow(3), - 't' => base.pow(4), - 'p' => base.pow(5), - 'e' => base.pow(6), - 'z' => base.pow(7), - 'y' => base.pow(8), - _ => return Err(ParseError::Syntax), - }; - let mul = match usize::try_from(mul) { - Ok(n) => n, - Err(_) => return Err(ParseError::Overflow), - }; - match num.unwrap_or(1).checked_mul(mul) { - Some(n) => Ok((n, all_but_last)), - None => Err(ParseError::Overflow), - } + match parse_size(&size_string) { + Ok(n) => Ok((n, all_but_last)), + Err(e) => Err(e), } } + #[cfg(test)] mod tests { use super::*; @@ -195,44 +128,6 @@ mod tests { Some(Ok(src.iter().map(|s| s.to_string()).collect())) } #[test] - #[cfg(not(target_pointer_width = "128"))] - fn test_parse_overflow_x64() { - assert_eq!(parse_num("1Y"), Err(ParseError::Overflow)); - assert_eq!(parse_num("1Z"), Err(ParseError::Overflow)); - assert_eq!(parse_num("100E"), Err(ParseError::Overflow)); - assert_eq!(parse_num("100000P"), Err(ParseError::Overflow)); - assert_eq!(parse_num("1000000000T"), Err(ParseError::Overflow)); - assert_eq!( - parse_num("10000000000000000000000"), - Err(ParseError::Overflow) - ); - } - #[test] - #[cfg(target_pointer_width = "32")] - fn test_parse_overflow_x32() { - assert_eq!(parse_num("1T"), Err(ParseError::Overflow)); - assert_eq!(parse_num("1000G"), Err(ParseError::Overflow)); - } - #[test] - fn test_parse_bad_syntax() { - assert_eq!(parse_num("5MiB nonsense"), Err(ParseError::Syntax)); - assert_eq!(parse_num("Nonsense string"), Err(ParseError::Syntax)); - assert_eq!(parse_num("5mib"), Err(ParseError::Syntax)); - assert_eq!(parse_num("biB"), Err(ParseError::Syntax)); - assert_eq!(parse_num("-"), Err(ParseError::Syntax)); - assert_eq!(parse_num(""), Err(ParseError::Syntax)); - } - #[test] - fn test_parse_numbers() { - assert_eq!(parse_num("k"), Ok((1024, false))); - assert_eq!(parse_num("MiB"), Ok((1024 * 1024, false))); - assert_eq!(parse_num("-5"), Ok((5, true))); - assert_eq!(parse_num("b"), Ok((512, false))); - assert_eq!(parse_num("-2GiB"), Ok((2 * 1024 * 1024 * 1024, true))); - assert_eq!(parse_num("5M"), Ok((5 * 1024 * 1024, false))); - assert_eq!(parse_num("5MB"), Ok((5 * 1000 * 1000, false))); - } - #[test] fn test_parse_numbers_obsolete() { assert_eq!(obsolete("-5"), obsolete_result(&["-n", "5"])); assert_eq!(obsolete("-100"), obsolete_result(&["-n", "100"])); diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index cf7c9c2ee..349fc05d3 100755 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -242,3 +242,28 @@ hello ", ); } +#[test] +fn test_head_invalid_num() { + new_ucmd!() + .args(&["-c", "1024R", "emptyfile.txt"]) + .fails() + .stderr_is("head: invalid number of bytes: ‘1024R’"); + new_ucmd!() + .args(&["-n", "1024R", "emptyfile.txt"]) + .fails() + .stderr_is("head: invalid number of lines: ‘1024R’"); + #[cfg(not(target_pointer_width = "128"))] + new_ucmd!() + .args(&["-c", "1Y", "emptyfile.txt"]) + .fails() + .stderr_is( + "head: invalid number of bytes: ‘1Y’: Value too large to be stored in data type", + ); + #[cfg(not(target_pointer_width = "128"))] + new_ucmd!() + .args(&["-n", "1Y", "emptyfile.txt"]) + .fails() + .stderr_is( + "head: invalid number of lines: ‘1Y’: Value too large to be stored in data type", + ); +} From c1f2d41a273d08ecf36345070d0967f83c262207 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Tue, 1 Jun 2021 09:54:49 +0200 Subject: [PATCH 0820/1135] sum: fix help text for system v argument --- src/uu/sum/src/sum.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/sum/src/sum.rs b/src/uu/sum/src/sum.rs index ea833c0d2..95de707fa 100644 --- a/src/uu/sum/src/sum.rs +++ b/src/uu/sum/src/sum.rs @@ -108,13 +108,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg( Arg::with_name(options::BSD_COMPATIBLE) .short(options::BSD_COMPATIBLE) - .help("use the BSD compatible algorithm (default)"), + .help("use the BSD sum algorithm, use 1K blocks (default)"), ) .arg( Arg::with_name(options::SYSTEM_V_COMPATIBLE) .short("s") .long(options::SYSTEM_V_COMPATIBLE) - .help("use the BSD compatible algorithm (default)"), + .help("use System V sum algorithm, use 512 bytes blocks"), ) .get_matches_from(args); From a3e047ff166205b066174032274594a2eeab2a50 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Tue, 1 Jun 2021 10:22:44 +0200 Subject: [PATCH 0821/1135] uucore: add more tests to parse_size --- src/uucore/src/lib/parser/parse_size.rs | 32 ++++++++++++++----------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index e8ede8cad..4339cd7fb 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -53,14 +53,14 @@ pub fn parse_size(size: &str) -> Result { let (base, exponent): (u128, u32) = match unit { "" => (1, 0), "b" => (512, 1), // (`head` and `tail` use "b") - "KiB" | "K" | "k" => (1024, 1), - "MiB" | "M" | "m" => (1024, 2), - "GiB" | "G" | "g" => (1024, 3), - "TiB" | "T" | "t" => (1024, 4), - "PiB" | "P" | "p" => (1024, 5), - "EiB" | "E" | "e" => (1024, 6), - "ZiB" | "Z" | "z" => (1024, 7), - "YiB" | "Y" | "y" => (1024, 8), + "KiB" | "kiB" | "K" | "k" => (1024, 1), + "MiB" | "miB" | "M" | "m" => (1024, 2), + "GiB" | "giB" | "G" | "g" => (1024, 3), + "TiB" | "tiB" | "T" | "t" => (1024, 4), + "PiB" | "piB" | "P" | "p" => (1024, 5), + "EiB" | "eiB" | "E" | "e" => (1024, 6), + "ZiB" | "ziB" | "Z" | "z" => (1024, 7), + "YiB" | "yiB" | "Y" | "y" => (1024, 8), "KB" | "kB" => (1000, 1), "MB" | "mB" => (1000, 2), "GB" | "gB" => (1000, 3), @@ -152,19 +152,23 @@ mod tests { for &(c, exp) in &suffixes { let s = format!("2{}B", c); // KB - assert_eq!(Ok((2 * (1000 as u128).pow(exp)) as usize), parse_size(&s)); + assert_eq!(Ok((2 * (1000_u128).pow(exp)) as usize), parse_size(&s)); let s = format!("2{}", c); // K - assert_eq!(Ok((2 * (1024 as u128).pow(exp)) as usize), parse_size(&s)); + assert_eq!(Ok((2 * (1024_u128).pow(exp)) as usize), parse_size(&s)); let s = format!("2{}iB", c); // KiB - assert_eq!(Ok((2 * (1024 as u128).pow(exp)) as usize), parse_size(&s)); + assert_eq!(Ok((2 * (1024_u128).pow(exp)) as usize), parse_size(&s)); + let s = format!("2{}iB", c.to_lowercase()); // kiB + assert_eq!(Ok((2 * (1024_u128).pow(exp)) as usize), parse_size(&s)); // suffix only let s = format!("{}B", c); // KB - assert_eq!(Ok(((1000 as u128).pow(exp)) as usize), parse_size(&s)); + assert_eq!(Ok(((1000_u128).pow(exp)) as usize), parse_size(&s)); let s = format!("{}", c); // K - assert_eq!(Ok(((1024 as u128).pow(exp)) as usize), parse_size(&s)); + assert_eq!(Ok(((1024_u128).pow(exp)) as usize), parse_size(&s)); let s = format!("{}iB", c); // KiB - assert_eq!(Ok(((1024 as u128).pow(exp)) as usize), parse_size(&s)); + assert_eq!(Ok(((1024_u128).pow(exp)) as usize), parse_size(&s)); + let s = format!("{}iB", c.to_lowercase()); // kiB + assert_eq!(Ok(((1024_u128).pow(exp)) as usize), parse_size(&s)); } } From 1dc4ab92d90dd30dd1562f1c6bb496583571d5d0 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Tue, 1 Jun 2021 10:27:50 +0200 Subject: [PATCH 0822/1135] ls: add help text and value name for --hide and --ignore --- src/uu/ls/src/ls.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 5846cb0aa..a74a045c5 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -785,6 +785,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::HIDE) .takes_value(true) .multiple(true) + .value_name("PATTERN") + .help("do not list implied entries matching shell PATTERN (overridden by -a or -A)") ) .arg( Arg::with_name(options::IGNORE) @@ -792,6 +794,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::IGNORE) .takes_value(true) .multiple(true) + .value_name("PATTERN") + .help("do not list implied entries matching shell PATTERN") ) .arg( Arg::with_name(options::IGNORE_BACKUPS) From 3c7175f00d784768a793a4141c067650bb0ef150 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Tue, 1 Jun 2021 12:17:11 +0200 Subject: [PATCH 0823/1135] head/tail: add fixes and tests for bytes/lines NUM arg (undocumented sign) * change tail bytes/lines clap parsing to fix posix override behavior * change tail bytes/lines NUM parsing logic to be consistent with head --- src/uu/head/src/parse.rs | 7 ++-- src/uu/tail/src/tail.rs | 74 ++++++++++++++++++++------------------ tests/by-util/test_head.rs | 22 ++++++++++++ tests/by-util/test_tail.rs | 48 +++++++++++++++++++++++++ 4 files changed, 115 insertions(+), 36 deletions(-) diff --git a/src/uu/head/src/parse.rs b/src/uu/head/src/parse.rs index 3b788f819..b395b330b 100644 --- a/src/uu/head/src/parse.rs +++ b/src/uu/head/src/parse.rs @@ -97,9 +97,12 @@ pub fn parse_num(src: &str) -> Result<(usize, bool), ParseSizeError> { let mut all_but_last = false; if let Some(c) = size_string.chars().next() { - if c == '-' { + if c == '+' || c == '-' { + // head: '+' is not documented (8.32 man pages) size_string = &size_string[1..]; - all_but_last = true; + if c == '-' { + all_but_last = true; + } } } else { return Err(ParseSizeError::ParseFailure(src.to_string())); diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index a4634714c..acaad8c30 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -27,7 +27,7 @@ use std::io::{stdin, stdout, BufRead, BufReader, Read, Seek, SeekFrom, Write}; use std::path::Path; use std::thread::sleep; use std::time::Duration; -use uucore::parse_size::parse_size; +use uucore::parse_size::{parse_size, ParseSizeError}; use uucore::ringbuffer::RingBuffer; pub mod options { @@ -42,10 +42,9 @@ pub mod options { pub static PID: &str = "pid"; pub static SLEEP_INT: &str = "sleep-interval"; pub static ZERO_TERM: &str = "zero-terminated"; + pub static ARG_FILES: &str = "files"; } -static ARG_FILES: &str = "files"; - enum FilterMode { Bytes(usize), Lines(usize, u8), // (number of lines, delimiter) @@ -84,6 +83,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::BYTES) .takes_value(true) .allow_hyphen_values(true) + .overrides_with_all(&[options::BYTES, options::LINES]) .help("Number of bytes to print"), ) .arg( @@ -98,6 +98,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::LINES) .takes_value(true) .allow_hyphen_values(true) + .overrides_with_all(&[options::BYTES, options::LINES]) .help("Number of lines to print"), ) .arg( @@ -137,7 +138,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("Line delimiter is NUL, not newline"), ) .arg( - Arg::with_name(ARG_FILES) + Arg::with_name(options::ARG_FILES) .multiple(true) .takes_value(true) .min_values(1), @@ -171,38 +172,21 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } - match matches.value_of(options::LINES) { - Some(n) => { - let mut slice: &str = n; - let c = slice.chars().next().unwrap_or('_'); - if c == '+' || c == '-' { - slice = &slice[1..]; - if c == '+' { - settings.beginning = true; - } - } - match parse_size(slice) { - Ok(m) => settings.mode = FilterMode::Lines(m, b'\n'), - Err(e) => crash!(1, "invalid number of bytes: {}", e.to_string()), - } + let mode_and_beginning = if let Some(arg) = matches.value_of(options::BYTES) { + match parse_num(arg) { + Ok((n, beginning)) => (FilterMode::Bytes(n), beginning), + Err(e) => crash!(1, "invalid number of bytes: {}", e.to_string()), } - None => { - if let Some(n) = matches.value_of(options::BYTES) { - let mut slice: &str = n; - let c = slice.chars().next().unwrap_or('_'); - if c == '+' || c == '-' { - slice = &slice[1..]; - if c == '+' { - settings.beginning = true; - } - } - match parse_size(slice) { - Ok(m) => settings.mode = FilterMode::Bytes(m), - Err(e) => crash!(1, "invalid number of bytes: {}", e.to_string()), - } - } + } else if let Some(arg) = matches.value_of(options::LINES) { + match parse_num(arg) { + Ok((n, beginning)) => (FilterMode::Lines(n, b'\n'), beginning), + Err(e) => crash!(1, "invalid number of lines: {}", e.to_string()), } + } else { + (FilterMode::Lines(10, b'\n'), false) }; + settings.mode = mode_and_beginning.0; + settings.beginning = mode_and_beginning.1; if matches.is_present(options::ZERO_TERM) { if let FilterMode::Lines(count, _) = settings.mode { @@ -215,7 +199,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { || matches.is_present(options::verbosity::SILENT); let files: Vec = matches - .values_of(ARG_FILES) + .values_of(options::ARG_FILES) .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); @@ -422,3 +406,25 @@ fn print_byte(stdout: &mut T, ch: u8) { crash!(1, "{}", err); } } + +fn parse_num(src: &str) -> Result<(usize, bool), ParseSizeError> { + let mut size_string = src.trim(); + let mut starting_with = false; + + if let Some(c) = size_string.chars().next() { + if c == '+' || c == '-' { + // tail: '-' is not documented (8.32 man pages) + size_string = &size_string[1..]; + if c == '+' { + starting_with = true; + } + } + } else { + return Err(ParseSizeError::ParseFailure(src.to_string())); + } + + match parse_size(&size_string) { + Ok(n) => Ok((n, starting_with)), + Err(e) => Err(e), + } +} diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index 349fc05d3..f26447636 100755 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -267,3 +267,25 @@ fn test_head_invalid_num() { "head: invalid number of lines: ‘1Y’: Value too large to be stored in data type", ); } + +#[test] +fn test_head_num_with_undocumented_sign_bytes() { + // tail: '-' is not documented (8.32 man pages) + // head: '+' is not documented (8.32 man pages) + const ALPHABET: &str = "abcdefghijklmnopqrstuvwxyz"; + new_ucmd!() + .args(&["-c", "5"]) + .pipe_in(ALPHABET) + .succeeds() + .stdout_is("abcde"); + new_ucmd!() + .args(&["-c", "-5"]) + .pipe_in(ALPHABET) + .succeeds() + .stdout_is("abcdefghijklmnopqrstu"); + new_ucmd!() + .args(&["-c", "+5"]) + .pipe_in(ALPHABET) + .succeeds() + .stdout_is("abcde"); +} diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 6227ac60b..9d0462c7a 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -352,3 +352,51 @@ fn test_positive_zero_lines() { .succeeds() .stdout_is("a\nb\nc\nd\ne\n"); } + +#[test] +fn test_tail_invalid_num() { + new_ucmd!() + .args(&["-c", "1024R", "emptyfile.txt"]) + .fails() + .stderr_is("tail: invalid number of bytes: ‘1024R’"); + new_ucmd!() + .args(&["-n", "1024R", "emptyfile.txt"]) + .fails() + .stderr_is("tail: invalid number of lines: ‘1024R’"); + #[cfg(not(target_pointer_width = "128"))] + new_ucmd!() + .args(&["-c", "1Y", "emptyfile.txt"]) + .fails() + .stderr_is( + "tail: invalid number of bytes: ‘1Y’: Value too large to be stored in data type", + ); + #[cfg(not(target_pointer_width = "128"))] + new_ucmd!() + .args(&["-n", "1Y", "emptyfile.txt"]) + .fails() + .stderr_is( + "tail: invalid number of lines: ‘1Y’: Value too large to be stored in data type", + ); +} + +#[test] +fn test_tail_num_with_undocumented_sign_bytes() { + // tail: '-' is not documented (8.32 man pages) + // head: '+' is not documented (8.32 man pages) + const ALPHABET: &str = "abcdefghijklmnopqrstuvwxyz"; + new_ucmd!() + .args(&["-c", "5"]) + .pipe_in(ALPHABET) + .succeeds() + .stdout_is("vwxyz"); + new_ucmd!() + .args(&["-c", "-5"]) + .pipe_in(ALPHABET) + .succeeds() + .stdout_is("vwxyz"); + new_ucmd!() + .args(&["-c", "+5"]) + .pipe_in(ALPHABET) + .succeeds() + .stdout_is("efghijklmnopqrstuvwxyz"); +} From 06b3092f5f3b47e263c350ba810f1d07b4530519 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Tue, 1 Jun 2021 18:06:18 +0200 Subject: [PATCH 0824/1135] sort: fix debug output for zeros / invalid numbers We were reporting "no match" when sorting something like "0 ". This is because we don't distinguish between 0 and invalid lines when sorting. For debug output we have to get this information back. --- src/uu/sort/src/numeric_str_cmp.rs | 17 ++++++++-- src/uu/sort/src/sort.rs | 34 ++++++++++++------- tests/by-util/test_sort.rs | 8 +++++ .../fixtures/sort/human_block_sizes.expected | 1 + .../sort/human_block_sizes.expected.debug | 3 ++ tests/fixtures/sort/human_block_sizes.txt | 1 + .../sort/numeric_trailing_chars.expected | 5 +++ .../numeric_trailing_chars.expected.debug | 15 ++++++++ .../fixtures/sort/numeric_trailing_chars.txt | 5 +++ 9 files changed, 75 insertions(+), 14 deletions(-) create mode 100644 tests/fixtures/sort/numeric_trailing_chars.expected create mode 100644 tests/fixtures/sort/numeric_trailing_chars.expected.debug create mode 100644 tests/fixtures/sort/numeric_trailing_chars.txt diff --git a/src/uu/sort/src/numeric_str_cmp.rs b/src/uu/sort/src/numeric_str_cmp.rs index 03806b0c8..461f72670 100644 --- a/src/uu/sort/src/numeric_str_cmp.rs +++ b/src/uu/sort/src/numeric_str_cmp.rs @@ -46,7 +46,12 @@ impl Default for NumInfoParseSettings { impl NumInfo { /// Parse NumInfo for this number. - /// Also returns the range of num that should be passed to numeric_str_cmp later + /// Also returns the range of num that should be passed to numeric_str_cmp later. + /// + /// Leading zeros will be excluded from the returned range. If the number consists of only zeros, + /// an empty range (idx..idx) is returned so that idx is the char after the last zero. + /// If the input is not a number (which has to be treated as zero), the returned empty range + /// will be 0..0. pub fn parse(num: &str, parse_settings: NumInfoParseSettings) -> (Self, Range) { let mut exponent = -1; let mut had_decimal_pt = false; @@ -105,7 +110,15 @@ impl NumInfo { sign: if had_digit { sign } else { Sign::Positive }, exponent: 0, }, - 0..0, + if had_digit { + // In this case there were only zeroes. + // For debug output to work properly, we have to match the character after the last zero. + idx..idx + } else { + // This was no number at all. + // For debug output to work properly, we have to match 0..0. + 0..0 + }, ) }; } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index ab3b06451..f47b561ed 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -414,19 +414,29 @@ impl<'a> Line<'a> { selection.start += num_range.start; selection.end = selection.start + num_range.len(); - // include a trailing si unit - if selector.settings.mode == SortMode::HumanNumeric - && self.line[selection.end..initial_selection.end] - .starts_with(&['k', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'][..]) - { - selection.end += 1; - } + if num_range != (0..0) { + // include a trailing si unit + if selector.settings.mode == SortMode::HumanNumeric + && self.line[selection.end..initial_selection.end] + .starts_with(&['k', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'][..]) + { + selection.end += 1; + } - // include leading zeroes, a leading minus or a leading decimal point - while self.line[initial_selection.start..selection.start] - .ends_with(&['-', '0', '.'][..]) - { - selection.start -= 1; + // include leading zeroes, a leading minus or a leading decimal point + while self.line[initial_selection.start..selection.start] + .ends_with(&['-', '0', '.'][..]) + { + selection.start -= 1; + } + } else { + // This was not a valid number. + // Report no match at the first non-whitespace character. + let leading_whitespace = self.line[selection.clone()] + .find(|c: char| !c.is_whitespace()) + .unwrap_or(0); + selection.start += leading_whitespace; + selection.end += leading_whitespace; } } SortMode::GeneralNumeric => { diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index d2b447925..02636b027 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -123,6 +123,14 @@ fn test_multiple_decimals_numeric() { ) } +#[test] +fn test_numeric_with_trailing_invalid_chars() { + test_helper( + "numeric_trailing_chars", + &["-n", "--numeric-sort", "--sort=numeric"], + ) +} + #[test] fn test_check_zero_terminated_failure() { new_ucmd!() diff --git a/tests/fixtures/sort/human_block_sizes.expected b/tests/fixtures/sort/human_block_sizes.expected index 74fad9fdf..0e4fdfbb6 100644 --- a/tests/fixtures/sort/human_block_sizes.expected +++ b/tests/fixtures/sort/human_block_sizes.expected @@ -1,3 +1,4 @@ +K 844K 981K 11M diff --git a/tests/fixtures/sort/human_block_sizes.expected.debug b/tests/fixtures/sort/human_block_sizes.expected.debug index 5f4860a85..cde98628e 100644 --- a/tests/fixtures/sort/human_block_sizes.expected.debug +++ b/tests/fixtures/sort/human_block_sizes.expected.debug @@ -1,3 +1,6 @@ +K +^ no match for key +_ 844K ____ ____ diff --git a/tests/fixtures/sort/human_block_sizes.txt b/tests/fixtures/sort/human_block_sizes.txt index 803666dbe..9cc2b3c6c 100644 --- a/tests/fixtures/sort/human_block_sizes.txt +++ b/tests/fixtures/sort/human_block_sizes.txt @@ -9,3 +9,4 @@ 844K 981K 13M +K \ No newline at end of file diff --git a/tests/fixtures/sort/numeric_trailing_chars.expected b/tests/fixtures/sort/numeric_trailing_chars.expected new file mode 100644 index 000000000..96226fd38 --- /dev/null +++ b/tests/fixtures/sort/numeric_trailing_chars.expected @@ -0,0 +1,5 @@ +-.05, +-x +0.abc +0foo +100 diff --git a/tests/fixtures/sort/numeric_trailing_chars.expected.debug b/tests/fixtures/sort/numeric_trailing_chars.expected.debug new file mode 100644 index 000000000..0226a636f --- /dev/null +++ b/tests/fixtures/sort/numeric_trailing_chars.expected.debug @@ -0,0 +1,15 @@ +-.05, +____ +_____ +-x +^ no match for key +__ +0.abc +__ +_____ +0foo +_ +____ +100 +___ +____ diff --git a/tests/fixtures/sort/numeric_trailing_chars.txt b/tests/fixtures/sort/numeric_trailing_chars.txt new file mode 100644 index 000000000..d6fe3e48d --- /dev/null +++ b/tests/fixtures/sort/numeric_trailing_chars.txt @@ -0,0 +1,5 @@ +0foo +0.abc +100 +-.05, +-x \ No newline at end of file From 67b83647ac41515f762506211ec6390c19fa0b2d Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Tue, 1 Jun 2021 18:09:39 +0200 Subject: [PATCH 0825/1135] sort: simplify handling of negative zeros We can simply parse the sign of negative zero as positive, instead of handling the comparison of zeros differently. --- src/uu/sort/src/numeric_str_cmp.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/uu/sort/src/numeric_str_cmp.rs b/src/uu/sort/src/numeric_str_cmp.rs index 461f72670..8cd3faab2 100644 --- a/src/uu/sort/src/numeric_str_cmp.rs +++ b/src/uu/sort/src/numeric_str_cmp.rs @@ -107,7 +107,7 @@ impl NumInfo { } else { ( NumInfo { - sign: if had_digit { sign } else { Sign::Positive }, + sign: Sign::Positive, exponent: 0, }, if had_digit { @@ -147,7 +147,7 @@ impl NumInfo { } else { ( NumInfo { - sign: if had_digit { sign } else { Sign::Positive }, + sign: Sign::Positive, exponent: 0, }, if had_digit { @@ -187,11 +187,7 @@ impl NumInfo { pub fn numeric_str_cmp((a, a_info): (&str, &NumInfo), (b, b_info): (&str, &NumInfo)) -> Ordering { // check for a difference in the sign if a_info.sign != b_info.sign { - return if a.is_empty() && b.is_empty() { - Ordering::Equal - } else { - a_info.sign.cmp(&b_info.sign) - }; + return a_info.sign.cmp(&b_info.sign); } // check for a difference in the exponent From 9b29ac98a59c5b8bc82a4a15177ad75053fbb067 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Tue, 1 Jun 2021 18:12:37 +0200 Subject: [PATCH 0826/1135] seq: reject NaN arguments Move the validation logic to an argument validator. --- src/uu/seq/src/seq.rs | 68 ++++++++++++++------------------------- tests/by-util/test_seq.rs | 16 +++++++++ 2 files changed, 40 insertions(+), 44 deletions(-) diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index bdab044c5..60aa7e654 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -13,7 +13,6 @@ use num_traits::Zero; use num_traits::{Num, ToPrimitive}; use std::cmp; use std::io::{stdout, Write}; -use std::str::FromStr; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Display numbers from FIRST to LAST, in steps of INCREMENT."; @@ -44,6 +43,18 @@ enum Number { } impl Number { + fn new(mut s: &str) -> Self { + if s.starts_with('+') { + s = &s[1..]; + } + + match s.parse::() { + Ok(n) => Number::BigInt(n), + // The argument validator made sure this is a valid float. + Err(_) => Number::F64(s.parse::().unwrap()), + } + } + fn is_zero(&self) -> bool { match self { Number::BigInt(n) => n.is_zero(), @@ -60,27 +71,6 @@ impl Number { } } -impl FromStr for Number { - type Err = String; - /// Tries to parse this string as a BigInt, or if that fails as an f64. - fn from_str(mut s: &str) -> Result { - if s.starts_with('+') { - s = &s[1..]; - } - - match s.parse::() { - Ok(n) => Ok(Number::BigInt(n)), - Err(_) => match s.parse::() { - Ok(n) => Ok(Number::F64(n)), - Err(e) => Err(format!( - "seq: invalid floating point argument `{}`: {}", - s, e - )), - }, - } - } -} - pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) @@ -116,7 +106,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .allow_hyphen_values(true) .max_values(3) - .required(true), + .required(true) + .validator(|value| { + match value.parse::() { + Ok(value) if value.is_nan() => Err("can not be NaN".to_string()), + Ok(_) => Ok(()), + Err(e) => Err(e.to_string()), + } + .map_err(|e| format!("invalid floating point argument `{}`: {}", value, e)) + }), ) .get_matches_from(args); @@ -136,13 +134,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let dec = slice.find('.').unwrap_or(len); largest_dec = len - dec; padding = dec; - match slice.parse() { - Ok(n) => n, - Err(s) => { - show_error!("{}", s); - return 1; - } - } + Number::new(slice) } else { Number::BigInt(BigInt::one()) }; @@ -152,13 +144,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let dec = slice.find('.').unwrap_or(len); largest_dec = cmp::max(largest_dec, len - dec); padding = cmp::max(padding, dec); - match slice.parse() { - Ok(n) => n, - Err(s) => { - show_error!("{}", s); - return 1; - } - } + Number::new(slice) } else { Number::BigInt(BigInt::one()) }; @@ -169,13 +155,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let last = { let slice = numbers[numbers.len() - 1]; padding = cmp::max(padding, slice.find('.').unwrap_or_else(|| slice.len())); - match slice.parse::() { - Ok(n) => n, - Err(s) => { - show_error!("{}", s); - return 1; - } - } + Number::new(slice) }; if largest_dec > 0 { largest_dec -= 1; diff --git a/tests/by-util/test_seq.rs b/tests/by-util/test_seq.rs index 98eb23598..7545ebde7 100644 --- a/tests/by-util/test_seq.rs +++ b/tests/by-util/test_seq.rs @@ -1,5 +1,21 @@ use crate::common::util::*; +#[test] +fn test_rejects_nan() { + new_ucmd!() + .args(&["NaN"]) + .fails() + .stderr_only("error: Invalid value for '...': invalid floating point argument `NaN`: can not be NaN"); +} + +#[test] +fn test_rejects_non_floats() { + new_ucmd!() + .args(&["foo"]) + .fails() + .stderr_only("error: Invalid value for '...': invalid floating point argument `foo`: invalid float literal"); +} + // ---- Tests for the big integer based path ---- #[test] From 5329d77cc2f928a4b59a6e1563761217789d47e8 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Tue, 1 Jun 2021 20:35:18 +0200 Subject: [PATCH 0827/1135] seq: adapt output to GNU seq --- src/uu/seq/src/seq.rs | 61 +++++++++++++++++++++++---------------- tests/by-util/test_seq.rs | 4 +-- 2 files changed, 38 insertions(+), 27 deletions(-) diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index 60aa7e654..8cf6513cb 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -13,6 +13,7 @@ use num_traits::Zero; use num_traits::{Num, ToPrimitive}; use std::cmp; use std::io::{stdout, Write}; +use std::str::FromStr; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Display numbers from FIRST to LAST, in steps of INCREMENT."; @@ -43,18 +44,6 @@ enum Number { } impl Number { - fn new(mut s: &str) -> Self { - if s.starts_with('+') { - s = &s[1..]; - } - - match s.parse::() { - Ok(n) => Number::BigInt(n), - // The argument validator made sure this is a valid float. - Err(_) => Number::F64(s.parse::().unwrap()), - } - } - fn is_zero(&self) -> bool { match self { Number::BigInt(n) => n.is_zero(), @@ -71,6 +60,32 @@ impl Number { } } +impl FromStr for Number { + type Err = String; + fn from_str(mut s: &str) -> Result { + if s.starts_with('+') { + s = &s[1..]; + } + + match s.parse::() { + Ok(n) => Ok(Number::BigInt(n)), + Err(_) => match s.parse::() { + Ok(value) if value.is_nan() => Err(format!( + "invalid 'not-a-number' argument: '{}'\nTry '{} --help' for more information.", + s, + executable!(), + )), + Ok(value) => Ok(Number::F64(value)), + Err(_) => Err(format!( + "invalid floating point argument: '{}'\nTry '{} --help' for more information.", + s, + executable!(), + )), + }, + } + } +} + pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) @@ -106,15 +121,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .allow_hyphen_values(true) .max_values(3) - .required(true) - .validator(|value| { - match value.parse::() { - Ok(value) if value.is_nan() => Err("can not be NaN".to_string()), - Ok(_) => Ok(()), - Err(e) => Err(e.to_string()), - } - .map_err(|e| format!("invalid floating point argument `{}`: {}", value, e)) - }), + .required(true), ) .get_matches_from(args); @@ -134,7 +141,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let dec = slice.find('.').unwrap_or(len); largest_dec = len - dec; padding = dec; - Number::new(slice) + return_if_err!(1, slice.parse()) } else { Number::BigInt(BigInt::one()) }; @@ -144,18 +151,22 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let dec = slice.find('.').unwrap_or(len); largest_dec = cmp::max(largest_dec, len - dec); padding = cmp::max(padding, dec); - Number::new(slice) + return_if_err!(1, slice.parse()) } else { Number::BigInt(BigInt::one()) }; if increment.is_zero() { - show_error!("increment value: '{}'", numbers[1]); + show_error!( + "invalid Zero increment value: '{}'\nTry '{} --help' for more information.", + numbers[1], + executable!() + ); return 1; } let last = { let slice = numbers[numbers.len() - 1]; padding = cmp::max(padding, slice.find('.').unwrap_or_else(|| slice.len())); - Number::new(slice) + return_if_err!(1, slice.parse()) }; if largest_dec > 0 { largest_dec -= 1; diff --git a/tests/by-util/test_seq.rs b/tests/by-util/test_seq.rs index 7545ebde7..459eeeb3a 100644 --- a/tests/by-util/test_seq.rs +++ b/tests/by-util/test_seq.rs @@ -5,7 +5,7 @@ fn test_rejects_nan() { new_ucmd!() .args(&["NaN"]) .fails() - .stderr_only("error: Invalid value for '...': invalid floating point argument `NaN`: can not be NaN"); + .stderr_only("seq: invalid 'not-a-number' argument: 'NaN'\nTry 'seq --help' for more information."); } #[test] @@ -13,7 +13,7 @@ fn test_rejects_non_floats() { new_ucmd!() .args(&["foo"]) .fails() - .stderr_only("error: Invalid value for '...': invalid floating point argument `foo`: invalid float literal"); + .stderr_only("seq: invalid floating point argument: 'foo'\nTry 'seq --help' for more information."); } // ---- Tests for the big integer based path ---- From 23f89d1494b0fa071adca1552ad6757f21e40b39 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Tue, 1 Jun 2021 22:04:19 +0200 Subject: [PATCH 0828/1135] cp: close file descriptors after cow on linux Instead of using into_raw_fd(), which transfers ownership and requires us to close the file descriptor manually, use as_raw_fd(), which does not transfer ownership to us but drops the file descriptor when the original file is dropped (in our case at the end of the function). --- src/uu/cp/src/cp.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index b7c64928f..3a5941284 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -41,7 +41,7 @@ use std::io; use std::io::{stdin, stdout, Write}; use std::mem; #[cfg(target_os = "linux")] -use std::os::unix::io::IntoRawFd; +use std::os::unix::io::AsRawFd; #[cfg(windows)] use std::os::windows::ffi::OsStrExt; use std::path::{Path, PathBuf, StripPrefixError}; @@ -1261,14 +1261,14 @@ fn copy_helper(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> fn copy_on_write_linux(source: &Path, dest: &Path, mode: ReflinkMode) -> CopyResult<()> { debug_assert!(mode != ReflinkMode::Never); - let src_file = File::open(source).unwrap().into_raw_fd(); + let src_file = File::open(source).unwrap().as_raw_fd(); let dst_file = OpenOptions::new() .write(true) .truncate(false) .create(true) .open(dest) .unwrap() - .into_raw_fd(); + .as_raw_fd(); match mode { ReflinkMode::Always => unsafe { let result = ficlone(dst_file, src_file as *const i32); From a900c7421aaeef2bf4cb225409b3ccd6d8926a9f Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Tue, 1 Jun 2021 22:07:29 +0200 Subject: [PATCH 0829/1135] od: use "parse_size" from uucore --- src/uu/od/src/parse_nrofbytes.rs | 51 +++---------------------- src/uucore/src/lib/parser/parse_size.rs | 40 ++++++++++++++++++- 2 files changed, 44 insertions(+), 47 deletions(-) diff --git a/src/uu/od/src/parse_nrofbytes.rs b/src/uu/od/src/parse_nrofbytes.rs index d2ba1527b..9223d7e53 100644 --- a/src/uu/od/src/parse_nrofbytes.rs +++ b/src/uu/od/src/parse_nrofbytes.rs @@ -1,14 +1,18 @@ pub fn parse_number_of_bytes(s: &str) -> Result { let mut start = 0; let mut len = s.len(); - let mut radix = 10; + let mut radix = 16; let mut multiply = 1; if s.starts_with("0x") || s.starts_with("0X") { start = 2; - radix = 16; } else if s.starts_with('0') { radix = 8; + } else { + return match uucore::parse_size::parse_size(&s[start..]) { + Ok(n) => Ok(n), + Err(_) => Err("parse failed"), + }; } let mut ends_with = s.chars().rev(); @@ -75,22 +79,6 @@ fn parse_number_of_bytes_str(s: &str) -> Result { #[test] fn test_parse_number_of_bytes() { - // normal decimal numbers - assert_eq!(0, parse_number_of_bytes_str("0").unwrap()); - assert_eq!(5, parse_number_of_bytes_str("5").unwrap()); - assert_eq!(999, parse_number_of_bytes_str("999").unwrap()); - assert_eq!(2 * 512, parse_number_of_bytes_str("2b").unwrap()); - assert_eq!(2 * 1024, parse_number_of_bytes_str("2k").unwrap()); - assert_eq!(4 * 1024, parse_number_of_bytes_str("4K").unwrap()); - assert_eq!(2 * 1048576, parse_number_of_bytes_str("2m").unwrap()); - assert_eq!(4 * 1048576, parse_number_of_bytes_str("4M").unwrap()); - assert_eq!(1073741824, parse_number_of_bytes_str("1G").unwrap()); - assert_eq!(2000, parse_number_of_bytes_str("2kB").unwrap()); - assert_eq!(4000, parse_number_of_bytes_str("4KB").unwrap()); - assert_eq!(2000000, parse_number_of_bytes_str("2mB").unwrap()); - assert_eq!(4000000, parse_number_of_bytes_str("4MB").unwrap()); - assert_eq!(2000000000, parse_number_of_bytes_str("2GB").unwrap()); - // octal input assert_eq!(8, parse_number_of_bytes_str("010").unwrap()); assert_eq!(8 * 512, parse_number_of_bytes_str("010b").unwrap()); @@ -103,31 +91,4 @@ fn test_parse_number_of_bytes() { assert_eq!(27, parse_number_of_bytes_str("0x1b").unwrap()); assert_eq!(16 * 1024, parse_number_of_bytes_str("0x10k").unwrap()); assert_eq!(16 * 1048576, parse_number_of_bytes_str("0x10m").unwrap()); - - // invalid input - parse_number_of_bytes_str("").unwrap_err(); - parse_number_of_bytes_str("-1").unwrap_err(); - parse_number_of_bytes_str("1e2").unwrap_err(); - parse_number_of_bytes_str("xyz").unwrap_err(); - parse_number_of_bytes_str("b").unwrap_err(); - parse_number_of_bytes_str("1Y").unwrap_err(); - parse_number_of_bytes_str("∞").unwrap_err(); -} - -#[test] -#[cfg(target_pointer_width = "64")] -fn test_parse_number_of_bytes_64bits() { - assert_eq!(1099511627776, parse_number_of_bytes_str("1T").unwrap()); - assert_eq!(1125899906842624, parse_number_of_bytes_str("1P").unwrap()); - assert_eq!( - 1152921504606846976, - parse_number_of_bytes_str("1E").unwrap() - ); - - assert_eq!(2000000000000, parse_number_of_bytes_str("2TB").unwrap()); - assert_eq!(2000000000000000, parse_number_of_bytes_str("2PB").unwrap()); - assert_eq!( - 2000000000000000000, - parse_number_of_bytes_str("2EB").unwrap() - ); } diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index 4339cd7fb..8b3e0bf03 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -52,7 +52,7 @@ pub fn parse_size(size: &str) -> Result { let unit = &size[numeric_string.len()..]; let (base, exponent): (u128, u32) = match unit { "" => (1, 0), - "b" => (512, 1), // (`head` and `tail` use "b") + "b" => (512, 1), // (`od`, `head` and `tail` use "b") "KiB" | "kiB" | "K" | "k" => (1024, 1), "MiB" | "miB" | "M" | "m" => (1024, 2), "GiB" | "giB" | "G" | "g" => (1024, 3), @@ -210,7 +210,18 @@ mod tests { #[test] fn invalid_syntax() { - let test_strings = ["328hdsf3290", "5MiB nonsense", "5mib", "biB", "-", ""]; + let test_strings = [ + "328hdsf3290", + "5MiB nonsense", + "5mib", + "biB", + "-", + "+", + "", + "-1", + "1e2", + "∞", + ]; for &test_string in &test_strings { assert_eq!( parse_size(test_string).unwrap_err(), @@ -228,6 +239,8 @@ mod tests { fn no_suffix() { assert_eq!(Ok(1234), parse_size("1234")); assert_eq!(Ok(0), parse_size("0")); + assert_eq!(Ok(5), parse_size("5")); + assert_eq!(Ok(999), parse_size("999")); } #[test] @@ -239,6 +252,8 @@ mod tests { assert_eq!(Ok(0), parse_size("0KB")); assert_eq!(Ok(1000), parse_size("KB")); assert_eq!(Ok(1024), parse_size("K")); + assert_eq!(Ok(2000), parse_size("2kB")); + assert_eq!(Ok(4000), parse_size("4KB")); } #[test] @@ -247,5 +262,26 @@ mod tests { assert_eq!(Ok(123 * 1000 * 1000), parse_size("123MB")); assert_eq!(Ok(1024 * 1024), parse_size("M")); assert_eq!(Ok(1000 * 1000), parse_size("MB")); + assert_eq!(Ok(2 * 1_048_576), parse_size("2m")); + assert_eq!(Ok(4 * 1_048_576), parse_size("4M")); + assert_eq!(Ok(2_000_000), parse_size("2mB")); + assert_eq!(Ok(4_000_000), parse_size("4MB")); + } + + #[test] + fn gigabytes_suffix() { + assert_eq!(Ok(1_073_741_824), parse_size("1G")); + assert_eq!(Ok(2_000_000_000), parse_size("2GB")); + } + + #[test] + #[cfg(target_pointer_width = "64")] + fn x64() { + assert_eq!(Ok(1_099_511_627_776), parse_size("1T")); + assert_eq!(Ok(1_125_899_906_842_624), parse_size("1P")); + assert_eq!(Ok(1_152_921_504_606_846_976), parse_size("1E")); + assert_eq!(Ok(2_000_000_000_000), parse_size("2TB")); + assert_eq!(Ok(2_000_000_000_000_000), parse_size("2PB")); + assert_eq!(Ok(2_000_000_000_000_000_000), parse_size("2EB")); } } From a323e9cda17c51849bd62d75e47303fb2a47a3d8 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Tue, 1 Jun 2021 23:06:38 +0200 Subject: [PATCH 0830/1135] cp: show errors in cow on linux --- src/uu/cp/src/cp.rs | 6 ++++-- tests/by-util/test_cp.rs | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index b7c64928f..40266689c 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1261,13 +1261,15 @@ fn copy_helper(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> fn copy_on_write_linux(source: &Path, dest: &Path, mode: ReflinkMode) -> CopyResult<()> { debug_assert!(mode != ReflinkMode::Never); - let src_file = File::open(source).unwrap().into_raw_fd(); + let src_file = File::open(source) + .context(&*context_for(source, dest))? + .into_raw_fd(); let dst_file = OpenOptions::new() .write(true) .truncate(false) .create(true) .open(dest) - .unwrap() + .context(&*context_for(source, dest))? .into_raw_fd(); match mode { ReflinkMode::Always => unsafe { diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index e995cc56c..c56e1ca57 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -7,6 +7,8 @@ use std::fs::set_permissions; #[cfg(not(windows))] use std::os::unix::fs; +#[cfg(target_os = "linux")] +use std::os::unix::fs::PermissionsExt; #[cfg(windows)] use std::os::windows::fs::symlink_file; @@ -1257,3 +1259,20 @@ fn test_cp_reflink_bad() { .fails() .stderr_contains("invalid argument"); } + +#[test] +#[cfg(target_os = "linux")] +fn test_cp_reflink_insufficient_permission() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.make_file("unreadable") + .set_permissions(PermissionsExt::from_mode(0o000)) + .unwrap(); + + ucmd.arg("-r") + .arg("--reflink=auto") + .arg("unreadable") + .arg(TEST_EXISTING_FILE) + .fails() + .stderr_only("cp: 'unreadable' -> 'existing_file.txt': Permission denied (os error 13)"); +} From fc2b61eb9623c855817e87ffef0dd672885f89a0 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Tue, 1 Jun 2021 23:06:51 +0200 Subject: [PATCH 0831/1135] tests: typo --- tests/common/macros.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/common/macros.rs b/tests/common/macros.rs index 81878bf1b..03d2051d0 100644 --- a/tests/common/macros.rs +++ b/tests/common/macros.rs @@ -50,14 +50,14 @@ macro_rules! new_ucmd { /// Convenience macro for acquiring a [`UCommand`] builder and a test path. /// /// Returns a tuple containing the following: -/// - an [`AsPath`] that points to a unique temporary test directory +/// - an [`AtPath`] that points to a unique temporary test directory /// - a [`UCommand`] builder for invoking the binary to be tested /// /// This macro is intended for quick, single-call tests. For more complex tests /// that require multiple invocations of the tested binary, see [`TestScenario`] /// /// [`UCommand`]: crate::tests::common::util::UCommand -/// [`AsPath`]: crate::tests::common::util::AsPath +/// [`AtPath`]: crate::tests::common::util::AtPath /// [`TestScenario]: crate::tests::common::util::TestScenario #[macro_export] macro_rules! at_and_ucmd { From efe1850087a9c0a2a8b57c2385d09d62d5ba80a6 Mon Sep 17 00:00:00 2001 From: Mitchell Mebane Date: Tue, 1 Jun 2021 19:06:51 -0500 Subject: [PATCH 0832/1135] dircolors: replace getopts with clap Port argument parsing from getopts to clap. The only difference I have observed is that clap auto-generates -h and -V short options for help and version, and there is no way (in clap 2.x) to disable them. --- Cargo.lock | 1 + src/uu/dircolors/Cargo.toml | 1 + src/uu/dircolors/src/dircolors.rs | 118 +++++++++++++++++++++++------- 3 files changed, 93 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 17fa9e2b7..01c154351 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1893,6 +1893,7 @@ dependencies = [ name = "uu_dircolors" version = "0.0.6" dependencies = [ + "clap", "glob 0.3.0", "uucore", "uucore_procs", diff --git a/src/uu/dircolors/Cargo.toml b/src/uu/dircolors/Cargo.toml index 5e822820e..7d47fa5c4 100644 --- a/src/uu/dircolors/Cargo.toml +++ b/src/uu/dircolors/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/dircolors.rs" [dependencies] +clap = "2.33" glob = "0.3.0" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index b6942c2d2..8e13e281c 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -1,6 +1,7 @@ // This file is part of the uutils coreutils package. // // (c) Jian Zeng +// (c) Mitchell Mebane // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. @@ -15,6 +16,17 @@ use std::env; use std::fs::File; use std::io::{BufRead, BufReader}; +use clap::{App, Arg, crate_version}; + +mod options { + pub const SH: &str = "sh"; + pub const BOURNE_SHELL: &str = "bourne-shell"; + pub const CSH: &str = "csh"; + pub const C_SHELL: &str = "c-shell"; + pub const PRINT_DATABASE: &str = "print-database"; + pub const FILE: &str = "FILE"; +} + static SYNTAX: &str = "[OPTION]... [FILE]"; static SUMMARY: &str = "Output commands to set the LS_COLORS environment variable."; static LONG_HELP: &str = " @@ -52,28 +64,80 @@ pub fn guess_syntax() -> OutputFmt { } } +fn get_usage() -> String { + format!( + "{0} {1}", + executable!(), + SYNTAX + ) +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args .collect_str(InvalidEncodingHandling::Ignore) .accept_any(); - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optflag("b", "sh", "output Bourne shell code to set LS_COLORS") - .optflag( - "", - "bourne-shell", - "output Bourne shell code to set LS_COLORS", - ) - .optflag("c", "csh", "output C shell code to set LS_COLORS") - .optflag("", "c-shell", "output C shell code to set LS_COLORS") - .optflag("p", "print-database", "print the byte counts") - .parse(args); + let usage = get_usage(); - if (matches.opt_present("csh") - || matches.opt_present("c-shell") - || matches.opt_present("sh") - || matches.opt_present("bourne-shell")) - && matches.opt_present("print-database") + /* Clap has .visible_alias, but it generates help like this + * -b, --sh output Bourne shell code to set LS_COLORS [aliases: bourne-shell] + * whereas we want help like this + * -b, --sh output Bourne shell code to set LS_COLORS + * --bourne-shell output Bourne shell code to set LS_COLORS + * (or preferably like the original, but that doesn't seem possible with clap:) + * -b, --sh, --bourne-shell output Bourne shell code to set LS_COLORS + * therefore, command aliases are defined manually as multiple commands + */ + let matches = App::new(executable!()) + .version(crate_version!()) + .about(SUMMARY) + .usage(&usage[..]) + .after_help(LONG_HELP) + .arg(Arg::with_name(options::SH) + .long("sh") + .short("b") + .help("output Bourne shell code to set LS_COLORS") + .display_order(1) + ) + .arg(Arg::with_name(options::BOURNE_SHELL) + .long("bourne-shell") + .help("output Bourne shell code to set LS_COLORS") + .display_order(2) + ) + .arg(Arg::with_name(options::CSH) + .long("csh") + .short("c") + .help("output C shell code to set LS_COLORS") + .display_order(3) + ) + .arg(Arg::with_name(options::C_SHELL) + .long("c-shell") + .help("output C shell code to set LS_COLORS") + .display_order(4) + ) + .arg(Arg::with_name(options::PRINT_DATABASE) + .long("print-database") + .short("p") + .help("print the byte counts") + .display_order(5) + ) + .arg(Arg::with_name(options::FILE) + .hidden(true) + .multiple(true) + ) + .get_matches_from(&args); + + let files = matches.values_of(options::FILE) + .map_or(vec![], |file_values| file_values.collect()); + + // clap provides .conflicts_with / .conflicts_with_all, but we want to + // manually handle conflicts so we can match the output of GNU coreutils + if (matches.is_present(options::CSH) + || matches.is_present(options::C_SHELL) + || matches.is_present(options::SH) + || matches.is_present(options::BOURNE_SHELL) + ) + && matches.is_present(options::PRINT_DATABASE) { show_usage_error!( "the options to output dircolors' internal database and\nto select a shell \ @@ -82,12 +146,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return 1; } - if matches.opt_present("print-database") { - if !matches.free.is_empty() { + if matches.is_present(options::PRINT_DATABASE) { + if !files.is_empty() { show_usage_error!( "extra operand ‘{}’\nfile operands cannot be combined with \ --print-database (-p)", - matches.free[0] + files[0] ); return 1; } @@ -96,9 +160,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } let mut out_format = OutputFmt::Unknown; - if matches.opt_present("csh") || matches.opt_present("c-shell") { + if matches.is_present(options::CSH) || matches.is_present(options::C_SHELL) { out_format = OutputFmt::CShell; - } else if matches.opt_present("sh") || matches.opt_present("bourne-shell") { + } else if matches.is_present(options::SH) || matches.is_present(options::BOURNE_SHELL) { out_format = OutputFmt::Shell; } @@ -113,24 +177,24 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } let result; - if matches.free.is_empty() { + if files.is_empty() { result = parse(INTERNAL_DB.lines(), out_format, "") } else { - if matches.free.len() > 1 { - show_usage_error!("extra operand ‘{}’", matches.free[1]); + if files.len() > 1 { + show_usage_error!("extra operand ‘{}’", files[1]); return 1; } - match File::open(matches.free[0].as_str()) { + match File::open(files[0]) { Ok(f) => { let fin = BufReader::new(f); result = parse( fin.lines().filter_map(Result::ok), out_format, - matches.free[0].as_str(), + files[0], ) } Err(e) => { - show_error!("{}: {}", matches.free[0], e); + show_error!("{}: {}", files[0], e); return 1; } } From 850a56cceaa758b4122e5b644b28d9bf8aa3bb70 Mon Sep 17 00:00:00 2001 From: Mitchell Mebane Date: Tue, 1 Jun 2021 19:13:20 -0500 Subject: [PATCH 0833/1135] dircolors: rustfmt --- src/uu/dircolors/src/dircolors.rs | 80 ++++++++++++++----------------- 1 file changed, 37 insertions(+), 43 deletions(-) diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index 8e13e281c..078270791 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -16,7 +16,7 @@ use std::env; use std::fs::File; use std::io::{BufRead, BufReader}; -use clap::{App, Arg, crate_version}; +use clap::{crate_version, App, Arg}; mod options { pub const SH: &str = "sh"; @@ -65,11 +65,7 @@ pub fn guess_syntax() -> OutputFmt { } fn get_usage() -> String { - format!( - "{0} {1}", - executable!(), - SYNTAX - ) + format!("{0} {1}", executable!(), SYNTAX) } pub fn uumain(args: impl uucore::Args) -> i32 { @@ -93,50 +89,52 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(SUMMARY) .usage(&usage[..]) .after_help(LONG_HELP) - .arg(Arg::with_name(options::SH) - .long("sh") - .short("b") - .help("output Bourne shell code to set LS_COLORS") - .display_order(1) + .arg( + Arg::with_name(options::SH) + .long("sh") + .short("b") + .help("output Bourne shell code to set LS_COLORS") + .display_order(1), ) - .arg(Arg::with_name(options::BOURNE_SHELL) - .long("bourne-shell") - .help("output Bourne shell code to set LS_COLORS") - .display_order(2) + .arg( + Arg::with_name(options::BOURNE_SHELL) + .long("bourne-shell") + .help("output Bourne shell code to set LS_COLORS") + .display_order(2), ) - .arg(Arg::with_name(options::CSH) - .long("csh") - .short("c") - .help("output C shell code to set LS_COLORS") - .display_order(3) + .arg( + Arg::with_name(options::CSH) + .long("csh") + .short("c") + .help("output C shell code to set LS_COLORS") + .display_order(3), ) - .arg(Arg::with_name(options::C_SHELL) - .long("c-shell") - .help("output C shell code to set LS_COLORS") - .display_order(4) + .arg( + Arg::with_name(options::C_SHELL) + .long("c-shell") + .help("output C shell code to set LS_COLORS") + .display_order(4), ) - .arg(Arg::with_name(options::PRINT_DATABASE) - .long("print-database") - .short("p") - .help("print the byte counts") - .display_order(5) - ) - .arg(Arg::with_name(options::FILE) - .hidden(true) - .multiple(true) + .arg( + Arg::with_name(options::PRINT_DATABASE) + .long("print-database") + .short("p") + .help("print the byte counts") + .display_order(5), ) + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) .get_matches_from(&args); - let files = matches.values_of(options::FILE) + let files = matches + .values_of(options::FILE) .map_or(vec![], |file_values| file_values.collect()); // clap provides .conflicts_with / .conflicts_with_all, but we want to // manually handle conflicts so we can match the output of GNU coreutils if (matches.is_present(options::CSH) - || matches.is_present(options::C_SHELL) - || matches.is_present(options::SH) - || matches.is_present(options::BOURNE_SHELL) - ) + || matches.is_present(options::C_SHELL) + || matches.is_present(options::SH) + || matches.is_present(options::BOURNE_SHELL)) && matches.is_present(options::PRINT_DATABASE) { show_usage_error!( @@ -187,11 +185,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { match File::open(files[0]) { Ok(f) => { let fin = BufReader::new(f); - result = parse( - fin.lines().filter_map(Result::ok), - out_format, - files[0], - ) + result = parse(fin.lines().filter_map(Result::ok), out_format, files[0]) } Err(e) => { show_error!("{}: {}", files[0], e); From 6b8de1dd8bfd3935467c5c2679c3b2bf0a6478cf Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 2 Jun 2021 04:16:41 +0200 Subject: [PATCH 0834/1135] sort: use "parse_size" from uucore * make parsing of SIZE argument consistent with GNU's behavior * add error handling * add tests --- src/uu/sort/src/sort.rs | 100 +++++++++++++++++++++++++++---------- tests/by-util/test_sort.rs | 45 +++++++++++++++-- 2 files changed, 115 insertions(+), 30 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index ab3b06451..208010d09 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -43,6 +43,7 @@ use std::ops::Range; use std::path::Path; use std::path::PathBuf; use unicode_width::UnicodeWidthStr; +use uucore::parse_size::{parse_size, ParseSizeError}; use uucore::InvalidEncodingHandling; static NAME: &str = "sort"; @@ -159,32 +160,31 @@ pub struct GlobalSettings { } impl GlobalSettings { - /// Interpret this `&str` as a number with an optional trailing si unit. - /// - /// If there is no trailing si unit, the implicit unit is K. - /// The suffix B causes the number to be interpreted as a byte count. - fn parse_byte_count(input: &str) -> usize { - const SI_UNITS: &[char] = &['B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; + /// Parse a SIZE string into a number of bytes. + /// A size string comprises an integer and an optional unit. + /// The unit may be k, K, m, M, g, G, t, T, P, E, Z, Y (powers of 1024), or b which is 1. + /// Default is K. + fn parse_byte_count(input: &str) -> Result { + // GNU sort (8.32) valid: 1b, k, K, m, M, g, G, t, T, P, E, Z, Y + // GNU sort (8.32) invalid: b, B, 1B, p, e, z, y + const ALLOW_LIST: &[char] = &[ + 'b', 'k', 'K', 'm', 'M', 'g', 'G', 't', 'T', 'P', 'E', 'Z', 'Y', + ]; + let mut size_string = input.trim().to_string(); - let input = input.trim(); - - let (num_str, si_unit) = - if input.ends_with(|c: char| SI_UNITS.contains(&c.to_ascii_uppercase())) { - let mut chars = input.chars(); - let si_suffix = chars.next_back().unwrap().to_ascii_uppercase(); - let si_unit = SI_UNITS.iter().position(|&c| c == si_suffix).unwrap(); - let num_str = chars.as_str(); - (num_str, si_unit) - } else { - (input, 1) - }; - - let num_usize: usize = num_str - .trim() - .parse() - .unwrap_or_else(|e| crash!(1, "failed to parse buffer size `{}`: {}", num_str, e)); - - num_usize.saturating_mul(1000usize.saturating_pow(si_unit as u32)) + if size_string.ends_with(|c: char| ALLOW_LIST.contains(&c)) + || size_string.ends_with(|c: char| c.is_digit(10)) + { + // b 1, K 1024 (default) + if size_string.ends_with(|c: char| c.is_digit(10)) { + size_string.push('K'); + } else if size_string.ends_with('b') { + size_string.pop(); + } + parse_size(&size_string) + } else { + Err(ParseSizeError::ParseFailure("invalid suffix".to_string())) + } } fn out_writer(&self) -> BufWriter> { @@ -1148,7 +1148,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.buffer_size = matches .value_of(OPT_BUF_SIZE) - .map(GlobalSettings::parse_byte_count) + .map(|v| match GlobalSettings::parse_byte_count(v) { + Ok(n) => n, + Err(ParseSizeError::ParseFailure(_)) => crash!(2, "invalid -S argument '{}'", v), + Err(ParseSizeError::SizeTooBig(_)) => crash!(2, "-S argument '{}' too large", v), + }) .unwrap_or(DEFAULT_BUF_SIZE); settings.tmp_dir = matches @@ -1640,4 +1644,48 @@ mod tests { // How big is a selection? Constant cost all lines pay when we need selections. assert_eq!(std::mem::size_of::(), 24); } + + #[test] + fn test_parse_byte_count() { + let valid_input = [ + ("0", 0), + ("50K", 50 * 1024), + ("50k", 50 * 1024), + ("1M", 1024 * 1024), + ("100M", 100 * 1024 * 1024), + #[cfg(not(target_pointer_width = "32"))] + ("1000G", 1000 * 1024 * 1024 * 1024), + #[cfg(not(target_pointer_width = "32"))] + ("10T", 10 * 1024 * 1024 * 1024 * 1024), + ("1b", 1), + ("1024b", 1024), + ("1024Mb", 1024 * 1024 * 1024), // TODO: This might not be what GNU `sort` does? + ("1", 1024), // K is default + ("50", 50 * 1024), + ("K", 1024), + ("k", 1024), + ("m", 1024 * 1024), + #[cfg(not(target_pointer_width = "32"))] + ("E", 1024 * 1024 * 1024 * 1024 * 1024 * 1024), + ]; + for (input, expected_output) in &valid_input { + assert_eq!( + GlobalSettings::parse_byte_count(input), + Ok(*expected_output) + ); + } + + // SizeTooBig + let invalid_input = ["500E", "1Y"]; + for input in &invalid_input { + #[cfg(not(target_pointer_width = "128"))] + assert!(GlobalSettings::parse_byte_count(input).is_err()); + } + + // ParseFailure + let invalid_input = ["nonsense", "1B", "B", "b", "p", "e", "z", "y"]; + for input in &invalid_input { + assert!(GlobalSettings::parse_byte_count(input).is_err()); + } + } } diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index d2b447925..054789edf 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -21,9 +21,7 @@ fn test_helper(file_name: &str, possible_args: &[&str]) { #[test] fn test_buffer_sizes() { - let buffer_sizes = [ - "0", "50K", "50k", "1M", "100M", "1000G", "10T", "500E", "1Y", - ]; + let buffer_sizes = ["0", "50K", "50k", "1M", "100M"]; for buffer_size in &buffer_sizes { new_ucmd!() .arg("-n") @@ -32,6 +30,20 @@ fn test_buffer_sizes() { .arg("ext_sort.txt") .succeeds() .stdout_is_fixture("ext_sort.expected"); + + #[cfg(not(target_pointer_width = "32"))] + { + let buffer_sizes = ["1000G", "10T"]; + for buffer_size in &buffer_sizes { + new_ucmd!() + .arg("-n") + .arg("-S") + .arg(buffer_size) + .arg("ext_sort.txt") + .succeeds() + .stdout_is_fixture("ext_sort.expected"); + } + } } } @@ -43,11 +55,36 @@ fn test_invalid_buffer_size() { .arg("-S") .arg(invalid_buffer_size) .fails() + .code_is(2) .stderr_only(format!( - "sort: failed to parse buffer size `{}`: invalid digit found in string", + "sort: invalid -S argument '{}'", invalid_buffer_size )); } + #[cfg(not(target_pointer_width = "128"))] + new_ucmd!() + .arg("-n") + .arg("-S") + .arg("1Y") + .arg("ext_sort.txt") + .fails() + .code_is(2) + .stderr_only("sort: -S argument '1Y' too large"); + + #[cfg(target_pointer_width = "32")] + { + let buffer_sizes = ["1000G", "10T"]; + for buffer_size in &buffer_sizes { + new_ucmd!() + .arg("-n") + .arg("-S") + .arg(buffer_size) + .arg("ext_sort.txt") + .fails() + .code_is(2) + .stderr_only(format!("sort: -S argument '{}' too large", buffer_size)); + } + } } #[test] From 48516cc06a313c6aa2d95b5fb866b25fb9721cae Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 2 Jun 2021 17:18:07 +0200 Subject: [PATCH 0835/1135] pr: fix usage of current time --- tests/by-util/test_pr.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/by-util/test_pr.rs b/tests/by-util/test_pr.rs index 4fef41ccd..def361fab 100644 --- a/tests/by-util/test_pr.rs +++ b/tests/by-util/test_pr.rs @@ -288,13 +288,14 @@ fn test_with_suppress_error_option() { fn test_with_stdin() { let expected_file_path = "stdin.log.expected"; let mut scenario = new_ucmd!(); + let now = now_time(); scenario .pipe_in_fixture("stdin.log") .args(&["--pages=1:2", "-n", "-"]) .run() .stdout_is_templated_fixture( expected_file_path, - vec![(&"{last_modified_time}".to_string(), &now_time())], + vec![(&"{last_modified_time}".to_string(), &now)], ); } @@ -381,22 +382,25 @@ fn test_with_mpr() { let expected_test_file_path = "mpr.log.expected"; let expected_test_file_path1 = "mpr1.log.expected"; let expected_test_file_path2 = "mpr2.log.expected"; + let now = now_time(); new_ucmd!() .args(&["--pages=1:2", "-m", "-n", test_file_path, test_file_path1]) .succeeds() .stdout_is_templated_fixture( expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &now_time())], + vec![(&"{last_modified_time}".to_string(), &now)], ); + let now = now_time(); new_ucmd!() .args(&["--pages=2:4", "-m", "-n", test_file_path, test_file_path1]) .succeeds() .stdout_is_templated_fixture( expected_test_file_path1, - vec![(&"{last_modified_time}".to_string(), &now_time())], + vec![(&"{last_modified_time}".to_string(), &now)], ); + let now = now_time(); new_ucmd!() .args(&[ "--pages=1:2", @@ -411,7 +415,7 @@ fn test_with_mpr() { .succeeds() .stdout_is_templated_fixture( expected_test_file_path2, - vec![(&"{last_modified_time}".to_string(), &now_time())], + vec![(&"{last_modified_time}".to_string(), &now)], ); } @@ -507,11 +511,12 @@ fn test_with_join_lines_option() { let test_file_2 = "test.log"; let expected_file_path = "joined.log.expected"; let mut scenario = new_ucmd!(); + let now = now_time(); scenario .args(&["+1:2", "-J", "-m", test_file_1, test_file_2]) .run() .stdout_is_templated_fixture( expected_file_path, - vec![(&"{last_modified_time}".to_string(), &now_time())], + vec![(&"{last_modified_time}".to_string(), &now)], ); } From 6aa53ead7c26ad8a4814466798a788eeea35f968 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 2 Jun 2021 18:43:35 +0200 Subject: [PATCH 0836/1135] rustfmt the recent change --- tests/by-util/test_seq.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/by-util/test_seq.rs b/tests/by-util/test_seq.rs index 459eeeb3a..be04bf1fd 100644 --- a/tests/by-util/test_seq.rs +++ b/tests/by-util/test_seq.rs @@ -2,18 +2,16 @@ use crate::common::util::*; #[test] fn test_rejects_nan() { - new_ucmd!() - .args(&["NaN"]) - .fails() - .stderr_only("seq: invalid 'not-a-number' argument: 'NaN'\nTry 'seq --help' for more information."); + new_ucmd!().args(&["NaN"]).fails().stderr_only( + "seq: invalid 'not-a-number' argument: 'NaN'\nTry 'seq --help' for more information.", + ); } #[test] fn test_rejects_non_floats() { - new_ucmd!() - .args(&["foo"]) - .fails() - .stderr_only("seq: invalid floating point argument: 'foo'\nTry 'seq --help' for more information."); + new_ucmd!().args(&["foo"]).fails().stderr_only( + "seq: invalid floating point argument: 'foo'\nTry 'seq --help' for more information.", + ); } // ---- Tests for the big integer based path ---- From d8c06dd6bb88b7392cdf58bd0502765c4974cd4f Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 2 Jun 2021 19:00:19 +0200 Subject: [PATCH 0837/1135] use clap::crate_version macro instead of the env variable --- src/uu/arch/src/arch.rs | 5 ++--- src/uu/basename/src/basename.rs | 5 ++--- src/uu/cat/src/cat.rs | 5 ++--- src/uu/chmod/src/chmod.rs | 5 ++--- src/uu/chown/src/chown.rs | 5 ++--- src/uu/chroot/src/chroot.rs | 5 ++--- src/uu/cksum/src/cksum.rs | 5 ++--- src/uu/comm/src/comm.rs | 5 ++--- src/uu/cp/src/cp.rs | 5 ++--- src/uu/csplit/src/csplit.rs | 5 ++--- src/uu/cut/src/cut.rs | 5 ++--- src/uu/date/src/date.rs | 5 ++--- src/uu/df/src/df.rs | 5 ++--- src/uu/dirname/src/dirname.rs | 5 ++--- src/uu/du/src/du.rs | 5 ++--- src/uu/expand/src/expand.rs | 5 ++--- src/uu/factor/src/cli.rs | 5 ++--- src/uu/fmt/src/fmt.rs | 5 ++--- src/uu/fold/src/fold.rs | 5 ++--- src/uu/groups/src/groups.rs | 5 ++--- src/uu/head/src/head.rs | 5 ++--- src/uu/hostname/src/hostname.rs | 5 ++--- src/uu/id/src/id.rs | 5 ++--- src/uu/install/src/install.rs | 5 ++--- src/uu/join/src/join.rs | 5 ++--- src/uu/kill/src/kill.rs | 5 ++--- src/uu/link/src/link.rs | 5 ++--- src/uu/ln/src/ln.rs | 5 ++--- src/uu/logname/src/logname.rs | 5 ++--- src/uu/ls/src/ls.rs | 5 ++--- src/uu/mkdir/src/mkdir.rs | 5 ++--- src/uu/mkfifo/src/mkfifo.rs | 5 ++--- src/uu/mknod/src/mknod.rs | 5 ++--- src/uu/mktemp/src/mktemp.rs | 5 ++--- src/uu/more/src/more.rs | 4 ++-- src/uu/mv/src/mv.rs | 5 ++--- src/uu/nice/src/nice.rs | 5 ++--- src/uu/nl/src/nl.rs | 5 ++--- src/uu/nohup/src/nohup.rs | 5 ++--- src/uu/nproc/src/nproc.rs | 5 ++--- src/uu/numfmt/src/numfmt.rs | 5 ++--- src/uu/od/src/od.rs | 17 ++--------------- src/uu/paste/src/paste.rs | 5 ++--- src/uu/pathchk/src/pathchk.rs | 5 ++--- src/uu/pinky/src/pinky.rs | 5 ++--- src/uu/printenv/src/printenv.rs | 5 ++--- src/uu/ptx/src/ptx.rs | 5 ++--- src/uu/pwd/src/pwd.rs | 5 ++--- src/uu/readlink/src/readlink.rs | 5 ++--- src/uu/realpath/src/realpath.rs | 5 ++--- src/uu/relpath/src/relpath.rs | 5 ++--- src/uu/rm/src/rm.rs | 5 ++--- src/uu/rmdir/src/rmdir.rs | 5 ++--- src/uu/seq/src/seq.rs | 5 ++--- src/uu/shred/src/shred.rs | 5 ++--- src/uu/shuf/src/shuf.rs | 5 ++--- src/uu/sleep/src/sleep.rs | 5 ++--- src/uu/sort/src/sort.rs | 9 ++++----- src/uu/split/src/split.rs | 5 ++--- src/uu/stat/src/stat.rs | 5 ++--- src/uu/stdbuf/src/stdbuf.rs | 5 ++--- src/uu/sum/src/sum.rs | 5 ++--- src/uu/sync/src/sync.rs | 5 ++--- src/uu/tac/src/tac.rs | 5 ++--- src/uu/tee/src/tee.rs | 5 ++--- src/uu/timeout/src/timeout.rs | 6 ++---- src/uu/touch/src/touch.rs | 5 ++--- src/uu/tr/src/tr.rs | 5 ++--- src/uu/truncate/src/truncate.rs | 5 ++--- src/uu/tsort/src/tsort.rs | 5 ++--- src/uu/tty/src/tty.rs | 5 ++--- src/uu/uname/src/uname.rs | 5 ++--- src/uu/unexpand/src/unexpand.rs | 5 ++--- src/uu/uniq/src/uniq.rs | 5 ++--- src/uu/unlink/src/unlink.rs | 5 ++--- src/uu/uptime/src/uptime.rs | 5 ++--- src/uu/users/src/users.rs | 5 ++--- src/uu/wc/src/wc.rs | 5 ++--- src/uu/who/src/who.rs | 5 ++--- 79 files changed, 160 insertions(+), 251 deletions(-) diff --git a/src/uu/arch/src/arch.rs b/src/uu/arch/src/arch.rs index 31278f000..eddd24502 100644 --- a/src/uu/arch/src/arch.rs +++ b/src/uu/arch/src/arch.rs @@ -11,15 +11,14 @@ extern crate uucore; use platform_info::*; -use clap::App; +use clap::{crate_version, App}; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Display machine architecture"; static SUMMARY: &str = "Determine architecture name for current machine."; pub fn uumain(args: impl uucore::Args) -> i32 { App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .after_help(SUMMARY) .get_matches_from(args); diff --git a/src/uu/basename/src/basename.rs b/src/uu/basename/src/basename.rs index ebd69de79..a0eed93f1 100644 --- a/src/uu/basename/src/basename.rs +++ b/src/uu/basename/src/basename.rs @@ -10,11 +10,10 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::path::{is_separator, PathBuf}; use uucore::InvalidEncodingHandling; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static SUMMARY: &str = "Print NAME with any leading directory components removed If specified, also remove a trailing SUFFIX"; @@ -42,7 +41,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // Argument parsing // let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(SUMMARY) .usage(&usage[..]) .arg( diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index 69ea902e6..1f2f441d8 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -16,7 +16,7 @@ extern crate unix_socket; extern crate uucore; // last synced with: cat (GNU coreutils) 8.13 -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::fs::{metadata, File}; use std::io::{self, Read, Write}; use thiserror::Error; @@ -38,7 +38,6 @@ use unix_socket::UnixStream; use uucore::InvalidEncodingHandling; static NAME: &str = "cat"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static SYNTAX: &str = "[OPTION]... [FILE]..."; static SUMMARY: &str = "Concatenate FILE(s), or standard input, to standard output With no FILE, or when FILE is -, read standard input."; @@ -173,7 +172,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .name(NAME) - .version(VERSION) + .version(crate_version!()) .usage(SYNTAX) .about(SUMMARY) .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index 62faacffe..9cdabc7d6 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::fs; use std::os::unix::fs::{MetadataExt, PermissionsExt}; use std::path::Path; @@ -21,7 +21,6 @@ use uucore::mode; use uucore::InvalidEncodingHandling; use walkdir::WalkDir; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Change the mode of each FILE to MODE. With --reference, change the mode of each FILE to that of RFILE."; @@ -63,7 +62,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let after_help = get_long_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .after_help(&after_help[..]) diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index 3d0b25814..2bb5133fe 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -14,7 +14,7 @@ use uucore::fs::resolve_relative_path; use uucore::libc::{gid_t, uid_t}; use uucore::perms::{wrap_chown, Verbosity}; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use walkdir::WalkDir; @@ -26,7 +26,6 @@ use std::path::Path; use uucore::InvalidEncodingHandling; static ABOUT: &str = "change file owner and group"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); pub mod options { pub mod verbosity { @@ -75,7 +74,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/chroot/src/chroot.rs b/src/uu/chroot/src/chroot.rs index 9480830e5..a05bd4494 100644 --- a/src/uu/chroot/src/chroot.rs +++ b/src/uu/chroot/src/chroot.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::ffi::CString; use std::io::Error; use std::path::Path; @@ -18,7 +18,6 @@ use std::process::Command; use uucore::libc::{self, chroot, setgid, setgroups, setuid}; use uucore::{entries, InvalidEncodingHandling}; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static NAME: &str = "chroot"; static ABOUT: &str = "Run COMMAND with root directory set to NEWROOT."; static SYNTAX: &str = "[OPTION]... NEWROOT [COMMAND [ARG]...]"; @@ -37,7 +36,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .accept_any(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(SYNTAX) .arg(Arg::with_name(options::NEWROOT).hidden(true).required(true)) diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index b6f798d5e..49c0536f5 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::fs::File; use std::io::{self, stdin, BufReader, Read}; use std::path::Path; @@ -20,7 +20,6 @@ use uucore::InvalidEncodingHandling; const CRC_TABLE_LEN: usize = 256; const CRC_TABLE: [u32; CRC_TABLE_LEN] = generate_crc_table(); -const VERSION: &str = env!("CARGO_PKG_VERSION"); const NAME: &str = "cksum"; const SYNTAX: &str = "[OPTIONS] [FILE]..."; const SUMMARY: &str = "Print CRC and size for each file"; @@ -187,7 +186,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .name(NAME) - .version(VERSION) + .version(crate_version!()) .about(SUMMARY) .usage(SYNTAX) .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) diff --git a/src/uu/comm/src/comm.rs b/src/uu/comm/src/comm.rs index d1d07461c..f7190fb73 100644 --- a/src/uu/comm/src/comm.rs +++ b/src/uu/comm/src/comm.rs @@ -16,9 +16,8 @@ use std::io::{self, stdin, BufRead, BufReader, Stdin}; use std::path::Path; use uucore::InvalidEncodingHandling; -use clap::{App, Arg, ArgMatches}; +use clap::{crate_version, App, Arg, ArgMatches}; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "compare two sorted files line by line"; static LONG_HELP: &str = ""; @@ -140,7 +139,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .accept_any(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .after_help(LONG_HELP) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 40266689c..63c322438 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -25,7 +25,7 @@ use winapi::um::fileapi::GetFileInformationByHandle; use std::borrow::Cow; -use clap::{App, Arg, ArgMatches}; +use clap::{crate_version, App, Arg, ArgMatches}; use filetime::FileTime; use quick_error::ResultExt; use std::collections::HashSet; @@ -213,7 +213,6 @@ pub struct Options { verbose: bool, } -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY."; static LONG_HELP: &str = ""; static EXIT_OK: i32 = 0; @@ -294,7 +293,7 @@ static DEFAULT_ATTRIBUTES: &[Attribute] = &[ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .after_help(&*format!("{}\n{}", LONG_HELP, backup_control::BACKUP_CONTROL_LONG_HELP)) .usage(&usage[..]) diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index a2eb8604a..e3b2069ab 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -2,7 +2,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg, ArgMatches}; +use clap::{crate_version, App, Arg, ArgMatches}; use regex::Regex; use std::cmp::Ordering; use std::io::{self, BufReader}; @@ -19,7 +19,6 @@ use crate::csplit_error::CsplitError; use crate::split_name::SplitName; use uucore::InvalidEncodingHandling; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static SUMMARY: &str = "split a file into sections determined by context lines"; static LONG_HELP: &str = "Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output."; @@ -713,7 +712,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .accept_any(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(SUMMARY) .usage(&usage[..]) .arg( diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index 535027237..819cbb989 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -11,7 +11,7 @@ extern crate uucore; use bstr::io::BufReadExt; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::fs::File; use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write}; use std::path::Path; @@ -24,7 +24,6 @@ use uucore::InvalidEncodingHandling; mod searcher; static NAME: &str = "cut"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static SYNTAX: &str = "[-d] [-s] [-z] [--output-delimiter] ((-f|-b|-c) {{sequence}}) {{sourcefile}}+"; static SUMMARY: &str = @@ -400,7 +399,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .name(NAME) - .version(VERSION) + .version(crate_version!()) .usage(SYNTAX) .about(SUMMARY) .after_help(LONG_HELP) diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index 02aa7a60d..8a0e3ef3a 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -14,7 +14,7 @@ extern crate uucore; use chrono::{DateTime, FixedOffset, Local, Offset, Utc}; #[cfg(windows)] use chrono::{Datelike, Timelike}; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; #[cfg(all(unix, not(target_os = "macos")))] use libc::{clock_settime, timespec, CLOCK_REALTIME}; use std::fs::File; @@ -37,7 +37,6 @@ const SECOND: &str = "second"; const NS: &str = "ns"; const NAME: &str = "date"; -const VERSION: &str = env!("CARGO_PKG_VERSION"); const ABOUT: &str = "print or set the system date and time"; const OPT_DATE: &str = "date"; @@ -144,7 +143,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { NAME ); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&syntax[..]) .arg( diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index 07f8b0214..0836aa43d 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -12,7 +12,7 @@ extern crate uucore; use uucore::fsext::statfs_fn; use uucore::fsext::{read_fs_list, FsUsage, MountInfo}; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use number_prefix::NumberPrefix; use std::cell::Cell; @@ -30,7 +30,6 @@ use uucore::libc::{c_char, fsid_t, uid_t}; #[cfg(windows)] use std::path::Path; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Show information about the file system on which each FILE resides,\n\ or all file systems by default."; @@ -260,7 +259,7 @@ fn use_size(free_size: u64, total_size: u64) -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/dirname/src/dirname.rs b/src/uu/dirname/src/dirname.rs index 63693c982..ad42517d4 100644 --- a/src/uu/dirname/src/dirname.rs +++ b/src/uu/dirname/src/dirname.rs @@ -8,12 +8,11 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::path::Path; use uucore::InvalidEncodingHandling; static ABOUT: &str = "strip last component from file name"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); mod options { pub const ZERO: &str = "zero"; @@ -43,7 +42,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .after_help(&after_help[..]) - .version(VERSION) + .version(crate_version!()) .arg( Arg::with_name(options::ZERO) .long(options::ZERO) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 0bc8b30c8..cbb945423 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -10,7 +10,7 @@ extern crate uucore; use chrono::prelude::DateTime; use chrono::Local; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::collections::HashSet; use std::env; use std::fs; @@ -56,7 +56,6 @@ mod options { pub const FILE: &str = "FILE"; } -const VERSION: &str = env!("CARGO_PKG_VERSION"); const NAME: &str = "du"; const SUMMARY: &str = "estimate file space usage"; const LONG_HELP: &str = " @@ -398,7 +397,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(SUMMARY) .usage(&usage[..]) .after_help(LONG_HELP) diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index 67d24086c..08a514dbf 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -12,14 +12,13 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg, ArgMatches}; +use clap::{crate_version, App, Arg, ArgMatches}; use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; use std::iter::repeat; use std::str::from_utf8; use unicode_width::UnicodeWidthChar; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Convert tabs in each FILE to spaces, writing to standard output. With no FILE, or when FILE is -, read standard input."; @@ -111,7 +110,7 @@ impl Options { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .after_help(LONG_HELP) diff --git a/src/uu/factor/src/cli.rs b/src/uu/factor/src/cli.rs index 69a368479..af5e3cdb0 100644 --- a/src/uu/factor/src/cli.rs +++ b/src/uu/factor/src/cli.rs @@ -13,7 +13,7 @@ use std::error::Error; use std::io::{self, stdin, stdout, BufRead, Write}; mod factor; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; pub use factor::*; mod miller_rabin; @@ -21,7 +21,6 @@ pub mod numeric; mod rho; pub mod table; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static SUMMARY: &str = "Print the prime factors of the given NUMBER(s). If none are specified, read from standard input."; @@ -38,7 +37,7 @@ fn print_factors_str(num_str: &str, w: &mut impl io::Write) -> Result<(), Box i32 { let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(SUMMARY) .arg(Arg::with_name(options::NUMBER).multiple(true)) .get_matches_from(args); diff --git a/src/uu/fmt/src/fmt.rs b/src/uu/fmt/src/fmt.rs index f10f4cf7f..91f59e076 100644 --- a/src/uu/fmt/src/fmt.rs +++ b/src/uu/fmt/src/fmt.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::cmp; use std::fs::File; use std::io::{stdin, stdout, Write}; @@ -32,7 +32,6 @@ mod linebreak; mod parasplit; static ABOUT: &str = "Reformat paragraphs from input files (or stdin) to stdout."; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static MAX_WIDTH: usize = 2500; static OPT_CROWN_MARGIN: &str = "crown-margin"; @@ -79,7 +78,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index 1f52748f1..e476fed5b 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; use std::path::Path; @@ -19,7 +19,6 @@ use uucore::InvalidEncodingHandling; const TAB_WIDTH: usize = 8; static NAME: &str = "fold"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static SYNTAX: &str = "[OPTION]... [FILE]..."; static SUMMARY: &str = "Writes each file (or standard input if no files are given) to standard output whilst breaking long lines"; @@ -39,7 +38,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let (args, obs_width) = handle_obsolete(&args[..]); let matches = App::new(executable!()) .name(NAME) - .version(VERSION) + .version(crate_version!()) .usage(SYNTAX) .about(SUMMARY) .arg( diff --git a/src/uu/groups/src/groups.rs b/src/uu/groups/src/groups.rs index 2ce5fe70e..5b9cd948a 100644 --- a/src/uu/groups/src/groups.rs +++ b/src/uu/groups/src/groups.rs @@ -12,9 +12,8 @@ extern crate uucore; use uucore::entries::{get_groups, gid2grp, Locate, Passwd}; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "display current group names"; static OPT_USER: &str = "user"; @@ -26,7 +25,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg(Arg::with_name(OPT_USER)) diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index ff5ef2355..28710e1fe 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -1,6 +1,6 @@ // spell-checker:ignore (vars) zlines -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::convert::TryFrom; use std::ffi::OsString; use std::io::{self, ErrorKind, Read, Seek, SeekFrom, Write}; @@ -10,7 +10,6 @@ const EXIT_FAILURE: i32 = 1; const EXIT_SUCCESS: i32 = 0; const BUF_SIZE: usize = 65536; -const VERSION: &str = env!("CARGO_PKG_VERSION"); const ABOUT: &str = "\ Print the first 10 lines of each FILE to standard output.\n\ With more than one FILE, precede each with a header giving the file name.\n\ @@ -38,7 +37,7 @@ use take::take_all_but; fn app<'a>() -> App<'a, 'a> { App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(USAGE) .arg( diff --git a/src/uu/hostname/src/hostname.rs b/src/uu/hostname/src/hostname.rs index d6f70be16..ff312fb58 100644 --- a/src/uu/hostname/src/hostname.rs +++ b/src/uu/hostname/src/hostname.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg, ArgMatches}; +use clap::{crate_version, App, Arg, ArgMatches}; use std::collections::hash_set::HashSet; use std::net::ToSocketAddrs; use std::str; @@ -21,7 +21,6 @@ use winapi::shared::minwindef::MAKEWORD; use winapi::um::winsock2::{WSACleanup, WSAStartup}; static ABOUT: &str = "Display or set the system's host name."; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static OPT_DOMAIN: &str = "domain"; static OPT_IP_ADDRESS: &str = "ip-address"; @@ -54,7 +53,7 @@ fn get_usage() -> String { fn execute(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index 4536622c7..77b185f24 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -18,7 +18,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::ffi::CStr; use uucore::entries::{self, Group, Locate, Passwd}; pub use uucore::libc; @@ -71,7 +71,6 @@ mod audit { } static ABOUT: &str = "Display user and group information for the specified USER,\n or (when USER omitted) for the current user."; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static OPT_AUDIT: &str = "audit"; static OPT_EFFECTIVE_USER: &str = "effective-user"; @@ -92,7 +91,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 7a4ad1fd1..7aa6f95ff 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -12,7 +12,7 @@ mod mode; #[macro_use] extern crate uucore; -use clap::{App, Arg, ArgMatches}; +use clap::{crate_version, App, Arg, ArgMatches}; use file_diff::diff; use filetime::{set_file_times, FileTime}; use uucore::entries::{grp2gid, usr2uid}; @@ -64,7 +64,6 @@ impl Behavior { static ABOUT: &str = "Copy SOURCE to DEST or multiple SOURCE(s) to the existing DIRECTORY, while setting permission modes and owner/group"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static OPT_COMPARE: &str = "compare"; static OPT_BACKUP: &str = "backup"; @@ -99,7 +98,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/join/src/join.rs b/src/uu/join/src/join.rs index d02a54eb3..7a044789f 100644 --- a/src/uu/join/src/join.rs +++ b/src/uu/join/src/join.rs @@ -10,13 +10,12 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::cmp::{min, Ordering}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Lines, Stdin}; static NAME: &str = "join"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); #[derive(Copy, Clone, PartialEq)] enum FileNum { @@ -444,7 +443,7 @@ impl<'a> State<'a> { pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(NAME) - .version(VERSION) + .version(crate_version!()) .about( "For each pair of input lines with identical join fields, write a line to standard output. The default join field is the first, delimited by blanks. diff --git a/src/uu/kill/src/kill.rs b/src/uu/kill/src/kill.rs index 362f13f18..6c2464c92 100644 --- a/src/uu/kill/src/kill.rs +++ b/src/uu/kill/src/kill.rs @@ -10,13 +10,12 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use libc::{c_int, pid_t}; use std::io::Error; use uucore::signals::ALL_SIGNALS; use uucore::InvalidEncodingHandling; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Send signal to processes or list information about signals."; static EXIT_OK: i32 = 0; @@ -45,7 +44,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = format!("{} [OPTIONS]... PID...", executable!()); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/link/src/link.rs b/src/uu/link/src/link.rs index bd8b33355..08401ebaf 100644 --- a/src/uu/link/src/link.rs +++ b/src/uu/link/src/link.rs @@ -8,12 +8,11 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::fs::hard_link; use std::io::Error; use std::path::Path; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Call the link function to create a link named FILE2 to an existing FILE1."; pub mod options { @@ -34,7 +33,7 @@ pub fn normalize_error_message(e: Error) -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index 2a14f3c9c..cd5eef842 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::borrow::Cow; use std::ffi::OsStr; @@ -77,7 +77,6 @@ fn get_long_usage() -> String { } static ABOUT: &str = "change file owner and group"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static OPT_B: &str = "b"; static OPT_BACKUP: &str = "backup"; @@ -98,7 +97,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let long_usage = get_long_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .after_help(&long_usage[..]) diff --git a/src/uu/logname/src/logname.rs b/src/uu/logname/src/logname.rs index 14bf7ef3b..ba5880403 100644 --- a/src/uu/logname/src/logname.rs +++ b/src/uu/logname/src/logname.rs @@ -15,7 +15,7 @@ extern crate uucore; use std::ffi::CStr; use uucore::InvalidEncodingHandling; -use clap::App; +use clap::{crate_version, App}; extern "C" { // POSIX requires using getlogin (or equivalent code) @@ -34,7 +34,6 @@ fn get_userlogin() -> Option { } static SUMMARY: &str = "Print user's login name"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); fn get_usage() -> String { String::from(executable!()) @@ -47,7 +46,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let _ = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(SUMMARY) .usage(&usage[..]) .get_matches_from(args); diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 28ab13c71..3c7b22360 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -16,7 +16,7 @@ extern crate lazy_static; mod quoting_style; mod version_cmp; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use globset::{self, Glob, GlobSet, GlobSetBuilder}; use lscolors::LsColors; use number_prefix::NumberPrefix; @@ -45,7 +45,6 @@ use unicode_width::UnicodeWidthStr; #[cfg(unix)] use uucore::libc::{S_IXGRP, S_IXOTH, S_IXUSR}; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = " By default, ls will list the files and contents of any directories on the command line, expect that it will ignore files and directories @@ -559,7 +558,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let app = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) diff --git a/src/uu/mkdir/src/mkdir.rs b/src/uu/mkdir/src/mkdir.rs index 861ef5075..d1461c0c9 100644 --- a/src/uu/mkdir/src/mkdir.rs +++ b/src/uu/mkdir/src/mkdir.rs @@ -8,12 +8,11 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::fs; use std::path::Path; static ABOUT: &str = "Create the given DIRECTORY(ies) if they do not exist"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static OPT_MODE: &str = "mode"; static OPT_PARENTS: &str = "parents"; static OPT_VERBOSE: &str = "verbose"; @@ -34,7 +33,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // opts.optflag("Z", "context", "set SELinux security context" + // " of each created directory to CTX"), let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/mkfifo/src/mkfifo.rs b/src/uu/mkfifo/src/mkfifo.rs index 2fdd4abec..cf2fefa50 100644 --- a/src/uu/mkfifo/src/mkfifo.rs +++ b/src/uu/mkfifo/src/mkfifo.rs @@ -8,13 +8,12 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use libc::mkfifo; use std::ffi::CString; use uucore::InvalidEncodingHandling; static NAME: &str = "mkfifo"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static USAGE: &str = "mkfifo [OPTION]... NAME..."; static SUMMARY: &str = "Create a FIFO with the given name."; @@ -32,7 +31,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .name(NAME) - .version(VERSION) + .version(crate_version!()) .usage(USAGE) .about(SUMMARY) .arg( diff --git a/src/uu/mknod/src/mknod.rs b/src/uu/mknod/src/mknod.rs index 57bdd3052..e5e6ef1fa 100644 --- a/src/uu/mknod/src/mknod.rs +++ b/src/uu/mknod/src/mknod.rs @@ -12,14 +12,13 @@ extern crate uucore; use std::ffi::CString; -use clap::{App, Arg, ArgMatches}; +use clap::{crate_version, App, Arg, ArgMatches}; use libc::{dev_t, mode_t}; use libc::{S_IFBLK, S_IFCHR, S_IFIFO, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR}; use uucore::InvalidEncodingHandling; static NAME: &str = "mknod"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Create the special file NAME of the given TYPE."; static USAGE: &str = "mknod [OPTION]... NAME TYPE [MAJOR MINOR]"; static LONG_HELP: &str = "Mandatory arguments to long options are mandatory for short options too. @@ -91,7 +90,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // opts.optopt("", "context", "like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX"); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .usage(USAGE) .after_help(LONG_HELP) .about(ABOUT) diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index f7c87495c..67a88273d 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -11,7 +11,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::env; use std::iter; @@ -21,7 +21,6 @@ use rand::Rng; use tempfile::Builder; static ABOUT: &str = "create a temporary file or directory."; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static DEFAULT_TEMPLATE: &str = "tmp.XXXXXXXXXX"; @@ -42,7 +41,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 482c5491d..deadba4e4 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -21,7 +21,7 @@ use std::{ #[cfg(all(unix, not(target_os = "fuchsia")))] extern crate nix; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use crossterm::{ event::{self, Event, KeyCode, KeyEvent, KeyModifiers}, execute, queue, @@ -49,7 +49,7 @@ const MULTI_FILE_TOP_PROMPT: &str = "::::::::::::::\n{}\n::::::::::::::\n"; pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .about("A file perusal filter for CRT viewing.") - .version(env!("CARGO_PKG_VERSION")) + .version(crate_version!()) // The commented arguments below are unimplemented: /* .arg( diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index c61c7caf1..6b6482702 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -11,7 +11,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg, ArgMatches}; +use clap::{crate_version, App, Arg, ArgMatches}; use std::env; use std::fs; use std::io::{self, stdin}; @@ -42,7 +42,6 @@ pub enum OverwriteMode { } static ABOUT: &str = "Move SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY."; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static LONG_HELP: &str = ""; static OPT_BACKUP: &str = "backup"; @@ -72,7 +71,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .after_help(&*format!("{}\n{}", LONG_HELP, backup_control::BACKUP_CONTROL_LONG_HELP)) .usage(&usage[..]) diff --git a/src/uu/nice/src/nice.rs b/src/uu/nice/src/nice.rs index c1d3345af..77baad0ca 100644 --- a/src/uu/nice/src/nice.rs +++ b/src/uu/nice/src/nice.rs @@ -15,8 +15,7 @@ use std::ffi::CString; use std::io::Error; use std::ptr; -use clap::{App, AppSettings, Arg}; -const VERSION: &str = env!("CARGO_PKG_VERSION"); +use clap::{crate_version, App, AppSettings, Arg}; // XXX: PRIO_PROCESS is 0 on at least FreeBSD and Linux. Don't know about Mac OS X. const PRIO_PROCESS: c_int = 0; @@ -49,7 +48,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .setting(AppSettings::TrailingVarArg) - .version(VERSION) + .version(crate_version!()) .usage(&usage[..]) .arg( Arg::with_name(options::ADJUSTMENT) diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 69adbed41..c062eedd9 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -11,7 +11,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; use std::iter::repeat; @@ -21,7 +21,6 @@ use uucore::InvalidEncodingHandling; mod helper; static NAME: &str = "nl"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static USAGE: &str = "nl [OPTION]... [FILE]..."; // A regular expression matching everything. @@ -91,7 +90,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .name(NAME) - .version(VERSION) + .version(crate_version!()) .usage(USAGE) .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) .arg( diff --git a/src/uu/nohup/src/nohup.rs b/src/uu/nohup/src/nohup.rs index 93d9b5e45..ea379ff49 100644 --- a/src/uu/nohup/src/nohup.rs +++ b/src/uu/nohup/src/nohup.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate uucore; -use clap::{App, AppSettings, Arg}; +use clap::{crate_version, App, AppSettings, Arg}; use libc::{c_char, dup2, execvp, signal}; use libc::{SIGHUP, SIG_IGN}; use std::env; @@ -22,7 +22,6 @@ use std::path::{Path, PathBuf}; use uucore::fs::{is_stderr_interactive, is_stdin_interactive, is_stdout_interactive}; use uucore::InvalidEncodingHandling; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Run COMMAND ignoring hangup signals."; static LONG_HELP: &str = " If standard input is terminal, it'll be replaced with /dev/null. @@ -48,7 +47,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .accept_any(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .after_help(LONG_HELP) diff --git a/src/uu/nproc/src/nproc.rs b/src/uu/nproc/src/nproc.rs index 285cf764f..13f1862d2 100644 --- a/src/uu/nproc/src/nproc.rs +++ b/src/uu/nproc/src/nproc.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::env; #[cfg(target_os = "linux")] @@ -25,7 +25,6 @@ pub const _SC_NPROCESSORS_CONF: libc::c_int = 1001; static OPT_ALL: &str = "all"; static OPT_IGNORE: &str = "ignore"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Print the number of cores available to the current process."; fn get_usage() -> String { @@ -35,7 +34,7 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index 6eba699b2..086336437 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -11,7 +11,7 @@ extern crate uucore; use crate::format::format_and_print; use crate::options::*; use crate::units::{Result, Transform, Unit}; -use clap::{App, AppSettings, Arg, ArgMatches}; +use clap::{crate_version, App, AppSettings, Arg, ArgMatches}; use std::io::{BufRead, Write}; use uucore::ranges::Range; @@ -19,7 +19,6 @@ pub mod format; mod options; mod units; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Convert numbers from/to human-readable strings"; static LONG_HELP: &str = "UNIT options: none no auto-scaling is done; suffixes will trigger an error @@ -149,7 +148,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .after_help(LONG_HELP) diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 7359047b2..33303f0fc 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -42,10 +42,9 @@ use crate::parse_nrofbytes::parse_number_of_bytes; use crate::partialreader::*; use crate::peekreader::*; use crate::prn_char::format_ascii_dump; -use clap::{self, AppSettings, Arg, ArgMatches}; +use clap::{self, crate_version, AppSettings, Arg, ArgMatches}; use uucore::InvalidEncodingHandling; -static VERSION: &str = env!("CARGO_PKG_VERSION"); const PEEK_BUFFER_SIZE: usize = 4; // utf-8 can be 4 bytes static ABOUT: &str = "dump files in octal and other formats"; @@ -103,7 +102,6 @@ pub(crate) mod options { pub const OUTPUT_DUPLICATES: &str = "output-duplicates"; pub const TRADITIONAL: &str = "traditional"; pub const WIDTH: &str = "width"; - pub const VERSION: &str = "version"; pub const FILENAME: &str = "FILENAME"; } @@ -228,7 +226,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .accept_any(); let clap_opts = clap::App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(USAGE) .after_help(LONG_HELP) @@ -431,12 +429,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .default_value("32") .value_name("BYTES"), ) - .arg( - Arg::with_name(options::VERSION) - .long(options::VERSION) - .help("output version information and exit.") - .takes_value(false), - ) .arg( Arg::with_name(options::TRADITIONAL) .long(options::TRADITIONAL) @@ -459,11 +451,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .clone() // Clone to reuse clap_opts to print help .get_matches_from(args.clone()); - if clap_matches.is_present(options::VERSION) { - println!("{} {}", executable!(), VERSION); - return 0; - } - let od_options = match OdOptions::new(clap_matches, args) { Err(s) => { show_usage_error!("{}", s); diff --git a/src/uu/paste/src/paste.rs b/src/uu/paste/src/paste.rs index 751cc0a04..f2fa3c81c 100644 --- a/src/uu/paste/src/paste.rs +++ b/src/uu/paste/src/paste.rs @@ -10,13 +10,12 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +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; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Write lines consisting of the sequentially corresponding lines from each FILE, separated by TABs, to standard output."; @@ -39,7 +38,7 @@ fn read_line( pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .arg( Arg::with_name(options::SERIAL) diff --git a/src/uu/pathchk/src/pathchk.rs b/src/uu/pathchk/src/pathchk.rs index 5606c4d6a..9667e0ba1 100644 --- a/src/uu/pathchk/src/pathchk.rs +++ b/src/uu/pathchk/src/pathchk.rs @@ -12,7 +12,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::fs; use std::io::{ErrorKind, Write}; use uucore::InvalidEncodingHandling; @@ -26,7 +26,6 @@ enum Mode { } static NAME: &str = "pathchk"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Check whether file names are valid or portable"; mod options { @@ -51,7 +50,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .accept_any(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/pinky/src/pinky.rs b/src/uu/pinky/src/pinky.rs index d65775c2d..27dcc2421 100644 --- a/src/uu/pinky/src/pinky.rs +++ b/src/uu/pinky/src/pinky.rs @@ -19,13 +19,12 @@ use std::io::BufReader; use std::fs::File; use std::os::unix::fs::MetadataExt; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::path::PathBuf; use uucore::InvalidEncodingHandling; const BUFSIZE: usize = 1024; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "pinky - lightweight finger"; mod options { @@ -62,7 +61,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let after_help = get_long_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .after_help(&after_help[..]) diff --git a/src/uu/printenv/src/printenv.rs b/src/uu/printenv/src/printenv.rs index 25cb58185..5c2594835 100644 --- a/src/uu/printenv/src/printenv.rs +++ b/src/uu/printenv/src/printenv.rs @@ -10,11 +10,10 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::env; static ABOUT: &str = "Display the values of the specified environment VARIABLE(s), or (with no VARIABLE) display name and value pairs for them all."; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static OPT_NULL: &str = "null"; @@ -28,7 +27,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index 5b0c35093..69960ac49 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use regex::Regex; use std::cmp; use std::collections::{BTreeSet, HashMap, HashSet}; @@ -20,7 +20,6 @@ use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; use uucore::InvalidEncodingHandling; static NAME: &str = "ptx"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static BRIEF: &str = "Usage: ptx [OPTION]... [INPUT]... (without -G) or: \ ptx -G [OPTION]... [INPUT [OUTPUT]] \n Output a permuted index, \ including context, of the words in the input files. \n\n Mandatory \ @@ -641,7 +640,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // let mut opts = Options::new(); let matches = App::new(executable!()) .name(NAME) - .version(VERSION) + .version(crate_version!()) .usage(BRIEF) .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) .arg( diff --git a/src/uu/pwd/src/pwd.rs b/src/uu/pwd/src/pwd.rs index 1786d33ee..9b4e5c600 100644 --- a/src/uu/pwd/src/pwd.rs +++ b/src/uu/pwd/src/pwd.rs @@ -8,13 +8,12 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::env; use std::io; use std::path::{Path, PathBuf}; static ABOUT: &str = "Display the full filename of the current working directory."; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static OPT_LOGICAL: &str = "logical"; static OPT_PHYSICAL: &str = "physical"; @@ -41,7 +40,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/readlink/src/readlink.rs b/src/uu/readlink/src/readlink.rs index 43a4ca656..02e286315 100644 --- a/src/uu/readlink/src/readlink.rs +++ b/src/uu/readlink/src/readlink.rs @@ -10,14 +10,13 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::fs; use std::io::{stdout, Write}; use std::path::{Path, PathBuf}; use uucore::fs::{canonicalize, CanonicalizeMode}; const NAME: &str = "readlink"; -const VERSION: &str = env!("CARGO_PKG_VERSION"); const ABOUT: &str = "Print value of a symbolic link or canonical file name."; const OPT_CANONICALIZE: &str = "canonicalize"; const OPT_CANONICALIZE_MISSING: &str = "canonicalize-missing"; @@ -37,7 +36,7 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/realpath/src/realpath.rs b/src/uu/realpath/src/realpath.rs index 937cee5bd..1a96b7f80 100644 --- a/src/uu/realpath/src/realpath.rs +++ b/src/uu/realpath/src/realpath.rs @@ -10,12 +10,11 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::path::{Path, PathBuf}; use uucore::fs::{canonicalize, CanonicalizeMode}; static ABOUT: &str = "print the resolved path"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static OPT_QUIET: &str = "quiet"; static OPT_STRIP: &str = "strip"; @@ -31,7 +30,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/relpath/src/relpath.rs b/src/uu/relpath/src/relpath.rs index f1b2c9a43..a997e1c5f 100644 --- a/src/uu/relpath/src/relpath.rs +++ b/src/uu/relpath/src/relpath.rs @@ -10,13 +10,12 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::env; use std::path::{Path, PathBuf}; use uucore::fs::{canonicalize, CanonicalizeMode}; use uucore::InvalidEncodingHandling; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Convert TO destination to the relative path from the FROM dir. If FROM path is omitted, current working dir will be used."; @@ -37,7 +36,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 8010988bb..43a4f4780 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use remove_dir_all::remove_dir_all; use std::collections::VecDeque; use std::fs; @@ -38,7 +38,6 @@ struct Options { } static ABOUT: &str = "Remove (unlink) the FILE(s)"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static OPT_DIR: &str = "dir"; static OPT_INTERACTIVE: &str = "interactive"; static OPT_FORCE: &str = "force"; @@ -79,7 +78,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let long_usage = get_long_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .after_help(&long_usage[..]) diff --git a/src/uu/rmdir/src/rmdir.rs b/src/uu/rmdir/src/rmdir.rs index d39c33f77..d13a21f60 100644 --- a/src/uu/rmdir/src/rmdir.rs +++ b/src/uu/rmdir/src/rmdir.rs @@ -10,11 +10,10 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::fs; use std::path::Path; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Remove the DIRECTORY(ies), if they are empty."; static OPT_IGNORE_FAIL_NON_EMPTY: &str = "ignore-fail-on-non-empty"; static OPT_PARENTS: &str = "parents"; @@ -35,7 +34,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index 8cf6513cb..954d15f2f 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -6,7 +6,7 @@ #[macro_use] extern crate uucore; -use clap::{App, AppSettings, Arg}; +use clap::{crate_version, App, AppSettings, Arg}; use num_bigint::BigInt; use num_traits::One; use num_traits::Zero; @@ -15,7 +15,6 @@ use std::cmp; use std::io::{stdout, Write}; use std::str::FromStr; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Display numbers from FIRST to LAST, in steps of INCREMENT."; static OPT_SEPARATOR: &str = "separator"; static OPT_TERMINATOR: &str = "terminator"; @@ -90,7 +89,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) .setting(AppSettings::AllowLeadingHyphen) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index e371ad6b2..6a43ed478 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -8,7 +8,7 @@ // spell-checker:ignore (words) writeback wipesync -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use rand::{Rng, ThreadRng}; use std::cell::{Cell, RefCell}; use std::fs; @@ -23,7 +23,6 @@ use uucore::InvalidEncodingHandling; extern crate uucore; static NAME: &str = "shred"; -static VERSION_STR: &str = "1.0.0"; const BLOCK_SIZE: usize = 512; const NAME_CHARSET: &str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_."; @@ -278,7 +277,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let app = App::new(executable!()) - .version(VERSION_STR) + .version(crate_version!()) .about(ABOUT) .after_help(AFTER_HELP) .usage(&usage[..]) diff --git a/src/uu/shuf/src/shuf.rs b/src/uu/shuf/src/shuf.rs index 9c735673c..88a47585f 100644 --- a/src/uu/shuf/src/shuf.rs +++ b/src/uu/shuf/src/shuf.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use rand::Rng; use std::fs::File; use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write}; @@ -23,7 +23,6 @@ enum Mode { } static NAME: &str = "shuf"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static USAGE: &str = r#"shuf [OPTION]... [FILE] or: shuf -e [OPTION]... [ARG]... or: shuf -i LO-HI [OPTION]... @@ -59,7 +58,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .name(NAME) - .version(VERSION) + .version(crate_version!()) .template(TEMPLATE) .usage(USAGE) .arg( diff --git a/src/uu/sleep/src/sleep.rs b/src/uu/sleep/src/sleep.rs index 5c1f06e5e..c78c1cfc9 100644 --- a/src/uu/sleep/src/sleep.rs +++ b/src/uu/sleep/src/sleep.rs @@ -11,9 +11,8 @@ extern crate uucore; use std::thread; use std::time::Duration; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Pause for NUMBER seconds."; static LONG_HELP: &str = "Pause for NUMBER seconds. SUFFIX may be 's' for seconds (the default), 'm' for minutes, 'h' for hours or 'd' for days. Unlike most implementations @@ -37,7 +36,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .after_help(LONG_HELP) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index f47b561ed..5825e73bd 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -23,7 +23,7 @@ mod ext_sort; mod merge; mod numeric_str_cmp; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use custom_str_cmp::custom_str_cmp; use ext_sort::ext_sort; use fnv::FnvHasher; @@ -47,7 +47,6 @@ use uucore::InvalidEncodingHandling; static NAME: &str = "sort"; static ABOUT: &str = "Display sorted concatenation of all FILE(s)."; -static VERSION: &str = env!("CARGO_PKG_VERSION"); const LONG_HELP_KEYS: &str = "The key format is FIELD[.CHAR][OPTIONS][,FIELD[.CHAR]][OPTIONS]. @@ -874,13 +873,13 @@ impl FieldSelector { fn get_usage() -> String { format!( - "{0} {1} + "{0} Usage: {0} [OPTION]... [FILE]... Write the sorted concatenation of all FILE(s) to standard output. Mandatory arguments for long options are mandatory for short options too. With no FILE, or when FILE is -, read standard input.", - NAME, VERSION + NAME ) } @@ -902,7 +901,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let mut settings: GlobalSettings = Default::default(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index 85ed5f183..6550c35ac 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -12,7 +12,7 @@ extern crate uucore; mod platform; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::env; use std::fs::File; use std::io::{stdin, BufRead, BufReader, BufWriter, Read, Write}; @@ -20,7 +20,6 @@ use std::path::Path; use std::{char, fs::remove_file}; static NAME: &str = "split"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static OPT_BYTES: &str = "bytes"; static OPT_LINE_BYTES: &str = "line-bytes"; @@ -56,7 +55,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let default_suffix_length_str = OPT_DEFAULT_SUFFIX_LENGTH.to_string(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about("Create output files containing consecutive or interleaved sections of input") .usage(&usage[..]) .after_help(&long_usage[..]) diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 403134b4b..fa070d9b7 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -14,7 +14,7 @@ use uucore::fsext::{ }; use uucore::libc::mode_t; -use clap::{App, Arg, ArgMatches}; +use clap::{crate_version, App, Arg, ArgMatches}; use std::borrow::Cow; use std::convert::AsRef; use std::os::unix::fs::{FileTypeExt, MetadataExt}; @@ -82,7 +82,6 @@ macro_rules! print_adjusted { } static ABOUT: &str = "Display file or file system status."; -static VERSION: &str = env!("CARGO_PKG_VERSION"); pub mod options { pub static DEREFERENCE: &str = "dereference"; @@ -949,7 +948,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let long_usage = get_long_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .after_help(&long_usage[..]) diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 134247060..852fe3ef9 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate uucore; -use clap::{App, AppSettings, Arg, ArgMatches}; +use clap::{crate_version, App, AppSettings, Arg, ArgMatches}; use std::convert::TryFrom; use std::fs::File; use std::io::{self, Write}; @@ -21,7 +21,6 @@ use tempfile::tempdir; use tempfile::TempDir; use uucore::InvalidEncodingHandling; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Run COMMAND, with modified buffering operations for its standard streams.\n\n\ Mandatory arguments to long options are mandatory for short options too."; @@ -193,7 +192,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .after_help(LONG_HELP) diff --git a/src/uu/sum/src/sum.rs b/src/uu/sum/src/sum.rs index 95de707fa..4d42d7a97 100644 --- a/src/uu/sum/src/sum.rs +++ b/src/uu/sum/src/sum.rs @@ -10,14 +10,13 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::fs::File; use std::io::{stdin, Read, Result}; use std::path::Path; use uucore::InvalidEncodingHandling; static NAME: &str = "sum"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static USAGE: &str = "[OPTION]... [FILE]...\nWith no FILE, or when FILE is -, read standard input."; static SUMMARY: &str = "Checksum and count the blocks in a file."; @@ -101,7 +100,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .name(NAME) - .version(VERSION) + .version(crate_version!()) .usage(USAGE) .about(SUMMARY) .arg(Arg::with_name(options::FILE).multiple(true).hidden(true)) diff --git a/src/uu/sync/src/sync.rs b/src/uu/sync/src/sync.rs index 59206db98..53d1a5701 100644 --- a/src/uu/sync/src/sync.rs +++ b/src/uu/sync/src/sync.rs @@ -12,13 +12,12 @@ extern crate libc; #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::path::Path; static EXIT_ERR: i32 = 1; static ABOUT: &str = "Synchronize cached writes to persistent storage"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); pub mod options { pub static FILE_SYSTEM: &str = "file-system"; pub static DATA: &str = "data"; @@ -168,7 +167,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/tac/src/tac.rs b/src/uu/tac/src/tac.rs index a638d578d..be1852ec5 100644 --- a/src/uu/tac/src/tac.rs +++ b/src/uu/tac/src/tac.rs @@ -10,13 +10,12 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::io::{stdin, stdout, BufReader, Read, Stdout, Write}; use std::{fs::File, path::Path}; use uucore::InvalidEncodingHandling; static NAME: &str = "tac"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static USAGE: &str = "[OPTION]... [FILE]..."; static SUMMARY: &str = "Write each file to standard output, last line first."; @@ -34,7 +33,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .name(NAME) - .version(VERSION) + .version(crate_version!()) .usage(USAGE) .about(SUMMARY) .arg( diff --git a/src/uu/tee/src/tee.rs b/src/uu/tee/src/tee.rs index 82a06daa2..f5f24d944 100644 --- a/src/uu/tee/src/tee.rs +++ b/src/uu/tee/src/tee.rs @@ -8,7 +8,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use retain_mut::RetainMut; use std::fs::OpenOptions; use std::io::{copy, sink, stdin, stdout, Error, ErrorKind, Read, Result, Write}; @@ -17,7 +17,6 @@ use std::path::{Path, PathBuf}; #[cfg(unix)] use uucore::libc; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Copy standard input to each FILE, and also to standard output."; mod options { @@ -41,7 +40,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .after_help("If a FILE is -, it refers to a file named - .") diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index dc8979143..4ef9b2331 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -12,7 +12,7 @@ extern crate uucore; extern crate clap; -use clap::{App, AppSettings, Arg}; +use clap::{crate_version, App, AppSettings, Arg}; use std::io::ErrorKind; use std::process::{Command, Stdio}; use std::time::Duration; @@ -20,7 +20,6 @@ use uucore::process::ChildExt; use uucore::signals::signal_by_name_or_value; use uucore::InvalidEncodingHandling; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Start COMMAND, and kill it if still running after DURATION."; fn get_usage() -> String { @@ -33,7 +32,6 @@ pub mod options { pub static FOREGROUND: &str = "foreground"; pub static KILL_AFTER: &str = "kill-after"; pub static SIGNAL: &str = "signal"; - pub static VERSION: &str = "version"; pub static PRESERVE_STATUS: &str = "preserve-status"; // Positional args. @@ -106,7 +104,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let app = App::new("timeout") - .version(VERSION) + .version(crate_version!()) .usage(&usage[..]) .about(ABOUT) .arg( diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index b76e04b7a..b2df29d33 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -13,14 +13,13 @@ pub extern crate filetime; #[macro_use] extern crate uucore; -use clap::{App, Arg, ArgGroup}; +use clap::{crate_version, App, Arg, ArgGroup}; use filetime::*; use std::fs::{self, File}; use std::io::Error; use std::path::Path; use std::process; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Update the access and modification times of each FILE to the current time."; pub mod options { // Both SOURCES and sources are needed as we need to be able to refer to the ArgGroup. @@ -57,7 +56,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index a44f2733c..3c362dcec 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -16,14 +16,13 @@ extern crate uucore; mod expand; use bit_set::BitSet; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use fnv::FnvHashMap; use std::io::{stdin, stdout, BufRead, BufWriter, Write}; use crate::expand::ExpandSet; use uucore::InvalidEncodingHandling; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "translate or delete characters"; const BUFFER_LEN: usize = 1024; @@ -251,7 +250,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let after_help = get_long_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .after_help(&after_help[..]) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 50ab5c45e..8e785ad21 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::fs::{metadata, OpenOptions}; use std::io::ErrorKind; use std::path::Path; @@ -52,7 +52,6 @@ impl TruncateMode { } static ABOUT: &str = "Shrink or extend the size of each file to the specified size."; -static VERSION: &str = env!("CARGO_PKG_VERSION"); pub mod options { pub static IO_BLOCKS: &str = "io-blocks"; @@ -94,7 +93,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let long_usage = get_long_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .after_help(&long_usage[..]) diff --git a/src/uu/tsort/src/tsort.rs b/src/uu/tsort/src/tsort.rs index c96939b20..8bd6dabef 100644 --- a/src/uu/tsort/src/tsort.rs +++ b/src/uu/tsort/src/tsort.rs @@ -9,14 +9,13 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::collections::{HashMap, HashSet}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; use std::path::Path; use uucore::InvalidEncodingHandling; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static SUMMARY: &str = "Topological sort the strings in FILE. Strings are defined as any sequence of tokens separated by whitespace (tab, space, or newline). If FILE is not passed in, stdin is used instead."; @@ -32,7 +31,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .accept_any(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .usage(USAGE) .about(SUMMARY) .arg( diff --git a/src/uu/tty/src/tty.rs b/src/uu/tty/src/tty.rs index ef2d848e9..074bcf182 100644 --- a/src/uu/tty/src/tty.rs +++ b/src/uu/tty/src/tty.rs @@ -12,12 +12,11 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::ffi::CStr; use uucore::fs::is_stdin_interactive; use uucore::InvalidEncodingHandling; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Print the file name of the terminal connected to standard input."; mod options { @@ -35,7 +34,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .accept_any(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/uname/src/uname.rs b/src/uu/uname/src/uname.rs index 4586a084f..aa591ee18 100644 --- a/src/uu/uname/src/uname.rs +++ b/src/uu/uname/src/uname.rs @@ -13,10 +13,9 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use platform_info::*; -const VERSION: &str = env!("CARGO_PKG_VERSION"); const ABOUT: &str = "Print certain system information. With no OPTION, same as -s."; pub mod options { @@ -49,7 +48,7 @@ const HOST_OS: &str = "Redox"; pub fn uumain(args: impl uucore::Args) -> i32 { let usage = format!("{} [OPTION]...", executable!()); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg(Arg::with_name(options::ALL) diff --git a/src/uu/unexpand/src/unexpand.rs b/src/uu/unexpand/src/unexpand.rs index 22b6b807a..92b3c7520 100644 --- a/src/uu/unexpand/src/unexpand.rs +++ b/src/uu/unexpand/src/unexpand.rs @@ -11,7 +11,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Stdout, Write}; use std::str::from_utf8; @@ -19,7 +19,6 @@ use unicode_width::UnicodeWidthChar; use uucore::InvalidEncodingHandling; static NAME: &str = "unexpand"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static USAGE: &str = "unexpand [OPTION]... [FILE]..."; static SUMMARY: &str = "Convert blanks in each FILE to tabs, writing to standard output.\n With no FILE, or when FILE is -, read standard input."; @@ -97,7 +96,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .name(NAME) - .version(VERSION) + .version(crate_version!()) .usage(USAGE) .about(SUMMARY) .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) diff --git a/src/uu/uniq/src/uniq.rs b/src/uu/uniq/src/uniq.rs index 7e9862e65..aee024dd4 100644 --- a/src/uu/uniq/src/uniq.rs +++ b/src/uu/uniq/src/uniq.rs @@ -8,7 +8,7 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg, ArgMatches}; +use clap::{crate_version, App, Arg, ArgMatches}; use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Result, Write}; use std::path::Path; @@ -16,7 +16,6 @@ use std::str::FromStr; use strum_macros::{AsRefStr, EnumString}; static ABOUT: &str = "Report or omit repeated lines."; -static VERSION: &str = env!("CARGO_PKG_VERSION"); pub mod options { pub static ALL_REPEATED: &str = "all-repeated"; pub static CHECK_CHARS: &str = "check-chars"; @@ -240,7 +239,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let long_usage = get_long_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .after_help(&long_usage[..]) diff --git a/src/uu/unlink/src/unlink.rs b/src/uu/unlink/src/unlink.rs index 9d9d6385b..343f2653f 100644 --- a/src/uu/unlink/src/unlink.rs +++ b/src/uu/unlink/src/unlink.rs @@ -12,14 +12,13 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use libc::{lstat, stat, unlink}; use libc::{S_IFLNK, S_IFMT, S_IFREG}; use std::ffi::CString; use std::io::{Error, ErrorKind}; use uucore::InvalidEncodingHandling; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Unlink the file at [FILE]."; static OPT_PATH: &str = "FILE"; @@ -35,7 +34,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg(Arg::with_name(OPT_PATH).hidden(true).multiple(true)) diff --git a/src/uu/uptime/src/uptime.rs b/src/uu/uptime/src/uptime.rs index 418b8317f..3683a4de0 100644 --- a/src/uu/uptime/src/uptime.rs +++ b/src/uu/uptime/src/uptime.rs @@ -9,7 +9,7 @@ // spell-checker:ignore (ToDO) getloadavg upsecs updays nusers loadavg boottime uphours upmins use chrono::{Local, TimeZone, Utc}; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; #[macro_use] extern crate uucore; @@ -17,7 +17,6 @@ extern crate uucore; pub use uucore::libc; use uucore::libc::time_t; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Display the current time, the length of time the system has been up,\n\ the number of users on the system, and the average number of jobs\n\ in the run queue over the last 1, 5 and 15 minutes."; @@ -40,7 +39,7 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/users/src/users.rs b/src/uu/users/src/users.rs index 664ff55f3..5b1f1c037 100644 --- a/src/uu/users/src/users.rs +++ b/src/uu/users/src/users.rs @@ -11,10 +11,9 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use uucore::utmpx::{self, Utmpx}; -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Print the user names of users currently logged in to the current host"; static ARG_FILES: &str = "files"; @@ -36,7 +35,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let after_help = get_long_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .after_help(&after_help[..]) diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index d990c6679..031c25739 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -15,7 +15,7 @@ use count_bytes::count_bytes_fast; use countable::WordCountable; use word_count::{TitledWordCount, WordCount}; -use clap::{App, Arg, ArgMatches}; +use clap::{crate_version, App, Arg, ArgMatches}; use thiserror::Error; use std::fs::{self, File}; @@ -84,7 +84,6 @@ impl Settings { static ABOUT: &str = "Display newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified."; -static VERSION: &str = env!("CARGO_PKG_VERSION"); pub mod options { pub static BYTES: &str = "bytes"; @@ -136,7 +135,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .arg( diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index 2cddbf2d0..d2f64aa94 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -12,7 +12,7 @@ extern crate uucore; use uucore::libc::{ttyname, STDIN_FILENO, S_IWGRP}; use uucore::utmpx::{self, time, Utmpx}; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::borrow::Cow; use std::ffi::CStr; use std::os::unix::fs::MetadataExt; @@ -37,7 +37,6 @@ mod options { pub const FILE: &str = "FILE"; // if length=1: FILE, if length=2: ARG1 ARG2 } -static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Print information about users who are currently logged in."; #[cfg(any(target_os = "linux"))] @@ -66,7 +65,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let after_help = get_long_usage(); let matches = App::new(executable!()) - .version(VERSION) + .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) .after_help(&after_help[..]) From e5c4681e04feb8c762fc224bdf4925548de5cbba Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 2 Jun 2021 18:06:56 +0200 Subject: [PATCH 0838/1135] tests: add the ability to set resource limits --- .../workspace.wordlist.txt | 1 + Cargo.lock | 11 +++++++ Cargo.toml | 1 + tests/common/util.rs | 31 +++++++++++++++++++ 4 files changed, 44 insertions(+) diff --git a/.vscode/cspell.dictionaries/workspace.wordlist.txt b/.vscode/cspell.dictionaries/workspace.wordlist.txt index b567a6c21..e2a864f9c 100644 --- a/.vscode/cspell.dictionaries/workspace.wordlist.txt +++ b/.vscode/cspell.dictionaries/workspace.wordlist.txt @@ -30,6 +30,7 @@ peekreader quickcheck rand_chacha ringbuffer +rlimit smallvec tempdir tempfile diff --git a/Cargo.lock b/Cargo.lock index 17fa9e2b7..0455d7118 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -233,6 +233,7 @@ dependencies = [ "pretty_assertions", "rand 0.7.3", "regex", + "rlimit", "sha1", "tempfile", "textwrap", @@ -1410,6 +1411,16 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9c17925a9027d298a4603d286befe3f9dc0e8ed02523141914eb628798d6e5b" +[[package]] +name = "rlimit" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49b02d62c38353a6fce45c25ca19783e25dd5f495ca681c674a4ee15aa4c1536" +dependencies = [ + "cfg-if 0.1.10", + "libc", +] + [[package]] name = "rust-ini" version = "0.13.0" diff --git a/Cargo.toml b/Cargo.toml index 9a6e8bd46..5f89a4077 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -354,6 +354,7 @@ walkdir = "2.2" atty = "0.2.14" [target.'cfg(unix)'.dev-dependencies] +rlimit = "0.4.0" rust-users = { version="0.10", package="users" } unix_socket = "0.5.0" diff --git a/tests/common/util.rs b/tests/common/util.rs index d466ba1e9..2f7d7dcc4 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -1,5 +1,10 @@ +//spell-checker: ignore (linux) rlimit prlimit Rlim + #![allow(dead_code)] + use pretty_assertions::assert_eq; +#[cfg(target_os = "linux")] +use rlimit::{prlimit, rlim}; use std::env; #[cfg(not(windows))] use std::ffi::CString; @@ -724,6 +729,8 @@ pub struct UCommand { stdout: Option, stderr: Option, bytes_into_stdin: Option>, + #[cfg(target_os = "linux")] + limits: Vec<(rlimit::Resource, rlim, rlim)>, } impl UCommand { @@ -758,6 +765,8 @@ impl UCommand { stdin: None, stdout: None, stderr: None, + #[cfg(target_os = "linux")] + limits: vec![], } } @@ -855,6 +864,17 @@ impl UCommand { self } + #[cfg(target_os = "linux")] + pub fn with_limit( + &mut self, + resource: rlimit::Resource, + soft_limit: rlim, + hard_limit: rlim, + ) -> &mut Self { + self.limits.push((resource, soft_limit, hard_limit)); + self + } + /// Spawns the command, feeds the stdin if any, and returns the /// child process immediately. pub fn run_no_wait(&mut self) -> Child { @@ -871,6 +891,17 @@ impl UCommand { .spawn() .unwrap(); + #[cfg(target_os = "linux")] + for &(resource, soft_limit, hard_limit) in &self.limits { + prlimit( + child.id() as i32, + resource, + Some((soft_limit, hard_limit)), + None, + ) + .unwrap(); + } + if let Some(ref input) = self.bytes_into_stdin { let write_result = child .stdin From 7ffc7d073cc5b14fbafbf4f03af48d4550e7539a Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 2 Jun 2021 18:08:09 +0200 Subject: [PATCH 0839/1135] cp: test that file descriptors are closed --- tests/by-util/test_cp.rs | 16 +++++++++++++++- tests/fixtures/cp/dir_with_10_files/0 | 0 tests/fixtures/cp/dir_with_10_files/1 | 0 tests/fixtures/cp/dir_with_10_files/2 | 0 tests/fixtures/cp/dir_with_10_files/3 | 0 tests/fixtures/cp/dir_with_10_files/4 | 0 tests/fixtures/cp/dir_with_10_files/5 | 0 tests/fixtures/cp/dir_with_10_files/6 | 0 tests/fixtures/cp/dir_with_10_files/7 | 0 tests/fixtures/cp/dir_with_10_files/8 | 0 tests/fixtures/cp/dir_with_10_files/9 | 0 11 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tests/fixtures/cp/dir_with_10_files/0 create mode 100644 tests/fixtures/cp/dir_with_10_files/1 create mode 100644 tests/fixtures/cp/dir_with_10_files/2 create mode 100644 tests/fixtures/cp/dir_with_10_files/3 create mode 100644 tests/fixtures/cp/dir_with_10_files/4 create mode 100644 tests/fixtures/cp/dir_with_10_files/5 create mode 100644 tests/fixtures/cp/dir_with_10_files/6 create mode 100644 tests/fixtures/cp/dir_with_10_files/7 create mode 100644 tests/fixtures/cp/dir_with_10_files/8 create mode 100644 tests/fixtures/cp/dir_with_10_files/9 diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index c56e1ca57..ff607f984 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1,4 +1,4 @@ -// spell-checker:ignore (flags) reflink (fs) tmpfs +// spell-checker:ignore (flags) reflink (fs) tmpfs (linux) rlimit Rlim NOFILE use crate::common::util::*; #[cfg(not(windows))] @@ -14,6 +14,8 @@ use std::os::windows::fs::symlink_file; #[cfg(target_os = "linux")] use filetime::FileTime; +#[cfg(target_os = "linux")] +use rlimit::Resource; #[cfg(not(windows))] use std::env; #[cfg(target_os = "linux")] @@ -1276,3 +1278,15 @@ fn test_cp_reflink_insufficient_permission() { .fails() .stderr_only("cp: 'unreadable' -> 'existing_file.txt': Permission denied (os error 13)"); } + +#[cfg(target_os = "linux")] +#[test] +fn test_closes_file_descriptors() { + new_ucmd!() + .arg("-r") + .arg("--reflink=auto") + .arg("dir_with_10_files/") + .arg("dir_with_10_files_new/") + .with_limit(Resource::NOFILE, 9, 9) + .succeeds(); +} diff --git a/tests/fixtures/cp/dir_with_10_files/0 b/tests/fixtures/cp/dir_with_10_files/0 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/fixtures/cp/dir_with_10_files/1 b/tests/fixtures/cp/dir_with_10_files/1 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/fixtures/cp/dir_with_10_files/2 b/tests/fixtures/cp/dir_with_10_files/2 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/fixtures/cp/dir_with_10_files/3 b/tests/fixtures/cp/dir_with_10_files/3 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/fixtures/cp/dir_with_10_files/4 b/tests/fixtures/cp/dir_with_10_files/4 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/fixtures/cp/dir_with_10_files/5 b/tests/fixtures/cp/dir_with_10_files/5 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/fixtures/cp/dir_with_10_files/6 b/tests/fixtures/cp/dir_with_10_files/6 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/fixtures/cp/dir_with_10_files/7 b/tests/fixtures/cp/dir_with_10_files/7 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/fixtures/cp/dir_with_10_files/8 b/tests/fixtures/cp/dir_with_10_files/8 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/fixtures/cp/dir_with_10_files/9 b/tests/fixtures/cp/dir_with_10_files/9 new file mode 100644 index 000000000..e69de29bb From efa89de4636220d94ba9d077a4f2f0d2f2e64029 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 2 Jun 2021 19:58:29 +0200 Subject: [PATCH 0840/1135] ln: fix LINK_NAME in help output --- src/uu/ln/src/ln.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index 2a14f3c9c..950270872 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -54,7 +54,7 @@ pub enum BackupMode { fn get_usage() -> String { format!( - "{0} [OPTION]... [-T] TARGET LINK_executable!() (1st form) + "{0} [OPTION]... [-T] TARGET LINK_NAME (1st form) {0} [OPTION]... TARGET (2nd form) {0} [OPTION]... TARGET... DIRECTORY (3rd form) {0} [OPTION]... -t DIRECTORY TARGET... (4th form)", @@ -64,7 +64,7 @@ fn get_usage() -> String { fn get_long_usage() -> String { String::from( - " In the 1st form, create a link to TARGET with the name LINK_executable!(). + " In the 1st form, create a link to TARGET with the name LINK_NAME. In the 2nd form, create a link to TARGET in the current directory. In the 3rd and 4th forms, create links to each TARGET in DIRECTORY. Create hard links by default, symbolic links with --symbolic. @@ -144,7 +144,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .short("n") .long(OPT_NO_DEREFERENCE) .help( - "treat LINK_executable!() as a normal file if it is a \ + "treat LINK_NAME as a normal file if it is a \ symbolic link to a directory", ), ) @@ -179,7 +179,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(OPT_NO_TARGET_DIRECTORY) .short("T") .long(OPT_NO_TARGET_DIRECTORY) - .help("treat LINK_executable!() as a normal file always"), + .help("treat LINK_NAME as a normal file always"), ) .arg( Arg::with_name(OPT_RELATIVE) From 87570bbc1041b211b30b1f72fe661d4b497b8da2 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 2 Jun 2021 20:56:37 +0200 Subject: [PATCH 0841/1135] ln: remove redundant `force` flag This information is already encoded in the `OverwriteMode` enum. --- src/uu/ln/src/ln.rs | 82 ++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index 950270872..0c60405f6 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -27,7 +27,6 @@ use uucore::fs::{canonicalize, CanonicalizeMode}; pub struct Settings { overwrite: OverwriteMode, backup: BackupMode, - force: bool, suffix: String, symbolic: bool, relative: bool, @@ -244,7 +243,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let settings = Settings { overwrite: overwrite_mode, backup: backup_mode, - force: matches.is_present(OPT_FORCE), suffix: backup_suffix.to_string(), symbolic: matches.is_present(OPT_SYMBOLIC), relative: matches.is_present(OPT_RELATIVE), @@ -311,47 +309,48 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings) let mut all_successful = true; for srcpath in files.iter() { - let targetpath = if settings.no_dereference && settings.force { - // In that case, we don't want to do link resolution - // We need to clean the target - if is_symlink(target_dir) { - if target_dir.is_file() { - if let Err(e) = fs::remove_file(target_dir) { - show_error!("Could not update {}: {}", target_dir.display(), e) - }; - } - if target_dir.is_dir() { - // Not sure why but on Windows, the symlink can be - // considered as a dir - // See test_ln::test_symlink_no_deref_dir - if let Err(e) = fs::remove_dir(target_dir) { - show_error!("Could not update {}: {}", target_dir.display(), e) - }; - } - } - target_dir.to_path_buf() - } else { - match srcpath.as_os_str().to_str() { - Some(name) => { - match Path::new(name).file_name() { - Some(basename) => target_dir.join(basename), - // This can be None only for "." or "..". Trying - // to create a link with such name will fail with - // EEXIST, which agrees with the behavior of GNU - // coreutils. - None => target_dir.join(name), + let targetpath = + if settings.no_dereference && matches!(settings.overwrite, OverwriteMode::Force) { + // In that case, we don't want to do link resolution + // We need to clean the target + if is_symlink(target_dir) { + if target_dir.is_file() { + if let Err(e) = fs::remove_file(target_dir) { + show_error!("Could not update {}: {}", target_dir.display(), e) + }; + } + if target_dir.is_dir() { + // Not sure why but on Windows, the symlink can be + // considered as a dir + // See test_ln::test_symlink_no_deref_dir + if let Err(e) = fs::remove_dir(target_dir) { + show_error!("Could not update {}: {}", target_dir.display(), e) + }; } } - None => { - show_error!( - "cannot stat '{}': No such file or directory", - srcpath.display() - ); - all_successful = false; - continue; + target_dir.to_path_buf() + } else { + match srcpath.as_os_str().to_str() { + Some(name) => { + match Path::new(name).file_name() { + Some(basename) => target_dir.join(basename), + // This can be None only for "." or "..". Trying + // to create a link with such name will fail with + // EEXIST, which agrees with the behavior of GNU + // coreutils. + None => target_dir.join(name), + } + } + None => { + show_error!( + "cannot stat '{}': No such file or directory", + srcpath.display() + ); + all_successful = false; + continue; + } } - } - }; + }; if let Err(e) = link(srcpath, &targetpath, settings) { show_error!( @@ -422,7 +421,8 @@ fn link(src: &Path, dst: &Path, settings: &Settings) -> Result<()> { } } - if settings.no_dereference && settings.force && dst.exists() { + if settings.no_dereference && matches!(settings.overwrite, OverwriteMode::Force) && dst.exists() + { fs::remove_file(dst)?; } From ed69d797b526bf4a01f676d591a688664cb1b281 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 2 Jun 2021 21:02:12 +0200 Subject: [PATCH 0842/1135] ln: reject --relative without --symbolic --- src/uu/ln/src/ln.rs | 3 ++- tests/by-util/test_ln.rs | 19 +++++-------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index 0c60405f6..4bd3310cc 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -184,7 +184,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(OPT_RELATIVE) .short("r") .long(OPT_RELATIVE) - .help("create symbolic links relative to link location"), + .help("create symbolic links relative to link location") + .requires(OPT_SYMBOLIC), ) .arg( Arg::with_name(OPT_VERBOSE) diff --git a/tests/by-util/test_ln.rs b/tests/by-util/test_ln.rs index e475e3608..00ea85ecd 100644 --- a/tests/by-util/test_ln.rs +++ b/tests/by-util/test_ln.rs @@ -428,20 +428,6 @@ fn test_symlink_relative() { assert_eq!(at.resolve_link(link), file_a); } -#[test] -fn test_hardlink_relative() { - let (at, mut ucmd) = at_and_ucmd!(); - let file_a = "test_hardlink_relative_a"; - let link = "test_hardlink_relative_link"; - - at.touch(file_a); - - // relative hardlink - ucmd.args(&["-r", "-v", file_a, link]) - .succeeds() - .stdout_only(format!("'{}' -> '{}'\n", link, file_a)); -} - #[test] fn test_symlink_relative_path() { let (at, mut ucmd) = at_and_ucmd!(); @@ -571,3 +557,8 @@ fn test_symlink_no_deref_file() { assert!(at.is_symlink(link)); assert_eq!(at.resolve_link(link), file1); } + +#[test] +fn test_relative_requires_symbolic() { + new_ucmd!().args(&["-r", "foo", "bar"]).fails(); +} From 2f5f7c6fa1f79a3917300e62555e812be3faa87b Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 2 Jun 2021 18:37:21 +0200 Subject: [PATCH 0843/1135] split: use "parse_size" from uucore * make stderr of parsing SIZE/NUMBER argument consistent with GNU's behavior * add error handling * add tests --- src/uu/split/src/split.rs | 56 +++++++++---------------- src/uucore/src/lib/parser/parse_size.rs | 4 +- tests/by-util/test_split.rs | 46 ++++++++++++++++++++ 3 files changed, 69 insertions(+), 37 deletions(-) diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index 85ed5f183..1fe35795e 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -13,11 +13,13 @@ extern crate uucore; mod platform; use clap::{App, Arg}; +use std::convert::TryFrom; use std::env; use std::fs::File; use std::io::{stdin, BufRead, BufReader, BufWriter, Read, Write}; use std::path::Path; use std::{char, fs::remove_file}; +use uucore::parse_size::{parse_size, ParseSizeError}; static NAME: &str = "split"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -232,10 +234,9 @@ struct LineSplitter { impl LineSplitter { fn new(settings: &Settings) -> LineSplitter { LineSplitter { - lines_per_split: settings - .strategy_param - .parse() - .unwrap_or_else(|e| crash!(1, "invalid number of lines: {}", e)), + lines_per_split: settings.strategy_param.parse().unwrap_or_else(|_| { + crash!(1, "invalid number of lines: ‘{}’", settings.strategy_param) + }), } } } @@ -277,40 +278,23 @@ struct ByteSplitter { impl ByteSplitter { fn new(settings: &Settings) -> ByteSplitter { - // These multipliers are the same as supported by GNU coreutils. - let modifiers: Vec<(&str, u128)> = vec![ - ("K", 1024u128), - ("M", 1024 * 1024), - ("G", 1024 * 1024 * 1024), - ("T", 1024 * 1024 * 1024 * 1024), - ("P", 1024 * 1024 * 1024 * 1024 * 1024), - ("E", 1024 * 1024 * 1024 * 1024 * 1024 * 1024), - ("Z", 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024), - ("Y", 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024), - ("KB", 1000), - ("MB", 1000 * 1000), - ("GB", 1000 * 1000 * 1000), - ("TB", 1000 * 1000 * 1000 * 1000), - ("PB", 1000 * 1000 * 1000 * 1000 * 1000), - ("EB", 1000 * 1000 * 1000 * 1000 * 1000 * 1000), - ("ZB", 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000), - ("YB", 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000), - ]; - - // This sequential find is acceptable since none of the modifiers are - // suffixes of any other modifiers, a la Huffman codes. - let (suffix, multiplier) = modifiers - .iter() - .find(|(suffix, _)| settings.strategy_param.ends_with(suffix)) - .unwrap_or(&("", 1)); - - // Try to parse the actual numeral. - let n = &settings.strategy_param[0..(settings.strategy_param.len() - suffix.len())] - .parse::() - .unwrap_or_else(|e| crash!(1, "invalid number of bytes: {}", e)); + let size_string = &settings.strategy_param; + let size_num = match parse_size(&size_string) { + Ok(n) => n, + Err(e) => match e { + ParseSizeError::ParseFailure(_) => { + crash!(1, "invalid number of bytes: {}", e.to_string()) + } + ParseSizeError::SizeTooBig(_) => crash!( + 1, + "invalid number of bytes: ‘{}’: Value too large for defined data type", + size_string + ), + }, + }; ByteSplitter { - bytes_per_split: n * multiplier, + bytes_per_split: u128::try_from(size_num).unwrap(), } } } diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index 8b3e0bf03..4a31d753a 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -117,7 +117,9 @@ impl ParseSizeError { fn size_too_big(s: &str) -> ParseSizeError { // has to be handled in the respective uutils because strings differ, e.g. // truncate: Invalid number: ‘1Y’: Value too large to be stored in data type - // tail: invalid number of bytes: ‘1Y’: Value too large to be stored in data type + // tail: invalid number of bytes: ‘1Y’: Value too large to be stored in data type + // split: invalid number of bytes: ‘1Y’: Value too large for defined data type + // etc. ParseSizeError::SizeTooBig(format!( "‘{}’: Value too large to be stored in data type", s diff --git a/tests/by-util/test_split.rs b/tests/by-util/test_split.rs index 85b28326b..1727072ca 100644 --- a/tests/by-util/test_split.rs +++ b/tests/by-util/test_split.rs @@ -285,3 +285,49 @@ fn test_filter_command_fails() { ucmd.args(&["--filter=/a/path/that/totally/does/not/exist", name]) .fails(); } + +#[test] +fn test_split_lines_number() { + // Test if stdout/stderr for '--lines' option is correct + new_ucmd!() + .args(&["--lines", "2"]) + .pipe_in("abcde") + .succeeds() + .no_stderr() + .no_stdout(); + new_ucmd!() + .args(&["--lines", "2fb"]) + .pipe_in("abcde") + .fails() + .code_is(1) + .stderr_only("split: invalid number of lines: ‘2fb’"); +} + +#[test] +fn test_split_invalid_bytes_size() { + new_ucmd!() + .args(&["-b", "1024R"]) + .fails() + .code_is(1) + .stderr_only("split: invalid number of bytes: ‘1024R’"); + #[cfg(not(target_pointer_width = "128"))] + new_ucmd!() + .args(&["-b", "1Y"]) + .fails() + .code_is(1) + .stderr_only("split: invalid number of bytes: ‘1Y’: Value too large for defined data type"); + #[cfg(target_pointer_width = "32")] + { + let sizes = ["1000G", "10T"]; + for size in &sizes { + new_ucmd!() + .args(&["-b", size]) + .fails() + .code_is(1) + .stderr_only(format!( + "split: invalid number of bytes: ‘{}’: Value too large for defined data type", + size + )); + } + } +} From 5898b99627ebb5fac6e14d381abc907879d33ee2 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 2 Jun 2021 22:08:42 +0200 Subject: [PATCH 0844/1135] truncate: add error handling for SIZE argument * add tests for SIZE argument * fix clap argument handling for --size and --reference --- src/uu/truncate/src/truncate.rs | 22 +++++++-------- tests/by-util/test_truncate.rs | 48 ++++++++++++++++++++++++++++++--- 2 files changed, 55 insertions(+), 15 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 79aa4f3f1..57cc280c3 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -61,10 +61,9 @@ pub mod options { pub static NO_CREATE: &str = "no-create"; pub static REFERENCE: &str = "reference"; pub static SIZE: &str = "size"; + pub static ARG_FILES: &str = "files"; } -static ARG_FILES: &str = "files"; - fn get_usage() -> String { format!("{0} [OPTION]... [FILE]...", executable!()) } @@ -116,21 +115,23 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(options::REFERENCE) .short("r") .long(options::REFERENCE) + .required_unless(options::SIZE) .help("base the size of each file on the size of RFILE") .value_name("RFILE") ) .arg( Arg::with_name(options::SIZE) .short("s") - .long("size") + .long(options::SIZE) + .required_unless(options::REFERENCE) .help("set or adjust the size of each file according to SIZE, which is in bytes unless --io-blocks is specified") .value_name("SIZE") ) - .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true).min_values(1)) + .arg(Arg::with_name(options::ARG_FILES).value_name("FILE").multiple(true).takes_value(true).required(true).min_values(1)) .get_matches_from(args); let files: Vec = matches - .values_of(ARG_FILES) + .values_of(options::ARG_FILES) .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); @@ -152,8 +153,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { crash!( 1, "cannot stat '{}': No such file or directory", - reference.unwrap() - ); + reference.unwrap_or("".to_string()) + ); // TODO: fix '--no-create' see test_reference and test_truncate_bytes_size } _ => crash!(1, "{}", e.to_string()), } @@ -209,8 +210,7 @@ fn truncate_reference_and_size( } _ => m, }, - // TODO: handle errors ParseFailure(String)/SizeTooBig(String) - Err(_) => crash!(1, "Invalid number: ‘{}’", size_string), + Err(e) => crash!(1, "Invalid number: {}", e.to_string()), }; let fsize = usize::try_from(metadata(rfilename)?.len()).unwrap(); let tsize = mode.to_size(fsize); @@ -265,7 +265,7 @@ fn truncate_size_only( ) -> std::io::Result<()> { let mode = match parse_mode_and_size(size_string) { Ok(m) => m, - Err(_) => crash!(1, "Invalid number: ‘{}’", size_string), + Err(e) => crash!(1, "Invalid number: {}", e.to_string()), }; for filename in &filenames { let fsize = usize::try_from(metadata(filename)?.len()).unwrap(); @@ -294,7 +294,7 @@ fn truncate( } (Some(rfilename), None) => truncate_reference_file_only(&rfilename, filenames, create), (None, Some(size_string)) => truncate_size_only(&size_string, filenames, create), - (None, None) => crash!(1, "you must specify either --reference or --size"), + (None, None) => crash!(1, "you must specify either --reference or --size"), // this case cannot happen anymore because it's handled by clap } } diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index 5c3f169a1..72f7f780b 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -48,7 +48,7 @@ fn test_reference() { // manpage: "A FILE argument that does not exist is created." // TODO: 'truncate' does not create the file in this case, // but should because '--no-create' wasn't specified. - at.touch(FILE1); // TODO: remove this when fixed + at.touch(FILE1); // TODO: remove this when 'no-create' is fixed scene.ucmd().arg("-s").arg("+5KB").arg(FILE1).succeeds(); scene @@ -240,11 +240,18 @@ fn test_size_and_reference() { ); } +#[test] +fn test_error_filename_only() { + // truncate: you must specify either ‘--size’ or ‘--reference’ + new_ucmd!().args(&["file"]).fails().stderr_contains( + "error: The following required arguments were not provided: + --reference + --size ", + ); +} + #[test] fn test_invalid_numbers() { - // TODO For compatibility with GNU, `truncate -s 0X` should cause - // the same error as `truncate -s 0X file`, but currently it returns - // a different error. new_ucmd!() .args(&["-s", "0X", "file"]) .fails() @@ -274,3 +281,36 @@ fn test_reference_with_size_file_not_found() { .fails() .stderr_contains("cannot stat 'a': No such file or directory"); } + +#[test] +fn test_truncate_bytes_size() { + // TODO: this should succeed without error, uncomment when '--no-create' is fixed + // new_ucmd!() + // .args(&["--no-create", "--size", "K", "file"]) + // .succeeds(); + new_ucmd!() + .args(&["--size", "1024R", "file"]) + .fails() + .code_is(1) + .stderr_only("truncate: Invalid number: ‘1024R’"); + #[cfg(not(target_pointer_width = "128"))] + new_ucmd!() + .args(&["--size", "1Y", "file"]) + .fails() + .code_is(1) + .stderr_only("truncate: Invalid number: ‘1Y’: Value too large for defined data type"); + #[cfg(target_pointer_width = "32")] + { + let sizes = ["1000G", "10T"]; + for size in &sizes { + new_ucmd!() + .args(&["--size", size, "file"]) + .fails() + .code_is(1) + .stderr_only(format!( + "truncate: Invalid number: ‘{}’: Value too large for defined data type", + size + )); + } + } +} From 0105531b7f368ffa25464b17aaaba33ca3fa1608 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 2 Jun 2021 20:59:53 +0200 Subject: [PATCH 0845/1135] show the backtrace in case of a rust crash --- util/run-gnu-test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/util/run-gnu-test.sh b/util/run-gnu-test.sh index 61034e015..044c6c140 100644 --- a/util/run-gnu-test.sh +++ b/util/run-gnu-test.sh @@ -5,4 +5,5 @@ BUILDDIR="${PWD}/uutils/target/release" GNULIB_DIR="${PWD}/gnulib" pushd gnu +export RUST_BACKTRACE=1 timeout -sKILL 2h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make From e7f59168646b1f2ccd533ce3991694a53970906c Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 2 Jun 2021 21:21:12 +0200 Subject: [PATCH 0846/1135] gnu/ci: allow to run a single gnu test (and document it) --- CONTRIBUTING.md | 1 + README.md | 4 ++++ util/run-gnu-test.sh | 8 +++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3793a0968..47793977e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,6 +18,7 @@ search the issues to make sure no one else is working on it. ## Best practices 1. Follow what GNU is doing in term of options and behavior. +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. The code must be clippy-warning-free and rustfmt-compliant. diff --git a/README.md b/README.md index 8ab4c6128..fde01d64a 100644 --- a/README.md +++ b/README.md @@ -327,8 +327,12 @@ To run locally: ```bash $ bash util/build-gnu.sh $ bash util/run-gnu-test.sh +# To run a single test: +$ bash util/run-gnu-test.sh tests/touch/not-owner.sh # for example ``` +Note that it relies on individual utilities (not the multicall binary). + ## Contribute To contribute to uutils, please see [CONTRIBUTING](CONTRIBUTING.md). diff --git a/util/run-gnu-test.sh b/util/run-gnu-test.sh index 044c6c140..9d51a983e 100644 --- a/util/run-gnu-test.sh +++ b/util/run-gnu-test.sh @@ -6,4 +6,10 @@ GNULIB_DIR="${PWD}/gnulib" pushd gnu export RUST_BACKTRACE=1 -timeout -sKILL 2h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make + +if test -n "$1"; then + # if set, run only the test passed + export RUN_TEST="TESTS=$1" +fi + +timeout -sKILL 2h make -j "$(nproc)" check $RUN_TEST SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make From eb2c06c37e29ebdc97a58eeb4002bccae7a46709 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 2 Jun 2021 22:53:10 +0200 Subject: [PATCH 0847/1135] touch/gnu compat: when touch fails because of a permission error, change the error message + return 1 as error code when having this error --- src/uu/touch/src/touch.rs | 24 ++++++++++++++++++++---- tests/by-util/test_touch.rs | 10 ++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index b76e04b7a..ed65cb659 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -155,6 +155,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { (now, now) }; + let mut error_code = 0; + for filename in &files { let path = &filename[..]; @@ -202,14 +204,28 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if matches.is_present(options::NO_DEREF) { if let Err(e) = set_symlink_file_times(path, atime, mtime) { - show_warning!("cannot touch '{}': {}", path, e); + // we found an error, it should fail in any case + error_code = 1; + if e.kind() == std::io::ErrorKind::PermissionDenied { + // GNU compatibility (not-owner.sh) + show_error!("setting times of '{}': {}", path, "Permission denied"); + } else { + show_error!("setting times of '{}': {}", path, e); + } } } else if let Err(e) = filetime::set_file_times(path, atime, mtime) { - show_warning!("cannot touch '{}': {}", path, e); + // we found an error, it should fail in any case + error_code = 1; + + if e.kind() == std::io::ErrorKind::PermissionDenied { + // GNU compatibility (not-owner.sh) + show_error!("setting times of '{}': {}", path, "Permission denied"); + } else { + show_error!("setting times of '{}': {}", path, e); + } } } - - 0 + error_code } fn stat(path: &str, follow: bool) -> (FileTime, FileTime) { diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index 3c803e1c6..cd780f670 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -449,3 +449,13 @@ fn test_touch_mtime_dst_fails() { ucmd.args(&["-m", "-t", &s, file]).fails(); } } + +#[test] +#[cfg(unix)] +fn test_touch_system_fails() { + let (_at, mut ucmd) = at_and_ucmd!(); + let file = "/"; + ucmd.args(&[file]) + .fails() + .stderr_contains("setting times of '/'"); +} From 31875a241fc1b1c3582b8e876cf3c44d1145d468 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 2 Jun 2021 23:43:16 +0200 Subject: [PATCH 0848/1135] touch/gnu compat: 'touch no-file' exit code should be 1 --- src/uu/touch/src/touch.rs | 1 + tests/by-util/test_touch.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index ed65cb659..1b560553f 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -168,6 +168,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if let Err(e) = File::create(path) { show_warning!("cannot touch '{}': {}", path, e); + error_code = 1; continue; }; diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index cd780f670..c861a50dd 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -459,3 +459,10 @@ fn test_touch_system_fails() { .fails() .stderr_contains("setting times of '/'"); } + +#[test] +fn test_touch_trailing_slash() { + let (_at, mut ucmd) = at_and_ucmd!(); + let file = "no-file/"; + ucmd.args(&[file]).fails(); +} From 05aeaf3061e78e669686ca04e576314d7b153cd4 Mon Sep 17 00:00:00 2001 From: Syukron Rifail M Date: Wed, 26 May 2021 12:27:15 +0700 Subject: [PATCH 0849/1135] du: fix --time behavior --- src/uu/du/src/du.rs | 56 +++++++++++++++++++++++++++------------- tests/by-util/test_du.rs | 29 +++++++++++++++++---- 2 files changed, 62 insertions(+), 23 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 0bc8b30c8..ee50c213e 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -14,6 +14,8 @@ use clap::{App, Arg}; use std::collections::HashSet; use std::env; use std::fs; +#[cfg(not(windows))] +use std::fs::Metadata; use std::io::{stderr, ErrorKind, Result, Write}; use std::iter; #[cfg(not(windows))] @@ -92,7 +94,7 @@ struct Stat { size: u64, blocks: u64, inode: Option, - created: u64, + created: Option, accessed: u64, modified: u64, } @@ -113,7 +115,7 @@ impl Stat { size: metadata.len(), blocks: metadata.blocks() as u64, inode: Some(file_info), - created: metadata.mtime() as u64, + created: birth_u64(&metadata), accessed: metadata.atime() as u64, modified: metadata.mtime() as u64, }); @@ -129,7 +131,7 @@ impl Stat { size: metadata.len(), blocks: size_on_disk / 1024 * 2, inode: file_info, - created: windows_time_to_unix_time(metadata.creation_time()), + created: windows_creation_time_to_unix_time(metadata.creation_time()), accessed: windows_time_to_unix_time(metadata.last_access_time()), modified: windows_time_to_unix_time(metadata.last_write_time()), }) @@ -137,10 +139,24 @@ impl Stat { } #[cfg(windows)] -// https://doc.rust-lang.org/std/os/windows/fs/trait.MetadataExt.html#tymethod.creation_time +// https://doc.rust-lang.org/std/os/windows/fs/trait.MetadataExt.html#tymethod.last_access_time // "The returned 64-bit value [...] which represents the number of 100-nanosecond intervals since January 1, 1601 (UTC)." +// "If the underlying filesystem does not support last access time, the returned value is 0." fn windows_time_to_unix_time(win_time: u64) -> u64 { - win_time / 10_000_000 - 11_644_473_600 + (win_time / 10_000_000).saturating_sub(11_644_473_600) +} + +#[cfg(windows)] +fn windows_creation_time_to_unix_time(win_time: u64) -> Option { + (win_time / 10_000_000).checked_sub(11_644_473_600) +} + +#[cfg(not(windows))] +fn birth_u64(meta: &Metadata) -> Option { + meta.created() + .ok() + .and_then(|t| t.duration_since(UNIX_EPOCH).ok()) + .map(|e| e.as_secs() as u64) } #[cfg(windows)] @@ -539,10 +555,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .value_name("WORD") .require_equals(true) .min_values(0) + .possible_values(&["atime", "access", "use", "ctime", "status", "birth", "creation"]) .help( "show time of the last modification of any file in the \ directory, or any of its subdirectories. If WORD is given, show time as WORD instead \ - of modification time: atime, access, use, ctime or status" + of modification time: atime, access, use, ctime, status, birth or creation" ) ) .arg( @@ -667,19 +684,22 @@ Try '{} --help' for more information.", let secs = { match matches.value_of(options::TIME) { Some(s) => match s { - "accessed" => stat.accessed, - "created" => stat.created, - "modified" => stat.modified, - _ => { - show_error!( - "invalid argument 'modified' for '--time' - Valid arguments are: - - 'accessed', 'created', 'modified' - Try '{} --help' for more information.", - NAME - ); - return 1; + "ctime" | "status" => stat.modified, + "access" | "atime" | "use" => stat.accessed, + "birth" | "creation" => { + if let Some(time) = stat.created { + time + } else { + show_error!( + "Invalid argument ‘{}‘ for --time. +‘birth‘ and ‘creation‘ arguments are not supported on this platform.", + s + ); + return 1; + } } + // below should never happen as clap already restricts the values. + _ => unreachable!("Invalid field for --time"), }, None => stat.modified, } diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index 9e585b03e..3c177c6bf 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -240,18 +240,37 @@ fn test_du_time() { scene .ccmd("touch") .arg("-a") - .arg("-m") .arg("-t") .arg("201505150000") .arg("date_test") .succeeds(); scene - .ucmd() - .arg("--time") + .ccmd("touch") + .arg("-m") + .arg("-t") + .arg("201606160000") .arg("date_test") - .succeeds() - .stdout_only("0\t2015-05-15 00:00\tdate_test\n"); + .succeeds(); + + let result = scene.ucmd().arg("--time").arg("date_test").succeeds(); + result.stdout_only("0\t2016-06-16 00:00\tdate_test\n"); + + let result = scene.ucmd().arg("--time=atime").arg("date_test").succeeds(); + result.stdout_only("0\t2015-05-15 00:00\tdate_test\n"); + + let result = scene.ucmd().arg("--time=ctime").arg("date_test").succeeds(); + result.stdout_only("0\t2016-06-16 00:00\tdate_test\n"); + + #[cfg(not(target_env = "musl"))] + { + use regex::Regex; + + let re_birth = + Regex::new(r"0\t[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}\tdate_test").unwrap(); + let result = scene.ucmd().arg("--time=birth").arg("date_test").succeeds(); + result.stdout_matches(&re_birth); + } } #[cfg(not(target_os = "windows"))] From af8f47ea6a6c21836f88032217932cb15fba5ecb Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 3 Jun 2021 15:05:20 +0200 Subject: [PATCH 0850/1135] ln: remove redundant check if `dst.exists()` and `settings.overwrite` is `OverwriteMode::Force`, we already delete the file in the match above. --- src/uu/ln/src/ln.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index 4bd3310cc..4087716bd 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -422,11 +422,6 @@ fn link(src: &Path, dst: &Path, settings: &Settings) -> Result<()> { } } - if settings.no_dereference && matches!(settings.overwrite, OverwriteMode::Force) && dst.exists() - { - fs::remove_file(dst)?; - } - if settings.symbolic { symlink(&source, dst)?; } else { From 6c46d09397759118343a3e7fdd21310aa99debac Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 2 Jun 2021 21:27:08 +0200 Subject: [PATCH 0851/1135] ln: canonicalize the parent directory of dst, not dst dst may or may not exist. In case it exists it might already be a symlink. In neither case we should try to canonicalize dst, only its parent directory. https://www.gnu.org/software/coreutils/manual/html_node/ln-invocation.html > Relative symbolic links are generated based on their canonicalized > **containing directory**, and canonicalized targets. --- src/uu/ln/src/ln.rs | 3 ++- tests/by-util/test_ln.rs | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index 4087716bd..33ec5f449 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -372,7 +372,8 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings) fn relative_path<'a>(src: &Path, dst: &Path) -> Result> { let src_abs = canonicalize(src, CanonicalizeMode::Normal)?; - let dst_abs = canonicalize(dst, CanonicalizeMode::Normal)?; + let mut dst_abs = canonicalize(dst.parent().unwrap(), CanonicalizeMode::Normal)?; + dst_abs.push(dst.components().last().unwrap()); let suffix_pos = src_abs .components() .zip(dst_abs.components()) diff --git a/tests/by-util/test_ln.rs b/tests/by-util/test_ln.rs index 00ea85ecd..fc97ff779 100644 --- a/tests/by-util/test_ln.rs +++ b/tests/by-util/test_ln.rs @@ -562,3 +562,21 @@ fn test_symlink_no_deref_file() { fn test_relative_requires_symbolic() { new_ucmd!().args(&["-r", "foo", "bar"]).fails(); } + +#[test] +fn test_relative_dst_already_symlink() { + let (at, mut ucmd) = at_and_ucmd!(); + at.touch("file1"); + at.symlink_file("file1", "file2"); + ucmd.arg("-srf").arg("file1").arg("file2").succeeds(); + at.is_symlink("file2"); +} + +#[test] +fn test_relative_src_already_symlink() { + let (at, mut ucmd) = at_and_ucmd!(); + at.touch("file1"); + at.symlink_file("file1", "file2"); + ucmd.arg("-sr").arg("file2").arg("file3").succeeds(); + assert!(at.resolve_link("file3").ends_with("file1")); +} From ad26b7a042cabaf50b7b2ba93e980b050dc0bb59 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Thu, 3 Jun 2021 20:37:29 +0200 Subject: [PATCH 0852/1135] head/tail/split: make error handling of NUM/SIZE arguments more consistent * add tests for each flag that takes NUM/SIZE arguments * fix bug in tail where 'quiet' and 'verbose' flags did not override each other POSIX style --- src/uu/head/src/head.rs | 2 +- src/uu/head/src/parse.rs | 5 +- src/uu/split/src/split.rs | 13 +---- src/uu/tail/src/tail.rs | 18 +++---- src/uucore/src/lib/parser/parse_size.rs | 63 +++++++++++++++++++------ tests/by-util/test_head.rs | 23 ++++++--- tests/by-util/test_tail.rs | 25 ++++++---- 7 files changed, 93 insertions(+), 56 deletions(-) diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index d67cc5b07..80f816d0f 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -76,7 +76,7 @@ fn app<'a>() -> App<'a, 'a> { .arg( Arg::with_name(options::QUIET_NAME) .short("q") - .long("--quiet") + .long("quiet") .visible_alias("silent") .help("never print headers giving file names") .overrides_with_all(&[options::VERBOSE_NAME, options::QUIET_NAME]), diff --git a/src/uu/head/src/parse.rs b/src/uu/head/src/parse.rs index 50cdfc439..6631dba0e 100644 --- a/src/uu/head/src/parse.rs +++ b/src/uu/head/src/parse.rs @@ -108,10 +108,7 @@ pub fn parse_num(src: &str) -> Result<(usize, bool), ParseSizeError> { return Err(ParseSizeError::ParseFailure(src.to_string())); } - match parse_size(&size_string) { - Ok(n) => Ok((n, all_but_last)), - Err(e) => Err(e), - } + parse_size(&size_string).map(|n| (n, all_but_last)) } #[cfg(test)] diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index 1fe35795e..ca9c68c74 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -19,7 +19,7 @@ use std::fs::File; use std::io::{stdin, BufRead, BufReader, BufWriter, Read, Write}; use std::path::Path; use std::{char, fs::remove_file}; -use uucore::parse_size::{parse_size, ParseSizeError}; +use uucore::parse_size::parse_size; static NAME: &str = "split"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -281,16 +281,7 @@ impl ByteSplitter { let size_string = &settings.strategy_param; let size_num = match parse_size(&size_string) { Ok(n) => n, - Err(e) => match e { - ParseSizeError::ParseFailure(_) => { - crash!(1, "invalid number of bytes: {}", e.to_string()) - } - ParseSizeError::SizeTooBig(_) => crash!( - 1, - "invalid number of bytes: ‘{}’: Value too large for defined data type", - size_string - ), - }, + Err(e) => crash!(1, "invalid number of bytes: {}", e.to_string()), }; ByteSplitter { diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index acaad8c30..76c799621 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -33,7 +33,6 @@ use uucore::ringbuffer::RingBuffer; pub mod options { pub mod verbosity { pub static QUIET: &str = "quiet"; - pub static SILENT: &str = "silent"; pub static VERBOSE: &str = "verbose"; } pub static BYTES: &str = "bytes"; @@ -77,6 +76,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let app = App::new(executable!()) .version(crate_version!()) .about("output the last part of files") + // TODO: add usage .arg( Arg::with_name(options::BYTES) .short("c") @@ -111,13 +111,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(options::verbosity::QUIET) .short("q") .long(options::verbosity::QUIET) + .visible_alias("silent") + .overrides_with_all(&[options::verbosity::QUIET, options::verbosity::VERBOSE]) .help("never output headers giving file names"), ) - .arg( - Arg::with_name(options::verbosity::SILENT) - .long(options::verbosity::SILENT) - .help("synonym of --quiet"), - ) .arg( Arg::with_name(options::SLEEP_INT) .short("s") @@ -129,6 +126,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(options::verbosity::VERBOSE) .short("v") .long(options::verbosity::VERBOSE) + .overrides_with_all(&[options::verbosity::QUIET, options::verbosity::VERBOSE]) .help("always output headers giving file names"), ) .arg( @@ -195,8 +193,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } let verbose = matches.is_present(options::verbosity::VERBOSE); - let quiet = matches.is_present(options::verbosity::QUIET) - || matches.is_present(options::verbosity::SILENT); + let quiet = matches.is_present(options::verbosity::QUIET); let files: Vec = matches .values_of(options::ARG_FILES) @@ -423,8 +420,5 @@ fn parse_num(src: &str) -> Result<(usize, bool), ParseSizeError> { return Err(ParseSizeError::ParseFailure(src.to_string())); } - match parse_size(&size_string) { - Ok(n) => Ok((n, starting_with)), - Err(e) => Err(e), - } + parse_size(&size_string).map(|n| (n, starting_with)) } diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index 4a31d753a..c7825d4e3 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -75,10 +75,9 @@ pub fn parse_size(size: &str) -> Result { Ok(n) => n, Err(_) => return Err(ParseSizeError::size_too_big(size)), }; - match number.checked_mul(factor) { - Some(n) => Ok(n), - None => Err(ParseSizeError::size_too_big(size)), - } + number + .checked_mul(factor) + .ok_or(ParseSizeError::size_too_big(size)) } #[derive(Debug, PartialEq, Eq)] @@ -108,22 +107,58 @@ impl fmt::Display for ParseSizeError { impl ParseSizeError { fn parse_failure(s: &str) -> ParseSizeError { - // has to be handled in the respective uutils because strings differ, e.g. - // truncate: Invalid number: ‘fb’ - // tail: invalid number of bytes: ‘fb’ + // stderr on linux (GNU coreutils 8.32) + // has to be handled in the respective uutils because strings differ, e.g.: + // + // `NUM` + // head: invalid number of bytes: ‘1fb’ + // tail: invalid number of bytes: ‘1fb’ + // + // `SIZE` + // split: invalid number of bytes: ‘1fb’ + // truncate: Invalid number: ‘1fb’ + // + // `MODE` + // stdbuf: invalid mode ‘1fb’ + // + // `SIZE` + // sort: invalid suffix in --buffer-size argument '1fb' + // sort: invalid --buffer-size argument 'fb' + // + // `SIZE` + // du: invalid suffix in --buffer-size argument '1fb' + // du: invalid suffix in --threshold argument '1fb' + // du: invalid --buffer-size argument 'fb' + // du: invalid --threshold argument 'fb' + // + // `BYTES` + // od: invalid suffix in --read-bytes argument '1fb' + // od: invalid --read-bytes argument argument 'fb' + // --skip-bytes + // --width + // --strings + // etc. ParseSizeError::ParseFailure(format!("‘{}’", s)) } fn size_too_big(s: &str) -> ParseSizeError { - // has to be handled in the respective uutils because strings differ, e.g. - // truncate: Invalid number: ‘1Y’: Value too large to be stored in data type - // tail: invalid number of bytes: ‘1Y’: Value too large to be stored in data type + // stderr on linux (GNU coreutils 8.32) + // has to be handled in the respective uutils because strings differ, e.g.: + // + // head: invalid number of bytes: ‘1Y’: Value too large for defined data type + // tail: invalid number of bytes: ‘1Y’: Value too large for defined data type // split: invalid number of bytes: ‘1Y’: Value too large for defined data type + // truncate: Invalid number: ‘1Y’: Value too large for defined data type + // stdbuf: invalid mode ‘1Y’: Value too large for defined data type + // sort: -S argument '1Y' too large + // du: -B argument '1Y' too large + // od: -N argument '1Y' too large // etc. - ParseSizeError::SizeTooBig(format!( - "‘{}’: Value too large to be stored in data type", - s - )) + // + // stderr on macos (brew - GNU coreutils 8.32) also differs for the same version, e.g.: + // ghead: invalid number of bytes: ‘1Y’: Value too large to be stored in data type + // gtail: invalid number of bytes: ‘1Y’: Value too large to be stored in data type + ParseSizeError::SizeTooBig(format!("‘{}’: Value too large for defined data type", s)) } } diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index 99e6518fa..6a2cdf1cd 100755 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -244,6 +244,7 @@ hello ", ); } + #[test] fn test_head_invalid_num() { new_ucmd!() @@ -258,16 +259,26 @@ fn test_head_invalid_num() { new_ucmd!() .args(&["-c", "1Y", "emptyfile.txt"]) .fails() - .stderr_is( - "head: invalid number of bytes: ‘1Y’: Value too large to be stored in data type", - ); + .stderr_is("head: invalid number of bytes: ‘1Y’: Value too large for defined data type"); #[cfg(not(target_pointer_width = "128"))] new_ucmd!() .args(&["-n", "1Y", "emptyfile.txt"]) .fails() - .stderr_is( - "head: invalid number of lines: ‘1Y’: Value too large to be stored in data type", - ); + .stderr_is("head: invalid number of lines: ‘1Y’: Value too large for defined data type"); + #[cfg(target_pointer_width = "32")] + { + let sizes = ["1000G", "10T"]; + for size in &sizes { + new_ucmd!() + .args(&["-c", size]) + .fails() + .code_is(1) + .stderr_only(format!( + "head: invalid number of bytes: ‘{}’: Value too large for defined data type", + size + )); + } + } } #[test] diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 43e4aaa0c..c296e2763 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -284,12 +284,11 @@ fn test_multiple_input_files_with_suppressed_headers() { #[test] fn test_multiple_input_quiet_flag_overrides_verbose_flag_for_suppressing_headers() { - // TODO: actually the later one should win, i.e. -qv should lead to headers being printed, -vq to them being suppressed new_ucmd!() .arg(FOOBAR_TXT) .arg(FOOBAR_2_TXT) - .arg("-q") .arg("-v") + .arg("-q") .run() .stdout_is_fixture("foobar_multiple_quiet.expected"); } @@ -367,16 +366,26 @@ fn test_tail_invalid_num() { new_ucmd!() .args(&["-c", "1Y", "emptyfile.txt"]) .fails() - .stderr_is( - "tail: invalid number of bytes: ‘1Y’: Value too large to be stored in data type", - ); + .stderr_is("tail: invalid number of bytes: ‘1Y’: Value too large for defined data type"); #[cfg(not(target_pointer_width = "128"))] new_ucmd!() .args(&["-n", "1Y", "emptyfile.txt"]) .fails() - .stderr_is( - "tail: invalid number of lines: ‘1Y’: Value too large to be stored in data type", - ); + .stderr_is("tail: invalid number of lines: ‘1Y’: Value too large for defined data type"); + #[cfg(target_pointer_width = "32")] + { + let sizes = ["1000G", "10T"]; + for size in &sizes { + new_ucmd!() + .args(&["-c", size]) + .fails() + .code_is(1) + .stderr_only(format!( + "tail: invalid number of bytes: ‘{}’: Value too large for defined data type", + size + )); + } + } } #[test] From db3ee61742138e7bc1dd14bb3a1bd67db418f5a5 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Thu, 3 Jun 2021 21:00:03 +0200 Subject: [PATCH 0853/1135] du/sort/od/stdbuf: make error handling of SIZE/BYTES/MODE arguments more consistent * od: add stderr info for not yet implemented '--strings' flag --- src/uu/du/src/du.rs | 31 ++++++++------- src/uu/od/src/od.rs | 65 +++++++++++++++++++------------- src/uu/od/src/parse_nrofbytes.rs | 45 +++++++++++----------- src/uu/sort/src/sort.rs | 24 ++++++++---- src/uu/stdbuf/src/stdbuf.rs | 11 ++---- tests/by-util/test_du.rs | 2 +- tests/by-util/test_od.rs | 34 +++++++++++++++++ tests/by-util/test_sort.rs | 9 +++-- tests/by-util/test_stdbuf.rs | 25 ++++++------ 9 files changed, 153 insertions(+), 93 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 5dfb41d82..170e057b5 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -42,7 +42,7 @@ mod options { pub const NULL: &str = "0"; pub const ALL: &str = "all"; pub const APPARENT_SIZE: &str = "apparent-size"; - pub const BLOCK_SIZE: &str = "B"; + pub const BLOCK_SIZE: &str = "block-size"; pub const BYTES: &str = "b"; pub const TOTAL: &str = "c"; pub const MAX_DEPTH: &str = "d"; @@ -211,18 +211,11 @@ fn get_file_info(path: &PathBuf) -> Option { } fn read_block_size(s: Option<&str>) -> usize { - if let Some(size_arg) = s { - match parse_size(size_arg) { - Ok(v) => v, - Err(e) => match e { - ParseSizeError::ParseFailure(_) => { - crash!(1, "invalid suffix in --block-size argument '{}'", size_arg) - } - ParseSizeError::SizeTooBig(_) => { - crash!(1, "--block-size argument '{}' too large", size_arg) - } - }, - } + if let Some(s) = s { + parse_size(s).map_or_else( + |e| crash!(1, "{}", format_error_message(e, s, options::BLOCK_SIZE)), + |n| n, + ) } else { for env_var in &["DU_BLOCK_SIZE", "BLOCK_SIZE", "BLOCKSIZE"] { if let Ok(env_size) = env::var(env_var) { @@ -389,7 +382,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg( Arg::with_name(options::BLOCK_SIZE) .short("B") - .long("block-size") + .long(options::BLOCK_SIZE) .value_name("SIZE") .help( "scale sizes by SIZE before printing them. \ @@ -694,6 +687,16 @@ Try '{} --help' for more information.", 0 } +fn format_error_message(error: ParseSizeError, s: &str, option: &str) -> String { + // NOTE: + // GNU's du echos affected flag, -B or --block-size (-t or --threshold), depending user's selection + // GNU's du distinguishs between "invalid (suffix in) argument" + match error { + ParseSizeError::ParseFailure(_) => format!("invalid --{} argument '{}'", option, s), + ParseSizeError::SizeTooBig(_) => format!("--{} argument '{}' too large", option, s), + } +} + #[cfg(test)] mod test_du { #[allow(unused_imports)] diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 7359047b2..9b98fd515 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -43,6 +43,7 @@ use crate::partialreader::*; use crate::peekreader::*; use crate::prn_char::format_ascii_dump; use clap::{self, AppSettings, Arg, ArgMatches}; +use uucore::parse_size::ParseSizeError; use uucore::InvalidEncodingHandling; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -130,15 +131,16 @@ impl OdOptions { } }; - let mut skip_bytes = match matches.value_of(options::SKIP_BYTES) { - None => 0, - Some(s) => match parse_number_of_bytes(&s) { - Ok(i) => i, - Err(_) => { - return Err(format!("Invalid argument --skip-bytes={}", s)); - } - }, - }; + if matches.occurrences_of(options::STRINGS) > 0 { + crash!(1, "Option '{}' not yet implemented.", options::STRINGS); + } + + let mut skip_bytes = matches.value_of(options::SKIP_BYTES).map_or(0, |s| { + parse_number_of_bytes(s).map_or_else( + |e| crash!(1, "{}", format_error_message(e, s, options::SKIP_BYTES)), + |n| n, + ) + }); let mut label: Option = None; @@ -161,11 +163,16 @@ impl OdOptions { } }; - let mut line_bytes = match matches.value_of(options::WIDTH) { - None => 16, - Some(_) if matches.occurrences_of(options::WIDTH) == 0 => 16, - Some(s) => s.parse::().unwrap_or(0), - }; + let mut line_bytes = matches.value_of(options::WIDTH).map_or(16, |s| { + if matches.occurrences_of(options::WIDTH) == 0 { + return 16; + }; + parse_number_of_bytes(s).map_or_else( + |e| crash!(1, "{}", format_error_message(e, s, options::WIDTH)), + |n| n, + ) + }); + let min_bytes = formats.iter().fold(1, |max, next| { cmp::max(max, next.formatter_item_info.byte_size) }); @@ -176,15 +183,12 @@ impl OdOptions { let output_duplicates = matches.is_present(options::OUTPUT_DUPLICATES); - let read_bytes = match matches.value_of(options::READ_BYTES) { - None => None, - Some(s) => match parse_number_of_bytes(&s) { - Ok(i) => Some(i), - Err(_) => { - return Err(format!("Invalid argument --read-bytes={}", s)); - } - }, - }; + let read_bytes = matches.value_of(options::READ_BYTES).map(|s| { + parse_number_of_bytes(s).map_or_else( + |e| crash!(1, "{}", format_error_message(e, s, options::READ_BYTES)), + |n| n, + ) + }); let radix = match matches.value_of(options::ADDRESS_RADIX) { None => Radix::Octal, @@ -265,7 +269,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .short("S") .long(options::STRINGS) .help( - "output strings of at least BYTES graphic chars. 3 is assumed when \ + "NotImplemented: output strings of at least BYTES graphic chars. 3 is assumed when \ BYTES is not specified.", ) .default_value("3") @@ -466,8 +470,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let od_options = match OdOptions::new(clap_matches, args) { Err(s) => { - show_usage_error!("{}", s); - return 1; + crash!(1, "{}", s); } Ok(o) => o, }; @@ -649,3 +652,13 @@ fn open_input_peek_reader( let pr = PartialReader::new(mf, skip_bytes, read_bytes); PeekReader::new(pr) } + +fn format_error_message(error: ParseSizeError, s: &str, option: &str) -> String { + // NOTE: + // GNU's od echos affected flag, -N or --read-bytes (-j or --skip-bytes, etc.), depending user's selection + // GNU's od distinguishs between "invalid (suffix in) argument" + match error { + ParseSizeError::ParseFailure(_) => format!("invalid --{} argument '{}'", option, s), + ParseSizeError::SizeTooBig(_) => format!("--{} argument '{}' too large", option, s), + } +} diff --git a/src/uu/od/src/parse_nrofbytes.rs b/src/uu/od/src/parse_nrofbytes.rs index 9223d7e53..e51e15d39 100644 --- a/src/uu/od/src/parse_nrofbytes.rs +++ b/src/uu/od/src/parse_nrofbytes.rs @@ -1,4 +1,6 @@ -pub fn parse_number_of_bytes(s: &str) -> Result { +use uucore::parse_size::{parse_size, ParseSizeError}; + +pub fn parse_number_of_bytes(s: &str) -> Result { let mut start = 0; let mut len = s.len(); let mut radix = 16; @@ -9,10 +11,7 @@ pub fn parse_number_of_bytes(s: &str) -> Result { } else if s.starts_with('0') { radix = 8; } else { - return match uucore::parse_size::parse_size(&s[start..]) { - Ok(n) => Ok(n), - Err(_) => Err("parse failed"), - }; + return parse_size(&s[start..]); } let mut ends_with = s.chars().rev(); @@ -60,35 +59,33 @@ pub fn parse_number_of_bytes(s: &str) -> Result { Some('P') => 1000 * 1000 * 1000 * 1000 * 1000, #[cfg(target_pointer_width = "64")] Some('E') => 1000 * 1000 * 1000 * 1000 * 1000 * 1000, - _ => return Err("parse failed"), + _ => return Err(ParseSizeError::ParseFailure(s.to_string())), } } _ => {} } - match usize::from_str_radix(&s[start..len], radix) { - Ok(i) => Ok(i * multiply), - Err(_) => Err("parse failed"), - } -} - -#[allow(dead_code)] -fn parse_number_of_bytes_str(s: &str) -> Result { - parse_number_of_bytes(&String::from(s)) + let factor = match usize::from_str_radix(&s[start..len], radix) { + Ok(f) => f, + Err(e) => return Err(ParseSizeError::ParseFailure(e.to_string())), + }; + factor + .checked_mul(multiply) + .ok_or(ParseSizeError::SizeTooBig(s.to_string())) } #[test] fn test_parse_number_of_bytes() { // octal input - assert_eq!(8, parse_number_of_bytes_str("010").unwrap()); - assert_eq!(8 * 512, parse_number_of_bytes_str("010b").unwrap()); - assert_eq!(8 * 1024, parse_number_of_bytes_str("010k").unwrap()); - assert_eq!(8 * 1048576, parse_number_of_bytes_str("010m").unwrap()); + assert_eq!(8, parse_number_of_bytes("010").unwrap()); + assert_eq!(8 * 512, parse_number_of_bytes("010b").unwrap()); + assert_eq!(8 * 1024, parse_number_of_bytes("010k").unwrap()); + assert_eq!(8 * 1048576, parse_number_of_bytes("010m").unwrap()); // hex input - assert_eq!(15, parse_number_of_bytes_str("0xf").unwrap()); - assert_eq!(15, parse_number_of_bytes_str("0XF").unwrap()); - assert_eq!(27, parse_number_of_bytes_str("0x1b").unwrap()); - assert_eq!(16 * 1024, parse_number_of_bytes_str("0x10k").unwrap()); - assert_eq!(16 * 1048576, parse_number_of_bytes_str("0x10m").unwrap()); + assert_eq!(15, parse_number_of_bytes("0xf").unwrap()); + assert_eq!(15, parse_number_of_bytes("0XF").unwrap()); + assert_eq!(27, parse_number_of_bytes("0x1b").unwrap()); + assert_eq!(16 * 1024, parse_number_of_bytes("0x10k").unwrap()); + assert_eq!(16 * 1048576, parse_number_of_bytes("0x10m").unwrap()); } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 208010d09..c148d06c7 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1148,12 +1148,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.buffer_size = matches .value_of(OPT_BUF_SIZE) - .map(|v| match GlobalSettings::parse_byte_count(v) { - Ok(n) => n, - Err(ParseSizeError::ParseFailure(_)) => crash!(2, "invalid -S argument '{}'", v), - Err(ParseSizeError::SizeTooBig(_)) => crash!(2, "-S argument '{}' too large", v), - }) - .unwrap_or(DEFAULT_BUF_SIZE); + .map_or(DEFAULT_BUF_SIZE, |s| { + GlobalSettings::parse_byte_count(s).map_or_else( + |e| crash!(2, "{}", format_error_message(e, s, OPT_BUF_SIZE)), + |n| n, + ) + }); settings.tmp_dir = matches .value_of(OPT_TMP_DIR) @@ -1555,6 +1555,16 @@ fn open(path: impl AsRef) -> Box { } } +fn format_error_message(error: ParseSizeError, s: &str, option: &str) -> String { + // NOTE: + // GNU's sort echos affected flag, -S or --buffer-size, depending user's selection + // GNU's sort distinguishs between "invalid (suffix in) argument" + match error { + ParseSizeError::ParseFailure(_) => format!("invalid --{} argument '{}'", option, s), + ParseSizeError::SizeTooBig(_) => format!("--{} argument '{}' too large", option, s), + } +} + #[cfg(test)] mod tests { @@ -1659,7 +1669,7 @@ mod tests { ("10T", 10 * 1024 * 1024 * 1024 * 1024), ("1b", 1), ("1024b", 1024), - ("1024Mb", 1024 * 1024 * 1024), // TODO: This might not be what GNU `sort` does? + ("1024Mb", 1024 * 1024 * 1024), // NOTE: This might not be how GNU `sort` behaves for 'Mb' ("1", 1024), // K is default ("50", 50 * 1024), ("K", 1024), diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index e39af3816..d073c1bd1 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -118,13 +118,10 @@ fn check_option(matches: &ArgMatches, name: &str) -> Result { - let size = match parse_size(x) { - Ok(m) => m, - Err(e) => return Err(ProgramOptionsError(format!("invalid mode {}", e))), - }; - Ok(BufferType::Size(size)) - } + x => parse_size(x).map_or_else( + |e| crash!(125, "invalid mode {}", e), + |m| Ok(BufferType::Size(m)), + ), }, None => Ok(BufferType::Default), } diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index 8ec0a9c0c..066ab5c9b 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -80,7 +80,7 @@ fn test_du_invalid_size() { .arg("/tmp") .fails() .code_is(1) - .stderr_only("du: invalid suffix in --block-size argument '1fb4t'"); + .stderr_only("du: invalid --block-size argument '1fb4t'"); #[cfg(not(target_pointer_width = "128"))] new_ucmd!() .arg("--block-size=1Y") diff --git a/tests/by-util/test_od.rs b/tests/by-util/test_od.rs index c21c683dc..3d34e47a1 100644 --- a/tests/by-util/test_od.rs +++ b/tests/by-util/test_od.rs @@ -804,3 +804,37 @@ fn test_traditional_only_label() { ", )); } + +#[test] +fn test_od_invalid_bytes() { + const INVALID_SIZE: &str = "1fb4t"; + const BIG_SIZE: &str = "1Y"; + + let input: [u8; 8] = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; + + let options = [ + "--read-bytes", + "--skip-bytes", + "--width", + // "--strings", // TODO: consider testing here once '--strings' is implemented + ]; + for option in &options { + new_ucmd!() + .arg(format!("{}={}", option, INVALID_SIZE)) + .run_piped_stdin(&input[..]) + .failure() + .code_is(1) + .stderr_only(format!( + "od: invalid {} argument '{}'", + option, INVALID_SIZE + )); + + #[cfg(not(target_pointer_width = "128"))] + new_ucmd!() + .arg(format!("{}={}", option, BIG_SIZE)) + .run_piped_stdin(&input[..]) + .failure() + .code_is(1) + .stderr_only(format!("od: {} argument '{}' too large", option, BIG_SIZE)); + } +} diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 054789edf..eab256980 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -57,7 +57,7 @@ fn test_invalid_buffer_size() { .fails() .code_is(2) .stderr_only(format!( - "sort: invalid -S argument '{}'", + "sort: invalid --buffer-size argument '{}'", invalid_buffer_size )); } @@ -69,7 +69,7 @@ fn test_invalid_buffer_size() { .arg("ext_sort.txt") .fails() .code_is(2) - .stderr_only("sort: -S argument '1Y' too large"); + .stderr_only("sort: --buffer-size argument '1Y' too large"); #[cfg(target_pointer_width = "32")] { @@ -82,7 +82,10 @@ fn test_invalid_buffer_size() { .arg("ext_sort.txt") .fails() .code_is(2) - .stderr_only(format!("sort: -S argument '{}' too large", buffer_size)); + .stderr_only(format!( + "sort: --buffer-size argument '{}' too large", + buffer_size + )); } } } diff --git a/tests/by-util/test_stdbuf.rs b/tests/by-util/test_stdbuf.rs index e5d784edb..fc1b9324a 100644 --- a/tests/by-util/test_stdbuf.rs +++ b/tests/by-util/test_stdbuf.rs @@ -57,15 +57,18 @@ fn test_stdbuf_line_buffering_stdin_fails() { #[cfg(not(target_os = "windows"))] #[test] fn test_stdbuf_invalid_mode_fails() { - // TODO: GNU's `stdbuf` (8.32) does not return "\nTry 'stdbuf --help' for more information." - // for invalid modes. - new_ucmd!() - .args(&["-i", "1024R", "head"]) - .fails() - .stderr_contains("stdbuf: invalid mode ‘1024R’"); - #[cfg(not(target_pointer_width = "128"))] - new_ucmd!() - .args(&["--error", "1Y", "head"]) - .fails() - .stderr_contains("stdbuf: invalid mode ‘1Y’: Value too large to be stored in data type"); + let options = ["--input", "--output", "--error"]; + for option in &options { + new_ucmd!() + .args(&[*option, "1024R", "head"]) + .fails() + .code_is(125) + .stderr_only("stdbuf: invalid mode ‘1024R’"); + #[cfg(not(target_pointer_width = "128"))] + new_ucmd!() + .args(&[*option, "1Y", "head"]) + .fails() + .code_is(125) + .stderr_contains("stdbuf: invalid mode ‘1Y’: Value too large for defined data type"); + } } From 84330ca938bdd441f341d28a44e480f8352f43ed Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 3 Jun 2021 22:15:57 +0200 Subject: [PATCH 0854/1135] gnu/test: rm: update one of the test to match what we do --- util/build-gnu.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 64329bd0c..c575e84f6 100644 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -98,4 +98,13 @@ sed -i 's|seq |/usr/bin/seq |' tests/misc/sort-discrim.sh sed -i 's|seq \$|/usr/bin/timeout 0.1 seq \$|' tests/misc/seq-precision.sh tests/misc/seq-long-double.sh sed -i 's|cat |/usr/bin/timeout 0.1 cat |' tests/misc/cat-self.sh + + +#### Adjust tests to make them work with Rust/coreutils +# in some cases, what we are doing in rust/coreutils is good (or better) +# we should not regress our project just to match what GNU is going. +# So, do some changes on the fly + +sed -i -e "s|rm: cannot remove 'e/slink'|rm: cannot remove 'e'|g" tests/rm/fail-eacces.sh + test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" From 6a8d15f92eee778fe583d8680a9af7bcc9e8a46e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 3 Jun 2021 22:19:14 +0200 Subject: [PATCH 0855/1135] gnu/rm: match gnu's output --- src/uu/rm/src/rm.rs | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 43a4f4780..ba764034a 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -255,7 +255,18 @@ fn handle_dir(path: &Path, options: &Options) -> bool { // correctly on Windows if let Err(e) = remove_dir_all(path) { had_err = true; - show_error!("could not remove '{}': {}", path.display(), e); + if e.kind() == std::io::ErrorKind::PermissionDenied { + // GNU compatibility (rm/fail-eacces.sh) + // here, GNU doesn't use some kind of remove_dir_all + // It will show directory+file + show_error!( + "cannot remove '{}': {}", + path.display(), + "Permission denied" + ); + } else { + show_error!("cannot remove '{}': {}", path.display(), e); + } } } else { let mut dirs: VecDeque = VecDeque::new(); @@ -314,7 +325,16 @@ fn remove_dir(path: &Path, options: &Options) -> bool { } } Err(e) => { - show_error!("cannot remove '{}': {}", path.display(), e); + if e.kind() == std::io::ErrorKind::PermissionDenied { + // GNU compatibility (rm/fail-eacces.sh) + show_error!( + "cannot remove '{}': {}", + path.display(), + "Permission denied" + ); + } else { + show_error!("cannot remove '{}': {}", path.display(), e); + } return true; } } @@ -352,7 +372,16 @@ fn remove_file(path: &Path, options: &Options) -> bool { } } Err(e) => { - show_error!("removing '{}': {}", path.display(), e); + if e.kind() == std::io::ErrorKind::PermissionDenied { + // GNU compatibility (rm/fail-eacces.sh) + show_error!( + "cannot remove '{}': {}", + path.display(), + "Permission denied" + ); + } else { + show_error!("cannot remove '{}': {}", path.display(), e); + } return true; } } From 754082886c602414846f59bf9c3f9a9d04343a6b Mon Sep 17 00:00:00 2001 From: Mitchell Mebane Date: Thu, 3 Jun 2021 20:49:25 -0500 Subject: [PATCH 0856/1135] dircolors: Address code review comments --- src/uu/dircolors/src/dircolors.rs | 42 +++++++------------------------ 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index 078270791..2fa2e8b91 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -19,9 +19,7 @@ use std::io::{BufRead, BufReader}; use clap::{crate_version, App, Arg}; mod options { - pub const SH: &str = "sh"; pub const BOURNE_SHELL: &str = "bourne-shell"; - pub const CSH: &str = "csh"; pub const C_SHELL: &str = "c-shell"; pub const PRINT_DATABASE: &str = "print-database"; pub const FILE: &str = "FILE"; @@ -75,52 +73,33 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - /* Clap has .visible_alias, but it generates help like this - * -b, --sh output Bourne shell code to set LS_COLORS [aliases: bourne-shell] - * whereas we want help like this - * -b, --sh output Bourne shell code to set LS_COLORS - * --bourne-shell output Bourne shell code to set LS_COLORS - * (or preferably like the original, but that doesn't seem possible with clap:) - * -b, --sh, --bourne-shell output Bourne shell code to set LS_COLORS - * therefore, command aliases are defined manually as multiple commands - */ let matches = App::new(executable!()) .version(crate_version!()) .about(SUMMARY) .usage(&usage[..]) .after_help(LONG_HELP) .arg( - Arg::with_name(options::SH) + Arg::with_name(options::BOURNE_SHELL) .long("sh") .short("b") + .visible_alias("bourne-shell") .help("output Bourne shell code to set LS_COLORS") .display_order(1), ) .arg( - Arg::with_name(options::BOURNE_SHELL) - .long("bourne-shell") - .help("output Bourne shell code to set LS_COLORS") - .display_order(2), - ) - .arg( - Arg::with_name(options::CSH) + Arg::with_name(options::C_SHELL) .long("csh") .short("c") + .visible_alias("c-shell") .help("output C shell code to set LS_COLORS") - .display_order(3), - ) - .arg( - Arg::with_name(options::C_SHELL) - .long("c-shell") - .help("output C shell code to set LS_COLORS") - .display_order(4), + .display_order(2), ) .arg( Arg::with_name(options::PRINT_DATABASE) .long("print-database") .short("p") .help("print the byte counts") - .display_order(5), + .display_order(3), ) .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) .get_matches_from(&args); @@ -131,10 +110,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // clap provides .conflicts_with / .conflicts_with_all, but we want to // manually handle conflicts so we can match the output of GNU coreutils - if (matches.is_present(options::CSH) - || matches.is_present(options::C_SHELL) - || matches.is_present(options::SH) - || matches.is_present(options::BOURNE_SHELL)) + if (matches.is_present(options::C_SHELL) || matches.is_present(options::BOURNE_SHELL)) && matches.is_present(options::PRINT_DATABASE) { show_usage_error!( @@ -158,9 +134,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } let mut out_format = OutputFmt::Unknown; - if matches.is_present(options::CSH) || matches.is_present(options::C_SHELL) { + if matches.is_present(options::C_SHELL) { out_format = OutputFmt::CShell; - } else if matches.is_present(options::SH) || matches.is_present(options::BOURNE_SHELL) { + } else if matches.is_present(options::BOURNE_SHELL) { out_format = OutputFmt::Shell; } From a85ee4386ad29c60a185af8a7861a9c2b9404d29 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 3 Jun 2021 22:49:47 +0200 Subject: [PATCH 0857/1135] gnu/rm: make the code reentrant --- util/build-gnu.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index c575e84f6..cd0f7dc39 100644 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -59,7 +59,7 @@ do done -grep -rl 'path_prepend_' tests/* | xargs sed -i 's|path_prepend_ ./src||' +grep -rl 'path_prepend_' tests/* | xargs sed -i 's| path_prepend_ ./src||' sed -i -e 's|^seq |/usr/bin/seq |' -e 's|sha1sum |/usr/bin/sha1sum |' tests/factor/t*sh # Remove tests checking for --version & --help @@ -94,11 +94,14 @@ sed -i 's|cp |/usr/bin/cp |' tests/mv/hard-2.sh sed -i 's|paste |/usr/bin/paste |' tests/misc/od-endian.sh sed -i 's|seq |/usr/bin/seq |' tests/misc/sort-discrim.sh -#Add specific timeout to tests that currently hang to limit time spent waiting +# Add specific timeout to tests that currently hang to limit time spent waiting sed -i 's|seq \$|/usr/bin/timeout 0.1 seq \$|' tests/misc/seq-precision.sh tests/misc/seq-long-double.sh sed -i 's|cat |/usr/bin/timeout 0.1 cat |' tests/misc/cat-self.sh +# Remove dup of /usr/bin/ when executed several times +grep -rl '/usr/bin//usr/bin/' tests/* | xargs --no-run-if-empty sed -i 's|/usr/bin//usr/bin/|/usr/bin/|g' + #### Adjust tests to make them work with Rust/coreutils # in some cases, what we are doing in rust/coreutils is good (or better) From 9cf3ab894f0a887d5085fdf08abb52a13d3acb07 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 3 Jun 2021 23:00:51 +0200 Subject: [PATCH 0858/1135] gnu/ci: build in parallel --- util/build-gnu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index cd0f7dc39..0c511ffab 100644 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -44,7 +44,7 @@ sed -i 's|"\$@|/usr/bin/timeout 600 "\$@|' build-aux/test-driver # Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile sed -i 's| tr | /usr/bin/tr |' tests/init.sh -make +make -j "$(nproc)" # Generate the factor tests, so they can be fixed # Used to be 36. Reduced to 20 to decrease the log size for i in {00..20} From aabef14404274a7071dad8725ba7b51019b31c3b Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 3 Jun 2021 23:07:51 +0200 Subject: [PATCH 0859/1135] gnu/rm: fix tests/rm/cycle.sh --- util/build-gnu.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 0c511ffab..691598881 100644 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -110,4 +110,6 @@ grep -rl '/usr/bin//usr/bin/' tests/* | xargs --no-run-if-empty sed -i 's|/usr/b sed -i -e "s|rm: cannot remove 'e/slink'|rm: cannot remove 'e'|g" tests/rm/fail-eacces.sh +sed -i -e "s|rm: cannot remove 'a/b/file'|rm: cannot remove 'a'|g" tests/rm/cycle.sh + test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" From f421e51ad3df3b796ebf2d03ff8e099a1919ac93 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 3 Jun 2021 23:30:33 +0200 Subject: [PATCH 0860/1135] gnu/rm: fix tests/rm/rm{1,2}.sh --- util/build-gnu.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 691598881..83136e733 100644 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -112,4 +112,8 @@ sed -i -e "s|rm: cannot remove 'e/slink'|rm: cannot remove 'e'|g" tests/rm/fail- sed -i -e "s|rm: cannot remove 'a/b/file'|rm: cannot remove 'a'|g" tests/rm/cycle.sh +sed -i -e "s|rm: cannot remove directory 'b/a/p'|rm: cannot remove 'b'|g" tests/rm/rm1.sh + +sed -i -e "s|rm: cannot remove 'a/1'|rm: cannot remove 'a'|g" tests/rm/rm2.sh + test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" From f8e96150f81d20848b5285acd6b4ef95045a31d4 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 4 Jun 2021 00:49:06 +0200 Subject: [PATCH 0861/1135] fix clippy warnings and spelling * add some missing LICENSE headers --- src/uu/du/src/du.rs | 20 +++++++++++--------- src/uu/head/src/head.rs | 5 +++++ src/uu/head/src/parse.rs | 5 +++++ src/uu/od/src/od.rs | 2 +- src/uu/od/src/parse_nrofbytes.rs | 6 +++--- src/uu/sort/src/sort.rs | 2 +- src/uu/tail/src/tail.rs | 1 - src/uu/truncate/src/truncate.rs | 2 +- src/uucore/src/lib/lib.rs | 2 +- src/uucore/src/lib/parser/parse_size.rs | 4 +++- tests/by-util/test_du.rs | 5 +++++ tests/by-util/test_head.rs | 7 ++++++- tests/by-util/test_od.rs | 5 +++++ tests/by-util/test_sort.rs | 5 +++++ tests/by-util/test_split.rs | 5 +++++ tests/by-util/test_tail.rs | 7 +++++++ tests/by-util/test_truncate.rs | 7 +++++++ 17 files changed, 71 insertions(+), 19 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 25ef47af3..c2d764ebf 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -1,9 +1,9 @@ -// This file is part of the uutils coreutils package. -// -// (c) Derek Chiang -// -// For the full copyright and license information, please view the LICENSE -// file that was distributed with this source code. +// * This file is part of the uutils coreutils package. +// * +// * (c) Derek Chiang +// * +// * For the full copyright and license information, please view the LICENSE +// * file that was distributed with this source code. #[macro_use] extern crate uucore; @@ -25,6 +25,8 @@ use std::os::unix::fs::MetadataExt; use std::os::windows::fs::MetadataExt; #[cfg(windows)] use std::os::windows::io::AsRawHandle; +#[cfg(windows)] +use std::path::Path; use std::path::PathBuf; use std::time::{Duration, UNIX_EPOCH}; use uucore::parse_size::{parse_size, ParseSizeError}; @@ -161,7 +163,7 @@ fn birth_u64(meta: &Metadata) -> Option { } #[cfg(windows)] -fn get_size_on_disk(path: &PathBuf) -> u64 { +fn get_size_on_disk(path: &Path) -> u64 { let mut size_on_disk = 0; // bind file so it stays in scope until end of function @@ -193,7 +195,7 @@ fn get_size_on_disk(path: &PathBuf) -> u64 { } #[cfg(windows)] -fn get_file_info(path: &PathBuf) -> Option { +fn get_file_info(path: &Path) -> Option { let mut result = None; let file = match fs::File::open(path) { @@ -709,7 +711,7 @@ Try '{} --help' for more information.", fn format_error_message(error: ParseSizeError, s: &str, option: &str) -> String { // NOTE: // GNU's du echos affected flag, -B or --block-size (-t or --threshold), depending user's selection - // GNU's du distinguishs between "invalid (suffix in) argument" + // GNU's du does distinguish between "invalid (suffix in) argument" match error { ParseSizeError::ParseFailure(_) => format!("invalid --{} argument '{}'", option, s), ParseSizeError::SizeTooBig(_) => format!("--{} argument '{}' too large", option, s), diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index d671ed665..2c13ed37d 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -1,3 +1,8 @@ +// * This file is part of the uutils coreutils package. +// * +// * For the full copyright and license information, please view the LICENSE +// * file that was distributed with this source code. + // spell-checker:ignore (vars) zlines use clap::{crate_version, App, Arg}; diff --git a/src/uu/head/src/parse.rs b/src/uu/head/src/parse.rs index 6631dba0e..7e36594b5 100644 --- a/src/uu/head/src/parse.rs +++ b/src/uu/head/src/parse.rs @@ -1,3 +1,8 @@ +// * This file is part of the uutils coreutils package. +// * +// * For the full copyright and license information, please view the LICENSE +// * file that was distributed with this source code. + use std::ffi::OsString; use uucore::parse_size::{parse_size, ParseSizeError}; diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 080630b71..1a592f622 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -643,7 +643,7 @@ fn open_input_peek_reader( fn format_error_message(error: ParseSizeError, s: &str, option: &str) -> String { // NOTE: // GNU's od echos affected flag, -N or --read-bytes (-j or --skip-bytes, etc.), depending user's selection - // GNU's od distinguishs between "invalid (suffix in) argument" + // GNU's od does distinguish between "invalid (suffix in) argument" match error { ParseSizeError::ParseFailure(_) => format!("invalid --{} argument '{}'", option, s), ParseSizeError::SizeTooBig(_) => format!("--{} argument '{}' too large", option, s), diff --git a/src/uu/od/src/parse_nrofbytes.rs b/src/uu/od/src/parse_nrofbytes.rs index e51e15d39..d6329c60a 100644 --- a/src/uu/od/src/parse_nrofbytes.rs +++ b/src/uu/od/src/parse_nrofbytes.rs @@ -71,7 +71,7 @@ pub fn parse_number_of_bytes(s: &str) -> Result { }; factor .checked_mul(multiply) - .ok_or(ParseSizeError::SizeTooBig(s.to_string())) + .ok_or_else(|| ParseSizeError::SizeTooBig(s.to_string())) } #[test] @@ -80,12 +80,12 @@ fn test_parse_number_of_bytes() { assert_eq!(8, parse_number_of_bytes("010").unwrap()); assert_eq!(8 * 512, parse_number_of_bytes("010b").unwrap()); assert_eq!(8 * 1024, parse_number_of_bytes("010k").unwrap()); - assert_eq!(8 * 1048576, parse_number_of_bytes("010m").unwrap()); + assert_eq!(8 * 1_048_576, parse_number_of_bytes("010m").unwrap()); // hex input assert_eq!(15, parse_number_of_bytes("0xf").unwrap()); assert_eq!(15, parse_number_of_bytes("0XF").unwrap()); assert_eq!(27, parse_number_of_bytes("0x1b").unwrap()); assert_eq!(16 * 1024, parse_number_of_bytes("0x10k").unwrap()); - assert_eq!(16 * 1048576, parse_number_of_bytes("0x10m").unwrap()); + assert_eq!(16 * 1_048_576, parse_number_of_bytes("0x10m").unwrap()); } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index fca974dbd..9ec90519f 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1567,7 +1567,7 @@ fn open(path: impl AsRef) -> Box { fn format_error_message(error: ParseSizeError, s: &str, option: &str) -> String { // NOTE: // GNU's sort echos affected flag, -S or --buffer-size, depending user's selection - // GNU's sort distinguishs between "invalid (suffix in) argument" + // GNU's sort does distinguish between "invalid (suffix in) argument" match error { ParseSizeError::ParseFailure(_) => format!("invalid --{} argument '{}'", option, s), ParseSizeError::SizeTooBig(_) => format!("--{} argument '{}' too large", option, s), diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 76c799621..75cc43db1 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -5,7 +5,6 @@ // * // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// * // spell-checker:ignore (ToDO) seekable seek'd tail'ing ringbuffer ringbuf diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 78167ed77..8f02be874 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -152,7 +152,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { crash!( 1, "cannot stat '{}': No such file or directory", - reference.unwrap_or("".to_string()) + reference.unwrap_or_else(|| "".to_string()) ); // TODO: fix '--no-create' see test_reference and test_truncate_bytes_size } _ => crash!(1, "{}", e.to_string()), diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 84adeeb34..f765b7b3e 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -22,7 +22,7 @@ pub extern crate winapi; mod features; // feature-gated code modules mod macros; // crate macros (macro_rules-type; exported to `crate::...`) mod mods; // core cross-platform modules -mod parser; // string parsing moduls +mod parser; // string parsing modules // * cross-platform modules pub use crate::mods::backup_control; diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index 12c410e57..58213adef 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -3,6 +3,8 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. +// spell-checker:ignore (ToDO) hdsf ghead gtail + use std::convert::TryFrom; use std::error::Error; use std::fmt; @@ -77,7 +79,7 @@ pub fn parse_size(size: &str) -> Result { }; number .checked_mul(factor) - .ok_or(ParseSizeError::size_too_big(size)) + .ok_or_else(|| ParseSizeError::size_too_big(size)) } #[derive(Debug, PartialEq, Eq)] diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index 2c656ced5..e4dd95ae1 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -1,3 +1,8 @@ +// * This file is part of the uutils coreutils package. +// * +// * For the full copyright and license information, please view the LICENSE +// * file that was distributed with this source code. + // spell-checker:ignore (paths) sublink subwords use crate::common::util::*; diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index 6a2cdf1cd..2c4b66696 100755 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -1,4 +1,9 @@ -// spell-checker:ignore (words) bogusfile emptyfile +// * This file is part of the uutils coreutils package. +// * +// * For the full copyright and license information, please view the LICENSE +// * file that was distributed with this source code. + +// spell-checker:ignore (words) bogusfile emptyfile abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstu use crate::common::util::*; diff --git a/tests/by-util/test_od.rs b/tests/by-util/test_od.rs index 3d34e47a1..53b471dba 100644 --- a/tests/by-util/test_od.rs +++ b/tests/by-util/test_od.rs @@ -1,3 +1,8 @@ +// * This file is part of the uutils coreutils package. +// * +// * For the full copyright and license information, please view the LICENSE +// * file that was distributed with this source code. + extern crate unindent; use self::unindent::*; diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 204145719..3d1cfe120 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -1,3 +1,8 @@ +// * This file is part of the uutils coreutils package. +// * +// * For the full copyright and license information, please view the LICENSE +// * file that was distributed with this source code. + // spell-checker:ignore (words) ints use crate::common::util::*; diff --git a/tests/by-util/test_split.rs b/tests/by-util/test_split.rs index 53b545200..a1350534f 100644 --- a/tests/by-util/test_split.rs +++ b/tests/by-util/test_split.rs @@ -1,3 +1,8 @@ +// * This file is part of the uutils coreutils package. +// * +// * For the full copyright and license information, please view the LICENSE +// * file that was distributed with this source code. + extern crate rand; extern crate regex; diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index c296e2763..8478944e2 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -1,3 +1,10 @@ +// * This file is part of the uutils coreutils package. +// * +// * For the full copyright and license information, please view the LICENSE +// * file that was distributed with this source code. + +// spell-checker:ignore (ToDO) abcdefghijklmnopqrstuvwxyz efghijklmnopqrstuvwxyz vwxyz emptyfile + extern crate tail; use crate::common::util::*; diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index 72f7f780b..2da59035e 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -1,3 +1,10 @@ +// * This file is part of the uutils coreutils package. +// * +// * For the full copyright and license information, please view the LICENSE +// * file that was distributed with this source code. + +// spell-checker:ignore (words) RFILE + use crate::common::util::*; use std::io::{Seek, SeekFrom, Write}; From acd290d11f3351a342e67e351d38792ffd725286 Mon Sep 17 00:00:00 2001 From: Dean Li Date: Wed, 2 Jun 2021 21:40:47 +0800 Subject: [PATCH 0862/1135] more: fix unicode bug for breakline - Use `unicode_segmentation` and `unicode_width` to determine proper `break_line` position. - Keep track of total_width as suggested by @tertsdiepraam. - Add unittest for ZWJ unicode case Related to #2319. --- Cargo.lock | 2 ++ src/uu/more/Cargo.toml | 2 ++ src/uu/more/src/more.rs | 62 ++++++++++++++++++++++++++++++----------- 3 files changed, 50 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 17fa9e2b7..3778db34c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2204,6 +2204,8 @@ dependencies = [ "nix 0.13.1", "redox_syscall 0.1.57", "redox_termios", + "unicode-segmentation", + "unicode-width", "uucore", "uucore_procs", ] diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index 9b1a3d7b6..b3b97e6dd 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -20,6 +20,8 @@ uucore = { version = ">=0.0.7", package = "uucore", path = "../../uucore" } uucore_procs = { version = ">=0.0.5", package = "uucore_procs", path = "../../uucore_procs" } crossterm = ">=0.19" atty = "0.2.14" +unicode-width = "0.1.7" +unicode-segmentation = "1.7.1" [target.'cfg(target_os = "redox")'.dependencies] redox_termios = "0.1" diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 482c5491d..2e6771705 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -29,6 +29,9 @@ use crossterm::{ terminal, }; +use unicode_segmentation::UnicodeSegmentation; +use unicode_width::UnicodeWidthStr; + pub mod options { pub const SILENT: &str = "silent"; pub const LOGICAL: &str = "logical"; @@ -313,23 +316,30 @@ fn break_buff(buff: &str, cols: usize) -> Vec { lines } -fn break_line(mut line: &str, cols: usize) -> Vec { - let breaks = (line.len() / cols).saturating_add(1); - let mut lines = Vec::with_capacity(breaks); - // TODO: Use unicode width instead of the length in bytes. - if line.len() < cols { +fn break_line(line: &str, cols: usize) -> Vec { + let width = UnicodeWidthStr::width(line); + let mut lines = Vec::new(); + if width < cols { lines.push(line.to_string()); return lines; } - for _ in 1..=breaks { - let (line1, line2) = line.split_at(cols); - lines.push(line1.to_string()); - if line2.len() < cols { - lines.push(line2.to_string()); - break; + let gr_idx = UnicodeSegmentation::grapheme_indices(line, true); + let mut last_index = 0; + let mut total_width = 0; + for (index, grapheme) in gr_idx { + let width = UnicodeWidthStr::width(grapheme); + total_width += width; + + if total_width > cols { + lines.push(line[last_index..index].to_string()); + last_index = index; + total_width = width; } - line = line2; + } + + if last_index != line.len() { + lines.push(line[last_index..].to_string()); } lines } @@ -363,6 +373,7 @@ fn make_prompt_and_flush(stdout: &mut Stdout, lower_mark: u16, lc: u16) { #[cfg(test)] mod tests { use super::{break_line, calc_range}; + use unicode_width::UnicodeWidthStr; // It is good to test the above functions #[test] @@ -379,11 +390,12 @@ mod tests { } let lines = break_line(&test_string, 80); + let widths: Vec = lines + .iter() + .map(|s| UnicodeWidthStr::width(&s[..])) + .collect(); - assert_eq!( - (80, 80, 40), - (lines[0].len(), lines[1].len(), lines[2].len()) - ); + assert_eq!((80, 80, 40), (widths[0], widths[1], widths[2])); } #[test] @@ -397,4 +409,22 @@ mod tests { assert_eq!(20, lines[0].len()); } + + #[test] + fn test_break_line_zwj() { + let mut test_string = String::with_capacity(1100); + for _ in 0..20 { + test_string.push_str("👩🏻‍🔬"); + } + + let lines = break_line(&test_string, 80); + + let widths: Vec = lines + .iter() + .map(|s| UnicodeWidthStr::width(&s[..])) + .collect(); + + // Each 👩🏻‍🔬 is 6 character width it break line to the closest number to 80 => 6 * 13 = 78 + assert_eq!((78, 42), (widths[0], widths[1])); + } } From b7061d1817e55db3322a5a8a52f2010667288543 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Fri, 4 Jun 2021 16:29:32 +0200 Subject: [PATCH 0863/1135] README: Cleanup utility list In PR #2300 an old commit got merged putting back utilities that were already implemented into "To Do". This commit reverts this. In addition it moves `numfmt` to Semi-Done and sorts the Semi-Done column alphabetically. This should now be the up-to-date list of utilities. There are 96 utilities in Done or Semi-Done and `ls -1 src/uu | wc -l` also outputs 96. --- README.md | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index fde01d64a..fd8709b64 100644 --- a/README.md +++ b/README.md @@ -342,22 +342,22 @@ To contribute to uutils, please see [CONTRIBUTING](CONTRIBUTING.md). | Done | Semi-Done | To Do | |-----------|-----------|--------| | arch | cp | chcon | -| base32 | expr | csplit | -| base64 | install | dd | -| basename | ls | df | -| cat | more | numfmt | -| chgrp | od (`--strings` and 128-bit data types missing) | runcon | -| chmod | printf | stty | -| chown | sort | | -| chroot | split | | -| cksum | tail | | -| comm | test | | -| csplit | date | | -| cut | join | | -| dircolors | df | | +| base32 | date | dd | +| base64 | df | runcon | +| basename | expr | stty | +| 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 | pr | | -| echo | | | +| du | tail | | +| echo | test | | | env | | | | expand | | | | factor | | | @@ -374,12 +374,12 @@ To contribute to uutils, please see [CONTRIBUTING](CONTRIBUTING.md). | link | | | | ln | | | | logname | | | -| ~~md5sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/uu/hashsum/src/hashsum.rs)) | | -| ~~sha1sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/uu/hashsum/src/hashsum.rs)) | | -| ~~sha224sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/uu/hashsum/src/hashsum.rs)) | | -| ~~sha256sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/uu/hashsum/src/hashsum.rs)) | | -| ~~sha384sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/uu/hashsum/src/hashsum.rs)) | | -| ~~sha512sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/uu/hashsum/src/hashsum.rs)) | | +| ~~md5sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/uu/hashsum/src/hashsum.rs)) | | | +| ~~sha1sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/uu/hashsum/src/hashsum.rs)) | | | +| ~~sha224sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/uu/hashsum/src/hashsum.rs)) | | | +| ~~sha256sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/uu/hashsum/src/hashsum.rs)) | | | +| ~~sha384sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/uu/hashsum/src/hashsum.rs)) | | | +| ~~sha512sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/uu/hashsum/src/hashsum.rs)) | | | | mkdir | | | | mkfifo | | | | mknod | | | From 81e07a6a4dc829bd57b2527b50048cc3f8a5e61c Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 4 Jun 2021 17:22:45 +0200 Subject: [PATCH 0864/1135] od: replace 'piped_stdin' to make test stable --- tests/by-util/test_od.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/by-util/test_od.rs b/tests/by-util/test_od.rs index 53b471dba..33d7d4dc4 100644 --- a/tests/by-util/test_od.rs +++ b/tests/by-util/test_od.rs @@ -815,7 +815,10 @@ fn test_od_invalid_bytes() { const INVALID_SIZE: &str = "1fb4t"; const BIG_SIZE: &str = "1Y"; - let input: [u8; 8] = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; + // NOTE: + // GNU's od (8.32) with option '--width' does not accept 'Y' as valid suffix. + // According to the man page it should be valid in the same way it is valid for + // '--read-bytes' and '--skip-bytes'. let options = [ "--read-bytes", @@ -826,8 +829,8 @@ fn test_od_invalid_bytes() { for option in &options { new_ucmd!() .arg(format!("{}={}", option, INVALID_SIZE)) - .run_piped_stdin(&input[..]) - .failure() + .arg("file") + .fails() .code_is(1) .stderr_only(format!( "od: invalid {} argument '{}'", @@ -837,8 +840,8 @@ fn test_od_invalid_bytes() { #[cfg(not(target_pointer_width = "128"))] new_ucmd!() .arg(format!("{}={}", option, BIG_SIZE)) - .run_piped_stdin(&input[..]) - .failure() + .arg("file") + .fails() .code_is(1) .stderr_only(format!("od: {} argument '{}' too large", option, BIG_SIZE)); } From 14303c524fa744ad824155925fc764209a4f4976 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 4 Jun 2021 23:55:24 +0200 Subject: [PATCH 0865/1135] gnu/rm: make another test pass --- util/build-gnu.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 83136e733..1ffde8311 100644 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -116,4 +116,6 @@ sed -i -e "s|rm: cannot remove directory 'b/a/p'|rm: cannot remove 'b'|g" tests/ sed -i -e "s|rm: cannot remove 'a/1'|rm: cannot remove 'a'|g" tests/rm/rm2.sh +sed -i -e "s|removed directory 'a/'|removed directory 'a'|g" tests/rm/v-slash.sh + test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" From 285b27c9b311e92833d310c33b77cf617ebc9623 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 5 Jun 2021 11:04:42 +0200 Subject: [PATCH 0866/1135] du: add --app as alias of --apparent-size to match GNU --- src/uu/du/src/du.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index a46f74100..c5fff2ed7 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -431,6 +431,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { although the apparent size is usually smaller, it may be larger due to holes \ in ('sparse') files, internal fragmentation, indirect blocks, and the like" ) + .alias("app") // The GNU testsuite uses this alias ) .arg( Arg::with_name(options::BLOCK_SIZE) From 420e9322eac301906ea87bb03a3a9304ebb5f846 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 5 Jun 2021 14:07:09 +0200 Subject: [PATCH 0867/1135] more: do not accidentically hide last line --- src/uu/more/src/more.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 27829d577..d37dd46f4 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -349,7 +349,7 @@ fn calc_range(mut upper_mark: u16, rows: u16, line_count: u16) -> (u16, u16) { let mut lower_mark = upper_mark.saturating_add(rows); if lower_mark >= line_count { - upper_mark = line_count.saturating_sub(rows); + upper_mark = line_count.saturating_sub(rows).saturating_add(1); lower_mark = line_count; } else { lower_mark = lower_mark.saturating_sub(1) From 2760efb01de4f135287ca3763c6e16f547e1f82e Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 5 Jun 2021 14:42:43 +0200 Subject: [PATCH 0868/1135] more: fix test --- src/uu/more/src/more.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index d37dd46f4..c1df9afa0 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -380,7 +380,7 @@ mod tests { fn test_calc_range() { assert_eq!((0, 24), calc_range(0, 25, 100)); assert_eq!((50, 74), calc_range(50, 25, 100)); - assert_eq!((75, 100), calc_range(85, 25, 100)); + assert_eq!((76, 100), calc_range(85, 25, 100)); } #[test] fn test_break_lines_long() { From 74a7da7b527a8942c45efd7b40c7be0f032bc85d Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sat, 5 Jun 2021 19:56:20 +0200 Subject: [PATCH 0869/1135] id: clean-up of clap options and usage/help text * add conflicts_with for '-G' * add required flags for '-r' and '-n' * add usage/help texts from BSD's `id` --- src/uu/id/src/id.rs | 99 +++++++++++++++++++++++++++------------------ 1 file changed, 59 insertions(+), 40 deletions(-) diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index 77b185f24..b32988ebc 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -9,6 +9,10 @@ // Synced with: // http://ftp-archive.freebsd.org/mirror/FreeBSD-Archive/old-releases/i386/1.0-RELEASE/ports/shellutils/src/id.c // http://www.opensource.apple.com/source/shell_cmds/shell_cmds-118/id/id.c +// +// This is not based on coreutils (8.32) GNU's `id`. +// This is based on BSD's `id` (noticeable in functionality, usage text, options text, etc.) +// // spell-checker:ignore (ToDO) asid auditid auditinfo auid cstr egid emod euid getaudit getlogin gflag nflag pline rflag termid uflag @@ -70,18 +74,19 @@ mod audit { } } -static ABOUT: &str = "Display user and group information for the specified USER,\n or (when USER omitted) for the current user."; +static ABOUT: &str = "The id utility displays the user and group names and numeric IDs, of the calling process, to the standard output. If the real and effective IDs are different, both are displayed, otherwise only the real ID is displayed.\n\nIf a user (login name or user ID) is specified, the user and group IDs of that user are displayed. In this case, the real and effective IDs are assumed to be the same."; -static OPT_AUDIT: &str = "audit"; -static OPT_EFFECTIVE_USER: &str = "effective-user"; -static OPT_GROUP: &str = "group"; -static OPT_GROUPS: &str = "groups"; -static OPT_HUMAN_READABLE: &str = "human-readable"; -static OPT_NAME: &str = "name"; -static OPT_PASSWORD: &str = "password"; -static OPT_REAL_ID: &str = "real-id"; - -static ARG_USERS: &str = "users"; +mod options { + pub const OPT_AUDIT: &str = "audit"; // GNU's id does not have this + pub const OPT_EFFECTIVE_USER: &str = "user"; + pub const OPT_GROUP: &str = "group"; + pub const OPT_GROUPS: &str = "groups"; + pub const OPT_HUMAN_READABLE: &str = "human-readable"; // GNU's id does not have this + pub const OPT_NAME: &str = "name"; + pub const OPT_PASSWORD: &str = "password"; // GNU's id does not have this + pub const OPT_REAL_ID: &str = "real"; + pub const ARG_USERS: &str = "USER"; +} fn get_usage() -> String { format!("{0} [OPTION]... [USER]", executable!()) @@ -95,57 +100,76 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .arg( - Arg::with_name(OPT_AUDIT) + Arg::with_name(options::OPT_AUDIT) .short("A") - .help("Display the process audit (not available on Linux)"), + .help("Display the process audit user ID and other process audit properties, which requires privilege (not available on Linux)."), ) .arg( - Arg::with_name(OPT_EFFECTIVE_USER) + Arg::with_name(options::OPT_EFFECTIVE_USER) .short("u") - .long("user") - .help("Display the effective user ID as a number"), + .long(options::OPT_EFFECTIVE_USER) + .help("Display the effective user ID as a number."), ) .arg( - Arg::with_name(OPT_GROUP) + Arg::with_name(options::OPT_GROUP) .short("g") - .long(OPT_GROUP) + .long(options::OPT_GROUP) .help("Display the effective group ID as a number"), ) .arg( - Arg::with_name(OPT_GROUPS) + Arg::with_name(options::OPT_GROUPS) .short("G") - .long(OPT_GROUPS) - .help("Display the different group IDs"), + .long(options::OPT_GROUPS) + .conflicts_with_all(&[options::OPT_GROUP, options::OPT_EFFECTIVE_USER, options::OPT_HUMAN_READABLE, options::OPT_PASSWORD, options::OPT_AUDIT]) + .help("Display the different group IDs as white-space separated numbers, in no particular order."), ) .arg( - Arg::with_name(OPT_HUMAN_READABLE) + Arg::with_name(options::OPT_HUMAN_READABLE) .short("p") - .help("Make the output human-readable"), + .help("Make the output human-readable. Each display is on a separate line."), ) .arg( - Arg::with_name(OPT_NAME) + Arg::with_name(options::OPT_NAME) .short("n") - .help("Display the name of the user or group ID for the -G, -g and -u options"), + .long(options::OPT_NAME) + .help("Display the name of the user or group ID for the -G, -g and -u options instead of the number. If any of the ID numbers cannot be mapped into names, the number will be displayed as usual."), ) .arg( - Arg::with_name(OPT_PASSWORD) + Arg::with_name(options::OPT_PASSWORD) .short("P") - .help("Display the id as a password file entry"), + .help("Display the id as a password file entry."), ) .arg( - Arg::with_name(OPT_REAL_ID) + Arg::with_name(options::OPT_REAL_ID) .short("r") - .help("Display the real ID for the -g and -u options"), + .long(options::OPT_REAL_ID) + .help("Display the real ID for the -g and -u options instead of the effective ID."), + ) + .arg( + Arg::with_name(options::ARG_USERS) + .multiple(true) + .takes_value(true) + .value_name(options::ARG_USERS), ) - .arg(Arg::with_name(ARG_USERS).multiple(true).takes_value(true)) .get_matches_from(args); + let nflag = matches.is_present(options::OPT_NAME); + let uflag = matches.is_present(options::OPT_EFFECTIVE_USER); + let gflag = matches.is_present(options::OPT_GROUP); + let gsflag = matches.is_present(options::OPT_GROUPS); + let rflag = matches.is_present(options::OPT_REAL_ID); + + // -ugG + if (nflag || rflag) && !(uflag || gflag || gsflag) { + crash!(1, "cannot print only names or real IDs in default format"); + } + let users: Vec = matches - .values_of(ARG_USERS) + .values_of(options::ARG_USERS) .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); - if matches.is_present(OPT_AUDIT) { + if matches.is_present(options::OPT_AUDIT) { auditid(); return 0; } @@ -159,11 +183,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } }; - let nflag = matches.is_present(OPT_NAME); - let uflag = matches.is_present(OPT_EFFECTIVE_USER); - let gflag = matches.is_present(OPT_GROUP); - let rflag = matches.is_present(OPT_REAL_ID); - if gflag { let id = possible_pw .map(|p| p.gid()) @@ -194,7 +213,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return 0; } - if matches.is_present(OPT_GROUPS) { + if gsflag { println!( "{}", if nflag { @@ -218,12 +237,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return 0; } - if matches.is_present(OPT_PASSWORD) { + if matches.is_present(options::OPT_PASSWORD) { pline(possible_pw.map(|v| v.uid())); return 0; }; - if matches.is_present(OPT_HUMAN_READABLE) { + if matches.is_present(options::OPT_HUMAN_READABLE) { pretty(possible_pw); return 0; } From b9fe76ab92b39ea0a4b009277184f151a86cf6ce Mon Sep 17 00:00:00 2001 From: Dean Li Date: Sat, 5 Jun 2021 22:33:30 +0800 Subject: [PATCH 0870/1135] more: Show next file at bottom line Implement feature requested in #2318. --- src/uu/more/src/more.rs | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 27829d577..4f5b95a48 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -143,7 +143,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if let Some(files) = matches.values_of(options::FILES) { let mut stdout = setup_term(); let length = files.len(); - for (idx, file) in files.enumerate() { + + let mut files_iter = files.peekable(); + while let (Some(file), next_file) = (files_iter.next(), files_iter.peek()) { let file = Path::new(file); if file.is_dir() { terminal::disable_raw_mode().unwrap(); @@ -160,15 +162,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } let mut reader = BufReader::new(File::open(file).unwrap()); reader.read_to_string(&mut buff).unwrap(); - let is_last = idx + 1 == length; - more(&buff, &mut stdout, is_last); + more(&buff, &mut stdout, next_file.copied()); buff.clear(); } reset_term(&mut stdout); } else if atty::isnt(atty::Stream::Stdin) { stdin().read_to_string(&mut buff).unwrap(); let mut stdout = setup_term(); - more(&buff, &mut stdout, true); + more(&buff, &mut stdout, None); reset_term(&mut stdout); } else { show_usage_error!("bad usage"); @@ -203,7 +204,7 @@ fn reset_term(stdout: &mut std::io::Stdout) { #[inline(always)] fn reset_term(_: &mut usize) {} -fn more(buff: &str, mut stdout: &mut Stdout, is_last: bool) { +fn more(buff: &str, mut stdout: &mut Stdout, next_file: Option<&str>) { let (cols, rows) = terminal::size().unwrap(); let lines = break_buff(buff, usize::from(cols)); let line_count: u16 = lines.len().try_into().unwrap(); @@ -217,8 +218,11 @@ fn more(buff: &str, mut stdout: &mut Stdout, is_last: bool) { &mut stdout, lines.clone(), line_count, + next_file, ); + let is_last = next_file.is_none(); + // Specifies whether we have reached the end of the file and should // return on the next key press. However, we immediately return when // this is the last file. @@ -270,6 +274,7 @@ fn more(buff: &str, mut stdout: &mut Stdout, is_last: bool) { &mut stdout, lines.clone(), line_count, + next_file, ); if lines_left == 0 { @@ -288,6 +293,7 @@ fn draw( mut stdout: &mut std::io::Stdout, lines: Vec, lc: u16, + next_file: Option<&str>, ) { execute!(stdout, terminal::Clear(terminal::ClearType::CurrentLine)).unwrap(); let (up_mark, lower_mark) = calc_range(*upper_mark, rows, lc); @@ -302,7 +308,7 @@ fn draw( .write_all(format!("\r{}\n", line).as_bytes()) .unwrap(); } - make_prompt_and_flush(&mut stdout, lower_mark, lc); + make_prompt_and_flush(&mut stdout, lower_mark, lc, next_file); *upper_mark = up_mark; } @@ -358,12 +364,20 @@ fn calc_range(mut upper_mark: u16, rows: u16, line_count: u16) -> (u16, u16) { } // Make a prompt similar to original more -fn make_prompt_and_flush(stdout: &mut Stdout, lower_mark: u16, lc: u16) { +fn make_prompt_and_flush(stdout: &mut Stdout, lower_mark: u16, lc: u16, next_file: Option<&str>) { + let status = if lower_mark == lc { + format!("Next file: {}", next_file.unwrap_or_default()) + } else { + format!( + "{}%", + (lower_mark as f64 / lc as f64 * 100.0).round() as u16 + ) + }; write!( stdout, - "\r{}--More--({}%){}", + "\r{}--More--({}){}", Attribute::Reverse, - ((lower_mark as f64 / lc as f64) * 100.0).round() as u16, + status, Attribute::Reset ) .unwrap(); From 7f07bd82d4ee7095e902ce1016e94d96c437f3d9 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 6 Jun 2021 13:25:44 +0200 Subject: [PATCH 0871/1135] hashsum: document how to benchmark blake2 --- src/uu/hashsum/BENCHMARKING.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/uu/hashsum/BENCHMARKING.md diff --git a/src/uu/hashsum/BENCHMARKING.md b/src/uu/hashsum/BENCHMARKING.md new file mode 100644 index 000000000..cef710a19 --- /dev/null +++ b/src/uu/hashsum/BENCHMARKING.md @@ -0,0 +1,9 @@ +## Benchmarking hashsum + +### To bench blake2 + +Taken from: https://github.com/uutils/coreutils/pull/2296 + +With a large file: +$ hyperfine "./target/release/coreutils hashsum --b2sum large-file" "b2sum large-file" + From 7e41b58845dc887409ad66803f31ac480a0de927 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 6 Jun 2021 13:38:48 +0200 Subject: [PATCH 0872/1135] ride along: refresh cargo.lock --- Cargo.lock | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9c3aae831..43d491cef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,12 +43,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "array-init" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6945cc5422176fc5e602e590c2878d2c2acd9a4fe20a4baa7c28022521698ec6" - [[package]] name = "arrayref" version = "0.3.6" @@ -710,9 +704,9 @@ checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" [[package]] name = "heck" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" dependencies = [ "unicode-segmentation", ] @@ -1393,12 +1387,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -dependencies = [ - "byteorder", -] +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" [[package]] name = "regex-syntax" @@ -1511,9 +1502,9 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" dependencies = [ "libc", ] From 2dd6824e7628d9d3fad77ed44d57654cb45ef6d4 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sun, 6 Jun 2021 11:29:32 +0200 Subject: [PATCH 0873/1135] sort: never use a bigger buffer than requested A min buffer size of 8KB makes sense in practice, but decreases testability. --- src/uu/sort/src/ext_sort.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs index 9b1845efa..d344df428 100644 --- a/src/uu/sort/src/ext_sort.rs +++ b/src/uu/sort/src/ext_sort.rs @@ -30,7 +30,7 @@ use crate::{ compare_by, merge, output_sorted_lines, sort_by, GlobalSettings, }; -const MIN_BUFFER_SIZE: usize = 8_000; +const START_BUFFER_SIZE: usize = 8_000; /// Sort files by using auxiliary files for storing intermediate chunks (if needed), and output the result. pub fn ext_sort(files: &mut impl Iterator>, settings: &GlobalSettings) { @@ -132,7 +132,14 @@ fn reader_writer( for _ in 0..2 { chunks::read( &mut sender_option, - vec![0; MIN_BUFFER_SIZE], + vec![ + 0; + if START_BUFFER_SIZE < buffer_size { + START_BUFFER_SIZE + } else { + buffer_size + } + ], Some(buffer_size), &mut carry_over, &mut file, From 66359a0f564561edcba6ce154c7536a1cba7869e Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sun, 6 Jun 2021 11:31:42 +0200 Subject: [PATCH 0874/1135] sort: insert line separators after non-empty files If files don't end witht a line separator we have to insert one, otherwise the last line will be combined with the first line of the next file. --- src/uu/sort/src/chunks.rs | 20 +++++++++++++++++--- tests/by-util/test_sort.rs | 8 ++++++++ tests/fixtures/sort/no_trailing_newline1.txt | 2 ++ tests/fixtures/sort/no_trailing_newline2.txt | 1 + 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 tests/fixtures/sort/no_trailing_newline1.txt create mode 100644 tests/fixtures/sort/no_trailing_newline2.txt diff --git a/src/uu/sort/src/chunks.rs b/src/uu/sort/src/chunks.rs index 23567833b..3705f2cf7 100644 --- a/src/uu/sort/src/chunks.rs +++ b/src/uu/sort/src/chunks.rs @@ -175,6 +175,7 @@ fn read_to_buffer( separator: u8, ) -> (usize, bool) { let mut read_target = &mut buffer[start_offset..]; + let mut last_file_target_size = read_target.len(); loop { match file.read(read_target) { Ok(0) => { @@ -208,14 +209,27 @@ fn read_to_buffer( read_target = &mut buffer[len..]; } } else { - // This file is empty. + // This file has been fully read. + let mut leftover_len = read_target.len(); + if last_file_target_size != leftover_len { + // The file was not empty. + let read_len = buffer.len() - leftover_len; + if buffer[read_len - 1] != separator { + // The file did not end with a separator. We have to insert one. + buffer[read_len] = separator; + leftover_len -= 1; + } + let read_len = buffer.len() - leftover_len; + read_target = &mut buffer[read_len..]; + } if let Some(next_file) = next_files.next() { // There is another file. + last_file_target_size = leftover_len; *file = next_file; } else { // This was the last file. - let leftover_len = read_target.len(); - return (buffer.len() - leftover_len, false); + let read_len = buffer.len() - leftover_len; + return (read_len, false); } } } diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 02636b027..97127b995 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -792,3 +792,11 @@ fn test_nonexistent_file() { fn test_blanks() { test_helper("blanks", &["-b", "--ignore-blanks"]); } + +#[test] +fn sort_multiple() { + new_ucmd!() + .args(&["no_trailing_newline1.txt", "no_trailing_newline2.txt"]) + .succeeds() + .stdout_is("a\nb\nb\n"); +} diff --git a/tests/fixtures/sort/no_trailing_newline1.txt b/tests/fixtures/sort/no_trailing_newline1.txt new file mode 100644 index 000000000..0a207c060 --- /dev/null +++ b/tests/fixtures/sort/no_trailing_newline1.txt @@ -0,0 +1,2 @@ +a +b \ No newline at end of file diff --git a/tests/fixtures/sort/no_trailing_newline2.txt b/tests/fixtures/sort/no_trailing_newline2.txt new file mode 100644 index 000000000..63d8dbd40 --- /dev/null +++ b/tests/fixtures/sort/no_trailing_newline2.txt @@ -0,0 +1 @@ +b \ No newline at end of file From 5a5c7c5a346ca0971f7f42ce216cafbb8ae8f334 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sun, 6 Jun 2021 11:33:22 +0200 Subject: [PATCH 0875/1135] sort: properly check for empty reads --- src/uu/sort/src/chunks.rs | 22 +++++++++++----------- tests/by-util/test_sort.rs | 9 +++++++++ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/uu/sort/src/chunks.rs b/src/uu/sort/src/chunks.rs index 3705f2cf7..dde6febd3 100644 --- a/src/uu/sort/src/chunks.rs +++ b/src/uu/sort/src/chunks.rs @@ -102,17 +102,17 @@ pub fn read( carry_over.clear(); carry_over.extend_from_slice(&buffer[read..]); - let payload = Chunk::new(buffer, |buf| { - let mut lines = unsafe { - // SAFETY: It is safe to transmute to a vector of lines with shorter lifetime, - // because it was only temporarily transmuted to a Vec> to make recycling possible. - std::mem::transmute::>, Vec>>(lines) - }; - let read = crash_if_err!(1, std::str::from_utf8(&buf[..read])); - parse_lines(read, &mut lines, separator, &settings); - lines - }); - if !payload.borrow_lines().is_empty() { + if read != 0 { + let payload = Chunk::new(buffer, |buf| { + let mut lines = unsafe { + // SAFETY: It is safe to transmute to a vector of lines with shorter lifetime, + // because it was only temporarily transmuted to a Vec> to make recycling possible. + std::mem::transmute::>, Vec>>(lines) + }; + let read = crash_if_err!(1, std::str::from_utf8(&buf[..read])); + parse_lines(read, &mut lines, separator, &settings); + lines + }); sender.send(payload).unwrap(); } if !should_continue { diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 97127b995..d100e2141 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -800,3 +800,12 @@ fn sort_multiple() { .succeeds() .stdout_is("a\nb\nb\n"); } + +#[test] +fn sort_empty_chunk() { + new_ucmd!() + .args(&["-S", "40B"]) + .pipe_in("a\na\n") + .succeeds() + .stdout_is("a\na\n"); +} From 8d213219c7c4120bf70c926d79fe517b2daf1b29 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sun, 6 Jun 2021 12:07:06 +0200 Subject: [PATCH 0876/1135] sort: implement --compress-program --- src/uu/sort/src/ext_sort.rs | 75 ++++++++++++++++++++++++++++++++----- src/uu/sort/src/merge.rs | 10 +++-- src/uu/sort/src/sort.rs | 14 ++++++- tests/by-util/test_sort.rs | 31 +++++++++++++++ 4 files changed, 115 insertions(+), 15 deletions(-) diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs index d344df428..2d8513e9f 100644 --- a/src/uu/sort/src/ext_sort.rs +++ b/src/uu/sort/src/ext_sort.rs @@ -12,8 +12,12 @@ //! The buffers for the individual chunks are recycled. There are two buffers. use std::cmp::Ordering; +use std::fs::File; +use std::io::BufReader; use std::io::{BufWriter, Write}; use std::path::Path; +use std::process::Child; +use std::process::{Command, Stdio}; use std::{ fs::OpenOptions, io::Read, @@ -25,6 +29,7 @@ use itertools::Itertools; use tempfile::TempDir; +use crate::Line; use crate::{ chunks::{self, Chunk}, compare_by, merge, output_sorted_lines, sort_by, GlobalSettings, @@ -63,10 +68,31 @@ pub fn ext_sort(files: &mut impl Iterator>, settings ); match read_result { ReadResult::WroteChunksToFile { chunks_written } => { - let files = (0..chunks_written) - .map(|chunk_num| tmp_dir.path().join(chunk_num.to_string())) - .collect::>(); - let mut merger = merge::merge(&files, settings); + let mut children = Vec::new(); + let files = (0..chunks_written).map(|chunk_num| { + let file_path = tmp_dir.path().join(chunk_num.to_string()); + let file = File::open(file_path).unwrap(); + if let Some(compress_prog) = &settings.compress_prog { + let mut command = Command::new(compress_prog); + command.stdin(file).stdout(Stdio::piped()).arg("-d"); + let mut child = crash_if_err!( + 2, + command.spawn().map_err(|err| format!( + "couldn't execute compress program: errno {}", + err.raw_os_error().unwrap() + )) + ); + let child_stdout = child.stdout.take().unwrap(); + children.push(child); + Box::new(BufReader::new(child_stdout)) as Box + } else { + Box::new(BufReader::new(file)) as Box + } + }); + let mut merger = merge::merge(files, settings); + for child in children { + assert_child_success(child, settings.compress_prog.as_ref().unwrap()); + } merger.write_all(settings); } ReadResult::SortedSingleChunk(chunk) => { @@ -178,6 +204,7 @@ fn reader_writer( write( &mut chunk, &tmp_dir.path().join(file_number.to_string()), + settings.compress_prog.as_deref(), separator, ); @@ -200,14 +227,42 @@ fn reader_writer( } /// Write the lines in `chunk` to `file`, separated by `separator`. -fn write(chunk: &mut Chunk, file: &Path, separator: u8) { +/// `compress_prog` is used to optionally compress file contents. +fn write(chunk: &mut Chunk, file: &Path, compress_prog: Option<&str>, separator: u8) { chunk.with_lines_mut(|lines| { // Write the lines to the file let file = crash_if_err!(1, OpenOptions::new().create(true).write(true).open(file)); - let mut writer = BufWriter::new(file); - for s in lines.iter() { - crash_if_err!(1, writer.write_all(s.line.as_bytes())); - crash_if_err!(1, writer.write_all(&[separator])); - } + if let Some(compress_prog) = compress_prog { + let mut command = Command::new(compress_prog); + command.stdin(Stdio::piped()).stdout(file); + let mut child = crash_if_err!( + 2, + command.spawn().map_err(|err| format!( + "couldn't execute compress program: errno {}", + err.raw_os_error().unwrap() + )) + ); + let mut writer = BufWriter::new(child.stdin.take().unwrap()); + write_lines(lines, &mut writer, separator); + writer.flush().unwrap(); + drop(writer); + assert_child_success(child, compress_prog); + } else { + let mut writer = BufWriter::new(file); + write_lines(lines, &mut writer, separator); + }; }); } + +fn write_lines<'a, T: Write>(lines: &[Line<'a>], writer: &mut T, separator: u8) { + for s in lines { + crash_if_err!(1, writer.write_all(s.line.as_bytes())); + crash_if_err!(1, writer.write_all(&[separator])); + } +} + +fn assert_child_success(mut child: Child, program: &str) { + if !matches!(child.wait().map(|e| e.code()), Ok(Some(0)) | Ok(None)) { + crash!(2, "'{}' terminated abnormally", program) + } +} diff --git a/src/uu/sort/src/merge.rs b/src/uu/sort/src/merge.rs index 696353829..b47c58c08 100644 --- a/src/uu/sort/src/merge.rs +++ b/src/uu/sort/src/merge.rs @@ -9,7 +9,6 @@ use std::{ cmp::Ordering, - ffi::OsStr, io::{Read, Write}, iter, rc::Rc, @@ -21,15 +20,18 @@ use compare::Compare; use crate::{ chunks::{self, Chunk}, - compare_by, open, GlobalSettings, + compare_by, GlobalSettings, }; // Merge already sorted files. -pub fn merge<'a>(files: &[impl AsRef], settings: &'a GlobalSettings) -> FileMerger<'a> { +pub fn merge>>( + files: F, + settings: &GlobalSettings, +) -> FileMerger { let (request_sender, request_receiver) = channel(); let mut reader_files = Vec::with_capacity(files.len()); let mut loaded_receivers = Vec::with_capacity(files.len()); - for (file_number, file) in files.iter().map(open).enumerate() { + for (file_number, file) in files.enumerate() { let (sender, receiver) = sync_channel(2); loaded_receivers.push(receiver); reader_files.push(ReaderFile { diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 5825e73bd..6cdf051c1 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -95,6 +95,7 @@ static OPT_PARALLEL: &str = "parallel"; static OPT_FILES0_FROM: &str = "files0-from"; static OPT_BUF_SIZE: &str = "buffer-size"; static OPT_TMP_DIR: &str = "temporary-directory"; +static OPT_COMPRESS_PROG: &str = "compress-program"; static ARG_FILES: &str = "files"; @@ -155,6 +156,7 @@ pub struct GlobalSettings { zero_terminated: bool, buffer_size: usize, tmp_dir: PathBuf, + compress_prog: Option, } impl GlobalSettings { @@ -223,6 +225,7 @@ impl Default for GlobalSettings { zero_terminated: false, buffer_size: DEFAULT_BUF_SIZE, tmp_dir: PathBuf::new(), + compress_prog: None, } } } @@ -1076,6 +1079,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .value_name("DIR"), ) + .arg( + Arg::with_name(OPT_COMPRESS_PROG) + .long(OPT_COMPRESS_PROG) + .help("compress temporary files with PROG, decompress with PROG -d") + .long_help("PROG has to take input from stdin and output to stdout") + .value_name("PROG") + ) .arg( Arg::with_name(OPT_FILES0_FROM) .long(OPT_FILES0_FROM) @@ -1165,6 +1175,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .map(PathBuf::from) .unwrap_or_else(env::temp_dir); + settings.compress_prog = matches.value_of(OPT_COMPRESS_PROG).map(String::from); + settings.zero_terminated = matches.is_present(OPT_ZERO_TERMINATED); settings.merge = matches.is_present(OPT_MERGE); @@ -1240,7 +1252,7 @@ fn output_sorted_lines<'a>(iter: impl Iterator>, settings: & fn exec(files: &[String], settings: &GlobalSettings) -> i32 { if settings.merge { - let mut file_merger = merge::merge(files, settings); + let mut file_merger = merge::merge(files.iter().map(open), settings); file_merger.write_all(settings); } else if settings.check { if files.len() > 1 { diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index d100e2141..e731d5b1d 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -809,3 +809,34 @@ fn sort_empty_chunk() { .succeeds() .stdout_is("a\na\n"); } + +#[test] +#[cfg(target_os = "linux")] +fn test_compress() { + new_ucmd!() + .args(&[ + "ext_sort.txt", + "-n", + "--compress-program", + "gzip", + "-S", + "10", + ]) + .succeeds() + .stdout_only_fixture("ext_sort.expected"); +} + +#[test] +fn test_compress_fail() { + new_ucmd!() + .args(&[ + "ext_sort.txt", + "-n", + "--compress-program", + "nonexistent-program", + "-S", + "10", + ]) + .fails() + .stderr_only("sort: couldn't execute compress program: errno 2"); +} From 7c9da82b394e0be8b640afb631f7d512a5351aab Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sun, 6 Jun 2021 13:50:38 +0200 Subject: [PATCH 0877/1135] sort: implement --batch-size --- src/uu/sort/src/ext_sort.rs | 2 +- src/uu/sort/src/merge.rs | 63 ++++++++++++++++++++++++++++++++++--- src/uu/sort/src/sort.rs | 17 +++++++++- tests/by-util/test_sort.rs | 13 ++++++++ 4 files changed, 88 insertions(+), 7 deletions(-) diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs index 2d8513e9f..91a7ca360 100644 --- a/src/uu/sort/src/ext_sort.rs +++ b/src/uu/sort/src/ext_sort.rs @@ -89,7 +89,7 @@ pub fn ext_sort(files: &mut impl Iterator>, settings Box::new(BufReader::new(file)) as Box } }); - let mut merger = merge::merge(files, settings); + let mut merger = merge::merge_with_file_limit(files, settings); for child in children { assert_child_success(child, settings.compress_prog.as_ref().unwrap()); } diff --git a/src/uu/sort/src/merge.rs b/src/uu/sort/src/merge.rs index b47c58c08..478b454b6 100644 --- a/src/uu/sort/src/merge.rs +++ b/src/uu/sort/src/merge.rs @@ -9,7 +9,8 @@ use std::{ cmp::Ordering, - io::{Read, Write}, + fs::File, + io::{BufWriter, Read, Write}, iter, rc::Rc, sync::mpsc::{channel, sync_channel, Receiver, Sender, SyncSender}, @@ -17,6 +18,7 @@ use std::{ }; use compare::Compare; +use itertools::Itertools; use crate::{ chunks::{self, Chunk}, @@ -24,13 +26,60 @@ use crate::{ }; // Merge already sorted files. -pub fn merge>>( +pub fn merge_with_file_limit>>( + files: F, + settings: &GlobalSettings, +) -> FileMerger { + if files.len() > settings.merge_batch_size { + let tmp_dir = tempfile::Builder::new() + .prefix("uutils_sort") + .tempdir_in(&settings.tmp_dir) + .unwrap(); + let mut batch_number = 0; + let mut remaining_files = files.len(); + let batches = files.chunks(settings.merge_batch_size); + let mut batches = batches.into_iter(); + while batch_number + remaining_files > settings.merge_batch_size && remaining_files != 0 { + remaining_files = remaining_files.saturating_sub(settings.merge_batch_size); + let mut merger = merge_without_limit(batches.next().unwrap(), settings); + let tmp_file = File::create(tmp_dir.path().join(batch_number.to_string())).unwrap(); + merger.write_all_to(settings, &mut BufWriter::new(tmp_file)); + batch_number += 1; + } + let batch_files = (0..batch_number).map(|n| { + Box::new(File::open(tmp_dir.path().join(n.to_string())).unwrap()) + as Box + }); + if batch_number > settings.merge_batch_size { + assert!(batches.next().is_none()); + merge_with_file_limit( + Box::new(batch_files) as Box>>, + settings, + ) + } else { + let final_batch = batches.next(); + assert!(batches.next().is_none()); + merge_without_limit( + batch_files.chain(final_batch.into_iter().flatten()), + settings, + ) + } + } else { + merge_without_limit(files, settings) + } +} + +/// Merge files without limiting how many files are concurrently open +/// +/// It is the responsibility of the caller to ensure that `files` yields only +/// as many files as we are allowed to open concurrently. +fn merge_without_limit>>( files: F, settings: &GlobalSettings, ) -> FileMerger { let (request_sender, request_receiver) = channel(); - let mut reader_files = Vec::with_capacity(files.len()); - let mut loaded_receivers = Vec::with_capacity(files.len()); + let mut reader_files = Vec::with_capacity(files.size_hint().0); + let mut loaded_receivers = Vec::with_capacity(files.size_hint().0); for (file_number, file) in files.enumerate() { let (sender, receiver) = sync_channel(2); loaded_receivers.push(receiver); @@ -148,7 +197,11 @@ impl<'a> FileMerger<'a> { /// Write the merged contents to the output file. pub fn write_all(&mut self, settings: &GlobalSettings) { let mut out = settings.out_writer(); - while self.write_next(settings, &mut out) {} + self.write_all_to(settings, &mut out); + } + + pub fn write_all_to(&mut self, settings: &GlobalSettings, out: &mut impl Write) { + while self.write_next(settings, out) {} } fn write_next(&mut self, settings: &GlobalSettings, out: &mut impl Write) -> bool { diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 6cdf051c1..70e3325ad 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -96,6 +96,7 @@ static OPT_FILES0_FROM: &str = "files0-from"; static OPT_BUF_SIZE: &str = "buffer-size"; static OPT_TMP_DIR: &str = "temporary-directory"; static OPT_COMPRESS_PROG: &str = "compress-program"; +static OPT_BATCH_SIZE: &str = "batch-size"; static ARG_FILES: &str = "files"; @@ -157,6 +158,7 @@ pub struct GlobalSettings { buffer_size: usize, tmp_dir: PathBuf, compress_prog: Option, + merge_batch_size: usize, } impl GlobalSettings { @@ -226,6 +228,7 @@ impl Default for GlobalSettings { buffer_size: DEFAULT_BUF_SIZE, tmp_dir: PathBuf::new(), compress_prog: None, + merge_batch_size: 16, } } } @@ -1086,6 +1089,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long_help("PROG has to take input from stdin and output to stdout") .value_name("PROG") ) + .arg( + Arg::with_name(OPT_BATCH_SIZE) + .long(OPT_BATCH_SIZE) + .help("Merge at most N_MERGE inputs at once.") + .value_name("N_MERGE") + ) .arg( Arg::with_name(OPT_FILES0_FROM) .long(OPT_FILES0_FROM) @@ -1177,6 +1186,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.compress_prog = matches.value_of(OPT_COMPRESS_PROG).map(String::from); + if let Some(n_merge) = matches.value_of(OPT_BATCH_SIZE) { + settings.merge_batch_size = n_merge + .parse() + .unwrap_or_else(|_| crash!(2, "invalid --batch-size argument '{}'", n_merge)); + } + settings.zero_terminated = matches.is_present(OPT_ZERO_TERMINATED); settings.merge = matches.is_present(OPT_MERGE); @@ -1252,7 +1267,7 @@ fn output_sorted_lines<'a>(iter: impl Iterator>, settings: & fn exec(files: &[String], settings: &GlobalSettings) -> i32 { if settings.merge { - let mut file_merger = merge::merge(files.iter().map(open), settings); + let mut file_merger = merge::merge_with_file_limit(files.iter().map(open), settings); file_merger.write_all(settings); } else if settings.check { if files.len() > 1 { diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index e731d5b1d..75611abfc 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -840,3 +840,16 @@ fn test_compress_fail() { .fails() .stderr_only("sort: couldn't execute compress program: errno 2"); } + +#[test] +fn test_merge_batches() { + new_ucmd!() + .args(&[ + "ext_sort.txt", + "-n", + "-S", + "150B", + ]) + .succeeds() + .stdout_only_fixture("ext_sort.expected"); +} From 6ee6082cf88d656f1af30a9240d888594aa7e44f Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sun, 6 Jun 2021 18:04:55 +0200 Subject: [PATCH 0878/1135] update Cargo.lock --- Cargo.lock | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9c3aae831..43d491cef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,12 +43,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "array-init" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6945cc5422176fc5e602e590c2878d2c2acd9a4fe20a4baa7c28022521698ec6" - [[package]] name = "arrayref" version = "0.3.6" @@ -710,9 +704,9 @@ checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" [[package]] name = "heck" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" dependencies = [ "unicode-segmentation", ] @@ -1393,12 +1387,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -dependencies = [ - "byteorder", -] +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" [[package]] name = "regex-syntax" @@ -1511,9 +1502,9 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" dependencies = [ "libc", ] From d6da143c4ebffb65221cb5b4a3b5157237aea52b Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sun, 6 Jun 2021 19:53:28 +0200 Subject: [PATCH 0879/1135] sort: ignore errors when waiting for child --- src/uu/sort/src/ext_sort.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs index 91a7ca360..c439adcdc 100644 --- a/src/uu/sort/src/ext_sort.rs +++ b/src/uu/sort/src/ext_sort.rs @@ -262,7 +262,10 @@ fn write_lines<'a, T: Write>(lines: &[Line<'a>], writer: &mut T, separator: u8) } fn assert_child_success(mut child: Child, program: &str) { - if !matches!(child.wait().map(|e| e.code()), Ok(Some(0)) | Ok(None)) { + if !matches!( + child.wait().map(|e| e.code()), + Ok(Some(0)) | Ok(None) | Err(_) + ) { crash!(2, "'{}' terminated abnormally", program) } } From 884f5701251af39b29b6c305ce455fb5bc80ecca Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 6 Jun 2021 21:55:39 +0200 Subject: [PATCH 0880/1135] du/od/sort: refactor - replace map_or_else with unwrap_or_else --- src/uu/du/src/du.rs | 6 ++---- src/uu/od/src/od.rs | 20 ++++++++------------ src/uu/sort/src/sort.rs | 6 ++---- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index c2d764ebf..93f2fe5bb 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -229,10 +229,8 @@ fn get_file_info(path: &Path) -> Option { fn read_block_size(s: Option<&str>) -> usize { if let Some(s) = s { - parse_size(s).map_or_else( - |e| crash!(1, "{}", format_error_message(e, s, options::BLOCK_SIZE)), - |n| n, - ) + parse_size(s) + .unwrap_or_else(|e| crash!(1, "{}", format_error_message(e, s, options::BLOCK_SIZE))) } else { for env_var in &["DU_BLOCK_SIZE", "BLOCK_SIZE", "BLOCKSIZE"] { if let Ok(env_size) = env::var(env_var) { diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 1a592f622..d5124e93c 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -134,10 +134,9 @@ impl OdOptions { } let mut skip_bytes = matches.value_of(options::SKIP_BYTES).map_or(0, |s| { - parse_number_of_bytes(s).map_or_else( - |e| crash!(1, "{}", format_error_message(e, s, options::SKIP_BYTES)), - |n| n, - ) + parse_number_of_bytes(s).unwrap_or_else(|e| { + crash!(1, "{}", format_error_message(e, s, options::SKIP_BYTES)) + }) }); let mut label: Option = None; @@ -165,10 +164,8 @@ impl OdOptions { if matches.occurrences_of(options::WIDTH) == 0 { return 16; }; - parse_number_of_bytes(s).map_or_else( - |e| crash!(1, "{}", format_error_message(e, s, options::WIDTH)), - |n| n, - ) + parse_number_of_bytes(s) + .unwrap_or_else(|e| crash!(1, "{}", format_error_message(e, s, options::WIDTH))) }); let min_bytes = formats.iter().fold(1, |max, next| { @@ -182,10 +179,9 @@ impl OdOptions { let output_duplicates = matches.is_present(options::OUTPUT_DUPLICATES); let read_bytes = matches.value_of(options::READ_BYTES).map(|s| { - parse_number_of_bytes(s).map_or_else( - |e| crash!(1, "{}", format_error_message(e, s, options::READ_BYTES)), - |n| n, - ) + parse_number_of_bytes(s).unwrap_or_else(|e| { + crash!(1, "{}", format_error_message(e, s, options::READ_BYTES)) + }) }); let radix = match matches.value_of(options::ADDRESS_RADIX) { diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 9ec90519f..850f039b3 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1158,10 +1158,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.buffer_size = matches .value_of(OPT_BUF_SIZE) .map_or(DEFAULT_BUF_SIZE, |s| { - GlobalSettings::parse_byte_count(s).map_or_else( - |e| crash!(2, "{}", format_error_message(e, s, OPT_BUF_SIZE)), - |n| n, - ) + GlobalSettings::parse_byte_count(s) + .unwrap_or_else(|e| crash!(2, "{}", format_error_message(e, s, OPT_BUF_SIZE))) }); settings.tmp_dir = matches From 0033928128777e6423cc17ff47dad2e74864a6ce Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 6 Jun 2021 22:56:11 +0200 Subject: [PATCH 0881/1135] sort: fix broken tests for '--batch-size' (replace 'B' with 'b') https://github.com/uutils/coreutils/pull/2297#issuecomment-855460881 --- tests/by-util/test_sort.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 898bb3568..2894d3007 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -849,7 +849,7 @@ fn sort_multiple() { #[test] fn sort_empty_chunk() { new_ucmd!() - .args(&["-S", "40B"]) + .args(&["-S", "40b"]) .pipe_in("a\na\n") .succeeds() .stdout_is("a\na\n"); @@ -889,12 +889,7 @@ fn test_compress_fail() { #[test] fn test_merge_batches() { new_ucmd!() - .args(&[ - "ext_sort.txt", - "-n", - "-S", - "150B", - ]) + .args(&["ext_sort.txt", "-n", "-S", "150b"]) .succeeds() .stdout_only_fixture("ext_sort.expected"); } From 4d5880f098843558c8917637df4b238fe63c4597 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Mon, 31 May 2021 15:33:49 -0500 Subject: [PATCH 0882/1135] maint/CICD ~ temporarily disable failing tool cache for actionrs/install # [why] The tool cache is currently failing and seems to be getting further behind current versions. The [actions-rs/install#12] issue addresses this but seems to be languishing without any proposed solution. [ref]: --- .github/workflows/CICD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 32c3537c2..c7d296e60 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -606,7 +606,7 @@ jobs: with: crate: grcov version: latest - use-tool-cache: true + use-tool-cache: false - name: Generate coverage data (via `grcov`) id: coverage shell: bash From 9cdfa06f3a8a40128d2d1e50ec1c6343e6bb9976 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Fri, 4 Jun 2021 10:56:53 -0500 Subject: [PATCH 0883/1135] maint/CICD ~ (MinRustV) update 'Cargo.lock' for rust v1.43 --- Cargo.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.lock b/Cargo.lock index 43d491cef..7b2d989be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2420,6 +2420,7 @@ dependencies = [ "uucore", "uucore_procs", "walkdir", + "winapi 0.3.9", ] [[package]] From 5553416b878535edb88c6ffd997006b8b6bb9409 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Fri, 4 Jun 2021 14:28:53 -0500 Subject: [PATCH 0884/1135] tests ~ fix clippy complaint (clippy::bool_assert_comparision) --- tests/by-util/test_env.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/by-util/test_env.rs b/tests/by-util/test_env.rs index 4db3b59bd..1d76c433d 100644 --- a/tests/by-util/test_env.rs +++ b/tests/by-util/test_env.rs @@ -187,11 +187,10 @@ fn test_change_directory() { .arg(&temporary_path) .succeeds() .stdout_move_str(); - assert_eq!( - out.lines() - .any(|line| line.ends_with(temporary_path.file_name().unwrap().to_str().unwrap())), - false - ); + + assert!(!out + .lines() + .any(|line| line.ends_with(temporary_path.file_name().unwrap().to_str().unwrap()))); } #[test] From 3cfb95668429607dde7ac36f0e4aa1c0d780535e Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Mon, 31 May 2021 16:18:33 -0500 Subject: [PATCH 0885/1135] refactor/du ~ fix `cargo clippy` warning (clippy::ptr_arg) --- src/uu/du/src/du.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index c5fff2ed7..d0dc845cb 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -24,6 +24,8 @@ use std::os::unix::fs::MetadataExt; use std::os::windows::fs::MetadataExt; #[cfg(windows)] use std::os::windows::io::AsRawHandle; +#[cfg(windows)] +use std::path::Path; use std::path::PathBuf; use std::time::{Duration, UNIX_EPOCH}; use uucore::InvalidEncodingHandling; @@ -159,7 +161,7 @@ fn birth_u64(meta: &Metadata) -> Option { } #[cfg(windows)] -fn get_size_on_disk(path: &PathBuf) -> u64 { +fn get_size_on_disk(path: &Path) -> u64 { let mut size_on_disk = 0; // bind file so it stays in scope until end of function @@ -191,7 +193,7 @@ fn get_size_on_disk(path: &PathBuf) -> u64 { } #[cfg(windows)] -fn get_file_info(path: &PathBuf) -> Option { +fn get_file_info(path: &Path) -> Option { let mut result = None; let file = match fs::File::open(path) { From 1ef820212c8db78b3e11cefd6e1bac3e24103bae Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Mon, 31 May 2021 16:17:54 -0500 Subject: [PATCH 0886/1135] refactor/rm ~ fix `cargo clippy` warning (clippy::upper_case_acronyms) --- src/uu/rm/Cargo.toml | 2 ++ src/uu/rm/src/rm.rs | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index 9974111aa..d84756fd3 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -18,10 +18,12 @@ path = "src/rm.rs" clap = "2.33" walkdir = "2.2" remove_dir_all = "0.5.1" +winapi = { version="0.3", features=[] } uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } + [[bin]] name = "rm" path = "src/main.rs" diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index ba764034a..ea56ca170 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -430,9 +430,7 @@ use std::os::windows::prelude::MetadataExt; #[cfg(windows)] fn is_symlink_dir(metadata: &fs::Metadata) -> bool { - use std::os::raw::c_ulong; - pub type DWORD = c_ulong; - pub const FILE_ATTRIBUTE_DIRECTORY: DWORD = 0x10; + use winapi::um::winnt::FILE_ATTRIBUTE_DIRECTORY; metadata.file_type().is_symlink() && ((metadata.file_attributes() & FILE_ATTRIBUTE_DIRECTORY) != 0) From 114844d9cda1f178b5a9852d3df58132fa15c582 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Mon, 31 May 2021 16:01:54 -0500 Subject: [PATCH 0887/1135] maint/CICD ~ refactor; use a shell script (`outputs`) for step outputs --- .github/workflows/CICD.yml | 94 +++++++++++++------------------------- 1 file changed, 32 insertions(+), 62 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index c7d296e60..25e2386f0 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -32,12 +32,12 @@ jobs: shell: bash run: | ## VARs setup + outputs() { for var in "$@" ; do echo steps.vars.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 - echo set-output name=CARGO_FEATURES_OPTION::${CARGO_FEATURES_OPTION} - echo ::set-output name=CARGO_FEATURES_OPTION::${CARGO_FEATURES_OPTION} + outputs CARGO_FEATURES_OPTION - name: Install `rust` toolchain uses: actions-rs/toolchain@v1 with: @@ -93,12 +93,12 @@ jobs: shell: bash run: | ## VARs setup + outputs() { for var in "$@" ; do echo steps.vars.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 - echo set-output name=CARGO_FEATURES_OPTION::${CARGO_FEATURES_OPTION} - echo ::set-output name=CARGO_FEATURES_OPTION::${CARGO_FEATURES_OPTION} + outputs CARGO_FEATURES_OPTION - name: Install `rust` toolchain uses: actions-rs/toolchain@v1 with: @@ -261,22 +261,20 @@ jobs: shell: bash run: | ## VARs setup + outputs() { for var in "$@" ; do echo steps.vars.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } # toolchain TOOLCHAIN="stable" ## default to "stable" toolchain # * specify alternate/non-default TOOLCHAIN for *-pc-windows-gnu targets; gnu targets on Windows are broken for the standard *-pc-windows-msvc toolchain (refs: GH:rust-lang/rust#47048, GH:rust-lang/rust#53454, GH:rust-lang/cargo#6754) case ${{ matrix.job.target }} in *-pc-windows-gnu) TOOLCHAIN="stable-${{ matrix.job.target }}" ;; esac; # * use requested TOOLCHAIN if specified if [ -n "${{ matrix.job.toolchain }}" ]; then TOOLCHAIN="${{ matrix.job.toolchain }}" ; fi - echo set-output name=TOOLCHAIN::${TOOLCHAIN:-/false} - echo ::set-output name=TOOLCHAIN::${TOOLCHAIN} + outputs TOOLCHAIN # staging directory STAGING='_staging' - echo set-output name=STAGING::${STAGING} - echo ::set-output name=STAGING::${STAGING} + outputs STAGING # determine EXE suffix EXE_suffix="" ; case '${{ matrix.job.target }}' in *-pc-windows-*) EXE_suffix=".exe" ;; esac; - echo set-output name=EXE_suffix::${EXE_suffix} - echo ::set-output name=EXE_suffix::${EXE_suffix} + outputs EXE_suffix # parse commit reference info echo GITHUB_REF=${GITHUB_REF} echo GITHUB_SHA=${GITHUB_SHA} @@ -284,14 +282,7 @@ jobs: unset REF_BRANCH ; case "${GITHUB_REF}" in refs/heads/*) REF_BRANCH=${GITHUB_REF#refs/heads/} ;; esac; unset REF_TAG ; case "${GITHUB_REF}" in refs/tags/*) REF_TAG=${GITHUB_REF#refs/tags/} ;; esac; REF_SHAS=${GITHUB_SHA:0:8} - echo set-output name=REF_NAME::${REF_NAME} - echo set-output name=REF_BRANCH::${REF_BRANCH} - echo set-output name=REF_TAG::${REF_TAG} - echo set-output name=REF_SHAS::${REF_SHAS} - echo ::set-output name=REF_NAME::${REF_NAME} - echo ::set-output name=REF_BRANCH::${REF_BRANCH} - echo ::set-output name=REF_TAG::${REF_TAG} - echo ::set-output name=REF_SHAS::${REF_SHAS} + outputs REF_NAME REF_BRANCH REF_TAG REF_SHAS # parse target unset TARGET_ARCH case '${{ matrix.job.target }}' in @@ -301,68 +292,50 @@ jobs: i686-*) TARGET_ARCH=i686 ;; x86_64-*) TARGET_ARCH=x86_64 ;; esac; - echo set-output name=TARGET_ARCH::${TARGET_ARCH} - echo ::set-output name=TARGET_ARCH::${TARGET_ARCH} unset TARGET_OS ; case '${{ matrix.job.target }}' in *-linux-*) TARGET_OS=linux ;; *-apple-*) TARGET_OS=macos ;; *-windows-*) TARGET_OS=windows ;; esac; - echo set-output name=TARGET_OS::${TARGET_OS} - echo ::set-output name=TARGET_OS::${TARGET_OS} + outputs TARGET_ARCH TARGET_OS # package name PKG_suffix=".tar.gz" ; case '${{ matrix.job.target }}' in *-pc-windows-*) PKG_suffix=".zip" ;; esac; PKG_BASENAME=${PROJECT_NAME}-${REF_TAG:-$REF_SHAS}-${{ matrix.job.target }} PKG_NAME=${PKG_BASENAME}${PKG_suffix} - echo set-output name=PKG_suffix::${PKG_suffix} - echo set-output name=PKG_BASENAME::${PKG_BASENAME} - echo set-output name=PKG_NAME::${PKG_NAME} - echo ::set-output name=PKG_suffix::${PKG_suffix} - echo ::set-output name=PKG_BASENAME::${PKG_BASENAME} - echo ::set-output name=PKG_NAME::${PKG_NAME} + outputs PKG_suffix PKG_BASENAME PKG_NAME # deployable tag? (ie, leading "vM" or "M"; M == version number) unset DEPLOY ; if [[ $REF_TAG =~ ^[vV]?[0-9].* ]]; then DEPLOY='true' ; fi - echo set-output name=DEPLOY::${DEPLOY:-/false} - echo ::set-output name=DEPLOY::${DEPLOY} + outputs DEPLOY # DPKG architecture? unset DPKG_ARCH case ${{ matrix.job.target }} in x86_64-*-linux-*) DPKG_ARCH=amd64 ;; *-linux-*) DPKG_ARCH=${TARGET_ARCH} ;; esac - echo set-output name=DPKG_ARCH::${DPKG_ARCH} - echo ::set-output name=DPKG_ARCH::${DPKG_ARCH} + outputs DPKG_ARCH # DPKG version? unset DPKG_VERSION ; if [[ $REF_TAG =~ ^[vV]?[0-9].* ]]; then DPKG_VERSION=${REF_TAG/#[vV]/} ; fi - echo set-output name=DPKG_VERSION::${DPKG_VERSION} - echo ::set-output name=DPKG_VERSION::${DPKG_VERSION} + outputs DPKG_VERSION # DPKG base name/conflicts? DPKG_BASENAME=${PROJECT_NAME} DPKG_CONFLICTS=${PROJECT_NAME}-musl case ${{ matrix.job.target }} in *-musl) DPKG_BASENAME=${PROJECT_NAME}-musl ; DPKG_CONFLICTS=${PROJECT_NAME} ;; esac; - echo set-output name=DPKG_BASENAME::${DPKG_BASENAME} - echo set-output name=DPKG_CONFLICTS::${DPKG_CONFLICTS} - echo ::set-output name=DPKG_BASENAME::${DPKG_BASENAME} - echo ::set-output name=DPKG_CONFLICTS::${DPKG_CONFLICTS} + outputs DPKG_BASENAME DPKG_CONFLICTS # DPKG name unset DPKG_NAME; if [[ -n $DPKG_ARCH && -n $DPKG_VERSION ]]; then DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb" ; fi - echo set-output name=DPKG_NAME::${DPKG_NAME} - echo ::set-output name=DPKG_NAME::${DPKG_NAME} + outputs DPKG_NAME # target-specific options # * CARGO_FEATURES_OPTION CARGO_FEATURES_OPTION='' ; if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features "${{ matrix.job.features }}"' ; fi - echo set-output name=CARGO_FEATURES_OPTION::${CARGO_FEATURES_OPTION} - echo ::set-output name=CARGO_FEATURES_OPTION::${CARGO_FEATURES_OPTION} + outputs CARGO_FEATURES_OPTION # * CARGO_USE_CROSS (truthy) CARGO_USE_CROSS='true' ; case '${{ matrix.job.use-cross }}' in ''|0|f|false|n|no) unset CARGO_USE_CROSS ;; esac; - echo set-output name=CARGO_USE_CROSS::${CARGO_USE_CROSS:-/false} - echo ::set-output name=CARGO_USE_CROSS::${CARGO_USE_CROSS} + outputs CARGO_USE_CROSS # ** pass needed environment into `cross` container (iff `cross` not already configured via "Cross.toml") if [ -n "${CARGO_USE_CROSS}" ] && [ ! -e "Cross.toml" ] ; then printf "[build.env]\npassthrough = [\"CI\"]\n" > Cross.toml fi # * test only library and/or binaries for arm-type targets unset CARGO_TEST_OPTIONS ; case '${{ matrix.job.target }}' in aarch64-* | arm-*) CARGO_TEST_OPTIONS="--bins" ;; esac; - echo set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS} - echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS} + outputs CARGO_TEST_OPTIONS # * executable for `strip`? STRIP="strip" case ${{ matrix.job.target }} in @@ -370,8 +343,7 @@ jobs: arm-*-linux-gnueabihf) STRIP="arm-linux-gnueabihf-strip" ;; *-pc-windows-msvc) STRIP="" ;; esac; - echo set-output name=STRIP::${STRIP:-/false} - echo ::set-output name=STRIP::${STRIP} + outputs STRIP - name: Create all needed build/work directories shell: bash run: | @@ -395,11 +367,12 @@ jobs: shell: bash run: | ## Dependent VARs setup + outputs() { for var in "$@" ; do echo steps.vars.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } # * 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;)" - echo set-output name=UTILITY_LIST::${UTILITY_LIST} - echo ::set-output name=CARGO_UTILITY_LIST_OPTIONS::${CARGO_UTILITY_LIST_OPTIONS} + outputs CARGO_UTILITY_LIST_OPTIONS - name: Install `cargo-tree` # for dependency information uses: actions-rs/install@v0.1 with: @@ -524,34 +497,31 @@ jobs: id: vars shell: bash run: | + ## VARs setup + outputs() { for var in "$@" ; do echo steps.vars.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 # * 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 if [ -n "${{ matrix.job.toolchain }}" ]; then TOOLCHAIN="${{ matrix.job.toolchain }}" ; fi - echo set-output name=TOOLCHAIN::${TOOLCHAIN} - echo ::set-output name=TOOLCHAIN::${TOOLCHAIN} + outputs TOOLCHAIN # staging directory STAGING='_staging' - echo set-output name=STAGING::${STAGING} - echo ::set-output name=STAGING::${STAGING} + outputs STAGING ## # check for CODECOV_TOKEN availability (work-around for inaccessible 'secrets' object for 'if'; see ) ## # note: CODECOV_TOKEN / HAS_CODECOV_TOKEN is not needed for public repositories when using AppVeyor, Azure Pipelines, CircleCI, GitHub Actions, Travis (see ) ## unset HAS_CODECOV_TOKEN ## if [ -n $CODECOV_TOKEN ]; then HAS_CODECOV_TOKEN='true' ; fi - ## echo set-output name=HAS_CODECOV_TOKEN::${HAS_CODECOV_TOKEN} - ## echo ::set-output name=HAS_CODECOV_TOKEN::${HAS_CODECOV_TOKEN} + ## outputs HAS_CODECOV_TOKEN # target-specific options # * CARGO_FEATURES_OPTION CARGO_FEATURES_OPTION='--all-features' ; ## default to '--all-features' for code coverage if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features "${{ matrix.job.features }}"' ; fi - echo set-output name=CARGO_FEATURES_OPTION::${CARGO_FEATURES_OPTION} - echo ::set-output name=CARGO_FEATURES_OPTION::${CARGO_FEATURES_OPTION} + outputs CARGO_FEATURES_OPTION # * CODECOV_FLAGS CODECOV_FLAGS=$( echo "${{ matrix.job.os }}" | sed 's/[^[:alnum:]]/_/g' ) - echo set-output name=CODECOV_FLAGS::${CODECOV_FLAGS} - echo ::set-output name=CODECOV_FLAGS::${CODECOV_FLAGS} + outputs CODECOV_FLAGS - name: rust toolchain ~ install uses: actions-rs/toolchain@v1 with: @@ -563,11 +533,11 @@ jobs: shell: bash run: | ## Dependent VARs setup + outputs() { for var in "$@" ; do echo steps.vars.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } # * determine sub-crate utility list UTILITY_LIST="$(./util/show-utils.sh ${CARGO_FEATURES_OPTION})" CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo "-puu_${u}"; done;)" - echo set-output name=UTILITY_LIST::${UTILITY_LIST} - echo ::set-output name=CARGO_UTILITY_LIST_OPTIONS::${CARGO_UTILITY_LIST_OPTIONS} + outputs CARGO_UTILITY_LIST_OPTIONS - name: Test uucore uses: actions-rs/cargo@v1 with: From b1cc604b620fc609a2b7de3b8c818f68a2068a3a Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 16:05:58 -0500 Subject: [PATCH 0888/1135] docs/spell ~ update cspell dictionaries --- .vscode/cspell.dictionaries/people.wordlist.txt | 3 +++ .vscode/cspell.dictionaries/workspace.wordlist.txt | 2 ++ 2 files changed, 5 insertions(+) diff --git a/.vscode/cspell.dictionaries/people.wordlist.txt b/.vscode/cspell.dictionaries/people.wordlist.txt index 01cfa4a3e..0a091633f 100644 --- a/.vscode/cspell.dictionaries/people.wordlist.txt +++ b/.vscode/cspell.dictionaries/people.wordlist.txt @@ -97,6 +97,9 @@ Michael Debertol Michael Gehring Michael Gehring +Mitchell Mebane + Mitchell + Mebane Morten Olsen Lysgaard Morten Olsen diff --git a/.vscode/cspell.dictionaries/workspace.wordlist.txt b/.vscode/cspell.dictionaries/workspace.wordlist.txt index e2a864f9c..ed634dffb 100644 --- a/.vscode/cspell.dictionaries/workspace.wordlist.txt +++ b/.vscode/cspell.dictionaries/workspace.wordlist.txt @@ -7,6 +7,7 @@ advapi advapi32-sys aho-corasick backtrace +blake2b_simd bstr byteorder chacha @@ -47,6 +48,7 @@ xattr # * rust/rustc RUSTDOCFLAGS RUSTFLAGS +bitor # BitOr trait function bitxor # BitXor trait function clippy concat From c192550f22976408fb4fe113e3bbdcfee0e83615 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 16:07:56 -0500 Subject: [PATCH 0889/1135] refactor ~ polish spelling + add spelling exceptions --- .github/workflows/CICD.yml | 2 +- src/uu/du/src/du.rs | 2 +- src/uu/rm/src/rm.rs | 2 +- util/build-gnu.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 25e2386f0..ad3177224 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -5,7 +5,7 @@ name: CICD # spell-checker:ignore (jargon) SHAs deps softprops 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 tempfile testsuite uutils +# spell-checker:ignore (misc) aarch alnum armhf bindir busytest coreutils gnueabihf issuecomment maint nullglob onexitbegin onexitend runtest tempfile testsuite uutils env: PROJECT_NAME: coreutils diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index d0dc845cb..9d8d5536f 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -433,7 +433,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { although the apparent size is usually smaller, it may be larger due to holes \ in ('sparse') files, internal fragmentation, indirect blocks, and the like" ) - .alias("app") // The GNU testsuite uses this alias + .alias("app") // The GNU test suite uses this alias ) .arg( Arg::with_name(options::BLOCK_SIZE) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index ea56ca170..40a24cea7 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -5,7 +5,7 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// spell-checker:ignore (ToDO) bitor ulong +// spell-checker:ignore (path) eacces #[macro_use] extern crate uucore; diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 1ffde8311..44ecd2044 100644 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -1,6 +1,6 @@ #!/bin/bash -# spell-checker:ignore (paths) abmon deref discrim getlimits getopt ginstall gnulib inacc infloop inotify reflink ; (misc) INT_OFLOW OFLOW ; (vars/env) BUILDDIR SRCDIR +# spell-checker:ignore (paths) abmon deref discrim eacces getlimits getopt ginstall gnulib inacc infloop inotify reflink ; (misc) INT_OFLOW OFLOW ; (vars/env) BUILDDIR SRCDIR set -e if test ! -d ../gnu; then From f5e2daa0565fab8e9923c9b0bd491eecb7fb0f10 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 16:09:52 -0500 Subject: [PATCH 0890/1135] refactor/uucore ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uucore/src/lib/features/utmpx.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/src/lib/features/utmpx.rs b/src/uucore/src/lib/features/utmpx.rs index a794b01da..5077d9e59 100644 --- a/src/uucore/src/lib/features/utmpx.rs +++ b/src/uucore/src/lib/features/utmpx.rs @@ -207,7 +207,7 @@ impl Utmpx { flags: AI_CANONNAME, ..AddrInfoHints::default() }; - let sockets = getaddrinfo(Some(&hostname), None, Some(hints)) + let sockets = getaddrinfo(Some(hostname), None, Some(hints)) .unwrap() .collect::>>()?; for socket in sockets { From 777e3906f87f0bd2927e968c09b07bbcc8c7a9bc Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 22:01:00 -0500 Subject: [PATCH 0891/1135] refactor/basename ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/basename/src/basename.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/basename/src/basename.rs b/src/uu/basename/src/basename.rs index a0eed93f1..47ad3117f 100644 --- a/src/uu/basename/src/basename.rs +++ b/src/uu/basename/src/basename.rs @@ -110,7 +110,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let line_ending = if opt_zero { "\0" } else { "\n" }; for path in paths { - print!("{}{}", basename(&path, &suffix), line_ending); + print!("{}{}", basename(path, suffix), line_ending); } 0 From c115ad4274f3237f7014df3cd82fc6fe5f08d6bd Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 21:10:13 -0500 Subject: [PATCH 0892/1135] refactor/cat ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/cat/src/cat.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index 1f2f441d8..005802ce5 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -295,7 +295,7 @@ fn cat_handle( if options.can_write_fast() { write_fast(handle) } else { - write_lines(handle, &options, state) + write_lines(handle, options, state) } } @@ -308,7 +308,7 @@ fn cat_path(path: &str, options: &OutputOptions, state: &mut OutputState) -> Cat reader: stdin, is_interactive: is_stdin_interactive(), }; - return cat_handle(&mut handle, &options, state); + return cat_handle(&mut handle, options, state); } match get_input_type(path)? { InputType::Directory => Err(CatError::IsDirectory), @@ -322,7 +322,7 @@ fn cat_path(path: &str, options: &OutputOptions, state: &mut OutputState) -> Cat reader: socket, is_interactive: false, }; - cat_handle(&mut handle, &options, state) + cat_handle(&mut handle, options, state) } _ => { let file = File::open(path)?; @@ -332,7 +332,7 @@ fn cat_path(path: &str, options: &OutputOptions, state: &mut OutputState) -> Cat reader: file, is_interactive: false, }; - cat_handle(&mut handle, &options, state) + cat_handle(&mut handle, options, state) } } } @@ -345,7 +345,7 @@ fn cat_files(files: Vec, options: &OutputOptions) -> Result<(), u32> { }; for path in &files { - if let Err(err) = cat_path(path, &options, &mut state) { + if let Err(err) = cat_path(path, options, &mut state) { show_error!("{}: {}", path, err); error_count += 1; } From 35b360b8e40d30986bcf86951bc18ea478503de1 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 22:01:12 -0500 Subject: [PATCH 0893/1135] refactor/chmod ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/chmod/src/chmod.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index 9cdabc7d6..7d171a6f7 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -127,13 +127,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let verbose = matches.is_present(options::VERBOSE); let preserve_root = matches.is_present(options::PRESERVE_ROOT); let recursive = matches.is_present(options::RECURSIVE); - let fmode = - matches - .value_of(options::REFERENCE) - .and_then(|ref fref| match fs::metadata(fref) { - Ok(meta) => Some(meta.mode()), - Err(err) => crash!(1, "cannot stat attributes of '{}': {}", fref, err), - }); + let fmode = matches + .value_of(options::REFERENCE) + .and_then(|fref| match fs::metadata(fref) { + Ok(meta) => Some(meta.mode()), + Err(err) => crash!(1, "cannot stat attributes of '{}': {}", fref, err), + }); let modes = matches.value_of(options::MODE).unwrap(); // should always be Some because required let mut cmode = if mode_had_minus_prefix { // clap parsing is finished, now put prefix back @@ -230,11 +229,11 @@ impl Chmoder { return Err(1); } if !self.recursive { - r = self.chmod_file(&file).and(r); + r = self.chmod_file(file).and(r); } else { for entry in WalkDir::new(&filename).into_iter().filter_map(|e| e.ok()) { let file = entry.path(); - r = self.chmod_file(&file).and(r); + r = self.chmod_file(file).and(r); } } } From baa656ca8ad7a5d2e1144aa91b6cbb56ebbb6a5d Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 23:28:04 -0500 Subject: [PATCH 0894/1135] refactor/chown ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/chown/src/chown.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index 2bb5133fe..649300d83 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -220,7 +220,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; let filter = if let Some(spec) = matches.value_of(options::FROM) { - match parse_spec(&spec) { + match parse_spec(spec) { Ok((Some(uid), None)) => IfFrom::User(uid), Ok((None, Some(gid))) => IfFrom::Group(gid), Ok((Some(uid), Some(gid))) => IfFrom::UserGroup(uid, gid), @@ -248,7 +248,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } } else { - match parse_spec(&owner) { + match parse_spec(owner) { Ok((u, g)) => { dest_uid = u; dest_gid = g; From 1e418e8d844e6dc4d7f3de28ca55e292d8c03acf Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 13:53:54 -0500 Subject: [PATCH 0895/1135] refactor/chroot ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/chroot/src/chroot.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/chroot/src/chroot.rs b/src/uu/chroot/src/chroot.rs index a05bd4494..8e23d8227 100644 --- a/src/uu/chroot/src/chroot.rs +++ b/src/uu/chroot/src/chroot.rs @@ -106,13 +106,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let mut vector: Vec<&str> = Vec::new(); for (&k, v) in matches.args.iter() { vector.push(k); - vector.push(&v.vals[0].to_str().unwrap()); + vector.push(v.vals[0].to_str().unwrap()); } vector } }; - set_context(&newroot, &matches); + set_context(newroot, &matches); let pstatus = Command::new(command[0]) .args(&command[1..]) @@ -132,7 +132,7 @@ fn set_context(root: &Path, options: &clap::ArgMatches) { let group_str = options.value_of(options::GROUP).unwrap_or_default(); let groups_str = options.value_of(options::GROUPS).unwrap_or_default(); let userspec = match userspec_str { - Some(ref u) => { + Some(u) => { let s: Vec<&str> = u.split(':').collect(); if s.len() != 2 || s.iter().any(|&spec| spec.is_empty()) { crash!(1, "invalid userspec: `{}`", u) From 14bb9ec61619dd90b10bbd843105724f083aa89f Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 10:26:00 -0500 Subject: [PATCH 0896/1135] refactor/csplit ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/csplit/src/csplit.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index e3b2069ab..d69254a3a 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -92,7 +92,7 @@ where T: BufRead, { let mut input_iter = InputSplitter::new(input.lines().enumerate()); - let mut split_writer = SplitWriter::new(&options); + let mut split_writer = SplitWriter::new(options); let ret = do_csplit(&mut split_writer, patterns, &mut input_iter); // consume the rest From 3409dc93e3cfb1da0c1d83e6d6b6242ea0ef3011 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 22:10:55 -0500 Subject: [PATCH 0897/1135] refactor/du ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/du/src/du.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 9d8d5536f..82424ca32 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -258,7 +258,7 @@ fn unit_string_to_number(s: &str) -> Option { fn translate_to_pure_number(s: &Option<&str>) -> Option { match *s { - Some(ref s) => unit_string_to_number(s), + Some(s) => unit_string_to_number(s), None => None, } } @@ -585,12 +585,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let max_depth_str = matches.value_of(options::MAX_DEPTH); let max_depth = max_depth_str.as_ref().and_then(|s| s.parse::().ok()); match (max_depth_str, max_depth) { - (Some(ref s), _) if summarize => { - show_error!("summarizing conflicts with --max-depth={}", *s); + (Some(s), _) if summarize => { + show_error!("summarizing conflicts with --max-depth={}", s); return 1; } - (Some(ref s), None) => { - show_error!("invalid maximum depth '{}'", *s); + (Some(s), None) => { + show_error!("invalid maximum depth '{}'", s); return 1; } (Some(_), Some(_)) | (None, _) => { /* valid */ } From b08c568748038b5649c82329b3736c95831867cb Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 13:21:25 -0500 Subject: [PATCH 0898/1135] refactor/echo ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/echo/src/echo.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index 56cd967f4..d83a4fe06 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -181,7 +181,7 @@ fn execute(no_newline: bool, escaped: bool, free: Vec) -> io::Result<()> write!(output, " ")?; } if escaped { - let should_stop = print_escaped(&input, &mut output)?; + let should_stop = print_escaped(input, &mut output)?; if should_stop { break; } From 9964a21fe3473274de5b11b325ae9757b5e90c6d Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 13:21:35 -0500 Subject: [PATCH 0899/1135] refactor/env ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/env/src/env.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/env/src/env.rs b/src/uu/env/src/env.rs index 50a327260..e20f047b7 100644 --- a/src/uu/env/src/env.rs +++ b/src/uu/env/src/env.rs @@ -245,7 +245,7 @@ fn run_env(args: impl uucore::Args) -> Result<(), i32> { } // set specified env vars - for &(ref name, ref val) in &opts.sets { + for &(name, val) in &opts.sets { // FIXME: set_var() panics if name is an empty string env::set_var(name, val); } From 122d82e835882cce4a86a88fc107f674ff121512 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 11:28:30 -0500 Subject: [PATCH 0900/1135] refactor/expand ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/expand/src/expand.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index 08a514dbf..17b05c726 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -236,7 +236,7 @@ fn expand(options: Options) { // now dump out either spaces if we're expanding, or a literal tab if we're not if init || !options.iflag { - safe_unwrap!(output.write_all(&options.tspaces[..nts].as_bytes())); + safe_unwrap!(output.write_all(options.tspaces[..nts].as_bytes())); } else { safe_unwrap!(output.write_all(&buf[byte..byte + nbytes])); } From 489f9e83864156817627c240487450e69ebd24d3 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 11:29:35 -0500 Subject: [PATCH 0901/1135] refactor/expand ~ fix `cargo clippy` complaint (clippy::manual_str_repeat) --- src/uu/expand/src/expand.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index 17b05c726..d9d669e7c 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -15,7 +15,6 @@ extern crate uucore; use clap::{crate_version, App, Arg, ArgMatches}; use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; -use std::iter::repeat; use std::str::from_utf8; use unicode_width::UnicodeWidthChar; @@ -90,7 +89,7 @@ impl Options { }) .max() .unwrap(); // length of tabstops is guaranteed >= 1 - let tspaces = repeat(' ').take(nspaces).collect(); + let tspaces = " ".repeat(nspaces); let files: Vec = match matches.values_of(options::FILES) { Some(s) => s.map(|v| v.to_string()).collect(), From 28e176cbbaf259e6d105352850bd3ebab83b0b84 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 22:01:24 -0500 Subject: [PATCH 0902/1135] refactor/expr ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/expr/src/expr.rs | 2 +- src/uu/expr/src/tokens.rs | 34 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/uu/expr/src/expr.rs b/src/uu/expr/src/expr.rs index 5d63bed80..329a79ba2 100644 --- a/src/uu/expr/src/expr.rs +++ b/src/uu/expr/src/expr.rs @@ -37,7 +37,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } fn process_expr(token_strings: &[String]) -> Result { - let maybe_tokens = tokens::strings_to_tokens(&token_strings); + let maybe_tokens = tokens::strings_to_tokens(token_strings); let maybe_ast = syntax_tree::tokens_to_ast(maybe_tokens); evaluate_ast(maybe_ast) } diff --git a/src/uu/expr/src/tokens.rs b/src/uu/expr/src/tokens.rs index 6f2795588..748960bc3 100644 --- a/src/uu/expr/src/tokens.rs +++ b/src/uu/expr/src/tokens.rs @@ -78,27 +78,27 @@ pub fn strings_to_tokens(strings: &[String]) -> Result, Stri "(" => Token::ParOpen, ")" => Token::ParClose, - "^" => Token::new_infix_op(&s, false, 7), + "^" => Token::new_infix_op(s, false, 7), - ":" => Token::new_infix_op(&s, true, 6), + ":" => Token::new_infix_op(s, true, 6), - "*" => Token::new_infix_op(&s, true, 5), - "/" => Token::new_infix_op(&s, true, 5), - "%" => Token::new_infix_op(&s, true, 5), + "*" => Token::new_infix_op(s, true, 5), + "/" => Token::new_infix_op(s, true, 5), + "%" => Token::new_infix_op(s, true, 5), - "+" => Token::new_infix_op(&s, true, 4), - "-" => Token::new_infix_op(&s, true, 4), + "+" => Token::new_infix_op(s, true, 4), + "-" => Token::new_infix_op(s, true, 4), - "=" => Token::new_infix_op(&s, true, 3), - "!=" => Token::new_infix_op(&s, true, 3), - "<" => Token::new_infix_op(&s, true, 3), - ">" => Token::new_infix_op(&s, true, 3), - "<=" => Token::new_infix_op(&s, true, 3), - ">=" => Token::new_infix_op(&s, true, 3), + "=" => Token::new_infix_op(s, true, 3), + "!=" => Token::new_infix_op(s, true, 3), + "<" => Token::new_infix_op(s, true, 3), + ">" => Token::new_infix_op(s, true, 3), + "<=" => Token::new_infix_op(s, true, 3), + ">=" => Token::new_infix_op(s, true, 3), - "&" => Token::new_infix_op(&s, true, 2), + "&" => Token::new_infix_op(s, true, 2), - "|" => Token::new_infix_op(&s, true, 1), + "|" => Token::new_infix_op(s, true, 1), "match" => Token::PrefixOp { arity: 2, @@ -117,9 +117,9 @@ pub fn strings_to_tokens(strings: &[String]) -> Result, Stri value: s.clone(), }, - _ => Token::new_value(&s), + _ => Token::new_value(s), }; - push_token_if_not_escaped(&mut tokens_acc, tok_idx, token_if_not_escaped, &s); + push_token_if_not_escaped(&mut tokens_acc, tok_idx, token_if_not_escaped, s); tok_idx += 1; } maybe_dump_tokens_acc(&tokens_acc); From 2bf06c3104c942a56e2c90bc87b76160f082bfe8 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 10:26:12 -0500 Subject: [PATCH 0903/1135] refactor/fold ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/fold/src/fold.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index e476fed5b..c49809549 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -109,7 +109,7 @@ fn handle_obsolete(args: &[String]) -> (Vec, Option) { fn fold(filenames: Vec, bytes: bool, spaces: bool, width: usize) { for filename in &filenames { - let filename: &str = &filename; + let filename: &str = filename; let mut stdin_buf; let mut file_buf; let buffer = BufReader::new(if filename == "-" { From 9f2cb2e5e9a64311ba488b2d90b1effef1ae9aba Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 22:13:08 -0500 Subject: [PATCH 0904/1135] refactor/hashsum ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/hashsum/src/digest.rs | 2 +- src/uu/hashsum/src/hashsum.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/uu/hashsum/src/digest.rs b/src/uu/hashsum/src/digest.rs index 25bc7f4c3..9093d94a7 100644 --- a/src/uu/hashsum/src/digest.rs +++ b/src/uu/hashsum/src/digest.rs @@ -59,7 +59,7 @@ impl Digest for blake2b_simd::State { fn result(&mut self, out: &mut [u8]) { let hash_result = &self.finalize(); - out.copy_from_slice(&hash_result.as_bytes()); + out.copy_from_slice(hash_result.as_bytes()); } fn reset(&mut self) { diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index 9822ca3fa..1f097e128 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -90,7 +90,7 @@ fn detect_algo<'a>( 512, ), "sha3sum" => match matches.value_of("bits") { - Some(bits_str) => match (&bits_str).parse::() { + Some(bits_str) => match (bits_str).parse::() { Ok(224) => ( "SHA3-224", Box::new(Sha3_224::new()) as Box, @@ -140,7 +140,7 @@ fn detect_algo<'a>( 512, ), "shake128sum" => match matches.value_of("bits") { - Some(bits_str) => match (&bits_str).parse::() { + Some(bits_str) => match (bits_str).parse::() { Ok(bits) => ( "SHAKE128", Box::new(Shake128::new()) as Box, @@ -151,7 +151,7 @@ fn detect_algo<'a>( None => crash!(1, "--bits required for SHAKE-128"), }, "shake256sum" => match matches.value_of("bits") { - Some(bits_str) => match (&bits_str).parse::() { + Some(bits_str) => match (bits_str).parse::() { Ok(bits) => ( "SHAKE256", Box::new(Shake256::new()) as Box, @@ -194,7 +194,7 @@ fn detect_algo<'a>( } if matches.is_present("sha3") { match matches.value_of("bits") { - Some(bits_str) => match (&bits_str).parse::() { + Some(bits_str) => match (bits_str).parse::() { Ok(224) => set_or_crash( "SHA3-224", Box::new(Sha3_224::new()) as Box, @@ -238,7 +238,7 @@ fn detect_algo<'a>( } if matches.is_present("shake128") { match matches.value_of("bits") { - Some(bits_str) => match (&bits_str).parse::() { + Some(bits_str) => match (bits_str).parse::() { Ok(bits) => set_or_crash("SHAKE128", Box::new(Shake128::new()), bits), Err(err) => crash!(1, "{}", err), }, @@ -247,7 +247,7 @@ fn detect_algo<'a>( } if matches.is_present("shake256") { match matches.value_of("bits") { - Some(bits_str) => match (&bits_str).parse::() { + Some(bits_str) => match (bits_str).parse::() { Ok(bits) => set_or_crash("SHAKE256", Box::new(Shake256::new()), bits), Err(err) => crash!(1, "{}", err), }, From c66d67a0b9dca79a27bd54c48496774eebc1c760 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 13:21:46 -0500 Subject: [PATCH 0905/1135] refactor/install ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/install/src/install.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 7aa6f95ff..bcfe1a396 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -379,7 +379,7 @@ fn directory(paths: Vec, b: Behavior) -> i32 { } } - if mode::chmod(&path, b.mode()).is_err() { + if mode::chmod(path, b.mode()).is_err() { all_successful = false; continue; } @@ -422,7 +422,7 @@ fn standard(paths: Vec, b: Behavior) -> i32 { return 1; } - if mode::chmod(&parent, b.mode()).is_err() { + if mode::chmod(parent, b.mode()).is_err() { show_error!("failed to chmod {}", parent.display()); return 1; } @@ -501,7 +501,7 @@ fn copy_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> i3 /// _target_ must be a non-directory /// fn copy_file_to_file(file: &Path, target: &Path, b: &Behavior) -> i32 { - if copy(file, &target, b).is_err() { + if copy(file, target, b).is_err() { 1 } else { 0 @@ -563,7 +563,7 @@ fn copy(from: &Path, to: &Path, b: &Behavior) -> Result<(), ()> { } } - if mode::chmod(&to, b.mode()).is_err() { + if mode::chmod(to, b.mode()).is_err() { return Err(()); } From 4a09c72fe7d918d43792be9162a8e6559e8edc1b Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 16:12:00 -0500 Subject: [PATCH 0906/1135] refactor/join ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/join/src/join.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/uu/join/src/join.rs b/src/uu/join/src/join.rs index 7a044789f..4cdfe2141 100644 --- a/src/uu/join/src/join.rs +++ b/src/uu/join/src/join.rs @@ -328,8 +328,8 @@ impl<'a> State<'a> { }); } else { repr.print_field(key); - repr.print_fields(&line1, self.key, self.max_fields); - repr.print_fields(&line2, other.key, other.max_fields); + repr.print_fields(line1, self.key, self.max_fields); + repr.print_fields(line2, other.key, other.max_fields); } println!(); @@ -611,7 +611,7 @@ fn exec(file1: &str, file2: &str, settings: &Settings) -> i32 { let mut state1 = State::new( FileNum::File1, - &file1, + file1, &stdin, settings.key1, settings.print_unpaired, @@ -619,7 +619,7 @@ fn exec(file1: &str, file2: &str, settings: &Settings) -> i32 { let mut state2 = State::new( FileNum::File2, - &file2, + file2, &stdin, settings.key2, settings.print_unpaired, From e8e28f15084f541e9cedfc46cc7b002a95516f60 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 11:46:52 -0500 Subject: [PATCH 0907/1135] refactor/ln ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/ln/src/ln.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index cd5eef842..fff38c939 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -260,17 +260,17 @@ fn exec(files: &[PathBuf], settings: &Settings) -> i32 { // Handle cases where we create links in a directory first. if let Some(ref name) = settings.target_dir { // 4th form: a directory is specified by -t. - return link_files_in_dir(files, &PathBuf::from(name), &settings); + return link_files_in_dir(files, &PathBuf::from(name), settings); } if !settings.no_target_dir { if files.len() == 1 { // 2nd form: the target directory is the current directory. - return link_files_in_dir(files, &PathBuf::from("."), &settings); + return link_files_in_dir(files, &PathBuf::from("."), settings); } let last_file = &PathBuf::from(files.last().unwrap()); if files.len() > 2 || last_file.is_dir() { // 3rd form: create links in the last argument. - return link_files_in_dir(&files[0..files.len() - 1], last_file, &settings); + return link_files_in_dir(&files[0..files.len() - 1], last_file, settings); } } @@ -392,7 +392,7 @@ fn relative_path<'a>(src: &Path, dst: &Path) -> Result> { fn link(src: &Path, dst: &Path, settings: &Settings) -> Result<()> { let mut backup_path = None; let source: Cow<'_, Path> = if settings.relative { - relative_path(&src, dst)? + relative_path(src, dst)? } else { src.into() }; From 99fae850ae48b8373b05e2503fbdfc2badd056ad Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 21:10:23 -0500 Subject: [PATCH 0908/1135] refactor/ls ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/ls/src/ls.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 3c7b22360..dc67d5738 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1243,7 +1243,7 @@ fn sort_entries(entries: &mut Vec, config: &Config) { Sort::Time => entries.sort_by_key(|k| { Reverse( k.md() - .and_then(|md| get_system_time(&md, config)) + .and_then(|md| get_system_time(md, config)) .unwrap_or(UNIX_EPOCH), ) }), @@ -1323,7 +1323,7 @@ fn enter_directory(dir: &PathData, config: &Config, out: &mut BufWriter) .filter(|p| p.file_type().map(|ft| ft.is_dir()).unwrap_or(false)) { let _ = writeln!(out, "\n{}:", e.p_buf.display()); - enter_directory(&e, config, out); + enter_directory(e, config, out); } } } @@ -1339,8 +1339,8 @@ fn get_metadata(entry: &Path, dereference: bool) -> std::io::Result { fn display_dir_entry_size(entry: &PathData, config: &Config) -> (usize, usize) { if let Some(md) = entry.md() { ( - display_symlink_count(&md).len(), - display_size_or_rdev(&md, config).len(), + display_symlink_count(md).len(), + display_size_or_rdev(md, config).len(), ) } else { (0, 0) @@ -1371,7 +1371,7 @@ fn display_items(items: &[PathData], config: &Config, out: &mut BufWriter { @@ -1482,40 +1482,40 @@ fn display_item_long( #[cfg(unix)] { if config.inode { - let _ = write!(out, "{} ", get_inode(&md)); + let _ = write!(out, "{} ", get_inode(md)); } } let _ = write!( out, "{} {}", - display_permissions(&md, true), - pad_left(display_symlink_count(&md), max_links), + display_permissions(md, true), + pad_left(display_symlink_count(md), max_links), ); if config.long.owner { - let _ = write!(out, " {}", display_uname(&md, config)); + let _ = write!(out, " {}", display_uname(md, config)); } if config.long.group { - let _ = write!(out, " {}", display_group(&md, config)); + let _ = write!(out, " {}", display_group(md, config)); } // Author is only different from owner on GNU/Hurd, so we reuse // the owner, since GNU/Hurd is not currently supported by Rust. if config.long.author { - let _ = write!(out, " {}", display_uname(&md, config)); + let _ = write!(out, " {}", display_uname(md, config)); } let _ = writeln!( out, " {} {} {}", pad_left(display_size_or_rdev(md, config), max_size), - display_date(&md, config), + display_date(md, config), // unwrap is fine because it fails when metadata is not available // but we already know that it is because it's checked at the // start of the function. - display_file_name(&item, config).unwrap().contents, + display_file_name(item, config).unwrap().contents, ); } @@ -1741,7 +1741,7 @@ fn display_file_name(path: &PathData, config: &Config) -> Option { let mut width = name.width(); if let Some(ls_colors) = &config.color { - name = color_name(&ls_colors, &path.p_buf, name, path.md()?); + name = color_name(ls_colors, &path.p_buf, name, path.md()?); } if config.indicator_style != IndicatorStyle::None { @@ -1786,7 +1786,7 @@ fn display_file_name(path: &PathData, config: &Config) -> Option { } fn color_name(ls_colors: &LsColors, path: &Path, name: String, md: &Metadata) -> String { - match ls_colors.style_for_path_with_metadata(path, Some(&md)) { + match ls_colors.style_for_path_with_metadata(path, Some(md)) { Some(style) => style.to_ansi_term_style().paint(name).to_string(), None => name, } From 380e28dde55b62c4704dd00216826e9f44e82fbd Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 11:29:49 -0500 Subject: [PATCH 0909/1135] refactor/mkdir ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/mkdir/src/mkdir.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/mkdir/src/mkdir.rs b/src/uu/mkdir/src/mkdir.rs index d1461c0c9..e8a8ef2db 100644 --- a/src/uu/mkdir/src/mkdir.rs +++ b/src/uu/mkdir/src/mkdir.rs @@ -77,7 +77,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let mode_match = matches.value_of(OPT_MODE); let mode: u16 = match mode_match { Some(m) => { - let res: Option = u16::from_str_radix(&m, 8).ok(); + let res: Option = u16::from_str_radix(m, 8).ok(); match res { Some(r) => r, _ => crash!(1, "no mode given"), From 5889d81fde3b1cc0ac23b45391dfe3ee411ab0d6 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 22:39:15 -0500 Subject: [PATCH 0910/1135] refactor/mkfifo ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/mkfifo/src/mkfifo.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/mkfifo/src/mkfifo.rs b/src/uu/mkfifo/src/mkfifo.rs index cf2fefa50..b8a6bbe38 100644 --- a/src/uu/mkfifo/src/mkfifo.rs +++ b/src/uu/mkfifo/src/mkfifo.rs @@ -59,7 +59,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } let mode = match matches.value_of(options::MODE) { - Some(m) => match usize::from_str_radix(&m, 8) { + Some(m) => match usize::from_str_radix(m, 8) { Ok(m) => m, Err(e) => { show_error!("invalid mode: {}", e); From 768b343ff9e179714c8bbf0f83a15de9a2f871c8 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 13:22:00 -0500 Subject: [PATCH 0911/1135] refactor/mktemp ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/mktemp/src/mktemp.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index 67a88273d..e04de8702 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -165,9 +165,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; if dry_run { - dry_exec(tmpdir, prefix, rand, &suffix) + dry_exec(tmpdir, prefix, rand, suffix) } else { - exec(tmpdir, prefix, rand, &suffix, make_dir, suppress_file_err) + exec(tmpdir, prefix, rand, suffix, make_dir, suppress_file_err) } } From ca50eae0034c6c15729593beb9c8673171c66551 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 11:40:35 -0500 Subject: [PATCH 0912/1135] refactor/mv ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/mv/src/mv.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 6b6482702..bb402737e 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -389,7 +389,7 @@ fn rename_with_fallback(from: &Path, to: &Path) -> io::Result<()> { let file_type = metadata.file_type(); if file_type.is_symlink() { - rename_symlink_fallback(&from, &to)?; + rename_symlink_fallback(from, to)?; } else if file_type.is_dir() { // We remove the destination directory if it exists to match the // behavior of `fs::rename`. As far as I can tell, `fs_extra`'s From 63112783b21c6ae862e0dcb6dd309aa4daac9101 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 12:19:42 -0500 Subject: [PATCH 0913/1135] refactor/numfmt ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/numfmt/src/format.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/numfmt/src/format.rs b/src/uu/numfmt/src/format.rs index ebe380569..ee692d8f0 100644 --- a/src/uu/numfmt/src/format.rs +++ b/src/uu/numfmt/src/format.rs @@ -238,7 +238,7 @@ fn format_and_print_delimited(s: &str, options: &NumfmtOptions) -> Result<()> { } if field_selected { - print!("{}", format_string(&field.trim_start(), options, None)?); + print!("{}", format_string(field.trim_start(), options, None)?); } else { // print unselected field without conversion print!("{}", field); @@ -271,7 +271,7 @@ fn format_and_print_whitespace(s: &str, options: &NumfmtOptions) -> Result<()> { None }; - print!("{}", format_string(&field, options, implicit_padding)?); + print!("{}", format_string(field, options, implicit_padding)?); } else { // print unselected field without conversion print!("{}{}", prefix, field); From 94f5011662c457d920dec5b5999169fa8ac721c2 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 23:00:31 -0500 Subject: [PATCH 0914/1135] refactor/od ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/od/src/inputdecoder.rs | 2 +- src/uu/od/src/od.rs | 6 +++--- src/uu/od/src/output_info.rs | 2 +- src/uu/od/src/parse_inputs.rs | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/uu/od/src/inputdecoder.rs b/src/uu/od/src/inputdecoder.rs index f6ba59885..606495461 100644 --- a/src/uu/od/src/inputdecoder.rs +++ b/src/uu/od/src/inputdecoder.rs @@ -115,7 +115,7 @@ impl<'a> MemoryDecoder<'a> { /// Creates a clone of the internal buffer. The clone only contain the valid data. pub fn clone_buffer(&self, other: &mut Vec) { - other.clone_from(&self.data); + other.clone_from(self.data); other.resize(self.used_normal_length, 0); } diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 33303f0fc..1e7b4533a 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -130,7 +130,7 @@ impl OdOptions { let mut skip_bytes = match matches.value_of(options::SKIP_BYTES) { None => 0, - Some(s) => match parse_number_of_bytes(&s) { + Some(s) => match parse_number_of_bytes(s) { Ok(i) => i, Err(_) => { return Err(format!("Invalid argument --skip-bytes={}", s)); @@ -176,7 +176,7 @@ impl OdOptions { let read_bytes = match matches.value_of(options::READ_BYTES) { None => None, - Some(s) => match parse_number_of_bytes(&s) { + Some(s) => match parse_number_of_bytes(s) { Ok(i) => Some(i), Err(_) => { return Err(format!("Invalid argument --read-bytes={}", s)); @@ -537,7 +537,7 @@ where print_bytes( &input_offset.format_byte_offset(), &memory_decoder, - &output_info, + output_info, ); } diff --git a/src/uu/od/src/output_info.rs b/src/uu/od/src/output_info.rs index a204fa36e..49c2a09a2 100644 --- a/src/uu/od/src/output_info.rs +++ b/src/uu/od/src/output_info.rs @@ -68,7 +68,7 @@ impl OutputInfo { let print_width_line = print_width_block * (line_bytes / byte_size_block); let spaced_formatters = - OutputInfo::create_spaced_formatter_info(&formats, byte_size_block, print_width_block); + OutputInfo::create_spaced_formatter_info(formats, byte_size_block, print_width_block); OutputInfo { byte_size_line: line_bytes, diff --git a/src/uu/od/src/parse_inputs.rs b/src/uu/od/src/parse_inputs.rs index 288c0870f..419b7173d 100644 --- a/src/uu/od/src/parse_inputs.rs +++ b/src/uu/od/src/parse_inputs.rs @@ -55,7 +55,7 @@ pub fn parse_inputs(matches: &dyn CommandLineOpts) -> Result) -> Result Ok(CommandLineInputs::FileNames(vec!["-".to_string()])), 1 => { - let offset0 = parse_offset_operand(&input_strings[0]); + let offset0 = parse_offset_operand(input_strings[0]); Ok(match offset0 { Ok(n) => CommandLineInputs::FileAndOffset(("-".to_string(), n, None)), _ => CommandLineInputs::FileNames( @@ -97,8 +97,8 @@ pub fn parse_inputs_traditional(input_strings: Vec<&str>) -> Result { - let offset0 = parse_offset_operand(&input_strings[0]); - let offset1 = parse_offset_operand(&input_strings[1]); + let offset0 = parse_offset_operand(input_strings[0]); + let offset1 = parse_offset_operand(input_strings[1]); match (offset0, offset1) { (Ok(n), Ok(m)) => Ok(CommandLineInputs::FileAndOffset(( "-".to_string(), @@ -114,8 +114,8 @@ pub fn parse_inputs_traditional(input_strings: Vec<&str>) -> Result { - let offset = parse_offset_operand(&input_strings[1]); - let label = parse_offset_operand(&input_strings[2]); + let offset = parse_offset_operand(input_strings[1]); + let label = parse_offset_operand(input_strings[2]); match (offset, label) { (Ok(n), Ok(m)) => Ok(CommandLineInputs::FileAndOffset(( input_strings[0].to_string(), From b3dd80d39cdc0d67e30f049ced895538f77ad3bc Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 12:20:03 -0500 Subject: [PATCH 0915/1135] refactor/printf ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/printf/src/tokenize/num_format/num_format.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/printf/src/tokenize/num_format/num_format.rs b/src/uu/printf/src/tokenize/num_format/num_format.rs index a8a60cc57..c030358bb 100644 --- a/src/uu/printf/src/tokenize/num_format/num_format.rs +++ b/src/uu/printf/src/tokenize/num_format/num_format.rs @@ -258,7 +258,7 @@ pub fn num_format(field: &FormatField, in_str_opt: Option<&String>) -> Option Date: Sun, 6 Jun 2021 12:19:18 -0500 Subject: [PATCH 0916/1135] refactor/pathchk ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/pathchk/src/pathchk.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/uu/pathchk/src/pathchk.rs b/src/uu/pathchk/src/pathchk.rs index 9667e0ba1..07e3a3289 100644 --- a/src/uu/pathchk/src/pathchk.rs +++ b/src/uu/pathchk/src/pathchk.rs @@ -118,10 +118,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // check a path, given as a slice of it's components and an operating mode fn check_path(mode: &Mode, path: &[String]) -> bool { match *mode { - Mode::Basic => check_basic(&path), - Mode::Extra => check_default(&path) && check_extra(&path), - Mode::Both => check_basic(&path) && check_extra(&path), - _ => check_default(&path), + Mode::Basic => check_basic(path), + Mode::Extra => check_default(path) && check_extra(path), + Mode::Both => check_basic(path) && check_extra(path), + _ => check_default(path), } } @@ -156,7 +156,7 @@ fn check_basic(path: &[String]) -> bool { ); return false; } - if !check_portable_chars(&p) { + if !check_portable_chars(p) { return false; } } @@ -168,7 +168,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 !no_leading_hyphen(p) { writeln!( &mut std::io::stderr(), "leading hyphen in file name component '{}'", From f7028c4175581bd98258615c3037209166607957 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 21:10:36 -0500 Subject: [PATCH 0917/1135] refactor/pinky ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/pinky/src/pinky.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/pinky/src/pinky.rs b/src/uu/pinky/src/pinky.rs index 27dcc2421..d15730b32 100644 --- a/src/uu/pinky/src/pinky.rs +++ b/src/uu/pinky/src/pinky.rs @@ -283,7 +283,7 @@ impl Pinky { } } - print!(" {}", time_string(&ut)); + print!(" {}", time_string(ut)); let mut s = ut.host(); if self.include_where && !s.is_empty() { From ad486a77dcf22e17b262cdb8ce92c8162f15d227 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 23:00:43 -0500 Subject: [PATCH 0918/1135] refactor/pr ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/pr/src/pr.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index 486cedc00..0761dd09d 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -410,7 +410,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let options = &result_options.unwrap(); let cmd_result = if file_group.len() == 1 { - pr(&file_group.get(0).unwrap(), options) + pr(file_group.get(0).unwrap(), options) } else { mpr(&file_group, options) }; @@ -1114,7 +1114,7 @@ fn write_columns( for (i, cell) in row.iter().enumerate() { if cell.is_none() && options.merge_files_print.is_some() { out.write_all( - get_line_for_printing(&options, &blank_line, columns, i, &line_width, indexes) + get_line_for_printing(options, &blank_line, columns, i, &line_width, indexes) .as_bytes(), )?; } else if cell.is_none() { @@ -1124,7 +1124,7 @@ fn write_columns( let file_line = cell.unwrap(); out.write_all( - get_line_for_printing(&options, file_line, columns, i, &line_width, indexes) + get_line_for_printing(options, file_line, columns, i, &line_width, indexes) .as_bytes(), )?; lines_printed += 1; @@ -1149,7 +1149,7 @@ fn get_line_for_printing( indexes: usize, ) -> String { let blank_line = String::new(); - let formatted_line_number = get_formatted_line_number(&options, file_line.line_number, index); + let formatted_line_number = get_formatted_line_number(options, file_line.line_number, index); let mut complete_line = format!( "{}{}", From 750b68a44c759c2530c4131c203b9be005e3a381 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 23:28:19 -0500 Subject: [PATCH 0919/1135] refactor/printf ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- .../tokenize/num_format/formatters/cninetyninehexfloatf.rs | 2 +- .../printf/src/tokenize/num_format/formatters/float_common.rs | 4 ++-- src/uu/printf/src/tokenize/num_format/formatters/floatf.rs | 2 +- src/uu/printf/src/tokenize/num_format/formatters/intf.rs | 4 ++-- src/uu/printf/src/tokenize/num_format/num_format.rs | 2 +- src/uu/printf/src/tokenize/sub.rs | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs b/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs index f96a991b5..0ca993680 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs @@ -26,7 +26,7 @@ impl Formatter for CninetyNineHexFloatf { ) -> Option { let second_field = field.second_field.unwrap_or(6) + 1; let analysis = FloatAnalysis::analyze( - &str_in, + str_in, initial_prefix, Some(second_field as usize), None, diff --git a/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs b/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs index dd8259233..dfd64296c 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs @@ -298,11 +298,11 @@ pub fn get_primitive_dec( pub fn primitive_to_str_common(prim: &FormatPrimitive, field: &FormatField) -> String { let mut final_str = String::new(); if let Some(ref prefix) = prim.prefix { - final_str.push_str(&prefix); + final_str.push_str(prefix); } match prim.pre_decimal { Some(ref pre_decimal) => { - final_str.push_str(&pre_decimal); + final_str.push_str(pre_decimal); } None => { panic!( diff --git a/src/uu/printf/src/tokenize/num_format/formatters/floatf.rs b/src/uu/printf/src/tokenize/num_format/formatters/floatf.rs index aed50f18e..afb2bcf08 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/floatf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/floatf.rs @@ -21,7 +21,7 @@ impl Formatter for Floatf { ) -> Option { let second_field = field.second_field.unwrap_or(6) + 1; let analysis = FloatAnalysis::analyze( - &str_in, + str_in, initial_prefix, None, Some(second_field as usize), diff --git a/src/uu/printf/src/tokenize/num_format/formatters/intf.rs b/src/uu/printf/src/tokenize/num_format/formatters/intf.rs index 02c59211b..b6c18d436 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/intf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/intf.rs @@ -252,7 +252,7 @@ impl Formatter for Intf { fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String { let mut final_str: String = String::new(); if let Some(ref prefix) = prim.prefix { - final_str.push_str(&prefix); + final_str.push_str(prefix); } // integral second fields is zero-padded minimum-width // which gets handled before general minimum-width @@ -266,7 +266,7 @@ impl Formatter for Intf { i -= 1; } } - final_str.push_str(&pre_decimal); + final_str.push_str(pre_decimal); } None => { panic!( diff --git a/src/uu/printf/src/tokenize/num_format/num_format.rs b/src/uu/printf/src/tokenize/num_format/num_format.rs index c030358bb..b32731f2d 100644 --- a/src/uu/printf/src/tokenize/num_format/num_format.rs +++ b/src/uu/printf/src/tokenize/num_format/num_format.rs @@ -235,7 +235,7 @@ pub fn num_format(field: &FormatField, in_str_opt: Option<&String>) -> Option { text_so_far.push('%'); - err_conv(&text_so_far); + err_conv(text_so_far); false } } From 84e08cd0710a452f6f4afe63c473d936d435549f Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 22:01:57 -0500 Subject: [PATCH 0920/1135] refactor/ptx ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/ptx/src/ptx.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index 69960ac49..31da8f05d 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -213,7 +213,7 @@ fn read_input(input_files: &[String], config: &Config) -> FileMap { files.push("-"); } else if config.gnu_ext { for file in input_files { - files.push(&file); + files.push(file); } } else { files.push(&input_files[0]); @@ -503,7 +503,7 @@ fn format_tex_line( let keyword = &line[word_ref.position..word_ref.position_end]; let after_chars_trim_idx = (word_ref.position_end, chars_line.len()); let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1]; - let (tail, before, after, head) = get_output_chunks(&all_before, &keyword, &all_after, &config); + let (tail, before, after, head) = get_output_chunks(all_before, keyword, all_after, config); output.push_str(&format!( "{5}{0}{6}{5}{1}{6}{5}{2}{6}{5}{3}{6}{5}{4}{6}", format_tex_field(&tail), @@ -515,7 +515,7 @@ fn format_tex_line( "}" )); if config.auto_ref || config.input_ref { - output.push_str(&format!("{}{}{}", "{", format_tex_field(&reference), "}")); + output.push_str(&format!("{}{}{}", "{", format_tex_field(reference), "}")); } output } @@ -546,7 +546,7 @@ fn format_roff_line( let keyword = &line[word_ref.position..word_ref.position_end]; let after_chars_trim_idx = (word_ref.position_end, chars_line.len()); let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1]; - let (tail, before, after, head) = get_output_chunks(&all_before, &keyword, &all_after, &config); + let (tail, before, after, head) = get_output_chunks(all_before, keyword, all_after, config); output.push_str(&format!( " \"{}\" \"{}\" \"{}{}\" \"{}\"", format_roff_field(&tail), @@ -556,7 +556,7 @@ fn format_roff_line( format_roff_field(&head) )); if config.auto_ref || config.input_ref { - output.push_str(&format!(" \"{}\"", format_roff_field(&reference))); + output.push_str(&format!(" \"{}\"", format_roff_field(reference))); } output } From 2f7c4884258dde96e214ef25d8d6c19f82bc832d Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 23:00:55 -0500 Subject: [PATCH 0921/1135] refactor/rmdir ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/rmdir/src/rmdir.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/rmdir/src/rmdir.rs b/src/uu/rmdir/src/rmdir.rs index d13a21f60..05cc66d51 100644 --- a/src/uu/rmdir/src/rmdir.rs +++ b/src/uu/rmdir/src/rmdir.rs @@ -88,7 +88,7 @@ fn remove(dirs: Vec, ignore: bool, parents: bool, verbose: bool) -> Resu for dir in &dirs { let path = Path::new(&dir[..]); - r = remove_dir(&path, ignore, verbose).and(r); + r = remove_dir(path, ignore, verbose).and(r); if parents { let mut p = path; while let Some(new_p) = p.parent() { From 08713d22ec1880c5115f6e22312a6c5cf3b75101 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 22:14:34 -0500 Subject: [PATCH 0922/1135] refactor/shred ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/shred/src/shred.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 6a43ed478..964e68a9e 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -381,7 +381,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { for path_str in matches.values_of(options::FILE).unwrap() { wipe_file( - &path_str, iterations, remove, size, exact, zero, verbose, force, + path_str, iterations, remove, size, exact, zero, verbose, force, ); } @@ -659,7 +659,7 @@ fn do_remove(path: &Path, orig_filename: &str, verbose: bool) -> Result<(), io:: println!("{}: {}: removing", NAME, orig_filename); } - let renamed_path: Option = wipe_name(&path, verbose); + let renamed_path: Option = wipe_name(path, verbose); if let Some(rp) = renamed_path { fs::remove_file(rp)?; } From 39dbcda66e0be87c1c5891c84aae9774d509c7ef Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 13:22:12 -0500 Subject: [PATCH 0923/1135] refactor/sort ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/sort/src/check.rs | 4 ++-- src/uu/sort/src/chunks.rs | 6 +++--- src/uu/sort/src/custom_str_cmp.rs | 2 +- src/uu/sort/src/sort.rs | 20 ++++++++++---------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/uu/sort/src/check.rs b/src/uu/sort/src/check.rs index d3b9d6669..a8e5a0d9b 100644 --- a/src/uu/sort/src/check.rs +++ b/src/uu/sort/src/check.rs @@ -49,7 +49,7 @@ pub fn check(path: &str, settings: &GlobalSettings) -> i32 { let prev_last = prev_chunk.borrow_lines().last().unwrap(); let new_first = chunk.borrow_lines().first().unwrap(); - if compare_by(prev_last, new_first, &settings) == Ordering::Greater { + if compare_by(prev_last, new_first, settings) == Ordering::Greater { if !settings.check_silent { println!("sort: {}:{}: disorder: {}", path, line_idx, new_first.line); } @@ -60,7 +60,7 @@ pub fn check(path: &str, settings: &GlobalSettings) -> i32 { for (a, b) in chunk.borrow_lines().iter().tuple_windows() { line_idx += 1; - if compare_by(a, b, &settings) == Ordering::Greater { + if compare_by(a, b, settings) == Ordering::Greater { if !settings.check_silent { println!("sort: {}:{}: disorder: {}", path, line_idx, b.line); } diff --git a/src/uu/sort/src/chunks.rs b/src/uu/sort/src/chunks.rs index dde6febd3..3d996e6d6 100644 --- a/src/uu/sort/src/chunks.rs +++ b/src/uu/sort/src/chunks.rs @@ -90,7 +90,7 @@ pub fn read( if buffer.len() < carry_over.len() { buffer.resize(carry_over.len() + 10 * 1024, 0); } - buffer[..carry_over.len()].copy_from_slice(&carry_over); + buffer[..carry_over.len()].copy_from_slice(carry_over); let (read, should_continue) = read_to_buffer( file, next_files, @@ -110,7 +110,7 @@ pub fn read( std::mem::transmute::>, Vec>>(lines) }; let read = crash_if_err!(1, std::str::from_utf8(&buf[..read])); - parse_lines(read, &mut lines, separator, &settings); + parse_lines(read, &mut lines, separator, settings); lines }); sender.send(payload).unwrap(); @@ -194,7 +194,7 @@ fn read_to_buffer( continue; } } - let mut sep_iter = memchr_iter(separator, &buffer).rev(); + let mut sep_iter = memchr_iter(separator, buffer).rev(); let last_line_end = sep_iter.next(); if sep_iter.next().is_some() { // We read enough lines. diff --git a/src/uu/sort/src/custom_str_cmp.rs b/src/uu/sort/src/custom_str_cmp.rs index a087a9fc2..089d33bc4 100644 --- a/src/uu/sort/src/custom_str_cmp.rs +++ b/src/uu/sort/src/custom_str_cmp.rs @@ -38,7 +38,7 @@ pub fn custom_str_cmp( ) -> Ordering { if !(ignore_case || ignore_non_dictionary || ignore_non_printing) { // There are no custom settings. Fall back to the default strcmp, which is faster. - return a.cmp(&b); + return a.cmp(b); } let mut a_chars = a .chars() diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 70e3325ad..53619d0d6 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -400,9 +400,9 @@ impl<'a> Line<'a> { let line = self.line.replace('\t', ">"); writeln!(writer, "{}", line)?; - let fields = tokenize(&self.line, settings.separator); + let fields = tokenize(self.line, settings.separator); for selector in settings.selectors.iter() { - let mut selection = selector.get_range(&self.line, Some(&fields)); + let mut selection = selector.get_range(self.line, Some(&fields)); match selector.settings.mode { SortMode::Numeric | SortMode::HumanNumeric => { // find out which range is used for numeric comparisons @@ -756,7 +756,7 @@ impl FieldSelector { /// Get the selection that corresponds to this selector for the line. /// If needs_fields returned false, tokens may be None. fn get_selection<'a>(&self, line: &'a str, tokens: Option<&[Field]>) -> Selection<'a> { - let mut range = &line[self.get_range(&line, tokens)]; + let mut range = &line[self.get_range(line, tokens)]; let num_cache = if self.settings.mode == SortMode::Numeric || self.settings.mode == SortMode::HumanNumeric { @@ -846,7 +846,7 @@ impl FieldSelector { match resolve_index(line, tokens, &self.from) { Resolution::StartOfChar(from) => { - let to = self.to.as_ref().map(|to| resolve_index(line, tokens, &to)); + let to = self.to.as_ref().map(|to| resolve_index(line, tokens, to)); let mut range = match to { Some(Resolution::StartOfChar(mut to)) => { @@ -1257,11 +1257,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { fn output_sorted_lines<'a>(iter: impl Iterator>, settings: &GlobalSettings) { if settings.unique { print_sorted( - iter.dedup_by(|a, b| compare_by(a, b, &settings) == Ordering::Equal), - &settings, + iter.dedup_by(|a, b| compare_by(a, b, settings) == Ordering::Equal), + settings, ); } else { - print_sorted(iter, &settings); + print_sorted(iter, settings); } } @@ -1277,16 +1277,16 @@ fn exec(files: &[String], settings: &GlobalSettings) -> i32 { } else { let mut lines = files.iter().map(open); - ext_sort(&mut lines, &settings); + ext_sort(&mut lines, settings); } 0 } fn sort_by<'a>(unsorted: &mut Vec>, settings: &GlobalSettings) { if settings.stable || settings.unique { - unsorted.par_sort_by(|a, b| compare_by(a, b, &settings)) + unsorted.par_sort_by(|a, b| compare_by(a, b, settings)) } else { - unsorted.par_sort_unstable_by(|a, b| compare_by(a, b, &settings)) + unsorted.par_sort_unstable_by(|a, b| compare_by(a, b, settings)) } } From 79a33728ca15811f59a3fe8df60b71cfe467d7ee Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 11:45:19 -0500 Subject: [PATCH 0924/1135] refactor/split ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/split/src/platform/unix.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/split/src/platform/unix.rs b/src/uu/split/src/platform/unix.rs index 20d9d637b..a115d1959 100644 --- a/src/uu/split/src/platform/unix.rs +++ b/src/uu/split/src/platform/unix.rs @@ -66,7 +66,7 @@ impl FilterWriter { /// * `filepath` - Path of the output file (forwarded to command as $FILE) fn new(command: &str, filepath: &str) -> FilterWriter { // set $FILE, save previous value (if there was one) - let _with_env_var_set = WithEnvVarSet::new("FILE", &filepath); + let _with_env_var_set = WithEnvVarSet::new("FILE", filepath); let shell_process = Command::new(env::var("SHELL").unwrap_or_else(|_| "/bin/sh".to_owned())) @@ -117,7 +117,7 @@ pub fn instantiate_current_writer( ) as Box), Some(ref filter_command) => BufWriter::new(Box::new( // spawn a shell command and write to it - FilterWriter::new(&filter_command, &filename), + FilterWriter::new(filter_command, filename), ) as Box), } } From c8c14ca40c4fa7afb6473af1426fed64e478ea9d Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 22:39:02 -0500 Subject: [PATCH 0925/1135] refactor/stat ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/stat/src/stat.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index fa070d9b7..4e1d9d2c9 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -477,7 +477,7 @@ impl Stater { Stater::generate_tokens(&Stater::default_format(show_fs, terse, false), use_printf) .unwrap() } else { - Stater::generate_tokens(&format_str, use_printf)? + Stater::generate_tokens(format_str, use_printf)? }; let default_dev_tokens = Stater::generate_tokens(&Stater::default_format(show_fs, terse, true), use_printf) From 6e98ea78ac1554ca2d533691bac56b1301a81e82 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 13:28:14 -0500 Subject: [PATCH 0926/1135] refactor/stdbuf ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/stdbuf/src/stdbuf.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 852fe3ef9..5baff4825 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -69,9 +69,9 @@ impl<'a> TryFrom<&ArgMatches<'a>> for ProgramOptions { fn try_from(matches: &ArgMatches) -> Result { Ok(ProgramOptions { - stdin: check_option(&matches, options::INPUT)?, - stdout: check_option(&matches, options::OUTPUT)?, - stderr: check_option(&matches, options::ERROR)?, + stdin: check_option(matches, options::INPUT)?, + stdout: check_option(matches, options::OUTPUT)?, + stderr: check_option(matches, options::ERROR)?, }) } } From a8a2b3ec84f62aa0a0331245651d7701b229012c Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 13:54:09 -0500 Subject: [PATCH 0927/1135] refactor/timeout ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/timeout/src/timeout.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index 4ef9b2331..afe560ee5 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -55,7 +55,7 @@ impl Config { fn from(options: clap::ArgMatches) -> Config { let signal = match options.value_of(options::SIGNAL) { Some(signal_) => { - let signal_result = signal_by_name_or_value(&signal_); + let signal_result = signal_by_name_or_value(signal_); match signal_result { None => { unreachable!("invalid signal '{}'", signal_); @@ -67,7 +67,7 @@ impl Config { }; let kill_after: Duration = match options.value_of(options::KILL_AFTER) { - Some(time) => uucore::parse_time::from_str(&time).unwrap(), + Some(time) => uucore::parse_time::from_str(time).unwrap(), None => Duration::new(0, 0), }; From 8f0d42da39dc7f51afca026e87f8553160e19f35 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 5 Jun 2021 22:38:53 -0500 Subject: [PATCH 0928/1135] refactor/wc ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- src/uu/wc/src/wc.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 031c25739..d1e1f75ca 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -374,8 +374,8 @@ fn wc(inputs: Vec, settings: &Settings) -> Result<(), u32> { let num_inputs = inputs.len(); for input in &inputs { - let word_count = word_count_from_input(&input, settings).unwrap_or_else(|err| { - show_error(&input, err); + let word_count = word_count_from_input(input, settings).unwrap_or_else(|err| { + show_error(input, err); error_count += 1; WordCount::default() }); From 0dc8c18bac79680214fdec07ed053b11b3c4672b Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 14:13:54 -0500 Subject: [PATCH 0929/1135] tests ~ fix `cargo clippy` complaint (clippy::needless_borrow) --- tests/by-util/test_cat.rs | 2 +- tests/by-util/test_cp.rs | 8 ++++---- tests/by-util/test_ls.rs | 20 ++++++++++---------- tests/by-util/test_pathchk.rs | 12 ++++++------ 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index fadf378ab..d83b5515b 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -438,7 +438,7 @@ fn test_domain_socket() { let child = new_ucmd!().args(&[socket_path]).run_no_wait(); barrier.wait(); let stdout = &child.wait_with_output().unwrap().stdout; - let output = String::from_utf8_lossy(&stdout); + let output = String::from_utf8_lossy(stdout); assert_eq!("a\tb", output); thread.join().unwrap(); diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index ff607f984..bc6c6fc79 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -618,7 +618,7 @@ fn test_cp_deref() { // Check the content of the destination file that was copied. assert_eq!(at.read(TEST_COPY_TO_FOLDER_FILE), "Hello, World!\n"); let path_to_check = path_to_new_symlink.to_str().unwrap(); - assert_eq!(at.read(&path_to_check), "Hello, World!\n"); + assert_eq!(at.read(path_to_check), "Hello, World!\n"); } #[test] fn test_cp_no_deref() { @@ -655,7 +655,7 @@ fn test_cp_no_deref() { // Check the content of the destination file that was copied. assert_eq!(at.read(TEST_COPY_TO_FOLDER_FILE), "Hello, World!\n"); let path_to_check = path_to_new_symlink.to_str().unwrap(); - assert_eq!(at.read(&path_to_check), "Hello, World!\n"); + assert_eq!(at.read(path_to_check), "Hello, World!\n"); } #[test] @@ -823,7 +823,7 @@ fn test_cp_deref_folder_to_folder() { // Check the content of the symlink let path_to_check = path_to_new_symlink.to_str().unwrap(); - assert_eq!(at.read(&path_to_check), "Hello, World!\n"); + assert_eq!(at.read(path_to_check), "Hello, World!\n"); } #[test] @@ -923,7 +923,7 @@ fn test_cp_no_deref_folder_to_folder() { // Check the content of the symlink let path_to_check = path_to_new_symlink.to_str().unwrap(); - assert_eq!(at.read(&path_to_check), "Hello, World!\n"); + assert_eq!(at.read(path_to_check), "Hello, World!\n"); } #[test] diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 20c6b913d..33373960f 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -398,7 +398,7 @@ fn test_ls_long_formats() { .arg("--author") .arg("test-long-formats") .succeeds(); - assert!(re_three.is_match(&result.stdout_str())); + assert!(re_three.is_match(result.stdout_str())); #[cfg(unix)] { @@ -701,20 +701,20 @@ fn test_ls_styles() { .arg("-l") .arg("--time-style=full-iso") .succeeds(); - assert!(re_full.is_match(&result.stdout_str())); + assert!(re_full.is_match(result.stdout_str())); //long-iso let result = scene .ucmd() .arg("-l") .arg("--time-style=long-iso") .succeeds(); - assert!(re_long.is_match(&result.stdout_str())); + assert!(re_long.is_match(result.stdout_str())); //iso let result = scene.ucmd().arg("-l").arg("--time-style=iso").succeeds(); - assert!(re_iso.is_match(&result.stdout_str())); + assert!(re_iso.is_match(result.stdout_str())); //locale let result = scene.ucmd().arg("-l").arg("--time-style=locale").succeeds(); - assert!(re_locale.is_match(&result.stdout_str())); + assert!(re_locale.is_match(result.stdout_str())); //Overwrite options tests let result = scene @@ -723,19 +723,19 @@ fn test_ls_styles() { .arg("--time-style=long-iso") .arg("--time-style=iso") .succeeds(); - assert!(re_iso.is_match(&result.stdout_str())); + assert!(re_iso.is_match(result.stdout_str())); let result = scene .ucmd() .arg("--time-style=iso") .arg("--full-time") .succeeds(); - assert!(re_full.is_match(&result.stdout_str())); + assert!(re_full.is_match(result.stdout_str())); let result = scene .ucmd() .arg("--full-time") .arg("--time-style=iso") .succeeds(); - assert!(re_iso.is_match(&result.stdout_str())); + assert!(re_iso.is_match(result.stdout_str())); let result = scene .ucmd() @@ -743,7 +743,7 @@ fn test_ls_styles() { .arg("--time-style=iso") .arg("--full-time") .succeeds(); - assert!(re_full.is_match(&result.stdout_str())); + assert!(re_full.is_match(result.stdout_str())); let result = scene .ucmd() @@ -751,7 +751,7 @@ fn test_ls_styles() { .arg("-x") .arg("-l") .succeeds(); - assert!(re_full.is_match(&result.stdout_str())); + assert!(re_full.is_match(result.stdout_str())); at.touch("test2"); let result = scene.ucmd().arg("--full-time").arg("-x").succeeds(); diff --git a/tests/by-util/test_pathchk.rs b/tests/by-util/test_pathchk.rs index 3bc12f0b6..8ba3b9033 100644 --- a/tests/by-util/test_pathchk.rs +++ b/tests/by-util/test_pathchk.rs @@ -38,7 +38,7 @@ fn test_posix_mode() { // fail on long path new_ucmd!() - .args(&["-p", &"dir".repeat(libc::PATH_MAX as usize + 1).as_str()]) + .args(&["-p", "dir".repeat(libc::PATH_MAX as usize + 1).as_str()]) .fails() .no_stdout(); @@ -46,7 +46,7 @@ fn test_posix_mode() { new_ucmd!() .args(&[ "-p", - &format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(), + format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(), ]) .fails() .no_stdout(); @@ -76,7 +76,7 @@ fn test_posix_special() { // fail on long path new_ucmd!() - .args(&["-P", &"dir".repeat(libc::PATH_MAX as usize + 1).as_str()]) + .args(&["-P", "dir".repeat(libc::PATH_MAX as usize + 1).as_str()]) .fails() .no_stdout(); @@ -84,7 +84,7 @@ fn test_posix_special() { new_ucmd!() .args(&[ "-P", - &format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(), + format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(), ]) .fails() .no_stdout(); @@ -117,7 +117,7 @@ fn test_posix_all() { .args(&[ "-p", "-P", - &"dir".repeat(libc::PATH_MAX as usize + 1).as_str(), + "dir".repeat(libc::PATH_MAX as usize + 1).as_str(), ]) .fails() .no_stdout(); @@ -127,7 +127,7 @@ fn test_posix_all() { .args(&[ "-p", "-P", - &format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(), + format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(), ]) .fails() .no_stdout(); From 26cb6540da6ae38d1c9562cff85144b5e1902cbd Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 14:14:35 -0500 Subject: [PATCH 0930/1135] tests ~ fix `cargo clippy` complaint (clippy::useless_format) --- tests/by-util/test_ls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 33373960f..f8aa4453b 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1143,7 +1143,7 @@ fn test_ls_indicator_style() { for opt in options { scene .ucmd() - .arg(format!("{}", opt)) + .arg(opt.to_string()) .succeeds() .stdout_contains(&"/"); } From 3f0ac0612220dc7bf669338060cf08ac8a4db89b Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 13:59:48 -0500 Subject: [PATCH 0931/1135] refactor/od ~ fix `cargo clippy` complaint (*allow* clippy::enum_variant_names) --- src/uu/od/src/formatteriteminfo.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uu/od/src/formatteriteminfo.rs b/src/uu/od/src/formatteriteminfo.rs index d44d97a92..13cf62246 100644 --- a/src/uu/od/src/formatteriteminfo.rs +++ b/src/uu/od/src/formatteriteminfo.rs @@ -2,6 +2,7 @@ use std::fmt; +#[allow(clippy::enum_variant_names)] #[derive(Copy)] pub enum FormatWriter { IntWriter(fn(u64) -> String), From 7df5acc2dccdaa8d7bdc5396c3f3f6f21632cabb Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 17:43:44 -0500 Subject: [PATCH 0932/1135] tests ~ fix `cargo clippy` complaint (*allow* clippy::manual_strip; with FixME/ToDO) - replace with the included/noted code when MSRV includes a stabilized `String::strip_prefix()` --- tests/common/util.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/common/util.rs b/tests/common/util.rs index 2f7d7dcc4..11425e9b8 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -625,11 +625,20 @@ impl AtPath { // Source: // http://stackoverflow.com/questions/31439011/getfinalpathnamebyhandle-without-prepended let prefix = "\\\\?\\"; + // FixME: replace ... + #[allow(clippy::manual_strip)] if s.starts_with(prefix) { String::from(&s[prefix.len()..]) } else { s } + // ... with ... + // if let Some(stripped) = s.strip_prefix(prefix) { + // String::from(stripped) + // } else { + // s + // } + // ... when using MSRV with stabilized `strip_prefix()` } } From 9feff1e441f4e04e393231b8346cae897cb04639 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 15:07:48 -0500 Subject: [PATCH 0933/1135] tests ~ fix `cargo clippy` complaint (*allow* clippy::needless_borrow; for *false positives*) --- tests/by-util/test_pinky.rs | 2 ++ tests/by-util/test_stat.rs | 2 ++ tests/by-util/test_users.rs | 2 ++ tests/by-util/test_who.rs | 2 ++ 4 files changed, 8 insertions(+) diff --git a/tests/by-util/test_pinky.rs b/tests/by-util/test_pinky.rs index 0813e5e1b..8b50ec2bd 100644 --- a/tests/by-util/test_pinky.rs +++ b/tests/by-util/test_pinky.rs @@ -102,6 +102,8 @@ fn expected_result(args: &[&str]) -> String { #[cfg(target_vendor = "apple")] let util_name = format!("g{}", util_name!()); + // note: clippy::needless_borrow *false positive* + #[allow(clippy::needless_borrow)] TestScenario::new(&util_name) .cmd_keepenv(util_name) .env("LANGUAGE", "C") diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 89dd96752..37328d5ae 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -313,6 +313,8 @@ fn expected_result(args: &[&str]) -> String { #[cfg(target_vendor = "apple")] let util_name = format!("g{}", util_name!()); + // note: clippy::needless_borrow *false positive* + #[allow(clippy::needless_borrow)] TestScenario::new(&util_name) .cmd_keepenv(util_name) .env("LANGUAGE", "C") diff --git a/tests/by-util/test_users.rs b/tests/by-util/test_users.rs index 8ceb0eeb8..68bdf9a5e 100644 --- a/tests/by-util/test_users.rs +++ b/tests/by-util/test_users.rs @@ -13,6 +13,8 @@ fn test_users_check_name() { #[cfg(target_vendor = "apple")] let util_name = format!("g{}", util_name!()); + // note: clippy::needless_borrow *false positive* + #[allow(clippy::needless_borrow)] let expected = TestScenario::new(&util_name) .cmd_keepenv(util_name) .env("LANGUAGE", "C") diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index 16444b0cb..4907d2306 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -238,6 +238,8 @@ fn expected_result(args: &[&str]) -> String { #[cfg(target_vendor = "apple")] let util_name = format!("g{}", util_name!()); + // note: clippy::needless_borrow *false positive* + #[allow(clippy::needless_borrow)] TestScenario::new(&util_name) .cmd_keepenv(util_name) .env("LANGUAGE", "C") From 423f4f9bf12103e1382c7f5497a6de51d34d0693 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 17:40:22 -0500 Subject: [PATCH 0934/1135] fix/cp ~ correct `cargo clippy` complaint exception (*allow* clippy::unnecessary_wraps) --- src/uu/cp/src/cp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 6a114cf44..cc0103044 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1088,7 +1088,7 @@ fn copy_attribute(source: &Path, dest: &Path, attribute: &Attribute) -> CopyResu } #[cfg(not(windows))] -#[allow(clippy::unnecessary_unwrap)] // needed for windows version +#[allow(clippy::unnecessary_wraps)] // needed for windows version fn symlink_file(source: &Path, dest: &Path, context: &str) -> CopyResult<()> { match std::os::unix::fs::symlink(source, dest).context(context) { Ok(_) => Ok(()), From 5b697aace81944327be20b32e21b618e5494b5fa Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 11:18:12 -0500 Subject: [PATCH 0935/1135] maint/build ~ normalize makefile recipe format --- GNUmakefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 102856b66..5d7966722 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -268,11 +268,11 @@ test: ${CARGO} test ${CARGOFLAGS} --features "$(TESTS) $(TEST_SPEC_FEATURE)" --no-default-features $(TEST_NO_FAIL_FAST) busybox-src: - if [ ! -e $(BUSYBOX_SRC) ]; then \ - mkdir -p $(BUSYBOX_ROOT); \ - wget https://busybox.net/downloads/busybox-$(BUSYBOX_VER).tar.bz2 -P $(BUSYBOX_ROOT); \ - tar -C $(BUSYBOX_ROOT) -xf $(BUSYBOX_ROOT)/busybox-$(BUSYBOX_VER).tar.bz2; \ - fi; \ + if [ ! -e "$(BUSYBOX_SRC)" ] ; then \ + mkdir -p "$(BUSYBOX_ROOT)" ; \ + wget "https://busybox.net/downloads/busybox-$(BUSYBOX_VER).tar.bz2" -P "$(BUSYBOX_ROOT)" ; \ + tar -C "$(BUSYBOX_ROOT)" -xf "$(BUSYBOX_ROOT)/busybox-$(BUSYBOX_VER).tar.bz2" ; \ + fi ; # This is a busybox-specific config file their test suite wants to parse. $(BUILDDIR)/.config: $(BASEDIR)/.busybox-config @@ -280,8 +280,8 @@ $(BUILDDIR)/.config: $(BASEDIR)/.busybox-config # Test under the busybox test suite $(BUILDDIR)/busybox: busybox-src build-coreutils $(BUILDDIR)/.config - cp $(BUILDDIR)/coreutils $(BUILDDIR)/busybox; \ - chmod +x $@; + cp "$(BUILDDIR)/coreutils" "$(BUILDDIR)/busybox" + chmod +x $@ prepare-busytest: $(BUILDDIR)/busybox From 4495964864c2758c652981fe8b310c323ae7ade6 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 11:21:38 -0500 Subject: [PATCH 0936/1135] maint/CICD ~ disable inapplicable tests from BusyTests --- GNUmakefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/GNUmakefile b/GNUmakefile index 5d7966722..e5ad01340 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -284,6 +284,8 @@ $(BUILDDIR)/busybox: busybox-src build-coreutils $(BUILDDIR)/.config chmod +x $@ prepare-busytest: $(BUILDDIR)/busybox + # disable inapplicable tests + -( cd "$(BUSYBOX_SRC)/testsuite" ; if [ -e "busybox.tests" ] ; then mv busybox.tests busybox.tests- ; fi ; ) ifeq ($(EXES),) busytest: From 2ff46a78b108690d13e4cda409a57ec9252c37d4 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 11:22:42 -0500 Subject: [PATCH 0937/1135] maint/CICD ~ summarize BusyTest output for dashboard --- .github/workflows/CICD.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index ad3177224..a8ed1b704 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -197,7 +197,11 @@ jobs: run: | bindir=$(pwd)/target/debug cd tmp/busybox-*/testsuite - S=$(bindir=$bindir ./runtest) && printf "%s\n" "$S" || { printf "%s\n" "$S" | grep "FAIL:" | sed -e "s/FAIL: /::warning ::Test failure:/g" ; } + ## S=$(bindir=$bindir ./runtest) && printf "%s\n" "$S" || { printf "%s\n" "$S" | grep "FAIL:" | sed -e "s/FAIL: /::warning ::Test failure:/g" ; } + output=$(bindir=$bindir ./runtest 2>&1 || true) + printf "%s\n" "${output}" + n_fails=$(echo "$output" | grep "^FAIL:\s" | wc --lines) + if [ $n_fails -gt 0 ] ; then echo "::warning ::${n_fails}+ test failures" ; fi makefile_build: name: Test the build target of the Makefile From 1faa9eebab2bca3baeb6ef387d784971a90ca1ab Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Jun 2021 19:24:04 -0500 Subject: [PATCH 0938/1135] refactor/polish ~ `cargo make format` --- tests/by-util/test_sort.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 75611abfc..7a0143b43 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -844,12 +844,7 @@ fn test_compress_fail() { #[test] fn test_merge_batches() { new_ucmd!() - .args(&[ - "ext_sort.txt", - "-n", - "-S", - "150B", - ]) + .args(&["ext_sort.txt", "-n", "-S", "150B"]) .succeeds() .stdout_only_fixture("ext_sort.expected"); } From 98225105afc35feb703c4fe8ce6c41add551c582 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 6 Jun 2021 00:03:53 +0200 Subject: [PATCH 0939/1135] id: implement '--zero' flag * add tests for '--zero' flag * add a bunch of requires/conflicts rules for flags (incl. tests) --- src/uu/id/src/id.rs | 56 +++++++++++++----- tests/by-util/test_id.rs | 123 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 157 insertions(+), 22 deletions(-) diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index b32988ebc..f44d77c5f 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -13,8 +13,10 @@ // This is not based on coreutils (8.32) GNU's `id`. // This is based on BSD's `id` (noticeable in functionality, usage text, options text, etc.) // +// Option '--zero' does not exist for BSD's `id`, therefor '--zero' is only allowed together +// with other options that are available on GNU's `id`. -// spell-checker:ignore (ToDO) asid auditid auditinfo auid cstr egid emod euid getaudit getlogin gflag nflag pline rflag termid uflag +// spell-checker:ignore (ToDO) asid auditid auditinfo auid cstr egid emod euid getaudit getlogin gflag nflag pline rflag termid uflag gsflag zflag #![allow(non_camel_case_types)] #![allow(dead_code)] @@ -85,6 +87,7 @@ mod options { pub const OPT_NAME: &str = "name"; pub const OPT_PASSWORD: &str = "password"; // GNU's id does not have this pub const OPT_REAL_ID: &str = "real"; + pub const OPT_ZERO: &str = "zero"; // BSD's id does not have this pub const ARG_USERS: &str = "USER"; } @@ -102,26 +105,28 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg( Arg::with_name(options::OPT_AUDIT) .short("A") + .conflicts_with_all(&[options::OPT_GROUP, options::OPT_EFFECTIVE_USER, options::OPT_HUMAN_READABLE, options::OPT_PASSWORD, options::OPT_GROUPS, options::OPT_ZERO]) .help("Display the process audit user ID and other process audit properties, which requires privilege (not available on Linux)."), ) .arg( Arg::with_name(options::OPT_EFFECTIVE_USER) .short("u") .long(options::OPT_EFFECTIVE_USER) - .help("Display the effective user ID as a number."), + .conflicts_with(options::OPT_GROUP) + .help("Display only the effective user ID as a number."), ) .arg( Arg::with_name(options::OPT_GROUP) .short("g") .long(options::OPT_GROUP) - .help("Display the effective group ID as a number"), + .help("Display only the effective group ID as a number"), ) .arg( Arg::with_name(options::OPT_GROUPS) .short("G") .long(options::OPT_GROUPS) .conflicts_with_all(&[options::OPT_GROUP, options::OPT_EFFECTIVE_USER, options::OPT_HUMAN_READABLE, options::OPT_PASSWORD, options::OPT_AUDIT]) - .help("Display the different group IDs as white-space separated numbers, in no particular order."), + .help("Display only the different group IDs as white-space separated numbers, in no particular order."), ) .arg( Arg::with_name(options::OPT_HUMAN_READABLE) @@ -145,6 +150,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::OPT_REAL_ID) .help("Display the real ID for the -g and -u options instead of the effective ID."), ) + .arg( + Arg::with_name(options::OPT_ZERO) + .short("z") + .long(options::OPT_ZERO) + .help("delimit entries with NUL characters, not whitespace;\nnot permitted in default format"), + ) .arg( Arg::with_name(options::ARG_USERS) .multiple(true) @@ -158,11 +169,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let gflag = matches.is_present(options::OPT_GROUP); let gsflag = matches.is_present(options::OPT_GROUPS); let rflag = matches.is_present(options::OPT_REAL_ID); + let zflag = matches.is_present(options::OPT_ZERO); - // -ugG + // "default format" is when none of '-ugG' was used + // could not implement these "required" rules with just clap if (nflag || rflag) && !(uflag || gflag || gsflag) { crash!(1, "cannot print only names or real IDs in default format"); } + if (zflag) && !(uflag || gflag || gsflag) { + crash!(1, "option --zero not permitted in default format"); + } let users: Vec = matches .values_of(options::ARG_USERS) @@ -183,17 +199,20 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } }; + let line_ending = if zflag { '\0' } else { '\n' }; + if gflag { let id = possible_pw .map(|p| p.gid()) .unwrap_or(if rflag { getgid() } else { getegid() }); - println!( - "{}", + print!( + "{}{}", if nflag { entries::gid2grp(id).unwrap_or_else(|_| id.to_string()) } else { id.to_string() - } + }, + line_ending ); return 0; } @@ -202,20 +221,22 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let id = possible_pw .map(|p| p.uid()) .unwrap_or(if rflag { getuid() } else { geteuid() }); - println!( - "{}", + print!( + "{}{}", if nflag { entries::uid2usr(id).unwrap_or_else(|_| id.to_string()) } else { id.to_string() - } + }, + line_ending ); return 0; } if gsflag { - println!( - "{}", + let delimiter = if zflag { "" } else { " " }; + print!( + "{}{}", if nflag { possible_pw .map(|p| p.belongs_to()) @@ -223,7 +244,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .iter() .map(|&id| entries::gid2grp(id).unwrap()) .collect::>() - .join(" ") + .join(delimiter) } else { possible_pw .map(|p| p.belongs_to()) @@ -231,8 +252,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .iter() .map(|&id| id.to_string()) .collect::>() - .join(" ") - } + .join(delimiter) + }, + line_ending ); return 0; } @@ -398,3 +420,5 @@ fn id_print(possible_pw: Option, p_euid: bool, p_egid: bool) { .join(",") ); } + +fn get_groups() -> diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index 1f8249aab..a8ad37190 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -96,11 +96,19 @@ fn test_id_group() { let mut result = scene.ucmd().arg("-g").succeeds(); let s1 = result.stdout_str().trim(); - assert!(s1.parse::().is_ok()); + assert!(s1.parse::().is_ok()); result = scene.ucmd().arg("--group").succeeds(); let s1 = result.stdout_str().trim(); - assert!(s1.parse::().is_ok()); + assert!(s1.parse::().is_ok()); + + #[cfg(any(target_vendor = "apple", target_os = "linux"))] + for flag in &["-g", "--group"] { + new_ucmd!() + .arg(flag) + .succeeds() + .stdout_is(expected_result(&[flag], false)); + } } #[test] @@ -110,13 +118,22 @@ fn test_id_groups() { let result = scene.ucmd().arg("-G").succeeds(); let groups = result.stdout_str().trim().split_whitespace(); for s in groups { - assert!(s.parse::().is_ok()); + assert!(s.parse::().is_ok()); } let result = scene.ucmd().arg("--groups").succeeds(); let groups = result.stdout_str().trim().split_whitespace(); for s in groups { - assert!(s.parse::().is_ok()); + assert!(s.parse::().is_ok()); + } + + #[cfg(any(target_vendor = "apple", target_os = "linux"))] + for args in &["-G", "--groups"] { + let expect = expected_result(&[args], false); + let actual = new_ucmd!().arg(&args).succeeds().stdout_move_str(); + let mut v_actual: Vec<&str> = actual.split_whitespace().collect(); + let mut v_expect: Vec<&str> = expect.split_whitespace().collect(); + assert_eq!(v_actual.sort_unstable(), v_expect.sort_unstable()); } } @@ -126,11 +143,19 @@ fn test_id_user() { let result = scene.ucmd().arg("-u").succeeds(); let s1 = result.stdout_str().trim(); - assert!(s1.parse::().is_ok()); + assert!(s1.parse::().is_ok()); let result = scene.ucmd().arg("--user").succeeds(); let s1 = result.stdout_str().trim(); - assert!(s1.parse::().is_ok()); + assert!(s1.parse::().is_ok()); + + #[cfg(any(target_vendor = "apple", target_os = "linux"))] + for flag in &["-u", "--user"] { + new_ucmd!() + .arg(flag) + .succeeds() + .stdout_is(expected_result(&[flag], false)); + } } #[test] @@ -167,3 +192,89 @@ fn test_id_password_style() { assert!(result.stdout_str().starts_with(&username)); } + +#[test] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] +fn test_id_default_format() { + // -ugG + for flag in &["--name", "--real"] { + new_ucmd!() + .arg(flag) + .fails() + .stderr_is(expected_result(&[flag], true)); + for &opt in &["--user", "--group", "--groups"] { + if is_ci() && *flag == "--name" { + // '--name' does not work in CI: + // id: cannot find name for user ID 1001 + // id: cannot find name for group ID 116 + println!("test skipped:"); + continue; + } + let args = [opt, flag]; + let expect = expected_result(&args, false); + let actual = new_ucmd!().args(&args).succeeds().stdout_move_str(); + let mut v_actual: Vec<&str> = actual.split_whitespace().collect(); + let mut v_expect: Vec<&str> = expect.split_whitespace().collect(); + assert_eq!(v_actual.sort_unstable(), v_expect.sort_unstable()); + } + } +} + +#[test] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] +fn test_id_zero() { + for z_flag in &["-z", "--zero"] { + for &opt in &["-n", "--name", "-r", "--real"] { + let args = [opt, z_flag]; + new_ucmd!() + .args(&args) + .fails() + .stderr_is(expected_result(&args, true)); + } + for &opt in &["-u", "--user", "-g", "--group"] { + let args = [opt, z_flag]; + new_ucmd!() + .args(&args) + .succeeds() + .stdout_is(expected_result(&args, false)); + } + // '--groups' ids are in no particular order and when paired with '--zero' there's no + // delimiter which makes the split_whitespace-collect-into-vector comparison impossible. + for opt in &["-G", "--groups"] { + let args = [opt, z_flag]; + let result = new_ucmd!().args(&args).succeeds().stdout_move_str(); + assert!(!result.contains(" ")); + assert!(result.ends_with('\0')); + } + } +} + +#[cfg(any(target_vendor = "apple", target_os = "linux"))] +fn expected_result(args: &[&str], exp_fail: bool) -> String { + #[cfg(target_os = "linux")] + let util_name = util_name!(); + #[cfg(target_vendor = "apple")] + let util_name = format!("g{}", util_name!()); + + let result = if !exp_fail { + TestScenario::new(&util_name) + .cmd_keepenv(util_name) + .env("LANGUAGE", "C") + .args(args) + .succeeds() + .stdout_move_str() + } else { + TestScenario::new(&util_name) + .cmd_keepenv(util_name) + .env("LANGUAGE", "C") + .args(args) + .fails() + .stderr_move_str() + }; + // #[cfg(target_vendor = "apple")] + return if cfg!(target_os = "macos") && result.starts_with("gid") { + result[1..].to_string() + } else { + result + }; +} From 448caa3d1c09272868e3dad71c8edb24c5cd432e Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 7 Jun 2021 14:51:58 +0200 Subject: [PATCH 0940/1135] ln: refactor argument handling --- src/uu/ln/src/ln.rs | 111 ++++++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 55 deletions(-) diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index cd5eef842..3d40b6bab 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -78,17 +78,19 @@ fn get_long_usage() -> String { static ABOUT: &str = "change file owner and group"; -static OPT_B: &str = "b"; -static OPT_BACKUP: &str = "backup"; -static OPT_FORCE: &str = "force"; -static OPT_INTERACTIVE: &str = "interactive"; -static OPT_NO_DEREFERENCE: &str = "no-dereference"; -static OPT_SYMBOLIC: &str = "symbolic"; -static OPT_SUFFIX: &str = "suffix"; -static OPT_TARGET_DIRECTORY: &str = "target-directory"; -static OPT_NO_TARGET_DIRECTORY: &str = "no-target-directory"; -static OPT_RELATIVE: &str = "relative"; -static OPT_VERBOSE: &str = "verbose"; +mod options { + pub const B: &str = "b"; + pub const BACKUP: &str = "backup"; + pub const FORCE: &str = "force"; + pub const INTERACTIVE: &str = "interactive"; + pub const NO_DEREFERENCE: &str = "no-dereference"; + pub const SYMBOLIC: &str = "symbolic"; + pub const SUFFIX: &str = "suffix"; + pub const TARGET_DIRECTORY: &str = "target-directory"; + pub const NO_TARGET_DIRECTORY: &str = "no-target-directory"; + pub const RELATIVE: &str = "relative"; + pub const VERBOSE: &str = "verbose"; +} static ARG_FILES: &str = "files"; @@ -101,47 +103,42 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .after_help(&long_usage[..]) - .arg(Arg::with_name(OPT_B).short(OPT_B).help( + .arg(Arg::with_name(options::B).short(options::B).help( "make a backup of each file that would otherwise be overwritten or \ removed", )) .arg( - Arg::with_name(OPT_BACKUP) - .long(OPT_BACKUP) + Arg::with_name(options::BACKUP) + .long(options::BACKUP) .help( "make a backup of each file that would otherwise be overwritten \ or removed", ) .takes_value(true) - .possible_value("simple") - .possible_value("never") - .possible_value("numbered") - .possible_value("t") - .possible_value("existing") - .possible_value("nil") - .possible_value("none") - .possible_value("off") + .possible_values(&[ + "simple", "never", "numbered", "t", "existing", "nil", "none", "off", + ]) .value_name("METHOD"), ) // TODO: opts.arg( // Arg::with_name(("d", "directory", "allow users with appropriate privileges to attempt \ // to make hard links to directories"); .arg( - Arg::with_name(OPT_FORCE) + Arg::with_name(options::FORCE) .short("f") - .long(OPT_FORCE) + .long(options::FORCE) .help("remove existing destination files"), ) .arg( - Arg::with_name(OPT_INTERACTIVE) + Arg::with_name(options::INTERACTIVE) .short("i") - .long(OPT_INTERACTIVE) + .long(options::INTERACTIVE) .help("prompt whether to remove existing destination files"), ) .arg( - Arg::with_name(OPT_NO_DEREFERENCE) + Arg::with_name(options::NO_DEREFERENCE) .short("n") - .long(OPT_NO_DEREFERENCE) + .long(options::NO_DEREFERENCE) .help( "treat LINK_executable!() as a normal file if it is a \ symbolic link to a directory", @@ -153,43 +150,45 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // TODO: opts.arg( // Arg::with_name(("P", "physical", "make hard links directly to symbolic links"); .arg( - Arg::with_name(OPT_SYMBOLIC) + Arg::with_name(options::SYMBOLIC) .short("s") .long("symbolic") - .help("make symbolic links instead of hard links"), + .help("make symbolic links instead of hard links") + // override added for https://github.com/uutils/coreutils/issues/2359 + .overrides_with(options::SYMBOLIC), ) .arg( - Arg::with_name(OPT_SUFFIX) + Arg::with_name(options::SUFFIX) .short("S") - .long(OPT_SUFFIX) + .long(options::SUFFIX) .help("override the usual backup suffix") .value_name("SUFFIX") .takes_value(true), ) .arg( - Arg::with_name(OPT_TARGET_DIRECTORY) + Arg::with_name(options::TARGET_DIRECTORY) .short("t") - .long(OPT_TARGET_DIRECTORY) + .long(options::TARGET_DIRECTORY) .help("specify the DIRECTORY in which to create the links") .value_name("DIRECTORY") - .conflicts_with(OPT_NO_TARGET_DIRECTORY), + .conflicts_with(options::NO_TARGET_DIRECTORY), ) .arg( - Arg::with_name(OPT_NO_TARGET_DIRECTORY) + Arg::with_name(options::NO_TARGET_DIRECTORY) .short("T") - .long(OPT_NO_TARGET_DIRECTORY) + .long(options::NO_TARGET_DIRECTORY) .help("treat LINK_executable!() as a normal file always"), ) .arg( - Arg::with_name(OPT_RELATIVE) + Arg::with_name(options::RELATIVE) .short("r") - .long(OPT_RELATIVE) + .long(options::RELATIVE) .help("create symbolic links relative to link location"), ) .arg( - Arg::with_name(OPT_VERBOSE) + Arg::with_name(options::VERBOSE) .short("v") - .long(OPT_VERBOSE) + .long(options::VERBOSE) .help("print name of each linked file"), ) .arg( @@ -209,18 +208,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .map(PathBuf::from) .collect(); - let overwrite_mode = if matches.is_present(OPT_FORCE) { + let overwrite_mode = if matches.is_present(options::FORCE) { OverwriteMode::Force - } else if matches.is_present(OPT_INTERACTIVE) { + } else if matches.is_present(options::INTERACTIVE) { OverwriteMode::Interactive } else { OverwriteMode::NoClobber }; - let backup_mode = if matches.is_present(OPT_B) { + let backup_mode = if matches.is_present(options::B) { BackupMode::ExistingBackup - } else if matches.is_present(OPT_BACKUP) { - match matches.value_of(OPT_BACKUP) { + } else if matches.is_present(options::BACKUP) { + match matches.value_of(options::BACKUP) { None => BackupMode::ExistingBackup, Some(mode) => match mode { "simple" | "never" => BackupMode::SimpleBackup, @@ -234,8 +233,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { BackupMode::NoBackup }; - let backup_suffix = if matches.is_present(OPT_SUFFIX) { - matches.value_of(OPT_SUFFIX).unwrap() + let backup_suffix = if matches.is_present(options::SUFFIX) { + matches.value_of(options::SUFFIX).unwrap() } else { "~" }; @@ -243,14 +242,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let settings = Settings { overwrite: overwrite_mode, backup: backup_mode, - force: matches.is_present(OPT_FORCE), + force: matches.is_present(options::FORCE), suffix: backup_suffix.to_string(), - symbolic: matches.is_present(OPT_SYMBOLIC), - relative: matches.is_present(OPT_RELATIVE), - target_dir: matches.value_of(OPT_TARGET_DIRECTORY).map(String::from), - no_target_dir: matches.is_present(OPT_NO_TARGET_DIRECTORY), - no_dereference: matches.is_present(OPT_NO_DEREFERENCE), - verbose: matches.is_present(OPT_VERBOSE), + symbolic: matches.is_present(options::SYMBOLIC), + relative: matches.is_present(options::RELATIVE), + target_dir: matches + .value_of(options::TARGET_DIRECTORY) + .map(String::from), + no_target_dir: matches.is_present(options::NO_TARGET_DIRECTORY), + no_dereference: matches.is_present(options::NO_DEREFERENCE), + verbose: matches.is_present(options::VERBOSE), }; exec(&paths[..], &settings) From 26ad05cbb4194bd4fd51dec86c1c04db9712f90a Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 7 Jun 2021 19:52:49 +0200 Subject: [PATCH 0941/1135] uucore: fix order of group IDs returned from entries::get_groups() As discussed here: https://github.com/uutils/coreutils/pull/2361 the group IDs returned for GNU's 'group' and GNU's 'id --groups' starts with the effective group ID. This implements a wrapper for `entris::get_groups()` which mimics GNU's behaviour. * add tests for `id` * add tests for `groups` * fix `id --groups --real` to no longer ignore `--real` --- Cargo.toml | 2 +- src/uu/groups/src/groups.rs | 4 +- src/uu/id/src/id.rs | 45 +++++++++-------- src/uucore/src/lib/features/entries.rs | 52 ++++++++++++++++++- tests/by-util/test_groups.rs | 70 +++++++++++++++----------- tests/by-util/test_id.rs | 55 ++++++++++++++++---- 6 files changed, 162 insertions(+), 66 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5f89a4077..19ebca511 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -349,7 +349,7 @@ sha1 = { version="0.6", features=["std"] } tempfile = "3.2.0" time = "0.1" unindent = "0.1" -uucore = { version=">=0.0.8", package="uucore", path="src/uucore", features=["entries"] } +uucore = { version=">=0.0.8", package="uucore", path="src/uucore", features=["entries", "process"] } walkdir = "2.2" atty = "0.2.14" diff --git a/src/uu/groups/src/groups.rs b/src/uu/groups/src/groups.rs index 5b9cd948a..07c25cebb 100644 --- a/src/uu/groups/src/groups.rs +++ b/src/uu/groups/src/groups.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate uucore; -use uucore::entries::{get_groups, gid2grp, Locate, Passwd}; +use uucore::entries::{get_groups_gnu, gid2grp, Locate, Passwd}; use clap::{crate_version, App, Arg}; @@ -35,7 +35,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { None => { println!( "{}", - get_groups() + get_groups_gnu(None) .unwrap() .iter() .map(|&g| gid2grp(g).unwrap()) diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index 77b185f24..4f8f92fe4 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -10,7 +10,7 @@ // http://ftp-archive.freebsd.org/mirror/FreeBSD-Archive/old-releases/i386/1.0-RELEASE/ports/shellutils/src/id.c // http://www.opensource.apple.com/source/shell_cmds/shell_cmds-118/id/id.c -// spell-checker:ignore (ToDO) asid auditid auditinfo auid cstr egid emod euid getaudit getlogin gflag nflag pline rflag termid uflag +// spell-checker:ignore (ToDO) asid auditid auditinfo auid cstr egid emod euid getaudit getlogin gflag nflag pline rflag termid uflag gsflag #![allow(non_camel_case_types)] #![allow(dead_code)] @@ -79,7 +79,7 @@ static OPT_GROUPS: &str = "groups"; static OPT_HUMAN_READABLE: &str = "human-readable"; static OPT_NAME: &str = "name"; static OPT_PASSWORD: &str = "password"; -static OPT_REAL_ID: &str = "real-id"; +static OPT_REAL_ID: &str = "real"; static ARG_USERS: &str = "users"; @@ -135,7 +135,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg( Arg::with_name(OPT_REAL_ID) .short("r") - .help("Display the real ID for the -g and -u options"), + .long(OPT_REAL_ID) + .help( + "Display the real ID for the -G, -g and -u options instead of the effective ID.", + ), ) .arg(Arg::with_name(ARG_USERS).multiple(true).takes_value(true)) .get_matches_from(args); @@ -162,6 +165,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let nflag = matches.is_present(OPT_NAME); let uflag = matches.is_present(OPT_EFFECTIVE_USER); let gflag = matches.is_present(OPT_GROUP); + let gsflag = matches.is_present(OPT_GROUPS); let rflag = matches.is_present(OPT_REAL_ID); if gflag { @@ -194,26 +198,23 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return 0; } - if matches.is_present(OPT_GROUPS) { + if gsflag { + let id = possible_pw + .map(|p| p.gid()) + .unwrap_or(if rflag { getgid() } else { getegid() }); println!( "{}", - if nflag { - possible_pw - .map(|p| p.belongs_to()) - .unwrap_or_else(|| entries::get_groups().unwrap()) - .iter() - .map(|&id| entries::gid2grp(id).unwrap()) - .collect::>() - .join(" ") - } else { - possible_pw - .map(|p| p.belongs_to()) - .unwrap_or_else(|| entries::get_groups().unwrap()) - .iter() - .map(|&id| id.to_string()) - .collect::>() - .join(" ") - } + possible_pw + .map(|p| p.belongs_to()) + .unwrap_or_else(|| entries::get_groups_gnu(Some(id)).unwrap()) + .iter() + .map(|&id| if nflag { + entries::gid2grp(id).unwrap_or_else(|_| id.to_string()) + } else { + id.to_string() + }) + .collect::>() + .join(" ") ); return 0; } @@ -280,7 +281,7 @@ fn pretty(possible_pw: Option) { println!( "groups\t{}", - entries::get_groups() + entries::get_groups_gnu(None) .unwrap() .iter() .map(|&gr| entries::gid2grp(gr).unwrap()) diff --git a/src/uucore/src/lib/features/entries.rs b/src/uucore/src/lib/features/entries.rs index d2dce2461..b94abbe4f 100644 --- a/src/uucore/src/lib/features/entries.rs +++ b/src/uucore/src/lib/features/entries.rs @@ -5,7 +5,7 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// spell-checker:ignore (vars) Passwd cstr fnam gecos ngroups +// spell-checker:ignore (vars) Passwd cstr fnam gecos ngroups egid //! Get password/group file entry //! @@ -72,6 +72,41 @@ pub fn get_groups() -> IOResult> { } } +/// The list of group IDs returned from GNU's `groups` and GNU's `id --groups` +/// starts with the effective group ID (egid). +/// This is a wrapper for `get_groups()` to mimic this behavior. +/// +/// If `arg_id` is `None` (default), `get_groups_gnu` moves the effective +/// group id (egid) to the first entry in the returned Vector. +/// If `arg_id` is `Some(x)`, `get_groups_gnu` moves the id with value `x` +/// to the first entry in the returned Vector. This might be necessary +/// for `id --groups --real` if `gid` and `egid` are not equal. +/// +/// From: https://www.man7.org/linux/man-pages/man3/getgroups.3p.html +/// As implied by the definition of supplementary groups, the +/// effective group ID may appear in the array returned by +/// getgroups() or it may be returned only by getegid(). Duplication +/// may exist, but the application needs to call getegid() to be sure +/// of getting all of the information. Various implementation +/// variations and administrative sequences cause the set of groups +/// appearing in the result of getgroups() to vary in order and as to +/// whether the effective group ID is included, even when the set of +/// groups is the same (in the mathematical sense of ``set''). (The +/// history of a process and its parents could affect the details of +/// the result.) +pub fn get_groups_gnu(arg_id: Option) -> IOResult> { + let mut groups = get_groups()?; + let egid = arg_id.unwrap_or_else(crate::features::process::getegid); + if !groups.is_empty() && *groups.first().unwrap() == egid { + return Ok(groups); + } else if let Some(index) = groups.iter().position(|&x| x == egid) { + groups.remove(index); + } + groups.insert(0, egid); + Ok(groups) +} + +#[derive(Copy, Clone)] pub struct Passwd { inner: passwd, } @@ -268,3 +303,18 @@ pub fn usr2uid(name: &str) -> IOResult { pub fn grp2gid(name: &str) -> IOResult { Group::locate(name).map(|p| p.gid()) } + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_entries_get_groups_gnu() { + if let Ok(mut groups) = get_groups() { + if let Some(last) = groups.pop() { + groups.insert(0, last); + assert_eq!(get_groups_gnu(Some(last)).unwrap(), groups); + } + } + } +} diff --git a/tests/by-util/test_groups.rs b/tests/by-util/test_groups.rs index cee13bdc3..26ab6a75a 100644 --- a/tests/by-util/test_groups.rs +++ b/tests/by-util/test_groups.rs @@ -1,41 +1,53 @@ use crate::common::util::*; #[test] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] fn test_groups() { - let result = new_ucmd!().run(); - println!("result.stdout = {}", result.stdout_str()); - println!("result.stderr = {}", result.stderr_str()); - if is_ci() && result.stdout_str().trim().is_empty() { - // In the CI, some server are failing to return the group. - // As seems to be a configuration issue, ignoring it - return; + if !is_ci() { + new_ucmd!().succeeds().stdout_is(expected_result(&[])); + } else { + // TODO: investigate how this could be tested in CI + // stderr = groups: cannot find name for group ID 116 + println!("test skipped:"); } - result.success(); - assert!(!result.stdout_str().trim().is_empty()); } #[test] -fn test_groups_arg() { - // get the username with the "id -un" command - let result = TestScenario::new("id").ucmd_keepenv().arg("-un").run(); - println!("result.stdout = {}", result.stdout_str()); - println!("result.stderr = {}", result.stderr_str()); - let s1 = String::from(result.stdout_str().trim()); - if is_ci() && s1.parse::().is_ok() { - // In the CI, some server are failing to return id -un. - // So, if we are getting a uid, just skip this test - // As seems to be a configuration issue, ignoring it +#[cfg(any(target_os = "linux"))] +#[ignore = "fixme: 'groups USERNAME' needs more debugging"] +fn test_groups_username() { + let scene = TestScenario::new(util_name!()); + let whoami_result = scene.cmd("whoami").run(); + + let username = if whoami_result.succeeded() { + whoami_result.stdout_move_str() + } else if is_ci() { + String::from("docker") + } else { + println!("test skipped:"); return; - } + }; - println!("result.stdout = {}", result.stdout_str()); - println!("result.stderr = {}", result.stderr_str()); - result.success(); - assert!(!result.stdout_str().is_empty()); - let username = result.stdout_str().trim(); + // TODO: stdout should be in the form: "username : group1 group2 group3" - // call groups with the user name to check that we - // are getting something - new_ucmd!().arg(username).succeeds(); - assert!(!result.stdout_str().is_empty()); + scene + .ucmd() + .arg(&username) + .succeeds() + .stdout_is(expected_result(&[&username])); +} + +#[cfg(any(target_vendor = "apple", target_os = "linux"))] +fn expected_result(args: &[&str]) -> String { + #[cfg(target_os = "linux")] + let util_name = util_name!(); + #[cfg(target_vendor = "apple")] + let util_name = format!("g{}", util_name!()); + + TestScenario::new(&util_name) + .cmd_keepenv(util_name) + .env("LANGUAGE", "C") + .args(args) + .succeeds() + .stdout_move_str() } diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index 1f8249aab..c3a08810a 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -104,19 +104,23 @@ fn test_id_group() { } #[test] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] fn test_id_groups() { let scene = TestScenario::new(util_name!()); - - let result = scene.ucmd().arg("-G").succeeds(); - let groups = result.stdout_str().trim().split_whitespace(); - for s in groups { - assert!(s.parse::().is_ok()); - } - - let result = scene.ucmd().arg("--groups").succeeds(); - let groups = result.stdout_str().trim().split_whitespace(); - for s in groups { - assert!(s.parse::().is_ok()); + for g_flag in &["-G", "--groups"] { + scene + .ucmd() + .arg(g_flag) + .succeeds() + .stdout_is(expected_result(&[g_flag], false)); + for &r_flag in &["-r", "--real"] { + let args = [g_flag, r_flag]; + scene + .ucmd() + .args(&args) + .succeeds() + .stdout_is(expected_result(&args, false)); + } } } @@ -167,3 +171,32 @@ fn test_id_password_style() { assert!(result.stdout_str().starts_with(&username)); } + +#[cfg(any(target_vendor = "apple", target_os = "linux"))] +fn expected_result(args: &[&str], exp_fail: bool) -> String { + #[cfg(target_os = "linux")] + let util_name = util_name!(); + #[cfg(target_vendor = "apple")] + let util_name = format!("g{}", util_name!()); + + let result = if !exp_fail { + TestScenario::new(&util_name) + .cmd_keepenv(util_name) + .env("LANGUAGE", "C") + .args(args) + .succeeds() + .stdout_move_str() + } else { + TestScenario::new(&util_name) + .cmd_keepenv(util_name) + .env("LANGUAGE", "C") + .args(args) + .fails() + .stderr_move_str() + }; + return if cfg!(target_os = "macos") && result.starts_with("gid") { + result[1..].to_string() + } else { + result + }; +} From d846c403724be80714b090b0b7bad507ddbb06b8 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Tue, 8 Jun 2021 21:45:02 +0200 Subject: [PATCH 0942/1135] groups: fix test for arch --- tests/by-util/test_groups.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/by-util/test_groups.rs b/tests/by-util/test_groups.rs index 26ab6a75a..657503471 100644 --- a/tests/by-util/test_groups.rs +++ b/tests/by-util/test_groups.rs @@ -13,7 +13,7 @@ fn test_groups() { } #[test] -#[cfg(any(target_os = "linux"))] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[ignore = "fixme: 'groups USERNAME' needs more debugging"] fn test_groups_username() { let scene = TestScenario::new(util_name!()); @@ -39,15 +39,13 @@ fn test_groups_username() { #[cfg(any(target_vendor = "apple", target_os = "linux"))] fn expected_result(args: &[&str]) -> String { - #[cfg(target_os = "linux")] - let util_name = util_name!(); - #[cfg(target_vendor = "apple")] - let util_name = format!("g{}", util_name!()); + let util_name = "id"; TestScenario::new(&util_name) .cmd_keepenv(util_name) .env("LANGUAGE", "C") .args(args) + .args(&["-Gn"]) .succeeds() .stdout_move_str() } From 06b6066e89bfe32bcff277ff41e8adfe8cbed1dd Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Tue, 8 Jun 2021 22:53:48 +0200 Subject: [PATCH 0943/1135] groups: enable tests for non-linux unix systems --- tests/by-util/test_groups.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/by-util/test_groups.rs b/tests/by-util/test_groups.rs index 657503471..af0334e5a 100644 --- a/tests/by-util/test_groups.rs +++ b/tests/by-util/test_groups.rs @@ -1,7 +1,7 @@ use crate::common::util::*; #[test] -#[cfg(any(target_vendor = "apple", target_os = "linux"))] +#[cfg(unix)] fn test_groups() { if !is_ci() { new_ucmd!().succeeds().stdout_is(expected_result(&[])); @@ -13,7 +13,7 @@ fn test_groups() { } #[test] -#[cfg(any(target_vendor = "apple", target_os = "linux"))] +#[cfg(unix)] #[ignore = "fixme: 'groups USERNAME' needs more debugging"] fn test_groups_username() { let scene = TestScenario::new(util_name!()); @@ -37,9 +37,14 @@ fn test_groups_username() { .stdout_is(expected_result(&[&username])); } -#[cfg(any(target_vendor = "apple", target_os = "linux"))] +#[cfg(unix)] fn expected_result(args: &[&str]) -> String { + // We want to use GNU id. On most linux systems, this is "id", but on + // bsd-like systems (e.g. FreeBSD, MacOS), it is commonly "gid". + #[cfg(any(target_os = "linux"))] let util_name = "id"; + #[cfg(not(target_os = "linux"))] + let util_name = "gid"; TestScenario::new(&util_name) .cmd_keepenv(util_name) From 145e705b746d0bdf777ea180a99de70e7cd5a509 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 9 Jun 2021 12:39:25 +0200 Subject: [PATCH 0944/1135] groups: fix clippy lint in test --- tests/by-util/test_groups.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_groups.rs b/tests/by-util/test_groups.rs index af0334e5a..c1b98aea1 100644 --- a/tests/by-util/test_groups.rs +++ b/tests/by-util/test_groups.rs @@ -46,7 +46,7 @@ fn expected_result(args: &[&str]) -> String { #[cfg(not(target_os = "linux"))] let util_name = "gid"; - TestScenario::new(&util_name) + TestScenario::new(util_name) .cmd_keepenv(util_name) .env("LANGUAGE", "C") .args(args) From 3818e5441594b1ed439e2b4bf0fc17dae60223e5 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 9 Jun 2021 14:34:37 +0200 Subject: [PATCH 0945/1135] who: cleanup argument handling --- src/uu/who/src/who.rs | 126 ++++++++++-------------------------------- 1 file changed, 30 insertions(+), 96 deletions(-) diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index d2f64aa94..44f565438 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -179,124 +179,58 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // Ignored for 'who am i'. let short_list = matches.is_present(options::COUNT); - // If true, display only name, line, and time fields. - let mut short_output = false; - - // If true, display the hours:minutes since each user has touched - // the keyboard, or "." if within the last minute, or "old" if - // not within the last day. - let mut include_idle = false; + let all = matches.is_present(options::ALL); // If true, display a line at the top describing each field. let include_heading = matches.is_present(options::HEADING); // If true, display a '+' for each user if mesg y, a '-' if mesg n, // or a '?' if their tty cannot be statted. - let include_mesg = matches.is_present(options::ALL) - || matches.is_present(options::MESG) - || matches.is_present("w"); - - // If true, display process termination & exit status. - let mut include_exit = false; + let include_mesg = all || matches.is_present(options::MESG) || matches.is_present("w"); // If true, display the last boot time. - let mut need_boottime = false; + let need_boottime = all || matches.is_present(options::BOOT); // If true, display dead processes. - let mut need_deadprocs = false; + let need_deadprocs = all || matches.is_present(options::DEAD); // If true, display processes waiting for user login. - let mut need_login = false; + let need_login = all || matches.is_present(options::LOGIN); // If true, display processes started by init. - let mut need_initspawn = false; + let need_initspawn = all || matches.is_present(options::PROCESS); // If true, display the last clock change. - let mut need_clockchange = false; + let need_clockchange = all || matches.is_present(options::TIME); // If true, display the current runlevel. - let mut need_runlevel = false; + let need_runlevel = all || matches.is_present(options::RUNLEVEL); + + let use_defaults = !(all + || need_boottime + || need_deadprocs + || need_login + || need_initspawn + || need_runlevel + || need_clockchange + || matches.is_present(options::USERS)); // If true, display user processes. - let mut need_users = false; + let need_users = all || matches.is_present(options::USERS) || use_defaults; + + // If true, display the hours:minutes since each user has touched + // the keyboard, or "." if within the last minute, or "old" if + // not within the last day. + let include_idle = need_deadprocs || need_login || need_runlevel || need_users; + + // If true, display process termination & exit status. + let include_exit = need_deadprocs; + + // If true, display only name, line, and time fields. + let short_output = !include_exit && use_defaults; // If true, display info only for the controlling tty. - let mut my_line_only = false; - - let mut assumptions = true; - - #[allow(clippy::useless_let_if_seq)] - { - if matches.is_present(options::ALL) { - need_boottime = true; - need_deadprocs = true; - need_login = true; - need_initspawn = true; - need_runlevel = true; - need_clockchange = true; - need_users = true; - include_idle = true; - include_exit = true; - assumptions = false; - } - - if matches.is_present(options::BOOT) { - need_boottime = true; - assumptions = false; - } - - if matches.is_present(options::DEAD) { - need_deadprocs = true; - include_idle = true; - include_exit = true; - assumptions = false; - } - - if matches.is_present(options::LOGIN) { - need_login = true; - include_idle = true; - assumptions = false; - } - - if matches.is_present(options::ONLY_HOSTNAME_USER) || files.len() == 2 { - my_line_only = true; - } - - if matches.is_present(options::PROCESS) { - need_initspawn = true; - assumptions = false; - } - - if matches.is_present(options::RUNLEVEL) { - need_runlevel = true; - include_idle = true; - assumptions = false; - } - - if matches.is_present(options::SHORT) { - short_output = true; - } - - if matches.is_present(options::TIME) { - need_clockchange = true; - assumptions = false; - } - - if matches.is_present(options::USERS) { - need_users = true; - include_idle = true; - assumptions = false; - } - - if assumptions { - need_users = true; - short_output = true; - } - - if include_exit { - short_output = false; - } - } + let my_line_only = matches.is_present(options::ONLY_HOSTNAME_USER) || files.len() == 2; let mut who = Who { do_lookup, From 8ae4a8d06e20221a801d779f5b97d4ac8708bec7 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 9 Jun 2021 14:37:19 +0200 Subject: [PATCH 0946/1135] Revert "groups: fix test for arch" This reverts commit d846c403724be80714b090b0b7bad507ddbb06b8. --- tests/by-util/test_groups.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/by-util/test_groups.rs b/tests/by-util/test_groups.rs index 657503471..26ab6a75a 100644 --- a/tests/by-util/test_groups.rs +++ b/tests/by-util/test_groups.rs @@ -13,7 +13,7 @@ fn test_groups() { } #[test] -#[cfg(any(target_vendor = "apple", target_os = "linux"))] +#[cfg(any(target_os = "linux"))] #[ignore = "fixme: 'groups USERNAME' needs more debugging"] fn test_groups_username() { let scene = TestScenario::new(util_name!()); @@ -39,13 +39,15 @@ fn test_groups_username() { #[cfg(any(target_vendor = "apple", target_os = "linux"))] fn expected_result(args: &[&str]) -> String { - let util_name = "id"; + #[cfg(target_os = "linux")] + let util_name = util_name!(); + #[cfg(target_vendor = "apple")] + let util_name = format!("g{}", util_name!()); TestScenario::new(&util_name) .cmd_keepenv(util_name) .env("LANGUAGE", "C") .args(args) - .args(&["-Gn"]) .succeeds() .stdout_move_str() } From 1b824f491460e7f7274ce597224e4d3a86e41cc9 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 9 Jun 2021 15:56:29 +0200 Subject: [PATCH 0947/1135] fix clippy warnings --- src/uu/head/src/parse.rs | 2 +- src/uu/split/src/split.rs | 2 +- src/uu/tail/src/tail.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/head/src/parse.rs b/src/uu/head/src/parse.rs index 7e36594b5..f6f291814 100644 --- a/src/uu/head/src/parse.rs +++ b/src/uu/head/src/parse.rs @@ -113,7 +113,7 @@ pub fn parse_num(src: &str) -> Result<(usize, bool), ParseSizeError> { return Err(ParseSizeError::ParseFailure(src.to_string())); } - parse_size(&size_string).map(|n| (n, all_but_last)) + parse_size(size_string).map(|n| (n, all_but_last)) } #[cfg(test)] diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index b905a4592..0d5543d8b 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -278,7 +278,7 @@ struct ByteSplitter { impl ByteSplitter { fn new(settings: &Settings) -> ByteSplitter { let size_string = &settings.strategy_param; - let size_num = match parse_size(&size_string) { + let size_num = match parse_size(size_string) { Ok(n) => n, Err(e) => crash!(1, "invalid number of bytes: {}", e.to_string()), }; diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 75cc43db1..8950886a2 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -419,5 +419,5 @@ fn parse_num(src: &str) -> Result<(usize, bool), ParseSizeError> { return Err(ParseSizeError::ParseFailure(src.to_string())); } - parse_size(&size_string).map(|n| (n, starting_with)) + parse_size(size_string).map(|n| (n, starting_with)) } From f40f9fbf91298f920e0ce5760768c5a083e5db08 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Wed, 9 Jun 2021 23:51:04 +0900 Subject: [PATCH 0948/1135] Fix build when not(feature = "process") --- src/uucore/src/lib/features/entries.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uucore/src/lib/features/entries.rs b/src/uucore/src/lib/features/entries.rs index b94abbe4f..988d88fd3 100644 --- a/src/uucore/src/lib/features/entries.rs +++ b/src/uucore/src/lib/features/entries.rs @@ -94,6 +94,7 @@ pub fn get_groups() -> IOResult> { /// groups is the same (in the mathematical sense of ``set''). (The /// history of a process and its parents could affect the details of /// the result.) +#[cfg(all(unix, feature = "process"))] pub fn get_groups_gnu(arg_id: Option) -> IOResult> { let mut groups = get_groups()?; let egid = arg_id.unwrap_or_else(crate::features::process::getegid); From 394eb82af1be3aa44abb857e38199c4888fc5074 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 9 Jun 2021 17:07:44 +0200 Subject: [PATCH 0949/1135] cat/cut/tty/nohup: replace is_std{in, out, err}_interactive with atty --- Cargo.lock | 4 +++ src/uu/cat/Cargo.toml | 1 + src/uu/cat/src/cat.rs | 3 +-- src/uu/cut/Cargo.toml | 1 + src/uu/cut/src/cut.rs | 3 +-- src/uu/nohup/Cargo.toml | 1 + src/uu/nohup/src/nohup.rs | 7 +++-- src/uu/tty/Cargo.toml | 1 + src/uu/tty/src/tty.rs | 3 +-- src/uucore/src/lib/features/fs.rs | 45 ------------------------------- 10 files changed, 14 insertions(+), 55 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7b2d989be..931bff981 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1772,6 +1772,7 @@ dependencies = [ name = "uu_cat" version = "0.0.6" dependencies = [ + "atty", "clap", "nix 0.20.0", "thiserror", @@ -1872,6 +1873,7 @@ dependencies = [ name = "uu_cut" version = "0.0.6" dependencies = [ + "atty", "bstr", "clap", "memchr 2.4.0", @@ -2262,6 +2264,7 @@ dependencies = [ name = "uu_nohup" version = "0.0.6" dependencies = [ + "atty", "clap", "libc", "uucore", @@ -2660,6 +2663,7 @@ dependencies = [ name = "uu_tty" version = "0.0.6" dependencies = [ + "atty", "clap", "libc", "uucore", diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 09b289253..9218e84fe 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -17,6 +17,7 @@ path = "src/cat.rs" [dependencies] clap = "2.33" thiserror = "1.0" +atty = "0.2" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index 005802ce5..889ba424a 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -20,7 +20,6 @@ use clap::{crate_version, App, Arg}; use std::fs::{metadata, File}; use std::io::{self, Read, Write}; use thiserror::Error; -use uucore::fs::is_stdin_interactive; /// Linux splice support #[cfg(any(target_os = "linux", target_os = "android"))] @@ -306,7 +305,7 @@ fn cat_path(path: &str, options: &OutputOptions, state: &mut OutputState) -> Cat #[cfg(any(target_os = "linux", target_os = "android"))] file_descriptor: stdin.as_raw_fd(), reader: stdin, - is_interactive: is_stdin_interactive(), + is_interactive: atty::is(atty::Stream::Stdin), }; return cat_handle(&mut handle, options, state); } diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index c863c1772..47b8223c5 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -20,6 +20,7 @@ uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } memchr = "2" bstr = "0.2" +atty = "0.2" [[bin]] name = "cut" diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index 819cbb989..af4a27d8a 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -17,7 +17,6 @@ use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write}; use std::path::Path; use self::searcher::Searcher; -use uucore::fs::is_stdout_interactive; use uucore::ranges::Range; use uucore::InvalidEncodingHandling; @@ -127,7 +126,7 @@ enum Mode { } fn stdout_writer() -> Box { - if is_stdout_interactive() { + if atty::is(atty::Stream::Stdout) { Box::new(stdout()) } else { Box::new(BufWriter::new(stdout())) as Box diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index 5bbbd9dff..0e47b5cad 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -17,6 +17,7 @@ path = "src/nohup.rs" [dependencies] clap = "2.33" libc = "0.2.42" +atty = "0.2.14" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/nohup/src/nohup.rs b/src/uu/nohup/src/nohup.rs index ea379ff49..4e6fd7a7e 100644 --- a/src/uu/nohup/src/nohup.rs +++ b/src/uu/nohup/src/nohup.rs @@ -19,7 +19,6 @@ use std::fs::{File, OpenOptions}; use std::io::Error; use std::os::unix::prelude::*; use std::path::{Path, PathBuf}; -use uucore::fs::{is_stderr_interactive, is_stdin_interactive, is_stdout_interactive}; use uucore::InvalidEncodingHandling; static ABOUT: &str = "Run COMMAND ignoring hangup signals."; @@ -84,7 +83,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } fn replace_fds() { - if is_stdin_interactive() { + if atty::is(atty::Stream::Stdin) { let new_stdin = match File::open(Path::new("/dev/null")) { Ok(t) => t, Err(e) => crash!(2, "Cannot replace STDIN: {}", e), @@ -94,7 +93,7 @@ fn replace_fds() { } } - if is_stdout_interactive() { + if atty::is(atty::Stream::Stdout) { let new_stdout = find_stdout(); let fd = new_stdout.as_raw_fd(); @@ -103,7 +102,7 @@ fn replace_fds() { } } - if is_stderr_interactive() && unsafe { dup2(1, 2) } != 2 { + if atty::is(atty::Stream::Stderr) && unsafe { dup2(1, 2) } != 2 { crash!(2, "Cannot replace STDERR: {}", Error::last_os_error()) } } diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index 7be27a900..49b7669df 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -17,6 +17,7 @@ path = "src/tty.rs" [dependencies] clap = "2.33" libc = "0.2.42" +atty = "0.2" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/tty/src/tty.rs b/src/uu/tty/src/tty.rs index 074bcf182..edcdf091e 100644 --- a/src/uu/tty/src/tty.rs +++ b/src/uu/tty/src/tty.rs @@ -14,7 +14,6 @@ extern crate uucore; use clap::{crate_version, App, Arg}; use std::ffi::CStr; -use uucore::fs::is_stdin_interactive; use uucore::InvalidEncodingHandling; static ABOUT: &str = "Print the file name of the terminal connected to standard input."; @@ -67,7 +66,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } - if is_stdin_interactive() { + if atty::is(atty::Stream::Stdin) { libc::EXIT_SUCCESS } else { libc::EXIT_FAILURE diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index 38cdbef94..525f305e3 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -225,51 +225,6 @@ pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> Ok(result) } -#[cfg(unix)] -pub fn is_stdin_interactive() -> bool { - unsafe { libc::isatty(libc::STDIN_FILENO) == 1 } -} - -#[cfg(windows)] -pub fn is_stdin_interactive() -> bool { - false -} - -#[cfg(target_os = "redox")] -pub fn is_stdin_interactive() -> bool { - termion::is_tty(&io::stdin()) -} - -#[cfg(unix)] -pub fn is_stdout_interactive() -> bool { - unsafe { libc::isatty(libc::STDOUT_FILENO) == 1 } -} - -#[cfg(windows)] -pub fn is_stdout_interactive() -> bool { - false -} - -#[cfg(target_os = "redox")] -pub fn is_stdout_interactive() -> bool { - termion::is_tty(&io::stdout()) -} - -#[cfg(unix)] -pub fn is_stderr_interactive() -> bool { - unsafe { libc::isatty(libc::STDERR_FILENO) == 1 } -} - -#[cfg(windows)] -pub fn is_stderr_interactive() -> bool { - false -} - -#[cfg(target_os = "redox")] -pub fn is_stderr_interactive() -> bool { - termion::is_tty(&io::stderr()) -} - #[cfg(not(unix))] #[allow(unused_variables)] pub fn display_permissions(metadata: &fs::Metadata, display_file_type: bool) -> String { From be8e5f5f30f8f94b1c03ea1125f8273dec7aeb2c Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 9 Jun 2021 17:15:42 +0200 Subject: [PATCH 0950/1135] use the same spec for atty everywhere --- Cargo.toml | 2 +- src/uu/more/Cargo.toml | 2 +- src/uu/nohup/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 19ebca511..804c5f978 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -351,7 +351,7 @@ time = "0.1" unindent = "0.1" uucore = { version=">=0.0.8", package="uucore", path="src/uucore", features=["entries", "process"] } walkdir = "2.2" -atty = "0.2.14" +atty = "0.2" [target.'cfg(unix)'.dev-dependencies] rlimit = "0.4.0" diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index b3b97e6dd..af6781876 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -19,7 +19,7 @@ clap = "2.33" uucore = { version = ">=0.0.7", package = "uucore", path = "../../uucore" } uucore_procs = { version = ">=0.0.5", package = "uucore_procs", path = "../../uucore_procs" } crossterm = ">=0.19" -atty = "0.2.14" +atty = "0.2" unicode-width = "0.1.7" unicode-segmentation = "1.7.1" diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index 0e47b5cad..839219a84 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -17,7 +17,7 @@ path = "src/nohup.rs" [dependencies] clap = "2.33" libc = "0.2.42" -atty = "0.2.14" +atty = "0.2" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } From 7009cb04869b9abc9ca1e81774ff97a6ed96594c Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 01:07:01 +0900 Subject: [PATCH 0951/1135] Add "process" dependency to groups/Cargo.toml --- src/uu/groups/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index 1a56bc2ab..4a5a537e5 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/groups.rs" [dependencies] -uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "process"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } clap = "2.33" From cebf1f09dff0925b5056bc49c5c43751a168dc30 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 01:54:10 +0900 Subject: [PATCH 0952/1135] get_groups_gnu sort with rotate_right --- src/uucore/src/lib/features/entries.rs | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/uucore/src/lib/features/entries.rs b/src/uucore/src/lib/features/entries.rs index b94abbe4f..75bf245e4 100644 --- a/src/uucore/src/lib/features/entries.rs +++ b/src/uucore/src/lib/features/entries.rs @@ -95,15 +95,18 @@ pub fn get_groups() -> IOResult> { /// history of a process and its parents could affect the details of /// the result.) pub fn get_groups_gnu(arg_id: Option) -> IOResult> { - let mut groups = get_groups()?; + let groups = get_groups()?; let egid = arg_id.unwrap_or_else(crate::features::process::getegid); - if !groups.is_empty() && *groups.first().unwrap() == egid { - return Ok(groups); - } else if let Some(index) = groups.iter().position(|&x| x == egid) { - groups.remove(index); + Ok(sort_groups(groups, egid)) +} + +fn sort_groups(mut groups: Vec, egid: gid_t) -> Vec { + if let Some(index) = groups.iter().position(|&x| x == egid) { + groups[..index + 1].rotate_right(1); + } else { + groups.insert(0, egid); } - groups.insert(0, egid); - Ok(groups) + groups } #[derive(Copy, Clone)] @@ -308,6 +311,15 @@ pub fn grp2gid(name: &str) -> IOResult { mod test { use super::*; + #[test] + fn test_sort_groups() { + assert_eq!(sort_groups(vec![1, 2, 3], 4), vec![4, 1, 2, 3]); + assert_eq!(sort_groups(vec![1, 2, 3], 3), vec![3, 1, 2]); + assert_eq!(sort_groups(vec![1, 2, 3], 2), vec![2, 1, 3]); + assert_eq!(sort_groups(vec![1, 2, 3], 1), vec![1, 2, 3]); + assert_eq!(sort_groups(vec![1, 2, 3], 0), vec![0, 1, 2, 3]); + } + #[test] fn test_entries_get_groups_gnu() { if let Ok(mut groups) = get_groups() { From 40720dc52de71d93809c1e12c8a6403d60b51662 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 9 Jun 2021 19:39:56 +0200 Subject: [PATCH 0953/1135] more: rewrite drawing logic --- src/uu/more/src/more.rs | 202 +++++++++++++++++++--------------------- 1 file changed, 98 insertions(+), 104 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 4d345e96b..8dbfb8460 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -11,7 +11,6 @@ extern crate uucore; use std::{ - convert::TryInto, fs::File, io::{stdin, stdout, BufReader, Read, Stdout, Write}, path::Path, @@ -207,32 +206,11 @@ fn reset_term(_: &mut usize) {} fn more(buff: &str, mut stdout: &mut Stdout, next_file: Option<&str>) { let (cols, rows) = terminal::size().unwrap(); let lines = break_buff(buff, usize::from(cols)); - let line_count: u16 = lines.len().try_into().unwrap(); - let mut upper_mark = 0; - let mut lines_left = line_count.saturating_sub(upper_mark + rows); - - draw( - &mut upper_mark, - rows, - &mut stdout, - lines.clone(), - line_count, - next_file, - ); - - let is_last = next_file.is_none(); - - // Specifies whether we have reached the end of the file and should - // return on the next key press. However, we immediately return when - // this is the last file. - let mut to_be_done = false; - if lines_left == 0 && is_last { - if is_last { - return; - } else { - to_be_done = true; - } + let mut pager = Pager::new(rows as usize, lines, next_file); + pager.draw(stdout); + if pager.should_close() { + return; } loop { @@ -257,59 +235,116 @@ fn more(buff: &str, mut stdout: &mut Stdout, next_file: Option<&str>) { code: KeyCode::Char(' '), modifiers: KeyModifiers::NONE, }) => { - upper_mark = upper_mark.saturating_add(rows.saturating_sub(1)); + pager.page_down(); } Event::Key(KeyEvent { code: KeyCode::Up, modifiers: KeyModifiers::NONE, }) => { - upper_mark = upper_mark.saturating_sub(rows.saturating_sub(1)); + pager.page_up(); } _ => continue, } - lines_left = line_count.saturating_sub(upper_mark + rows); - draw( - &mut upper_mark, - rows, - &mut stdout, - lines.clone(), - line_count, - next_file, - ); - if lines_left == 0 { - if to_be_done || is_last { - return; - } - to_be_done = true; + pager.draw(stdout); + if pager.should_close() { + return; } } } } -fn draw( - upper_mark: &mut u16, - rows: u16, - mut stdout: &mut std::io::Stdout, +struct Pager<'a> { + // The current line at the top of the screen + upper_mark: usize, + // The number of rows that fit on the screen + content_rows: usize, lines: Vec, - lc: u16, - next_file: Option<&str>, -) { - execute!(stdout, terminal::Clear(terminal::ClearType::CurrentLine)).unwrap(); - let (up_mark, lower_mark) = calc_range(*upper_mark, rows, lc); - // Reduce the row by 1 for the prompt - let displayed_lines = lines - .iter() - .skip(up_mark.into()) - .take(usize::from(rows.saturating_sub(1))); + next_file: Option<&'a str>, + line_count: usize, + close_on_down: bool, +} - for line in displayed_lines { - stdout - .write_all(format!("\r{}\n", line).as_bytes()) - .unwrap(); +impl<'a> Pager<'a> { + fn new(rows: usize, lines: Vec, next_file: Option<&'a str>) -> Self { + let line_count = lines.len(); + Self { + upper_mark: 0, + content_rows: rows - 1, + lines, + next_file, + line_count, + close_on_down: false, + } + } + + fn should_close(&mut self) -> bool { + if self.upper_mark + self.content_rows >= self.line_count { + if self.close_on_down { + return true; + } + if self.next_file.is_none() { + return true; + } else { + self.close_on_down = true; + } + } else { + self.close_on_down = false; + } + false + } + + fn page_down(&mut self) { + self.upper_mark = self + .line_count + .saturating_sub(self.content_rows) + .min(self.upper_mark + self.content_rows); + } + + fn page_up(&mut self) { + self.upper_mark = self.upper_mark.saturating_sub(self.content_rows); + } + + fn draw(&self, stdout: &mut std::io::Stdout) { + let lower_mark = self.line_count.min(self.upper_mark + self.content_rows); + self.draw_lines(stdout); + self.draw_prompt(stdout, lower_mark); + stdout.flush().unwrap(); + } + + fn draw_lines(&self, stdout: &mut std::io::Stdout) { + execute!(stdout, terminal::Clear(terminal::ClearType::CurrentLine)).unwrap(); + let displayed_lines = self + .lines + .iter() + .skip(self.upper_mark) + .take(self.content_rows); + + for line in displayed_lines { + stdout + .write_all(format!("\r{}\n", line).as_bytes()) + .unwrap(); + } + } + + fn draw_prompt(&self, stdout: &mut Stdout, lower_mark: usize) { + let status = if lower_mark == self.line_count { + format!("Next file: {}", self.next_file.unwrap_or_default()) + } else { + format!( + "{}%", + (lower_mark as f64 / self.line_count as f64 * 100.0).round() as usize + ) + }; + write!( + stdout, + "\r{}--More--({}){}", + Attribute::Reverse, + status, + Attribute::Reset + ) + .unwrap(); } - make_prompt_and_flush(&mut stdout, lower_mark, lc, next_file); - *upper_mark = up_mark; } // Break the lines on the cols of the terminal @@ -350,52 +385,11 @@ fn break_line(line: &str, cols: usize) -> Vec { lines } -// Calculate upper_mark based on certain parameters -fn calc_range(mut upper_mark: u16, rows: u16, line_count: u16) -> (u16, u16) { - let mut lower_mark = upper_mark.saturating_add(rows); - - if lower_mark >= line_count { - upper_mark = line_count.saturating_sub(rows).saturating_add(1); - lower_mark = line_count; - } else { - lower_mark = lower_mark.saturating_sub(1) - } - (upper_mark, lower_mark) -} - -// Make a prompt similar to original more -fn make_prompt_and_flush(stdout: &mut Stdout, lower_mark: u16, lc: u16, next_file: Option<&str>) { - let status = if lower_mark == lc { - format!("Next file: {}", next_file.unwrap_or_default()) - } else { - format!( - "{}%", - (lower_mark as f64 / lc as f64 * 100.0).round() as u16 - ) - }; - write!( - stdout, - "\r{}--More--({}){}", - Attribute::Reverse, - status, - Attribute::Reset - ) - .unwrap(); - stdout.flush().unwrap(); -} - #[cfg(test)] mod tests { - use super::{break_line, calc_range}; + use super::break_line; use unicode_width::UnicodeWidthStr; - // It is good to test the above functions - #[test] - fn test_calc_range() { - assert_eq!((0, 24), calc_range(0, 25, 100)); - assert_eq!((50, 74), calc_range(50, 25, 100)); - assert_eq!((76, 100), calc_range(85, 25, 100)); - } #[test] fn test_break_lines_long() { let mut test_string = String::with_capacity(100); From e73743eb0d363582f9b9134b0931f1675e58d5d1 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 9 Jun 2021 21:56:32 +0200 Subject: [PATCH 0954/1135] more: simpler page_down --- src/uu/more/src/more.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 8dbfb8460..271abd994 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -295,10 +295,7 @@ impl<'a> Pager<'a> { } fn page_down(&mut self) { - self.upper_mark = self - .line_count - .saturating_sub(self.content_rows) - .min(self.upper_mark + self.content_rows); + self.upper_mark += self.content_rows; } fn page_up(&mut self) { From 44f6dc6098d6f47fbd054ac170ebeec7fd81535d Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 9 Jun 2021 22:10:28 +0200 Subject: [PATCH 0955/1135] whoami: remove advapi32-sys dependency --- Cargo.lock | 11 ----------- src/uu/whoami/Cargo.toml | 1 - src/uu/whoami/src/platform/windows.rs | 4 ++-- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7b2d989be..9c03e22bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6,16 +6,6 @@ version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -[[package]] -name = "advapi32-sys" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "aho-corasick" version = "0.7.18" @@ -2751,7 +2741,6 @@ dependencies = [ name = "uu_whoami" version = "0.0.6" dependencies = [ - "advapi32-sys", "clap", "uucore", "uucore_procs", diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index f8dc01440..28670c8b5 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -20,7 +20,6 @@ uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=[" uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "windows")'.dependencies] -advapi32-sys = "0.2.0" winapi = { version = "0.3", features = ["lmcons"] } [[bin]] diff --git a/src/uu/whoami/src/platform/windows.rs b/src/uu/whoami/src/platform/windows.rs index 5d648877b..3fe8eb1e7 100644 --- a/src/uu/whoami/src/platform/windows.rs +++ b/src/uu/whoami/src/platform/windows.rs @@ -11,7 +11,7 @@ extern crate winapi; use self::winapi::shared::lmcons; use self::winapi::shared::minwindef; -use self::winapi::um::winnt; +use self::winapi::um::{winbase, winnt}; use std::io::{Error, Result}; use std::mem; use uucore::wide::FromWide; @@ -20,7 +20,7 @@ pub unsafe fn get_username() -> Result { #[allow(deprecated)] let mut buffer: [winnt::WCHAR; lmcons::UNLEN as usize + 1] = mem::uninitialized(); let mut len = buffer.len() as minwindef::DWORD; - if advapi32::GetUserNameW(buffer.as_mut_ptr(), &mut len) == 0 { + if winbase::GetUserNameW(buffer.as_mut_ptr(), &mut len) == 0 { return Err(Error::last_os_error()); } let username = String::from_wide(&buffer[..len as usize - 1]); From 026570ff9c887b4c3e2fac56a213ae7e59f59f38 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 9 Jun 2021 13:24:28 +0200 Subject: [PATCH 0956/1135] id: add more tests for '--zero' * fix clippy warnings --- src/uu/id/src/id.rs | 1 + tests/by-util/test_id.rs | 100 +++++++++++++++++++++++++++++---------- 2 files changed, 75 insertions(+), 26 deletions(-) diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index 360f6a09c..f0659faf3 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -177,6 +177,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { crash!(1, "cannot print only names or real IDs in default format"); } if (zflag) && !(uflag || gflag || gsflag) { + // GNU testsuite "id/zero.sh" needs this stderr output crash!(1, "option --zero not permitted in default format"); } diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index a9c7e31ae..a885069a1 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -6,8 +6,12 @@ use crate::common::util::*; // // From the Logs: "Build (ubuntu-18.04, x86_64-unknown-linux-gnu, feat_os_unix, use-cross)" // stderr: "whoami: cannot find name for user ID 1001" -// Maybe: "adduser --uid 1001 username" can put things right? -// stderr = id: Could not find uid 1001: No such id: 1001 +// stderr: "id: Could not find uid 1001: No such id: 1001" +// +// However, when running "id" from within "/bin/bash" it looks fine: +// id: "uid=1001(runner) gid=118(docker) groups=118(docker),4(adm),101(systemd-journal)" +// whoami: "runner" +// fn skipping_test_is_okay(result: &CmdResult, needle: &str) -> bool { if !result.succeeded() { println!("result.stdout = {}", result.stdout_str()); @@ -191,53 +195,97 @@ fn test_id_password_style() { #[test] #[cfg(any(target_vendor = "apple", target_os = "linux"))] fn test_id_default_format() { + // These are the same tests like in test_id_zero but without --zero flag. let scene = TestScenario::new(util_name!()); - // -ugG - for flag in &["--name", "--real"] { + for &opt1 in &["--name", "--real"] { + // id: cannot print only names or real IDs in default format + let args = [opt1]; scene .ucmd() - .arg(flag) + .args(&args) .fails() - .stderr_is(expected_result(&[flag], true)); - for &opt in &["--user", "--group", "--groups"] { - if is_ci() && *flag == "--name" { + .stderr_only(expected_result(&args, true)); + for &opt2 in &["--user", "--group", "--groups"] { + // u/g/G n/r + let args = [opt2, opt1]; + let result = scene.ucmd().args(&args).run(); + + if !result.succeeded() && is_ci() + // && (result.stderr_str().contains("cannot find name for") + // || result.stdout_str().contains("cannot find name for")) + { // '--name' does not work on CICD ubuntu-16/ubuntu-18 // id: cannot find name for user ID 1001 // id: cannot find name for group ID 116 - println!("test skipped"); - continue; + scene + .ucmd() + .args(&args) + .fails() + .stderr_only(expected_result(&args, true)); + } else { + result.stdout_only(expected_result(&args, false)); } - let args = [opt, flag]; - scene - .ucmd() - .args(&args) - .succeeds() - .stdout_is(expected_result(&args, false)); } } + // u/g/G + for &opt2 in &["--user", "--group", "--groups"] { + let args = [opt2]; + scene + .ucmd() + .args(&args) + .succeeds() + .stdout_only(expected_result(&args, false)); + } } #[test] #[cfg(any(target_vendor = "apple", target_os = "linux"))] fn test_id_zero() { + let scene = TestScenario::new(util_name!()); for z_flag in &["-z", "--zero"] { - for &opt in &["-n", "--name", "-r", "--real"] { - let args = [opt, z_flag]; - new_ucmd!() + for &opt1 in &["--name", "--real"] { + // id: cannot print only names or real IDs in default format + let args = [opt1, z_flag]; + scene + .ucmd() .args(&args) .fails() - .stderr_is(expected_result(&args, true)); + .stderr_only(expected_result(&args, true)); + for &opt2 in &["--user", "--group", "--groups"] { + // u/g/G n/r z + let args = [opt2, z_flag, opt1]; + let result = scene.ucmd().args(&args).run(); + + if !result.succeeded() && is_ci() + // && (result.stderr_str().contains("cannot find name for") + // || result.stdout_str().contains("cannot find name for")) + { + // '--name' does not work on CICD ubuntu-16/ubuntu-18 + // id: cannot find name for user ID 1001 + // id: cannot find name for group ID 116 + scene + .ucmd() + .args(&args) + .fails() + .stderr_only(expected_result(&args, true)); + } else { + result.stdout_only(expected_result(&args, false)); + } + } } - for &opt in &["-u", "--user", "-g", "--group", "-G", "--groups"] { - let args = [opt, z_flag]; - new_ucmd!() + // u/g/G z + for &opt2 in &["--user", "--group", "--groups"] { + let args = [opt2, z_flag]; + scene + .ucmd() .args(&args) .succeeds() - .stdout_is(expected_result(&args, false)); + .stdout_only(expected_result(&args, false)); } } } +#[allow(clippy::needless_borrow)] #[cfg(any(target_vendor = "apple", target_os = "linux"))] fn expected_result(args: &[&str], exp_fail: bool) -> String { #[cfg(target_os = "linux")] @@ -260,9 +308,9 @@ fn expected_result(args: &[&str], exp_fail: bool) -> String { .fails() .stderr_move_str() }; - return if cfg!(target_os = "macos") && result.starts_with("gid") { + if cfg!(target_os = "macos") && result.starts_with("gid") { result[1..].to_string() } else { result - }; + } } From 6d7d57e13c9f0e3de2a3f00be09d66087b186360 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 9 Jun 2021 22:52:59 +0200 Subject: [PATCH 0957/1135] remove a legacy declaration to getopt --- Cargo.lock | 1 - src/uu/timeout/Cargo.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7b2d989be..c69e1fde3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2602,7 +2602,6 @@ name = "uu_timeout" version = "0.0.6" dependencies = [ "clap", - "getopts", "libc", "uucore", "uucore_procs", diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index 206a98c08..d16559858 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -16,7 +16,6 @@ path = "src/timeout.rs" [dependencies] clap = "2.33" -getopts = "0.2.18" libc = "0.2.42" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } From 00c05b8687cca0d8a38dc3ad79e93857490f5799 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Thu, 10 Jun 2021 00:19:23 +0200 Subject: [PATCH 0958/1135] id: add error handling (stderr/exit_code) for '-ugG' --- src/uu/id/src/id.rs | 25 +++++++++++++++++++------ tests/by-util/test_id.rs | 14 ++++++-------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index f0659faf3..570a87790 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -201,6 +201,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; let line_ending = if zflag { '\0' } else { '\n' }; + let mut exit_code = 0; if gflag { let id = possible_pw @@ -209,13 +210,17 @@ pub fn uumain(args: impl uucore::Args) -> i32 { print!( "{}{}", if nflag { - entries::gid2grp(id).unwrap_or_else(|_| id.to_string()) + entries::gid2grp(id).unwrap_or_else(|_| { + show_error!("cannot find name for group ID {}", id); + exit_code = 1; + id.to_string() + }) } else { id.to_string() }, line_ending ); - return 0; + return exit_code; } if uflag { @@ -225,13 +230,17 @@ pub fn uumain(args: impl uucore::Args) -> i32 { print!( "{}{}", if nflag { - entries::uid2usr(id).unwrap_or_else(|_| id.to_string()) + entries::uid2usr(id).unwrap_or_else(|_| { + show_error!("cannot find name for user ID {}", id); + exit_code = 1; + id.to_string() + }) } else { id.to_string() }, line_ending ); - return 0; + return exit_code; } if gsflag { @@ -246,7 +255,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .unwrap_or_else(|| entries::get_groups_gnu(Some(id)).unwrap()) .iter() .map(|&id| if nflag { - entries::gid2grp(id).unwrap_or_else(|_| id.to_string()) + entries::gid2grp(id).unwrap_or_else(|_| { + show_error!("cannot find name for group ID {}", id); + exit_code = 1; + id.to_string() + }) } else { id.to_string() }) @@ -254,7 +267,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .join(delimiter), line_ending ); - return 0; + return exit_code; } if matches.is_present(options::OPT_PASSWORD) { diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index a885069a1..e8e2f8d35 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -209,10 +209,9 @@ fn test_id_default_format() { // u/g/G n/r let args = [opt2, opt1]; let result = scene.ucmd().args(&args).run(); - - if !result.succeeded() && is_ci() - // && (result.stderr_str().contains("cannot find name for") - // || result.stdout_str().contains("cannot find name for")) + if !result.succeeded() + && is_ci() + && result.stderr_str().contains("cannot find name for") { // '--name' does not work on CICD ubuntu-16/ubuntu-18 // id: cannot find name for user ID 1001 @@ -255,10 +254,9 @@ fn test_id_zero() { // u/g/G n/r z let args = [opt2, z_flag, opt1]; let result = scene.ucmd().args(&args).run(); - - if !result.succeeded() && is_ci() - // && (result.stderr_str().contains("cannot find name for") - // || result.stdout_str().contains("cannot find name for")) + if !result.succeeded() + && is_ci() + && result.stderr_str().contains("cannot find name for") { // '--name' does not work on CICD ubuntu-16/ubuntu-18 // id: cannot find name for user ID 1001 From 23f655e2a514ee2730601f7ac184d84763e8e07e Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 11:15:01 +0900 Subject: [PATCH 0959/1135] Use inclusive range Co-authored-by: Michael Debertol --- src/uucore/src/lib/features/entries.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/src/lib/features/entries.rs b/src/uucore/src/lib/features/entries.rs index 75bf245e4..7d8c78a2f 100644 --- a/src/uucore/src/lib/features/entries.rs +++ b/src/uucore/src/lib/features/entries.rs @@ -102,7 +102,7 @@ pub fn get_groups_gnu(arg_id: Option) -> IOResult> { fn sort_groups(mut groups: Vec, egid: gid_t) -> Vec { if let Some(index) = groups.iter().position(|&x| x == egid) { - groups[..index + 1].rotate_right(1); + groups[..=index].rotate_right(1); } else { groups.insert(0, egid); } From 3eae399ec4e38bf4ea9fb4600a34b792e1076145 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 11:51:04 +0900 Subject: [PATCH 0960/1135] Remove trivially unnessessary unwrap() from base32/64 --- src/uu/base32/src/base32.rs | 9 +-------- src/uu/base64/src/base64.rs | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/uu/base32/src/base32.rs b/src/uu/base32/src/base32.rs index f0e187c31..e6a01cb34 100644 --- a/src/uu/base32/src/base32.rs +++ b/src/uu/base32/src/base32.rs @@ -38,18 +38,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let config_result: Result = base_common::parse_base_cmd_args(args, name, VERSION, ABOUT, &usage); - - if config_result.is_err() { - match config_result { - Ok(_) => panic!(), - Err(s) => crash!(BASE_CMD_PARSE_ERROR, "{}", s), - } - } + let config = config_result.unwrap_or_else(|s| crash!(BASE_CMD_PARSE_ERROR, "{}", s)); // Create a reference to stdin so we can return a locked stdin from // parse_base_cmd_args let stdin_raw = stdin(); - let config = config_result.unwrap(); let mut input: Box = base_common::get_input(&config, &stdin_raw); base_common::handle_input( diff --git a/src/uu/base64/src/base64.rs b/src/uu/base64/src/base64.rs index 810df4fe8..0dd831027 100644 --- a/src/uu/base64/src/base64.rs +++ b/src/uu/base64/src/base64.rs @@ -38,18 +38,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let name = executable!(); let config_result: Result = base_common::parse_base_cmd_args(args, name, VERSION, ABOUT, &usage); - - if config_result.is_err() { - match config_result { - Ok(_) => panic!(), - Err(s) => crash!(BASE_CMD_PARSE_ERROR, "{}", s), - } - } + let config = config_result.unwrap_or_else(|s| crash!(BASE_CMD_PARSE_ERROR, "{}", s)); // Create a reference to stdin so we can return a locked stdin from // parse_base_cmd_args let stdin_raw = stdin(); - let config = config_result.unwrap(); let mut input: Box = base_common::get_input(&config, &stdin_raw); base_common::handle_input( From 774c01f00800be92ec28501731ffd917c8847f42 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 12:29:41 +0900 Subject: [PATCH 0961/1135] Remove trivially unnessessary unwrap() from du --- src/uu/du/src/du.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 82424ca32..94d90c6cd 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -320,8 +320,7 @@ fn du( if this_stat.is_dir { futures.push(du(this_stat, options, depth + 1, inodes)); } else { - if this_stat.inode.is_some() { - let inode = this_stat.inode.unwrap(); + if let Some(inode) = this_stat.inode { if inodes.contains(&inode) { continue; } @@ -360,7 +359,9 @@ fn du( my_stat.size += stat.size; my_stat.blocks += stat.blocks; } - options.max_depth == None || depth < options.max_depth.unwrap() + options + .max_depth + .map_or(true, |max_depth| depth < max_depth) })); stats.push(my_stat); Box::new(stats.into_iter()) From da9558c6841e7721fcbecb71da9f860e7a07d004 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 12:36:34 +0900 Subject: [PATCH 0962/1135] Remove trivially unnessessary unwrap() from expr --- src/uu/expr/src/expr.rs | 6 +----- src/uu/expr/src/syntax_tree.rs | 17 ++++------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/uu/expr/src/expr.rs b/src/uu/expr/src/expr.rs index 329a79ba2..8238917f7 100644 --- a/src/uu/expr/src/expr.rs +++ b/src/uu/expr/src/expr.rs @@ -56,11 +56,7 @@ fn print_expr_error(expr_error: &str) -> ! { } fn evaluate_ast(maybe_ast: Result, String>) -> Result { - if maybe_ast.is_err() { - Err(maybe_ast.err().unwrap()) - } else { - maybe_ast.ok().unwrap().evaluate() - } + maybe_ast.and_then(|ast| ast.evaluate()) } fn maybe_handle_help_or_version(args: &[String]) -> bool { diff --git a/src/uu/expr/src/syntax_tree.rs b/src/uu/expr/src/syntax_tree.rs index b72d78729..ba477414e 100644 --- a/src/uu/expr/src/syntax_tree.rs +++ b/src/uu/expr/src/syntax_tree.rs @@ -175,23 +175,14 @@ impl AstNode { pub fn tokens_to_ast( maybe_tokens: Result, String>, ) -> Result, String> { - if maybe_tokens.is_err() { - Err(maybe_tokens.err().unwrap()) - } else { - let tokens = maybe_tokens.ok().unwrap(); + maybe_tokens.and_then(|tokens| { let mut out_stack: TokenStack = Vec::new(); let mut op_stack: TokenStack = Vec::new(); for (token_idx, token) in tokens { - if let Err(reason) = - push_token_to_either_stack(token_idx, &token, &mut out_stack, &mut op_stack) - { - return Err(reason); - } - } - if let Err(reason) = move_rest_of_ops_to_out(&mut out_stack, &mut op_stack) { - return Err(reason); + push_token_to_either_stack(token_idx, &token, &mut out_stack, &mut op_stack)?; } + move_rest_of_ops_to_out(&mut out_stack, &mut op_stack)?; assert!(op_stack.is_empty()); maybe_dump_rpn(&out_stack); @@ -205,7 +196,7 @@ pub fn tokens_to_ast( maybe_dump_ast(&result); result } - } + }) } fn maybe_dump_ast(result: &Result, String>) { From 797c4a340e1941ecd276f0241f24bf90f63c7f00 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 13:10:16 +0900 Subject: [PATCH 0963/1135] Remove trivially unnessessary unwrap() from od --- src/uu/od/src/parse_formats.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/uu/od/src/parse_formats.rs b/src/uu/od/src/parse_formats.rs index abf05ea18..ccac44d72 100644 --- a/src/uu/od/src/parse_formats.rs +++ b/src/uu/od/src/parse_formats.rs @@ -275,17 +275,13 @@ fn parse_type_string(params: &str) -> Result, Strin let mut chars = params.chars(); let mut ch = chars.next(); - while ch.is_some() { - let type_char = ch.unwrap(); - let type_char = match format_type(type_char) { - Some(t) => t, - None => { - return Err(format!( - "unexpected char '{}' in format specification '{}'", - type_char, params - )); - } - }; + while let Some(type_char) = ch { + let type_char = format_type(type_char).ok_or_else(|| { + format!( + "unexpected char '{}' in format specification '{}'", + type_char, params + ) + })?; let type_cat = format_type_category(type_char); From 1ac4eb171ee7976c8de30fcf786e2873ec2b7685 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 12:37:52 +0900 Subject: [PATCH 0964/1135] move cmode rather than mut --- src/uu/chmod/src/chmod.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index 7d171a6f7..2d5787099 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -134,23 +134,25 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Err(err) => crash!(1, "cannot stat attributes of '{}': {}", fref, err), }); let modes = matches.value_of(options::MODE).unwrap(); // should always be Some because required - let mut cmode = if mode_had_minus_prefix { + let cmode = if mode_had_minus_prefix { // clap parsing is finished, now put prefix back - Some(format!("-{}", modes)) + format!("-{}", modes) } else { - Some(modes.to_string()) + modes.to_string() }; let mut files: Vec = matches .values_of(options::FILE) .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); - if fmode.is_some() { + let cmode = if fmode.is_some() { // "--reference" and MODE are mutually exclusive // if "--reference" was used MODE needs to be interpreted as another FILE // it wasn't possible to implement this behavior directly with clap - files.push(cmode.unwrap()); - cmode = None; - } + files.push(cmode); + None + } else { + Some(cmode) + }; let chmoder = Chmoder { changes, From ded92dbca0253be2bd5b9cd886bbc5e8ed2bc6d6 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 13:09:35 +0900 Subject: [PATCH 0965/1135] clean up fold, hashsum, kill --- src/uu/fold/src/fold.rs | 2 +- src/uu/hashsum/src/hashsum.rs | 6 ++---- src/uu/kill/src/kill.rs | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index c49809549..118f7f5f9 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -98,7 +98,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { fn handle_obsolete(args: &[String]) -> (Vec, Option) { for (i, arg) in args.iter().enumerate() { let slice = &arg; - if slice.starts_with('-') && slice.len() > 1 && slice.chars().nth(1).unwrap().is_digit(10) { + if slice.starts_with('-') && slice.chars().nth(1).map_or(false, |c| c.is_digit(10)) { let mut v = args.to_vec(); v.remove(i); return (v, Some(slice[1..].to_owned())); diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index 1f097e128..a007473ab 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -255,10 +255,8 @@ fn detect_algo<'a>( } } } - if alg.is_none() { - crash!(1, "You must specify hash algorithm!") - }; - (name, alg.unwrap(), output_bits) + let alg = alg.unwrap_or_else(|| crash!(1, "You must specify hash algorithm!")); + (name, alg, output_bits) } } } diff --git a/src/uu/kill/src/kill.rs b/src/uu/kill/src/kill.rs index 6c2464c92..a49acaa05 100644 --- a/src/uu/kill/src/kill.rs +++ b/src/uu/kill/src/kill.rs @@ -111,7 +111,7 @@ fn handle_obsolete(mut args: Vec) -> (Vec, Option) { while i < args.len() { // this is safe because slice is valid when it is referenced let slice = &args[i].clone(); - if slice.starts_with('-') && slice.len() > 1 && slice.chars().nth(1).unwrap().is_digit(10) { + if slice.starts_with('-') && slice.chars().nth(1).map_or(false, |c| c.is_digit(10)) { let val = &slice[1..]; match val.parse() { Ok(num) => { From 9c6750252d2c7a981de5cf6ff527fc54de69b147 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 15:07:07 +0900 Subject: [PATCH 0966/1135] du winapi dependency only for windows --- src/uu/du/Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index 023c0a021..dcd1f720e 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -19,6 +19,8 @@ clap = "2.33" chrono = "0.4" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } + +[target.'cfg(target_os = "windows")'.dependencies] winapi = { version="0.3", features=[] } [[bin]] From 44d1790d1fee2e9272ab38d854291a97b359299c Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Thu, 10 Jun 2021 10:33:22 +0200 Subject: [PATCH 0967/1135] id: add more tests for '--zero' --- tests/by-util/test_id.rs | 189 +++++++++------------------------------ tests/common/util.rs | 16 ++++ 2 files changed, 59 insertions(+), 146 deletions(-) diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index e8e2f8d35..bfed78886 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -5,8 +5,9 @@ use crate::common::util::*; // considered okay. If we are not inside the CI this calls assert!(result.success). // // From the Logs: "Build (ubuntu-18.04, x86_64-unknown-linux-gnu, feat_os_unix, use-cross)" -// stderr: "whoami: cannot find name for user ID 1001" -// stderr: "id: Could not find uid 1001: No such id: 1001" +// whoami: cannot find name for user ID 1001 +// id --name: cannot find name for user ID 1001 +// id --name: cannot find name for group ID 116 // // However, when running "id" from within "/bin/bash" it looks fine: // id: "uid=1001(runner) gid=118(docker) groups=118(docker),4(adm),101(systemd-journal)" @@ -94,69 +95,6 @@ fn test_id_name_from_id() { assert_eq!(username_id, username_whoami); } -#[test] -fn test_id_group() { - let scene = TestScenario::new(util_name!()); - - let mut result = scene.ucmd().arg("-g").succeeds(); - let s1 = result.stdout_str().trim(); - assert!(s1.parse::().is_ok()); - - result = scene.ucmd().arg("--group").succeeds(); - let s1 = result.stdout_str().trim(); - assert!(s1.parse::().is_ok()); - - #[cfg(any(target_vendor = "apple", target_os = "linux"))] - for flag in &["-g", "--group"] { - new_ucmd!() - .arg(flag) - .succeeds() - .stdout_is(expected_result(&[flag], false)); - } -} - -#[test] -#[cfg(any(target_vendor = "apple", target_os = "linux"))] -fn test_id_groups() { - let scene = TestScenario::new(util_name!()); - for g_flag in &["-G", "--groups"] { - scene - .ucmd() - .arg(g_flag) - .succeeds() - .stdout_is(expected_result(&[g_flag], false)); - for &r_flag in &["-r", "--real"] { - let args = [g_flag, r_flag]; - scene - .ucmd() - .args(&args) - .succeeds() - .stdout_is(expected_result(&args, false)); - } - } -} - -#[test] -fn test_id_user() { - let scene = TestScenario::new(util_name!()); - - let result = scene.ucmd().arg("-u").succeeds(); - let s1 = result.stdout_str().trim(); - assert!(s1.parse::().is_ok()); - - let result = scene.ucmd().arg("--user").succeeds(); - let s1 = result.stdout_str().trim(); - assert!(s1.parse::().is_ok()); - - #[cfg(any(target_vendor = "apple", target_os = "linux"))] - for flag in &["-u", "--user"] { - new_ucmd!() - .arg(flag) - .succeeds() - .stdout_is(expected_result(&[flag], false)); - } -} - #[test] fn test_id_pretty_print() { let username = return_whoami_username(); @@ -193,52 +131,13 @@ fn test_id_password_style() { } #[test] -#[cfg(any(target_vendor = "apple", target_os = "linux"))] +#[cfg(unix)] fn test_id_default_format() { - // These are the same tests like in test_id_zero but without --zero flag. - let scene = TestScenario::new(util_name!()); - for &opt1 in &["--name", "--real"] { - // id: cannot print only names or real IDs in default format - let args = [opt1]; - scene - .ucmd() - .args(&args) - .fails() - .stderr_only(expected_result(&args, true)); - for &opt2 in &["--user", "--group", "--groups"] { - // u/g/G n/r - let args = [opt2, opt1]; - let result = scene.ucmd().args(&args).run(); - if !result.succeeded() - && is_ci() - && result.stderr_str().contains("cannot find name for") - { - // '--name' does not work on CICD ubuntu-16/ubuntu-18 - // id: cannot find name for user ID 1001 - // id: cannot find name for group ID 116 - scene - .ucmd() - .args(&args) - .fails() - .stderr_only(expected_result(&args, true)); - } else { - result.stdout_only(expected_result(&args, false)); - } - } - } - // u/g/G - for &opt2 in &["--user", "--group", "--groups"] { - let args = [opt2]; - scene - .ucmd() - .args(&args) - .succeeds() - .stdout_only(expected_result(&args, false)); - } + // TODO: These are the same tests like in test_id_zero but without --zero flag. } #[test] -#[cfg(any(target_vendor = "apple", target_os = "linux"))] +#[cfg(unix)] fn test_id_zero() { let scene = TestScenario::new(util_name!()); for z_flag in &["-z", "--zero"] { @@ -249,26 +148,15 @@ fn test_id_zero() { .ucmd() .args(&args) .fails() - .stderr_only(expected_result(&args, true)); + .stderr_only(expected_result(&args).stderr_str()); for &opt2 in &["--user", "--group", "--groups"] { // u/g/G n/r z let args = [opt2, z_flag, opt1]; let result = scene.ucmd().args(&args).run(); - if !result.succeeded() - && is_ci() - && result.stderr_str().contains("cannot find name for") - { - // '--name' does not work on CICD ubuntu-16/ubuntu-18 - // id: cannot find name for user ID 1001 - // id: cannot find name for group ID 116 - scene - .ucmd() - .args(&args) - .fails() - .stderr_only(expected_result(&args, true)); - } else { - result.stdout_only(expected_result(&args, false)); - } + let expected_result = expected_result(&args); + result + .stdout_is_bytes(expected_result.stdout()) + .stderr_is_bytes(expected_result.stderr()); } } // u/g/G z @@ -278,37 +166,46 @@ fn test_id_zero() { .ucmd() .args(&args) .succeeds() - .stdout_only(expected_result(&args, false)); + .stdout_only_bytes(expected_result(&args).stdout()); } } } #[allow(clippy::needless_borrow)] -#[cfg(any(target_vendor = "apple", target_os = "linux"))] -fn expected_result(args: &[&str], exp_fail: bool) -> String { +#[cfg(unix)] +fn expected_result(args: &[&str]) -> CmdResult { #[cfg(target_os = "linux")] let util_name = util_name!(); - #[cfg(target_vendor = "apple")] + #[cfg(all(unix, not(target_os = "linux")))] let util_name = format!("g{}", util_name!()); - let result = if !exp_fail { - TestScenario::new(&util_name) - .cmd_keepenv(util_name) - .env("LANGUAGE", "C") - .args(args) - .succeeds() - .stdout_move_str() - } else { - TestScenario::new(&util_name) - .cmd_keepenv(util_name) - .env("LANGUAGE", "C") - .args(args) - .fails() - .stderr_move_str() - }; - if cfg!(target_os = "macos") && result.starts_with("gid") { - result[1..].to_string() - } else { - result + let result = TestScenario::new(&util_name) + .cmd_keepenv(&util_name) + .env("LANGUAGE", "C") + .args(args) + .run(); + + let mut _o = 0; + let mut _e = 0; + #[cfg(all(unix, not(target_os = "linux")))] + { + _o = if result.stdout_str().starts_with(&util_name) { + 1 + } else { + 0 + }; + _e = if result.stderr_str().starts_with(&util_name) { + 1 + } else { + 0 + }; } + + CmdResult::new( + Some(result.tmpd()), + Some(result.code()), + result.succeeded(), + &result.stdout()[_o..], + &result.stderr()[_e..], + ) } diff --git a/tests/common/util.rs b/tests/common/util.rs index 2f7d7dcc4..64485c0a8 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -69,6 +69,22 @@ pub struct CmdResult { } impl CmdResult { + pub fn new( + tmpd: Option>, + code: Option, + success: bool, + stdout: &[u8], + stderr: &[u8], + ) -> CmdResult { + CmdResult { + tmpd, + code, + success, + stdout: stdout.to_vec(), + stderr: stderr.to_vec(), + } + } + /// Returns a reference to the program's standard output as a slice of bytes pub fn stdout(&self) -> &[u8] { &self.stdout From 357886b5999205317bbfcc1479d40ebf7d9e63de Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 18:05:36 +0900 Subject: [PATCH 0968/1135] Remove unnessassary chars() and unwrap_or() from tail --- src/uu/tail/src/tail.rs | 44 ++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 15a819d35..7670313a4 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -174,7 +174,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { match matches.value_of(options::LINES) { Some(n) => { let mut slice: &str = n; - if slice.chars().next().unwrap_or('_') == '+' { + if slice.as_bytes().first() == Some(&b'+') { settings.beginning = true; slice = &slice[1..]; } @@ -189,7 +189,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { None => { if let Some(n) = matches.value_of(options::BYTES) { let mut slice: &str = n; - if slice.chars().next().unwrap_or('_') == '+' { + if slice.as_bytes().first() == Some(&b'+') { settings.beginning = true; slice = &slice[1..]; } @@ -305,41 +305,35 @@ impl ParseSizeErr { pub type ParseSizeResult = Result; pub fn parse_size(mut size_slice: &str) -> Result { - let mut base = if size_slice.chars().last().unwrap_or('_') == 'B' { + let mut base = if size_slice.as_bytes().last() == Some(&b'B') { size_slice = &size_slice[..size_slice.len() - 1]; 1000u64 } else { 1024u64 }; - let exponent = if !size_slice.is_empty() { - let mut has_suffix = true; - let exp = match size_slice.chars().last().unwrap_or('_') { - 'K' | 'k' => 1u64, - 'M' => 2u64, - 'G' => 3u64, - 'T' => 4u64, - 'P' => 5u64, - 'E' => 6u64, - 'Z' | 'Y' => { + let exponent = match size_slice.as_bytes().last() { + Some(unit) => match unit { + b'K' | b'k' => 1u64, + b'M' => 2u64, + b'G' => 3u64, + b'T' => 4u64, + b'P' => 5u64, + b'E' => 6u64, + b'Z' | b'Y' => { return Err(ParseSizeErr::size_too_big(size_slice)); } - 'b' => { + b'b' => { base = 512u64; 1u64 } - _ => { - has_suffix = false; - 0u64 - } - }; - if has_suffix { - size_slice = &size_slice[..size_slice.len() - 1]; - } - exp - } else { - 0u64 + _ => 0u64, + }, + None => 0u64, }; + if exponent != 0 { + size_slice = &size_slice[..size_slice.len() - 1]; + } let mut multiplier = 1u64; for _ in 0u64..exponent { From 8a03ac6caa4095a14ef1f3d84db67e9dd4bf8b6e Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 12:03:25 +0900 Subject: [PATCH 0969/1135] Prevent double scanning from dircolors --- src/uu/dircolors/src/dircolors.rs | 35 +++++++++++++++++-------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index 2fa2e8b91..80c94c047 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -191,24 +191,27 @@ pub trait StrUtils { impl StrUtils for str { fn purify(&self) -> &Self { - let mut line = self; - for (n, c) in self.chars().enumerate() { - if c != '#' { - continue; - } - + let line = if self.as_bytes().first() == Some(&b'#') { // Ignore if '#' is at the beginning of line - if n == 0 { - line = &self[..0]; - break; + &self[..0] + } else { + let mut line = self; + for (n, _) in self + .as_bytes() + .iter() + .enumerate() + .rev() + .filter(|(_, c)| **c == b'#') + { + // Ignore the content after '#' + // only if it is preceded by at least one whitespace + if self[..n].chars().last().unwrap().is_whitespace() { + line = &self[..n]; + break; + } } - - // Ignore the content after '#' - // only if it is preceded by at least one whitespace - if self.chars().nth(n - 1).unwrap().is_whitespace() { - line = &self[..n]; - } - } + line + }; line.trim() } From e3197bea39ca6093126dbdf1d24d834f03e09837 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 18:14:23 +0900 Subject: [PATCH 0970/1135] dircolor purify forward match '#' --- src/uu/dircolors/src/dircolors.rs | 37 ++++++++++++++++--------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index 80c94c047..530f051b3 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -191,27 +191,28 @@ pub trait StrUtils { impl StrUtils for str { fn purify(&self) -> &Self { - let line = if self.as_bytes().first() == Some(&b'#') { - // Ignore if '#' is at the beginning of line - &self[..0] - } else { - let mut line = self; - for (n, _) in self - .as_bytes() - .iter() - .enumerate() - .rev() - .filter(|(_, c)| **c == b'#') - { - // Ignore the content after '#' - // only if it is preceded by at least one whitespace - if self[..n].chars().last().unwrap().is_whitespace() { - line = &self[..n]; + let mut line = self; + for (n, _) in self + .as_bytes() + .iter() + .enumerate() + .filter(|(_, c)| **c == b'#') + { + // Ignore the content after '#' + // only if it is preceded by at least one whitespace + match self[..n].chars().last() { + Some(c) if c.is_whitespace() => { + line = &self[..n - c.len_utf8()]; break; } + None => { + // n == 0 + line = &self[..0]; + break; + } + _ => (), } - line - }; + } line.trim() } From 1fecd98ebe805f778f6fb0f6073613fb21507ba2 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 18:30:19 +0900 Subject: [PATCH 0971/1135] bytes operation for pathchk --- src/uu/pathchk/src/pathchk.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/uu/pathchk/src/pathchk.rs b/src/uu/pathchk/src/pathchk.rs index 07e3a3289..358881509 100644 --- a/src/uu/pathchk/src/pathchk.rs +++ b/src/uu/pathchk/src/pathchk.rs @@ -241,13 +241,14 @@ fn no_leading_hyphen(path_segment: &str) -> bool { // check whether a path segment contains only valid (read: portable) characters fn check_portable_chars(path_segment: &str) -> bool { - let valid_str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-".to_string(); - for ch in path_segment.chars() { - if !valid_str.contains(ch) { + const VALID_CHARS: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-"; + for (i, ch) in path_segment.as_bytes().iter().enumerate() { + if !VALID_CHARS.contains(ch) { + let invalid = path_segment[i..].chars().next().unwrap(); writeln!( &mut std::io::stderr(), "nonportable character '{}' in file name component '{}'", - ch, + invalid, path_segment ); return false; From 3ee09fa783026a02c892440b2d380370beeb2403 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 12:29:41 +0900 Subject: [PATCH 0972/1135] only matches Some() in match --- src/uu/du/src/du.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 94d90c6cd..bf1272a44 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -229,10 +229,9 @@ fn unit_string_to_number(s: &str) -> Option { let mut offset = 0; let mut s_chars = s.chars().rev(); - let (mut ch, multiple) = match s_chars.next() { - Some('B') | Some('b') => ('B', 1000u64), - Some(ch) => (ch, 1024u64), - None => return None, + let (mut ch, multiple) = match s_chars.next()? { + 'B' | 'b' => ('B', 1000u64), + ch => (ch, 1024u64), }; if ch == 'B' { ch = s_chars.next()?; From cc6c2f64b1ce36f02501b8c0fb52ddb66cdf7a46 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 13:09:35 +0900 Subject: [PATCH 0973/1135] clean up fold, hashsum, kill, nl, printf, truncate --- src/uu/nl/src/nl.rs | 2 +- .../src/tokenize/num_format/formatters/decf.rs | 15 +++------------ .../num_format/formatters/float_common.rs | 13 +++++++------ src/uu/truncate/src/truncate.rs | 5 +---- 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index c062eedd9..41750259f 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -247,7 +247,7 @@ fn nl(reader: &mut BufReader, settings: &Settings) { let mut line_filter: fn(&str, ®ex::Regex) -> bool = pass_regex; for mut l in reader.lines().map(|r| r.unwrap()) { // Sanitize the string. We want to print the newline ourselves. - if !l.is_empty() && l.chars().rev().next().unwrap() == '\n' { + if l.chars().last() == Some('\n') { l.pop(); } // Next we iterate through the individual chars to see if this diff --git a/src/uu/printf/src/tokenize/num_format/formatters/decf.rs b/src/uu/printf/src/tokenize/num_format/formatters/decf.rs index 5798eadcb..3376345e0 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/decf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/decf.rs @@ -55,18 +55,9 @@ impl Formatter for Decf { ); // strip trailing zeroes if let Some(ref post_dec) = f_sci.post_decimal { - let mut i = post_dec.len(); - { - let mut it = post_dec.chars(); - while let Some(c) = it.next_back() { - if c != '0' { - break; - } - i -= 1; - } - } - if i != post_dec.len() { - f_sci.post_decimal = Some(String::from(&post_dec[0..i])); + let trimmed = post_dec.trim_end_matches('0'); + if trimmed.len() != post_dec.len() { + f_sci.post_decimal = Some(trimmed.to_owned()); } } let f_fl = get_primitive_dec( diff --git a/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs b/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs index dfd64296c..97009b586 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs @@ -247,8 +247,12 @@ pub fn get_primitive_dec( first_segment.len() as isize - 1, ) } else { - match first_segment.chars().next() { - Some('0') => { + match first_segment + .chars() + .next() + .expect("float_common: no chars in first segment.") + { + '0' => { let it = second_segment.chars().enumerate(); let mut m: isize = 0; let mut pre = String::from("0"); @@ -266,10 +270,7 @@ pub fn get_primitive_dec( } (pre, post, m) } - Some(_) => (first_segment, second_segment, 0), - None => { - panic!("float_common: no chars in first segment."); - } + _ => (first_segment, second_segment, 0), } } } else { diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 8e785ad21..22c0252f7 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -363,10 +363,7 @@ fn parse_size(size: &str) -> Result { // Get the numeric part of the size argument. For example, if the // argument is "123K", then the numeric part is "123". let numeric_string: String = size.chars().take_while(|c| c.is_digit(10)).collect(); - let number: u64 = match numeric_string.parse() { - Ok(n) => n, - Err(_) => return Err(()), - }; + let number: u64 = numeric_string.parse().map_err(|_| ())?; // Get the alphabetic units part of the size argument and compute // the factor it represents. For example, if the argument is "123K", From b21d189fcfa99af3b78b2e8a3206460d313f75a9 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 14:35:09 +0900 Subject: [PATCH 0974/1135] Remove trivially unnessessary unwrap() pr --- src/uu/pr/src/pr.rs | 53 +++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index 0761dd09d..d7b95d215 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -401,18 +401,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { for file_group in file_groups { let result_options = build_options(&matches, &file_group, args.join(" ")); + let options = match result_options { + Ok(options) => options, + Err(err) => { + print_error(&matches, err); + return 1; + } + }; - if result_options.is_err() { - print_error(&matches, result_options.err().unwrap()); - return 1; - } - - let options = &result_options.unwrap(); - - let cmd_result = if file_group.len() == 1 { - pr(file_group.get(0).unwrap(), options) + let cmd_result = if let Ok(group) = file_group.iter().exactly_one() { + pr(group, &options) } else { - mpr(&file_group, options) + mpr(&file_group, &options) }; let status = match cmd_result { @@ -442,11 +442,12 @@ fn recreate_arguments(args: &[String]) -> Vec { let mut arguments = args.to_owned(); let num_option = args.iter().find_position(|x| n_regex.is_match(x.trim())); if let Some((pos, _value)) = num_option { - let num_val_opt = args.get(pos + 1); - if num_val_opt.is_some() && !num_regex.is_match(num_val_opt.unwrap()) { - let could_be_file = arguments.remove(pos + 1); - arguments.insert(pos + 1, format!("{}", NumberingMode::default().width)); - arguments.insert(pos + 2, could_be_file); + if let Some(num_val_opt) = args.get(pos + 1) { + if !num_regex.is_match(num_val_opt) { + let could_be_file = arguments.remove(pos + 1); + arguments.insert(pos + 1, format!("{}", NumberingMode::default().width)); + arguments.insert(pos + 2, could_be_file); + } } } @@ -666,12 +667,14 @@ fn build_options( None => end_page_in_plus_option, }; - if end_page.is_some() && start_page > end_page.unwrap() { - return Err(PrError::EncounteredErrors(format!( - "invalid --pages argument '{}:{}'", - start_page, - end_page.unwrap() - ))); + if let Some(end_page) = end_page { + if start_page > end_page { + return Err(PrError::EncounteredErrors(format!( + "invalid --pages argument '{}:{}'", + start_page, + end_page + ))); + } } let default_lines_per_page = if form_feed_used { @@ -947,7 +950,7 @@ fn read_stream_and_create_pages( let current_page = x + 1; current_page >= start_page - && (last_page.is_none() || current_page <= last_page.unwrap()) + && last_page.map_or(true, |last_page| current_page <= last_page) }), ) } @@ -1030,8 +1033,7 @@ fn print_page(lines: &[FileLine], options: &OutputOptions, page: usize) -> Resul let lines_written = write_columns(lines, options, out)?; - for index in 0..trailer_content.len() { - let x = trailer_content.get(index).unwrap(); + for (index, x) in trailer_content.iter().enumerate() { out.write_all(x.as_bytes())?; if index + 1 != trailer_content.len() { out.write_all(line_separator)?; @@ -1074,8 +1076,7 @@ fn write_columns( let mut offset = 0; for col in 0..columns { let mut inserted = 0; - for i in offset..lines.len() { - let line = lines.get(i).unwrap(); + for line in &lines[offset..] { if line.file_id != col { break; } From b9611b71ee46b761b2e29e6dec2af3a78b2841b5 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 17:22:05 +0900 Subject: [PATCH 0975/1135] use ? operator for od --- src/uu/od/src/parse_formats.rs | 48 ++++++++++++++-------------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/src/uu/od/src/parse_formats.rs b/src/uu/od/src/parse_formats.rs index ccac44d72..fca908016 100644 --- a/src/uu/od/src/parse_formats.rs +++ b/src/uu/od/src/parse_formats.rs @@ -297,30 +297,25 @@ fn parse_type_string(params: &str) -> Result, Strin ch = chars.next(); } if !decimal_size.is_empty() { - byte_size = match decimal_size.parse() { - Err(_) => { - return Err(format!( - "invalid number '{}' in format specification '{}'", - decimal_size, params - )) - } - Ok(n) => n, - } + byte_size = decimal_size.parse().map_err(|_| { + format!( + "invalid number '{}' in format specification '{}'", + decimal_size, params + ) + })?; } } if is_format_dump_char(ch, &mut show_ascii_dump) { ch = chars.next(); } - match od_format_type(type_char, byte_size) { - Some(ft) => formats.push(ParsedFormatterItemInfo::new(ft, show_ascii_dump)), - None => { - return Err(format!( - "invalid size '{}' in format specification '{}'", - byte_size, params - )) - } - } + let ft = od_format_type(type_char, byte_size).ok_or_else(|| { + format!( + "invalid size '{}' in format specification '{}'", + byte_size, params + ) + })?; + formats.push(ParsedFormatterItemInfo::new(ft, show_ascii_dump)); } Ok(formats) @@ -331,16 +326,13 @@ pub fn parse_format_flags_str( args_str: &Vec<&'static str>, ) -> Result, String> { let args: Vec = args_str.iter().map(|s| s.to_string()).collect(); - match parse_format_flags(&args) { - Err(e) => Err(e), - Ok(v) => { - // tests using this function assume add_ascii_dump is not set - Ok(v.into_iter() - .inspect(|f| assert!(!f.add_ascii_dump)) - .map(|f| f.formatter_item_info) - .collect()) - } - } + parse_format_flags(&args).map(|v| { + // tests using this function assume add_ascii_dump is not set + v.into_iter() + .inspect(|f| assert!(!f.add_ascii_dump)) + .map(|f| f.formatter_item_info) + .collect() + }) } #[test] From 8433c7726ddadf186fe322aa1345d1c78ecf8573 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Jun 2021 17:41:39 +0900 Subject: [PATCH 0976/1135] tr parse_sequence reuses chars iterator --- src/uu/tr/src/expand.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/uu/tr/src/expand.rs b/src/uu/tr/src/expand.rs index 7d0c61c30..5d960921e 100644 --- a/src/uu/tr/src/expand.rs +++ b/src/uu/tr/src/expand.rs @@ -22,14 +22,15 @@ use std::ops::RangeInclusive; /// character; octal escape sequences consume 1 to 3 octal digits. #[inline] fn parse_sequence(s: &str) -> (char, usize) { - let c = s.chars().next().expect("invalid escape: empty string"); + let mut s = s.chars(); + let c = s.next().expect("invalid escape: empty string"); if ('0'..='7').contains(&c) { let mut v = c.to_digit(8).unwrap(); let mut consumed = 1; let bits_per_digit = 3; - for c in s.chars().skip(1).take(2) { + for c in s.take(2) { match c.to_digit(8) { Some(c) => { v = (v << bits_per_digit) | c; From dc57e1535eb708e2acbbf6b7d60e05147a0a932f Mon Sep 17 00:00:00 2001 From: Dean Li Date: Wed, 9 Jun 2021 22:42:19 +0800 Subject: [PATCH 0977/1135] more: Implement option '-d' Implement option '-d' (silent mode) Related to #2320 --- src/uu/more/src/more.rs | 53 ++++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 4d345e96b..fa21c1e12 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -32,6 +32,8 @@ use crossterm::{ use unicode_segmentation::UnicodeSegmentation; use unicode_width::UnicodeWidthStr; +const BELL: &str = "\x07"; + pub mod options { pub const SILENT: &str = "silent"; pub const LOGICAL: &str = "logical"; @@ -53,14 +55,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .about("A file perusal filter for CRT viewing.") .version(crate_version!()) - // The commented arguments below are unimplemented: - /* .arg( Arg::with_name(options::SILENT) .short("d") .long(options::SILENT) .help("Display help instead of ringing bell"), ) + // The commented arguments below are unimplemented: + /* .arg( Arg::with_name(options::LOGICAL) .short("f") @@ -140,6 +142,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .get_matches_from(args); let mut buff = String::new(); + let silent = matches.is_present(options::SILENT); if let Some(files) = matches.values_of(options::FILES) { let mut stdout = setup_term(); let length = files.len(); @@ -162,14 +165,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } let mut reader = BufReader::new(File::open(file).unwrap()); reader.read_to_string(&mut buff).unwrap(); - more(&buff, &mut stdout, next_file.copied()); + more(&buff, &mut stdout, next_file.copied(), silent); buff.clear(); } reset_term(&mut stdout); } else if atty::isnt(atty::Stream::Stdin) { stdin().read_to_string(&mut buff).unwrap(); let mut stdout = setup_term(); - more(&buff, &mut stdout, None); + more(&buff, &mut stdout, None, silent); reset_term(&mut stdout); } else { show_usage_error!("bad usage"); @@ -204,13 +207,14 @@ fn reset_term(stdout: &mut std::io::Stdout) { #[inline(always)] fn reset_term(_: &mut usize) {} -fn more(buff: &str, mut stdout: &mut Stdout, next_file: Option<&str>) { +fn more(buff: &str, mut stdout: &mut Stdout, next_file: Option<&str>, silent: bool) { let (cols, rows) = terminal::size().unwrap(); let lines = break_buff(buff, usize::from(cols)); let line_count: u16 = lines.len().try_into().unwrap(); let mut upper_mark = 0; let mut lines_left = line_count.saturating_sub(upper_mark + rows); + let mut wrong_key = false; draw( &mut upper_mark, @@ -219,6 +223,8 @@ fn more(buff: &str, mut stdout: &mut Stdout, next_file: Option<&str>) { lines.clone(), line_count, next_file, + silent, + wrong_key, ); let is_last = next_file.is_none(); @@ -237,6 +243,7 @@ fn more(buff: &str, mut stdout: &mut Stdout, next_file: Option<&str>) { loop { if event::poll(Duration::from_millis(10)).unwrap() { + wrong_key = false; match event::read().unwrap() { Event::Key(KeyEvent { code: KeyCode::Char('q'), @@ -265,7 +272,9 @@ fn more(buff: &str, mut stdout: &mut Stdout, next_file: Option<&str>) { }) => { upper_mark = upper_mark.saturating_sub(rows.saturating_sub(1)); } - _ => continue, + _ => { + wrong_key = true; + } } lines_left = line_count.saturating_sub(upper_mark + rows); draw( @@ -275,6 +284,8 @@ fn more(buff: &str, mut stdout: &mut Stdout, next_file: Option<&str>) { lines.clone(), line_count, next_file, + silent, + wrong_key, ); if lines_left == 0 { @@ -287,6 +298,7 @@ fn more(buff: &str, mut stdout: &mut Stdout, next_file: Option<&str>) { } } +#[allow(clippy::too_many_arguments)] fn draw( upper_mark: &mut u16, rows: u16, @@ -294,6 +306,8 @@ fn draw( lines: Vec, lc: u16, next_file: Option<&str>, + silent: bool, + wrong_key: bool, ) { execute!(stdout, terminal::Clear(terminal::ClearType::CurrentLine)).unwrap(); let (up_mark, lower_mark) = calc_range(*upper_mark, rows, lc); @@ -308,7 +322,7 @@ fn draw( .write_all(format!("\r{}\n", line).as_bytes()) .unwrap(); } - make_prompt_and_flush(&mut stdout, lower_mark, lc, next_file); + make_prompt_and_flush(&mut stdout, lower_mark, lc, next_file, silent, wrong_key); *upper_mark = up_mark; } @@ -364,8 +378,15 @@ fn calc_range(mut upper_mark: u16, rows: u16, line_count: u16) -> (u16, u16) { } // Make a prompt similar to original more -fn make_prompt_and_flush(stdout: &mut Stdout, lower_mark: u16, lc: u16, next_file: Option<&str>) { - let status = if lower_mark == lc { +fn make_prompt_and_flush( + stdout: &mut Stdout, + lower_mark: u16, + lc: u16, + next_file: Option<&str>, + silent: bool, + wrong_key: bool, +) { + let status_inner = if lower_mark == lc { format!("Next file: {}", next_file.unwrap_or_default()) } else { format!( @@ -373,11 +394,21 @@ fn make_prompt_and_flush(stdout: &mut Stdout, lower_mark: u16, lc: u16, next_fil (lower_mark as f64 / lc as f64 * 100.0).round() as u16 ) }; + + let status = format!("--More--({})", status_inner); + + let banner = match (silent, wrong_key) { + (true, true) => "[Press 'h' for instructions. (unimplemented)]".to_string(), + (true, false) => format!("{}[Press space to continue, 'q' to quit.]", status), + (false, true) => format!("{}{}", status, BELL), + (false, false) => status, + }; + write!( stdout, - "\r{}--More--({}){}", + "\r{}{}{}", Attribute::Reverse, - status, + banner, Attribute::Reset ) .unwrap(); From c5d7cbda32f443964559c3e66f1c3360b561af4c Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 10 Jun 2021 16:59:06 +0200 Subject: [PATCH 0978/1135] timeout: handle arguments for the command to run To prevent clap from parsing flags for the command to run as flags for timeout, remove the "args" positional argument, but allow to pass flags via the "command" positional arg. --- src/uu/timeout/src/timeout.rs | 28 ++++++++++------------------ tests/by-util/test_timeout.rs | 8 ++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index afe560ee5..ea9a0dc65 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -37,7 +37,6 @@ pub mod options { // Positional args. pub static DURATION: &str = "duration"; pub static COMMAND: &str = "command"; - pub static ARGS: &str = "args"; } struct Config { @@ -47,8 +46,7 @@ struct Config { duration: Duration, preserve_status: bool, - command: String, - command_args: Vec, + command: Vec, } impl Config { @@ -77,12 +75,11 @@ impl Config { let preserve_status: bool = options.is_present(options::PRESERVE_STATUS); let foreground = options.is_present(options::FOREGROUND); - let command: String = options.value_of(options::COMMAND).unwrap().to_string(); - - let command_args: Vec = match options.values_of(options::ARGS) { - Some(values) => values.map(|x| x.to_owned()).collect(), - None => vec![], - }; + let command = options + .values_of(options::COMMAND) + .unwrap() + .map(String::from) + .collect::>(); Config { foreground, @@ -91,7 +88,6 @@ impl Config { duration, preserve_status, command, - command_args, } } } @@ -137,9 +133,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(options::COMMAND) .index(2) .required(true) - ) - .arg( - Arg::with_name(options::ARGS).multiple(true) + .multiple(true) ) .setting(AppSettings::TrailingVarArg); @@ -148,7 +142,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let config = Config::from(matches); timeout( &config.command, - &config.command_args, config.duration, config.signal, config.kill_after, @@ -160,8 +153,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { /// TODO: Improve exit codes, and make them consistent with the GNU Coreutils exit codes. fn timeout( - cmdname: &str, - args: &[String], + cmd: &[String], duration: Duration, signal: usize, kill_after: Duration, @@ -171,8 +163,8 @@ fn timeout( if !foreground { unsafe { libc::setpgid(0, 0) }; } - let mut process = match Command::new(cmdname) - .args(args) + let mut process = match Command::new(&cmd[0]) + .args(&cmd[1..]) .stdin(Stdio::inherit()) .stdout(Stdio::inherit()) .stderr(Stdio::inherit()) diff --git a/tests/by-util/test_timeout.rs b/tests/by-util/test_timeout.rs index 28273e00f..2346a17aa 100644 --- a/tests/by-util/test_timeout.rs +++ b/tests/by-util/test_timeout.rs @@ -9,3 +9,11 @@ fn test_subcommand_return_code() { new_ucmd!().arg("1").arg("false").run().status_code(1); } + +#[test] +fn test_command_with_args() { + new_ucmd!() + .args(&["1700", "echo", "-n", "abcd"]) + .succeeds() + .stdout_only("abcd"); +} From ed646090c209fe4376d20439ecf6279b6ee26131 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 10 Jun 2021 17:00:12 +0200 Subject: [PATCH 0979/1135] timeout: fix usage string --- src/uu/timeout/src/timeout.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index ea9a0dc65..3a35c351f 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -23,7 +23,7 @@ use uucore::InvalidEncodingHandling; static ABOUT: &str = "Start COMMAND, and kill it if still running after DURATION."; fn get_usage() -> String { - format!("{0} [OPTION]... [FILE]...", executable!()) + format!("{0} [OPTION] DURATION COMMAND...", executable!()) } const ERR_EXIT_STATUS: i32 = 125; From ceb5a2998c18215bad1684d337da3220cb8201d0 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 10 Jun 2021 18:28:37 +0200 Subject: [PATCH 0980/1135] core: add EXIT signal EXIT is supported by GNU (see https://github.com/coreutils/gnulib/blob/993ca832d232c33da1d2bb07e91acd6d301ebea0/lib/sig2str.c#L258), so we have to support it too to pass GNU tests. --- src/uucore/src/lib/features/signals.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/uucore/src/lib/features/signals.rs b/src/uucore/src/lib/features/signals.rs index d22fa1791..2e6069cb7 100644 --- a/src/uucore/src/lib/features/signals.rs +++ b/src/uucore/src/lib/features/signals.rs @@ -29,7 +29,11 @@ Linux Programmer's Manual */ #[cfg(target_os = "linux")] -pub static ALL_SIGNALS: [Signal<'static>; 31] = [ +pub static ALL_SIGNALS: [Signal<'static>; 32] = [ + Signal { + name: "EXIT", + value: 0, + }, Signal { name: "HUP", value: 1, @@ -198,7 +202,11 @@ No Name Default Action Description */ #[cfg(any(target_vendor = "apple", target_os = "freebsd"))] -pub static ALL_SIGNALS: [Signal<'static>; 31] = [ +pub static ALL_SIGNALS: [Signal<'static>; 32] = [ + Signal { + name: "EXIT", + value: 0, + }, Signal { name: "HUP", value: 1, From b0b937dc3e2a81c95b0d621f726fd9b39673dfa6 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 10 Jun 2021 18:29:06 +0200 Subject: [PATCH 0981/1135] core: add signal name lookup by value --- src/uucore/src/lib/features/signals.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/uucore/src/lib/features/signals.rs b/src/uucore/src/lib/features/signals.rs index 2e6069cb7..3c52a9158 100644 --- a/src/uucore/src/lib/features/signals.rs +++ b/src/uucore/src/lib/features/signals.rs @@ -349,6 +349,13 @@ pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { .map(|s| s.value) } +pub fn signal_name_by_value(signal_value: usize) -> Option<&'static str> { + ALL_SIGNALS + .iter() + .find(|signal| signal.value == signal_value) + .map(|signal| signal.name) +} + #[inline(always)] pub fn is_signal(num: usize) -> bool { // Named signals start at 1 @@ -358,7 +365,7 @@ pub fn is_signal(num: usize) -> bool { #[test] fn signals_all_contiguous() { for (i, signal) in ALL_SIGNALS.iter().enumerate() { - assert_eq!(signal.value, i + 1); + assert_eq!(signal.value, i); } } @@ -396,3 +403,10 @@ fn signal_by_long_name() { ); } } + +#[test] +fn name() { + for signal in &ALL_SIGNALS { + assert_eq!(signal_name_by_value(signal.value), Some(signal.name)); + } +} From 8e0ed2d20e03b56a7ade4f41ff3e1ab71bcb5e41 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 10 Jun 2021 18:34:05 +0200 Subject: [PATCH 0982/1135] timeout: support --verbose --- src/uu/timeout/src/timeout.rs | 24 +++++++++++++++++++++++- tests/by-util/test_timeout.rs | 14 ++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index 3a35c351f..3c82c4be2 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -17,7 +17,7 @@ use std::io::ErrorKind; use std::process::{Command, Stdio}; use std::time::Duration; use uucore::process::ChildExt; -use uucore::signals::signal_by_name_or_value; +use uucore::signals::{signal_by_name_or_value, signal_name_by_value}; use uucore::InvalidEncodingHandling; static ABOUT: &str = "Start COMMAND, and kill it if still running after DURATION."; @@ -33,6 +33,7 @@ pub mod options { pub static KILL_AFTER: &str = "kill-after"; pub static SIGNAL: &str = "signal"; pub static PRESERVE_STATUS: &str = "preserve-status"; + pub static VERBOSE: &str = "verbose"; // Positional args. pub static DURATION: &str = "duration"; @@ -45,6 +46,7 @@ struct Config { signal: usize, duration: Duration, preserve_status: bool, + verbose: bool, command: Vec, } @@ -74,6 +76,7 @@ impl Config { let preserve_status: bool = options.is_present(options::PRESERVE_STATUS); let foreground = options.is_present(options::FOREGROUND); + let verbose = options.is_present(options::VERBOSE); let command = options .values_of(options::COMMAND) @@ -88,6 +91,7 @@ impl Config { duration, preserve_status, command, + verbose, } } } @@ -124,6 +128,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("specify the signal to be sent on timeout; SIGNAL may be a name like 'HUP' or a number; see 'kill -l' for a list of signals") .takes_value(true) ) + .arg( + Arg::with_name(options::VERBOSE) + .short("v") + .long(options::VERBOSE) + .help("diagnose to stderr any signal sent upon timeout") + ) .arg( Arg::with_name(options::DURATION) .index(1) @@ -147,6 +157,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { config.kill_after, config.foreground, config.preserve_status, + config.verbose, ) } @@ -159,6 +170,7 @@ fn timeout( kill_after: Duration, foreground: bool, preserve_status: bool, + verbose: bool, ) -> i32 { if !foreground { unsafe { libc::setpgid(0, 0) }; @@ -185,6 +197,13 @@ fn timeout( match process.wait_or_timeout(duration) { Ok(Some(status)) => status.code().unwrap_or_else(|| status.signal().unwrap()), Ok(None) => { + if verbose { + show_error!( + "sending signal {} to command '{}'", + signal_name_by_value(signal).unwrap(), + cmd[0] + ); + } return_if_err!(ERR_EXIT_STATUS, process.send_signal(signal)); match process.wait_or_timeout(kill_after) { Ok(Some(status)) => { @@ -199,6 +218,9 @@ fn timeout( // XXX: this may not be right return 124; } + if verbose { + show_error!("sending signal KILL to command '{}'", cmd[0]); + } return_if_err!( ERR_EXIT_STATUS, process diff --git a/tests/by-util/test_timeout.rs b/tests/by-util/test_timeout.rs index 2346a17aa..4d2451c7e 100644 --- a/tests/by-util/test_timeout.rs +++ b/tests/by-util/test_timeout.rs @@ -17,3 +17,17 @@ fn test_command_with_args() { .succeeds() .stdout_only("abcd"); } + +#[test] +fn test_verbose() { + for &verbose_flag in &["-v", "--verbose"] { + new_ucmd!() + .args(&[verbose_flag, ".1", "sleep", "10"]) + .fails() + .stderr_only("timeout: sending signal TERM to command 'sleep'"); + new_ucmd!() + .args(&[verbose_flag, "-s0", "-k.1", ".1", "sleep", "10"]) + .fails() + .stderr_only("timeout: sending signal EXIT to command 'sleep'\ntimeout: sending signal KILL to command 'sleep'"); + } +} From 0f9bc8e9746809e1fe9b59e656e62f395e347610 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 10 Jun 2021 18:51:41 +0200 Subject: [PATCH 0983/1135] timeout: disable timeout if it is set to zero --- src/uu/timeout/src/timeout.rs | 4 ---- src/uucore/src/lib/features/process.rs | 6 ++++++ tests/by-util/test_timeout.rs | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index 3c82c4be2..b671d9d3e 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -214,10 +214,6 @@ fn timeout( } } Ok(None) => { - if kill_after == Duration::new(0, 0) { - // XXX: this may not be right - return 124; - } if verbose { show_error!("sending signal KILL to command '{}'", cmd[0]); } diff --git a/src/uucore/src/lib/features/process.rs b/src/uucore/src/lib/features/process.rs index 975123cf7..cda41bb4f 100644 --- a/src/uucore/src/lib/features/process.rs +++ b/src/uucore/src/lib/features/process.rs @@ -93,6 +93,7 @@ pub trait ChildExt { fn send_signal(&mut self, signal: usize) -> io::Result<()>; /// Wait for a process to finish or return after the specified duration. + /// A `timeout` of zero disables the timeout. fn wait_or_timeout(&mut self, timeout: Duration) -> io::Result>; } @@ -106,6 +107,11 @@ impl ChildExt for Child { } fn wait_or_timeout(&mut self, timeout: Duration) -> io::Result> { + if timeout == Duration::from_micros(0) { + return self + .wait() + .map(|status| Some(ExitStatus::from_std_status(status))); + } // .try_wait() doesn't drop stdin, so we do it manually drop(self.stdin.take()); diff --git a/tests/by-util/test_timeout.rs b/tests/by-util/test_timeout.rs index 4d2451c7e..9be29065a 100644 --- a/tests/by-util/test_timeout.rs +++ b/tests/by-util/test_timeout.rs @@ -31,3 +31,17 @@ fn test_verbose() { .stderr_only("timeout: sending signal EXIT to command 'sleep'\ntimeout: sending signal KILL to command 'sleep'"); } } + +#[test] +fn test_zero_timeout() { + new_ucmd!() + .args(&["-v", "0", "sleep", ".1"]) + .succeeds() + .no_stderr() + .no_stdout(); + new_ucmd!() + .args(&["-v", "0", "-s0", "-k0", "sleep", ".1"]) + .succeeds() + .no_stderr() + .no_stdout(); +} From b4efd5a749592758bf0d813f6bd2668b813a1e66 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 10 Jun 2021 20:03:33 +0200 Subject: [PATCH 0984/1135] timeout: disable pre-existing SIGCHLD handlers Needed to make a GNU test pass --- Cargo.lock | 3 +++ src/uu/timeout/Cargo.toml | 1 + src/uu/timeout/src/timeout.rs | 14 +++++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index c2c3a6242..6e9c22049 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "Inflector" version = "0.11.4" @@ -2606,6 +2608,7 @@ version = "0.0.6" dependencies = [ "clap", "libc", + "nix 0.20.0", "uucore", "uucore_procs", ] diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index d16559858..a09342c0a 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -17,6 +17,7 @@ path = "src/timeout.rs" [dependencies] clap = "2.33" libc = "0.2.42" +nix = "0.20.0" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index b671d9d3e..eabf0192a 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -5,7 +5,7 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// spell-checker:ignore (ToDO) tstr sigstr cmdname setpgid +// spell-checker:ignore (ToDO) tstr sigstr cmdname setpgid sigchld #[macro_use] extern crate uucore; @@ -161,6 +161,17 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) } +/// Remove pre-existing SIGCHLD handlers that would make waiting for the child's exit code fail. +fn unblock_sigchld() { + unsafe { + nix::sys::signal::signal( + nix::sys::signal::Signal::SIGCHLD, + nix::sys::signal::SigHandler::SigDfl, + ) + .unwrap(); + } +} + /// TODO: Improve exit codes, and make them consistent with the GNU Coreutils exit codes. fn timeout( @@ -194,6 +205,7 @@ fn timeout( } } }; + unblock_sigchld(); match process.wait_or_timeout(duration) { Ok(Some(status)) => status.code().unwrap_or_else(|| status.signal().unwrap()), Ok(None) => { From 0a1dcc27bb4e1ac0c1b4116d5059c81b9c5df884 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 04:29:56 +0900 Subject: [PATCH 0985/1135] prevent utf8 iteration for ascii str from shred (#2389) --- src/uu/shred/src/shred.rs | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 964e68a9e..177143811 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -24,7 +24,7 @@ extern crate uucore; static NAME: &str = "shred"; const BLOCK_SIZE: usize = 512; -const NAME_CHARSET: &str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_."; +const NAME_CHARSET: &[u8] = b"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_."; // Patterns as shown in the GNU coreutils shred implementation const PATTERNS: [&[u8]; 22] = [ @@ -89,7 +89,7 @@ impl Iterator for FilenameGenerator { // Make the return value, then increment let mut ret = String::new(); for i in name_charset_indices.iter() { - let c: char = NAME_CHARSET.chars().nth(*i).unwrap(); + let c = char::from(NAME_CHARSET[*i]); ret.push(c); } @@ -163,16 +163,14 @@ impl<'a> BytesGenerator<'a> { return None; } - let this_block_size = { - if !self.exact { + let this_block_size = if !self.exact { + self.block_size + } else { + let bytes_left = self.total_bytes - self.bytes_generated.get(); + if bytes_left >= self.block_size as u64 { self.block_size } else { - let bytes_left = self.total_bytes - self.bytes_generated.get(); - if bytes_left >= self.block_size as u64 { - self.block_size - } else { - (bytes_left % self.block_size as u64) as usize - } + (bytes_left % self.block_size as u64) as usize } }; @@ -184,12 +182,10 @@ impl<'a> BytesGenerator<'a> { rng.fill(bytes); } PassType::Pattern(pattern) => { - let skip = { - if self.bytes_generated.get() == 0 { - 0 - } else { - (pattern.len() as u64 % self.bytes_generated.get()) as usize - } + let skip = if self.bytes_generated.get() == 0 { + 0 + } else { + (pattern.len() as u64 % self.bytes_generated.get()) as usize }; // Copy the pattern in chunks rather than simply one byte at a time From 3347dacfc825fda8e6ce43378f6098847744b259 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Thu, 10 Jun 2021 22:46:17 +0300 Subject: [PATCH 0986/1135] chroot: refactor undocumented features (#2365) --- src/uu/chroot/src/chroot.rs | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/uu/chroot/src/chroot.rs b/src/uu/chroot/src/chroot.rs index 8e23d8227..86d4a4900 100644 --- a/src/uu/chroot/src/chroot.rs +++ b/src/uu/chroot/src/chroot.rs @@ -28,6 +28,7 @@ mod options { pub const GROUP: &str = "group"; pub const GROUPS: &str = "groups"; pub const USERSPEC: &str = "userspec"; + pub const COMMAND: &str = "command"; } pub fn uumain(args: impl uucore::Args) -> i32 { @@ -39,7 +40,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .version(crate_version!()) .about(ABOUT) .usage(SYNTAX) - .arg(Arg::with_name(options::NEWROOT).hidden(true).required(true)) + .arg( + Arg::with_name(options::NEWROOT) + .hidden(true) + .required(true) + .index(1), + ) .arg( Arg::with_name(options::USER) .short("u") @@ -71,6 +77,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) .value_name("USER:GROUP"), ) + .arg( + Arg::with_name(options::COMMAND) + .hidden(true) + .multiple(true) + .index(2), + ) .get_matches_from(args); let default_shell: &'static str = "/bin/sh"; @@ -94,7 +106,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); } - let command: Vec<&str> = match matches.args.len() { + let commands = match matches.values_of(options::COMMAND) { + Some(v) => v.collect(), + None => vec![], + }; + + // TODO: refactor the args and command matching + // See: https://github.com/uutils/coreutils/pull/2365#discussion_r647849967 + let command: Vec<&str> = match commands.len() { 1 => { let shell: &str = match user_shell { Err(_) => default_shell, @@ -102,14 +121,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; vec![shell, default_option] } - _ => { - let mut vector: Vec<&str> = Vec::new(); - for (&k, v) in matches.args.iter() { - vector.push(k); - vector.push(v.vals[0].to_str().unwrap()); - } - vector - } + _ => commands, }; set_context(newroot, &matches); From cff75f242afa013f58f98b1bac32f9f2a59f831e Mon Sep 17 00:00:00 2001 From: Walter Scheper Date: Wed, 19 May 2021 22:38:51 -0400 Subject: [PATCH 0987/1135] chgrp: replace getopts with clap (#2118) --- Cargo.lock | 1 + src/uu/chgrp/Cargo.toml | 1 + src/uu/chgrp/src/chgrp.rs | 261 +++++++++++++++++++-------- src/uucore/src/lib/features/perms.rs | 2 +- tests/by-util/test_chgrp.rs | 76 +++++++- tests/fixtures/chgrp/file1 | 1 + tests/fixtures/chgrp/file2 | 1 + tests/fixtures/chgrp/file3 | 1 + tests/fixtures/chgrp/ref_file | 1 + 9 files changed, 266 insertions(+), 79 deletions(-) create mode 100644 tests/fixtures/chgrp/file1 create mode 100644 tests/fixtures/chgrp/file2 create mode 100644 tests/fixtures/chgrp/file3 create mode 100644 tests/fixtures/chgrp/ref_file diff --git a/Cargo.lock b/Cargo.lock index 17fa9e2b7..9f4ed26b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1772,6 +1772,7 @@ dependencies = [ name = "uu_chgrp" version = "0.0.6" dependencies = [ + "clap", "uucore", "uucore_procs", "walkdir", diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index 9424ad35e..0e43f7c02 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/chgrp.rs" [dependencies] +clap = "2.33" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/chgrp/src/chgrp.rs b/src/uu/chgrp/src/chgrp.rs index f6afc2805..c0dc2daf3 100644 --- a/src/uu/chgrp/src/chgrp.rs +++ b/src/uu/chgrp/src/chgrp.rs @@ -14,6 +14,8 @@ use uucore::fs::resolve_relative_path; use uucore::libc::gid_t; use uucore::perms::{wrap_chgrp, Verbosity}; +use clap::{App, Arg}; + extern crate walkdir; use walkdir::WalkDir; @@ -24,76 +26,194 @@ use std::os::unix::fs::MetadataExt; use std::path::Path; use uucore::InvalidEncodingHandling; -static SYNTAX: &str = - "chgrp [OPTION]... GROUP FILE...\n or : chgrp [OPTION]... --reference=RFILE FILE..."; -static SUMMARY: &str = "Change the group of each FILE to GROUP."; +static ABOUT: &str = "Change the group of each FILE to GROUP."; +static VERSION: &str = env!("CARGO_PKG_VERSION"); + +pub mod options { + pub mod verbosity { + pub static CHANGES: &str = "changes"; + pub static QUIET: &str = "quiet"; + pub static SILENT: &str = "silent"; + pub static VERBOSE: &str = "verbose"; + } + pub mod preserve_root { + pub static PRESERVE: &str = "preserve-root"; + pub static NO_PRESERVE: &str = "no-preserve-root"; + } + pub mod dereference { + pub static DEREFERENCE: &str = "dereference"; + pub static NO_DEREFERENCE: &str = "no-dereference"; + } + pub static RECURSIVE: &str = "recursive"; + pub mod traverse { + pub static TRAVERSE: &str = "H"; + pub static NO_TRAVERSE: &str = "P"; + pub static EVERY: &str = "L"; + } + pub static REFERENCE: &str = "reference"; + pub static ARG_GROUP: &str = "GROUP"; + pub static ARG_FILES: &str = "FILE"; +} const FTS_COMFOLLOW: u8 = 1; const FTS_PHYSICAL: u8 = 1 << 1; const FTS_LOGICAL: u8 = 1 << 2; +fn get_usage() -> String { + format!( + "{0} [OPTION]... GROUP FILE...\n {0} [OPTION]... --reference=RFILE FILE...", + executable!() + ) +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); - let mut opts = app!(SYNTAX, SUMMARY, ""); - opts.optflag("c", - "changes", - "like verbose but report only when a change is made") - .optflag("f", "silent", "") - .optflag("", "quiet", "suppress most error messages") - .optflag("v", - "verbose", - "output a diagnostic for every file processed") - .optflag("", "dereference", "affect the referent of each symbolic link (this is the default), rather than the symbolic link itself") - .optflag("h", "no-dereference", "affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)") - .optflag("", - "no-preserve-root", - "do not treat '/' specially (the default)") - .optflag("", "preserve-root", "fail to operate recursively on '/'") - .optopt("", - "reference", - "use RFILE's owner and group rather than specifying OWNER:GROUP values", - "RFILE") - .optflag("R", - "recursive", - "operate on files and directories recursively") - .optflag("H", - "", - "if a command line argument is a symbolic link to a directory, traverse it") - .optflag("L", - "", - "traverse every symbolic link to a directory encountered") - .optflag("P", "", "do not traverse any symbolic links (default)"); + let usage = get_usage(); - let mut bit_flag = FTS_PHYSICAL; - let mut preserve_root = false; - let mut derefer = -1; - let flags: &[char] = &['H', 'L', 'P']; - for opt in &args { - match opt.as_str() { - // If more than one is specified, only the final one takes effect. - s if s.contains(flags) => { - if let Some(idx) = s.rfind(flags) { - match s.chars().nth(idx).unwrap() { - 'H' => bit_flag = FTS_COMFOLLOW | FTS_PHYSICAL, - 'L' => bit_flag = FTS_LOGICAL, - 'P' => bit_flag = FTS_PHYSICAL, - _ => (), - } - } - } - "--no-preserve-root" => preserve_root = false, - "--preserve-root" => preserve_root = true, - "--dereference" => derefer = 1, - "--no-dereference" => derefer = 0, - _ => (), + let mut app = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(options::verbosity::CHANGES) + .short("c") + .long(options::verbosity::CHANGES) + .help("like verbose but report only when a change is made"), + ) + .arg( + Arg::with_name(options::verbosity::SILENT) + .short("f") + .long(options::verbosity::SILENT), + ) + .arg( + Arg::with_name(options::verbosity::QUIET) + .long(options::verbosity::QUIET) + .help("suppress most error messages"), + ) + .arg( + Arg::with_name(options::verbosity::VERBOSE) + .short("v") + .long(options::verbosity::VERBOSE) + .help("output a diagnostic for every file processed"), + ) + .arg( + Arg::with_name(options::dereference::DEREFERENCE) + .long(options::dereference::DEREFERENCE), + ) + .arg( + Arg::with_name(options::dereference::NO_DEREFERENCE) + .short("h") + .long(options::dereference::NO_DEREFERENCE) + .help( + "affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)", + ), + ) + .arg( + Arg::with_name(options::preserve_root::PRESERVE) + .long(options::preserve_root::PRESERVE) + .help("fail to operate recursively on '/'"), + ) + .arg( + Arg::with_name(options::preserve_root::NO_PRESERVE) + .long(options::preserve_root::NO_PRESERVE) + .help("do not treat '/' specially (the default)"), + ) + .arg( + Arg::with_name(options::REFERENCE) + .long(options::REFERENCE) + .value_name("RFILE") + .help("use RFILE's group rather than specifying GROUP values") + .takes_value(true) + .multiple(false), + ) + .arg( + Arg::with_name(options::RECURSIVE) + .short("R") + .long(options::RECURSIVE) + .help("operate on files and directories recursively"), + ) + .arg( + Arg::with_name(options::traverse::TRAVERSE) + .short(options::traverse::TRAVERSE) + .help("if a command line argument is a symbolic link to a directory, traverse it"), + ) + .arg( + Arg::with_name(options::traverse::NO_TRAVERSE) + .short(options::traverse::NO_TRAVERSE) + .help("do not traverse any symbolic links (default)") + .overrides_with_all(&[options::traverse::TRAVERSE, options::traverse::EVERY]), + ) + .arg( + Arg::with_name(options::traverse::EVERY) + .short(options::traverse::EVERY) + .help("traverse every symbolic link to a directory encountered"), + ); + + // we change the positional args based on whether + // --reference was used. + let mut reference = false; + let mut help = false; + // stop processing options on -- + for arg in args.iter().take_while(|s| *s != "--") { + if arg.starts_with("--reference=") || arg == "--reference" { + reference = true; + } else if arg == "--help" { + // we stop processing once we see --help, + // as it doesn't matter if we've seen reference or not + help = true; + break; } } - let matches = opts.parse(args); - let recursive = matches.opt_present("recursive"); + if help || !reference { + // add both positional arguments + app = app.arg( + Arg::with_name(options::ARG_GROUP) + .value_name(options::ARG_GROUP) + .required(true) + .takes_value(true) + .multiple(false), + ) + } + app = app.arg( + Arg::with_name(options::ARG_FILES) + .value_name(options::ARG_FILES) + .multiple(true) + .takes_value(true) + .required(true) + .min_values(1), + ); + + let matches = app.get_matches_from(args); + + /* Get the list of files */ + let files: Vec = matches + .values_of(options::ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + + let preserve_root = matches.is_present(options::preserve_root::PRESERVE); + + let mut derefer = if matches.is_present(options::dereference::DEREFERENCE) { + 1 + } else if matches.is_present(options::dereference::NO_DEREFERENCE) { + 0 + } else { + -1 + }; + + let mut bit_flag = if matches.is_present(options::traverse::TRAVERSE) { + FTS_COMFOLLOW | FTS_PHYSICAL + } else if matches.is_present(options::traverse::EVERY) { + FTS_LOGICAL + } else { + FTS_PHYSICAL + }; + + let recursive = matches.is_present(options::RECURSIVE); if recursive { if bit_flag == FTS_PHYSICAL { if derefer == 1 { @@ -106,27 +226,20 @@ pub fn uumain(args: impl uucore::Args) -> i32 { bit_flag = FTS_PHYSICAL; } - let verbosity = if matches.opt_present("changes") { + let verbosity = if matches.is_present(options::verbosity::CHANGES) { Verbosity::Changes - } else if matches.opt_present("silent") || matches.opt_present("quiet") { + } else if matches.is_present(options::verbosity::SILENT) + || matches.is_present(options::verbosity::QUIET) + { Verbosity::Silent - } else if matches.opt_present("verbose") { + } else if matches.is_present(options::verbosity::VERBOSE) { Verbosity::Verbose } else { Verbosity::Normal }; - if matches.free.is_empty() { - show_usage_error!("missing operand"); - return 1; - } else if matches.free.len() < 2 && !matches.opt_present("reference") { - show_usage_error!("missing operand after ‘{}’", matches.free[0]); - return 1; - } - - let dest_gid: gid_t; - let mut files; - if let Some(file) = matches.opt_str("reference") { + let dest_gid: u32; + if let Some(file) = matches.value_of(options::REFERENCE) { match fs::metadata(&file) { Ok(meta) => { dest_gid = meta.gid(); @@ -136,19 +249,17 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return 1; } } - files = matches.free; } else { - match entries::grp2gid(&matches.free[0]) { + let group = matches.value_of(options::ARG_GROUP).unwrap_or_default(); + match entries::grp2gid(&group) { Ok(g) => { dest_gid = g; } _ => { - show_error!("invalid group: {}", matches.free[0].as_str()); + show_error!("invalid group: {}", group); return 1; } } - files = matches.free; - files.remove(0); } let executor = Chgrper { diff --git a/src/uucore/src/lib/features/perms.rs b/src/uucore/src/lib/features/perms.rs index eb6cca102..89c30b53b 100644 --- a/src/uucore/src/lib/features/perms.rs +++ b/src/uucore/src/lib/features/perms.rs @@ -92,7 +92,7 @@ pub fn wrap_chgrp>( out = format!( "group of '{}' retained as {}", path.display(), - entries::gid2grp(dest_gid).unwrap() + entries::gid2grp(dest_gid).unwrap_or_default() ); } } diff --git a/tests/by-util/test_chgrp.rs b/tests/by-util/test_chgrp.rs index 45380b80b..d886d674b 100644 --- a/tests/by-util/test_chgrp.rs +++ b/tests/by-util/test_chgrp.rs @@ -10,6 +10,33 @@ fn test_invalid_option() { static DIR: &str = "/tmp"; +// we should always get both arguments, regardless of whether --refernce was used +#[test] +fn test_help() { + new_ucmd!() + .arg("--help") + .succeeds() + .stdout_contains("ARGS:\n \n ... "); +} + +#[test] +fn test_help_ref() { + new_ucmd!() + .arg("--help") + .arg("--reference=ref_file") + .succeeds() + .stdout_contains("ARGS:\n \n ... "); +} + +#[test] +fn test_ref_help() { + new_ucmd!() + .arg("--reference=ref_file") + .arg("--help") + .succeeds() + .stdout_contains("ARGS:\n \n ... "); +} + #[test] fn test_invalid_group() { new_ucmd!() @@ -121,9 +148,52 @@ fn test_reference() { fn test_reference() { new_ucmd!() .arg("-v") - .arg("--reference=/etc/passwd") + .arg("--reference=ref_file") .arg("/etc") - .succeeds(); + .fails() + // group name can differ, so just check the first part of the message + .stderr_contains("chgrp: changing group of '/etc': Operation not permitted (os error 1)\nfailed to change group of '/etc' from "); +} + +#[test] +#[cfg(any(target_os = "linux", target_vendor = "apple"))] +fn test_reference_multi_no_equal() { + new_ucmd!() + .arg("-v") + .arg("--reference") + .arg("ref_file") + .arg("file1") + .arg("file2") + .succeeds() + .stderr_contains("chgrp: group of 'file1' retained as ") + .stderr_contains("\nchgrp: group of 'file2' retained as "); +} + +#[test] +#[cfg(any(target_os = "linux", target_vendor = "apple"))] +fn test_reference_last() { + new_ucmd!() + .arg("-v") + .arg("file1") + .arg("file2") + .arg("file3") + .arg("--reference") + .arg("ref_file") + .succeeds() + .stderr_contains("chgrp: group of 'file1' retained as ") + .stderr_contains("\nchgrp: group of 'file2' retained as ") + .stderr_contains("\nchgrp: group of 'file3' retained as "); +} + +#[test] +fn test_missing_files() { + new_ucmd!() + .arg("-v") + .arg("groupname") + .fails() + .stderr_contains( + "error: The following required arguments were not provided:\n ...\n", + ); } #[test] @@ -135,7 +205,7 @@ fn test_big_p() { .arg("bin") .arg("/proc/self/cwd") .fails() - .stderr_is( + .stderr_contains( "chgrp: changing group of '/proc/self/cwd': Operation not permitted (os error 1)\n", ); } diff --git a/tests/fixtures/chgrp/file1 b/tests/fixtures/chgrp/file1 new file mode 100644 index 000000000..73b6f48ab --- /dev/null +++ b/tests/fixtures/chgrp/file1 @@ -0,0 +1 @@ +target file 1 diff --git a/tests/fixtures/chgrp/file2 b/tests/fixtures/chgrp/file2 new file mode 100644 index 000000000..7ecd32965 --- /dev/null +++ b/tests/fixtures/chgrp/file2 @@ -0,0 +1 @@ +target file 2 diff --git a/tests/fixtures/chgrp/file3 b/tests/fixtures/chgrp/file3 new file mode 100644 index 000000000..73d293aba --- /dev/null +++ b/tests/fixtures/chgrp/file3 @@ -0,0 +1 @@ +target file 3 diff --git a/tests/fixtures/chgrp/ref_file b/tests/fixtures/chgrp/ref_file new file mode 100644 index 000000000..aba32d56e --- /dev/null +++ b/tests/fixtures/chgrp/ref_file @@ -0,0 +1 @@ +Reference file From 46981a69f9ea29d631a5182e4f77fc7218b186a2 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 11 Jun 2021 07:33:11 +0200 Subject: [PATCH 0988/1135] util: fix path (#2396) suggest to clone into the path that `util/run-gnu-test.sh` will be using --- util/build-gnu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 44ecd2044..798a33456 100644 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -5,12 +5,12 @@ set -e if test ! -d ../gnu; then echo "Could not find ../gnu" - echo "git clone git@github.com:coreutils/coreutils.git ../gnu" + echo "git clone git@github.com:coreutils/coreutils.git gnu" exit 1 fi if test ! -d ../gnulib; then echo "Could not find ../gnulib" - echo "git clone git@github.com:coreutils/gnulib.git ../gnulib" + echo "git clone git@github.com:coreutils/gnulib.git gnulib" exit 1 fi From ae03b09c6de85df72dad1ae3415b67edc0fc91c7 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Thu, 10 Jun 2021 11:01:44 +0200 Subject: [PATCH 0989/1135] tests/util: add CmdResult::new() --- tests/common/util.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/common/util.rs b/tests/common/util.rs index 11425e9b8..922d2ba36 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -69,6 +69,22 @@ pub struct CmdResult { } impl CmdResult { + pub fn new( + tmpd: Option>, + code: Option, + success: bool, + stdout: &[u8], + stderr: &[u8], + ) -> CmdResult { + CmdResult { + tmpd, + code, + success, + stdout: stdout.to_vec(), + stderr: stderr.to_vec(), + } + } + /// Returns a reference to the program's standard output as a slice of bytes pub fn stdout(&self) -> &[u8] { &self.stdout From 0c364e635bf44330e728ef957f72d586d951c5fd Mon Sep 17 00:00:00 2001 From: Syukron Rifail M Date: Sun, 6 Jun 2021 20:34:40 +0700 Subject: [PATCH 0990/1135] du: add --one-file-system --- src/uu/du/src/du.rs | 24 ++++++++++++++++++------ tests/by-util/test_du.rs | 17 +++++++++++++++++ 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index bf1272a44..a1c2182c2 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -57,6 +57,7 @@ mod options { pub const SI: &str = "si"; pub const TIME: &str = "time"; pub const TIME_STYLE: &str = "time-style"; + pub const ONE_FILE_SYSTEM: &str = "one-file-system"; pub const FILE: &str = "FILE"; } @@ -81,6 +82,7 @@ struct Options { max_depth: Option, total: bool, separate_dirs: bool, + one_file_system: bool, } #[derive(PartialEq, Eq, Hash, Clone, Copy)] @@ -317,6 +319,15 @@ fn du( Ok(entry) => match Stat::new(entry.path()) { Ok(this_stat) => { if this_stat.is_dir { + if options.one_file_system { + if let (Some(this_inode), Some(my_inode)) = + (this_stat.inode, my_stat.inode) + { + if this_inode.dev_id != my_inode.dev_id { + continue; + } + } + } futures.push(du(this_stat, options, depth + 1, inodes)); } else { if let Some(inode) = this_stat.inode { @@ -532,12 +543,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::SI) .help("like -h, but use powers of 1000 not 1024") ) - // .arg( - // Arg::with_name("one-file-system") - // .short("x") - // .long("one-file-system") - // .help("skip directories on different file systems") - // ) + .arg( + Arg::with_name(options::ONE_FILE_SYSTEM) + .short("x") + .long(options::ONE_FILE_SYSTEM) + .help("skip directories on different file systems") + ) // .arg( // Arg::with_name("") // .short("x") @@ -602,6 +613,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { max_depth, total: matches.is_present(options::TOTAL), separate_dirs: matches.is_present(options::SEPARATE_DIRS), + one_file_system: matches.is_present(options::ONE_FILE_SYSTEM), }; let files = match matches.value_of(options::FILE) { diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index 3c177c6bf..231451b95 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -312,3 +312,20 @@ fn _du_no_permission(s: &str) { fn _du_no_permission(s: &str) { assert_eq!(s, "4\tsubdir/links\n"); } + +#[test] +fn test_du_one_file_system() { + let scene = TestScenario::new(util_name!()); + + let result = scene.ucmd().arg("-x").arg(SUB_DIR).succeeds(); + + #[cfg(target_os = "linux")] + { + let result_reference = scene.cmd("du").arg("-x").arg(SUB_DIR).run(); + if result_reference.succeeded() { + assert_eq!(result.stdout_str(), result_reference.stdout_str()); + return; + } + } + _du_basics_subdir(result.stdout_str()); +} From d99385e58520722f32741b3df92c299bd7dd89e3 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 11 Jun 2021 12:00:26 +0200 Subject: [PATCH 0991/1135] id: add more tests for multiple and/or invalid usernames --- tests/by-util/test_id.rs | 210 ++++++++++++++++++++++----------------- 1 file changed, 120 insertions(+), 90 deletions(-) diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index bfed78886..4823cf6d0 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -1,8 +1,6 @@ use crate::common::util::*; // Apparently some CI environments have configuration issues, e.g. with 'whoami' and 'id'. -// If we are running inside the CI and "needle" is in "stderr" skipping this test is -// considered okay. If we are not inside the CI this calls assert!(result.success). // // From the Logs: "Build (ubuntu-18.04, x86_64-unknown-linux-gnu, feat_os_unix, use-cross)" // whoami: cannot find name for user ID 1001 @@ -13,97 +11,99 @@ use crate::common::util::*; // id: "uid=1001(runner) gid=118(docker) groups=118(docker),4(adm),101(systemd-journal)" // whoami: "runner" // -fn skipping_test_is_okay(result: &CmdResult, needle: &str) -> bool { - if !result.succeeded() { - println!("result.stdout = {}", result.stdout_str()); - println!("result.stderr = {}", result.stderr_str()); - if is_ci() && result.stderr_str().contains(needle) { - println!("test skipped:"); - return true; - } else { - result.success(); - } - } - false -} -fn return_whoami_username() -> String { - let scene = TestScenario::new("whoami"); - let result = scene.cmd("whoami").run(); - if skipping_test_is_okay(&result, "whoami: cannot find name for user ID") { - println!("test skipped:"); - return String::from(""); - } - - result.stdout_str().trim().to_string() +fn whoami() -> String { + std::env::var("USER").unwrap_or_else(|e| { + println!("warning: {}, using \"nobody\" instead", e); + "nobody".to_string() + }) } #[test] -fn test_id() { - let scene = TestScenario::new(util_name!()); +#[cfg(unix)] +fn test_id_no_argument() { + let result = new_ucmd!().run(); + let expected_result = expected_result(&[]); + let mut exp_stdout = expected_result.stdout_str().to_string(); - let result = scene.ucmd().arg("-u").succeeds(); - let uid = result.stdout_str().trim(); - - let result = scene.ucmd().run(); - if skipping_test_is_okay(&result, "Could not find uid") { - return; - } - - // Verify that the id found by --user/-u exists in the list - result.stdout_contains(uid); -} - -#[test] -fn test_id_from_name() { - let username = return_whoami_username(); - if username.is_empty() { - return; - } - - let scene = TestScenario::new(util_name!()); - let result = scene.ucmd().arg(&username).run(); - if skipping_test_is_okay(&result, "Could not find uid") { - return; - } - - let uid = result.stdout_str().trim(); - - let result = scene.ucmd().run(); - if skipping_test_is_okay(&result, "Could not find uid") { - return; - } + // uu_stid does not support selinux context. Remove 'context' part from exp_stdout: + let context_offset = expected_result + .stdout_str() + .find(" context") + .unwrap_or(exp_stdout.len()); + exp_stdout.replace_range(context_offset.., "\n"); result - // Verify that the id found by --user/-u exists in the list - .stdout_contains(uid) - // Verify that the username found by whoami exists in the list - .stdout_contains(username); + .stdout_is(exp_stdout) + .stderr_is(expected_result.stderr_str()) + .code_is(expected_result.code()); } #[test] -fn test_id_name_from_id() { - let result = new_ucmd!().arg("-nu").run(); - - let username_id = result.stdout_str().trim(); - - let username_whoami = return_whoami_username(); - if username_whoami.is_empty() { - return; - } - - assert_eq!(username_id, username_whoami); +#[cfg(unix)] +fn test_id_single_user() { + let args = &[&whoami()[..]]; + let result = new_ucmd!().args(args).run(); + let expected_result = expected_result(args); + result + .stdout_is(expected_result.stdout_str()) + .stderr_is(expected_result.stderr_str()) + .code_is(expected_result.code()); } #[test] -fn test_id_pretty_print() { - let username = return_whoami_username(); - if username.is_empty() { - return; - } +#[cfg(unix)] +fn test_id_single_invalid_user() { + let args = &["hopefully_non_existing_username"]; + let result = new_ucmd!().args(args).run(); + let expected_result = expected_result(args); + result + .stdout_is(expected_result.stdout_str()) + .stderr_is(expected_result.stderr_str()) + .code_is(expected_result.code()); +} +#[test] +#[cfg(unix)] +fn test_id_name() { let scene = TestScenario::new(util_name!()); - let result = scene.ucmd().arg("-p").run(); + for &opt in &["--user", "--group", "--groups"] { + let args = [opt, "--name"]; + let result = scene.ucmd().args(&args).run(); + let expected_result = expected_result(&args); + result + .stdout_is(expected_result.stdout_str()) + .stderr_is(expected_result.stderr_str()) + .code_is(expected_result.code()); + + if opt == "--user" { + assert_eq!(result.stdout_str().trim_end(), whoami()); + } + } +} + +#[test] +#[cfg(unix)] +fn test_id_real() { + let scene = TestScenario::new(util_name!()); + for &opt in &["--user", "--group", "--groups"] { + let args = [opt, "--real"]; + let result = scene.ucmd().args(&args).run(); + let expected_result = expected_result(&args); + result + .stdout_is(expected_result.stdout_str()) + .stderr_is(expected_result.stderr_str()) + .code_is(expected_result.code()); + } +} + +#[test] +#[cfg(all(unix, not(target_os = "linux")))] +fn test_id_pretty_print() { + // `-p` is BSD only and not supported on GNU's `id` + let username = whoami(); + + let result = new_ucmd!().arg("-p").run(); if result.stdout_str().trim().is_empty() { // this fails only on: "MinRustV (ubuntu-latest, feat_os_unix)" // `rustc 1.40.0 (73528e339 2019-12-16)` @@ -113,20 +113,17 @@ fn test_id_pretty_print() { // stderr = ', tests/common/util.rs:157:13 println!("test skipped:"); return; + } else { + result.success().stdout_contains(username); } - - result.success().stdout_contains(username); } #[test] +#[cfg(all(unix, not(target_os = "linux")))] fn test_id_password_style() { - let username = return_whoami_username(); - if username.is_empty() { - return; - } - - let result = new_ucmd!().arg("-P").succeeds(); - + // `-P` is BSD only and not supported on GNU's `id` + let username = whoami(); + let result = new_ucmd!().arg("-P").arg(&username).succeeds(); assert!(result.stdout_str().starts_with(&username)); } @@ -136,6 +133,39 @@ fn test_id_default_format() { // TODO: These are the same tests like in test_id_zero but without --zero flag. } +#[test] +#[cfg(unix)] +fn test_id_multiple_users() { + // Same typical users that GNU testsuite is using. + let test_users = ["root", "man", "postfix", "sshd", &whoami()]; + + let result = new_ucmd!().args(&test_users).run(); + let expected_result = expected_result(&test_users); + result + .stdout_is(expected_result.stdout_str()) + .stderr_is(expected_result.stderr_str()); +} + +#[test] +#[cfg(unix)] +fn test_id_multiple_invalid_users() { + let test_users = [ + "root", + "hopefully_non_existing_username1", + "man", + "postfix", + "sshd", + "hopefully_non_existing_username2", + &whoami(), + ]; + + let result = new_ucmd!().args(&test_users).run(); + let expected_result = expected_result(&test_users); + result + .stdout_is(expected_result.stdout_str()) + .stderr_is(expected_result.stderr_str()); +} + #[test] #[cfg(unix)] fn test_id_zero() { @@ -155,8 +185,8 @@ fn test_id_zero() { let result = scene.ucmd().args(&args).run(); let expected_result = expected_result(&args); result - .stdout_is_bytes(expected_result.stdout()) - .stderr_is_bytes(expected_result.stderr()); + .stdout_is(expected_result.stdout_str()) + .stderr_is(expected_result.stderr_str()); } } // u/g/G z @@ -166,7 +196,7 @@ fn test_id_zero() { .ucmd() .args(&args) .succeeds() - .stdout_only_bytes(expected_result(&args).stdout()); + .stdout_only(expected_result(&args).stdout_str()); } } } From c5594bc9bc4783932024128f7d407ae47852c4bb Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 14:21:32 +0900 Subject: [PATCH 0992/1135] base32: clean up returning Err --- src/uu/base32/src/base_common.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/uu/base32/src/base_common.rs b/src/uu/base32/src/base_common.rs index ee5fe8675..256b674e2 100644 --- a/src/uu/base32/src/base_common.rs +++ b/src/uu/base32/src/base_common.rs @@ -54,15 +54,13 @@ impl Config { None => None, }; - let cols = match options.value_of(options::WRAP) { - Some(num) => match num.parse::() { - Ok(n) => Some(n), - Err(e) => { - return Err(format!("Invalid wrap size: ‘{}’: {}", num, e)); - } - }, - None => None, - }; + let cols = options + .value_of(options::WRAP) + .map(|num| { + num.parse::() + .map_err(|e| format!("Invalid wrap size: ‘{}’: {}", num, e)) + }) + .transpose()?; Ok(Config { decode: options.is_present(options::DECODE), From a197d35039908b28d0cfea453e911b0e542d35fc Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 14:22:11 +0900 Subject: [PATCH 0993/1135] chown: clean up returning Err --- src/uu/chown/src/chown.rs | 55 +++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index 649300d83..166ad72b8 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -279,36 +279,41 @@ fn parse_spec(spec: &str) -> Result<(Option, Option), String> { let grp_only = args.len() == 2 && args[0].is_empty(); let usr_grp = args.len() == 2 && !args[0].is_empty() && !args[1].is_empty(); - if usr_only { - Ok(( - Some(match Passwd::locate(args[0]) { - Ok(v) => v.uid(), - _ => return Err(format!("invalid user: ‘{}’", spec)), - }), + let r = if usr_only { + ( + Some( + Passwd::locate(args[0]) + .map_err(|_| format!("invalid user: ‘{}’", spec))? + .uid(), + ), None, - )) + ) } else if grp_only { - Ok(( + ( None, - Some(match Group::locate(args[1]) { - Ok(v) => v.gid(), - _ => return Err(format!("invalid group: ‘{}’", spec)), - }), - )) + Some( + Group::locate(args[1]) + .map_err(|_| format!("invalid group: ‘{}’", spec))? + .gid(), + ), + ) } else if usr_grp { - Ok(( - Some(match Passwd::locate(args[0]) { - Ok(v) => v.uid(), - _ => return Err(format!("invalid user: ‘{}’", spec)), - }), - Some(match Group::locate(args[1]) { - Ok(v) => v.gid(), - _ => return Err(format!("invalid group: ‘{}’", spec)), - }), - )) + ( + Some( + Passwd::locate(args[0]) + .map_err(|_| format!("invalid user: ‘{}’", spec))? + .uid(), + ), + Some( + Group::locate(args[1]) + .map_err(|_| format!("invalid group: ‘{}’", spec))? + .gid(), + ), + ) } else { - Ok((None, None)) - } + (None, None) + }; + Ok(r) } enum IfFrom { From 526ed7afdcaa8e5654cbf629d8d94bb28d44fd1a Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 14:22:21 +0900 Subject: [PATCH 0994/1135] cksum: clean up returning Err --- src/uu/cksum/src/cksum.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index 49c0536f5..6a812c186 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -160,18 +160,14 @@ fn cksum(fname: &str) -> io::Result<(u32, usize)> { let mut bytes = init_byte_array(); loop { - match rd.read(&mut bytes) { - Ok(num_bytes) => { - if num_bytes == 0 { - return Ok((crc_final(crc, size), size)); - } - for &b in bytes[..num_bytes].iter() { - crc = crc_update(crc, b); - } - size += num_bytes; - } - Err(err) => return Err(err), + let num_bytes = rd.read(&mut bytes)?; + if num_bytes == 0 { + return Ok((crc_final(crc, size), size)); } + for &b in bytes[..num_bytes].iter() { + crc = crc_update(crc, b); + } + size += num_bytes; } } From 7cc17c15c202b0c987ab70fc07619b4fe55aa8ed Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 14:22:32 +0900 Subject: [PATCH 0995/1135] cp: clean up returning Err --- src/uu/cp/src/cp.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index cc0103044..a87e86b98 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -709,27 +709,26 @@ fn parse_path_args(path_args: &[String], options: &Options) -> CopyResult<(Vec { // All path args are sources, and the target dir was // specified separately - (paths, PathBuf::from(target)) + PathBuf::from(target) } None => { // If there was no explicit target-dir, then use the last // path_arg - let target = paths.pop().unwrap(); - (paths, target) + paths.pop().unwrap() } }; if options.strip_trailing_slashes { - for source in sources.iter_mut() { + for source in paths.iter_mut() { *source = source.components().as_path().to_owned() } } - Ok((sources, target)) + Ok((paths, target)) } fn preserve_hardlinks( @@ -1271,15 +1270,15 @@ fn copy_on_write_linux(source: &Path, dest: &Path, mode: ReflinkMode) -> CopyRes ReflinkMode::Always => unsafe { let result = ficlone(dst_file.as_raw_fd(), src_file.as_raw_fd() as *const i32); if result != 0 { - return Err(format!( + Err(format!( "failed to clone {:?} from {:?}: {}", source, dest, std::io::Error::last_os_error() ) - .into()); + .into()) } else { - return Ok(()); + Ok(()) } }, ReflinkMode::Auto => unsafe { @@ -1287,11 +1286,10 @@ fn copy_on_write_linux(source: &Path, dest: &Path, mode: ReflinkMode) -> CopyRes if result != 0 { fs::copy(source, dest).context(&*context_for(source, dest))?; } + Ok(()) }, ReflinkMode::Never => unreachable!(), } - - Ok(()) } /// Copies `source` to `dest` using copy-on-write if possible. From 6736faec4a054630f6a0b093cbe7c1fb44c5211c Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 14:22:44 +0900 Subject: [PATCH 0996/1135] csplit: clean up returning Err --- src/uu/csplit/src/patterns.rs | 16 ++++------------ src/uu/csplit/src/split_name.rs | 14 +++++++------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/uu/csplit/src/patterns.rs b/src/uu/csplit/src/patterns.rs index 5621d18a3..4ab7862ac 100644 --- a/src/uu/csplit/src/patterns.rs +++ b/src/uu/csplit/src/patterns.rs @@ -133,20 +133,12 @@ fn extract_patterns(args: &[String]) -> Result, CsplitError> { Some(m) => m.as_str().parse().unwrap(), }; if let Some(up_to_match) = captures.name("UPTO") { - let pattern = match Regex::new(up_to_match.as_str()) { - Err(_) => { - return Err(CsplitError::InvalidPattern(arg.to_string())); - } - Ok(reg) => reg, - }; + let pattern = Regex::new(up_to_match.as_str()) + .map_err(|_| CsplitError::InvalidPattern(arg.to_string()))?; patterns.push(Pattern::UpToMatch(pattern, offset, execute_ntimes)); } else if let Some(skip_to_match) = captures.name("SKIPTO") { - let pattern = match Regex::new(skip_to_match.as_str()) { - Err(_) => { - return Err(CsplitError::InvalidPattern(arg.to_string())); - } - Ok(reg) => reg, - }; + let pattern = Regex::new(skip_to_match.as_str()) + .map_err(|_| CsplitError::InvalidPattern(arg.to_string()))?; patterns.push(Pattern::SkipToMatch(pattern, offset, execute_ntimes)); } } else if let Ok(line_number) = arg.parse::() { diff --git a/src/uu/csplit/src/split_name.rs b/src/uu/csplit/src/split_name.rs index 6db781e9b..758216414 100644 --- a/src/uu/csplit/src/split_name.rs +++ b/src/uu/csplit/src/split_name.rs @@ -33,13 +33,13 @@ impl SplitName { // get the prefix let prefix = prefix_opt.unwrap_or_else(|| "xx".to_string()); // the width for the split offset - let n_digits = match n_digits_opt { - None => 2, - Some(opt) => match opt.parse::() { - Ok(digits) => digits, - Err(_) => return Err(CsplitError::InvalidNumber(opt)), - }, - }; + let n_digits = n_digits_opt + .map(|opt| { + opt.parse::() + .map_err(|_| CsplitError::InvalidNumber(opt)) + }) + .transpose()? + .unwrap_or(2); // translate the custom format into a function let fn_split_name: Box String> = match format_opt { None => Box::new(move |n: usize| -> String { From f01121f5b7ae678725410724c4e6cef4ebc403a9 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 14:23:14 +0900 Subject: [PATCH 0997/1135] env: clean up returning Err --- src/uu/env/src/env.rs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/uu/env/src/env.rs b/src/uu/env/src/env.rs index e20f047b7..0ea66d7e9 100644 --- a/src/uu/env/src/env.rs +++ b/src/uu/env/src/env.rs @@ -82,13 +82,10 @@ fn load_config_file(opts: &mut Options) -> Result<(), i32> { Ini::load_from_file(file) }; - let conf = match conf { - Ok(config) => config, - Err(error) => { - eprintln!("env: error: \"{}\": {}", file, error); - return Err(1); - } - }; + let conf = conf.map_err(|error| { + eprintln!("env: error: \"{}\": {}", file, error); + 1 + })?; for (_, prop) in &conf { // ignore all INI section lines (treat them as comments) @@ -256,13 +253,10 @@ fn run_env(args: impl uucore::Args) -> Result<(), i32> { // FIXME: this should just use execvp() (no fork()) on Unix-like systems match Command::new(&*prog).args(args).status() { - Ok(exit) => { - if !exit.success() { - return Err(exit.code().unwrap()); - } - } + Ok(exit) if !exit.success() => return Err(exit.code().unwrap()), Err(ref err) if err.kind() == io::ErrorKind::NotFound => return Err(127), Err(_) => return Err(126), + Ok(_) => (), } } else { // no program provided, so just dump all env vars to stdout From bbae78db67cb15dc229826bcb3107714408528ce Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 14:23:24 +0900 Subject: [PATCH 0998/1135] expr: clean up returning Err --- src/uu/expr/src/syntax_tree.rs | 47 +++++++++++++++------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/src/uu/expr/src/syntax_tree.rs b/src/uu/expr/src/syntax_tree.rs index ba477414e..ff49ea57e 100644 --- a/src/uu/expr/src/syntax_tree.rs +++ b/src/uu/expr/src/syntax_tree.rs @@ -160,10 +160,8 @@ impl AstNode { if let AstNode::Node { operands, .. } = self { let mut out = Vec::with_capacity(operands.len()); for operand in operands { - match operand.evaluate() { - Ok(value) => out.push(value), - Err(reason) => return Err(reason), - } + let value = operand.evaluate()?; + out.push(value); } Ok(out) } else { @@ -252,10 +250,8 @@ fn maybe_ast_node( ) -> Result, String> { let mut operands = Vec::with_capacity(arity); for _ in 0..arity { - match ast_from_rpn(rpn) { - Err(reason) => return Err(reason), - Ok(operand) => operands.push(operand), - } + let operand = ast_from_rpn(rpn)?; + operands.push(operand); } operands.reverse(); Ok(AstNode::new_node(token_idx, op_type, operands)) @@ -399,10 +395,12 @@ fn move_till_match_paren( op_stack: &mut TokenStack, ) -> Result<(), String> { loop { - match op_stack.pop() { - None => return Err("syntax error (Mismatched close-parenthesis)".to_string()), - Some((_, Token::ParOpen)) => return Ok(()), - Some(other) => out_stack.push(other), + let op = op_stack + .pop() + .ok_or_else(|| "syntax error (Mismatched close-parenthesis)".to_string())?; + match op { + (_, Token::ParOpen) => return Ok(()), + other => out_stack.push(other), } } } @@ -462,22 +460,17 @@ fn infix_operator_and(values: &[String]) -> String { fn operator_match(values: &[String]) -> Result { assert!(values.len() == 2); - let re = match Regex::with_options(&values[1], RegexOptions::REGEX_OPTION_NONE, Syntax::grep()) - { - Ok(m) => m, - Err(err) => return Err(err.description().to_string()), - }; - if re.captures_len() > 0 { - Ok(match re.captures(&values[0]) { - Some(captures) => captures.at(1).unwrap().to_string(), - None => "".to_string(), - }) + let re = Regex::with_options(&values[1], RegexOptions::REGEX_OPTION_NONE, Syntax::grep()) + .map_err(|err| err.description().to_string())?; + Ok(if re.captures_len() > 0 { + re.captures(&values[0]) + .map(|captures| captures.at(1).unwrap()) + .unwrap_or("") + .to_string() } else { - Ok(match re.find(&values[0]) { - Some((start, end)) => (end - start).to_string(), - None => "0".to_string(), - }) - } + re.find(&values[0]) + .map_or("0".to_string(), |(start, end)| (end - start).to_string()) + }) } fn prefix_operator_length(values: &[String]) -> String { From 27ce4bb0a4773f08fc149df5287efd109bc60ea2 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 14:23:46 +0900 Subject: [PATCH 0999/1135] head: clean up returning Err --- src/uu/head/src/head.rs | 16 ++++------------ src/uu/head/src/parse.rs | 32 ++++++++++++++------------------ 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 28710e1fe..c6d2f98bd 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -176,19 +176,11 @@ impl HeadOptions { options.zeroed = matches.is_present(options::ZERO_NAME); let mode_and_from_end = if let Some(v) = matches.value_of(options::BYTES_NAME) { - match parse_mode(v, Modes::Bytes) { - Ok(v) => v, - Err(err) => { - return Err(format!("invalid number of bytes: {}", err)); - } - } + parse_mode(v, Modes::Bytes) + .map_err(|err| format!("invalid number of bytes: {}", err))? } else if let Some(v) = matches.value_of(options::LINES_NAME) { - match parse_mode(v, Modes::Lines) { - Ok(v) => v, - Err(err) => { - return Err(format!("invalid number of lines: {}", err)); - } - } + parse_mode(v, Modes::Lines) + .map_err(|err| format!("invalid number of lines: {}", err))? } else { (Modes::Lines(10), false) }; diff --git a/src/uu/head/src/parse.rs b/src/uu/head/src/parse.rs index f1c97561d..c04962f1b 100644 --- a/src/uu/head/src/parse.rs +++ b/src/uu/head/src/parse.rs @@ -94,17 +94,15 @@ pub fn parse_obsolete(src: &str) -> Option /// the bool specifies whether to read from the end pub fn parse_num(src: &str) -> Result<(usize, bool), ParseError> { let mut num_start = 0; - let mut chars = src.char_indices(); - let (mut chars, all_but_last) = match chars.next() { - Some((_, c)) => { - if c == '-' { - num_start += 1; - (chars, true) - } else { - (src.char_indices(), false) - } + let (mut chars, all_but_last) = { + let mut chars = src.char_indices(); + let (_, c) = chars.next().ok_or(ParseError::Syntax)?; + if c == '-' { + num_start += 1; + (chars, true) + } else { + (src.char_indices(), false) } - None => return Err(ParseError::Syntax), }; let mut num_end = 0usize; let mut last_char = 0 as char; @@ -120,10 +118,11 @@ pub fn parse_num(src: &str) -> Result<(usize, bool), ParseError> { } let num = if num_count > 0 { - match src[num_start..=num_end].parse::() { - Ok(n) => Some(n), - Err(_) => return Err(ParseError::Overflow), - } + Some( + src[num_start..=num_end] + .parse::() + .map_err(|_| ParseError::Overflow)?, + ) } else { None }; @@ -168,10 +167,7 @@ pub fn parse_num(src: &str) -> Result<(usize, bool), ParseError> { 'y' => base.pow(8), _ => return Err(ParseError::Syntax), }; - let mul = match usize::try_from(mul) { - Ok(n) => n, - Err(_) => return Err(ParseError::Overflow), - }; + let mul = usize::try_from(mul).map_err(|_| ParseError::Overflow)?; match num.unwrap_or(1).checked_mul(mul) { Some(n) => Ok((n, all_but_last)), None => Err(ParseError::Overflow), From d329c7c864691854a7b3b9e6c233ea1718732e87 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 14:23:53 +0900 Subject: [PATCH 1000/1135] install : clean up returning Err --- src/uu/install/src/install.rs | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index bcfe1a396..ad5ea694c 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -299,29 +299,17 @@ fn behavior(matches: &ArgMatches) -> Result { let considering_dir: bool = MainFunction::Directory == main_function; let specified_mode: Option = if matches.is_present(OPT_MODE) { - match matches.value_of(OPT_MODE) { - Some(x) => match mode::parse(x, considering_dir) { - Ok(y) => Some(y), - Err(err) => { - show_error!("Invalid mode string: {}", err); - return Err(1); - } - }, - None => { - return Err(1); - } - } + let x = matches.value_of(OPT_MODE).ok_or(1)?; + Some(mode::parse(x, considering_dir).map_err(|err| { + show_error!("Invalid mode string: {}", err); + 1 + })?) } else { None }; let backup_suffix = if matches.is_present(OPT_SUFFIX) { - match matches.value_of(OPT_SUFFIX) { - Some(x) => x, - None => { - return Err(1); - } - } + matches.value_of(OPT_SUFFIX).ok_or(1)? } else { "~" }; From 3ea18173cb8fbe326504bb92a7855d022e078025 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 14:24:09 +0900 Subject: [PATCH 1001/1135] od: clean up returning Err --- src/uu/od/src/od.rs | 48 +++++++++++++--------------------- src/uu/od/src/parse_formats.rs | 18 +++++-------- src/uu/od/src/partialreader.rs | 7 +++-- 3 files changed, 27 insertions(+), 46 deletions(-) diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 1e7b4533a..642618cac 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -128,36 +128,27 @@ impl OdOptions { } }; - let mut skip_bytes = match matches.value_of(options::SKIP_BYTES) { - None => 0, - Some(s) => match parse_number_of_bytes(s) { - Ok(i) => i, - Err(_) => { - return Err(format!("Invalid argument --skip-bytes={}", s)); - } - }, - }; + let mut skip_bytes = matches + .value_of(options::SKIP_BYTES) + .map(|s| { + parse_number_of_bytes(s).map_err(|_| format!("Invalid argument --skip-bytes={}", s)) + }) + .transpose()? + .unwrap_or(0); let mut label: Option = None; - let input_strings = match parse_inputs(&matches) { - Ok(CommandLineInputs::FileNames(v)) => v, - Ok(CommandLineInputs::FileAndOffset((f, s, l))) => { + let parsed_input = parse_inputs(&matches).map_err(|e| format!("Invalid inputs: {}", e))?; + let input_strings = match parsed_input { + CommandLineInputs::FileNames(v) => v, + CommandLineInputs::FileAndOffset((f, s, l)) => { skip_bytes = s; label = l; vec![f] } - Err(e) => { - return Err(format!("Invalid inputs: {}", e)); - } }; - let formats = match parse_format_flags(&args) { - Ok(f) => f, - Err(e) => { - return Err(e); - } - }; + let formats = parse_format_flags(&args)?; let mut line_bytes = match matches.value_of(options::WIDTH) { None => 16, @@ -174,15 +165,12 @@ impl OdOptions { let output_duplicates = matches.is_present(options::OUTPUT_DUPLICATES); - let read_bytes = match matches.value_of(options::READ_BYTES) { - None => None, - Some(s) => match parse_number_of_bytes(s) { - Ok(i) => Some(i), - Err(_) => { - return Err(format!("Invalid argument --read-bytes={}", s)); - } - }, - }; + let read_bytes = matches + .value_of(options::READ_BYTES) + .map(|s| { + parse_number_of_bytes(s).map_err(|_| format!("Invalid argument --read-bytes={}", s)) + }) + .transpose()?; let radix = match matches.value_of(options::ADDRESS_RADIX) { None => Radix::Octal, diff --git a/src/uu/od/src/parse_formats.rs b/src/uu/od/src/parse_formats.rs index fca908016..f5b150d61 100644 --- a/src/uu/od/src/parse_formats.rs +++ b/src/uu/od/src/parse_formats.rs @@ -108,10 +108,8 @@ pub fn parse_format_flags(args: &[String]) -> Result formats.extend(v.into_iter()), - Err(e) => return Err(e), - } + let v = parse_type_string(arg)?; + formats.extend(v.into_iter()); expect_type_string = false; } else if arg.starts_with("--") { if arg.len() == 2 { @@ -119,10 +117,8 @@ pub fn parse_format_flags(args: &[String]) -> Result Result formats.extend(v.into_iter()), - Err(e) => return Err(e), - } + let v = parse_type_string(&format_spec)?; + formats.extend(v.into_iter()); expect_type_string = false; } } diff --git a/src/uu/od/src/partialreader.rs b/src/uu/od/src/partialreader.rs index ee3588830..f155a7bd2 100644 --- a/src/uu/od/src/partialreader.rs +++ b/src/uu/od/src/partialreader.rs @@ -36,16 +36,15 @@ impl Read for PartialReader { while self.skip > 0 { let skip_count = cmp::min(self.skip, MAX_SKIP_BUFFER); - match self.inner.read(&mut bytes[..skip_count]) { - Ok(0) => { + match self.inner.read(&mut bytes[..skip_count])? { + 0 => { // this is an error as we still have more to skip return Err(io::Error::new( io::ErrorKind::UnexpectedEof, "tried to skip past end of input", )); } - Ok(n) => self.skip -= n, - Err(e) => return Err(e), + n => self.skip -= n, } } } From e45f5404db398ff6beedbb2c7ef297ec13ef9a2b Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 14:24:17 +0900 Subject: [PATCH 1002/1135] nl: fix clippy error --- src/uu/nl/src/nl.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 41750259f..a3181e11f 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -247,7 +247,7 @@ fn nl(reader: &mut BufReader, settings: &Settings) { let mut line_filter: fn(&str, ®ex::Regex) -> bool = pass_regex; for mut l in reader.lines().map(|r| r.unwrap()) { // Sanitize the string. We want to print the newline ourselves. - if l.chars().last() == Some('\n') { + if l.ends_with('\n') { l.pop(); } // Next we iterate through the individual chars to see if this From 7cc4bf6e369c972e27454a0d92450a539e5574cb Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 14:24:52 +0900 Subject: [PATCH 1003/1135] pr: clean up returning Err --- src/uu/pr/src/pr.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index d7b95d215..239a0970f 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -671,8 +671,7 @@ fn build_options( if start_page > end_page { return Err(PrError::EncounteredErrors(format!( "invalid --pages argument '{}:{}'", - start_page, - end_page + start_page, end_page ))); } } @@ -999,8 +998,8 @@ fn mpr(paths: &[String], options: &OutputOptions) -> Result { for (_key, file_line_group) in file_line_groups.into_iter() { for file_line in file_line_group { - if file_line.line_content.is_err() { - return Err(file_line.line_content.unwrap_err().into()); + if let Err(e) = file_line.line_content { + return Err(e.into()); } let new_page_number = file_line.page_number; if page_counter != new_page_number { From 2dd9822d5709b0635ce0de836663e1d302c7ef17 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 14:25:17 +0900 Subject: [PATCH 1004/1135] rmdir: clean up returning Err --- src/uu/rmdir/src/rmdir.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/uu/rmdir/src/rmdir.rs b/src/uu/rmdir/src/rmdir.rs index 05cc66d51..fc22cca09 100644 --- a/src/uu/rmdir/src/rmdir.rs +++ b/src/uu/rmdir/src/rmdir.rs @@ -109,17 +109,14 @@ fn remove(dirs: Vec, ignore: bool, parents: bool, verbose: bool) -> Resu } fn remove_dir(path: &Path, ignore: bool, verbose: bool) -> Result<(), i32> { - let mut read_dir = match fs::read_dir(path) { - Ok(m) => m, - Err(e) if e.raw_os_error() == Some(ENOTDIR) => { + let mut read_dir = fs::read_dir(path).map_err(|e| { + if e.raw_os_error() == Some(ENOTDIR) { show_error!("failed to remove '{}': Not a directory", path.display()); - return Err(1); - } - Err(e) => { + } else { show_error!("reading directory '{}': {}", path.display(), e); - return Err(1); } - }; + 1 + })?; let mut r = Ok(()); From 9c56a40bcbff23c3d673784a0d4072f5c84eb058 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 14:25:30 +0900 Subject: [PATCH 1005/1135] shuf: clean up returning Err --- src/uu/shuf/src/shuf.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/uu/shuf/src/shuf.rs b/src/uu/shuf/src/shuf.rs index 88a47585f..2d1f558de 100644 --- a/src/uu/shuf/src/shuf.rs +++ b/src/uu/shuf/src/shuf.rs @@ -285,14 +285,12 @@ fn parse_range(input_range: &str) -> Result<(usize, usize), String> { if split.len() != 2 { Err(format!("invalid input range: '{}'", input_range)) } else { - let begin = match split[0].parse::() { - Ok(m) => m, - Err(_) => return Err(format!("invalid input range: '{}'", split[0])), - }; - let end = match split[1].parse::() { - Ok(m) => m, - Err(_) => return Err(format!("invalid input range: '{}'", split[1])), - }; + let begin = split[0] + .parse::() + .map_err(|_| format!("invalid input range: '{}'", split[0]))?; + let end = split[1] + .parse::() + .map_err(|_| format!("invalid input range: '{}'", split[1]))?; Ok((begin, end + 1)) } } From b59c1dae59ffdb60c37dc6abcc62e72665e8280e Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 14:25:40 +0900 Subject: [PATCH 1006/1135] stdbuf: clean up returning Err --- src/uu/stdbuf/src/stdbuf.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 5baff4825..a69e0c2c5 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -152,10 +152,8 @@ fn check_option(matches: &ArgMatches, name: &str) -> Result { - let size = match parse_size(x) { - Some(m) => m, - None => return Err(ProgramOptionsError(format!("invalid mode {}", x))), - }; + let size = parse_size(x) + .ok_or_else(|| ProgramOptionsError(format!("invalid mode {}", x)))?; Ok(BufferType::Size(size)) } }, From fb67e54e20543b3365879333a5e7dc348fd49610 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 14:26:22 +0900 Subject: [PATCH 1007/1135] uucore: clean up returning Err --- src/uucore/src/lib/features/fs.rs | 35 ++++++++--------------- src/uucore/src/lib/features/mode.rs | 26 ++++++++--------- src/uucore/src/lib/features/parse_time.rs | 14 ++++----- src/uucore/src/lib/mods/ranges.rs | 7 ++--- 4 files changed, 34 insertions(+), 48 deletions(-) diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index 525f305e3..36bdbfed0 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -113,22 +113,14 @@ fn resolve>(original: P) -> IOResult { )); } - match fs::symlink_metadata(&result) { - Err(e) => return Err(e), - Ok(ref m) if !m.file_type().is_symlink() => break, - Ok(..) => { - followed += 1; - match fs::read_link(&result) { - Ok(path) => { - result.pop(); - result.push(path); - } - Err(e) => { - return Err(e); - } - } - } + if !fs::symlink_metadata(&result)?.file_type().is_symlink() { + break; } + + followed += 1; + let path = fs::read_link(&result)?; + result.pop(); + result.push(path); } Ok(result) } @@ -193,10 +185,8 @@ pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> } match resolve(&result) { - Err(e) => match can_mode { - CanonicalizeMode::Missing => continue, - _ => return Err(e), - }, + Err(_) if can_mode == CanonicalizeMode::Missing => continue, + Err(e) => return Err(e), Ok(path) => { result.pop(); result.push(path); @@ -211,15 +201,14 @@ pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> } match resolve(&result) { - Err(e) => { - if can_mode == CanonicalizeMode::Existing { - return Err(e); - } + Err(e) if can_mode == CanonicalizeMode::Existing => { + return Err(e); } Ok(path) => { result.pop(); result.push(path); } + Err(_) => (), } } Ok(result) diff --git a/src/uucore/src/lib/features/mode.rs b/src/uucore/src/lib/features/mode.rs index 4fb5a6509..fe109d73d 100644 --- a/src/uucore/src/lib/features/mode.rs +++ b/src/uucore/src/lib/features/mode.rs @@ -89,19 +89,19 @@ fn parse_levels(mode: &str) -> (u32, usize) { } fn parse_op(mode: &str, default: Option) -> Result<(char, usize), String> { - match mode.chars().next() { - Some(ch) => match ch { - '+' | '-' | '=' => Ok((ch, 1)), - _ => match default { - Some(ch) => Ok((ch, 0)), - None => Err(format!( - "invalid operator (expected +, -, or =, but found {})", - ch - )), - }, - }, - None => Err("unexpected end of mode".to_owned()), - } + let ch = mode + .chars() + .next() + .ok_or_else(|| "unexpected end of mode".to_owned())?; + Ok(match ch { + '+' | '-' | '=' => (ch, 1), + _ => { + let ch = default.ok_or_else(|| { + format!("invalid operator (expected +, -, or =, but found {})", ch) + })?; + (ch, 0) + } + }) } fn parse_change(mode: &str, fperm: u32, considering_dir: bool) -> (u32, usize) { diff --git a/src/uucore/src/lib/features/parse_time.rs b/src/uucore/src/lib/features/parse_time.rs index 8e822685b..fdf43b727 100644 --- a/src/uucore/src/lib/features/parse_time.rs +++ b/src/uucore/src/lib/features/parse_time.rs @@ -20,20 +20,18 @@ pub fn from_str(string: &str) -> Result { 'm' | 'M' => (slice, 60), 'h' | 'H' => (slice, 60 * 60), 'd' | 'D' => (slice, 60 * 60 * 24), - val => { - if !val.is_alphabetic() { - (string, 1) - } else if string == "inf" || string == "infinity" { + val if !val.is_alphabetic() => (string, 1), + _ => { + if string == "inf" || string == "infinity" { ("inf", 1) } else { return Err(format!("invalid time interval '{}'", string)); } } }; - let num = match numstr.parse::() { - Ok(m) => m, - Err(e) => return Err(format!("invalid time interval '{}': {}", string, e)), - }; + let num = numstr + .parse::() + .map_err(|e| format!("invalid time interval '{}': {}", string, e))?; const NANOS_PER_SEC: u32 = 1_000_000_000; let whole_secs = num.trunc(); diff --git a/src/uucore/src/lib/mods/ranges.rs b/src/uucore/src/lib/mods/ranges.rs index d4a6bf601..9e1e67d5a 100644 --- a/src/uucore/src/lib/mods/ranges.rs +++ b/src/uucore/src/lib/mods/ranges.rs @@ -85,10 +85,9 @@ impl Range { let mut ranges: Vec = vec![]; for item in list.split(',') { - match FromStr::from_str(item) { - Ok(range_item) => ranges.push(range_item), - Err(e) => return Err(format!("range '{}' was invalid: {}", item, e)), - } + let range_item = FromStr::from_str(item) + .map_err(|e| format!("range '{}' was invalid: {}", item, e))?; + ranges.push(range_item); } ranges.sort(); From e985131c832b72a1c874be3a326316cbc66010fd Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 14:27:14 +0900 Subject: [PATCH 1008/1135] uucore: remove unused warning of sort_groups --- src/uucore/src/lib/features/entries.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uucore/src/lib/features/entries.rs b/src/uucore/src/lib/features/entries.rs index 477fac470..bc4166346 100644 --- a/src/uucore/src/lib/features/entries.rs +++ b/src/uucore/src/lib/features/entries.rs @@ -101,6 +101,7 @@ pub fn get_groups_gnu(arg_id: Option) -> IOResult> { Ok(sort_groups(groups, egid)) } +#[cfg(all(unix, feature = "process"))] fn sort_groups(mut groups: Vec, egid: gid_t) -> Vec { if let Some(index) = groups.iter().position(|&x| x == egid) { groups[..=index].rotate_right(1); From 9e8be3093fa430e1a48d740574a89d1fcf319e50 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 18:44:28 +0900 Subject: [PATCH 1009/1135] chown: clean up parse_spec --- src/uu/chown/src/chown.rs | 63 +++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index 166ad72b8..ab9f10dba 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -278,42 +278,25 @@ fn parse_spec(spec: &str) -> Result<(Option, Option), String> { let usr_only = args.len() == 1 && !args[0].is_empty(); let grp_only = args.len() == 2 && args[0].is_empty(); let usr_grp = args.len() == 2 && !args[0].is_empty() && !args[1].is_empty(); - - let r = if usr_only { - ( - Some( - Passwd::locate(args[0]) - .map_err(|_| format!("invalid user: ‘{}’", spec))? - .uid(), - ), - None, - ) - } else if grp_only { - ( - None, - Some( - Group::locate(args[1]) - .map_err(|_| format!("invalid group: ‘{}’", spec))? - .gid(), - ), - ) - } else if usr_grp { - ( - Some( - Passwd::locate(args[0]) - .map_err(|_| format!("invalid user: ‘{}’", spec))? - .uid(), - ), - Some( - Group::locate(args[1]) - .map_err(|_| format!("invalid group: ‘{}’", spec))? - .gid(), - ), + let uid = if usr_only || usr_grp { + Some( + Passwd::locate(args[0]) + .map_err(|_| format!("invalid user: ‘{}’", spec))? + .uid(), ) } else { - (None, None) + None }; - Ok(r) + let gid = if grp_only || usr_grp { + Some( + Group::locate(args[1]) + .map_err(|_| format!("invalid group: ‘{}’", spec))? + .gid(), + ) + } else { + None + }; + Ok((uid, gid)) } enum IfFrom { @@ -502,3 +485,17 @@ impl Chowner { } } } + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_parse_spec() { + assert_eq!(parse_spec(":"), Ok((None, None))); + assert!(parse_spec("::") + .err() + .unwrap() + .starts_with("invalid group: ")); + } +} From 6003d959746a6dadecbd1c6479baa9fff73d1d39 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 21:59:16 +0900 Subject: [PATCH 1010/1135] comm: clean up line-end check --- src/uu/comm/src/comm.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/uu/comm/src/comm.rs b/src/uu/comm/src/comm.rs index f7190fb73..7a6086bb5 100644 --- a/src/uu/comm/src/comm.rs +++ b/src/uu/comm/src/comm.rs @@ -50,9 +50,8 @@ fn mkdelim(col: usize, opts: &ArgMatches) -> String { } fn ensure_nl(line: &mut String) { - match line.chars().last() { - Some('\n') => (), - _ => line.push('\n'), + if !line.ends_with('\n') { + line.push('\n'); } } From 6734d5df932f07b764c0c50640688e08adc5482a Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 11 Jun 2021 19:51:55 +0900 Subject: [PATCH 1011/1135] basename: trim separators with function --- src/uu/basename/src/basename.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/uu/basename/src/basename.rs b/src/uu/basename/src/basename.rs index 47ad3117f..098a3e2b2 100644 --- a/src/uu/basename/src/basename.rs +++ b/src/uu/basename/src/basename.rs @@ -118,14 +118,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { fn basename(fullname: &str, suffix: &str) -> String { // Remove all platform-specific path separators from the end - let mut path: String = fullname - .chars() - .rev() - .skip_while(|&ch| is_separator(ch)) - .collect(); - - // Undo reverse - path = path.chars().rev().collect(); + let path = fullname.trim_end_matches(is_separator); // Convert to path buffer and get last path component let pb = PathBuf::from(path); From ddb196dd1d8ee141d5bdc2dd48c6b4a354a84296 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 11 Jun 2021 17:24:12 +0200 Subject: [PATCH 1012/1135] chgrp: fix clippy and spell-check warnings --- src/uu/chgrp/src/chgrp.rs | 2 +- tests/by-util/test_chgrp.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/chgrp/src/chgrp.rs b/src/uu/chgrp/src/chgrp.rs index c0dc2daf3..454a0386c 100644 --- a/src/uu/chgrp/src/chgrp.rs +++ b/src/uu/chgrp/src/chgrp.rs @@ -251,7 +251,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } else { let group = matches.value_of(options::ARG_GROUP).unwrap_or_default(); - match entries::grp2gid(&group) { + match entries::grp2gid(group) { Ok(g) => { dest_gid = g; } diff --git a/tests/by-util/test_chgrp.rs b/tests/by-util/test_chgrp.rs index d886d674b..762e922c4 100644 --- a/tests/by-util/test_chgrp.rs +++ b/tests/by-util/test_chgrp.rs @@ -1,4 +1,4 @@ -// spell-checker:ignore (words) nosuchgroup +// spell-checker:ignore (words) nosuchgroup groupname use crate::common::util::*; use rust_users::*; @@ -10,7 +10,7 @@ fn test_invalid_option() { static DIR: &str = "/tmp"; -// we should always get both arguments, regardless of whether --refernce was used +// we should always get both arguments, regardless of whether --reference was used #[test] fn test_help() { new_ucmd!() From f90975115538ba4d2043113f4cecf39bd17af94c Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 11 Jun 2021 20:44:25 +0200 Subject: [PATCH 1013/1135] timeout: don't kill the process if -k is not set `timeout` used to set the timeout to 0 when -k was not set. This collided with the behavior of 0 timeouts, which disable the timeout. When -k is not set the process should not be killed. --- src/uu/timeout/src/timeout.rs | 52 +++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index eabf0192a..bc92157ca 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -42,7 +42,7 @@ pub mod options { struct Config { foreground: bool, - kill_after: Duration, + kill_after: Option, signal: usize, duration: Duration, preserve_status: bool, @@ -66,10 +66,9 @@ impl Config { _ => uucore::signals::signal_by_name_or_value("TERM").unwrap(), }; - let kill_after: Duration = match options.value_of(options::KILL_AFTER) { - Some(time) => uucore::parse_time::from_str(time).unwrap(), - None => Duration::new(0, 0), - }; + let kill_after = options + .value_of(options::KILL_AFTER) + .map(|time| uucore::parse_time::from_str(time).unwrap()); let duration: Duration = uucore::parse_time::from_str(options.value_of(options::DURATION).unwrap()).unwrap(); @@ -178,7 +177,7 @@ fn timeout( cmd: &[String], duration: Duration, signal: usize, - kill_after: Duration, + kill_after: Option, foreground: bool, preserve_status: bool, verbose: bool, @@ -217,27 +216,32 @@ fn timeout( ); } return_if_err!(ERR_EXIT_STATUS, process.send_signal(signal)); - match process.wait_or_timeout(kill_after) { - Ok(Some(status)) => { - if preserve_status { - status.code().unwrap_or_else(|| status.signal().unwrap()) - } else { - 124 + if let Some(kill_after) = kill_after { + match process.wait_or_timeout(kill_after) { + Ok(Some(status)) => { + if preserve_status { + status.code().unwrap_or_else(|| status.signal().unwrap()) + } else { + 124 + } } - } - Ok(None) => { - if verbose { - show_error!("sending signal KILL to command '{}'", cmd[0]); + Ok(None) => { + if verbose { + show_error!("sending signal KILL to command '{}'", cmd[0]); + } + return_if_err!( + ERR_EXIT_STATUS, + process.send_signal( + uucore::signals::signal_by_name_or_value("KILL").unwrap() + ) + ); + return_if_err!(ERR_EXIT_STATUS, process.wait()); + 137 } - return_if_err!( - ERR_EXIT_STATUS, - process - .send_signal(uucore::signals::signal_by_name_or_value("KILL").unwrap()) - ); - return_if_err!(ERR_EXIT_STATUS, process.wait()); - 137 + Err(_) => 124, } - Err(_) => 124, + } else { + 124 } } Err(_) => { From cc0df6ea43621856d884248e72ee4e088ef49c0f Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 10 Jun 2021 22:21:45 +0200 Subject: [PATCH 1014/1135] sort: move options to the `options` module Be more consistent with other utilities --- src/uu/sort/src/sort.rs | 287 ++++++++++++++++++++++------------------ 1 file changed, 156 insertions(+), 131 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 53619d0d6..11fd05c4e 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -45,8 +45,8 @@ use std::path::PathBuf; use unicode_width::UnicodeWidthStr; use uucore::InvalidEncodingHandling; -static NAME: &str = "sort"; -static ABOUT: &str = "Display sorted concatenation of all FILE(s)."; +const NAME: &str = "sort"; +const ABOUT: &str = "Display sorted concatenation of all FILE(s)."; const LONG_HELP_KEYS: &str = "The key format is FIELD[.CHAR][OPTIONS][,FIELD[.CHAR]][OPTIONS]. @@ -58,49 +58,53 @@ If CHAR is set 0, it means the end of the field. CHAR defaults to 1 for the star Valid options are: MbdfhnRrV. They override the global options for this key."; -static OPT_HUMAN_NUMERIC_SORT: &str = "human-numeric-sort"; -static OPT_MONTH_SORT: &str = "month-sort"; -static OPT_NUMERIC_SORT: &str = "numeric-sort"; -static OPT_GENERAL_NUMERIC_SORT: &str = "general-numeric-sort"; -static OPT_VERSION_SORT: &str = "version-sort"; +mod options { + pub mod modes { + pub const SORT: &str = "sort"; -static OPT_SORT: &str = "sort"; + pub const HUMAN_NUMERIC: &str = "human-numeric-sort"; + pub const MONTH: &str = "month-sort"; + pub const NUMERIC: &str = "numeric-sort"; + pub const GENERAL_NUMERIC: &str = "general-numeric-sort"; + pub const VERSION: &str = "version-sort"; + pub const RANDOM: &str = "random-sort"; -static ALL_SORT_MODES: &[&str] = &[ - OPT_GENERAL_NUMERIC_SORT, - OPT_HUMAN_NUMERIC_SORT, - OPT_MONTH_SORT, - OPT_NUMERIC_SORT, - OPT_VERSION_SORT, - OPT_RANDOM, -]; + pub const ALL_SORT_MODES: [&str; 6] = [ + GENERAL_NUMERIC, + HUMAN_NUMERIC, + MONTH, + NUMERIC, + VERSION, + RANDOM, + ]; + } -static OPT_DICTIONARY_ORDER: &str = "dictionary-order"; -static OPT_MERGE: &str = "merge"; -static OPT_CHECK: &str = "check"; -static OPT_CHECK_SILENT: &str = "check-silent"; -static OPT_DEBUG: &str = "debug"; -static OPT_IGNORE_CASE: &str = "ignore-case"; -static OPT_IGNORE_BLANKS: &str = "ignore-blanks"; -static OPT_IGNORE_NONPRINTING: &str = "ignore-nonprinting"; -static OPT_OUTPUT: &str = "output"; -static OPT_REVERSE: &str = "reverse"; -static OPT_STABLE: &str = "stable"; -static OPT_UNIQUE: &str = "unique"; -static OPT_KEY: &str = "key"; -static OPT_SEPARATOR: &str = "field-separator"; -static OPT_RANDOM: &str = "random-sort"; -static OPT_ZERO_TERMINATED: &str = "zero-terminated"; -static OPT_PARALLEL: &str = "parallel"; -static OPT_FILES0_FROM: &str = "files0-from"; -static OPT_BUF_SIZE: &str = "buffer-size"; -static OPT_TMP_DIR: &str = "temporary-directory"; -static OPT_COMPRESS_PROG: &str = "compress-program"; -static OPT_BATCH_SIZE: &str = "batch-size"; + pub const DICTIONARY_ORDER: &str = "dictionary-order"; + pub const MERGE: &str = "merge"; + pub const CHECK: &str = "check"; + pub const CHECK_SILENT: &str = "check-silent"; + pub const DEBUG: &str = "debug"; + pub const IGNORE_CASE: &str = "ignore-case"; + pub const IGNORE_BLANKS: &str = "ignore-blanks"; + pub const IGNORE_NONPRINTING: &str = "ignore-nonprinting"; + pub const OUTPUT: &str = "output"; + pub const REVERSE: &str = "reverse"; + pub const STABLE: &str = "stable"; + pub const UNIQUE: &str = "unique"; + pub const KEY: &str = "key"; + pub const SEPARATOR: &str = "field-separator"; + pub const ZERO_TERMINATED: &str = "zero-terminated"; + pub const PARALLEL: &str = "parallel"; + pub const FILES0_FROM: &str = "files0-from"; + pub const BUF_SIZE: &str = "buffer-size"; + pub const TMP_DIR: &str = "temporary-directory"; + pub const COMPRESS_PROG: &str = "compress-program"; + pub const BATCH_SIZE: &str = "batch-size"; -static ARG_FILES: &str = "files"; + pub const FILES: &str = "files"; +} -static DECIMAL_PT: char = '.'; +const DECIMAL_PT: char = '.'; const NEGATIVE: char = '-'; const POSITIVE: char = '+'; @@ -108,7 +112,7 @@ const POSITIVE: char = '+'; // Choosing a higher buffer size does not result in performance improvements // (at least not on my machine). TODO: In the future, we should also take the amount of // available memory into consideration, instead of relying on this constant only. -static DEFAULT_BUF_SIZE: usize = 1_000_000_000; // 1 GB +const DEFAULT_BUF_SIZE: usize = 1_000_000_000; // 1 GB #[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy, Debug)] enum SortMode { @@ -889,9 +893,10 @@ With no FILE, or when FILE is -, read standard input.", ) } +/// Creates an `Arg` that conflicts with all other sort modes. fn make_sort_mode_arg<'a, 'b>(mode: &'a str, short: &'b str, help: &'b str) -> Arg<'a, 'b> { let mut arg = Arg::with_name(mode).short(short).long(mode).help(help); - for possible_mode in ALL_SORT_MODES { + for possible_mode in &options::modes::ALL_SORT_MODES { if *possible_mode != mode { arg = arg.conflicts_with(possible_mode); } @@ -911,8 +916,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .arg( - Arg::with_name(OPT_SORT) - .long(OPT_SORT) + Arg::with_name(options::modes::SORT) + .long(options::modes::SORT) .takes_value(true) .possible_values( &[ @@ -924,199 +929,213 @@ pub fn uumain(args: impl uucore::Args) -> i32 { "random", ] ) - .conflicts_with_all(ALL_SORT_MODES) + .conflicts_with_all(&options::modes::ALL_SORT_MODES) ) .arg( make_sort_mode_arg( - OPT_HUMAN_NUMERIC_SORT, + options::modes::HUMAN_NUMERIC, "h", "compare according to human readable sizes, eg 1M > 100k" ), ) .arg( make_sort_mode_arg( - OPT_MONTH_SORT, + options::modes::MONTH, "M", "compare according to month name abbreviation" ), ) .arg( make_sort_mode_arg( - OPT_NUMERIC_SORT, + options::modes::NUMERIC, "n", "compare according to string numerical value" ), ) .arg( make_sort_mode_arg( - OPT_GENERAL_NUMERIC_SORT, + options::modes::GENERAL_NUMERIC, "g", "compare according to string general numerical value" ), ) .arg( make_sort_mode_arg( - OPT_VERSION_SORT, + options::modes::VERSION, "V", "Sort by SemVer version number, eg 1.12.2 > 1.1.2", ), ) .arg( make_sort_mode_arg( - OPT_RANDOM, + options::modes::RANDOM, "R", "shuffle in random order", ), ) .arg( - Arg::with_name(OPT_DICTIONARY_ORDER) + Arg::with_name(options::DICTIONARY_ORDER) .short("d") - .long(OPT_DICTIONARY_ORDER) + .long(options::DICTIONARY_ORDER) .help("consider only blanks and alphanumeric characters") - .conflicts_with_all(&[OPT_NUMERIC_SORT, OPT_GENERAL_NUMERIC_SORT, OPT_HUMAN_NUMERIC_SORT, OPT_MONTH_SORT]), + .conflicts_with_all( + &[ + options::modes::NUMERIC, + options::modes::GENERAL_NUMERIC, + options::modes::HUMAN_NUMERIC, + options::modes::MONTH, + ] + ), ) .arg( - Arg::with_name(OPT_MERGE) + Arg::with_name(options::MERGE) .short("m") - .long(OPT_MERGE) + .long(options::MERGE) .help("merge already sorted files; do not sort"), ) .arg( - Arg::with_name(OPT_CHECK) + Arg::with_name(options::CHECK) .short("c") - .long(OPT_CHECK) + .long(options::CHECK) .help("check for sorted input; do not sort"), ) .arg( - Arg::with_name(OPT_CHECK_SILENT) + Arg::with_name(options::CHECK_SILENT) .short("C") - .long(OPT_CHECK_SILENT) + .long(options::CHECK_SILENT) .help("exit successfully if the given file is already sorted, and exit with status 1 otherwise."), ) .arg( - Arg::with_name(OPT_IGNORE_CASE) + Arg::with_name(options::IGNORE_CASE) .short("f") - .long(OPT_IGNORE_CASE) + .long(options::IGNORE_CASE) .help("fold lower case to upper case characters"), ) .arg( - Arg::with_name(OPT_IGNORE_NONPRINTING) + Arg::with_name(options::IGNORE_NONPRINTING) .short("i") - .long(OPT_IGNORE_NONPRINTING) + .long(options::IGNORE_NONPRINTING) .help("ignore nonprinting characters") - .conflicts_with_all(&[OPT_NUMERIC_SORT, OPT_GENERAL_NUMERIC_SORT, OPT_HUMAN_NUMERIC_SORT, OPT_MONTH_SORT]), + .conflicts_with_all( + &[ + options::modes::NUMERIC, + options::modes::GENERAL_NUMERIC, + options::modes::HUMAN_NUMERIC, + options::modes::MONTH + ] + ), ) .arg( - Arg::with_name(OPT_IGNORE_BLANKS) + Arg::with_name(options::IGNORE_BLANKS) .short("b") - .long(OPT_IGNORE_BLANKS) + .long(options::IGNORE_BLANKS) .help("ignore leading blanks when finding sort keys in each line"), ) .arg( - Arg::with_name(OPT_OUTPUT) + Arg::with_name(options::OUTPUT) .short("o") - .long(OPT_OUTPUT) + .long(options::OUTPUT) .help("write output to FILENAME instead of stdout") .takes_value(true) .value_name("FILENAME"), ) .arg( - Arg::with_name(OPT_REVERSE) + Arg::with_name(options::REVERSE) .short("r") - .long(OPT_REVERSE) + .long(options::REVERSE) .help("reverse the output"), ) .arg( - Arg::with_name(OPT_STABLE) + Arg::with_name(options::STABLE) .short("s") - .long(OPT_STABLE) + .long(options::STABLE) .help("stabilize sort by disabling last-resort comparison"), ) .arg( - Arg::with_name(OPT_UNIQUE) + Arg::with_name(options::UNIQUE) .short("u") - .long(OPT_UNIQUE) + .long(options::UNIQUE) .help("output only the first of an equal run"), ) .arg( - Arg::with_name(OPT_KEY) + Arg::with_name(options::KEY) .short("k") - .long(OPT_KEY) + .long(options::KEY) .help("sort by a key") .long_help(LONG_HELP_KEYS) .multiple(true) .takes_value(true), ) .arg( - Arg::with_name(OPT_SEPARATOR) + Arg::with_name(options::SEPARATOR) .short("t") - .long(OPT_SEPARATOR) + .long(options::SEPARATOR) .help("custom separator for -k") .takes_value(true)) .arg( - Arg::with_name(OPT_ZERO_TERMINATED) + Arg::with_name(options::ZERO_TERMINATED) .short("z") - .long(OPT_ZERO_TERMINATED) + .long(options::ZERO_TERMINATED) .help("line delimiter is NUL, not newline"), ) .arg( - Arg::with_name(OPT_PARALLEL) - .long(OPT_PARALLEL) + Arg::with_name(options::PARALLEL) + .long(options::PARALLEL) .help("change the number of threads running concurrently to NUM_THREADS") .takes_value(true) .value_name("NUM_THREADS"), ) .arg( - Arg::with_name(OPT_BUF_SIZE) + Arg::with_name(options::BUF_SIZE) .short("S") - .long(OPT_BUF_SIZE) + .long(options::BUF_SIZE) .help("sets the maximum SIZE of each segment in number of sorted items") .takes_value(true) .value_name("SIZE"), ) .arg( - Arg::with_name(OPT_TMP_DIR) + Arg::with_name(options::TMP_DIR) .short("T") - .long(OPT_TMP_DIR) + .long(options::TMP_DIR) .help("use DIR for temporaries, not $TMPDIR or /tmp") .takes_value(true) .value_name("DIR"), ) .arg( - Arg::with_name(OPT_COMPRESS_PROG) - .long(OPT_COMPRESS_PROG) + Arg::with_name(options::COMPRESS_PROG) + .long(options::COMPRESS_PROG) .help("compress temporary files with PROG, decompress with PROG -d") .long_help("PROG has to take input from stdin and output to stdout") .value_name("PROG") ) .arg( - Arg::with_name(OPT_BATCH_SIZE) - .long(OPT_BATCH_SIZE) + Arg::with_name(options::BATCH_SIZE) + .long(options::BATCH_SIZE) .help("Merge at most N_MERGE inputs at once.") .value_name("N_MERGE") ) .arg( - Arg::with_name(OPT_FILES0_FROM) - .long(OPT_FILES0_FROM) + Arg::with_name(options::FILES0_FROM) + .long(options::FILES0_FROM) .help("read input from the files specified by NUL-terminated NUL_FILES") .takes_value(true) .value_name("NUL_FILES") .multiple(true), ) .arg( - Arg::with_name(OPT_DEBUG) - .long(OPT_DEBUG) + Arg::with_name(options::DEBUG) + .long(options::DEBUG) .help("underline the parts of the line that are actually used for sorting"), ) - .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) + .arg(Arg::with_name(options::FILES).multiple(true).takes_value(true)) .get_matches_from(args); - settings.debug = matches.is_present(OPT_DEBUG); + settings.debug = matches.is_present(options::DEBUG); // check whether user specified a zero terminated list of files for input, otherwise read files from args - let mut files: Vec = if matches.is_present(OPT_FILES0_FROM) { + let mut files: Vec = if matches.is_present(options::FILES0_FROM) { let files0_from: Vec = matches - .values_of(OPT_FILES0_FROM) + .values_of(options::FILES0_FROM) .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); @@ -1135,80 +1154,86 @@ pub fn uumain(args: impl uucore::Args) -> i32 { files } else { matches - .values_of(ARG_FILES) + .values_of(options::FILES) .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default() }; - settings.mode = if matches.is_present(OPT_HUMAN_NUMERIC_SORT) - || matches.value_of(OPT_SORT) == Some("human-numeric") + settings.mode = if matches.is_present(options::modes::HUMAN_NUMERIC) + || matches.value_of(options::modes::SORT) == Some("human-numeric") { SortMode::HumanNumeric - } else if matches.is_present(OPT_MONTH_SORT) || matches.value_of(OPT_SORT) == Some("month") { + } else if matches.is_present(options::modes::MONTH) + || matches.value_of(options::modes::SORT) == Some("month") + { SortMode::Month - } else if matches.is_present(OPT_GENERAL_NUMERIC_SORT) - || matches.value_of(OPT_SORT) == Some("general-numeric") + } else if matches.is_present(options::modes::GENERAL_NUMERIC) + || matches.value_of(options::modes::SORT) == Some("general-numeric") { SortMode::GeneralNumeric - } else if matches.is_present(OPT_NUMERIC_SORT) || matches.value_of(OPT_SORT) == Some("numeric") + } else if matches.is_present(options::modes::NUMERIC) + || matches.value_of(options::modes::SORT) == Some("numeric") { SortMode::Numeric - } else if matches.is_present(OPT_VERSION_SORT) || matches.value_of(OPT_SORT) == Some("version") + } else if matches.is_present(options::modes::VERSION) + || matches.value_of(options::modes::SORT) == Some("version") { SortMode::Version - } else if matches.is_present(OPT_RANDOM) || matches.value_of(OPT_SORT) == Some("random") { + } else if matches.is_present(options::modes::RANDOM) + || matches.value_of(options::modes::SORT) == Some("random") + { settings.salt = get_rand_string(); SortMode::Random } else { SortMode::Default }; - settings.dictionary_order = matches.is_present(OPT_DICTIONARY_ORDER); - settings.ignore_non_printing = matches.is_present(OPT_IGNORE_NONPRINTING); - if matches.is_present(OPT_PARALLEL) { + settings.dictionary_order = matches.is_present(options::DICTIONARY_ORDER); + settings.ignore_non_printing = matches.is_present(options::IGNORE_NONPRINTING); + if matches.is_present(options::PARALLEL) { // "0" is default - threads = num of cores settings.threads = matches - .value_of(OPT_PARALLEL) + .value_of(options::PARALLEL) .map(String::from) .unwrap_or_else(|| "0".to_string()); env::set_var("RAYON_NUM_THREADS", &settings.threads); } settings.buffer_size = matches - .value_of(OPT_BUF_SIZE) + .value_of(options::BUF_SIZE) .map(GlobalSettings::parse_byte_count) .unwrap_or(DEFAULT_BUF_SIZE); settings.tmp_dir = matches - .value_of(OPT_TMP_DIR) + .value_of(options::TMP_DIR) .map(PathBuf::from) .unwrap_or_else(env::temp_dir); - settings.compress_prog = matches.value_of(OPT_COMPRESS_PROG).map(String::from); + settings.compress_prog = matches.value_of(options::COMPRESS_PROG).map(String::from); - if let Some(n_merge) = matches.value_of(OPT_BATCH_SIZE) { + if let Some(n_merge) = matches.value_of(options::BATCH_SIZE) { settings.merge_batch_size = n_merge .parse() .unwrap_or_else(|_| crash!(2, "invalid --batch-size argument '{}'", n_merge)); } - settings.zero_terminated = matches.is_present(OPT_ZERO_TERMINATED); - settings.merge = matches.is_present(OPT_MERGE); + settings.zero_terminated = matches.is_present(options::ZERO_TERMINATED); + settings.merge = matches.is_present(options::MERGE); - settings.check = matches.is_present(OPT_CHECK); - if matches.is_present(OPT_CHECK_SILENT) { - settings.check_silent = matches.is_present(OPT_CHECK_SILENT); + settings.check = matches.is_present(options::CHECK); + if matches.is_present(options::CHECK_SILENT) { + settings.check_silent = matches.is_present(options::CHECK_SILENT); settings.check = true; }; - settings.ignore_case = matches.is_present(OPT_IGNORE_CASE); + settings.ignore_case = matches.is_present(options::IGNORE_CASE); - settings.ignore_blanks = matches.is_present(OPT_IGNORE_BLANKS); + settings.ignore_blanks = matches.is_present(options::IGNORE_BLANKS); - settings.output_file = matches.value_of(OPT_OUTPUT).map(String::from); - settings.reverse = matches.is_present(OPT_REVERSE); - settings.stable = matches.is_present(OPT_STABLE); - settings.unique = matches.is_present(OPT_UNIQUE); + settings.output_file = matches.value_of(options::OUTPUT).map(String::from); + settings.reverse = matches.is_present(options::REVERSE); + settings.stable = matches.is_present(options::STABLE); + settings.unique = matches.is_present(options::UNIQUE); if files.is_empty() { /* if no file, default to stdin */ @@ -1217,7 +1242,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { crash!(1, "extra operand `{}' not allowed with -c", files[1]) } - if let Some(arg) = matches.args.get(OPT_SEPARATOR) { + if let Some(arg) = matches.args.get(options::SEPARATOR) { let separator = arg.vals[0].to_string_lossy(); let separator = separator; if separator.len() != 1 { @@ -1226,15 +1251,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.separator = Some(separator.chars().next().unwrap()) } - if matches.is_present(OPT_KEY) { - for key in &matches.args[OPT_KEY].vals { + if matches.is_present(options::KEY) { + for key in &matches.args[options::KEY].vals { settings .selectors .push(FieldSelector::parse(&key.to_string_lossy(), &settings)); } } - if !matches.is_present(OPT_KEY) { + if !matches.is_present(options::KEY) { // add a default selector matching the whole line let key_settings = KeySettings::from(&settings); settings.selectors.push( From fb035aa049d241ce88291944ba6cdee5a96c7a8c Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 10 Jun 2021 22:38:43 +0200 Subject: [PATCH 1015/1135] sort: allow --check= syntax * --check=silent and --check=quiet, which are equivalent to -C. * --check=diagnose-first, which is the same as --check We also allow -c=, which confuses GNU sort. --- src/uu/sort/src/sort.rs | 37 ++++++++++++++++++++++++++++--------- tests/by-util/test_sort.rs | 34 +++++++++++++++++++--------------- 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 11fd05c4e..1156a9437 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -79,10 +79,16 @@ mod options { ]; } + pub mod check { + pub const CHECK: &str = "check"; + pub const CHECK_SILENT: &str = "check-silent"; + pub const SILENT: &str = "silent"; + pub const QUIET: &str = "quiet"; + pub const DIAGNOSE_FIRST: &str = "diagnose-first"; + } + pub const DICTIONARY_ORDER: &str = "dictionary-order"; pub const MERGE: &str = "merge"; - pub const CHECK: &str = "check"; - pub const CHECK_SILENT: &str = "check-silent"; pub const DEBUG: &str = "debug"; pub const IGNORE_CASE: &str = "ignore-case"; pub const IGNORE_BLANKS: &str = "ignore-blanks"; @@ -994,15 +1000,23 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("merge already sorted files; do not sort"), ) .arg( - Arg::with_name(options::CHECK) + Arg::with_name(options::check::CHECK) .short("c") - .long(options::CHECK) + .long(options::check::CHECK) + .takes_value(true) + .require_equals(true) + .min_values(0) + .possible_values(&[ + options::check::SILENT, + options::check::QUIET, + options::check::DIAGNOSE_FIRST, + ]) .help("check for sorted input; do not sort"), ) .arg( - Arg::with_name(options::CHECK_SILENT) + Arg::with_name(options::check::CHECK_SILENT) .short("C") - .long(options::CHECK_SILENT) + .long(options::check::CHECK_SILENT) .help("exit successfully if the given file is already sorted, and exit with status 1 otherwise."), ) .arg( @@ -1220,9 +1234,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.zero_terminated = matches.is_present(options::ZERO_TERMINATED); settings.merge = matches.is_present(options::MERGE); - settings.check = matches.is_present(options::CHECK); - if matches.is_present(options::CHECK_SILENT) { - settings.check_silent = matches.is_present(options::CHECK_SILENT); + settings.check = matches.is_present(options::check::CHECK); + if matches.is_present(options::check::CHECK_SILENT) + || matches!( + matches.value_of(options::check::CHECK), + Some(options::check::SILENT) | Some(options::check::QUIET) + ) + { + settings.check_silent = true; settings.check = true; }; diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 7a0143b43..1624c2caf 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -717,26 +717,30 @@ fn test_pipe() { #[test] fn test_check() { - new_ucmd!() - .arg("-c") - .arg("check_fail.txt") - .fails() - .stdout_is("sort: check_fail.txt:6: disorder: 5\n"); + for diagnose_arg in &["-c", "--check", "--check=diagnose-first"] { + new_ucmd!() + .arg(diagnose_arg) + .arg("check_fail.txt") + .fails() + .stdout_is("sort: check_fail.txt:6: disorder: 5\n"); - new_ucmd!() - .arg("-c") - .arg("multiple_files.expected") - .succeeds() - .stdout_is(""); + new_ucmd!() + .arg(diagnose_arg) + .arg("multiple_files.expected") + .succeeds() + .stdout_is(""); + } } #[test] fn test_check_silent() { - new_ucmd!() - .arg("-C") - .arg("check_fail.txt") - .fails() - .stdout_is(""); + for silent_arg in &["-C", "--check=silent", "--check=quiet"] { + new_ucmd!() + .arg(silent_arg) + .arg("check_fail.txt") + .fails() + .stdout_is(""); + } } #[test] From b8d44112918421a0cc2c5b923d2d5eb03ce090b8 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 10 Jun 2021 22:49:17 +0200 Subject: [PATCH 1016/1135] sort: fix ignore-leading-blanks long option --- src/uu/sort/src/sort.rs | 24 +++++++++++++----------- tests/by-util/test_sort.rs | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 1156a9437..934a4da49 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -91,7 +91,7 @@ mod options { pub const MERGE: &str = "merge"; pub const DEBUG: &str = "debug"; pub const IGNORE_CASE: &str = "ignore-case"; - pub const IGNORE_BLANKS: &str = "ignore-blanks"; + pub const IGNORE_LEADING_BLANKS: &str = "ignore-leading-blanks"; pub const IGNORE_NONPRINTING: &str = "ignore-nonprinting"; pub const OUTPUT: &str = "output"; pub const REVERSE: &str = "reverse"; @@ -149,7 +149,7 @@ impl SortMode { pub struct GlobalSettings { mode: SortMode, debug: bool, - ignore_blanks: bool, + ignore_leading_blanks: bool, ignore_case: bool, dictionary_order: bool, ignore_non_printing: bool, @@ -219,7 +219,7 @@ impl Default for GlobalSettings { GlobalSettings { mode: SortMode::Default, debug: false, - ignore_blanks: false, + ignore_leading_blanks: false, ignore_case: false, dictionary_order: false, ignore_non_printing: false, @@ -310,7 +310,7 @@ impl From<&GlobalSettings> for KeySettings { fn from(settings: &GlobalSettings) -> Self { Self { mode: settings.mode, - ignore_blanks: settings.ignore_blanks, + ignore_blanks: settings.ignore_leading_blanks, ignore_case: settings.ignore_case, ignore_non_printing: settings.ignore_non_printing, reverse: settings.reverse, @@ -517,7 +517,7 @@ impl<'a> Line<'a> { && !settings.stable && !settings.unique && (settings.dictionary_order - || settings.ignore_blanks + || settings.ignore_leading_blanks || settings.ignore_case || settings.ignore_non_printing || settings.mode != SortMode::Default @@ -681,9 +681,11 @@ impl FieldSelector { // This would be ideal for a try block, I think. In the meantime this closure allows // to use the `?` operator here. Self::new( - KeyPosition::new(from, 1, global_settings.ignore_blanks)?, - to.map(|(to, _)| KeyPosition::new(to, 0, global_settings.ignore_blanks)) - .transpose()?, + KeyPosition::new(from, 1, global_settings.ignore_leading_blanks)?, + to.map(|(to, _)| { + KeyPosition::new(to, 0, global_settings.ignore_leading_blanks) + }) + .transpose()?, KeySettings::from(global_settings), ) })() @@ -1040,9 +1042,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ), ) .arg( - Arg::with_name(options::IGNORE_BLANKS) + Arg::with_name(options::IGNORE_LEADING_BLANKS) .short("b") - .long(options::IGNORE_BLANKS) + .long(options::IGNORE_LEADING_BLANKS) .help("ignore leading blanks when finding sort keys in each line"), ) .arg( @@ -1247,7 +1249,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.ignore_case = matches.is_present(options::IGNORE_CASE); - settings.ignore_blanks = matches.is_present(options::IGNORE_BLANKS); + settings.ignore_leading_blanks = matches.is_present(options::IGNORE_LEADING_BLANKS); settings.output_file = matches.value_of(options::OUTPUT).map(String::from); settings.reverse = matches.is_present(options::REVERSE); diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 1624c2caf..c1d1a85b5 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -794,7 +794,7 @@ fn test_nonexistent_file() { #[test] fn test_blanks() { - test_helper("blanks", &["-b", "--ignore-blanks"]); + test_helper("blanks", &["-b", "--ignore-leading-blanks"]); } #[test] From b335e7f2aeb6125e068d614affeed96fa2f11e6c Mon Sep 17 00:00:00 2001 From: Hanif Bin Ariffin Date: Sat, 12 Jun 2021 17:57:35 +0800 Subject: [PATCH 1017/1135] Now stops at the last line first. Press down again to go to next file or quit Signed-off-by: Hanif Bin Ariffin --- src/uu/more/src/more.rs | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 206cebbc2..d83961d2c 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -239,7 +239,11 @@ fn more(buff: &str, mut stdout: &mut Stdout, next_file: Option<&str>, silent: bo code: KeyCode::Char(' '), modifiers: KeyModifiers::NONE, }) => { - pager.page_down(); + if pager.should_close() { + return; + } else { + pager.page_down(); + } } Event::Key(KeyEvent { code: KeyCode::Up, @@ -253,9 +257,6 @@ fn more(buff: &str, mut stdout: &mut Stdout, next_file: Option<&str>, silent: bo } pager.draw(stdout, wrong_key); - if pager.should_close() { - return; - } } } } @@ -268,7 +269,6 @@ struct Pager<'a> { lines: Vec, next_file: Option<&'a str>, line_count: usize, - close_on_down: bool, silent: bool, } @@ -277,33 +277,25 @@ impl<'a> Pager<'a> { let line_count = lines.len(); Self { upper_mark: 0, - content_rows: rows - 1, + content_rows: rows.saturating_sub(1), lines, next_file, line_count, - close_on_down: false, silent, } } fn should_close(&mut self) -> bool { - if self.upper_mark + self.content_rows >= self.line_count { - if self.close_on_down { - return true; - } - if self.next_file.is_none() { - return true; - } else { - self.close_on_down = true; - } - } else { - self.close_on_down = false; - } - false + self.upper_mark + .saturating_add(self.content_rows) + .eq(&self.line_count) } fn page_down(&mut self) { - self.upper_mark += self.content_rows; + self.upper_mark = self + .upper_mark + .saturating_add(self.content_rows) + .min(self.line_count.saturating_sub(self.content_rows)); } fn page_up(&mut self) { @@ -364,7 +356,7 @@ impl<'a> Pager<'a> { // Break the lines on the cols of the terminal fn break_buff(buff: &str, cols: usize) -> Vec { - let mut lines = Vec::new(); + let mut lines = Vec::with_capacity(buff.lines().count()); for l in buff.lines() { lines.append(&mut break_line(l, cols)); From 63ee42826b017ac4d0075dbdfc373535e731d3af Mon Sep 17 00:00:00 2001 From: Hanif Bin Ariffin Date: Sat, 12 Jun 2021 18:02:31 +0800 Subject: [PATCH 1018/1135] Fixed numeric type 1. Its better to bump u16 to usize than the other way round. 2. Highly unlikely to have a terminal with usize rows...makes making sense of the code easier. Signed-off-by: Hanif Bin Ariffin --- src/uu/more/src/more.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index d83961d2c..90ef07e99 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -210,7 +210,7 @@ fn more(buff: &str, mut stdout: &mut Stdout, next_file: Option<&str>, silent: bo let (cols, rows) = terminal::size().unwrap(); let lines = break_buff(buff, usize::from(cols)); - let mut pager = Pager::new(rows as usize, lines, next_file, silent); + let mut pager = Pager::new(rows, lines, next_file, silent); pager.draw(stdout, false); if pager.should_close() { return; @@ -265,7 +265,7 @@ struct Pager<'a> { // The current line at the top of the screen upper_mark: usize, // The number of rows that fit on the screen - content_rows: usize, + content_rows: u16, lines: Vec, next_file: Option<&'a str>, line_count: usize, @@ -273,7 +273,7 @@ struct Pager<'a> { } impl<'a> Pager<'a> { - fn new(rows: usize, lines: Vec, next_file: Option<&'a str>, silent: bool) -> Self { + fn new(rows: u16, lines: Vec, next_file: Option<&'a str>, silent: bool) -> Self { let line_count = lines.len(); Self { upper_mark: 0, @@ -287,23 +287,25 @@ impl<'a> Pager<'a> { fn should_close(&mut self) -> bool { self.upper_mark - .saturating_add(self.content_rows) + .saturating_add(self.content_rows.into()) .eq(&self.line_count) } fn page_down(&mut self) { self.upper_mark = self .upper_mark - .saturating_add(self.content_rows) - .min(self.line_count.saturating_sub(self.content_rows)); + .saturating_add(self.content_rows.into()) + .min(self.line_count.saturating_sub(self.content_rows.into())); } fn page_up(&mut self) { - self.upper_mark = self.upper_mark.saturating_sub(self.content_rows); + self.upper_mark = self.upper_mark.saturating_sub(self.content_rows.into()); } fn draw(&self, stdout: &mut std::io::Stdout, wrong_key: bool) { - let lower_mark = self.line_count.min(self.upper_mark + self.content_rows); + let lower_mark = self + .line_count + .min(self.upper_mark.saturating_add(self.content_rows.into())); self.draw_lines(stdout); self.draw_prompt(stdout, lower_mark, wrong_key); stdout.flush().unwrap(); @@ -315,7 +317,7 @@ impl<'a> Pager<'a> { .lines .iter() .skip(self.upper_mark) - .take(self.content_rows); + .take(self.content_rows.into()); for line in displayed_lines { stdout From ee6419f11c85056682f4ba190cd9f6329f04043c Mon Sep 17 00:00:00 2001 From: Hanif Bin Ariffin Date: Sat, 12 Jun 2021 18:10:38 +0800 Subject: [PATCH 1019/1135] Fixing display when resizing terminal Signed-off-by: Hanif Bin Ariffin --- src/uu/more/src/more.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 90ef07e99..dac48cea7 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -251,6 +251,10 @@ fn more(buff: &str, mut stdout: &mut Stdout, next_file: Option<&str>, silent: bo }) => { pager.page_up(); } + Event::Resize(col, row) => { + pager.page_resize(col, row); + } + // FIXME: Need to fix, there are more than just unknown keys. _ => { wrong_key = true; } @@ -302,6 +306,11 @@ impl<'a> Pager<'a> { self.upper_mark = self.upper_mark.saturating_sub(self.content_rows.into()); } + // TODO: Deal with column size changes. + fn page_resize(&mut self, _: u16, row: u16) { + self.content_rows = row.saturating_sub(1); + } + fn draw(&self, stdout: &mut std::io::Stdout, wrong_key: bool) { let lower_mark = self .line_count From 28c6fad6e3855176ea77b5899be225d9f2eff5ee Mon Sep 17 00:00:00 2001 From: Hanif Bin Ariffin Date: Sat, 12 Jun 2021 18:25:14 +0800 Subject: [PATCH 1020/1135] Now displays the unknown key entered Signed-off-by: Hanif Bin Ariffin --- src/uu/more/src/more.rs | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index dac48cea7..3724cd801 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -211,13 +211,13 @@ fn more(buff: &str, mut stdout: &mut Stdout, next_file: Option<&str>, silent: bo let lines = break_buff(buff, usize::from(cols)); let mut pager = Pager::new(rows, lines, next_file, silent); - pager.draw(stdout, false); + pager.draw(stdout, None); if pager.should_close() { return; } loop { - let mut wrong_key = false; + let mut wrong_key = None; if event::poll(Duration::from_millis(10)).unwrap() { match event::read().unwrap() { Event::Key(KeyEvent { @@ -254,10 +254,11 @@ fn more(buff: &str, mut stdout: &mut Stdout, next_file: Option<&str>, silent: bo Event::Resize(col, row) => { pager.page_resize(col, row); } - // FIXME: Need to fix, there are more than just unknown keys. - _ => { - wrong_key = true; - } + Event::Key(KeyEvent { + code: KeyCode::Char(k), + .. + }) => wrong_key = Some(k), + _ => continue, } pager.draw(stdout, wrong_key); @@ -311,7 +312,7 @@ impl<'a> Pager<'a> { self.content_rows = row.saturating_sub(1); } - fn draw(&self, stdout: &mut std::io::Stdout, wrong_key: bool) { + fn draw(&self, stdout: &mut std::io::Stdout, wrong_key: Option) { let lower_mark = self .line_count .min(self.upper_mark.saturating_add(self.content_rows.into())); @@ -335,7 +336,7 @@ impl<'a> Pager<'a> { } } - fn draw_prompt(&self, stdout: &mut Stdout, lower_mark: usize, wrong_key: bool) { + fn draw_prompt(&self, stdout: &mut Stdout, lower_mark: usize, wrong_key: Option) { let status_inner = if lower_mark == self.line_count { format!("Next file: {}", self.next_file.unwrap_or_default()) } else { @@ -348,10 +349,15 @@ impl<'a> Pager<'a> { let status = format!("--More--({})", status_inner); let banner = match (self.silent, wrong_key) { - (true, true) => "[Press 'h' for instructions. (unimplemented)]".to_string(), - (true, false) => format!("{}[Press space to continue, 'q' to quit.]", status), - (false, true) => format!("{}{}", status, BELL), - (false, false) => status, + (true, Some(key)) => { + format!( + "{} [Unknown key: '{}'. Press 'h' for instructions. (unimplemented)]", + status, key + ) + } + (true, None) => format!("{}[Press space to continue, 'q' to quit.]", status), + (false, Some(_)) => format!("{}{}", status, BELL), + (false, None) => status, }; write!( From a390383d2d71f51a4512abb641e61655ac280484 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 12 Jun 2021 13:01:42 +0200 Subject: [PATCH 1021/1135] core: represent signal values by their index --- src/uucore/src/lib/features/signals.rs | 326 ++----------------------- 1 file changed, 23 insertions(+), 303 deletions(-) diff --git a/src/uucore/src/lib/features/signals.rs b/src/uucore/src/lib/features/signals.rs index 3c52a9158..e6d2e7763 100644 --- a/src/uucore/src/lib/features/signals.rs +++ b/src/uucore/src/lib/features/signals.rs @@ -10,11 +10,6 @@ pub static DEFAULT_SIGNAL: usize = 15; -pub struct Signal<'a> { - pub name: &'a str, - pub value: usize, -} - /* Linux Programmer's Manual @@ -29,135 +24,10 @@ Linux Programmer's Manual */ #[cfg(target_os = "linux")] -pub static ALL_SIGNALS: [Signal<'static>; 32] = [ - Signal { - name: "EXIT", - value: 0, - }, - Signal { - name: "HUP", - value: 1, - }, - Signal { - name: "INT", - value: 2, - }, - Signal { - name: "QUIT", - value: 3, - }, - Signal { - name: "ILL", - value: 4, - }, - Signal { - name: "TRAP", - value: 5, - }, - Signal { - name: "ABRT", - value: 6, - }, - Signal { - name: "BUS", - value: 7, - }, - Signal { - name: "FPE", - value: 8, - }, - Signal { - name: "KILL", - value: 9, - }, - Signal { - name: "USR1", - value: 10, - }, - Signal { - name: "SEGV", - value: 11, - }, - Signal { - name: "USR2", - value: 12, - }, - Signal { - name: "PIPE", - value: 13, - }, - Signal { - name: "ALRM", - value: 14, - }, - Signal { - name: "TERM", - value: 15, - }, - Signal { - name: "STKFLT", - value: 16, - }, - Signal { - name: "CHLD", - value: 17, - }, - Signal { - name: "CONT", - value: 18, - }, - Signal { - name: "STOP", - value: 19, - }, - Signal { - name: "TSTP", - value: 20, - }, - Signal { - name: "TTIN", - value: 21, - }, - Signal { - name: "TTOU", - value: 22, - }, - Signal { - name: "URG", - value: 23, - }, - Signal { - name: "XCPU", - value: 24, - }, - Signal { - name: "XFSZ", - value: 25, - }, - Signal { - name: "VTALRM", - value: 26, - }, - Signal { - name: "PROF", - value: 27, - }, - Signal { - name: "WINCH", - value: 28, - }, - Signal { - name: "POLL", - value: 29, - }, - Signal { - name: "PWR", - value: 30, - }, - Signal { - name: "SYS", - value: 31, - }, +pub static ALL_SIGNALS: [&str; 32] = [ + "EXIT", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "BUS", "FPE", "KILL", "USR1", "SEGV", + "USR2", "PIPE", "ALRM", "TERM", "STKFLT", "CHLD", "CONT", "STOP", "TSTP", "TTIN", "TTOU", + "URG", "XCPU", "XFSZ", "VTALRM", "PROF", "WINCH", "POLL", "PWR", "SYS", ]; /* @@ -202,135 +72,10 @@ No Name Default Action Description */ #[cfg(any(target_vendor = "apple", target_os = "freebsd"))] -pub static ALL_SIGNALS: [Signal<'static>; 32] = [ - Signal { - name: "EXIT", - value: 0, - }, - Signal { - name: "HUP", - value: 1, - }, - Signal { - name: "INT", - value: 2, - }, - Signal { - name: "QUIT", - value: 3, - }, - Signal { - name: "ILL", - value: 4, - }, - Signal { - name: "TRAP", - value: 5, - }, - Signal { - name: "ABRT", - value: 6, - }, - Signal { - name: "EMT", - value: 7, - }, - Signal { - name: "FPE", - value: 8, - }, - Signal { - name: "KILL", - value: 9, - }, - Signal { - name: "BUS", - value: 10, - }, - Signal { - name: "SEGV", - value: 11, - }, - Signal { - name: "SYS", - value: 12, - }, - Signal { - name: "PIPE", - value: 13, - }, - Signal { - name: "ALRM", - value: 14, - }, - Signal { - name: "TERM", - value: 15, - }, - Signal { - name: "URG", - value: 16, - }, - Signal { - name: "STOP", - value: 17, - }, - Signal { - name: "TSTP", - value: 18, - }, - Signal { - name: "CONT", - value: 19, - }, - Signal { - name: "CHLD", - value: 20, - }, - Signal { - name: "TTIN", - value: 21, - }, - Signal { - name: "TTOU", - value: 22, - }, - Signal { - name: "IO", - value: 23, - }, - Signal { - name: "XCPU", - value: 24, - }, - Signal { - name: "XFSZ", - value: 25, - }, - Signal { - name: "VTALRM", - value: 26, - }, - Signal { - name: "PROF", - value: 27, - }, - Signal { - name: "WINCH", - value: 28, - }, - Signal { - name: "INFO", - value: 29, - }, - Signal { - name: "USR1", - value: 30, - }, - Signal { - name: "USR2", - value: 31, - }, +pub static ALL_SIGNALS: [&str; 32] = [ + "EXIT", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "EMT", "FPE", "KILL", "BUS", "SEGV", + "SYS", "PIPE", "ALRM", "TERM", "URG", "STOP", "TSTP", "CONT", "CHLD", "TTIN", "TTOU", "IO", + "XCPU", "XFSZ", "VTALRM", "PROF", "WINCH", "INFO", "USR1", "USR2", ]; pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { @@ -343,70 +88,45 @@ pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { } let signal_name = signal_name_or_value.trim_start_matches("SIG"); - ALL_SIGNALS - .iter() - .find(|s| s.name == signal_name) - .map(|s| s.value) + ALL_SIGNALS.iter().position(|&s| s == signal_name) +} + +pub fn is_signal(num: usize) -> bool { + num < ALL_SIGNALS.len() } pub fn signal_name_by_value(signal_value: usize) -> Option<&'static str> { - ALL_SIGNALS - .iter() - .find(|signal| signal.value == signal_value) - .map(|signal| signal.name) -} - -#[inline(always)] -pub fn is_signal(num: usize) -> bool { - // Named signals start at 1 - num <= ALL_SIGNALS.len() -} - -#[test] -fn signals_all_contiguous() { - for (i, signal) in ALL_SIGNALS.iter().enumerate() { - assert_eq!(signal.value, i); - } -} - -#[test] -fn signals_all_are_signal() { - for signal in &ALL_SIGNALS { - assert!(is_signal(signal.value)); - } + ALL_SIGNALS.get(signal_value).copied() } #[test] fn signal_by_value() { assert_eq!(signal_by_name_or_value("0"), Some(0)); - for signal in &ALL_SIGNALS { - assert_eq!( - signal_by_name_or_value(&signal.value.to_string()), - Some(signal.value) - ); + for (value, _signal) in ALL_SIGNALS.iter().enumerate() { + assert_eq!(signal_by_name_or_value(&value.to_string()), Some(value)); } } #[test] fn signal_by_short_name() { - for signal in &ALL_SIGNALS { - assert_eq!(signal_by_name_or_value(signal.name), Some(signal.value)); + for (value, signal) in ALL_SIGNALS.iter().enumerate() { + assert_eq!(signal_by_name_or_value(signal), Some(value)); } } #[test] fn signal_by_long_name() { - for signal in &ALL_SIGNALS { + for (value, signal) in ALL_SIGNALS.iter().enumerate() { assert_eq!( - signal_by_name_or_value(&format!("SIG{}", signal.name)), - Some(signal.value) + signal_by_name_or_value(&format!("SIG{}", signal)), + Some(value) ); } } #[test] fn name() { - for signal in &ALL_SIGNALS { - assert_eq!(signal_name_by_value(signal.value), Some(signal.name)); + for (value, signal) in ALL_SIGNALS.iter().enumerate() { + assert_eq!(signal_name_by_value(value), Some(*signal)); } } From a57313f01b29f2b363eea3dcace5d2ceeaa02754 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 12 Jun 2021 13:01:42 +0200 Subject: [PATCH 1022/1135] core: represent signal values by their index --- src/uu/kill/src/kill.rs | 22 +- src/uucore/src/lib/features/signals.rs | 326 ++----------------------- 2 files changed, 33 insertions(+), 315 deletions(-) diff --git a/src/uu/kill/src/kill.rs b/src/uu/kill/src/kill.rs index a49acaa05..7965c40a9 100644 --- a/src/uu/kill/src/kill.rs +++ b/src/uu/kill/src/kill.rs @@ -132,13 +132,13 @@ fn table() { let mut name_width = 0; /* Compute the maximum width of a signal name. */ for s in &ALL_SIGNALS { - if s.name.len() > name_width { - name_width = s.name.len() + if s.len() > name_width { + name_width = s.len() } } for (idx, signal) in ALL_SIGNALS.iter().enumerate() { - print!("{0: >#2} {1: <#8}", idx + 1, signal.name); + print!("{0: >#2} {1: <#8}", idx + 1, signal); //TODO: obtain max signal width here if (idx + 1) % 7 == 0 { @@ -148,14 +148,12 @@ fn table() { } fn print_signal(signal_name_or_value: &str) { - for signal in &ALL_SIGNALS { - if signal.name == signal_name_or_value - || (format!("SIG{}", signal.name)) == signal_name_or_value - { - println!("{}", signal.value); + for (value, &signal) in ALL_SIGNALS.iter().enumerate() { + if signal == signal_name_or_value || (format!("SIG{}", signal)) == signal_name_or_value { + println!("{}", value); exit!(EXIT_OK as i32) - } else if signal_name_or_value == signal.value.to_string() { - println!("{}", signal.name); + } else if signal_name_or_value == value.to_string() { + println!("{}", signal); exit!(EXIT_OK as i32) } } @@ -165,8 +163,8 @@ fn print_signal(signal_name_or_value: &str) { fn print_signals() { let mut pos = 0; for (idx, signal) in ALL_SIGNALS.iter().enumerate() { - pos += signal.name.len(); - print!("{}", signal.name); + pos += signal.len(); + print!("{}", signal); if idx > 0 && pos > 73 { println!(); pos = 0; diff --git a/src/uucore/src/lib/features/signals.rs b/src/uucore/src/lib/features/signals.rs index 3c52a9158..e6d2e7763 100644 --- a/src/uucore/src/lib/features/signals.rs +++ b/src/uucore/src/lib/features/signals.rs @@ -10,11 +10,6 @@ pub static DEFAULT_SIGNAL: usize = 15; -pub struct Signal<'a> { - pub name: &'a str, - pub value: usize, -} - /* Linux Programmer's Manual @@ -29,135 +24,10 @@ Linux Programmer's Manual */ #[cfg(target_os = "linux")] -pub static ALL_SIGNALS: [Signal<'static>; 32] = [ - Signal { - name: "EXIT", - value: 0, - }, - Signal { - name: "HUP", - value: 1, - }, - Signal { - name: "INT", - value: 2, - }, - Signal { - name: "QUIT", - value: 3, - }, - Signal { - name: "ILL", - value: 4, - }, - Signal { - name: "TRAP", - value: 5, - }, - Signal { - name: "ABRT", - value: 6, - }, - Signal { - name: "BUS", - value: 7, - }, - Signal { - name: "FPE", - value: 8, - }, - Signal { - name: "KILL", - value: 9, - }, - Signal { - name: "USR1", - value: 10, - }, - Signal { - name: "SEGV", - value: 11, - }, - Signal { - name: "USR2", - value: 12, - }, - Signal { - name: "PIPE", - value: 13, - }, - Signal { - name: "ALRM", - value: 14, - }, - Signal { - name: "TERM", - value: 15, - }, - Signal { - name: "STKFLT", - value: 16, - }, - Signal { - name: "CHLD", - value: 17, - }, - Signal { - name: "CONT", - value: 18, - }, - Signal { - name: "STOP", - value: 19, - }, - Signal { - name: "TSTP", - value: 20, - }, - Signal { - name: "TTIN", - value: 21, - }, - Signal { - name: "TTOU", - value: 22, - }, - Signal { - name: "URG", - value: 23, - }, - Signal { - name: "XCPU", - value: 24, - }, - Signal { - name: "XFSZ", - value: 25, - }, - Signal { - name: "VTALRM", - value: 26, - }, - Signal { - name: "PROF", - value: 27, - }, - Signal { - name: "WINCH", - value: 28, - }, - Signal { - name: "POLL", - value: 29, - }, - Signal { - name: "PWR", - value: 30, - }, - Signal { - name: "SYS", - value: 31, - }, +pub static ALL_SIGNALS: [&str; 32] = [ + "EXIT", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "BUS", "FPE", "KILL", "USR1", "SEGV", + "USR2", "PIPE", "ALRM", "TERM", "STKFLT", "CHLD", "CONT", "STOP", "TSTP", "TTIN", "TTOU", + "URG", "XCPU", "XFSZ", "VTALRM", "PROF", "WINCH", "POLL", "PWR", "SYS", ]; /* @@ -202,135 +72,10 @@ No Name Default Action Description */ #[cfg(any(target_vendor = "apple", target_os = "freebsd"))] -pub static ALL_SIGNALS: [Signal<'static>; 32] = [ - Signal { - name: "EXIT", - value: 0, - }, - Signal { - name: "HUP", - value: 1, - }, - Signal { - name: "INT", - value: 2, - }, - Signal { - name: "QUIT", - value: 3, - }, - Signal { - name: "ILL", - value: 4, - }, - Signal { - name: "TRAP", - value: 5, - }, - Signal { - name: "ABRT", - value: 6, - }, - Signal { - name: "EMT", - value: 7, - }, - Signal { - name: "FPE", - value: 8, - }, - Signal { - name: "KILL", - value: 9, - }, - Signal { - name: "BUS", - value: 10, - }, - Signal { - name: "SEGV", - value: 11, - }, - Signal { - name: "SYS", - value: 12, - }, - Signal { - name: "PIPE", - value: 13, - }, - Signal { - name: "ALRM", - value: 14, - }, - Signal { - name: "TERM", - value: 15, - }, - Signal { - name: "URG", - value: 16, - }, - Signal { - name: "STOP", - value: 17, - }, - Signal { - name: "TSTP", - value: 18, - }, - Signal { - name: "CONT", - value: 19, - }, - Signal { - name: "CHLD", - value: 20, - }, - Signal { - name: "TTIN", - value: 21, - }, - Signal { - name: "TTOU", - value: 22, - }, - Signal { - name: "IO", - value: 23, - }, - Signal { - name: "XCPU", - value: 24, - }, - Signal { - name: "XFSZ", - value: 25, - }, - Signal { - name: "VTALRM", - value: 26, - }, - Signal { - name: "PROF", - value: 27, - }, - Signal { - name: "WINCH", - value: 28, - }, - Signal { - name: "INFO", - value: 29, - }, - Signal { - name: "USR1", - value: 30, - }, - Signal { - name: "USR2", - value: 31, - }, +pub static ALL_SIGNALS: [&str; 32] = [ + "EXIT", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "EMT", "FPE", "KILL", "BUS", "SEGV", + "SYS", "PIPE", "ALRM", "TERM", "URG", "STOP", "TSTP", "CONT", "CHLD", "TTIN", "TTOU", "IO", + "XCPU", "XFSZ", "VTALRM", "PROF", "WINCH", "INFO", "USR1", "USR2", ]; pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { @@ -343,70 +88,45 @@ pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { } let signal_name = signal_name_or_value.trim_start_matches("SIG"); - ALL_SIGNALS - .iter() - .find(|s| s.name == signal_name) - .map(|s| s.value) + ALL_SIGNALS.iter().position(|&s| s == signal_name) +} + +pub fn is_signal(num: usize) -> bool { + num < ALL_SIGNALS.len() } pub fn signal_name_by_value(signal_value: usize) -> Option<&'static str> { - ALL_SIGNALS - .iter() - .find(|signal| signal.value == signal_value) - .map(|signal| signal.name) -} - -#[inline(always)] -pub fn is_signal(num: usize) -> bool { - // Named signals start at 1 - num <= ALL_SIGNALS.len() -} - -#[test] -fn signals_all_contiguous() { - for (i, signal) in ALL_SIGNALS.iter().enumerate() { - assert_eq!(signal.value, i); - } -} - -#[test] -fn signals_all_are_signal() { - for signal in &ALL_SIGNALS { - assert!(is_signal(signal.value)); - } + ALL_SIGNALS.get(signal_value).copied() } #[test] fn signal_by_value() { assert_eq!(signal_by_name_or_value("0"), Some(0)); - for signal in &ALL_SIGNALS { - assert_eq!( - signal_by_name_or_value(&signal.value.to_string()), - Some(signal.value) - ); + for (value, _signal) in ALL_SIGNALS.iter().enumerate() { + assert_eq!(signal_by_name_or_value(&value.to_string()), Some(value)); } } #[test] fn signal_by_short_name() { - for signal in &ALL_SIGNALS { - assert_eq!(signal_by_name_or_value(signal.name), Some(signal.value)); + for (value, signal) in ALL_SIGNALS.iter().enumerate() { + assert_eq!(signal_by_name_or_value(signal), Some(value)); } } #[test] fn signal_by_long_name() { - for signal in &ALL_SIGNALS { + for (value, signal) in ALL_SIGNALS.iter().enumerate() { assert_eq!( - signal_by_name_or_value(&format!("SIG{}", signal.name)), - Some(signal.value) + signal_by_name_or_value(&format!("SIG{}", signal)), + Some(value) ); } } #[test] fn name() { - for signal in &ALL_SIGNALS { - assert_eq!(signal_name_by_value(signal.value), Some(signal.name)); + for (value, signal) in ALL_SIGNALS.iter().enumerate() { + assert_eq!(signal_name_by_value(value), Some(*signal)); } } From 9ed5091be6bf4f0f9c13ec85a1b1ea9f72c4eccb Mon Sep 17 00:00:00 2001 From: Hanif Bin Ariffin Date: Sat, 12 Jun 2021 20:30:15 +0800 Subject: [PATCH 1023/1135] Fixed hanging with smaller content Using 'seq 10 | cargo run -- more' should no longer hangs. Signed-off-by: Hanif Bin Ariffin --- src/uu/more/src/more.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 3724cd801..93a2f0edf 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -293,7 +293,7 @@ impl<'a> Pager<'a> { fn should_close(&mut self) -> bool { self.upper_mark .saturating_add(self.content_rows.into()) - .eq(&self.line_count) + .ge(&self.line_count) } fn page_down(&mut self) { From 083e74597613d2edd1d17fce1bca282a8db0f315 Mon Sep 17 00:00:00 2001 From: Hanif Bin Ariffin Date: Sat, 12 Jun 2021 20:34:21 +0800 Subject: [PATCH 1024/1135] Simplified page down implementation Signed-off-by: Hanif Bin Ariffin --- src/uu/more/src/more.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 93a2f0edf..d7fba5080 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -297,10 +297,7 @@ impl<'a> Pager<'a> { } fn page_down(&mut self) { - self.upper_mark = self - .upper_mark - .saturating_add(self.content_rows.into()) - .min(self.line_count.saturating_sub(self.content_rows.into())); + self.upper_mark = self.upper_mark.saturating_add(self.content_rows.into()); } fn page_up(&mut self) { From d6181ce7d44e523c8400f4081bb1b16d3d97b0aa Mon Sep 17 00:00:00 2001 From: Anup Mahindre Date: Sat, 5 Jun 2021 23:35:15 +0530 Subject: [PATCH 1025/1135] du: Add threshold argument support - Add --threshold parameter and corresponding logic to skip listing entires that don't adhere to the threshold --- src/uu/du/src/du.rs | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index b7c53eb72..39af3d7e1 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -28,6 +28,7 @@ use std::os::windows::io::AsRawHandle; #[cfg(windows)] use std::path::Path; use std::path::PathBuf; +use std::str::FromStr; use std::time::{Duration, UNIX_EPOCH}; use uucore::parse_size::{parse_size, ParseSizeError}; use uucore::InvalidEncodingHandling; @@ -56,6 +57,7 @@ mod options { pub const BLOCK_SIZE_1M: &str = "m"; pub const SEPARATE_DIRS: &str = "S"; pub const SUMMARIZE: &str = "s"; + pub const THRESHOLD: &str = "threshold"; pub const SI: &str = "si"; pub const TIME: &str = "time"; pub const TIME_STYLE: &str = "time-style"; @@ -510,6 +512,17 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::ONE_FILE_SYSTEM) .help("skip directories on different file systems") ) + .arg( + Arg::with_name(options::THRESHOLD) + .short("t") + .long(options::THRESHOLD) + .alias("th") + .value_name("SIZE") + .number_of_values(1) + .allow_hyphen_values(true) + .help("exclude entries smaller than SIZE if positive, \ + or entries greater than SIZE if negative") + ) // .arg( // Arg::with_name("") // .short("x") @@ -586,6 +599,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let block_size = u64::try_from(read_block_size(matches.value_of(options::BLOCK_SIZE))).unwrap(); + let threshold = match matches.value_of(options::THRESHOLD) { + Some(s) => Threshold::from_str(s) + .unwrap_or_else(|e| crash!(1, "{}", format_error_message(e, s, options::THRESHOLD))), + None => Threshold(None, false), + }; + let multiplier: u64 = if matches.is_present(options::SI) { 1000 } else { @@ -654,6 +673,10 @@ Try '{} --help' for more information.", // See: http://linux.die.net/man/2/stat stat.blocks * 512 }; + if threshold.should_exclude(size) { + continue; + } + if matches.is_present(options::TIME) { let tm = { let secs = { @@ -720,6 +743,35 @@ Try '{} --help' for more information.", 0 } +struct Threshold(Option, bool); + +impl FromStr for Threshold { + type Err = ParseSizeError; + + fn from_str(s: &str) -> std::result::Result { + let offset = if s.starts_with('-') || s.starts_with('+') { + 1 + } else { + 0 + }; + let sz = parse_size(&s[offset..])?; + + Ok(Threshold( + Some(u64::try_from(sz).unwrap()), + s.starts_with('-'), + )) + } +} + +impl Threshold { + fn should_exclude(&self, sz: u64) -> bool { + match *self { + Threshold(Some(th), is_upper) => (is_upper && sz > th) || (!is_upper && sz < th), + Threshold(None, _) => false, + } + } +} + fn format_error_message(error: ParseSizeError, s: &str, option: &str) -> String { // NOTE: // GNU's du echos affected flag, -B or --block-size (-t or --threshold), depending user's selection From fa12b46c51268dd4c4f2db6fcaf93421c3330015 Mon Sep 17 00:00:00 2001 From: Anup Mahindre Date: Sat, 12 Jun 2021 19:30:48 +0530 Subject: [PATCH 1026/1135] tests: Add test for du threshold feature --- tests/by-util/test_du.rs | 50 +++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index 8d1267423..93875ae51 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -80,19 +80,22 @@ fn _du_basics_subdir(s: &str) { #[test] fn test_du_invalid_size() { - new_ucmd!() - .arg("--block-size=1fb4t") - .arg("/tmp") - .fails() - .code_is(1) - .stderr_only("du: invalid --block-size argument '1fb4t'"); - #[cfg(not(target_pointer_width = "128"))] - new_ucmd!() - .arg("--block-size=1Y") - .arg("/tmp") - .fails() - .code_is(1) - .stderr_only("du: --block-size argument '1Y' too large"); + let args = &["block-size", "threshold"]; + for s in args { + new_ucmd!() + .arg(format!("--{}=1fb4t", s)) + .arg("/tmp") + .fails() + .code_is(1) + .stderr_only(format!("du: invalid --{} argument '1fb4t'", s)); + #[cfg(not(target_pointer_width = "128"))] + new_ucmd!() + .arg(format!("--{}=1Y", s)) + .arg("/tmp") + .fails() + .code_is(1) + .stderr_only(format!("du: --{} argument '1Y' too large", s)); + } } #[test] @@ -351,3 +354,24 @@ fn test_du_one_file_system() { } _du_basics_subdir(result.stdout_str()); } + +#[test] +fn test_du_threshold() { + let scene = TestScenario::new(util_name!()); + + let threshold = if cfg!(windows) { "7K" } else { "10K" }; + + scene + .ucmd() + .arg(format!("--threshold={}", threshold)) + .succeeds() + .stdout_contains("links") + .stdout_does_not_contain("deeper"); + + scene + .ucmd() + .arg(format!("--threshold=-{}", threshold)) + .succeeds() + .stdout_does_not_contain("links") + .stdout_contains("deeper"); +} From 8e7eedebe7d3578289b54dce7f69668840b74a23 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 11 Jun 2021 22:00:26 +0200 Subject: [PATCH 1027/1135] tests: take slices in `stdout_is_fixture` --- tests/by-util/test_pr.rs | 132 +++++++++------------------------------ tests/common/util.rs | 2 +- 2 files changed, 31 insertions(+), 103 deletions(-) diff --git a/tests/by-util/test_pr.rs b/tests/by-util/test_pr.rs index def361fab..c1dee2a6c 100644 --- a/tests/by-util/test_pr.rs +++ b/tests/by-util/test_pr.rs @@ -33,10 +33,7 @@ fn test_without_any_options() { scenario .args(&[test_file_path]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]); } #[test] @@ -48,10 +45,7 @@ fn test_with_numbering_option_with_number_width() { scenario .args(&["-n", "2", test_file_path]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]); } #[test] @@ -66,10 +60,7 @@ fn test_with_long_header_option() { .succeeds() .stdout_is_templated_fixture( expected_test_file_path, - vec![ - (&"{last_modified_time}".to_string(), &value), - (&"{header}".to_string(), &header.to_string()), - ], + &[("{last_modified_time}", &value), ("{header}", header)], ); new_ucmd!() @@ -77,10 +68,7 @@ fn test_with_long_header_option() { .succeeds() .stdout_is_templated_fixture( expected_test_file_path, - vec![ - (&"{last_modified_time}".to_string(), &value), - (&"{header}".to_string(), &header.to_string()), - ], + &[("{last_modified_time}", &value), ("{header}", header)], ); } @@ -93,18 +81,12 @@ fn test_with_double_space_option() { scenario .args(&["-d", test_file_path]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]); new_ucmd!() .args(&["--double-space", test_file_path]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]); } #[test] @@ -116,10 +98,7 @@ fn test_with_first_line_number_option() { scenario .args(&["-N", "5", "-n", test_file_path]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]); } #[test] @@ -131,10 +110,7 @@ fn test_with_first_line_number_long_option() { scenario .args(&["--first-line-number=5", "-n", test_file_path]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]); } #[test] @@ -146,10 +122,7 @@ fn test_with_number_option_with_custom_separator_char() { scenario .args(&["-nc", test_file_path]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]); } #[test] @@ -161,10 +134,7 @@ fn test_with_number_option_with_custom_separator_char_and_width() { scenario .args(&["-nc1", test_file_path]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]); } #[test] @@ -207,25 +177,19 @@ fn test_with_page_range() { scenario .args(&["--pages=15", test_file_path]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]); new_ucmd!() .args(&["+15", test_file_path]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]); new_ucmd!() .args(&["--pages=15:17", test_file_path]) .succeeds() .stdout_is_templated_fixture( expected_test_file_path1, - vec![(&"{last_modified_time}".to_string(), &value)], + &[("{last_modified_time}", &value)], ); new_ucmd!() @@ -233,7 +197,7 @@ fn test_with_page_range() { .succeeds() .stdout_is_templated_fixture( expected_test_file_path1, - vec![(&"{last_modified_time}".to_string(), &value)], + &[("{last_modified_time}", &value)], ); } @@ -246,10 +210,7 @@ fn test_with_no_header_trailer_option() { scenario .args(&["-t", test_file_path]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]); } #[test] @@ -262,10 +223,7 @@ fn test_with_page_length_option() { scenario .args(&["--pages=2:3", "-l", "100", "-n", test_file_path]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]); new_ucmd!() .args(&["--pages=2:3", "-l", "5", "-n", test_file_path]) @@ -293,10 +251,7 @@ fn test_with_stdin() { .pipe_in_fixture("stdin.log") .args(&["--pages=1:2", "-n", "-"]) .run() - .stdout_is_templated_fixture( - expected_file_path, - vec![(&"{last_modified_time}".to_string(), &now)], - ); + .stdout_is_templated_fixture(expected_file_path, &[("{last_modified_time}", &now)]); } #[test] @@ -308,18 +263,12 @@ fn test_with_column() { scenario .args(&["--pages=3:5", "--column=3", "-n", test_file_path]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]); new_ucmd!() .args(&["--pages=3:5", "-3", "-n", test_file_path]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]); } #[test] @@ -331,10 +280,7 @@ fn test_with_column_across_option() { scenario .args(&["--pages=3:5", "--column=3", "-a", "-n", test_file_path]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]); } #[test] @@ -354,10 +300,7 @@ fn test_with_column_across_option_and_column_separator() { test_file_path, ]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]); new_ucmd!() .args(&[ @@ -371,7 +314,7 @@ fn test_with_column_across_option_and_column_separator() { .succeeds() .stdout_is_templated_fixture( expected_test_file_path1, - vec![(&"{last_modified_time}".to_string(), &value)], + &[("{last_modified_time}", &value)], ); } @@ -386,19 +329,13 @@ fn test_with_mpr() { new_ucmd!() .args(&["--pages=1:2", "-m", "-n", test_file_path, test_file_path1]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &now)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &now)]); let now = now_time(); new_ucmd!() .args(&["--pages=2:4", "-m", "-n", test_file_path, test_file_path1]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path1, - vec![(&"{last_modified_time}".to_string(), &now)], - ); + .stdout_is_templated_fixture(expected_test_file_path1, &[("{last_modified_time}", &now)]); let now = now_time(); new_ucmd!() @@ -413,10 +350,7 @@ fn test_with_mpr() { test_file_path, ]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path2, - vec![(&"{last_modified_time}".to_string(), &now)], - ); + .stdout_is_templated_fixture(expected_test_file_path2, &[("{last_modified_time}", &now)]); } #[test] @@ -452,10 +386,7 @@ fn test_with_offset_space_option() { test_file_path, ]) .succeeds() - .stdout_is_templated_fixture( - expected_test_file_path, - vec![(&"{last_modified_time}".to_string(), &value)], - ); + .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]); } #[test] @@ -497,9 +428,9 @@ fn test_with_pr_core_utils_tests() { scenario_with_expected_status.stdout_is_templated_fixture( test_file_path, - vec![ - (&"{last_modified_time}".to_string(), &value), - (&"{file_name}".to_string(), &input_file_path.to_string()), + &[ + ("{last_modified_time}", &value), + ("{file_name}", input_file_path), ], ); } @@ -515,8 +446,5 @@ fn test_with_join_lines_option() { scenario .args(&["+1:2", "-J", "-m", test_file_1, test_file_2]) .run() - .stdout_is_templated_fixture( - expected_file_path, - vec![(&"{last_modified_time}".to_string(), &now)], - ); + .stdout_is_templated_fixture(expected_file_path, &[("{last_modified_time}", &now)]); } diff --git a/tests/common/util.rs b/tests/common/util.rs index 922d2ba36..52911912e 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -247,7 +247,7 @@ impl CmdResult { pub fn stdout_is_templated_fixture>( &self, file_rel_path: T, - template_vars: Vec<(&String, &String)>, + template_vars: &[(&str, &str)], ) -> &CmdResult { let mut contents = String::from_utf8(read_scenario_fixture(&self.tmpd, file_rel_path)).unwrap(); From 98088db9ff09d40ee9f61aa697dedf41e2ae71ce Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 11 Jun 2021 22:02:10 +0200 Subject: [PATCH 1028/1135] tests: add `_any` functions This should make it easier to write tests that could have different valid outputs depending on timing. --- tests/common/util.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/common/util.rs b/tests/common/util.rs index 52911912e..f881cff21 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -223,6 +223,18 @@ impl CmdResult { self } + /// like `stdout_is`, but succeeds if any elements of `expected` matches stdout. + pub fn stdout_is_any + std::fmt::Debug>(&self, expected: Vec) -> &CmdResult { + if !expected.iter().any(|msg| self.stdout_str() == msg.as_ref()) { + panic!( + "stdout was {}\nExpected any of {:#?}", + self.stdout_str(), + expected + ) + } + self + } + /// Like `stdout_is` but newlines are normalized to `\n`. pub fn normalized_newlines_stdout_is>(&self, msg: T) -> &CmdResult { let msg = msg.as_ref().replace("\r\n", "\n"); @@ -257,6 +269,23 @@ impl CmdResult { self.stdout_is(contents) } + /// like `stdout_is_templated_fixture`, but succeeds if any replacement by `template_vars` results in the actual stdout. + pub fn stdout_is_templated_fixture_any>( + &self, + file_rel_path: T, + template_vars: &[Vec<(String, String)>], + ) { + let contents = String::from_utf8(read_scenario_fixture(&self.tmpd, file_rel_path)).unwrap(); + let possible_values = template_vars.iter().map(|vars| { + let mut contents = contents.clone(); + for kv in vars.iter() { + contents = contents.replace(&kv.0, &kv.1); + } + contents + }); + self.stdout_is_any(possible_values.collect()); + } + /// asserts that the command resulted in stderr stream output that equals the /// passed in value, when both are trimmed of trailing whitespace /// stderr_only is a better choice unless stdout may or will be non-empty From bb029193e2b281f07f5fae69985a42d028f4f6a6 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 11 Jun 2021 22:29:16 +0200 Subject: [PATCH 1029/1135] tests/pr: prevent races Allow any timestamp from the start of the command to its end to show up in stdout. --- tests/by-util/test_pr.rs | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/tests/by-util/test_pr.rs b/tests/by-util/test_pr.rs index c1dee2a6c..2391bc37a 100644 --- a/tests/by-util/test_pr.rs +++ b/tests/by-util/test_pr.rs @@ -3,6 +3,7 @@ use crate::common::util::*; use chrono::offset::Local; use chrono::DateTime; +use chrono::Duration; use std::fs::metadata; fn file_last_modified_time(ucmd: &UCommand, path: &str) -> String { @@ -20,8 +21,22 @@ fn file_last_modified_time(ucmd: &UCommand, path: &str) -> String { .unwrap_or_default() } -fn now_time() -> String { - Local::now().format("%b %d %H:%M %Y").to_string() +fn all_minutes(from: DateTime, to: DateTime) -> Vec { + const FORMAT: &str = "%b %d %H:%M %Y"; + let mut vec = vec![]; + let mut current = from; + while current < to { + vec.push(current.format(FORMAT).to_string()); + current = current + Duration::minutes(1); + } + vec +} + +fn valid_last_modified_template_vars(from: DateTime) -> Vec> { + all_minutes(from, Local::now()) + .into_iter() + .map(|time| vec![("{last_modified_time}".to_string(), time)]) + .collect() } #[test] @@ -246,12 +261,12 @@ fn test_with_suppress_error_option() { fn test_with_stdin() { let expected_file_path = "stdin.log.expected"; let mut scenario = new_ucmd!(); - let now = now_time(); + let start = Local::now(); scenario .pipe_in_fixture("stdin.log") .args(&["--pages=1:2", "-n", "-"]) .run() - .stdout_is_templated_fixture(expected_file_path, &[("{last_modified_time}", &now)]); + .stdout_is_templated_fixture_any(expected_file_path, &valid_last_modified_template_vars(start)); } #[test] @@ -325,19 +340,19 @@ fn test_with_mpr() { let expected_test_file_path = "mpr.log.expected"; let expected_test_file_path1 = "mpr1.log.expected"; let expected_test_file_path2 = "mpr2.log.expected"; - let now = now_time(); + let start = Local::now(); new_ucmd!() .args(&["--pages=1:2", "-m", "-n", test_file_path, test_file_path1]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &now)]); + .stdout_is_templated_fixture_any(expected_test_file_path, &valid_last_modified_template_vars(start)); - let now = now_time(); + let start = Local::now(); new_ucmd!() .args(&["--pages=2:4", "-m", "-n", test_file_path, test_file_path1]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path1, &[("{last_modified_time}", &now)]); + .stdout_is_templated_fixture_any(expected_test_file_path1, &valid_last_modified_template_vars(start)); - let now = now_time(); + let start = Local::now(); new_ucmd!() .args(&[ "--pages=1:2", @@ -350,7 +365,7 @@ fn test_with_mpr() { test_file_path, ]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path2, &[("{last_modified_time}", &now)]); + .stdout_is_templated_fixture_any(expected_test_file_path2, &valid_last_modified_template_vars(start)); } #[test] @@ -442,9 +457,9 @@ fn test_with_join_lines_option() { let test_file_2 = "test.log"; let expected_file_path = "joined.log.expected"; let mut scenario = new_ucmd!(); - let now = now_time(); + let start = Local::now(); scenario .args(&["+1:2", "-J", "-m", test_file_1, test_file_2]) .run() - .stdout_is_templated_fixture(expected_file_path, &[("{last_modified_time}", &now)]); + .stdout_is_templated_fixture_any(expected_file_path, &valid_last_modified_template_vars(start)); } From d8c8e6774ff5c66783ff875635282e7fb5468162 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 12 Jun 2021 12:35:50 +0200 Subject: [PATCH 1030/1135] tests/pr: formatting --- tests/by-util/test_pr.rs | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/tests/by-util/test_pr.rs b/tests/by-util/test_pr.rs index 2391bc37a..fb6703f28 100644 --- a/tests/by-util/test_pr.rs +++ b/tests/by-util/test_pr.rs @@ -266,7 +266,10 @@ fn test_with_stdin() { .pipe_in_fixture("stdin.log") .args(&["--pages=1:2", "-n", "-"]) .run() - .stdout_is_templated_fixture_any(expected_file_path, &valid_last_modified_template_vars(start)); + .stdout_is_templated_fixture_any( + expected_file_path, + &valid_last_modified_template_vars(start), + ); } #[test] @@ -344,13 +347,19 @@ fn test_with_mpr() { new_ucmd!() .args(&["--pages=1:2", "-m", "-n", test_file_path, test_file_path1]) .succeeds() - .stdout_is_templated_fixture_any(expected_test_file_path, &valid_last_modified_template_vars(start)); + .stdout_is_templated_fixture_any( + expected_test_file_path, + &valid_last_modified_template_vars(start), + ); let start = Local::now(); new_ucmd!() .args(&["--pages=2:4", "-m", "-n", test_file_path, test_file_path1]) .succeeds() - .stdout_is_templated_fixture_any(expected_test_file_path1, &valid_last_modified_template_vars(start)); + .stdout_is_templated_fixture_any( + expected_test_file_path1, + &valid_last_modified_template_vars(start), + ); let start = Local::now(); new_ucmd!() @@ -365,7 +374,10 @@ fn test_with_mpr() { test_file_path, ]) .succeeds() - .stdout_is_templated_fixture_any(expected_test_file_path2, &valid_last_modified_template_vars(start)); + .stdout_is_templated_fixture_any( + expected_test_file_path2, + &valid_last_modified_template_vars(start), + ); } #[test] @@ -461,5 +473,8 @@ fn test_with_join_lines_option() { scenario .args(&["+1:2", "-J", "-m", test_file_1, test_file_2]) .run() - .stdout_is_templated_fixture_any(expected_file_path, &valid_last_modified_template_vars(start)); + .stdout_is_templated_fixture_any( + expected_file_path, + &valid_last_modified_template_vars(start), + ); } From da7b02cf9d8b64d35de957124807f3a3b80c02ac Mon Sep 17 00:00:00 2001 From: Anup Mahindre Date: Sat, 12 Jun 2021 21:31:56 +0530 Subject: [PATCH 1031/1135] du: Refactor threshold handling --- src/uu/du/src/du.rs | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 39af3d7e1..e466b8afe 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -599,11 +599,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let block_size = u64::try_from(read_block_size(matches.value_of(options::BLOCK_SIZE))).unwrap(); - let threshold = match matches.value_of(options::THRESHOLD) { - Some(s) => Threshold::from_str(s) - .unwrap_or_else(|e| crash!(1, "{}", format_error_message(e, s, options::THRESHOLD))), - None => Threshold(None, false), - }; + let threshold = matches.value_of(options::THRESHOLD).map(|s| { + Threshold::from_str(s) + .unwrap_or_else(|e| crash!(1, "{}", format_error_message(e, s, options::THRESHOLD))) + }); let multiplier: u64 = if matches.is_present(options::SI) { 1000 @@ -673,7 +672,8 @@ Try '{} --help' for more information.", // See: http://linux.die.net/man/2/stat stat.blocks * 512 }; - if threshold.should_exclude(size) { + + if threshold.map_or(false, |threshold| threshold.should_exclude(size)) { continue; } @@ -743,31 +743,33 @@ Try '{} --help' for more information.", 0 } -struct Threshold(Option, bool); +#[derive(Clone, Copy)] +enum Threshold { + Lower(u64), + Upper(u64), +} impl FromStr for Threshold { type Err = ParseSizeError; fn from_str(s: &str) -> std::result::Result { - let offset = if s.starts_with('-') || s.starts_with('+') { - 1 - } else { - 0 - }; - let sz = parse_size(&s[offset..])?; + let offset = if s.starts_with(&['-', '+'][..]) { 1 } else { 0 }; - Ok(Threshold( - Some(u64::try_from(sz).unwrap()), - s.starts_with('-'), - )) + let size = u64::try_from(parse_size(&s[offset..])?).unwrap(); + + if s.starts_with('-') { + Ok(Threshold::Upper(size)) + } else { + Ok(Threshold::Lower(size)) + } } } impl Threshold { - fn should_exclude(&self, sz: u64) -> bool { + fn should_exclude(&self, size: u64) -> bool { match *self { - Threshold(Some(th), is_upper) => (is_upper && sz > th) || (!is_upper && sz < th), - Threshold(None, _) => false, + Threshold::Upper(threshold) => size > threshold, + Threshold::Lower(threshold) => size < threshold, } } } From 60124b8fbd5e620aea227aeb09f85a1a4293705c Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 13 Jun 2021 10:09:24 +0200 Subject: [PATCH 1032/1135] CICD/GNU: only run/compile tests for `id` --- .github/workflows/CICD.yml | 3 ++- .github/workflows/GNU.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 32c3537c2..42c448561 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -564,7 +564,8 @@ jobs: run: | ## Dependent VARs setup # * determine sub-crate utility list - UTILITY_LIST="$(./util/show-utils.sh ${CARGO_FEATURES_OPTION})" + # UTILITY_LIST="$(./util/show-utils.sh ${CARGO_FEATURES_OPTION})" + UTILITY_LIST="id" # TODO: remove after debugging CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo "-puu_${u}"; done;)" echo set-output name=UTILITY_LIST::${UTILITY_LIST} echo ::set-output name=CARGO_UTILITY_LIST_OPTIONS::${CARGO_UTILITY_LIST_OPTIONS} diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 1f9250900..e9227e38e 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -45,7 +45,8 @@ jobs: - name: Run GNU tests shell: bash run: | - bash uutils/util/run-gnu-test.sh + bash uutils/util/run-gnu-test.sh tests/id/uid.sh # TODO: remove after debugging + bash uutils/util/run-gnu-test.sh tests/id/zero.sh # TODO: remove after debugging - name: Extract tests info shell: bash run: | From 9af93437456fda9e50a9d577315995900b868c92 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 13 Jun 2021 10:12:00 +0200 Subject: [PATCH 1033/1135] uucore: entries: add documentation --- src/uucore/src/lib/features/entries.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/uucore/src/lib/features/entries.rs b/src/uucore/src/lib/features/entries.rs index b94abbe4f..2d5b44362 100644 --- a/src/uucore/src/lib/features/entries.rs +++ b/src/uucore/src/lib/features/entries.rs @@ -179,6 +179,13 @@ impl Passwd { self.inner } + /// This is a wrapper function for `libc::getgrouplist`. + /// + /// From: https://man7.org/linux/man-pages/man3/getgrouplist.3.html + /// If the user is a member of more than *ngroups groups, then + /// getgrouplist() returns -1. In this case, the value returned in + /// *ngroups can be used to resize the buffer passed to a further + /// call getgrouplist(). pub fn belongs_to(&self) -> Vec { let mut ngroups: c_int = 8; let mut groups = Vec::with_capacity(ngroups as usize); From 17c6f4c13a3d58a502b51d56bd3fc7416de0a998 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 13 Jun 2021 11:11:04 +0200 Subject: [PATCH 1034/1135] id: add more tests to be consistent with GNU testsuite tests (tests/id/zero.sh) --- tests/by-util/test_id.rs | 239 +++++++++++++++++++++++++++++++++------ 1 file changed, 207 insertions(+), 32 deletions(-) diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index 4823cf6d0..9e1a218ea 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -13,6 +13,8 @@ use crate::common::util::*; // fn whoami() -> String { + // Use environment variable to get current user instead of invoking `whoami` + // and fall back to user "nobody" on error. std::env::var("USER").unwrap_or_else(|e| { println!("warning: {}, using \"nobody\" instead", e); "nobody".to_string() @@ -21,12 +23,12 @@ fn whoami() -> String { #[test] #[cfg(unix)] -fn test_id_no_argument() { +fn test_id_no_specified_user() { let result = new_ucmd!().run(); let expected_result = expected_result(&[]); let mut exp_stdout = expected_result.stdout_str().to_string(); - // uu_stid does not support selinux context. Remove 'context' part from exp_stdout: + // uu_id does not support selinux context. Remove 'context' part from exp_stdout: let context_offset = expected_result .stdout_str() .find(" context") @@ -42,18 +44,63 @@ fn test_id_no_argument() { #[test] #[cfg(unix)] fn test_id_single_user() { - let args = &[&whoami()[..]]; - let result = new_ucmd!().args(args).run(); - let expected_result = expected_result(args); - result - .stdout_is(expected_result.stdout_str()) - .stderr_is(expected_result.stderr_str()) - .code_is(expected_result.code()); + let test_users = [&whoami()[..]]; + + let scene = TestScenario::new(util_name!()); + let mut exp_result = expected_result(&test_users); + scene + .ucmd() + .args(&test_users) + .run() + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); + + // u/g/G z/n + for &opt in &["--user", "--group", "--groups"] { + let mut args = vec![opt]; + args.extend_from_slice(&test_users); + exp_result = expected_result(&args); + scene + .ucmd() + .args(&args) + .run() + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); + args.push("--zero"); + exp_result = expected_result(&args); + scene + .ucmd() + .args(&args) + .run() + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); + args.push("--name"); + exp_result = expected_result(&args); + scene + .ucmd() + .args(&args) + .run() + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); + args.pop(); + exp_result = expected_result(&args); + scene + .ucmd() + .args(&args) + .run() + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); + } } #[test] #[cfg(unix)] -fn test_id_single_invalid_user() { +fn test_id_single_user_non_existing() { let args = &["hopefully_non_existing_username"]; let result = new_ucmd!().args(args).run(); let expected_result = expected_result(args); @@ -127,43 +174,164 @@ fn test_id_password_style() { assert!(result.stdout_str().starts_with(&username)); } -#[test] -#[cfg(unix)] -fn test_id_default_format() { - // TODO: These are the same tests like in test_id_zero but without --zero flag. -} - #[test] #[cfg(unix)] fn test_id_multiple_users() { // Same typical users that GNU testsuite is using. let test_users = ["root", "man", "postfix", "sshd", &whoami()]; - let result = new_ucmd!().args(&test_users).run(); - let expected_result = expected_result(&test_users); - result - .stdout_is(expected_result.stdout_str()) - .stderr_is(expected_result.stderr_str()); + let scene = TestScenario::new(util_name!()); + let mut exp_result = expected_result(&test_users); + scene + .ucmd() + .args(&test_users) + .run() + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); + + // u/g/G z/n + for &opt in &["--user", "--group", "--groups"] { + let mut args = vec![opt]; + args.extend_from_slice(&test_users); + exp_result = expected_result(&args); + scene + .ucmd() + .args(&args) + .run() + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); + args.push("--zero"); + exp_result = expected_result(&args); + scene + .ucmd() + .args(&args) + .run() + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); + args.push("--name"); + exp_result = expected_result(&args); + scene + .ucmd() + .args(&args) + .run() + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); + args.pop(); + exp_result = expected_result(&args); + scene + .ucmd() + .args(&args) + .run() + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); + } } #[test] #[cfg(unix)] -fn test_id_multiple_invalid_users() { +fn test_id_multiple_users_non_existing() { let test_users = [ "root", "hopefully_non_existing_username1", + &whoami(), "man", + "hopefully_non_existing_username2", + "hopefully_non_existing_username3", "postfix", "sshd", - "hopefully_non_existing_username2", + "hopefully_non_existing_username4", &whoami(), ]; - let result = new_ucmd!().args(&test_users).run(); - let expected_result = expected_result(&test_users); - result - .stdout_is(expected_result.stdout_str()) - .stderr_is(expected_result.stderr_str()); + let scene = TestScenario::new(util_name!()); + let mut exp_result = expected_result(&test_users); + scene + .ucmd() + .args(&test_users) + .run() + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); + + // u/g/G z/n + for &opt in &["--user", "--group", "--groups"] { + let mut args = vec![opt]; + args.extend_from_slice(&test_users); + exp_result = expected_result(&args); + scene + .ucmd() + .args(&args) + .run() + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); + args.push("--zero"); + exp_result = expected_result(&args); + scene + .ucmd() + .args(&args) + .run() + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); + args.push("--name"); + exp_result = expected_result(&args); + scene + .ucmd() + .args(&args) + .run() + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); + args.pop(); + exp_result = expected_result(&args); + scene + .ucmd() + .args(&args) + .run() + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); + } +} + +#[test] +#[cfg(unix)] +fn test_id_default_format() { + let scene = TestScenario::new(util_name!()); + for &opt1 in &["--name", "--real"] { + // id: cannot print only names or real IDs in default format + let args = [opt1]; + scene + .ucmd() + .args(&args) + .fails() + .stderr_only(expected_result(&args).stderr_str()); + for &opt2 in &["--user", "--group", "--groups"] { + // u/g/G n/r + let args = [opt2, opt1]; + let result = scene.ucmd().args(&args).run(); + let exp_result = expected_result(&args); + result + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); + } + } + for &opt2 in &["--user", "--group", "--groups"] { + // u/g/G + let args = [opt2]; + scene + .ucmd() + .args(&args) + .succeeds() + .stdout_only(expected_result(&args).stdout_str()); + } } #[test] @@ -171,6 +339,12 @@ fn test_id_multiple_invalid_users() { fn test_id_zero() { let scene = TestScenario::new(util_name!()); for z_flag in &["-z", "--zero"] { + // id: option --zero not permitted in default format + scene + .ucmd() + .args(&[z_flag]) + .fails() + .stderr_only(expected_result(&[z_flag]).stderr_str()); for &opt1 in &["--name", "--real"] { // id: cannot print only names or real IDs in default format let args = [opt1, z_flag]; @@ -183,14 +357,15 @@ fn test_id_zero() { // u/g/G n/r z let args = [opt2, z_flag, opt1]; let result = scene.ucmd().args(&args).run(); - let expected_result = expected_result(&args); + let exp_result = expected_result(&args); result - .stdout_is(expected_result.stdout_str()) - .stderr_is(expected_result.stderr_str()); + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); } } - // u/g/G z for &opt2 in &["--user", "--group", "--groups"] { + // u/g/G z let args = [opt2, z_flag]; scene .ucmd() From b4c47cc5bda717c60cf38250baea253c4eca13a2 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 13 Jun 2021 11:12:53 +0200 Subject: [PATCH 1035/1135] id: make `id` pass GNU's testssuite for "tests/id/uid.sh" and "tests/id/zero.sh" --- src/uu/id/src/id.rs | 479 ++++++++++++++++++++++++++++---------------- 1 file changed, 305 insertions(+), 174 deletions(-) diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index 570a87790..6afb23d67 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -6,15 +6,23 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. // -// Synced with: +// This was originally based on BSD's `id` +// (noticeable in functionality, usage text, options text, etc.) +// and synced with: // http://ftp-archive.freebsd.org/mirror/FreeBSD-Archive/old-releases/i386/1.0-RELEASE/ports/shellutils/src/id.c // http://www.opensource.apple.com/source/shell_cmds/shell_cmds-118/id/id.c // -// This is not based on coreutils (8.32) GNU's `id`. -// This is based on BSD's `id` (noticeable in functionality, usage text, options text, etc.) +// * This was partially rewritten in order for stdout/stderr/exit_code +// to be conform with GNU coreutils (8.32) testsuite for `id`. +// +// * This passes GNU's coreutils Testsuite (8.32.161-370c2-dirty) +// for "tests/id/uid.sh" and "tests/id/zero/sh". +// +// * Option '--zero' does not exist for BSD's `id`, therefor '--zero' is only +// allowed together with other options that are available on GNU's `id`. +// +// * Help text based on BSD's `id`. // -// Option '--zero' does not exist for BSD's `id`, therefor '--zero' is only allowed together -// with other options that are available on GNU's `id`. // spell-checker:ignore (ToDO) asid auditid auditinfo auid cstr egid emod euid getaudit getlogin gflag nflag pline rflag termid uflag gsflag zflag @@ -37,49 +45,12 @@ macro_rules! cstr2cow { }; } -#[cfg(not(target_os = "linux"))] -mod audit { - use super::libc::{c_int, c_uint, dev_t, pid_t, uid_t}; - - pub type au_id_t = uid_t; - pub type au_asid_t = pid_t; - pub type au_event_t = c_uint; - pub type au_emod_t = c_uint; - pub type au_class_t = c_int; - pub type au_flag_t = u64; - - #[repr(C)] - pub struct au_mask { - pub am_success: c_uint, - pub am_failure: c_uint, - } - pub type au_mask_t = au_mask; - - #[repr(C)] - pub struct au_tid_addr { - pub port: dev_t, - } - pub type au_tid_addr_t = au_tid_addr; - - #[repr(C)] - pub struct c_auditinfo_addr { - pub ai_auid: au_id_t, // Audit user ID - pub ai_mask: au_mask_t, // Audit masks. - pub ai_termid: au_tid_addr_t, // Terminal ID. - pub ai_asid: au_asid_t, // Audit session ID. - pub ai_flags: au_flag_t, // Audit session flags - } - pub type c_auditinfo_addr_t = c_auditinfo_addr; - - extern "C" { - pub fn getaudit(auditinfo_addr: *mut c_auditinfo_addr_t) -> c_int; - } -} - -static ABOUT: &str = "The id utility displays the user and group names and numeric IDs, of the calling process, to the standard output. If the real and effective IDs are different, both are displayed, otherwise only the real ID is displayed.\n\nIf a user (login name or user ID) is specified, the user and group IDs of that user are displayed. In this case, the real and effective IDs are assumed to be the same."; +static ABOUT: &str = "Print user and group information for each specified USER, +or (when USER omitted) for the current user."; mod options { pub const OPT_AUDIT: &str = "audit"; // GNU's id does not have this + pub const OPT_CONTEXT: &str = "context"; pub const OPT_EFFECTIVE_USER: &str = "user"; pub const OPT_GROUP: &str = "group"; pub const OPT_GROUPS: &str = "groups"; @@ -92,21 +63,76 @@ mod options { } fn get_usage() -> String { - format!("{0} [OPTION]... [USER]", executable!()) + format!("{0} [OPTION]... [USER]...", executable!()) +} + +fn get_description() -> String { + String::from( + "The id utility displays the user and group names and numeric IDs, of the \ + calling process, to the standard output. If the real and effective IDs are \ + different, both are displayed, otherwise only the real ID is displayed.\n\n\ + If a user (login name or user ID) is specified, the user and group IDs of \ + that user are displayed. In this case, the real and effective IDs are \ + assumed to be the same.", + ) +} + +struct Ids { + uid: u32, // user id + gid: u32, // group id + euid: u32, // effective uid + egid: u32, // effective gid +} + +struct State { + nflag: bool, // --name + uflag: bool, // --user + gflag: bool, // --group + gsflag: bool, // --groups + rflag: bool, // --real + zflag: bool, // --zero + ids: Option, + // The behaviour for calling GNU's `id` and calling GNU's `id $USER` is similar but different. + // * The SELinux context is only displayed without a specified user. + // * The `getgroups` system call is only used without a specified user, this causes + // the order of the displayed groups to be different between `id` and `id $USER`. + // + // Example: + // $ strace -e getgroups id -G $USER + // 1000 10 975 968 + // +++ exited with 0 +++ + // $ strace -e getgroups id -G + // getgroups(0, NULL) = 4 + // getgroups(4, [10, 968, 975, 1000]) = 4 + // 1000 10 968 975 + // +++ exited with 0 +++ + user_specified: bool, } pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); + let after_help = get_description(); let matches = App::new(executable!()) .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) + .after_help(&after_help[..]) .arg( Arg::with_name(options::OPT_AUDIT) .short("A") - .conflicts_with_all(&[options::OPT_GROUP, options::OPT_EFFECTIVE_USER, options::OPT_HUMAN_READABLE, options::OPT_PASSWORD, options::OPT_GROUPS, options::OPT_ZERO]) - .help("Display the process audit user ID and other process audit properties, which requires privilege (not available on Linux)."), + .conflicts_with_all(&[ + options::OPT_GROUP, + options::OPT_EFFECTIVE_USER, + options::OPT_HUMAN_READABLE, + options::OPT_PASSWORD, + options::OPT_GROUPS, + options::OPT_ZERO, + ]) + .help( + "Display the process audit user ID and other process audit properties,\n\ + which requires privilege (not available on Linux).", + ), ) .arg( Arg::with_name(options::OPT_EFFECTIVE_USER) @@ -125,8 +151,17 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(options::OPT_GROUPS) .short("G") .long(options::OPT_GROUPS) - .conflicts_with_all(&[options::OPT_GROUP, options::OPT_EFFECTIVE_USER, options::OPT_HUMAN_READABLE, options::OPT_PASSWORD, options::OPT_AUDIT]) - .help("Display only the different group IDs as white-space separated numbers, in no particular order."), + .conflicts_with_all(&[ + options::OPT_GROUP, + options::OPT_EFFECTIVE_USER, + options::OPT_HUMAN_READABLE, + options::OPT_PASSWORD, + options::OPT_AUDIT, + ]) + .help( + "Display only the different group IDs as white-space separated numbers, \ + in no particular order.", + ), ) .arg( Arg::with_name(options::OPT_HUMAN_READABLE) @@ -137,7 +172,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(options::OPT_NAME) .short("n") .long(options::OPT_NAME) - .help("Display the name of the user or group ID for the -G, -g and -u options instead of the number. If any of the ID numbers cannot be mapped into names, the number will be displayed as usual."), + .help( + "Display the name of the user or group ID for the -G, -g and -u options \ + instead of the number.\nIf any of the ID numbers cannot be mapped into \ + names, the number will be displayed as usual.", + ), ) .arg( Arg::with_name(options::OPT_PASSWORD) @@ -148,13 +187,25 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(options::OPT_REAL_ID) .short("r") .long(options::OPT_REAL_ID) - .help("Display the real ID for the -G, -g and -u options instead of the effective ID."), + .help( + "Display the real ID for the -G, -g and -u options instead of \ + the effective ID.", + ), ) .arg( Arg::with_name(options::OPT_ZERO) .short("z") .long(options::OPT_ZERO) - .help("delimit entries with NUL characters, not whitespace;\nnot permitted in default format"), + .help( + "delimit entries with NUL characters, not whitespace;\n\ + not permitted in default format", + ), + ) + .arg( + Arg::with_name(options::OPT_CONTEXT) + .short("Z") + .long(options::OPT_CONTEXT) + .help("NotImplemented: print only the security context of the process"), ) .arg( Arg::with_name(options::ARG_USERS) @@ -164,129 +215,173 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) .get_matches_from(args); - let nflag = matches.is_present(options::OPT_NAME); - let uflag = matches.is_present(options::OPT_EFFECTIVE_USER); - let gflag = matches.is_present(options::OPT_GROUP); - let gsflag = matches.is_present(options::OPT_GROUPS); - let rflag = matches.is_present(options::OPT_REAL_ID); - let zflag = matches.is_present(options::OPT_ZERO); - - // "default format" is when none of '-ugG' was used - // could not implement these "required" rules with just clap - if (nflag || rflag) && !(uflag || gflag || gsflag) { - crash!(1, "cannot print only names or real IDs in default format"); - } - if (zflag) && !(uflag || gflag || gsflag) { - // GNU testsuite "id/zero.sh" needs this stderr output - crash!(1, "option --zero not permitted in default format"); - } - let users: Vec = matches .values_of(options::ARG_USERS) .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); - if matches.is_present(options::OPT_AUDIT) { - auditid(); - return 0; + let mut state = State { + nflag: matches.is_present(options::OPT_NAME), + uflag: matches.is_present(options::OPT_EFFECTIVE_USER), + gflag: matches.is_present(options::OPT_GROUP), + gsflag: matches.is_present(options::OPT_GROUPS), + rflag: matches.is_present(options::OPT_REAL_ID), + zflag: matches.is_present(options::OPT_ZERO), + user_specified: !users.is_empty(), + ids: None, + }; + + let default_format = { + // "default format" is when none of '-ugG' was used + !(state.uflag || state.gflag || state.gsflag) + }; + + if (state.nflag || state.rflag) && default_format { + crash!(1, "cannot print only names or real IDs in default format"); + } + if (state.zflag) && default_format { + // NOTE: GNU testsuite "id/zero.sh" needs this stderr output: + crash!(1, "option --zero not permitted in default format"); } - let possible_pw = if users.is_empty() { - None - } else { - match Passwd::locate(users[0].as_str()) { - Ok(p) => Some(p), - Err(_) => crash!(1, "No such user/group: {}", users[0]), + let delimiter = { + if state.zflag { + "\0".to_string() + } else { + " ".to_string() + } + }; + let line_ending = { + if state.zflag { + '\0' + } else { + '\n' } }; - - let line_ending = if zflag { '\0' } else { '\n' }; let mut exit_code = 0; - if gflag { - let id = possible_pw - .map(|p| p.gid()) - .unwrap_or(if rflag { getgid() } else { getegid() }); - print!( - "{}{}", - if nflag { - entries::gid2grp(id).unwrap_or_else(|_| { - show_error!("cannot find name for group ID {}", id); + for i in 0..=users.len() { + let possible_pw = if !state.user_specified { + None + } else { + match Passwd::locate(users[i].as_str()) { + Ok(p) => Some(p), + Err(_) => { + show_error!("‘{}’: no such user", users[i]); exit_code = 1; - id.to_string() - }) - } else { - id.to_string() - }, - line_ending - ); - return exit_code; - } + if i + 1 >= users.len() { + break; + } else { + continue; + } + } + } + }; - if uflag { - let id = possible_pw - .map(|p| p.uid()) - .unwrap_or(if rflag { getuid() } else { geteuid() }); - print!( - "{}{}", - if nflag { - entries::uid2usr(id).unwrap_or_else(|_| { - show_error!("cannot find name for user ID {}", id); - exit_code = 1; - id.to_string() - }) - } else { - id.to_string() - }, - line_ending - ); - return exit_code; - } + // GNU's `id` does not support the flags: -p/-P/-A. + if matches.is_present(options::OPT_PASSWORD) { + // BSD's `id` ignores all but the first specified user + pline(possible_pw.map(|v| v.uid())); + return exit_code; + }; + if matches.is_present(options::OPT_HUMAN_READABLE) { + // BSD's `id` ignores all but the first specified user + pretty(possible_pw); + return exit_code; + } + if matches.is_present(options::OPT_AUDIT) { + // BSD's `id` ignores specified users + auditid(); + return exit_code; + } - if gsflag { - let delimiter = if zflag { "\0" } else { " " }; - let id = possible_pw - .map(|p| p.gid()) - .unwrap_or(if rflag { getgid() } else { getegid() }); - print!( - "{}{}", - possible_pw - .map(|p| p.belongs_to()) - .unwrap_or_else(|| entries::get_groups_gnu(Some(id)).unwrap()) - .iter() - .map(|&id| if nflag { - entries::gid2grp(id).unwrap_or_else(|_| { - show_error!("cannot find name for group ID {}", id); + let (uid, gid) = possible_pw.map(|p| (p.uid(), p.gid())).unwrap_or(( + if state.rflag { getuid() } else { geteuid() }, + if state.rflag { getgid() } else { getegid() }, + )); + state.ids = Some(Ids { + uid, + gid, + euid: geteuid(), + egid: getegid(), + }); + + if state.gflag { + print!( + "{}", + if state.nflag { + entries::gid2grp(gid).unwrap_or_else(|_| { + show_error!("cannot find name for group ID {}", gid); exit_code = 1; - id.to_string() + gid.to_string() }) } else { - id.to_string() - }) - .collect::>() - .join(delimiter), - line_ending - ); - return exit_code; + gid.to_string() + } + ); + } + + if state.uflag { + print!( + "{}", + if state.nflag { + entries::uid2usr(uid).unwrap_or_else(|_| { + show_error!("cannot find name for user ID {}", uid); + exit_code = 1; + uid.to_string() + }) + } else { + uid.to_string() + } + ); + } + + let groups = if state.user_specified { + possible_pw + .map(|p| p.belongs_to()) + .unwrap_or_else(|| entries::get_groups_gnu(Some(gid)).unwrap()) + } else { + entries::get_groups_gnu(Some(gid)).unwrap() + }; + + if state.gsflag { + print!( + "{}{}", + groups + .iter() + .map(|&id| { + if state.nflag { + entries::gid2grp(id).unwrap_or_else(|_| { + show_error!("cannot find name for group ID {}", id); + exit_code = 1; + id.to_string() + }) + } else { + id.to_string() + } + }) + .collect::>() + .join(&delimiter), + // NOTE: this is necessary to pass GNU's "tests/id/zero.sh": + if state.zflag && state.user_specified && users.len() > 1 { + "\0" + } else { + "" + } + ); + } + + if default_format { + id_print(&state, groups); + } + print!("{}", line_ending); + + if i + 1 >= users.len() { + break; + } } - if matches.is_present(options::OPT_PASSWORD) { - pline(possible_pw.map(|v| v.uid())); - return 0; - }; - - if matches.is_present(options::OPT_HUMAN_READABLE) { - pretty(possible_pw); - return 0; - } - - if possible_pw.is_some() { - id_print(possible_pw, false, false) - } else { - id_print(possible_pw, true, true) - } - - 0 + exit_code } fn pretty(possible_pw: Option) { @@ -399,30 +494,21 @@ fn auditid() { println!("asid={}", auditinfo.ai_asid); } -fn id_print(possible_pw: Option, p_euid: bool, p_egid: bool) { - let (uid, gid) = possible_pw - .map(|p| (p.uid(), p.gid())) - .unwrap_or((getuid(), getgid())); - - let groups = match Passwd::locate(uid) { - Ok(p) => p.belongs_to(), - Err(e) => crash!(1, "Could not find uid {}: {}", uid, e), - }; +fn id_print(state: &State, groups: Vec) { + let uid = state.ids.as_ref().unwrap().uid; + let gid = state.ids.as_ref().unwrap().gid; + let euid = state.ids.as_ref().unwrap().euid; + let egid = state.ids.as_ref().unwrap().egid; print!("uid={}({})", uid, entries::uid2usr(uid).unwrap()); print!(" gid={}({})", gid, entries::gid2grp(gid).unwrap()); - - let euid = geteuid(); - if p_euid && (euid != uid) { + if !state.user_specified && (euid != uid) { print!(" euid={}({})", euid, entries::uid2usr(euid).unwrap()); } - - let egid = getegid(); - if p_egid && (egid != gid) { + if !state.user_specified && (egid != gid) { print!(" egid={}({})", euid, entries::gid2grp(egid).unwrap()); } - - println!( + print!( " groups={}", groups .iter() @@ -430,4 +516,49 @@ fn id_print(possible_pw: Option, p_euid: bool, p_egid: bool) { .collect::>() .join(",") ); + + // placeholder ("-Z" is NotImplemented): + // if !state.user_specified { + // // print SElinux context (does not depend on "-Z") + // print!(" context={}", get_selinux_contexts().join(":")); + // } +} + +#[cfg(not(target_os = "linux"))] +mod audit { + use super::libc::{c_int, c_uint, dev_t, pid_t, uid_t}; + + pub type au_id_t = uid_t; + pub type au_asid_t = pid_t; + pub type au_event_t = c_uint; + pub type au_emod_t = c_uint; + pub type au_class_t = c_int; + pub type au_flag_t = u64; + + #[repr(C)] + pub struct au_mask { + pub am_success: c_uint, + pub am_failure: c_uint, + } + pub type au_mask_t = au_mask; + + #[repr(C)] + pub struct au_tid_addr { + pub port: dev_t, + } + pub type au_tid_addr_t = au_tid_addr; + + #[repr(C)] + pub struct c_auditinfo_addr { + pub ai_auid: au_id_t, // Audit user ID + pub ai_mask: au_mask_t, // Audit masks. + pub ai_termid: au_tid_addr_t, // Terminal ID. + pub ai_asid: au_asid_t, // Audit session ID. + pub ai_flags: au_flag_t, // Audit session flags + } + pub type c_auditinfo_addr_t = c_auditinfo_addr; + + extern "C" { + pub fn getaudit(auditinfo_addr: *mut c_auditinfo_addr_t) -> c_int; + } } From 7acb9373a62270c5baee091019da88f43ebc16b8 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Mon, 14 Jun 2021 11:10:41 +0200 Subject: [PATCH 1036/1135] kill: fix signal table printing --- src/uu/kill/src/kill.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/uu/kill/src/kill.rs b/src/uu/kill/src/kill.rs index 7965c40a9..c48864564 100644 --- a/src/uu/kill/src/kill.rs +++ b/src/uu/kill/src/kill.rs @@ -129,22 +129,15 @@ fn handle_obsolete(mut args: Vec) -> (Vec, Option) { } fn table() { - let mut name_width = 0; - /* Compute the maximum width of a signal name. */ - for s in &ALL_SIGNALS { - if s.len() > name_width { - name_width = s.len() - } - } + let name_width = ALL_SIGNALS.iter().map(|n| n.len()).max().unwrap(); for (idx, signal) in ALL_SIGNALS.iter().enumerate() { - print!("{0: >#2} {1: <#8}", idx + 1, signal); - //TODO: obtain max signal width here - + print!("{0: >#2} {1: <#2$}", idx, signal, name_width + 2); if (idx + 1) % 7 == 0 { println!(); } } + println!() } fn print_signal(signal_name_or_value: &str) { From 13458b48066c5d8476a58b04685b56ff31925046 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Mon, 14 Jun 2021 11:39:26 +0200 Subject: [PATCH 1037/1135] sort: use values_of --- src/uu/sort/src/sort.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 006664193..bc5048e11 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1272,11 +1272,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.separator = Some(separator.chars().next().unwrap()) } - if matches.is_present(options::KEY) { - for key in &matches.args[options::KEY].vals { + if let Some(values) = matches.values_of(options::KEY) { + for value in values { settings .selectors - .push(FieldSelector::parse(&key.to_string_lossy(), &settings)); + .push(FieldSelector::parse(value, &settings)); } } From 25240ba61c1e3319840b72ef3be36fc295e13412 Mon Sep 17 00:00:00 2001 From: David Suilea Date: Sat, 12 Jun 2021 13:28:21 +0200 Subject: [PATCH 1038/1135] touch: change the error message to match the GNU error message #2346 --- src/uu/touch/src/touch.rs | 10 +++++++++- tests/by-util/test_touch.rs | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index be4e51041..efa436c81 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -166,7 +166,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } if let Err(e) = File::create(path) { - show_warning!("cannot touch '{}': {}", path, e); + match e.kind() { + std::io::ErrorKind::NotFound => { + show_error!("cannot touch '{}': {}", path, "No such file or directory") + } + std::io::ErrorKind::PermissionDenied => { + show_error!("cannot touch '{}': {}", path, "Permission denied") + } + _ => show_error!("cannot touch '{}': {}", path, e), + } error_code = 1; continue; }; diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index c861a50dd..5e8114092 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -6,6 +6,7 @@ use self::touch::filetime::{self, FileTime}; extern crate time; use crate::common::util::*; +use std::path::PathBuf; fn get_file_times(at: &AtPath, path: &str) -> (FileTime, FileTime) { let m = at.metadata(path); @@ -466,3 +467,37 @@ fn test_touch_trailing_slash() { let file = "no-file/"; ucmd.args(&[file]).fails(); } + +#[test] +fn test_touch_no_such_file_error_msg() { + let dirname = "nonexistent"; + let filename = "file"; + let path = PathBuf::from(dirname).join(filename); + let path_str = path.to_str().unwrap(); + + new_ucmd!().arg(&path).fails().stderr_only(format!( + "touch: cannot touch '{}': No such file or directory", + path_str + )); +} + +#[test] +#[cfg(unix)] +fn test_touch_permission_denied_error_msg() { + let (at, mut ucmd) = at_and_ucmd!(); + + let dirname = "dir_with_read_only_access"; + let filename = "file"; + let path = PathBuf::from(dirname).join(filename); + let path_str = path.to_str().unwrap(); + + // create dest without write permissions + at.mkdir(dirname); + at.set_readonly(dirname); + + let full_path = at.plus_as_string(path_str); + ucmd.arg(&full_path).fails().stderr_only(format!( + "touch: cannot touch '{}': Permission denied", + &full_path + )); +} From 22fbf16b2c62f7688f7ba1d51de7260ed179c3cb Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Fri, 4 Jun 2021 23:16:48 -0400 Subject: [PATCH 1039/1135] test: implement user, group ownership checks closes #2337 --- src/uu/test/src/test.rs | 36 +++++++++++++++++++++------- tests/by-util/test_test.rs | 48 +++++++++++++++++++++++++++++++++++++- 2 files changed, 74 insertions(+), 10 deletions(-) diff --git a/src/uu/test/src/test.rs b/src/uu/test/src/test.rs index acf0f7eca..e30d7cf51 100644 --- a/src/uu/test/src/test.rs +++ b/src/uu/test/src/test.rs @@ -6,7 +6,7 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// spell-checker:ignore (vars) FiletestOp StrlenOp +// spell-checker:ignore (vars) egid euid FiletestOp StrlenOp mod parser; @@ -96,8 +96,10 @@ fn eval(stack: &mut Vec) -> Result { "-e" => path(&f, PathCondition::Exists), "-f" => path(&f, PathCondition::Regular), "-g" => path(&f, PathCondition::GroupIdFlag), + "-G" => path(&f, PathCondition::GroupOwns), "-h" => path(&f, PathCondition::SymLink), "-L" => path(&f, PathCondition::SymLink), + "-O" => path(&f, PathCondition::UserOwns), "-p" => path(&f, PathCondition::Fifo), "-r" => path(&f, PathCondition::Readable), "-S" => path(&f, PathCondition::Socket), @@ -166,7 +168,9 @@ enum PathCondition { Exists, Regular, GroupIdFlag, + GroupOwns, SymLink, + UserOwns, Fifo, Readable, Socket, @@ -190,18 +194,28 @@ fn path(path: &OsStr, condition: PathCondition) -> bool { Execute = 0o1, } - let perm = |metadata: Metadata, p: Permission| { + let geteuid = || { #[cfg(not(target_os = "redox"))] - let (uid, gid) = unsafe { (libc::getuid(), libc::getgid()) }; + let euid = unsafe { libc::geteuid() }; #[cfg(target_os = "redox")] - let (uid, gid) = ( - syscall::getuid().unwrap() as u32, - syscall::getgid().unwrap() as u32, - ); + let euid = syscall::geteuid().unwrap() as u32; - if uid == metadata.uid() { + euid + }; + + let getegid = || { + #[cfg(not(target_os = "redox"))] + let egid = unsafe { libc::getegid() }; + #[cfg(target_os = "redox")] + let egid = syscall::getegid().unwrap() as u32; + + egid + }; + + let perm = |metadata: Metadata, p: Permission| { + if geteuid() == metadata.uid() { metadata.mode() & ((p as u32) << 6) != 0 - } else if gid == metadata.gid() { + } else if getegid() == metadata.gid() { metadata.mode() & ((p as u32) << 3) != 0 } else { metadata.mode() & (p as u32) != 0 @@ -230,7 +244,9 @@ fn path(path: &OsStr, condition: PathCondition) -> bool { PathCondition::Exists => true, PathCondition::Regular => file_type.is_file(), PathCondition::GroupIdFlag => metadata.mode() & S_ISGID != 0, + PathCondition::GroupOwns => metadata.gid() == getegid(), PathCondition::SymLink => metadata.file_type().is_symlink(), + PathCondition::UserOwns => metadata.uid() == geteuid(), PathCondition::Fifo => file_type.is_fifo(), PathCondition::Readable => perm(metadata, Permission::Read), PathCondition::Socket => file_type.is_socket(), @@ -257,7 +273,9 @@ fn path(path: &OsStr, condition: PathCondition) -> bool { PathCondition::Exists => true, PathCondition::Regular => stat.is_file(), PathCondition::GroupIdFlag => false, + PathCondition::GroupOwns => unimplemented!(), PathCondition::SymLink => false, + PathCondition::UserOwns => unimplemented!(), PathCondition::Fifo => false, PathCondition::Readable => false, // TODO PathCondition::Socket => false, diff --git a/tests/by-util/test_test.rs b/tests/by-util/test_test.rs index aaf09d657..8d41c5ead 100644 --- a/tests/by-util/test_test.rs +++ b/tests/by-util/test_test.rs @@ -8,7 +8,7 @@ // file that was distributed with this source code. // -// spell-checker:ignore (words) pseudofloat +// spell-checker:ignore (words) egid euid pseudofloat use crate::common::util::*; @@ -476,6 +476,52 @@ fn test_nonexistent_file_is_not_symlink() { .succeeds(); } +#[test] +#[cfg(not(windows))] +fn test_file_owned_by_euid() { + new_ucmd!().args(&["-O", "regular_file"]).succeeds(); +} + +#[test] +#[cfg(not(windows))] +fn test_nonexistent_file_not_owned_by_euid() { + new_ucmd!() + .args(&["-O", "nonexistent_file"]) + .run() + .status_code(1); +} + +#[test] +#[cfg(all(not(windows), not(target_os = "freebsd")))] +fn test_file_not_owned_by_euid() { + new_ucmd!() + .args(&["-f", "/bin/sh", "-a", "!", "-O", "/bin/sh"]) + .succeeds(); +} + +#[test] +#[cfg(not(windows))] +fn test_file_owned_by_egid() { + new_ucmd!().args(&["-G", "regular_file"]).succeeds(); +} + +#[test] +#[cfg(not(windows))] +fn test_nonexistent_file_not_owned_by_egid() { + new_ucmd!() + .args(&["-G", "nonexistent_file"]) + .run() + .status_code(1); +} + +#[test] +#[cfg(all(not(windows), not(target_os = "freebsd")))] +fn test_file_not_owned_by_egid() { + new_ucmd!() + .args(&["-f", "/bin/sh", "-a", "!", "-G", "/bin/sh"]) + .succeeds(); +} + #[test] fn test_op_precedence_and_or_1() { new_ucmd!().args(&[" ", "-o", "", "-a", ""]).succeeds(); From 956ff57e2e6b1e142e1047f001d856094bdb3401 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 9 Jun 2021 17:15:57 +0200 Subject: [PATCH 1040/1135] `sort`: delete temporary files as soon as possible - When we have finished reading from a temproary file, we can immediately delete it. - Use one single directory for all temporary files. - Only create the temporary directory when needed. - Also compress temporary files created by the merge step if requested. --- src/uu/sort/src/check.rs | 12 +- src/uu/sort/src/chunks.rs | 90 +++++----- src/uu/sort/src/ext_sort.rs | 228 ++++++++++++------------ src/uu/sort/src/merge.rs | 344 ++++++++++++++++++++++++++++++------ src/uu/sort/src/sort.rs | 2 +- 5 files changed, 449 insertions(+), 227 deletions(-) diff --git a/src/uu/sort/src/check.rs b/src/uu/sort/src/check.rs index a8e5a0d9b..8e37602e1 100644 --- a/src/uu/sort/src/check.rs +++ b/src/uu/sort/src/check.rs @@ -36,7 +36,7 @@ pub fn check(path: &str, settings: &GlobalSettings) -> i32 { for _ in 0..2 { recycled_sender .send(Chunk::new(vec![0; 100 * 1024], |_| Vec::new())) - .unwrap(); + .ok(); } let mut prev_chunk: Option = None; @@ -80,12 +80,11 @@ fn reader( sender: SyncSender, settings: &GlobalSettings, ) { - let mut sender = Some(sender); let mut carry_over = vec![]; for chunk in receiver.iter() { let (recycled_lines, recycled_buffer) = chunk.recycle(); - chunks::read( - &mut sender, + let should_continue = chunks::read( + &sender, recycled_buffer, None, &mut carry_over, @@ -98,6 +97,9 @@ fn reader( }, recycled_lines, settings, - ) + ); + if !should_continue { + break; + } } } diff --git a/src/uu/sort/src/chunks.rs b/src/uu/sort/src/chunks.rs index 3d996e6d6..d452401df 100644 --- a/src/uu/sort/src/chunks.rs +++ b/src/uu/sort/src/chunks.rs @@ -52,17 +52,17 @@ impl Chunk { /// Read a chunk, parse lines and send them. /// -/// No empty chunk will be sent. If we reach the end of the input, sender_option -/// is set to None. If this function however does not set sender_option to None, -/// it is not guaranteed that there is still input left: If the input fits _exactly_ -/// into a buffer, we will only notice that there's nothing more to read at the next -/// invocation. +/// No empty chunk will be sent. If we reach the end of the input, `false` is returned. +/// However, if this function returns `true`, it is not guaranteed that there is still +/// input left: If the input fits _exactly_ into a buffer, we will only notice that there's +/// nothing more to read at the next invocation. In case there is no input left, nothing will +/// be sent. /// /// # Arguments /// /// (see also `read_to_chunk` for a more detailed documentation) /// -/// * `sender_option`: The sender to send the lines to the sorter. If `None`, this function does nothing. +/// * `sender`: The sender to send the lines to the sorter. /// * `buffer`: The recycled buffer. All contents will be overwritten, but it must already be filled. /// (i.e. `buffer.len()` should be equal to `buffer.capacity()`) /// * `max_buffer_size`: How big `buffer` can be. @@ -73,52 +73,47 @@ impl Chunk { /// * `lines`: The recycled vector to fill with lines. Must be empty. /// * `settings`: The global settings. #[allow(clippy::too_many_arguments)] -#[allow(clippy::borrowed_box)] -pub fn read( - sender_option: &mut Option>, +pub fn read( + sender: &SyncSender, mut buffer: Vec, max_buffer_size: Option, carry_over: &mut Vec, - file: &mut Box, - next_files: &mut impl Iterator>, + file: &mut T, + next_files: &mut impl Iterator, separator: u8, lines: Vec>, settings: &GlobalSettings, -) { +) -> bool { assert!(lines.is_empty()); - if let Some(sender) = sender_option { - if buffer.len() < carry_over.len() { - buffer.resize(carry_over.len() + 10 * 1024, 0); - } - buffer[..carry_over.len()].copy_from_slice(carry_over); - let (read, should_continue) = read_to_buffer( - file, - next_files, - &mut buffer, - max_buffer_size, - carry_over.len(), - separator, - ); - carry_over.clear(); - carry_over.extend_from_slice(&buffer[read..]); - - if read != 0 { - let payload = Chunk::new(buffer, |buf| { - let mut lines = unsafe { - // SAFETY: It is safe to transmute to a vector of lines with shorter lifetime, - // because it was only temporarily transmuted to a Vec> to make recycling possible. - std::mem::transmute::>, Vec>>(lines) - }; - let read = crash_if_err!(1, std::str::from_utf8(&buf[..read])); - parse_lines(read, &mut lines, separator, settings); - lines - }); - sender.send(payload).unwrap(); - } - if !should_continue { - *sender_option = None; - } + if buffer.len() < carry_over.len() { + buffer.resize(carry_over.len() + 10 * 1024, 0); } + buffer[..carry_over.len()].copy_from_slice(carry_over); + let (read, should_continue) = read_to_buffer( + file, + next_files, + &mut buffer, + max_buffer_size, + carry_over.len(), + separator, + ); + carry_over.clear(); + carry_over.extend_from_slice(&buffer[read..]); + + if read != 0 { + let payload = Chunk::new(buffer, |buf| { + let mut lines = unsafe { + // SAFETY: It is safe to transmute to a vector of lines with shorter lifetime, + // because it was only temporarily transmuted to a Vec> to make recycling possible. + std::mem::transmute::>, Vec>>(lines) + }; + let read = crash_if_err!(1, std::str::from_utf8(&buf[..read])); + parse_lines(read, &mut lines, separator, settings); + lines + }); + sender.send(payload).unwrap(); + } + should_continue } /// Split `read` into `Line`s, and add them to `lines`. @@ -165,10 +160,9 @@ fn parse_lines<'a>( /// The remaining bytes must be copied to the start of the buffer for the next invocation, /// if another invocation is necessary, which is determined by the other return value. /// * Whether this function should be called again. -#[allow(clippy::borrowed_box)] -fn read_to_buffer( - file: &mut Box, - next_files: &mut impl Iterator>, +fn read_to_buffer( + file: &mut T, + next_files: &mut impl Iterator, buffer: &mut Vec, max_buffer_size: Option, start_offset: usize, diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs index c439adcdc..7d39b13a2 100644 --- a/src/uu/sort/src/ext_sort.rs +++ b/src/uu/sort/src/ext_sort.rs @@ -12,14 +12,10 @@ //! The buffers for the individual chunks are recycled. There are two buffers. use std::cmp::Ordering; -use std::fs::File; -use std::io::BufReader; -use std::io::{BufWriter, Write}; +use std::io::Write; use std::path::Path; -use std::process::Child; -use std::process::{Command, Stdio}; +use std::path::PathBuf; use std::{ - fs::OpenOptions, io::Read, sync::mpsc::{Receiver, SyncSender}, thread, @@ -27,85 +23,91 @@ use std::{ use itertools::Itertools; -use tempfile::TempDir; - +use crate::merge::ClosedTmpFile; +use crate::merge::WriteableCompressedTmpFile; +use crate::merge::WriteablePlainTmpFile; +use crate::merge::WriteableTmpFile; use crate::Line; use crate::{ chunks::{self, Chunk}, compare_by, merge, output_sorted_lines, sort_by, GlobalSettings, }; +use tempfile::TempDir; const START_BUFFER_SIZE: usize = 8_000; /// Sort files by using auxiliary files for storing intermediate chunks (if needed), and output the result. pub fn ext_sort(files: &mut impl Iterator>, settings: &GlobalSettings) { - let tmp_dir = crash_if_err!( - 1, - tempfile::Builder::new() - .prefix("uutils_sort") - .tempdir_in(&settings.tmp_dir) - ); let (sorted_sender, sorted_receiver) = std::sync::mpsc::sync_channel(1); let (recycled_sender, recycled_receiver) = std::sync::mpsc::sync_channel(1); thread::spawn({ let settings = settings.clone(); move || sorter(recycled_receiver, sorted_sender, settings) }); - let read_result = reader_writer( + if settings.compress_prog.is_some() { + reader_writer::<_, WriteableCompressedTmpFile>( + files, + settings, + sorted_receiver, + recycled_sender, + ); + } else { + reader_writer::<_, WriteablePlainTmpFile>( + files, + settings, + sorted_receiver, + recycled_sender, + ); + } +} + +fn reader_writer>, Tmp: WriteableTmpFile + 'static>( + files: F, + settings: &GlobalSettings, + receiver: Receiver, + sender: SyncSender, +) { + let separator = if settings.zero_terminated { + b'\0' + } else { + b'\n' + }; + + // Heuristically chosen: Dividing by 10 seems to keep our memory usage roughly + // around settings.buffer_size as a whole. + let buffer_size = settings.buffer_size / 10; + let read_result: ReadResult = read_write_loop( files, - &tmp_dir, - if settings.zero_terminated { - b'\0' - } else { - b'\n' - }, + &settings.tmp_dir, + separator, // Heuristically chosen: Dividing by 10 seems to keep our memory usage roughly // around settings.buffer_size as a whole. - settings.buffer_size / 10, - settings.clone(), - sorted_receiver, - recycled_sender, + buffer_size, + &settings, + receiver, + sender, ); match read_result { - ReadResult::WroteChunksToFile { chunks_written } => { - let mut children = Vec::new(); - let files = (0..chunks_written).map(|chunk_num| { - let file_path = tmp_dir.path().join(chunk_num.to_string()); - let file = File::open(file_path).unwrap(); - if let Some(compress_prog) = &settings.compress_prog { - let mut command = Command::new(compress_prog); - command.stdin(file).stdout(Stdio::piped()).arg("-d"); - let mut child = crash_if_err!( - 2, - command.spawn().map_err(|err| format!( - "couldn't execute compress program: errno {}", - err.raw_os_error().unwrap() - )) - ); - let child_stdout = child.stdout.take().unwrap(); - children.push(child); - Box::new(BufReader::new(child_stdout)) as Box - } else { - Box::new(BufReader::new(file)) as Box - } - }); - let mut merger = merge::merge_with_file_limit(files, settings); - for child in children { - assert_child_success(child, settings.compress_prog.as_ref().unwrap()); - } - merger.write_all(settings); + ReadResult::WroteChunksToFile { tmp_files, tmp_dir } => { + let tmp_dir_size = tmp_files.len(); + let mut merger = merge::merge_with_file_limit::<_, _, Tmp>( + tmp_files.into_iter().map(|c| c.reopen()), + &settings, + Some((tmp_dir, tmp_dir_size)), + ); + merger.write_all(&settings); } ReadResult::SortedSingleChunk(chunk) => { - output_sorted_lines(chunk.borrow_lines().iter(), settings); + output_sorted_lines(chunk.borrow_lines().iter(), &settings); } ReadResult::SortedTwoChunks([a, b]) => { let merged_iter = a .borrow_lines() .iter() .merge_by(b.borrow_lines().iter(), |line_a, line_b| { - compare_by(line_a, line_b, settings) != Ordering::Greater + compare_by(line_a, line_b, &settings) != Ordering::Greater }); - output_sorted_lines(merged_iter, settings); + output_sorted_lines(merged_iter, &settings); } ReadResult::EmptyInput => { // don't output anything @@ -122,7 +124,7 @@ fn sorter(receiver: Receiver, sender: SyncSender, settings: Global } /// Describes how we read the chunks from the input. -enum ReadResult { +enum ReadResult { /// The input was empty. Nothing was read. EmptyInput, /// The input fits into a single Chunk, which was kept in memory. @@ -131,33 +133,27 @@ enum ReadResult { SortedTwoChunks([Chunk; 2]), /// The input was read into multiple chunks, which were written to auxiliary files. WroteChunksToFile { - /// The number of chunks written to auxiliary files. - chunks_written: usize, + tmp_files: Vec, + tmp_dir: TempDir, }, } - /// The function that is executed on the reader/writer thread. -/// -/// # Returns -/// * The number of chunks read. -fn reader_writer( +fn read_write_loop( mut files: impl Iterator>, - tmp_dir: &TempDir, + tmp_dir_parent: &Path, separator: u8, buffer_size: usize, - settings: GlobalSettings, + settings: &GlobalSettings, receiver: Receiver, sender: SyncSender, -) -> ReadResult { - let mut sender_option = Some(sender); - +) -> ReadResult { let mut file = files.next().unwrap(); let mut carry_over = vec![]; // kick things off with two reads for _ in 0..2 { - chunks::read( - &mut sender_option, + let should_continue = chunks::read( + &sender, vec![ 0; if START_BUFFER_SIZE < buffer_size { @@ -172,9 +168,11 @@ fn reader_writer( &mut files, separator, Vec::new(), - &settings, + settings, ); - if sender_option.is_none() { + + if !should_continue { + drop(sender); // We have already read the whole input. Since we are in our first two reads, // this means that we can fit the whole input into memory. Bypass writing below and // handle this case in a more straightforward way. @@ -190,68 +188,69 @@ fn reader_writer( } } + let tmp_dir = crash_if_err!( + 1, + tempfile::Builder::new() + .prefix("uutils_sort") + .tempdir_in(tmp_dir_parent) + ); + + let mut sender_option = Some(sender); let mut file_number = 0; + let mut tmp_files = vec![]; loop { let mut chunk = match receiver.recv() { Ok(it) => it, _ => { - return ReadResult::WroteChunksToFile { - chunks_written: file_number, - } + return ReadResult::WroteChunksToFile { tmp_files, tmp_dir }; } }; - write( + let tmp_file = write::( &mut chunk, - &tmp_dir.path().join(file_number.to_string()), + tmp_dir.path().join(file_number.to_string()), settings.compress_prog.as_deref(), separator, ); + tmp_files.push(tmp_file); file_number += 1; let (recycled_lines, recycled_buffer) = chunk.recycle(); - chunks::read( - &mut sender_option, - recycled_buffer, - None, - &mut carry_over, - &mut file, - &mut files, - separator, - recycled_lines, - &settings, - ); + if let Some(sender) = &sender_option { + let should_continue = chunks::read( + &sender, + recycled_buffer, + None, + &mut carry_over, + &mut file, + &mut files, + separator, + recycled_lines, + settings, + ); + if !should_continue { + sender_option = None; + } + } } } /// Write the lines in `chunk` to `file`, separated by `separator`. /// `compress_prog` is used to optionally compress file contents. -fn write(chunk: &mut Chunk, file: &Path, compress_prog: Option<&str>, separator: u8) { +fn write( + chunk: &mut Chunk, + file: PathBuf, + compress_prog: Option<&str>, + separator: u8, +) -> I::Closed { chunk.with_lines_mut(|lines| { // Write the lines to the file - let file = crash_if_err!(1, OpenOptions::new().create(true).write(true).open(file)); - if let Some(compress_prog) = compress_prog { - let mut command = Command::new(compress_prog); - command.stdin(Stdio::piped()).stdout(file); - let mut child = crash_if_err!( - 2, - command.spawn().map_err(|err| format!( - "couldn't execute compress program: errno {}", - err.raw_os_error().unwrap() - )) - ); - let mut writer = BufWriter::new(child.stdin.take().unwrap()); - write_lines(lines, &mut writer, separator); - writer.flush().unwrap(); - drop(writer); - assert_child_success(child, compress_prog); - } else { - let mut writer = BufWriter::new(file); - write_lines(lines, &mut writer, separator); - }; - }); + let mut tmp_file = I::create(file, compress_prog); + write_lines(lines, tmp_file.as_write(), separator); + tmp_file.finished_writing() + }) } fn write_lines<'a, T: Write>(lines: &[Line<'a>], writer: &mut T, separator: u8) { @@ -260,12 +259,3 @@ fn write_lines<'a, T: Write>(lines: &[Line<'a>], writer: &mut T, separator: u8) crash_if_err!(1, writer.write_all(&[separator])); } } - -fn assert_child_success(mut child: Child, program: &str) { - if !matches!( - child.wait().map(|e| e.code()), - Ok(Some(0)) | Ok(None) | Err(_) - ) { - crash!(2, "'{}' terminated abnormally", program) - } -} diff --git a/src/uu/sort/src/merge.rs b/src/uu/sort/src/merge.rs index 478b454b6..173faaffc 100644 --- a/src/uu/sort/src/merge.rs +++ b/src/uu/sort/src/merge.rs @@ -9,9 +9,11 @@ use std::{ cmp::Ordering, - fs::File, + fs::{self, File}, io::{BufWriter, Read, Write}, iter, + path::PathBuf, + process::{Child, ChildStdin, ChildStdout, Command, Stdio}, rc::Rc, sync::mpsc::{channel, sync_channel, Receiver, Sender, SyncSender}, thread, @@ -19,61 +21,94 @@ use std::{ use compare::Compare; use itertools::Itertools; +use tempfile::TempDir; use crate::{ chunks::{self, Chunk}, compare_by, GlobalSettings, }; -// Merge already sorted files. -pub fn merge_with_file_limit>>( - files: F, +/// Merge pre-sorted `Box`s. +/// +/// If `settings.merge_batch_size` is greater than the length of `files`, intermediate files will be used. +/// If `settings.compress_prog` is `Some`, intermediate files will be compressed with it. +pub fn merge>>( + files: Files, settings: &GlobalSettings, +) -> FileMerger { + if settings.compress_prog.is_none() { + merge_with_file_limit::<_, _, WriteablePlainTmpFile>( + files.map(|file| PlainMergeInput { inner: file }), + settings, + None, + ) + } else { + merge_with_file_limit::<_, _, WriteableCompressedTmpFile>( + files.map(|file| PlainMergeInput { inner: file }), + settings, + None, + ) + } +} + +// Merge already sorted `MergeInput`s. +pub fn merge_with_file_limit< + M: MergeInput + 'static, + F: ExactSizeIterator, + Tmp: WriteableTmpFile + 'static, +>( + files: F, + settings: &GlobalSettings, + tmp_dir: Option<(TempDir, usize)>, ) -> FileMerger { if files.len() > settings.merge_batch_size { - let tmp_dir = tempfile::Builder::new() - .prefix("uutils_sort") - .tempdir_in(&settings.tmp_dir) - .unwrap(); - let mut batch_number = 0; + // If we did not get a tmp_dir, create one. + let (tmp_dir, mut tmp_dir_size) = tmp_dir.unwrap_or_else(|| { + ( + tempfile::Builder::new() + .prefix("uutils_sort") + .tempdir_in(&settings.tmp_dir) + .unwrap(), + 0, + ) + }); let mut remaining_files = files.len(); let batches = files.chunks(settings.merge_batch_size); let mut batches = batches.into_iter(); - while batch_number + remaining_files > settings.merge_batch_size && remaining_files != 0 { + let mut temporary_files = vec![]; + while remaining_files != 0 { + // Work around the fact that `Chunks` is not an `ExactSizeIterator`. remaining_files = remaining_files.saturating_sub(settings.merge_batch_size); let mut merger = merge_without_limit(batches.next().unwrap(), settings); - let tmp_file = File::create(tmp_dir.path().join(batch_number.to_string())).unwrap(); - merger.write_all_to(settings, &mut BufWriter::new(tmp_file)); - batch_number += 1; - } - let batch_files = (0..batch_number).map(|n| { - Box::new(File::open(tmp_dir.path().join(n.to_string())).unwrap()) - as Box - }); - if batch_number > settings.merge_batch_size { - assert!(batches.next().is_none()); - merge_with_file_limit( - Box::new(batch_files) as Box>>, - settings, - ) - } else { - let final_batch = batches.next(); - assert!(batches.next().is_none()); - merge_without_limit( - batch_files.chain(final_batch.into_iter().flatten()), - settings, - ) + let mut tmp_file = Tmp::create( + tmp_dir.path().join(tmp_dir_size.to_string()), + settings.compress_prog.as_deref(), + ); + tmp_dir_size += 1; + merger.write_all_to(settings, tmp_file.as_write()); + temporary_files.push(tmp_file.finished_writing()); } + assert!(batches.next().is_none()); + merge_with_file_limit::<_, _, Tmp>( + temporary_files + .into_iter() + .map(Box::new(|c: Tmp::Closed| c.reopen()) + as Box< + dyn FnMut(Tmp::Closed) -> ::Reopened, + >), + settings, + Some((tmp_dir, tmp_dir_size)), + ) } else { merge_without_limit(files, settings) } } -/// Merge files without limiting how many files are concurrently open +/// Merge files without limiting how many files are concurrently open. /// /// It is the responsibility of the caller to ensure that `files` yields only /// as many files as we are allowed to open concurrently. -fn merge_without_limit>>( +fn merge_without_limit>( files: F, settings: &GlobalSettings, ) -> FileMerger { @@ -83,16 +118,18 @@ fn merge_without_limit>>( for (file_number, file) in files.enumerate() { let (sender, receiver) = sync_channel(2); loaded_receivers.push(receiver); - reader_files.push(ReaderFile { + reader_files.push(Some(ReaderFile { file, - sender: Some(sender), + sender, carry_over: vec![], - }); + })); + // Send the initial chunk to trigger a read for each file request_sender .send((file_number, Chunk::new(vec![0; 8 * 1024], |_| Vec::new()))) .unwrap(); } + // Send the second chunk for each file for file_number in 0..reader_files.len() { request_sender .send((file_number, Chunk::new(vec![0; 8 * 1024], |_| Vec::new()))) @@ -136,37 +173,45 @@ fn merge_without_limit>>( } } /// The struct on the reader thread representing an input file -struct ReaderFile { - file: Box, - sender: Option>, +struct ReaderFile { + file: M, + sender: SyncSender, carry_over: Vec, } /// The function running on the reader thread. fn reader( recycled_receiver: Receiver<(usize, Chunk)>, - files: &mut [ReaderFile], + files: &mut [Option>], settings: &GlobalSettings, separator: u8, ) { for (file_idx, chunk) in recycled_receiver.iter() { let (recycled_lines, recycled_buffer) = chunk.recycle(); - let ReaderFile { + if let Some(ReaderFile { file, sender, carry_over, - } = &mut files[file_idx]; - chunks::read( - sender, - recycled_buffer, - None, - carry_over, - file, - &mut iter::empty(), - separator, - recycled_lines, - settings, - ); + }) = &mut files[file_idx] + { + let should_continue = chunks::read( + sender, + recycled_buffer, + None, + carry_over, + file.as_read(), + &mut iter::empty(), + separator, + recycled_lines, + settings, + ); + if !should_continue { + // Remove the file from the list by replacing it with `None`. + let ReaderFile { file, .. } = files[file_idx].take().unwrap(); + // Depending on the kind of the `MergeInput`, this may delete the file: + file.finished_reading(); + } + } } } /// The struct on the main thread representing an input file @@ -241,11 +286,14 @@ impl<'a> FileMerger<'a> { self.heap.pop(); } } else { + // This will cause the comparison to use a different line and the heap to readjust. self.heap.peek_mut().unwrap().line_idx += 1; } if let Some(prev) = prev { if let Ok(prev_chunk) = Rc::try_unwrap(prev.chunk) { + // If nothing is referencing the previous chunk anymore, this means that the previous line + // was the last line of the chunk. We can recycle the chunk. self.request_sender .send((prev.file_number, prev_chunk)) .ok(); @@ -273,7 +321,195 @@ impl<'a> Compare for FileComparator<'a> { // as lines from a file with a lower number are to be considered "earlier". cmp = a.file_number.cmp(&b.file_number); } - // Our BinaryHeap is a max heap. We use it as a min heap, so we need to reverse the ordering. + // BinaryHeap is a max heap. We use it as a min heap, so we need to reverse the ordering. cmp.reverse() } } + +// Wait for the child to exit and check its exit code. +fn assert_child_success(mut child: Child, program: &str) { + if !matches!( + child.wait().map(|e| e.code()), + Ok(Some(0)) | Ok(None) | Err(_) + ) { + crash!(2, "'{}' terminated abnormally", program) + } +} + +/// A temporary file that can be written to. +pub trait WriteableTmpFile { + type Closed: ClosedTmpFile; + type InnerWrite: Write; + fn create(path: PathBuf, compress_prog: Option<&str>) -> Self; + /// Closes the temporary file. + fn finished_writing(self) -> Self::Closed; + fn as_write(&mut self) -> &mut Self::InnerWrite; +} +/// A temporary file that is (temporarily) closed, but can be reopened. +pub trait ClosedTmpFile { + type Reopened: MergeInput; + /// Reopens the temporary file. + fn reopen(self) -> Self::Reopened; +} +/// A pre-sorted input for merging. +pub trait MergeInput: Send { + type InnerRead: Read; + /// Cleans this `MergeInput` up. + /// Implementations may delete the backing file. + fn finished_reading(self); + fn as_read(&mut self) -> &mut Self::InnerRead; +} + +pub struct WriteablePlainTmpFile { + path: PathBuf, + file: BufWriter, +} +pub struct ClosedPlainTmpFile { + path: PathBuf, +} +pub struct PlainTmpMergeInput { + path: PathBuf, + file: File, +} +impl WriteableTmpFile for WriteablePlainTmpFile { + type Closed = ClosedPlainTmpFile; + type InnerWrite = BufWriter; + + fn create(path: PathBuf, _: Option<&str>) -> Self { + WriteablePlainTmpFile { + file: BufWriter::new(File::create(&path).unwrap()), + path, + } + } + + fn finished_writing(self) -> Self::Closed { + ClosedPlainTmpFile { path: self.path } + } + + fn as_write(&mut self) -> &mut Self::InnerWrite { + &mut self.file + } +} +impl ClosedTmpFile for ClosedPlainTmpFile { + type Reopened = PlainTmpMergeInput; + fn reopen(self) -> Self::Reopened { + PlainTmpMergeInput { + file: File::open(&self.path).unwrap(), + path: self.path, + } + } +} +impl MergeInput for PlainTmpMergeInput { + type InnerRead = File; + + fn finished_reading(self) { + fs::remove_file(self.path).ok(); + } + + fn as_read(&mut self) -> &mut Self::InnerRead { + &mut self.file + } +} + +pub struct WriteableCompressedTmpFile { + path: PathBuf, + compress_prog: String, + child: Child, + child_stdin: BufWriter, +} +pub struct ClosedCompressedTmpFile { + path: PathBuf, + compress_prog: String, +} +pub struct CompressedTmpMergeInput { + path: PathBuf, + compress_prog: String, + child: Child, + child_stdout: ChildStdout, +} +impl WriteableTmpFile for WriteableCompressedTmpFile { + type Closed = ClosedCompressedTmpFile; + type InnerWrite = BufWriter; + + fn create(path: PathBuf, compress_prog: Option<&str>) -> Self { + let compress_prog = compress_prog.unwrap(); + let mut command = Command::new(compress_prog); + command + .stdin(Stdio::piped()) + .stdout(File::create(&path).unwrap()); + let mut child = crash_if_err!( + 2, + command.spawn().map_err(|err| format!( + "couldn't execute compress program: errno {}", + err.raw_os_error().unwrap() + )) + ); + let child_stdin = child.stdin.take().unwrap(); + WriteableCompressedTmpFile { + path, + compress_prog: compress_prog.to_owned(), + child, + child_stdin: BufWriter::new(child_stdin), + } + } + + fn finished_writing(self) -> Self::Closed { + drop(self.child_stdin); + assert_child_success(self.child, &self.compress_prog); + ClosedCompressedTmpFile { + path: self.path, + compress_prog: self.compress_prog, + } + } + + fn as_write(&mut self) -> &mut Self::InnerWrite { + &mut self.child_stdin + } +} +impl ClosedTmpFile for ClosedCompressedTmpFile { + type Reopened = CompressedTmpMergeInput; + + fn reopen(self) -> Self::Reopened { + let mut command = Command::new(&self.compress_prog); + let file = File::open(&self.path).unwrap(); + command.stdin(file).stdout(Stdio::piped()).arg("-d"); + let mut child = crash_if_err!( + 2, + command.spawn().map_err(|err| format!( + "couldn't execute compress program: errno {}", + err.raw_os_error().unwrap() + )) + ); + let child_stdout = child.stdout.take().unwrap(); + CompressedTmpMergeInput { + path: self.path, + compress_prog: self.compress_prog, + child, + child_stdout, + } + } +} +impl MergeInput for CompressedTmpMergeInput { + type InnerRead = ChildStdout; + + fn finished_reading(self) { + drop(self.child_stdout); + assert_child_success(self.child, &self.compress_prog); + fs::remove_file(self.path).ok(); + } + + fn as_read(&mut self) -> &mut Self::InnerRead { + &mut self.child_stdout + } +} + +pub struct PlainMergeInput { + inner: R, +} +impl MergeInput for PlainMergeInput { + type InnerRead = R; + fn finished_reading(self) {} + fn as_read(&mut self) -> &mut Self::InnerRead { + &mut self.inner + } +} diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index bc5048e11..ccf129d39 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1313,7 +1313,7 @@ fn output_sorted_lines<'a>(iter: impl Iterator>, settings: & fn exec(files: &[String], settings: &GlobalSettings) -> i32 { if settings.merge { - let mut file_merger = merge::merge_with_file_limit(files.iter().map(open), settings); + let mut file_merger = merge::merge(files.iter().map(open), settings); file_merger.write_all(settings); } else if settings.check { if files.len() > 1 { From 6a3c1c19d9f5d8128c49e64e9389b7a2bbfee44b Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 9 Jun 2021 20:33:00 +0200 Subject: [PATCH 1041/1135] sort: remove needless allow --- src/uu/sort/src/sort.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index ccf129d39..4964f6514 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1516,8 +1516,6 @@ fn get_hash(t: &T) -> u64 { } fn random_shuffle(a: &str, b: &str, salt: &str) -> Ordering { - #![allow(clippy::comparison_chain)] - let da = get_hash(&[a, salt].concat()); let db = get_hash(&[b, salt].concat()); From 047ced2c7f2b6a44db2870ee8ca9e14d682fc954 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 9 Jun 2021 20:34:54 +0200 Subject: [PATCH 1042/1135] sort: increase default merge batch size I think we can attempt to open 32 files concurrently on all systems without risking resource exhaustion. --- src/uu/sort/src/sort.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 4964f6514..4e865b208 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -236,7 +236,7 @@ impl Default for GlobalSettings { buffer_size: DEFAULT_BUF_SIZE, tmp_dir: PathBuf::new(), compress_prog: None, - merge_batch_size: 16, + merge_batch_size: 32, } } } From 6979b707c06c5cf20174946cd7418504385adb72 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 10 Jun 2021 21:45:58 +0200 Subject: [PATCH 1043/1135] sort: fix clippy lints --- src/uu/sort/src/ext_sort.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs index 7d39b13a2..022c57741 100644 --- a/src/uu/sort/src/ext_sort.rs +++ b/src/uu/sort/src/ext_sort.rs @@ -83,7 +83,7 @@ fn reader_writer>, Tmp: WriteableTmpFile // Heuristically chosen: Dividing by 10 seems to keep our memory usage roughly // around settings.buffer_size as a whole. buffer_size, - &settings, + settings, receiver, sender, ); @@ -92,22 +92,22 @@ fn reader_writer>, Tmp: WriteableTmpFile let tmp_dir_size = tmp_files.len(); let mut merger = merge::merge_with_file_limit::<_, _, Tmp>( tmp_files.into_iter().map(|c| c.reopen()), - &settings, + settings, Some((tmp_dir, tmp_dir_size)), ); - merger.write_all(&settings); + merger.write_all(settings); } ReadResult::SortedSingleChunk(chunk) => { - output_sorted_lines(chunk.borrow_lines().iter(), &settings); + output_sorted_lines(chunk.borrow_lines().iter(), settings); } ReadResult::SortedTwoChunks([a, b]) => { let merged_iter = a .borrow_lines() .iter() .merge_by(b.borrow_lines().iter(), |line_a, line_b| { - compare_by(line_a, line_b, &settings) != Ordering::Greater + compare_by(line_a, line_b, settings) != Ordering::Greater }); - output_sorted_lines(merged_iter, &settings); + output_sorted_lines(merged_iter, settings); } ReadResult::EmptyInput => { // don't output anything @@ -220,7 +220,7 @@ fn read_write_loop( if let Some(sender) = &sender_option { let should_continue = chunks::read( - &sender, + sender, recycled_buffer, None, &mut carry_over, From 4bd556d58e0121140f28fe63aa8f80c52a12521d Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Mon, 14 Jun 2021 11:22:26 +0200 Subject: [PATCH 1044/1135] sort: better convey that the return value should be ignored --- src/uu/sort/src/check.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/uu/sort/src/check.rs b/src/uu/sort/src/check.rs index 8e37602e1..f53e4edb4 100644 --- a/src/uu/sort/src/check.rs +++ b/src/uu/sort/src/check.rs @@ -34,9 +34,7 @@ pub fn check(path: &str, settings: &GlobalSettings) -> i32 { move || reader(file, recycled_receiver, loaded_sender, &settings) }); for _ in 0..2 { - recycled_sender - .send(Chunk::new(vec![0; 100 * 1024], |_| Vec::new())) - .ok(); + let _ = recycled_sender.send(Chunk::new(vec![0; 100 * 1024], |_| Vec::new())); } let mut prev_chunk: Option = None; @@ -55,7 +53,7 @@ pub fn check(path: &str, settings: &GlobalSettings) -> i32 { } return 1; } - recycled_sender.send(prev_chunk).ok(); + let _ = recycled_sender.send(prev_chunk); } for (a, b) in chunk.borrow_lines().iter().tuple_windows() { From d4914b694344fa3c058249531362f7d688ddcaa2 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Mon, 14 Jun 2021 11:33:42 +0200 Subject: [PATCH 1045/1135] sort: add a test for --batch-size --- tests/by-util/test_sort.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index d0af7a9c9..02d9fe92d 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -897,3 +897,19 @@ fn test_merge_batches() { .succeeds() .stdout_only_fixture("ext_sort.expected"); } + +#[test] +fn test_merge_batch_size() { + new_ucmd!() + .arg("--batch-size=2") + .arg("-m") + .arg("--unique") + .arg("merge_ints_interleaved_1.txt") + .arg("merge_ints_interleaved_2.txt") + .arg("merge_ints_interleaved_3.txt") + .arg("merge_ints_interleaved_3.txt") + .arg("merge_ints_interleaved_2.txt") + .arg("merge_ints_interleaved_1.txt") + .succeeds() + .stdout_only_fixture("merge_ints_interleaved.expected"); +} From 996e1b8539456b033b3f96607f2a0a6c1afb19ea Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Tue, 15 Jun 2021 22:13:52 +0200 Subject: [PATCH 1046/1135] uucore/entries: fix `getgrouplist` wrapper to handle a bug in macOS's `getgrouplist` implementation * add documentation --- src/uucore/src/lib/features/entries.rs | 60 ++++++++++++++++++++------ src/uucore/src/lib/features/process.rs | 4 ++ 2 files changed, 50 insertions(+), 14 deletions(-) diff --git a/src/uucore/src/lib/features/entries.rs b/src/uucore/src/lib/features/entries.rs index bc4166346..6b986e616 100644 --- a/src/uucore/src/lib/features/entries.rs +++ b/src/uucore/src/lib/features/entries.rs @@ -47,6 +47,9 @@ use std::io::Result as IOResult; use std::ptr; extern "C" { + /// From: https://man7.org/linux/man-pages/man3/getgrouplist.3.html + /// > The getgrouplist() function scans the group database to obtain + /// > the list of groups that user belongs to. fn getgrouplist( name: *const c_char, gid: gid_t, @@ -55,6 +58,13 @@ extern "C" { ) -> c_int; } +/// From: https://man7.org/linux/man-pages/man2/getgroups.2.html +/// > getgroups() returns the supplementary group IDs of the calling +/// > process in list. +/// > If size is zero, list is not modified, but the total number of +/// > supplementary group IDs for the process is returned. This allows +/// > the caller to determine the size of a dynamically allocated list +/// > to be used in a further call to getgroups(). pub fn get_groups() -> IOResult> { let ngroups = unsafe { getgroups(0, ptr::null_mut()) }; if ngroups == -1 { @@ -83,17 +93,17 @@ pub fn get_groups() -> IOResult> { /// for `id --groups --real` if `gid` and `egid` are not equal. /// /// From: https://www.man7.org/linux/man-pages/man3/getgroups.3p.html -/// As implied by the definition of supplementary groups, the -/// effective group ID may appear in the array returned by -/// getgroups() or it may be returned only by getegid(). Duplication -/// may exist, but the application needs to call getegid() to be sure -/// of getting all of the information. Various implementation -/// variations and administrative sequences cause the set of groups -/// appearing in the result of getgroups() to vary in order and as to -/// whether the effective group ID is included, even when the set of -/// groups is the same (in the mathematical sense of ``set''). (The -/// history of a process and its parents could affect the details of -/// the result.) +/// > As implied by the definition of supplementary groups, the +/// > effective group ID may appear in the array returned by +/// > getgroups() or it may be returned only by getegid(). Duplication +/// > may exist, but the application needs to call getegid() to be sure +/// > of getting all of the information. Various implementation +/// > variations and administrative sequences cause the set of groups +/// > appearing in the result of getgroups() to vary in order and as to +/// > whether the effective group ID is included, even when the set of +/// > groups is the same (in the mathematical sense of ``set''). (The +/// > history of a process and its parents could affect the details of +/// > the result.) #[cfg(all(unix, feature = "process"))] pub fn get_groups_gnu(arg_id: Option) -> IOResult> { let groups = get_groups()?; @@ -184,16 +194,38 @@ impl Passwd { self.inner } + /// This is a wrapper function for `libc::getgrouplist`. + /// + /// From: https://man7.org/linux/man-pages/man3/getgrouplist.3.html + /// > If the number of groups of which user is a member is less than or + /// > equal to *ngroups, then the value *ngroups is returned. + /// > If the user is a member of more than *ngroups groups, then + /// > getgrouplist() returns -1. In this case, the value returned in + /// > *ngroups can be used to resize the buffer passed to a further + /// > call getgrouplist(). + /// + /// However, on macOS/darwin (and maybe others?) `getgrouplist` does + /// not update `ngroups` if `ngroups` is too small. Therefore, if not + /// updated by `getgrouplist`, `ngroups` needs to be increased in a + /// loop until `getgrouplist` stops returning -1. pub fn belongs_to(&self) -> Vec { let mut ngroups: c_int = 8; + let mut ngroups_old: c_int; let mut groups = Vec::with_capacity(ngroups as usize); let gid = self.inner.pw_gid; let name = self.inner.pw_name; - unsafe { - if getgrouplist(name, gid, groups.as_mut_ptr(), &mut ngroups) == -1 { + loop { + ngroups_old = ngroups; + if unsafe { getgrouplist(name, gid, groups.as_mut_ptr(), &mut ngroups) } == -1 { + if ngroups == ngroups_old { + ngroups *= 2; + } groups.resize(ngroups as usize, 0); - getgrouplist(name, gid, groups.as_mut_ptr(), &mut ngroups); + } else { + break; } + } + unsafe { groups.set_len(ngroups as usize); } groups.truncate(ngroups as usize); diff --git a/src/uucore/src/lib/features/process.rs b/src/uucore/src/lib/features/process.rs index cda41bb4f..21bfa992c 100644 --- a/src/uucore/src/lib/features/process.rs +++ b/src/uucore/src/lib/features/process.rs @@ -17,18 +17,22 @@ use std::process::ExitStatus as StdExitStatus; use std::thread; use std::time::{Duration, Instant}; +/// `geteuid()` returns the effective user ID of the calling process. pub fn geteuid() -> uid_t { unsafe { libc::geteuid() } } +/// `getegid()` returns the effective group ID of the calling process. pub fn getegid() -> gid_t { unsafe { libc::getegid() } } +/// `getgid()` returns the real group ID of the calling process. pub fn getgid() -> gid_t { unsafe { libc::getgid() } } +/// `getuid()` returns the real user ID of the calling process. pub fn getuid() -> uid_t { unsafe { libc::getuid() } } From 84affa2137feecedc997b5b865bb5690705f1599 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Tue, 15 Jun 2021 21:52:47 +0200 Subject: [PATCH 1047/1135] touch: support `@` date format parse `@` as a valid date. --- src/uu/touch/src/touch.rs | 4 ++++ tests/by-util/test_touch.rs | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index efa436c81..2e1c3c8e8 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -268,6 +268,10 @@ fn parse_date(str: &str) -> FileTime { return local_tm_to_filetime(to_local(tm)); } } + if let Ok(tm) = time::strptime(str, "@%s") { + // Don't convert to local time in this case - seconds since epoch are not time-zone dependent + return local_tm_to_filetime(tm); + } show_error!("Unable to parse date: {}\n", str); process::exit(1); } diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index 5e8114092..3ed7f3bb2 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -375,6 +375,24 @@ fn test_touch_set_date2() { assert_eq!(mtime, start_of_year); } +#[test] +fn test_touch_set_date3() { + let (at, mut ucmd) = at_and_ucmd!(); + let file = "test_touch_set_date"; + + ucmd.args(&["-d", "@1623786360", file]) + .succeeds() + .no_stderr(); + + assert!(at.file_exists(file)); + + let expected = FileTime::from_unix_time(1623786360, 0); + let (atime, mtime) = get_file_times(&at, file); + assert_eq!(atime, mtime); + assert_eq!(atime, expected); + assert_eq!(mtime, expected); +} + #[test] fn test_touch_set_date_wrong_format() { let (_at, mut ucmd) = at_and_ucmd!(); From 2a7209116d9199b03fa3aaa90e7829837591b75b Mon Sep 17 00:00:00 2001 From: Hanif Bin Ariffin Date: Sun, 13 Jun 2021 07:33:14 +0800 Subject: [PATCH 1048/1135] Fixed cp --preserve accepting no args Signed-off-by: Hanif Bin Ariffin --- src/uu/cp/src/cp.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index a87e86b98..2ebbeddb0 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -396,6 +396,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .multiple(true) .use_delimiter(true) .possible_values(PRESERVABLE_ATTRIBUTES) + .min_values(0) .value_name("ATTR_LIST") .conflicts_with_all(&[OPT_PRESERVE_DEFAULT_ATTRIBUTES, OPT_NO_PRESERVE]) // -d sets this option From 23de1811711455c6130b0115661e1d8533ebcd22 Mon Sep 17 00:00:00 2001 From: Hanif Bin Ariffin Date: Wed, 16 Jun 2021 11:32:15 +0800 Subject: [PATCH 1049/1135] Added tests for cp --preserve without args Signed-off-by: Hanif Bin Ariffin --- tests/by-util/test_cp.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index bc6c6fc79..83b199bc4 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -726,6 +726,15 @@ fn test_cp_parents_dest_not_directory() { .stderr_contains("with --parents, the destination must be a directory"); } +#[test] +fn test_cp_preserve_no_args() { + new_ucmd!() + .arg(TEST_COPY_FROM_FOLDER_FILE) + .arg(TEST_HELLO_WORLD_DEST) + .arg("--preserve") + .succeeds(); +} + #[test] // For now, disable the test on Windows. Symlinks aren't well support on Windows. // It works on Unix for now and it works locally when run from a powershell From 3c271304f5496b75e6f8f287934bf2d47a3c071f Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 16 Jun 2021 16:54:28 +0200 Subject: [PATCH 1050/1135] tty: correct exit code for wrong args --- src/uu/tty/src/tty.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/uu/tty/src/tty.rs b/src/uu/tty/src/tty.rs index edcdf091e..331f5e254 100644 --- a/src/uu/tty/src/tty.rs +++ b/src/uu/tty/src/tty.rs @@ -44,7 +44,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("print nothing, only return an exit status") .required(false), ) - .get_matches_from(args); + .get_matches_from_safe(args); + + let matches = match matches { + Ok(m) => m, + Err(e) => { + eprint!("{}", e); + return 2; + } + }; let silent = matches.is_present(options::SILENT); From aeaf2cebfb3b931a0538ad0f2ec9929180cb2ea8 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 16 Jun 2021 17:16:28 +0200 Subject: [PATCH 1051/1135] tests/tty: fix test inputs calling `pipe_in(" Date: Wed, 16 Jun 2021 17:38:07 +0200 Subject: [PATCH 1052/1135] tty: correct exit code for write errrors --- src/uu/tty/src/tty.rs | 14 +++++++++++--- tests/by-util/test_tty.rs | 9 +++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/uu/tty/src/tty.rs b/src/uu/tty/src/tty.rs index 331f5e254..cc5052dea 100644 --- a/src/uu/tty/src/tty.rs +++ b/src/uu/tty/src/tty.rs @@ -14,6 +14,7 @@ extern crate uucore; use clap::{crate_version, App, Arg}; use std::ffi::CStr; +use std::io::Write; use uucore::InvalidEncodingHandling; static ABOUT: &str = "Print the file name of the terminal connected to standard input."; @@ -66,11 +67,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } }; + let mut stdout = std::io::stdout(); + if !silent { - if !tty.chars().all(|c| c.is_whitespace()) { - println!("{}", tty); + let write_result = if !tty.chars().all(|c| c.is_whitespace()) { + writeln!(stdout, "{}", tty) } else { - println!("not a tty"); + writeln!(stdout, "not a tty") + }; + if write_result.is_err() || stdout.flush().is_err() { + // Don't return to prevent a panic later when another flush is attempted + // because the `uucore_procs::main` macro inserts a flush after execution for every utility. + std::process::exit(3); } } diff --git a/tests/by-util/test_tty.rs b/tests/by-util/test_tty.rs index a59be61b4..6ba8cd029 100644 --- a/tests/by-util/test_tty.rs +++ b/tests/by-util/test_tty.rs @@ -63,3 +63,12 @@ fn test_close_stdin_silent_alias() { fn test_wrong_argument() { new_ucmd!().args(&["a"]).fails().code_is(2); } + +#[test] +#[cfg(not(windows))] +fn test_stdout_fail() { + let mut child = new_ucmd!().run_no_wait(); + drop(child.stdout.take()); + let status = child.wait().unwrap(); + assert_eq!(status.code(), Some(3)); +} From 54cbb69d373766e884cf38778da01d8f82344ef1 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 13 Jun 2021 15:39:31 +0200 Subject: [PATCH 1053/1135] id/tests: fix tests if run on macOS --- .github/workflows/CICD.yml | 1 + .github/workflows/GNU.yml | 6 + src/uu/id/src/id.rs | 13 +-- tests/by-util/test_id.rs | 232 +++++++++++++++++++++++-------------- 4 files changed, 160 insertions(+), 92 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index a8ed1b704..fcaddd310 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -235,6 +235,7 @@ 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-16.04 , target: x86_64-unknown-linux-gnu , features: feat_os_unix , 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 diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index e9227e38e..1202de87f 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -45,8 +45,14 @@ jobs: - name: Run GNU tests shell: bash run: | + # bash uutils/util/run-gnu-test.sh + bash uutils/util/run-gnu-test.sh tests/id/context.sh # TODO: remove after debugging + sudo bash uutils/util/run-gnu-test.sh tests/id/setgid.sh # TODO: remove after debugging + bash uutils/util/run-gnu-test.sh tests/id/smack.sh # TODO: remove after debugging bash uutils/util/run-gnu-test.sh tests/id/uid.sh # TODO: remove after debugging bash uutils/util/run-gnu-test.sh tests/id/zero.sh # TODO: remove after debugging + bash uutils/util/run-gnu-test.sh tests/id/no-context.sh # TODO: remove after debugging + bash uutils/util/run-gnu-test.sh tests/id/gnu-zero-uids.sh # todo: remove after debugging - name: Extract tests info shell: bash run: | diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index 6afb23d67..35f641b3f 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -24,7 +24,7 @@ // * Help text based on BSD's `id`. // -// spell-checker:ignore (ToDO) asid auditid auditinfo auid cstr egid emod euid getaudit getlogin gflag nflag pline rflag termid uflag gsflag zflag +// spell-checker:ignore (ToDO) asid auditid auditinfo auid cstr egid emod euid getaudit getlogin gflag nflag pline rflag termid uflag gsflag zflag testsuite #![allow(non_camel_case_types)] #![allow(dead_code)] @@ -92,7 +92,7 @@ struct State { rflag: bool, // --real zflag: bool, // --zero ids: Option, - // The behaviour for calling GNU's `id` and calling GNU's `id $USER` is similar but different. + // The behavior for calling GNU's `id` and calling GNU's `id $USER` is similar but different. // * The SELinux context is only displayed without a specified user. // * The `getgroups` system call is only used without a specified user, this causes // the order of the displayed groups to be different between `id` and `id $USER`. @@ -336,12 +336,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); } + let groups = entries::get_groups_gnu(Some(gid)).unwrap(); let groups = if state.user_specified { - possible_pw - .map(|p| p.belongs_to()) - .unwrap_or_else(|| entries::get_groups_gnu(Some(gid)).unwrap()) + possible_pw.map(|p| p.belongs_to()).unwrap() } else { - entries::get_groups_gnu(Some(gid)).unwrap() + groups.clone() }; if state.gsflag { @@ -517,7 +516,7 @@ fn id_print(state: &State, groups: Vec) { .join(",") ); - // placeholder ("-Z" is NotImplemented): + // NOTE: placeholder ("-Z" is NotImplemented): // if !state.user_specified { // // print SElinux context (does not depend on "-Z") // print!(" context={}", get_selinux_contexts().join(":")); diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index 9e1a218ea..4c41e3131 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -12,11 +12,29 @@ use crate::common::util::*; // whoami: "runner" // +// spell-checker:ignore (ToDO) testsuite coreutil + +const VERSION_EXPECTED: &str = "8.30"; // 8.32 +const UUTILS_WARNING: &str = "uutils-tests-warning"; +const UUTILS_INFO: &str = "uutils-tests-info"; + +macro_rules! unwrap_or_return { + ( $e:expr ) => { + match $e { + Ok(x) => x, + Err(e) => { + println!("{}: test skipped: {}", UUTILS_INFO, e); + return; + } + } + }; +} + fn whoami() -> String { - // Use environment variable to get current user instead of invoking `whoami` - // and fall back to user "nobody" on error. + // Use environment variable to get current user instead of + // invoking `whoami` and fall back to user "nobody" on error. std::env::var("USER").unwrap_or_else(|e| { - println!("warning: {}, using \"nobody\" instead", e); + println!("{}: {}, using \"nobody\" instead", UUTILS_WARNING, e); "nobody".to_string() }) } @@ -25,20 +43,23 @@ fn whoami() -> String { #[cfg(unix)] fn test_id_no_specified_user() { let result = new_ucmd!().run(); - let expected_result = expected_result(&[]); - let mut exp_stdout = expected_result.stdout_str().to_string(); + let exp_result = unwrap_or_return!(expected_result(&[])); + let mut _exp_stdout = exp_result.stdout_str().to_string(); - // uu_id does not support selinux context. Remove 'context' part from exp_stdout: - let context_offset = expected_result - .stdout_str() - .find(" context") - .unwrap_or(exp_stdout.len()); - exp_stdout.replace_range(context_offset.., "\n"); + #[cfg(target_os = "linux")] + { + // NOTE: Strip 'context' part from exp_stdout (remove if SElinux gets added): + let context_offset = exp_result + .stdout_str() + .find(" context=") + .unwrap_or_else(|| _exp_stdout.len()); + _exp_stdout.replace_range(context_offset.., "\n"); + } result - .stdout_is(exp_stdout) - .stderr_is(expected_result.stderr_str()) - .code_is(expected_result.code()); + .stdout_is(_exp_stdout) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); } #[test] @@ -47,53 +68,53 @@ fn test_id_single_user() { let test_users = [&whoami()[..]]; let scene = TestScenario::new(util_name!()); - let mut exp_result = expected_result(&test_users); + let mut exp_result = unwrap_or_return!(expected_result(&test_users)); scene .ucmd() .args(&test_users) .run() .stdout_is(exp_result.stdout_str()) - .stderr_is(exp_result.stderr_str()) + .stderr_is(exp_result.stderr_str().replace(": Invalid argument", "")) .code_is(exp_result.code()); // u/g/G z/n for &opt in &["--user", "--group", "--groups"] { let mut args = vec![opt]; args.extend_from_slice(&test_users); - exp_result = expected_result(&args); + exp_result = unwrap_or_return!(expected_result(&args)); scene .ucmd() .args(&args) .run() .stdout_is(exp_result.stdout_str()) - .stderr_is(exp_result.stderr_str()) + .stderr_is(exp_result.stderr_str().replace(": Invalid argument", "")) .code_is(exp_result.code()); args.push("--zero"); - exp_result = expected_result(&args); + exp_result = unwrap_or_return!(expected_result(&args)); scene .ucmd() .args(&args) .run() .stdout_is(exp_result.stdout_str()) - .stderr_is(exp_result.stderr_str()) + .stderr_is(exp_result.stderr_str().replace(": Invalid argument", "")) .code_is(exp_result.code()); args.push("--name"); - exp_result = expected_result(&args); + exp_result = unwrap_or_return!(expected_result(&args)); scene .ucmd() .args(&args) .run() .stdout_is(exp_result.stdout_str()) - .stderr_is(exp_result.stderr_str()) + .stderr_is(exp_result.stderr_str().replace(": Invalid argument", "")) .code_is(exp_result.code()); args.pop(); - exp_result = expected_result(&args); + exp_result = unwrap_or_return!(expected_result(&args)); scene .ucmd() .args(&args) .run() .stdout_is(exp_result.stdout_str()) - .stderr_is(exp_result.stderr_str()) + .stderr_is(exp_result.stderr_str().replace(": Invalid argument", "")) .code_is(exp_result.code()); } } @@ -103,11 +124,16 @@ fn test_id_single_user() { fn test_id_single_user_non_existing() { let args = &["hopefully_non_existing_username"]; let result = new_ucmd!().args(args).run(); - let expected_result = expected_result(args); + let exp_result = unwrap_or_return!(expected_result(args)); + + // coreutils 8.32: $ LC_ALL=C id foobar + // macOS: stderr: "id: 'foobar': no such user: Invalid argument" + // linux: stderr: "id: 'foobar': no such user" + // It is unkown why the output on macOS is different. result - .stdout_is(expected_result.stdout_str()) - .stderr_is(expected_result.stderr_str()) - .code_is(expected_result.code()); + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str().replace(": Invalid argument", "")) + .code_is(exp_result.code()); } #[test] @@ -117,11 +143,11 @@ fn test_id_name() { for &opt in &["--user", "--group", "--groups"] { let args = [opt, "--name"]; let result = scene.ucmd().args(&args).run(); - let expected_result = expected_result(&args); + let exp_result = unwrap_or_return!(expected_result(&args)); result - .stdout_is(expected_result.stdout_str()) - .stderr_is(expected_result.stderr_str()) - .code_is(expected_result.code()); + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); if opt == "--user" { assert_eq!(result.stdout_str().trim_end(), whoami()); @@ -136,11 +162,11 @@ fn test_id_real() { for &opt in &["--user", "--group", "--groups"] { let args = [opt, "--real"]; let result = scene.ucmd().args(&args).run(); - let expected_result = expected_result(&args); + let exp_result = unwrap_or_return!(expected_result(&args)); result - .stdout_is(expected_result.stdout_str()) - .stderr_is(expected_result.stderr_str()) - .code_is(expected_result.code()); + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); } } @@ -159,7 +185,6 @@ fn test_id_pretty_print() { // stdout = // stderr = ', tests/common/util.rs:157:13 println!("test skipped:"); - return; } else { result.success().stdout_contains(username); } @@ -181,53 +206,53 @@ fn test_id_multiple_users() { let test_users = ["root", "man", "postfix", "sshd", &whoami()]; let scene = TestScenario::new(util_name!()); - let mut exp_result = expected_result(&test_users); + let mut exp_result = unwrap_or_return!(expected_result(&test_users)); scene .ucmd() .args(&test_users) .run() .stdout_is(exp_result.stdout_str()) - .stderr_is(exp_result.stderr_str()) + .stderr_is(exp_result.stderr_str().replace(": Invalid argument", "")) .code_is(exp_result.code()); // u/g/G z/n for &opt in &["--user", "--group", "--groups"] { let mut args = vec![opt]; args.extend_from_slice(&test_users); - exp_result = expected_result(&args); + exp_result = unwrap_or_return!(expected_result(&args)); scene .ucmd() .args(&args) .run() .stdout_is(exp_result.stdout_str()) - .stderr_is(exp_result.stderr_str()) + .stderr_is(exp_result.stderr_str().replace(": Invalid argument", "")) .code_is(exp_result.code()); args.push("--zero"); - exp_result = expected_result(&args); + exp_result = unwrap_or_return!(expected_result(&args)); scene .ucmd() .args(&args) .run() .stdout_is(exp_result.stdout_str()) - .stderr_is(exp_result.stderr_str()) + .stderr_is(exp_result.stderr_str().replace(": Invalid argument", "")) .code_is(exp_result.code()); args.push("--name"); - exp_result = expected_result(&args); + exp_result = unwrap_or_return!(expected_result(&args)); scene .ucmd() .args(&args) .run() .stdout_is(exp_result.stdout_str()) - .stderr_is(exp_result.stderr_str()) + .stderr_is(exp_result.stderr_str().replace(": Invalid argument", "")) .code_is(exp_result.code()); args.pop(); - exp_result = expected_result(&args); + exp_result = unwrap_or_return!(expected_result(&args)); scene .ucmd() .args(&args) .run() .stdout_is(exp_result.stdout_str()) - .stderr_is(exp_result.stderr_str()) + .stderr_is(exp_result.stderr_str().replace(": Invalid argument", "")) .code_is(exp_result.code()); } } @@ -249,53 +274,53 @@ fn test_id_multiple_users_non_existing() { ]; let scene = TestScenario::new(util_name!()); - let mut exp_result = expected_result(&test_users); + let mut exp_result = unwrap_or_return!(expected_result(&test_users)); scene .ucmd() .args(&test_users) .run() .stdout_is(exp_result.stdout_str()) - .stderr_is(exp_result.stderr_str()) + .stderr_is(exp_result.stderr_str().replace(": Invalid argument", "")) .code_is(exp_result.code()); // u/g/G z/n for &opt in &["--user", "--group", "--groups"] { let mut args = vec![opt]; args.extend_from_slice(&test_users); - exp_result = expected_result(&args); + exp_result = unwrap_or_return!(expected_result(&args)); scene .ucmd() .args(&args) .run() .stdout_is(exp_result.stdout_str()) - .stderr_is(exp_result.stderr_str()) + .stderr_is(exp_result.stderr_str().replace(": Invalid argument", "")) .code_is(exp_result.code()); args.push("--zero"); - exp_result = expected_result(&args); + exp_result = unwrap_or_return!(expected_result(&args)); scene .ucmd() .args(&args) .run() .stdout_is(exp_result.stdout_str()) - .stderr_is(exp_result.stderr_str()) + .stderr_is(exp_result.stderr_str().replace(": Invalid argument", "")) .code_is(exp_result.code()); args.push("--name"); - exp_result = expected_result(&args); + exp_result = unwrap_or_return!(expected_result(&args)); scene .ucmd() .args(&args) .run() .stdout_is(exp_result.stdout_str()) - .stderr_is(exp_result.stderr_str()) + .stderr_is(exp_result.stderr_str().replace(": Invalid argument", "")) .code_is(exp_result.code()); args.pop(); - exp_result = expected_result(&args); + exp_result = unwrap_or_return!(expected_result(&args)); scene .ucmd() .args(&args) .run() .stdout_is(exp_result.stdout_str()) - .stderr_is(exp_result.stderr_str()) + .stderr_is(exp_result.stderr_str().replace(": Invalid argument", "")) .code_is(exp_result.code()); } } @@ -311,12 +336,12 @@ fn test_id_default_format() { .ucmd() .args(&args) .fails() - .stderr_only(expected_result(&args).stderr_str()); + .stderr_only(unwrap_or_return!(expected_result(&args)).stderr_str()); for &opt2 in &["--user", "--group", "--groups"] { // u/g/G n/r let args = [opt2, opt1]; let result = scene.ucmd().args(&args).run(); - let exp_result = expected_result(&args); + let exp_result = unwrap_or_return!(expected_result(&args)); result .stdout_is(exp_result.stdout_str()) .stderr_is(exp_result.stderr_str()) @@ -330,7 +355,7 @@ fn test_id_default_format() { .ucmd() .args(&args) .succeeds() - .stdout_only(expected_result(&args).stdout_str()); + .stdout_only(unwrap_or_return!(expected_result(&args)).stdout_str()); } } @@ -344,7 +369,7 @@ fn test_id_zero() { .ucmd() .args(&[z_flag]) .fails() - .stderr_only(expected_result(&[z_flag]).stderr_str()); + .stderr_only(unwrap_or_return!(expected_result(&[z_flag])).stderr_str()); for &opt1 in &["--name", "--real"] { // id: cannot print only names or real IDs in default format let args = [opt1, z_flag]; @@ -352,12 +377,12 @@ fn test_id_zero() { .ucmd() .args(&args) .fails() - .stderr_only(expected_result(&args).stderr_str()); + .stderr_only(unwrap_or_return!(expected_result(&args)).stderr_str()); for &opt2 in &["--user", "--group", "--groups"] { // u/g/G n/r z let args = [opt2, z_flag, opt1]; let result = scene.ucmd().args(&args).run(); - let exp_result = expected_result(&args); + let exp_result = unwrap_or_return!(expected_result(&args)); result .stdout_is(exp_result.stdout_str()) .stderr_is(exp_result.stderr_str()) @@ -371,46 +396,83 @@ fn test_id_zero() { .ucmd() .args(&args) .succeeds() - .stdout_only(expected_result(&args).stdout_str()); + .stdout_only(unwrap_or_return!(expected_result(&args)).stdout_str()); } } } #[allow(clippy::needless_borrow)] #[cfg(unix)] -fn expected_result(args: &[&str]) -> CmdResult { +fn expected_result(args: &[&str]) -> Result { + // version for reference coreutil binary + #[cfg(target_os = "linux")] let util_name = util_name!(); #[cfg(all(unix, not(target_os = "linux")))] let util_name = format!("g{}", util_name!()); - let result = TestScenario::new(&util_name) + let scene = TestScenario::new(&util_name); + let version_check = scene + .cmd_keepenv(&util_name) + .env("LANGUAGE", "C") + .arg("--version") + .run(); + let version_check_string: String = version_check + .stdout_str() + .split('\n') + .collect::>() + .get(0) + .map_or_else( + || format!("{}: unexpected output format for reference coreutils '{} --version'", UUTILS_WARNING, util_name), + |s| { + if s.contains(&format!("(GNU coreutils) {}", VERSION_EXPECTED)) { + s.to_string() + } else if s.contains("(GNU coreutils)") { + // example: id (GNU coreutils) 8.32.162-4eda + let version_found = s.split_whitespace().last().unwrap()[..4].parse::().unwrap_or_default(); + let version_expected = VERSION_EXPECTED.parse::().unwrap_or_default(); + if version_found > version_expected { + format!("{}: version for the reference coreutil '{}' is higher than expected; expected: {}, found: {}", UUTILS_INFO, util_name, VERSION_EXPECTED, version_found) + } else { + format!("{}: version for the reference coreutil '{}' does not match; expected: {}, found: {}", UUTILS_WARNING, util_name, VERSION_EXPECTED, version_found) } + } else { + format!("{}: no coreutils version string found for reference coreutils '{} --version'", UUTILS_WARNING, util_name) + } + }, + ); + if version_check_string.starts_with(UUTILS_WARNING) { + return Err(version_check_string); + } + println!("{}", version_check_string); + + let result = scene .cmd_keepenv(&util_name) .env("LANGUAGE", "C") .args(args) .run(); - let mut _o = 0; - let mut _e = 0; - #[cfg(all(unix, not(target_os = "linux")))] - { - _o = if result.stdout_str().starts_with(&util_name) { - 1 - } else { - 0 - }; - _e = if result.stderr_str().starts_with(&util_name) { - 1 - } else { - 0 - }; - } + // #[cfg(all(unix, not(target_os = "linux")))] + // if cfg!(target_os = "macos") { + let (stdout, stderr): (String, String) = if cfg!(target_os = "linux") { + ( + result.stdout_str().to_string(), + result.stderr_str().to_string(), + ) + } else { + // strip 'g' prefix from results: + let from = util_name.to_string() + ":"; + let to = &from[1..]; + ( + result.stdout_str().replace(&from, to), + result.stderr_str().replace(&from, to), + ) + }; - CmdResult::new( + Ok(CmdResult::new( Some(result.tmpd()), Some(result.code()), result.succeeded(), - &result.stdout()[_o..], - &result.stderr()[_e..], - ) + stdout.as_bytes(), + stderr.as_bytes(), + )) } From 39aa5312edd768f88a8307adcfc339ae5f20c41a Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 16 Jun 2021 20:45:46 +0200 Subject: [PATCH 1054/1135] id/tests: skip tests for multiple_user feature if there's not at least coreutils `id` version 8.31 in `$PATH` --- .github/workflows/GNU.yml | 9 +--- src/uu/id/src/id.rs | 10 ++-- tests/by-util/test_id.rs | 111 +++++++++++++++++++++++--------------- 3 files changed, 76 insertions(+), 54 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 1202de87f..1f9250900 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -45,14 +45,7 @@ jobs: - name: Run GNU tests shell: bash run: | - # bash uutils/util/run-gnu-test.sh - bash uutils/util/run-gnu-test.sh tests/id/context.sh # TODO: remove after debugging - sudo bash uutils/util/run-gnu-test.sh tests/id/setgid.sh # TODO: remove after debugging - bash uutils/util/run-gnu-test.sh tests/id/smack.sh # TODO: remove after debugging - bash uutils/util/run-gnu-test.sh tests/id/uid.sh # TODO: remove after debugging - bash uutils/util/run-gnu-test.sh tests/id/zero.sh # TODO: remove after debugging - bash uutils/util/run-gnu-test.sh tests/id/no-context.sh # TODO: remove after debugging - bash uutils/util/run-gnu-test.sh tests/id/gnu-zero-uids.sh # todo: remove after debugging + bash uutils/util/run-gnu-test.sh - name: Extract tests info shell: bash run: | diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index 35f641b3f..9037745eb 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -15,13 +15,15 @@ // * This was partially rewritten in order for stdout/stderr/exit_code // to be conform with GNU coreutils (8.32) testsuite for `id`. // -// * This passes GNU's coreutils Testsuite (8.32.161-370c2-dirty) +// * This supports multiple users (a feature that was introduced in coreutils 8.31) +// +// * This passes GNU's coreutils Testsuite (8.32) // for "tests/id/uid.sh" and "tests/id/zero/sh". // -// * Option '--zero' does not exist for BSD's `id`, therefor '--zero' is only +// * Option '--zero' does not exist for BSD's `id`, therefore '--zero' is only // allowed together with other options that are available on GNU's `id`. // -// * Help text based on BSD's `id`. +// * Help text based on BSD's `id` manpage and GNU's `id` manpage. // // spell-checker:ignore (ToDO) asid auditid auditinfo auid cstr egid emod euid getaudit getlogin gflag nflag pline rflag termid uflag gsflag zflag testsuite @@ -516,7 +518,7 @@ fn id_print(state: &State, groups: Vec) { .join(",") ); - // NOTE: placeholder ("-Z" is NotImplemented): + // NOTE: (SELinux NotImplemented) placeholder: // if !state.user_specified { // // print SElinux context (does not depend on "-Z") // print!(" context={}", get_selinux_contexts().join(":")); diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index 4c41e3131..b4b929a2c 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -1,20 +1,15 @@ use crate::common::util::*; -// Apparently some CI environments have configuration issues, e.g. with 'whoami' and 'id'. -// -// From the Logs: "Build (ubuntu-18.04, x86_64-unknown-linux-gnu, feat_os_unix, use-cross)" -// whoami: cannot find name for user ID 1001 -// id --name: cannot find name for user ID 1001 -// id --name: cannot find name for group ID 116 -// -// However, when running "id" from within "/bin/bash" it looks fine: -// id: "uid=1001(runner) gid=118(docker) groups=118(docker),4(adm),101(systemd-journal)" -// whoami: "runner" -// - // spell-checker:ignore (ToDO) testsuite coreutil -const VERSION_EXPECTED: &str = "8.30"; // 8.32 +// These tests run the GNU coreutils `(g)id` binary in `$PATH` in order to gather reference values. +// If the `(g)id` in `$PATH` doesn't include a coreutils version string, +// or the version is too low, the test is skipped. + +// The reference version is 8.32. Here 8.30 was chosen because right now there's no +// ubuntu image for github action available with a higher version than 8.30. +const VERSION_EXPECTED: &str = "8.30"; // Version expected for the reference `id` in $PATH +const VERSION_MULTIPLE_USERS: &str = "8.31"; const UUTILS_WARNING: &str = "uutils-tests-warning"; const UUTILS_INFO: &str = "uutils-tests-info"; @@ -31,6 +26,17 @@ macro_rules! unwrap_or_return { } fn whoami() -> String { + // Apparently some CI environments have configuration issues, e.g. with 'whoami' and 'id'. + // + // From the Logs: "Build (ubuntu-18.04, x86_64-unknown-linux-gnu, feat_os_unix, use-cross)" + // whoami: cannot find name for user ID 1001 + // id --name: cannot find name for user ID 1001 + // id --name: cannot find name for group ID 116 + // + // However, when running "id" from within "/bin/bash" it looks fine: + // id: "uid=1001(runner) gid=118(docker) groups=118(docker),4(adm),101(systemd-journal)" + // whoami: "runner" + // Use environment variable to get current user instead of // invoking `whoami` and fall back to user "nobody" on error. std::env::var("USER").unwrap_or_else(|e| { @@ -48,12 +54,10 @@ fn test_id_no_specified_user() { #[cfg(target_os = "linux")] { - // NOTE: Strip 'context' part from exp_stdout (remove if SElinux gets added): - let context_offset = exp_result - .stdout_str() - .find(" context=") - .unwrap_or_else(|| _exp_stdout.len()); - _exp_stdout.replace_range(context_offset.., "\n"); + // NOTE: (SELinux NotImplemented) strip 'context' part from exp_stdout: + if let Some(context_offset) = exp_result.stdout_str().find(" context=") { + _exp_stdout.replace_range(context_offset.._exp_stdout.len() - 1, ""); + } } result @@ -126,10 +130,10 @@ fn test_id_single_user_non_existing() { let result = new_ucmd!().args(args).run(); let exp_result = unwrap_or_return!(expected_result(args)); + // It is unknown why on macOS (and possibly others?) `id` adds "Invalid argument". // coreutils 8.32: $ LC_ALL=C id foobar // macOS: stderr: "id: 'foobar': no such user: Invalid argument" // linux: stderr: "id: 'foobar': no such user" - // It is unkown why the output on macOS is different. result .stdout_is(exp_result.stdout_str()) .stderr_is(exp_result.stderr_str().replace(": Invalid argument", "")) @@ -202,6 +206,16 @@ fn test_id_password_style() { #[test] #[cfg(unix)] fn test_id_multiple_users() { + #[cfg(target_os = "linux")] + let util_name = util_name!(); + #[cfg(all(unix, not(target_os = "linux")))] + let util_name = &format!("g{}", util_name!()); + let version_check_string = check_coreutil_version(util_name, VERSION_MULTIPLE_USERS); + if version_check_string.starts_with(UUTILS_WARNING) { + println!("{}\ntest skipped", version_check_string); + return; + } + // Same typical users that GNU testsuite is using. let test_users = ["root", "man", "postfix", "sshd", &whoami()]; @@ -260,6 +274,16 @@ fn test_id_multiple_users() { #[test] #[cfg(unix)] fn test_id_multiple_users_non_existing() { + #[cfg(target_os = "linux")] + let util_name = util_name!(); + #[cfg(all(unix, not(target_os = "linux")))] + let util_name = &format!("g{}", util_name!()); + let version_check_string = check_coreutil_version(util_name, VERSION_MULTIPLE_USERS); + if version_check_string.starts_with(UUTILS_WARNING) { + println!("{}\ntest skipped", version_check_string); + return; + } + let test_users = [ "root", "hopefully_non_existing_username1", @@ -401,58 +425,61 @@ fn test_id_zero() { } } -#[allow(clippy::needless_borrow)] -#[cfg(unix)] -fn expected_result(args: &[&str]) -> Result { - // version for reference coreutil binary - - #[cfg(target_os = "linux")] - let util_name = util_name!(); - #[cfg(all(unix, not(target_os = "linux")))] - let util_name = format!("g{}", util_name!()); - - let scene = TestScenario::new(&util_name); +fn check_coreutil_version(util_name: &str, version_expected: &str) -> String { + // example: + // $ id --version | head -n 1 + // id (GNU coreutils) 8.32.162-4eda + let scene = TestScenario::new(util_name); let version_check = scene .cmd_keepenv(&util_name) .env("LANGUAGE", "C") .arg("--version") .run(); - let version_check_string: String = version_check + version_check .stdout_str() .split('\n') .collect::>() .get(0) .map_or_else( - || format!("{}: unexpected output format for reference coreutils '{} --version'", UUTILS_WARNING, util_name), + || format!("{}: unexpected output format for reference coreutil: '{} --version'", UUTILS_WARNING, util_name), |s| { - if s.contains(&format!("(GNU coreutils) {}", VERSION_EXPECTED)) { + if s.contains(&format!("(GNU coreutils) {}", version_expected)) { s.to_string() } else if s.contains("(GNU coreutils)") { - // example: id (GNU coreutils) 8.32.162-4eda let version_found = s.split_whitespace().last().unwrap()[..4].parse::().unwrap_or_default(); - let version_expected = VERSION_EXPECTED.parse::().unwrap_or_default(); + let version_expected = version_expected.parse::().unwrap_or_default(); if version_found > version_expected { - format!("{}: version for the reference coreutil '{}' is higher than expected; expected: {}, found: {}", UUTILS_INFO, util_name, VERSION_EXPECTED, version_found) + format!("{}: version for the reference coreutil '{}' is higher than expected; expected: {}, found: {}", UUTILS_INFO, util_name, version_expected, version_found) } else { - format!("{}: version for the reference coreutil '{}' does not match; expected: {}, found: {}", UUTILS_WARNING, util_name, VERSION_EXPECTED, version_found) } + format!("{}: version for the reference coreutil '{}' does not match; expected: {}, found: {}", UUTILS_WARNING, util_name, version_expected, version_found) } } else { format!("{}: no coreutils version string found for reference coreutils '{} --version'", UUTILS_WARNING, util_name) } }, - ); + ) +} + +#[allow(clippy::needless_borrow)] +#[cfg(unix)] +fn expected_result(args: &[&str]) -> Result { + #[cfg(target_os = "linux")] + let util_name = util_name!(); + #[cfg(all(unix, not(target_os = "linux")))] + let util_name = &format!("g{}", util_name!()); + + let version_check_string = check_coreutil_version(util_name, VERSION_EXPECTED); if version_check_string.starts_with(UUTILS_WARNING) { return Err(version_check_string); } println!("{}", version_check_string); + let scene = TestScenario::new(util_name); let result = scene - .cmd_keepenv(&util_name) + .cmd_keepenv(util_name) .env("LANGUAGE", "C") .args(args) .run(); - // #[cfg(all(unix, not(target_os = "linux")))] - // if cfg!(target_os = "macos") { let (stdout, stderr): (String, String) = if cfg!(target_os = "linux") { ( result.stdout_str().to_string(), From 816c55dce4153151ff341525678aa92c6d77d0a2 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 16 Jun 2021 12:12:57 +0200 Subject: [PATCH 1055/1135] sort: avoid sigpipe errors By calling `unwrap` we get a panic instead of an abort, and since we mute sigpipe panics for all utilites, no error message will be printed. --- src/uu/sort/src/ext_sort.rs | 4 ++-- src/uu/sort/src/sort.rs | 10 +++++----- tests/by-util/test_sort.rs | 13 +++++++++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs index 022c57741..44ff6014a 100644 --- a/src/uu/sort/src/ext_sort.rs +++ b/src/uu/sort/src/ext_sort.rs @@ -255,7 +255,7 @@ fn write( fn write_lines<'a, T: Write>(lines: &[Line<'a>], writer: &mut T, separator: u8) { for s in lines { - crash_if_err!(1, writer.write_all(s.line.as_bytes())); - crash_if_err!(1, writer.write_all(&[separator])); + writer.write_all(s.line.as_bytes()).unwrap(); + writer.write_all(&[separator]).unwrap(); } } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 4e865b208..7f3d2872e 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -384,13 +384,13 @@ impl<'a> Line<'a> { fn print(&self, writer: &mut impl Write, settings: &GlobalSettings) { if settings.zero_terminated && !settings.debug { - crash_if_err!(1, writer.write_all(self.line.as_bytes())); - crash_if_err!(1, writer.write_all(b"\0")); + writer.write_all(self.line.as_bytes()).unwrap(); + writer.write_all(b"\0").unwrap(); } else if !settings.debug { - crash_if_err!(1, writer.write_all(self.line.as_bytes())); - crash_if_err!(1, writer.write_all(b"\n")); + writer.write_all(self.line.as_bytes()).unwrap(); + writer.write_all(b"\n").unwrap(); } else { - crash_if_err!(1, self.print_debug(settings, writer)); + self.print_debug(settings, writer).unwrap(); } } diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 02d9fe92d..0f9a9d3f1 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -913,3 +913,16 @@ fn test_merge_batch_size() { .succeeds() .stdout_only_fixture("merge_ints_interleaved.expected"); } + +#[test] +fn test_sigpipe_panic() { + let mut cmd = new_ucmd!(); + let mut child = cmd.args(&["ext_sort.txt"]).run_no_wait(); + // Dropping the stdout should not lead to an error. + // The "Broken pipe" error should be silently ignored. + drop(child.stdout.take()); + assert_eq!( + String::from_utf8(child.wait_with_output().unwrap().stderr), + Ok(String::new()) + ); +} From b87387964de8fad7df636dd59e7b179b5bc63886 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 16 Jun 2021 12:28:50 +0200 Subject: [PATCH 1056/1135] core: mute all BrokenPipe errors On windows the error message does not contain `Broken pipe`, so let's try to find the error `kind` which should be `BrokenPipe` in all cases. --- src/uucore/src/lib/mods/panic.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/src/lib/mods/panic.rs b/src/uucore/src/lib/mods/panic.rs index 6947df2ac..ba0ecdf12 100644 --- a/src/uucore/src/lib/mods/panic.rs +++ b/src/uucore/src/lib/mods/panic.rs @@ -8,7 +8,7 @@ pub fn mute_sigpipe_panic() { let hook = panic::take_hook(); panic::set_hook(Box::new(move |info| { if let Some(res) = info.payload().downcast_ref::() { - if res.contains("Broken pipe") { + if res.contains("BrokenPipe") { return; } } From bc8415c9dbce3083d706eaa492c0352d8e95728d Mon Sep 17 00:00:00 2001 From: Syukron Rifail M Date: Thu, 10 Jun 2021 22:01:28 +0700 Subject: [PATCH 1057/1135] du: add --dereference --- src/uu/du/src/du.rs | 61 +++++++------- tests/by-util/test_du.rs | 80 ++++++++++++++----- .../subdir/deeper/deeper_dir/deeper_words.txt | 1 + 3 files changed, 95 insertions(+), 47 deletions(-) create mode 100644 tests/fixtures/du/subdir/deeper/deeper_dir/deeper_words.txt diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index e466b8afe..e4bac2e18 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -25,7 +25,6 @@ use std::os::unix::fs::MetadataExt; use std::os::windows::fs::MetadataExt; #[cfg(windows)] use std::os::windows::io::AsRawHandle; -#[cfg(windows)] use std::path::Path; use std::path::PathBuf; use std::str::FromStr; @@ -62,6 +61,7 @@ mod options { pub const TIME: &str = "time"; pub const TIME_STYLE: &str = "time-style"; pub const ONE_FILE_SYSTEM: &str = "one-file-system"; + pub const DEREFERENCE: &str = "dereference"; pub const FILE: &str = "FILE"; } @@ -87,6 +87,7 @@ struct Options { total: bool, separate_dirs: bool, one_file_system: bool, + dereference: bool, } #[derive(PartialEq, Eq, Hash, Clone, Copy)] @@ -107,8 +108,12 @@ struct Stat { } impl Stat { - fn new(path: PathBuf) -> Result { - let metadata = fs::symlink_metadata(&path)?; + fn new(path: PathBuf, options: &Options) -> Result { + let metadata = if options.dereference { + fs::metadata(&path)? + } else { + fs::symlink_metadata(&path)? + }; #[cfg(not(windows))] let file_info = FileInfo { @@ -279,8 +284,14 @@ fn du( for f in read { match f { - Ok(entry) => match Stat::new(entry.path()) { + Ok(entry) => match Stat::new(entry.path(), options) { Ok(this_stat) => { + if let Some(inode) = this_stat.inode { + if inodes.contains(&inode) { + continue; + } + inodes.insert(inode); + } if this_stat.is_dir { if options.one_file_system { if let (Some(this_inode), Some(my_inode)) = @@ -293,12 +304,6 @@ fn du( } futures.push(du(this_stat, options, depth + 1, inodes)); } else { - if let Some(inode) = this_stat.inode { - if inodes.contains(&inode) { - continue; - } - inodes.insert(inode); - } my_stat.size += this_stat.size; my_stat.blocks += this_stat.blocks; if options.all { @@ -308,18 +313,13 @@ fn du( } Err(error) => match error.kind() { ErrorKind::PermissionDenied => { - let description = format!( - "cannot access '{}'", - entry - .path() - .as_os_str() - .to_str() - .unwrap_or("") - ); + let description = format!("cannot access '{}'", entry.path().display()); let error_message = "Permission denied"; show_error_custom_description!(description, "{}", error_message) } - _ => show_error!("{}", error), + _ => { + show_error!("cannot access '{}': {}", entry.path().display(), error) + } }, }, Err(error) => show_error!("{}", error), @@ -327,7 +327,7 @@ fn du( } } - stats.extend(futures.into_iter().flatten().rev().filter(|stat| { + stats.extend(futures.into_iter().flatten().filter(|stat| { if !options.separate_dirs && stat.path.parent().unwrap() == my_stat.path { my_stat.size += stat.size; my_stat.blocks += stat.blocks; @@ -466,12 +466,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long("count-links") .help("count sizes many times if hard linked") ) - // .arg( - // Arg::with_name("dereference") - // .short("L") - // .long("dereference") - // .help("dereference all symbolic links") - // ) + .arg( + Arg::with_name(options::DEREFERENCE) + .short("L") + .long(options::DEREFERENCE) + .help("dereference all symbolic links") + ) // .arg( // Arg::with_name("no-dereference") // .short("P") @@ -588,12 +588,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { total: matches.is_present(options::TOTAL), separate_dirs: matches.is_present(options::SEPARATE_DIRS), one_file_system: matches.is_present(options::ONE_FILE_SYSTEM), + dereference: matches.is_present(options::DEREFERENCE), }; let files = match matches.value_of(options::FILE) { Some(_) => matches.values_of(options::FILE).unwrap().collect(), None => { - vec!["./"] // TODO: gnu `du` doesn't use trailing "/" here + vec!["."] } }; @@ -655,10 +656,12 @@ Try '{} --help' for more information.", let mut grand_total = 0; for path_string in files { let path = PathBuf::from(&path_string); - match Stat::new(path) { + match Stat::new(path, &options) { Ok(stat) => { let mut inodes: HashSet = HashSet::new(); - + if let Some(inode) = stat.inode { + inodes.insert(inode); + } let iter = du(stat, &options, 0, &mut inodes); let (_, len) = iter.size_hint(); let len = len.unwrap(); diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index 93875ae51..ffe449880 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -8,7 +8,9 @@ use crate::common::util::*; const SUB_DIR: &str = "subdir/deeper"; +const SUB_DEEPER_DIR: &str = "subdir/deeper/deeper_dir"; const SUB_DIR_LINKS: &str = "subdir/links"; +const SUB_DIR_LINKS_DEEPER_SYM_DIR: &str = "subdir/links/deeper_dir"; const SUB_FILE: &str = "subdir/links/subwords.txt"; const SUB_LINK: &str = "subdir/links/sublink.txt"; @@ -21,7 +23,7 @@ fn _du_basics(s: &str) { let answer = "32\t./subdir 8\t./subdir/deeper 24\t./subdir/links -40\t./ +40\t. "; assert_eq!(s, answer); } @@ -30,7 +32,7 @@ fn _du_basics(s: &str) { let answer = "28\t./subdir 8\t./subdir/deeper 16\t./subdir/links -36\t./ +36\t. "; assert_eq!(s, answer); } @@ -54,15 +56,15 @@ fn test_du_basics_subdir() { #[cfg(target_vendor = "apple")] fn _du_basics_subdir(s: &str) { - assert_eq!(s, "4\tsubdir/deeper\n"); + assert_eq!(s, "4\tsubdir/deeper/deeper_dir\n8\tsubdir/deeper\n"); } #[cfg(target_os = "windows")] fn _du_basics_subdir(s: &str) { - assert_eq!(s, "0\tsubdir/deeper\n"); + assert_eq!(s, "0\tsubdir/deeper\\deeper_dir\n0\tsubdir/deeper\n"); } #[cfg(target_os = "freebsd")] fn _du_basics_subdir(s: &str) { - assert_eq!(s, "8\tsubdir/deeper\n"); + assert_eq!(s, "8\tsubdir/deeper/deeper_dir\n16\tsubdir/deeper\n"); } #[cfg(all( not(target_vendor = "apple"), @@ -210,12 +212,7 @@ fn test_du_d_flag() { { let result_reference = scene.cmd("du").arg("-d1").run(); if result_reference.succeeded() { - assert_eq!( - // TODO: gnu `du` doesn't use trailing "/" here - // result.stdout_str(), result_reference.stdout_str() - result.stdout_str().trim_end_matches("/\n"), - result_reference.stdout_str().trim_end_matches('\n') - ); + assert_eq!(result.stdout_str(), result_reference.stdout_str()); return; } } @@ -224,15 +221,15 @@ fn test_du_d_flag() { #[cfg(target_vendor = "apple")] fn _du_d_flag(s: &str) { - assert_eq!(s, "16\t./subdir\n20\t./\n"); + assert_eq!(s, "20\t./subdir\n24\t.\n"); } #[cfg(target_os = "windows")] fn _du_d_flag(s: &str) { - assert_eq!(s, "8\t./subdir\n8\t./\n"); + assert_eq!(s, "8\t.\\subdir\n8\t.\n"); } #[cfg(target_os = "freebsd")] fn _du_d_flag(s: &str) { - assert_eq!(s, "28\t./subdir\n36\t./\n"); + assert_eq!(s, "36\t./subdir\n44\t.\n"); } #[cfg(all( not(target_vendor = "apple"), @@ -242,9 +239,56 @@ fn _du_d_flag(s: &str) { fn _du_d_flag(s: &str) { // MS-WSL linux has altered expected output if !uucore::os::is_wsl_1() { - assert_eq!(s, "28\t./subdir\n36\t./\n"); + assert_eq!(s, "28\t./subdir\n36\t.\n"); } else { - assert_eq!(s, "8\t./subdir\n8\t./\n"); + assert_eq!(s, "8\t./subdir\n8\t.\n"); + } +} + +#[test] +fn test_du_dereference() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.symlink_dir(SUB_DEEPER_DIR, SUB_DIR_LINKS_DEEPER_SYM_DIR); + + let result = scene.ucmd().arg("-L").arg(SUB_DIR_LINKS).succeeds(); + + #[cfg(target_os = "linux")] + { + let result_reference = scene.cmd("du").arg("-L").arg(SUB_DIR_LINKS).run(); + if result_reference.succeeded() { + assert_eq!(result.stdout_str(), result_reference.stdout_str()); + return; + } + } + + _du_dereference(result.stdout_str()); +} + +#[cfg(target_vendor = "apple")] +fn _du_dereference(s: &str) { + assert_eq!(s, "4\tsubdir/links/deeper_dir\n16\tsubdir/links\n"); +} +#[cfg(target_os = "windows")] +fn _du_dereference(s: &str) { + assert_eq!(s, "0\tsubdir/links\\deeper_dir\n8\tsubdir/links\n"); +} +#[cfg(target_os = "freebsd")] +fn _du_dereference(s: &str) { + assert_eq!(s, "8\tsubdir/links/deeper_dir\n24\tsubdir/links\n"); +} +#[cfg(all( + not(target_vendor = "apple"), + not(target_os = "windows"), + not(target_os = "freebsd") +))] +fn _du_dereference(s: &str) { + // MS-WSL linux has altered expected output + if !uucore::os::is_wsl_1() { + assert_eq!(s, "8\tsubdir/links/deeper_dir\n24\tsubdir/links\n"); + } else { + assert_eq!(s, "0\tsubdir/links/deeper_dir\n8\tsubdir/links\n"); } } @@ -366,12 +410,12 @@ fn test_du_threshold() { .arg(format!("--threshold={}", threshold)) .succeeds() .stdout_contains("links") - .stdout_does_not_contain("deeper"); + .stdout_does_not_contain("deeper_dir"); scene .ucmd() .arg(format!("--threshold=-{}", threshold)) .succeeds() .stdout_does_not_contain("links") - .stdout_contains("deeper"); + .stdout_contains("deeper_dir"); } diff --git a/tests/fixtures/du/subdir/deeper/deeper_dir/deeper_words.txt b/tests/fixtures/du/subdir/deeper/deeper_dir/deeper_words.txt new file mode 100644 index 000000000..a04238969 --- /dev/null +++ b/tests/fixtures/du/subdir/deeper/deeper_dir/deeper_words.txt @@ -0,0 +1 @@ +hello world! From c73ba1630ec116d0f170940a765538de26ba5ccf Mon Sep 17 00:00:00 2001 From: Dean Li Date: Tue, 15 Jun 2021 21:47:36 +0800 Subject: [PATCH 1058/1135] ls: set show-control-char if stdout is terminal --- src/uu/ls/src/ls.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index dc67d5738..0bffa2e52 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -382,10 +382,11 @@ impl Config { #[allow(clippy::needless_bool)] let show_control = if options.is_present(options::HIDE_CONTROL_CHARS) { false - } else if options.is_present(options::SHOW_CONTROL_CHARS) { + } else if options.is_present(options::SHOW_CONTROL_CHARS) || atty::is(atty::Stream::Stdout) + { true } else { - false // TODO: only if output is a terminal and the program is `ls` + false }; let quoting_style = if let Some(style) = options.value_of(options::QUOTING_STYLE) { From 12a1c87cb8e72f0df8b03594f425f8c98268ec1c Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 17 Jun 2021 22:26:13 +0200 Subject: [PATCH 1059/1135] cp: improve symlink handling --- src/uu/cp/src/cp.rs | 80 ++++++++++++++++++++++------------------ tests/by-util/test_cp.rs | 26 +++++++++++++ 2 files changed, 70 insertions(+), 36 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 2ebbeddb0..7e7bcca4c 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -48,7 +48,6 @@ use std::path::{Path, PathBuf, StripPrefixError}; use std::str::FromStr; use std::string::ToString; use uucore::backup_control::{self, BackupMode}; -use uucore::fs::resolve_relative_path; use uucore::fs::{canonicalize, CanonicalizeMode}; use walkdir::WalkDir; @@ -198,7 +197,6 @@ pub struct Options { copy_contents: bool, copy_mode: CopyMode, dereference: bool, - no_dereference: bool, no_target_dir: bool, one_file_system: bool, overwrite: OverwriteMode, @@ -641,11 +639,12 @@ impl Options { attributes_only: matches.is_present(OPT_ATTRIBUTES_ONLY), copy_contents: matches.is_present(OPT_COPY_CONTENTS), copy_mode: CopyMode::from_matches(matches), - dereference: matches.is_present(OPT_DEREFERENCE), // No dereference is set with -p, -d and --archive - no_dereference: matches.is_present(OPT_NO_DEREFERENCE) + dereference: !(matches.is_present(OPT_NO_DEREFERENCE) || matches.is_present(OPT_NO_DEREFERENCE_PRESERVE_LINKS) - || matches.is_present(OPT_ARCHIVE), + || matches.is_present(OPT_ARCHIVE) + || recursive) + || matches.is_present(OPT_DEREFERENCE), one_file_system: matches.is_present(OPT_ONE_FILE_SYSTEM), parents: matches.is_present(OPT_PARENTS), update: matches.is_present(OPT_UPDATE), @@ -896,7 +895,14 @@ fn copy_source( options: &Options, ) -> CopyResult<()> { let source_path = Path::new(&source); - if source_path.is_dir() { + // if no-dereference is enabled and this is a symlink, don't treat it as a directory + if source_path.is_dir() + && !(!options.dereference + && fs::symlink_metadata(source_path) + .unwrap() + .file_type() + .is_symlink()) + { // Copy as directory copy_directory(source, target, options) } else { @@ -937,7 +943,7 @@ fn copy_directory(root: &Path, target: &TargetSlice, options: &Options) -> CopyR return Err(format!("omitting directory '{}'", root.display()).into()); } - let root_path = Path::new(&root).canonicalize()?; + let root_path = env::current_dir().unwrap().join(root); let root_parent = if target.exists() { root_path.parent() @@ -958,17 +964,15 @@ fn copy_directory(root: &Path, target: &TargetSlice, options: &Options) -> CopyR #[cfg(any(windows, target_os = "redox"))] let mut hard_links: Vec<(String, u64)> = vec![]; - for path in WalkDir::new(root).same_file_system(options.one_file_system) { + for path in WalkDir::new(root) + .same_file_system(options.one_file_system) + .follow_links(options.dereference) + { let p = or_continue!(path); let is_symlink = fs::symlink_metadata(p.path())?.file_type().is_symlink(); - let path = if (options.no_dereference || options.dereference) && is_symlink { - // we are dealing with a symlink. Don't follow it - match env::current_dir() { - Ok(cwd) => cwd.join(resolve_relative_path(p.path())), - Err(e) => crash!(1, "failed to get current directory {}", e), - } - } else { - or_continue!(p.path().canonicalize()) + let path = match env::current_dir() { + Ok(cwd) => cwd.join(&p.path()), + Err(e) => crash!(1, "failed to get current directory {}", e), }; let local_to_root_parent = match root_parent { @@ -992,9 +996,10 @@ fn copy_directory(root: &Path, target: &TargetSlice, options: &Options) -> CopyR }; let local_to_target = target.join(&local_to_root_parent); - - if path.is_dir() && !local_to_target.exists() { - or_continue!(fs::create_dir_all(local_to_target.clone())); + if is_symlink && !options.dereference { + copy_link(&path, &local_to_target)?; + } else if path.is_dir() && !local_to_target.exists() { + or_continue!(fs::create_dir_all(local_to_target)); } else if !path.is_dir() { if preserve_hard_links { let mut found_hard_link = false; @@ -1220,25 +1225,10 @@ fn copy_helper(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> #[cfg(target_os = "macos")] copy_on_write_macos(source, dest, options.reflink_mode)?; - #[cfg(target_os = "linux")] copy_on_write_linux(source, dest, options.reflink_mode)?; - } else if options.no_dereference && fs::symlink_metadata(&source)?.file_type().is_symlink() { - // Here, we will copy the symlink itself (actually, just recreate it) - let link = fs::read_link(&source)?; - let dest: Cow<'_, Path> = if dest.is_dir() { - match source.file_name() { - Some(name) => dest.join(name).into(), - None => crash!( - EXIT_ERR, - "cannot stat ‘{}’: No such file or directory", - source.display() - ), - } - } else { - dest.into() - }; - symlink_file(&link, &dest, &*context_for(&link, &dest))?; + } else if !options.dereference && fs::symlink_metadata(&source)?.file_type().is_symlink() { + copy_link(source, dest)?; } else if source.to_string_lossy() == "/dev/null" { /* workaround a limitation of fs::copy * https://github.com/rust-lang/rust/issues/79390 @@ -1255,6 +1245,24 @@ fn copy_helper(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> Ok(()) } +fn copy_link(source: &Path, dest: &Path) -> CopyResult<()> { + // Here, we will copy the symlink itself (actually, just recreate it) + let link = fs::read_link(&source)?; + let dest: Cow<'_, Path> = if dest.is_dir() { + match source.file_name() { + Some(name) => dest.join(name).into(), + None => crash!( + EXIT_ERR, + "cannot stat ‘{}’: No such file or directory", + source.display() + ), + } + } else { + dest.into() + }; + symlink_file(&link, &dest, &*context_for(&link, &dest)) +} + /// Copies `source` to `dest` using copy-on-write if possible. #[cfg(target_os = "linux")] fn copy_on_write_linux(source: &Path, dest: &Path, mode: ReflinkMode) -> CopyResult<()> { diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 83b199bc4..4ce587e02 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1299,3 +1299,29 @@ fn test_closes_file_descriptors() { .with_limit(Resource::NOFILE, 9, 9) .succeeds(); } + +#[test] +fn test_copy_dir_symlink() { + let (at, mut ucmd) = at_and_ucmd!(); + at.mkdir("dir"); + at.symlink_dir("dir", "dir-link"); + ucmd.args(&["-r", "dir-link", "copy"]).succeeds(); + assert_eq!(at.resolve_link("copy"), "dir"); +} + +#[test] +fn test_copy_dir_with_symlinks() { + let (at, mut ucmd) = at_and_ucmd!(); + at.mkdir("dir"); + at.make_file("dir/file"); + + TestScenario::new("ln") + .ucmd() + .arg("-sr") + .arg(at.subdir.join("dir/file")) + .arg(at.subdir.join("dir/file-link")) + .succeeds(); + + ucmd.args(&["-r", "dir", "copy"]).succeeds(); + assert_eq!(at.resolve_link("copy/file-link"), "file"); +} From d05964a8cbb4b8e695a978b2fbd4ef6c0555b03c Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Thu, 17 Jun 2021 21:15:26 +0300 Subject: [PATCH 1060/1135] test: Implement -k parser.rs already accepts this, finish the implementation. --- src/uu/test/src/test.rs | 5 +++++ tests/by-util/test_test.rs | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/uu/test/src/test.rs b/src/uu/test/src/test.rs index e30d7cf51..5f20b95f0 100644 --- a/src/uu/test/src/test.rs +++ b/src/uu/test/src/test.rs @@ -98,6 +98,7 @@ fn eval(stack: &mut Vec) -> Result { "-g" => path(&f, PathCondition::GroupIdFlag), "-G" => path(&f, PathCondition::GroupOwns), "-h" => path(&f, PathCondition::SymLink), + "-k" => path(&f, PathCondition::Sticky), "-L" => path(&f, PathCondition::SymLink), "-O" => path(&f, PathCondition::UserOwns), "-p" => path(&f, PathCondition::Fifo), @@ -170,6 +171,7 @@ enum PathCondition { GroupIdFlag, GroupOwns, SymLink, + Sticky, UserOwns, Fifo, Readable, @@ -187,6 +189,7 @@ fn path(path: &OsStr, condition: PathCondition) -> bool { const S_ISUID: u32 = 0o4000; const S_ISGID: u32 = 0o2000; + const S_ISVTX: u32 = 0o1000; enum Permission { Read = 0o4, @@ -246,6 +249,7 @@ fn path(path: &OsStr, condition: PathCondition) -> bool { PathCondition::GroupIdFlag => metadata.mode() & S_ISGID != 0, PathCondition::GroupOwns => metadata.gid() == getegid(), PathCondition::SymLink => metadata.file_type().is_symlink(), + PathCondition::Sticky => metadata.mode() & S_ISVTX != 0, PathCondition::UserOwns => metadata.uid() == geteuid(), PathCondition::Fifo => file_type.is_fifo(), PathCondition::Readable => perm(metadata, Permission::Read), @@ -275,6 +279,7 @@ fn path(path: &OsStr, condition: PathCondition) -> bool { PathCondition::GroupIdFlag => false, PathCondition::GroupOwns => unimplemented!(), PathCondition::SymLink => false, + PathCondition::Sticky => false, PathCondition::UserOwns => unimplemented!(), PathCondition::Fifo => false, PathCondition::Readable => false, // TODO diff --git a/tests/by-util/test_test.rs b/tests/by-util/test_test.rs index 8d41c5ead..c4964d6bf 100644 --- a/tests/by-util/test_test.rs +++ b/tests/by-util/test_test.rs @@ -476,6 +476,27 @@ fn test_nonexistent_file_is_not_symlink() { .succeeds(); } +#[test] +#[cfg(not(windows))] // Windows has no concept of sticky bit +fn test_file_is_sticky() { + let scenario = TestScenario::new(util_name!()); + let mut ucmd = scenario.ucmd(); + let mut chmod = scenario.cmd("chmod"); + + scenario.fixtures.touch("sticky_file"); + chmod.args(&["+t", "sticky_file"]).succeeds(); + + ucmd.args(&["-k", "sticky_file"]).succeeds(); +} + +#[test] +fn test_file_is_not_sticky() { + new_ucmd!() + .args(&["-k", "regular_file"]) + .run() + .status_code(1); +} + #[test] #[cfg(not(windows))] fn test_file_owned_by_euid() { From 315bfd65a3f07221abdb262ba8731d364441e581 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 18 Jun 2021 11:42:37 +0200 Subject: [PATCH 1061/1135] cp: move symlink check to the right place --- src/uu/cp/src/cp.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 7e7bcca4c..8f47adc28 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -895,14 +895,7 @@ fn copy_source( options: &Options, ) -> CopyResult<()> { let source_path = Path::new(&source); - // if no-dereference is enabled and this is a symlink, don't treat it as a directory - if source_path.is_dir() - && !(!options.dereference - && fs::symlink_metadata(source_path) - .unwrap() - .file_type() - .is_symlink()) - { + if source_path.is_dir() { // Copy as directory copy_directory(source, target, options) } else { @@ -943,6 +936,11 @@ fn copy_directory(root: &Path, target: &TargetSlice, options: &Options) -> CopyR return Err(format!("omitting directory '{}'", root.display()).into()); } + // if no-dereference is enabled and this is a symlink, copy it as a file + if !options.dereference && fs::symlink_metadata(root).unwrap().file_type().is_symlink() { + return copy_file(root, target, options); + } + let root_path = env::current_dir().unwrap().join(root); let root_parent = if target.exists() { From 32526e30486613b3e83840331856ae08177dff7a Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 18 Jun 2021 11:45:04 +0200 Subject: [PATCH 1062/1135] cp: one more clippy fix --- src/uu/cp/src/cp.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 8f47adc28..c1d5e0ee3 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1397,9 +1397,9 @@ pub fn paths_refer_to_same_file(p1: &Path, p2: &Path) -> io::Result { fn test_cp_localize_to_target() { assert!( localize_to_target( - &Path::new("a/source/"), - &Path::new("a/source/c.txt"), - &Path::new("target/") + Path::new("a/source/"), + Path::new("a/source/c.txt"), + Path::new("target/") ) .unwrap() == Path::new("target/c.txt") From a371c034311b17a66460605a786565307791ac46 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 18 Jun 2021 11:48:13 +0200 Subject: [PATCH 1063/1135] cp: only get the current directory once --- src/uu/cp/src/cp.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index c1d5e0ee3..a7694ae08 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -941,7 +941,10 @@ fn copy_directory(root: &Path, target: &TargetSlice, options: &Options) -> CopyR return copy_file(root, target, options); } - let root_path = env::current_dir().unwrap().join(root); + let current_dir = + env::current_dir().unwrap_or_else(|e| crash!(1, "failed to get current directory {}", e)); + + let root_path = current_dir.join(root); let root_parent = if target.exists() { root_path.parent() @@ -968,10 +971,7 @@ fn copy_directory(root: &Path, target: &TargetSlice, options: &Options) -> CopyR { let p = or_continue!(path); let is_symlink = fs::symlink_metadata(p.path())?.file_type().is_symlink(); - let path = match env::current_dir() { - Ok(cwd) => cwd.join(&p.path()), - Err(e) => crash!(1, "failed to get current directory {}", e), - }; + let path = current_dir.join(&p.path()); let local_to_root_parent = match root_parent { Some(parent) => { From 3d3af5c8caa2a28977a75c2ad2d69942203fa442 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 17 Jun 2021 22:54:04 +0200 Subject: [PATCH 1064/1135] ln: don't return an empty path in `relative_path` --- src/uu/ln/src/ln.rs | 5 ++++- tests/by-util/test_ln.rs | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index ce1dd15b0..29cab58e5 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -382,12 +382,15 @@ fn relative_path<'a>(src: &Path, dst: &Path) -> Result> { let src_iter = src_abs.components().skip(suffix_pos).map(|x| x.as_os_str()); - let result: PathBuf = dst_abs + let mut result: PathBuf = dst_abs .components() .skip(suffix_pos + 1) .map(|_| OsStr::new("..")) .chain(src_iter) .collect(); + if result.as_os_str().is_empty() { + result.push("."); + } Ok(result.into()) } diff --git a/tests/by-util/test_ln.rs b/tests/by-util/test_ln.rs index fc97ff779..9fa73c0bc 100644 --- a/tests/by-util/test_ln.rs +++ b/tests/by-util/test_ln.rs @@ -580,3 +580,11 @@ fn test_relative_src_already_symlink() { ucmd.arg("-sr").arg("file2").arg("file3").succeeds(); assert!(at.resolve_link("file3").ends_with("file1")); } + +#[test] +fn test_relative_recursive() { + let (at, mut ucmd) = at_and_ucmd!(); + at.mkdir("dir"); + ucmd.args(&["-sr", "dir", "dir/recursive"]).succeeds(); + assert_eq!(at.resolve_link("dir/recursive"), "."); +} From 65f47be5ee260f8a0ce7747239a7fde8ccb59a83 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 18 Jun 2021 12:10:40 +0200 Subject: [PATCH 1065/1135] cut: fix `-d=` (#2424) --- src/uu/cut/src/cut.rs | 11 ++++++++++- tests/by-util/test_cut.rs | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index af4a27d8a..6602b1eb1 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -531,7 +531,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let zero_terminated = matches.is_present(options::ZERO_TERMINATED); match matches.value_of(options::DELIMITER) { - Some(delim) => { + Some(mut delim) => { + // GNU's `cut` supports `-d=` to set the delimiter to `=`. + // Clap parsing is limited in this situation, see: + // https://github.com/uutils/coreutils/issues/2424#issuecomment-863825242 + // Since clap parsing handles `-d=` as delimiter explicitly set to "" and + // an empty delimiter is not accepted by GNU's `cut` (and makes no sense), + // we can use this as basis for a simple workaround: + if delim.is_empty() { + delim = "="; + } if delim.chars().count() > 1 { Err(msg_opt_invalid_should_be!( "empty or 1 character long", diff --git a/tests/by-util/test_cut.rs b/tests/by-util/test_cut.rs index 8f81b94c1..e21010ec8 100644 --- a/tests/by-util/test_cut.rs +++ b/tests/by-util/test_cut.rs @@ -157,3 +157,12 @@ fn test_directory_and_no_such_file() { .run() .stderr_is("cut: some: No such file or directory\n"); } + +#[test] +fn test_equal_as_delimiter() { + new_ucmd!() + .args(&["-f", "2", "-d="]) + .pipe_in("--libdir=./out/lib") + .succeeds() + .stdout_only("./out/lib\n"); +} From 4e62c9db71be6c387f9c63d46edb86ceb13556cd Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 18 Jun 2021 16:45:36 +0200 Subject: [PATCH 1066/1135] install: support target-directory --- src/uu/install/src/install.rs | 27 +++++++++++++++------------ tests/by-util/test_install.rs | 22 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index ad5ea694c..3992ac25e 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -42,6 +42,7 @@ pub struct Behavior { strip: bool, strip_program: String, create_leading: bool, + target_dir: Option, } #[derive(Clone, Eq, PartialEq)] @@ -194,7 +195,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(OPT_TARGET_DIRECTORY) .short("t") .long(OPT_TARGET_DIRECTORY) - .help("(unimplemented) move all SOURCE arguments into DIRECTORY") + .help("move all SOURCE arguments into DIRECTORY") .value_name("DIRECTORY") ) .arg( @@ -268,8 +269,6 @@ fn check_unimplemented<'a>(matches: &ArgMatches) -> Result<(), &'a str> { Err("-b") } else if matches.is_present(OPT_SUFFIX) { Err("--suffix, -S") - } else if matches.is_present(OPT_TARGET_DIRECTORY) { - Err("--target-directory, -t") } else if matches.is_present(OPT_NO_TARGET_DIRECTORY) { Err("--no-target-directory, -T") } else if matches.is_present(OPT_PRESERVE_CONTEXT) { @@ -314,6 +313,8 @@ fn behavior(matches: &ArgMatches) -> Result { "~" }; + let target_dir = matches.value_of(OPT_TARGET_DIRECTORY).map(|d| d.to_owned()); + Ok(Behavior { main_function, specified_mode, @@ -330,6 +331,7 @@ fn behavior(matches: &ArgMatches) -> Result { .unwrap_or(DEFAULT_STRIP_PROGRAM), ), create_leading: matches.is_present(OPT_CREATE_LEADING), + target_dir, }) } @@ -392,16 +394,17 @@ fn is_new_file_path(path: &Path) -> bool { /// /// Returns an integer intended as a program return code. /// -fn standard(paths: Vec, b: Behavior) -> i32 { - let sources = &paths[0..paths.len() - 1] - .iter() - .map(PathBuf::from) - .collect::>(); +fn standard(mut paths: Vec, b: Behavior) -> i32 { + let target: PathBuf = b + .target_dir + .clone() + .unwrap_or_else(|| paths.pop().unwrap()) + .into(); - let target = Path::new(paths.last().unwrap()); + let sources = &paths.iter().map(PathBuf::from).collect::>(); if sources.len() > 1 || (target.exists() && target.is_dir()) { - copy_files_into_dir(sources, &target.to_path_buf(), &b) + copy_files_into_dir(sources, &target, &b) } else { if let Some(parent) = target.parent() { if !parent.exists() && b.create_leading { @@ -417,8 +420,8 @@ fn standard(paths: Vec, b: Behavior) -> i32 { } } - if target.is_file() || is_new_file_path(target) { - copy_file_to_file(&sources[0], &target.to_path_buf(), &b) + if target.is_file() || is_new_file_path(&target) { + copy_file_to_file(&sources[0], &target, &b) } else { show_error!( "invalid target {}: No such file or directory", diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 3ab5cbdfb..ea2c2818e 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -674,3 +674,25 @@ fn test_install_creating_leading_dir_fails_on_long_name() { .fails() .stderr_contains("failed to create"); } + +#[test] +fn test_install_dir() { + let (at, mut ucmd) = at_and_ucmd!(); + let dir = "target_dir"; + let file1 = "source_file1"; + let file2 = "source_file2"; + + at.touch(file1); + at.touch(file2); + at.mkdir(dir); + ucmd.arg(file1) + .arg(file2) + .arg(&format!("--target-directory={}", dir)) + .succeeds() + .no_stderr(); + + assert!(at.file_exists(file1)); + assert!(at.file_exists(file2)); + assert!(at.file_exists(&format!("{}/{}", dir, file1))); + assert!(at.file_exists(&format!("{}/{}", dir, file2))); +} From cf1a7d079645b526af926a01b7fc51e469f5ad5e Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 18 Jun 2021 17:56:04 +0200 Subject: [PATCH 1067/1135] cp: use options module --- src/uu/cp/src/cp.rs | 309 ++++++++++++++++++++++---------------------- 1 file changed, 156 insertions(+), 153 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 2ebbeddb0..96642f397 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -228,39 +228,41 @@ fn get_usage() -> String { } // Argument constants -static OPT_ARCHIVE: &str = "archive"; -static OPT_ATTRIBUTES_ONLY: &str = "attributes-only"; -static OPT_BACKUP: &str = "backup"; -static OPT_BACKUP_NO_ARG: &str = "b"; -static OPT_CLI_SYMBOLIC_LINKS: &str = "cli-symbolic-links"; -static OPT_CONTEXT: &str = "context"; -static OPT_COPY_CONTENTS: &str = "copy-contents"; -static OPT_DEREFERENCE: &str = "dereference"; -static OPT_FORCE: &str = "force"; -static OPT_INTERACTIVE: &str = "interactive"; -static OPT_LINK: &str = "link"; -static OPT_NO_CLOBBER: &str = "no-clobber"; -static OPT_NO_DEREFERENCE: &str = "no-dereference"; -static OPT_NO_DEREFERENCE_PRESERVE_LINKS: &str = "no-dereference-preserve-linkgs"; -static OPT_NO_PRESERVE: &str = "no-preserve"; -static OPT_NO_TARGET_DIRECTORY: &str = "no-target-directory"; -static OPT_ONE_FILE_SYSTEM: &str = "one-file-system"; -static OPT_PARENT: &str = "parent"; -static OPT_PARENTS: &str = "parents"; -static OPT_PATHS: &str = "paths"; -static OPT_PRESERVE: &str = "preserve"; -static OPT_PRESERVE_DEFAULT_ATTRIBUTES: &str = "preserve-default-attributes"; -static OPT_RECURSIVE: &str = "recursive"; -static OPT_RECURSIVE_ALIAS: &str = "recursive_alias"; -static OPT_REFLINK: &str = "reflink"; -static OPT_REMOVE_DESTINATION: &str = "remove-destination"; -static OPT_SPARSE: &str = "sparse"; -static OPT_STRIP_TRAILING_SLASHES: &str = "strip-trailing-slashes"; -static OPT_SUFFIX: &str = "suffix"; -static OPT_SYMBOLIC_LINK: &str = "symbolic-link"; -static OPT_TARGET_DIRECTORY: &str = "target-directory"; -static OPT_UPDATE: &str = "update"; -static OPT_VERBOSE: &str = "verbose"; +mod options { + pub const ARCHIVE: &str = "archive"; + pub const ATTRIBUTES_ONLY: &str = "attributes-only"; + pub const BACKUP: &str = "backup"; + pub const BACKUP_NO_ARG: &str = "b"; + pub const CLI_SYMBOLIC_LINKS: &str = "cli-symbolic-links"; + pub const CONTEXT: &str = "context"; + pub const COPY_CONTENTS: &str = "copy-contents"; + pub const DEREFERENCE: &str = "dereference"; + pub const FORCE: &str = "force"; + pub const INTERACTIVE: &str = "interactive"; + pub const LINK: &str = "link"; + pub const NO_CLOBBER: &str = "no-clobber"; + pub const NO_DEREFERENCE: &str = "no-dereference"; + pub const NO_DEREFERENCE_PRESERVE_LINKS: &str = "no-dereference-preserve-linkgs"; + pub const NO_PRESERVE: &str = "no-preserve"; + pub const NO_TARGET_DIRECTORY: &str = "no-target-directory"; + pub const ONE_FILE_SYSTEM: &str = "one-file-system"; + pub const PARENT: &str = "parent"; + pub const PARENTS: &str = "parents"; + pub const PATHS: &str = "paths"; + pub const PRESERVE: &str = "preserve"; + pub const PRESERVE_DEFAULT_ATTRIBUTES: &str = "preserve-default-attributes"; + pub const RECURSIVE: &str = "recursive"; + pub const RECURSIVE_ALIAS: &str = "recursive_alias"; + pub const REFLINK: &str = "reflink"; + pub const REMOVE_DESTINATION: &str = "remove-destination"; + pub const SPARSE: &str = "sparse"; + pub const STRIP_TRAILING_SLASHES: &str = "strip-trailing-slashes"; + pub const SUFFIX: &str = "suffix"; + pub const SYMBOLIC_LINK: &str = "symbolic-link"; + pub const TARGET_DIRECTORY: &str = "target-directory"; + pub const UPDATE: &str = "update"; + pub const VERBOSE: &str = "verbose"; +} #[cfg(unix)] static PRESERVABLE_ATTRIBUTES: &[&str] = &[ @@ -297,67 +299,67 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .after_help(&*format!("{}\n{}", LONG_HELP, backup_control::BACKUP_CONTROL_LONG_HELP)) .usage(&usage[..]) - .arg(Arg::with_name(OPT_TARGET_DIRECTORY) + .arg(Arg::with_name(options::TARGET_DIRECTORY) .short("t") - .conflicts_with(OPT_NO_TARGET_DIRECTORY) - .long(OPT_TARGET_DIRECTORY) - .value_name(OPT_TARGET_DIRECTORY) + .conflicts_with(options::NO_TARGET_DIRECTORY) + .long(options::TARGET_DIRECTORY) + .value_name(options::TARGET_DIRECTORY) .takes_value(true) .help("copy all SOURCE arguments into target-directory")) - .arg(Arg::with_name(OPT_NO_TARGET_DIRECTORY) + .arg(Arg::with_name(options::NO_TARGET_DIRECTORY) .short("T") - .long(OPT_NO_TARGET_DIRECTORY) - .conflicts_with(OPT_TARGET_DIRECTORY) + .long(options::NO_TARGET_DIRECTORY) + .conflicts_with(options::TARGET_DIRECTORY) .help("Treat DEST as a regular file and not a directory")) - .arg(Arg::with_name(OPT_INTERACTIVE) + .arg(Arg::with_name(options::INTERACTIVE) .short("i") - .long(OPT_INTERACTIVE) - .conflicts_with(OPT_NO_CLOBBER) + .long(options::INTERACTIVE) + .conflicts_with(options::NO_CLOBBER) .help("ask before overwriting files")) - .arg(Arg::with_name(OPT_LINK) + .arg(Arg::with_name(options::LINK) .short("l") - .long(OPT_LINK) - .overrides_with(OPT_REFLINK) + .long(options::LINK) + .overrides_with(options::REFLINK) .help("hard-link files instead of copying")) - .arg(Arg::with_name(OPT_NO_CLOBBER) + .arg(Arg::with_name(options::NO_CLOBBER) .short("n") - .long(OPT_NO_CLOBBER) - .conflicts_with(OPT_INTERACTIVE) + .long(options::NO_CLOBBER) + .conflicts_with(options::INTERACTIVE) .help("don't overwrite a file that already exists")) - .arg(Arg::with_name(OPT_RECURSIVE) + .arg(Arg::with_name(options::RECURSIVE) .short("r") - .long(OPT_RECURSIVE) + .long(options::RECURSIVE) // --archive sets this option .help("copy directories recursively")) - .arg(Arg::with_name(OPT_RECURSIVE_ALIAS) + .arg(Arg::with_name(options::RECURSIVE_ALIAS) .short("R") .help("same as -r")) - .arg(Arg::with_name(OPT_STRIP_TRAILING_SLASHES) - .long(OPT_STRIP_TRAILING_SLASHES) + .arg(Arg::with_name(options::STRIP_TRAILING_SLASHES) + .long(options::STRIP_TRAILING_SLASHES) .help("remove any trailing slashes from each SOURCE argument")) - .arg(Arg::with_name(OPT_VERBOSE) + .arg(Arg::with_name(options::VERBOSE) .short("v") - .long(OPT_VERBOSE) + .long(options::VERBOSE) .help("explicitly state what is being done")) - .arg(Arg::with_name(OPT_SYMBOLIC_LINK) + .arg(Arg::with_name(options::SYMBOLIC_LINK) .short("s") - .long(OPT_SYMBOLIC_LINK) - .conflicts_with(OPT_LINK) - .overrides_with(OPT_REFLINK) + .long(options::SYMBOLIC_LINK) + .conflicts_with(options::LINK) + .overrides_with(options::REFLINK) .help("make symbolic links instead of copying")) - .arg(Arg::with_name(OPT_FORCE) + .arg(Arg::with_name(options::FORCE) .short("f") - .long(OPT_FORCE) + .long(options::FORCE) .help("if an existing destination file cannot be opened, remove it and \ try again (this option is ignored when the -n option is also used). \ Currently not implemented for Windows.")) - .arg(Arg::with_name(OPT_REMOVE_DESTINATION) - .long(OPT_REMOVE_DESTINATION) - .conflicts_with(OPT_FORCE) + .arg(Arg::with_name(options::REMOVE_DESTINATION) + .long(options::REMOVE_DESTINATION) + .conflicts_with(options::FORCE) .help("remove each existing destination file before attempting to open it \ (contrast with --force). On Windows, current only works for writeable files.")) - .arg(Arg::with_name(OPT_BACKUP) - .long(OPT_BACKUP) + .arg(Arg::with_name(options::BACKUP) + .long(options::BACKUP) .help("make a backup of each existing destination file") .takes_value(true) .require_equals(true) @@ -365,104 +367,104 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .possible_values(backup_control::BACKUP_CONTROL_VALUES) .value_name("CONTROL") ) - .arg(Arg::with_name(OPT_BACKUP_NO_ARG) - .short(OPT_BACKUP_NO_ARG) + .arg(Arg::with_name(options::BACKUP_NO_ARG) + .short(options::BACKUP_NO_ARG) .help("like --backup but does not accept an argument") ) - .arg(Arg::with_name(OPT_SUFFIX) + .arg(Arg::with_name(options::SUFFIX) .short("S") - .long(OPT_SUFFIX) + .long(options::SUFFIX) .takes_value(true) .value_name("SUFFIX") .help("override the usual backup suffix")) - .arg(Arg::with_name(OPT_UPDATE) + .arg(Arg::with_name(options::UPDATE) .short("u") - .long(OPT_UPDATE) + .long(options::UPDATE) .help("copy only when the SOURCE file is newer than the destination file\ or when the destination file is missing")) - .arg(Arg::with_name(OPT_REFLINK) - .long(OPT_REFLINK) + .arg(Arg::with_name(options::REFLINK) + .long(options::REFLINK) .takes_value(true) .value_name("WHEN") .help("control clone/CoW copies. See below")) - .arg(Arg::with_name(OPT_ATTRIBUTES_ONLY) - .long(OPT_ATTRIBUTES_ONLY) - .conflicts_with(OPT_COPY_CONTENTS) - .overrides_with(OPT_REFLINK) + .arg(Arg::with_name(options::ATTRIBUTES_ONLY) + .long(options::ATTRIBUTES_ONLY) + .conflicts_with(options::COPY_CONTENTS) + .overrides_with(options::REFLINK) .help("Don't copy the file data, just the attributes")) - .arg(Arg::with_name(OPT_PRESERVE) - .long(OPT_PRESERVE) + .arg(Arg::with_name(options::PRESERVE) + .long(options::PRESERVE) .takes_value(true) .multiple(true) .use_delimiter(true) .possible_values(PRESERVABLE_ATTRIBUTES) .min_values(0) .value_name("ATTR_LIST") - .conflicts_with_all(&[OPT_PRESERVE_DEFAULT_ATTRIBUTES, OPT_NO_PRESERVE]) + .conflicts_with_all(&[options::PRESERVE_DEFAULT_ATTRIBUTES, options::NO_PRESERVE]) // -d sets this option // --archive sets this option .help("Preserve the specified attributes (default: mode(unix only),ownership,timestamps),\ if possible additional attributes: context, links, xattr, all")) - .arg(Arg::with_name(OPT_PRESERVE_DEFAULT_ATTRIBUTES) + .arg(Arg::with_name(options::PRESERVE_DEFAULT_ATTRIBUTES) .short("-p") - .long(OPT_PRESERVE_DEFAULT_ATTRIBUTES) - .conflicts_with_all(&[OPT_PRESERVE, OPT_NO_PRESERVE, OPT_ARCHIVE]) + .long(options::PRESERVE_DEFAULT_ATTRIBUTES) + .conflicts_with_all(&[options::PRESERVE, options::NO_PRESERVE, options::ARCHIVE]) .help("same as --preserve=mode(unix only),ownership,timestamps")) - .arg(Arg::with_name(OPT_NO_PRESERVE) - .long(OPT_NO_PRESERVE) + .arg(Arg::with_name(options::NO_PRESERVE) + .long(options::NO_PRESERVE) .takes_value(true) .value_name("ATTR_LIST") - .conflicts_with_all(&[OPT_PRESERVE_DEFAULT_ATTRIBUTES, OPT_PRESERVE, OPT_ARCHIVE]) + .conflicts_with_all(&[options::PRESERVE_DEFAULT_ATTRIBUTES, options::PRESERVE, options::ARCHIVE]) .help("don't preserve the specified attributes")) - .arg(Arg::with_name(OPT_PARENTS) - .long(OPT_PARENTS) - .alias(OPT_PARENT) + .arg(Arg::with_name(options::PARENTS) + .long(options::PARENTS) + .alias(options::PARENT) .help("use full source file name under DIRECTORY")) - .arg(Arg::with_name(OPT_NO_DEREFERENCE) + .arg(Arg::with_name(options::NO_DEREFERENCE) .short("-P") - .long(OPT_NO_DEREFERENCE) - .conflicts_with(OPT_DEREFERENCE) + .long(options::NO_DEREFERENCE) + .conflicts_with(options::DEREFERENCE) // -d sets this option .help("never follow symbolic links in SOURCE")) - .arg(Arg::with_name(OPT_DEREFERENCE) + .arg(Arg::with_name(options::DEREFERENCE) .short("L") - .long(OPT_DEREFERENCE) - .conflicts_with(OPT_NO_DEREFERENCE) + .long(options::DEREFERENCE) + .conflicts_with(options::NO_DEREFERENCE) .help("always follow symbolic links in SOURCE")) - .arg(Arg::with_name(OPT_ARCHIVE) + .arg(Arg::with_name(options::ARCHIVE) .short("a") - .long(OPT_ARCHIVE) - .conflicts_with_all(&[OPT_PRESERVE_DEFAULT_ATTRIBUTES, OPT_PRESERVE, OPT_NO_PRESERVE]) + .long(options::ARCHIVE) + .conflicts_with_all(&[options::PRESERVE_DEFAULT_ATTRIBUTES, options::PRESERVE, options::NO_PRESERVE]) .help("Same as -dR --preserve=all")) - .arg(Arg::with_name(OPT_NO_DEREFERENCE_PRESERVE_LINKS) + .arg(Arg::with_name(options::NO_DEREFERENCE_PRESERVE_LINKS) .short("d") .help("same as --no-dereference --preserve=links")) - .arg(Arg::with_name(OPT_ONE_FILE_SYSTEM) + .arg(Arg::with_name(options::ONE_FILE_SYSTEM) .short("x") - .long(OPT_ONE_FILE_SYSTEM) + .long(options::ONE_FILE_SYSTEM) .help("stay on this file system")) // TODO: implement the following args - .arg(Arg::with_name(OPT_COPY_CONTENTS) - .long(OPT_COPY_CONTENTS) - .conflicts_with(OPT_ATTRIBUTES_ONLY) + .arg(Arg::with_name(options::COPY_CONTENTS) + .long(options::COPY_CONTENTS) + .conflicts_with(options::ATTRIBUTES_ONLY) .help("NotImplemented: copy contents of special files when recursive")) - .arg(Arg::with_name(OPT_SPARSE) - .long(OPT_SPARSE) + .arg(Arg::with_name(options::SPARSE) + .long(options::SPARSE) .takes_value(true) .value_name("WHEN") .help("NotImplemented: control creation of sparse files. See below")) - .arg(Arg::with_name(OPT_CONTEXT) - .long(OPT_CONTEXT) + .arg(Arg::with_name(options::CONTEXT) + .long(options::CONTEXT) .takes_value(true) .value_name("CTX") .help("NotImplemented: set SELinux security context of destination file to default type")) - .arg(Arg::with_name(OPT_CLI_SYMBOLIC_LINKS) + .arg(Arg::with_name(options::CLI_SYMBOLIC_LINKS) .short("H") .help("NotImplemented: follow command-line symbolic links in SOURCE")) // END TODO - .arg(Arg::with_name(OPT_PATHS) + .arg(Arg::with_name(options::PATHS) .multiple(true)) .get_matches_from(args); @@ -474,7 +476,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } let paths: Vec = matches - .values_of(OPT_PATHS) + .values_of(options::PATHS) .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); @@ -496,9 +498,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { impl ClobberMode { fn from_matches(matches: &ArgMatches) -> ClobberMode { - if matches.is_present(OPT_FORCE) { + if matches.is_present(options::FORCE) { ClobberMode::Force - } else if matches.is_present(OPT_REMOVE_DESTINATION) { + } else if matches.is_present(options::REMOVE_DESTINATION) { ClobberMode::RemoveDestination } else { ClobberMode::Standard @@ -508,9 +510,9 @@ impl ClobberMode { impl OverwriteMode { fn from_matches(matches: &ArgMatches) -> OverwriteMode { - if matches.is_present(OPT_INTERACTIVE) { + if matches.is_present(options::INTERACTIVE) { OverwriteMode::Interactive(ClobberMode::from_matches(matches)) - } else if matches.is_present(OPT_NO_CLOBBER) { + } else if matches.is_present(options::NO_CLOBBER) { OverwriteMode::NoClobber } else { OverwriteMode::Clobber(ClobberMode::from_matches(matches)) @@ -520,15 +522,15 @@ impl OverwriteMode { impl CopyMode { fn from_matches(matches: &ArgMatches) -> CopyMode { - if matches.is_present(OPT_LINK) { + if matches.is_present(options::LINK) { CopyMode::Link - } else if matches.is_present(OPT_SYMBOLIC_LINK) { + } else if matches.is_present(options::SYMBOLIC_LINK) { CopyMode::SymLink - } else if matches.is_present(OPT_SPARSE) { + } else if matches.is_present(options::SPARSE) { CopyMode::Sparse - } else if matches.is_present(OPT_UPDATE) { + } else if matches.is_present(options::UPDATE) { CopyMode::Update - } else if matches.is_present(OPT_ATTRIBUTES_ONLY) { + } else if matches.is_present(options::ATTRIBUTES_ONLY) { CopyMode::AttrOnly } else { CopyMode::Copy @@ -576,13 +578,13 @@ fn add_all_attributes() -> Vec { impl Options { fn from_matches(matches: &ArgMatches) -> CopyResult { let not_implemented_opts = vec![ - OPT_COPY_CONTENTS, - OPT_SPARSE, + options::COPY_CONTENTS, + options::SPARSE, #[cfg(not(any(windows, unix)))] - OPT_ONE_FILE_SYSTEM, - OPT_CONTEXT, + options::ONE_FILE_SYSTEM, + options::CONTEXT, #[cfg(windows)] - OPT_FORCE, + options::FORCE, ]; for not_implemented_opt in not_implemented_opts { @@ -591,27 +593,28 @@ impl Options { } } - let recursive = matches.is_present(OPT_RECURSIVE) - || matches.is_present(OPT_RECURSIVE_ALIAS) - || matches.is_present(OPT_ARCHIVE); + let recursive = matches.is_present(options::RECURSIVE) + || matches.is_present(options::RECURSIVE_ALIAS) + || matches.is_present(options::ARCHIVE); let backup_mode = backup_control::determine_backup_mode( - matches.is_present(OPT_BACKUP_NO_ARG) || matches.is_present(OPT_BACKUP), - matches.value_of(OPT_BACKUP), + matches.is_present(options::BACKUP_NO_ARG) || matches.is_present(options::BACKUP), + matches.value_of(options::BACKUP), ); - let backup_suffix = backup_control::determine_backup_suffix(matches.value_of(OPT_SUFFIX)); + let backup_suffix = + backup_control::determine_backup_suffix(matches.value_of(options::SUFFIX)); let overwrite = OverwriteMode::from_matches(matches); // Parse target directory options - let no_target_dir = matches.is_present(OPT_NO_TARGET_DIRECTORY); + let no_target_dir = matches.is_present(options::NO_TARGET_DIRECTORY); let target_dir = matches - .value_of(OPT_TARGET_DIRECTORY) + .value_of(options::TARGET_DIRECTORY) .map(ToString::to_string); // Parse attributes to preserve - let preserve_attributes: Vec = if matches.is_present(OPT_PRESERVE) { - match matches.values_of(OPT_PRESERVE) { + let preserve_attributes: Vec = if matches.is_present(options::PRESERVE) { + match matches.values_of(options::PRESERVE) { None => DEFAULT_ATTRIBUTES.to_vec(), Some(attribute_strs) => { let mut attributes = Vec::new(); @@ -626,33 +629,33 @@ impl Options { attributes } } - } else if matches.is_present(OPT_ARCHIVE) { + } else if matches.is_present(options::ARCHIVE) { // --archive is used. Same as --preserve=all add_all_attributes() - } else if matches.is_present(OPT_NO_DEREFERENCE_PRESERVE_LINKS) { + } else if matches.is_present(options::NO_DEREFERENCE_PRESERVE_LINKS) { vec![Attribute::Links] - } else if matches.is_present(OPT_PRESERVE_DEFAULT_ATTRIBUTES) { + } else if matches.is_present(options::PRESERVE_DEFAULT_ATTRIBUTES) { DEFAULT_ATTRIBUTES.to_vec() } else { vec![] }; let options = Options { - attributes_only: matches.is_present(OPT_ATTRIBUTES_ONLY), - copy_contents: matches.is_present(OPT_COPY_CONTENTS), + attributes_only: matches.is_present(options::ATTRIBUTES_ONLY), + copy_contents: matches.is_present(options::COPY_CONTENTS), copy_mode: CopyMode::from_matches(matches), - dereference: matches.is_present(OPT_DEREFERENCE), + dereference: matches.is_present(options::DEREFERENCE), // No dereference is set with -p, -d and --archive - no_dereference: matches.is_present(OPT_NO_DEREFERENCE) - || matches.is_present(OPT_NO_DEREFERENCE_PRESERVE_LINKS) - || matches.is_present(OPT_ARCHIVE), - one_file_system: matches.is_present(OPT_ONE_FILE_SYSTEM), - parents: matches.is_present(OPT_PARENTS), - update: matches.is_present(OPT_UPDATE), - verbose: matches.is_present(OPT_VERBOSE), - strip_trailing_slashes: matches.is_present(OPT_STRIP_TRAILING_SLASHES), + no_dereference: matches.is_present(options::NO_DEREFERENCE) + || matches.is_present(options::NO_DEREFERENCE_PRESERVE_LINKS) + || matches.is_present(options::ARCHIVE), + one_file_system: matches.is_present(options::ONE_FILE_SYSTEM), + parents: matches.is_present(options::PARENTS), + update: matches.is_present(options::UPDATE), + verbose: matches.is_present(options::VERBOSE), + strip_trailing_slashes: matches.is_present(options::STRIP_TRAILING_SLASHES), reflink_mode: { - if let Some(reflink) = matches.value_of(OPT_REFLINK) { + if let Some(reflink) = matches.value_of(options::REFLINK) { match reflink { "always" => ReflinkMode::Always, "auto" => ReflinkMode::Auto, @@ -1177,7 +1180,7 @@ fn copy_file(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> { CopyMode::SymLink => { symlink_file(source, dest, &*context_for(source, dest))?; } - CopyMode::Sparse => return Err(Error::NotImplemented(OPT_SPARSE.to_string())), + CopyMode::Sparse => return Err(Error::NotImplemented(options::SPARSE.to_string())), CopyMode::Update => { if dest.exists() { let src_metadata = fs::metadata(source)?; From ab3f2cb6728afc42e5595e8ea4ad6a2e5837baa9 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 18 Jun 2021 17:56:22 +0200 Subject: [PATCH 1068/1135] cp: update list of implemented arguments --- src/uu/cp/README.md | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/uu/cp/README.md b/src/uu/cp/README.md index 91753eb66..5745cb8a0 100644 --- a/src/uu/cp/README.md +++ b/src/uu/cp/README.md @@ -7,37 +7,38 @@ ### To Do -- [ ] archive -- [ ] attributes-only -- [ ] copy-contents -- [ ] no-dereference-preserve-linkgs -- [ ] dereference -- [ ] no-dereference -- [ ] preserve-default-attributes -- [ ] preserve -- [ ] no-preserve -- [ ] parents -- [ ] reflink -- [ ] sparse -- [ ] strip-trailing-slashes -- [ ] update -- [ ] one-file-system -- [ ] context + - [ ] cli-symbolic-links +- [ ] context +- [ ] copy-contents +- [ ] sparse ### Completed +- [x] archive +- [x] attributes-only - [x] backup +- [x] dereference - [x] force (Not implemented on Windows) - [x] interactive - [x] link - [x] no-clobber +- [x] no-dereference +- [x] no-dereference-preserve-links +- [x] no-preserve - [x] no-target-directory +- [x] one-file-system +- [x] parents - [x] paths +- [x] preserve +- [x] preserve-default-attributes - [x] recursive +- [x] reflink - [x] remove-destination (On Windows, current only works for writeable files) +- [x] strip-trailing-slashes - [x] suffix - [x] symbolic-link - [x] target-directory +- [x] update - [x] verbose - [x] version From 14520fb64ef5152af0bcb267cde3bf236d4745de Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 18 Jun 2021 18:00:27 +0200 Subject: [PATCH 1069/1135] cp: remove redundant newline in readme --- src/uu/cp/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/uu/cp/README.md b/src/uu/cp/README.md index 5745cb8a0..13399c3b1 100644 --- a/src/uu/cp/README.md +++ b/src/uu/cp/README.md @@ -7,7 +7,6 @@ ### To Do - - [ ] cli-symbolic-links - [ ] context - [ ] copy-contents From 285eeac1fb88d1d3b354ec77f73375546fd72e75 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 18 Jun 2021 18:49:39 +0200 Subject: [PATCH 1070/1135] tests/pr: include one more possible minute --- tests/by-util/test_pr.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_pr.rs b/tests/by-util/test_pr.rs index fb6703f28..4a79a3eda 100644 --- a/tests/by-util/test_pr.rs +++ b/tests/by-util/test_pr.rs @@ -22,6 +22,7 @@ fn file_last_modified_time(ucmd: &UCommand, path: &str) -> String { } fn all_minutes(from: DateTime, to: DateTime) -> Vec { + let to = to + Duration::minutes(1); const FORMAT: &str = "%b %d %H:%M %Y"; let mut vec = vec![]; let mut current = from; From 65fe9beaada0d0c60638a98beeeb6219178cf78a Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 19 Jun 2021 08:58:33 +0200 Subject: [PATCH 1071/1135] bring back #[cfg(windows)] --- src/uu/du/src/du.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index e4bac2e18..fa6c34165 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -25,6 +25,7 @@ use std::os::unix::fs::MetadataExt; use std::os::windows::fs::MetadataExt; #[cfg(windows)] use std::os::windows::io::AsRawHandle; +#[cfg(windows)] use std::path::Path; use std::path::PathBuf; use std::str::FromStr; From 7b9814c7784dd93c31df03e12038ada37082dd55 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Fri, 18 Jun 2021 16:56:00 +0300 Subject: [PATCH 1072/1135] test: Implement [ expr ] syntax When invoked via '[' name, last argument must be ']' or we bail out with syntax error. Then the trailing ']' is simply disregarded and processing happens like usual. --- build.rs | 23 +++++++++++++++++++++++ src/uu/test/src/test.rs | 20 +++++++++++++++++--- tests/by-util/test_test.rs | 28 ++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 3 deletions(-) diff --git a/build.rs b/build.rs index ae38177b0..2ed8e1345 100644 --- a/build.rs +++ b/build.rs @@ -54,6 +54,29 @@ pub fn main() { for krate in crates { match krate.as_ref() { + // 'test' is named uu_test to avoid collision with rust core crate 'test'. + // It can also be invoked by name '[' for the '[ expr ] syntax'. + "uu_test" => { + mf.write_all( + format!( + "\ + \tmap.insert(\"test\", {krate}::uumain);\n\ + \t\tmap.insert(\"[\", {krate}::uumain);\n\ + ", + krate = krate + ) + .as_bytes(), + ) + .unwrap(); + tf.write_all( + format!( + "#[path=\"{dir}/test_test.rs\"]\nmod test_test;\n", + dir = util_tests_dir, + ) + .as_bytes(), + ) + .unwrap() + } k if k.starts_with(override_prefix) => { mf.write_all( format!( diff --git a/src/uu/test/src/test.rs b/src/uu/test/src/test.rs index 5f20b95f0..97a244cdc 100644 --- a/src/uu/test/src/test.rs +++ b/src/uu/test/src/test.rs @@ -12,10 +12,24 @@ mod parser; use parser::{parse, Symbol}; use std::ffi::{OsStr, OsString}; +use std::path::Path; -pub fn uumain(args: impl uucore::Args) -> i32 { - // TODO: handle being called as `[` - let args: Vec<_> = args.skip(1).collect(); +pub fn uumain(mut args: impl uucore::Args) -> i32 { + let program = args.next().unwrap_or_else(|| OsString::from("test")); + let binary_name = Path::new(&program) + .file_name() + .unwrap_or_else(|| OsStr::new("test")) + .to_string_lossy(); + let mut args: Vec<_> = args.collect(); + + // If invoked via name '[', matching ']' must be in the last arg + if binary_name == "[" { + let last = args.pop(); + if last != Some(OsString::from("]")) { + eprintln!("[: missing ']'"); + return 2; + } + } let result = parse(args).and_then(|mut stack| eval(&mut stack)); diff --git a/tests/by-util/test_test.rs b/tests/by-util/test_test.rs index c4964d6bf..36e825f2d 100644 --- a/tests/by-util/test_test.rs +++ b/tests/by-util/test_test.rs @@ -690,3 +690,31 @@ fn test_or_as_filename() { fn test_string_length_and_nothing() { new_ucmd!().args(&["-n", "a", "-a"]).run().status_code(2); } + +#[test] +fn test_bracket_syntax_success() { + let scenario = TestScenario::new("["); + let mut ucmd = scenario.ucmd(); + + ucmd.args(&["1", "-eq", "1", "]"]).succeeds(); +} + +#[test] +fn test_bracket_syntax_failure() { + let scenario = TestScenario::new("["); + let mut ucmd = scenario.ucmd(); + + ucmd.args(&["1", "-eq", "2", "]"]).run().status_code(1); +} + +#[test] +fn test_bracket_syntax_missing_right_bracket() { + let scenario = TestScenario::new("["); + let mut ucmd = scenario.ucmd(); + + // Missing closing bracket takes precedence over other possible errors. + ucmd.args(&["1", "-eq"]) + .run() + .status_code(2) + .stderr_is("[: missing ']'"); +} From 6400cded54ba436ad72f0758dfafe174491e378e Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 19 Jun 2021 17:45:45 +0200 Subject: [PATCH 1073/1135] cp: fix order of checks in `copy_helper` --- src/uu/cp/src/cp.rs | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 851117bde..cf723e4ee 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1218,28 +1218,38 @@ fn copy_file(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> { /// Copy the file from `source` to `dest` either using the normal `fs::copy` or a /// copy-on-write scheme if --reflink is specified and the filesystem supports it. fn copy_helper(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> { - if options.reflink_mode != ReflinkMode::Never { - #[cfg(not(any(target_os = "linux", target_os = "macos")))] - return Err("--reflink is only supported on linux and macOS" - .to_string() - .into()); - - #[cfg(target_os = "macos")] - copy_on_write_macos(source, dest, options.reflink_mode)?; - #[cfg(target_os = "linux")] - copy_on_write_linux(source, dest, options.reflink_mode)?; - } else if !options.dereference && fs::symlink_metadata(&source)?.file_type().is_symlink() { - copy_link(source, dest)?; - } else if source.to_string_lossy() == "/dev/null" { + if options.parents { + let parent = dest.parent().unwrap_or(dest); + fs::create_dir_all(parent)?; + } + let is_symlink = fs::symlink_metadata(&source)?.file_type().is_symlink(); + if source.to_string_lossy() == "/dev/null" { /* workaround a limitation of fs::copy * https://github.com/rust-lang/rust/issues/79390 */ File::create(dest)?; - } else { - if options.parents { - let parent = dest.parent().unwrap_or(dest); - fs::create_dir_all(parent)?; + } else if !options.dereference && is_symlink { + copy_link(source, dest)?; + } else if options.reflink_mode != ReflinkMode::Never { + #[cfg(not(any(target_os = "linux", target_os = "macos")))] + return Err("--reflink is only supported on linux and macOS" + .to_string() + .into()); + if is_symlink { + assert!(options.dereference); + let real_path = std::fs::read_link(source)?; + + #[cfg(target_os = "macos")] + copy_on_write_macos(&real_path, dest, options.reflink_mode)?; + #[cfg(target_os = "linux")] + copy_on_write_linux(&real_path, dest, options.reflink_mode)?; + } else { + #[cfg(target_os = "macos")] + copy_on_write_macos(source, dest, options.reflink_mode)?; + #[cfg(target_os = "linux")] + copy_on_write_linux(source, dest, options.reflink_mode)?; } + } else { fs::copy(source, dest).context(&*context_for(source, dest))?; } From 9fb927aa856eec92a58b6cfbf53438e4a48f71e2 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 19 Jun 2021 17:49:04 +0200 Subject: [PATCH 1074/1135] cp: always delete the destination for symlinks --- src/uu/cp/src/cp.rs | 5 +++++ tests/by-util/test_cp.rs | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index cf723e4ee..840035e4a 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1269,6 +1269,11 @@ fn copy_link(source: &Path, dest: &Path) -> CopyResult<()> { ), } } else { + // we always need to remove the file to be able to create a symlink, + // even if it is writeable. + if dest.exists() { + fs::remove_file(dest)?; + } dest.into() }; symlink_file(&link, &dest, &*context_for(&link, &dest)) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 4ce587e02..19f93e499 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1325,3 +1325,16 @@ fn test_copy_dir_with_symlinks() { ucmd.args(&["-r", "dir", "copy"]).succeeds(); assert_eq!(at.resolve_link("copy/file-link"), "file"); } + +#[test] +#[cfg(not(windows))] +fn test_copy_symlink_force() { + let (at, mut ucmd) = at_and_ucmd!(); + at.touch("file"); + at.symlink_file("file", "file-link"); + at.touch("copy"); + + ucmd.args(&["file-link", "copy", "-f", "--no-dereference"]) + .succeeds(); + assert_eq!(at.resolve_link("copy"), "file"); +} From 076c7fa501d43a190ab4356dfaa583677c80dc3b Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 19 Jun 2021 17:49:41 +0200 Subject: [PATCH 1075/1135] cp: default to --reflink=auto on linux and macos --- src/uu/cp/src/cp.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 840035e4a..7cf6a1d9b 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -667,7 +667,14 @@ impl Options { } } } else { - ReflinkMode::Never + #[cfg(any(target_os = "linux", target_os = "macos"))] + { + ReflinkMode::Auto + } + #[cfg(not(any(target_os = "linux", target_os = "macos")))] + { + ReflinkMode::Never + } } }, backup: backup_mode, From 3086e95702073e3ad0c5e8067f2ff650ab85141f Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 20 Jun 2021 00:21:14 +0200 Subject: [PATCH 1076/1135] numfmt: add round and use C locale style for errors --- src/uu/numfmt/src/format.rs | 60 +++++++++++++++++------------------- src/uu/numfmt/src/numfmt.rs | 38 +++++++++++++++++------ src/uu/numfmt/src/options.rs | 41 ++++++++++++++++++++++-- src/uu/numfmt/src/units.rs | 4 --- tests/by-util/test_numfmt.rs | 44 ++++++++++++++++++++------ 5 files changed, 129 insertions(+), 58 deletions(-) diff --git a/src/uu/numfmt/src/format.rs b/src/uu/numfmt/src/format.rs index ee692d8f0..f0f1bf739 100644 --- a/src/uu/numfmt/src/format.rs +++ b/src/uu/numfmt/src/format.rs @@ -1,7 +1,5 @@ -use crate::options::NumfmtOptions; -use crate::units::{ - DisplayableSuffix, RawSuffix, Result, Suffix, Transform, Unit, IEC_BASES, SI_BASES, -}; +use crate::options::{NumfmtOptions, RoundMethod}; +use crate::units::{DisplayableSuffix, RawSuffix, Result, Suffix, Unit, IEC_BASES, SI_BASES}; /// Iterate over a line's fields, where each field is a contiguous sequence of /// non-whitespace, optionally prefixed with one or more characters of leading @@ -62,7 +60,7 @@ impl<'a> Iterator for WhitespaceSplitter<'a> { fn parse_suffix(s: &str) -> Result<(f64, Option)> { if s.is_empty() { - return Err("invalid number: ‘’".to_string()); + return Err("invalid number: ''".to_string()); } let with_i = s.ends_with('i'); @@ -70,18 +68,18 @@ fn parse_suffix(s: &str) -> Result<(f64, Option)> { if with_i { iter.next_back(); } - let suffix: Option = match iter.next_back() { - Some('K') => Ok(Some((RawSuffix::K, with_i))), - Some('M') => Ok(Some((RawSuffix::M, with_i))), - Some('G') => Ok(Some((RawSuffix::G, with_i))), - Some('T') => Ok(Some((RawSuffix::T, with_i))), - Some('P') => Ok(Some((RawSuffix::P, with_i))), - Some('E') => Ok(Some((RawSuffix::E, with_i))), - Some('Z') => Ok(Some((RawSuffix::Z, with_i))), - Some('Y') => Ok(Some((RawSuffix::Y, with_i))), - Some('0'..='9') => Ok(None), - _ => Err(format!("invalid suffix in input: ‘{}’", s)), - }?; + let suffix = match iter.next_back() { + Some('K') => Some((RawSuffix::K, with_i)), + Some('M') => Some((RawSuffix::M, with_i)), + Some('G') => Some((RawSuffix::G, with_i)), + Some('T') => Some((RawSuffix::T, with_i)), + Some('P') => Some((RawSuffix::P, with_i)), + Some('E') => Some((RawSuffix::E, with_i)), + Some('Z') => Some((RawSuffix::Z, with_i)), + Some('Y') => Some((RawSuffix::Y, with_i)), + Some('0'..='9') => None, + _ => return Err(format!("invalid suffix in input: '{}'", s)), + }; let suffix_len = match suffix { None => 0, @@ -91,7 +89,7 @@ fn parse_suffix(s: &str) -> Result<(f64, Option)> { let number = s[..s.len() - suffix_len] .parse::() - .map_err(|_| format!("invalid number: ‘{}’", s))?; + .map_err(|_| format!("invalid number: '{}'", s))?; Ok((number, suffix)) } @@ -127,10 +125,10 @@ fn remove_suffix(i: f64, s: Option, u: &Unit) -> Result { } } -fn transform_from(s: &str, opts: &Transform) -> Result { +fn transform_from(s: &str, opts: &Unit) -> Result { let (i, suffix) = parse_suffix(s)?; - remove_suffix(i, suffix, &opts.unit).map(|n| if n < 0.0 { -n.abs().ceil() } else { n.ceil() }) + remove_suffix(i, suffix, opts).map(|n| if n < 0.0 { -n.abs().ceil() } else { n.ceil() }) } /// Divide numerator by denominator, with ceiling. @@ -153,18 +151,17 @@ fn transform_from(s: &str, opts: &Transform) -> Result { /// assert_eq!(div_ceil(1000.0, -3.14), -319.0); /// assert_eq!(div_ceil(-271828.0, -271.0), 1004.0); /// ``` -pub fn div_ceil(n: f64, d: f64) -> f64 { - let v = n / (d / 10.0); - let (v, sign) = if v < 0.0 { (v.abs(), -1.0) } else { (v, 1.0) }; +pub fn div_round(n: f64, d: f64, method: RoundMethod) -> f64 { + let v = n / d; - if v < 100.0 { - v.ceil() / 10.0 * sign + if v.abs() < 10.0 { + method.round(10.0 * v) / 10.0 } else { - (v / 10.0).ceil() * sign + method.round(v) } } -fn consider_suffix(n: f64, u: &Unit) -> Result<(f64, Option)> { +fn consider_suffix(n: f64, u: &Unit, round_method: RoundMethod) -> Result<(f64, Option)> { use crate::units::RawSuffix::*; let abs_n = n.abs(); @@ -190,7 +187,7 @@ fn consider_suffix(n: f64, u: &Unit) -> Result<(f64, Option)> { _ => return Err("Number is too big and unsupported".to_string()), }; - let v = div_ceil(n, bases[i]); + let v = div_round(n, bases[i], round_method); // check if rounding pushed us into the next base if v.abs() >= bases[1] { @@ -200,8 +197,8 @@ fn consider_suffix(n: f64, u: &Unit) -> Result<(f64, Option)> { } } -fn transform_to(s: f64, opts: &Transform) -> Result { - let (i2, s) = consider_suffix(s, &opts.unit)?; +fn transform_to(s: f64, opts: &Unit, round_method: RoundMethod) -> Result { + let (i2, s) = consider_suffix(s, opts, round_method)?; Ok(match s { None => format!("{}", i2), Some(s) if i2.abs() < 10.0 => format!("{:.1}{}", i2, DisplayableSuffix(s)), @@ -217,10 +214,11 @@ fn format_string( let number = transform_to( transform_from(source, &options.transform.from)?, &options.transform.to, + options.round, )?; Ok(match implicit_padding.unwrap_or(options.padding) { - p if p == 0 => number, + 0 => number, p if p > 0 => format!("{:>padding$}", number, padding = p as usize), p => format!("{: Result { let from = parse_unit(args.value_of(options::FROM).unwrap())?; let to = parse_unit(args.value_of(options::TO).unwrap())?; - let transform = TransformOptions { - from: Transform { unit: from }, - to: Transform { unit: to }, - }; + let transform = TransformOptions { from, to }; let padding = match args.value_of(options::PADDING) { Some(s) => s.parse::().map_err(|err| err.to_string()), @@ -114,17 +111,16 @@ fn parse_options(args: &ArgMatches) -> Result { 0 => Err(value), _ => Ok(n), }) - .map_err(|value| format!("invalid header value ‘{}’", value)) + .map_err(|value| format!("invalid header value '{}'", value)) } }?; - let fields = match args.value_of(options::FIELD) { - Some("-") => vec![Range { + let fields = match args.value_of(options::FIELD).unwrap() { + "-" => vec![Range { low: 1, high: std::usize::MAX, }], - Some(v) => Range::from_list(v)?, - None => unreachable!(), + v => Range::from_list(v)?, }; let delimiter = args.value_of(options::DELIMITER).map_or(Ok(None), |arg| { @@ -135,12 +131,23 @@ fn parse_options(args: &ArgMatches) -> Result { } })?; + // unwrap is fine because the argument has a default value + let round = match args.value_of(options::ROUND).unwrap() { + "up" => RoundMethod::Up, + "down" => RoundMethod::Down, + "from-zero" => RoundMethod::FromZero, + "towards-zero" => RoundMethod::TowardsZero, + "nearest" => RoundMethod::Nearest, + _ => unreachable!("Should be restricted by clap"), + }; + Ok(NumfmtOptions { transform, padding, header, fields, delimiter, + round, }) } @@ -203,6 +210,17 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .default_value(options::HEADER_DEFAULT) .hide_default_value(true), ) + .arg( + Arg::with_name(options::ROUND) + .long(options::ROUND) + .help( + "use METHOD for rounding when scaling; METHOD can be: up,\ + down, from-zero (default), towards-zero, nearest", + ) + .value_name("METHOD") + .default_value("from-zero") + .possible_values(&["up", "down", "from-zero", "towards-zero", "nearest"]), + ) .arg(Arg::with_name(options::NUMBER).hidden(true).multiple(true)) .get_matches_from(args); diff --git a/src/uu/numfmt/src/options.rs b/src/uu/numfmt/src/options.rs index 17f0a6fbe..59bf9d8d3 100644 --- a/src/uu/numfmt/src/options.rs +++ b/src/uu/numfmt/src/options.rs @@ -1,4 +1,4 @@ -use crate::units::Transform; +use crate::units::Unit; use uucore::ranges::Range; pub const DELIMITER: &str = "delimiter"; @@ -10,12 +10,13 @@ pub const HEADER: &str = "header"; pub const HEADER_DEFAULT: &str = "1"; pub const NUMBER: &str = "NUMBER"; pub const PADDING: &str = "padding"; +pub const ROUND: &str = "round"; pub const TO: &str = "to"; pub const TO_DEFAULT: &str = "none"; pub struct TransformOptions { - pub from: Transform, - pub to: Transform, + pub from: Unit, + pub to: Unit, } pub struct NumfmtOptions { @@ -24,4 +25,38 @@ pub struct NumfmtOptions { pub header: usize, pub fields: Vec, pub delimiter: Option, + pub round: RoundMethod, +} + +#[derive(Clone, Copy)] +pub enum RoundMethod { + Up, + Down, + FromZero, + TowardsZero, + Nearest, +} + +impl RoundMethod { + pub fn round(&self, f: f64) -> f64 { + match self { + RoundMethod::Up => f.ceil(), + RoundMethod::Down => f.floor(), + RoundMethod::FromZero => { + if f < 0.0 { + f.floor() + } else { + f.ceil() + } + } + RoundMethod::TowardsZero => { + if f < 0.0 { + f.ceil() + } else { + f.floor() + } + } + RoundMethod::Nearest => f.round(), + } + } } diff --git a/src/uu/numfmt/src/units.rs b/src/uu/numfmt/src/units.rs index 5f9907bdf..8a2895ab7 100644 --- a/src/uu/numfmt/src/units.rs +++ b/src/uu/numfmt/src/units.rs @@ -24,10 +24,6 @@ pub enum Unit { None, } -pub struct Transform { - pub unit: Unit, -} - pub type Result = std::result::Result; #[derive(Clone, Copy, Debug)] diff --git a/tests/by-util/test_numfmt.rs b/tests/by-util/test_numfmt.rs index bb29d431e..336b0f7cd 100644 --- a/tests/by-util/test_numfmt.rs +++ b/tests/by-util/test_numfmt.rs @@ -35,7 +35,7 @@ fn test_from_iec_i_requires_suffix() { new_ucmd!() .args(&["--from=iec-i", "1024"]) .fails() - .stderr_is("numfmt: missing 'i' suffix in input: ‘1024’ (e.g Ki/Mi/Gi)"); + .stderr_is("numfmt: missing 'i' suffix in input: '1024' (e.g Ki/Mi/Gi)"); } #[test] @@ -123,7 +123,7 @@ fn test_header_error_if_non_numeric() { new_ucmd!() .args(&["--header=two"]) .run() - .stderr_is("numfmt: invalid header value ‘two’"); + .stderr_is("numfmt: invalid header value 'two'"); } #[test] @@ -131,7 +131,7 @@ fn test_header_error_if_0() { new_ucmd!() .args(&["--header=0"]) .run() - .stderr_is("numfmt: invalid header value ‘0’"); + .stderr_is("numfmt: invalid header value '0'"); } #[test] @@ -139,7 +139,7 @@ fn test_header_error_if_negative() { new_ucmd!() .args(&["--header=-3"]) .run() - .stderr_is("numfmt: invalid header value ‘-3’"); + .stderr_is("numfmt: invalid header value '-3'"); } #[test] @@ -187,7 +187,7 @@ fn test_should_report_invalid_empty_number_on_empty_stdin() { .args(&["--from=auto"]) .pipe_in("\n") .run() - .stderr_is("numfmt: invalid number: ‘’\n"); + .stderr_is("numfmt: invalid number: ''\n"); } #[test] @@ -196,7 +196,7 @@ fn test_should_report_invalid_empty_number_on_blank_stdin() { .args(&["--from=auto"]) .pipe_in(" \t \n") .run() - .stderr_is("numfmt: invalid number: ‘’\n"); + .stderr_is("numfmt: invalid number: ''\n"); } #[test] @@ -205,14 +205,14 @@ fn test_should_report_invalid_suffix_on_stdin() { .args(&["--from=auto"]) .pipe_in("1k") .run() - .stderr_is("numfmt: invalid suffix in input: ‘1k’\n"); + .stderr_is("numfmt: invalid suffix in input: '1k'\n"); // GNU numfmt reports this one as “invalid number” new_ucmd!() .args(&["--from=auto"]) .pipe_in("NaN") .run() - .stderr_is("numfmt: invalid suffix in input: ‘NaN’\n"); + .stderr_is("numfmt: invalid suffix in input: 'NaN'\n"); } #[test] @@ -222,7 +222,7 @@ fn test_should_report_invalid_number_with_interior_junk() { .args(&["--from=auto"]) .pipe_in("1x0K") .run() - .stderr_is("numfmt: invalid number: ‘1x0K’\n"); + .stderr_is("numfmt: invalid number: '1x0K'\n"); } #[test] @@ -461,7 +461,7 @@ fn test_delimiter_overrides_whitespace_separator() { .args(&["-d,"]) .pipe_in("1 234,56") .fails() - .stderr_is("numfmt: invalid number: ‘1 234’\n"); + .stderr_is("numfmt: invalid number: '1 234'\n"); } #[test] @@ -481,3 +481,27 @@ fn test_delimiter_with_padding_and_fields() { .succeeds() .stdout_only(" 1.0K| 2.0K\n"); } + +#[test] +fn test_round() { + for (method, exp) in &[ + ("from-zero", ["9.1K", "-9.1K", "9.1K", "-9.1K"]), + ("towards-zero", ["9.0K", "-9.0K", "9.0K", "-9.0K"]), + ("up", ["9.1K", "-9.0K", "9.1K", "-9.0K"]), + ("down", ["9.0K", "-9.1K", "9.0K", "-9.1K"]), + ("nearest", ["9.0K", "-9.0K", "9.1K", "-9.1K"]), + ] { + new_ucmd!() + .args(&[ + "--to=si", + &format!("--round={}", method), + "--", + "9001", + "-9001", + "9099", + "-9099", + ]) + .succeeds() + .stdout_only(exp.join("\n") + "\n"); + } +} From eaa93e9c27eac914a6735d160706df3709b581d6 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 20 Jun 2021 00:25:02 +0200 Subject: [PATCH 1077/1135] numfmt: move to common core --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 804c5f978..0fec2af78 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,6 +63,7 @@ feat_common_core = [ "more", "mv", "nl", + "numfmt", "od", "paste", "pr", @@ -160,7 +161,6 @@ feat_require_unix = [ "mkfifo", "mknod", "nice", - "numfmt", "nohup", "pathchk", "stat", From 90bf26a51c805ec0d8f776ff47f98e4e3e6bb1b1 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 6 Jun 2021 20:21:23 +0200 Subject: [PATCH 1078/1135] maint/CICD ~ (GHA) update to checkout@v2 --- .github/workflows/CICD.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index fcaddd310..65051a88e 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -26,7 +26,7 @@ jobs: job: - { os: ubuntu-latest , features: feat_os_unix } steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Initialize workflow variables id: vars shell: bash @@ -66,7 +66,7 @@ jobs: job: - { os: ubuntu-latest } steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Install/setup prerequisites shell: bash run: | @@ -87,7 +87,7 @@ jobs: - { os: macos-latest , features: feat_os_macos } - { os: windows-latest , features: feat_os_windows } steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Initialize workflow variables id: vars shell: bash @@ -122,7 +122,7 @@ jobs: job: - { os: ubuntu-latest , features: feat_os_unix } steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Install `rust` toolchain (v${{ env.RUST_MIN_SRV }}) uses: actions-rs/toolchain@v1 with: @@ -181,7 +181,7 @@ jobs: job: - { os: ubuntu-latest } steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Install `rust` toolchain uses: actions-rs/toolchain@v1 with: @@ -212,7 +212,7 @@ jobs: job: - { os: ubuntu-latest } steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Install `rust` toolchain uses: actions-rs/toolchain@v1 with: @@ -249,7 +249,7 @@ jobs: - { 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@v1 + - uses: actions/checkout@v2 - name: Install/setup prerequisites shell: bash run: | @@ -488,7 +488,7 @@ jobs: - { os: macos-latest , features: macos } - { os: windows-latest , features: windows } steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Install/setup prerequisites shell: bash run: | From 298851096ef941a3d9658002e5b9eac4f8fb1bea Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 12 Jun 2021 21:35:11 -0500 Subject: [PATCH 1079/1135] maint/CICD ~ (GHA) remove deprecated 'ubuntu-16.04' environment --- .github/workflows/CICD.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 65051a88e..2667169dd 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -235,8 +235,6 @@ 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-16.04 , target: x86_64-unknown-linux-gnu , features: feat_os_unix , 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 } From db621c7d7a0a8a23b2fedb0eac5deefa0b74198a Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 12 Jun 2021 13:46:37 -0500 Subject: [PATCH 1080/1135] maint/CICD ~ (GHA) change/refactor CICD (convert most warnings to errors) - adds additional instruction to error message showing how to fix the error --- .github/workflows/CICD.yml | 167 +++++++++++++++++++------------------ 1 file changed, 88 insertions(+), 79 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 2667169dd..48df4e546 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -48,36 +48,19 @@ jobs: - name: "`fmt` testing" shell: bash run: | - # `fmt` testing + ## `fmt` testing # * convert any warnings to GHA UI annotations; ref: - S=$(cargo fmt -- --check) && 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]+).*$/::warning file=\1,line=\2::WARNING: \`cargo fmt\`: style violation/p" ; } + 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" + if: success() || failure() # run regardless of prior step success/failure shell: bash run: | - # `fmt` testing of tests + ## `fmt` testing of tests # * convert any warnings to GHA UI annotations; ref: - S=$(find tests -name "*.rs" -print0 | xargs -0 cargo fmt -- --check) && printf "%s\n" "$S" || { printf "%s\n" "$S" | sed -E -n "s/^Diff[[:space:]]+in[[:space:]]+${PWD//\//\\/}\/(.*)[[:space:]]+at[[:space:]]+[^0-9]+([0-9]+).*$/::warning file=\1,line=\2::WARNING: \`cargo fmt\`: style violation/p" ; } + 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 ; } - 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: | - sudo apt-get -y update ; sudo apt-get -y install npm ; sudo npm install cspell -g; - - name: Run `cspell` - shell: bash - run: | - cspell --config .vscode/cSpell.json --no-summary --no-progress "**/*" | sed "s/\(.*\):\(.*\):\(.*\) - \(.*\)/::warning file=\1,line=\2,col=\3::cspell: \4/" || true - - code_warnings: - name: Style/warnings + code_lint: + name: Style/lint runs-on: ${{ matrix.job.os }} strategy: fail-fast: false @@ -106,13 +89,32 @@ jobs: default: true profile: minimal # minimal component installation (ie, no documentation) components: clippy - - name: "`clippy` testing" - if: success() || failure() # run regardless of prior step success/failure + - name: "`clippy` lint testing" shell: bash run: | - # `clippy` testing + ## `clippy` lint testing # * convert any warnings to GHA UI annotations; ref: - 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:]]+(.*):([0-9]+):([0-9]+).*$/::warning file=\2,line=\3,col=\4::WARNING: \`cargo clippy\`: \1/p;" -e '}' ; } + 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 ; } + + 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 @@ -137,20 +139,20 @@ jobs: use-tool-cache: true env: RUSTUP_TOOLCHAIN: stable - - name: Confirm compatible 'Cargo.lock' + - name: Confirm MinSRV compatible 'Cargo.lock' shell: bash run: | - # Confirm compatible 'Cargo.lock' + ## Confirm MinSRV compatible 'Cargo.lock' # * 'Cargo.lock' is required to be in a format that `cargo` of MinSRV can interpret (eg, v1-format for MinSRV < v1.38) - cargo fetch --locked --quiet || { echo "::error file=Cargo.lock::Incompatible 'Cargo.lock' format; try \`cargo +${{ env.RUST_MIN_SRV }} update\`" ; exit 1 ; } + cargo fetch --locked --quiet || { echo "::error file=Cargo.lock::Incompatible (or out-of-date) 'Cargo.lock' file; update using \`cargo +${{ env.RUST_MIN_SRV }} update\`" ; exit 1 ; } - name: Info shell: bash run: | - # Info - ## environment + ## Info + # environment echo "## environment" echo "CI='${CI}'" - ## tooling info display + # tooling info display echo "## tooling" which gcc >/dev/null 2>&1 && (gcc --version | head -1) || true rustup -V @@ -158,12 +160,11 @@ jobs: cargo -V rustc -V cargo-tree tree -V - ## dependencies + # 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 --frozen --all --no-dev-dependencies --no-indent --features ${{ matrix.job.features }} | grep -vE "$PWD" | sort --unique - - name: Test uses: actions-rs/cargo@v1 with: @@ -172,8 +173,8 @@ jobs: env: RUSTFLAGS: '-Awarnings' - busybox_test: - name: Busybox test suite + build_makefile: + name: Build/Makefile runs-on: ${{ matrix.job.os }} strategy: fail-fast: false @@ -188,42 +189,19 @@ jobs: toolchain: stable default: true profile: minimal # minimal component installation (ie, no documentation) - - name: "prepare busytest" + - name: Install/setup prerequisites shell: bash run: | - make prepare-busytest - - name: "run busybox testsuite" + ## Install/setup prerequisites + sudo apt-get -y update ; sudo apt-get -y install python3-sphinx ; + - name: "`make build`" shell: bash run: | - bindir=$(pwd)/target/debug - cd tmp/busybox-*/testsuite - ## S=$(bindir=$bindir ./runtest) && printf "%s\n" "$S" || { printf "%s\n" "$S" | grep "FAIL:" | sed -e "s/FAIL: /::warning ::Test failure:/g" ; } - output=$(bindir=$bindir ./runtest 2>&1 || true) - printf "%s\n" "${output}" - n_fails=$(echo "$output" | grep "^FAIL:\s" | wc --lines) - if [ $n_fails -gt 0 ] ; then echo "::warning ::${n_fails}+ test failures" ; fi - - makefile_build: - name: Test the build target of the Makefile - runs-on: ${{ matrix.job.os }} - strategy: - fail-fast: false - matrix: - job: - - { os: ubuntu-latest } - steps: - - uses: actions/checkout@v2 - - name: Install `rust` toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - default: true - profile: minimal # minimal component installation (ie, no documentation) - - name: "Run make build" - shell: bash - run: | - sudo apt-get -y update ; sudo apt-get -y install python3-sphinx; make build + - name: "`make test`" + shell: bash + run: | + make test build: name: Build @@ -251,7 +229,7 @@ jobs: - name: Install/setup prerequisites shell: bash run: | - ## install/setup prerequisites + ## 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 ;; @@ -350,7 +328,7 @@ jobs: - name: Create all needed build/work directories shell: bash run: | - ## create build/work space + ## Create build/work space mkdir -p '${{ steps.vars.outputs.STAGING }}' mkdir -p '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}' mkdir -p '${{ steps.vars.outputs.STAGING }}/dpkg' @@ -387,15 +365,15 @@ jobs: - name: Info shell: bash run: | - # Info - ## commit info + ## Info + # commit info echo "## commit" echo GITHUB_REF=${GITHUB_REF} echo GITHUB_SHA=${GITHUB_SHA} - ## environment + # environment echo "## environment" echo "CI='${CI}'" - ## tooling info display + # tooling info display echo "## tooling" which gcc >/dev/null 2>&1 && (gcc --version | head -1) || true rustup -V @@ -403,7 +381,7 @@ jobs: cargo -V rustc -V cargo-tree tree -V - ## dependencies + # dependencies echo "## dependency list" cargo fetch --locked --quiet cargo-tree tree --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --all --no-dev-dependencies --no-indent | grep -vE "$PWD" | sort --unique @@ -433,7 +411,7 @@ jobs: - name: Package shell: bash run: | - ## package artifact(s) + ## Package artifact(s) # binary cp 'target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}' '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/' # `strip` binary (if needed) @@ -474,6 +452,37 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + test_busybox: + name: Tests/BusyBox test suite + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + - { os: ubuntu-latest } + steps: + - uses: actions/checkout@v2 + - 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: | + ## Run BusyBox test suite + bindir=$(pwd)/target/debug + cd tmp/busybox-*/testsuite + output=$(bindir=$bindir ./runtest 2>&1 || true) + printf "%s\n" "${output}" + n_fails=$(echo "$output" | grep "^FAIL:\s" | wc --lines) + if [ $n_fails -gt 0 ] ; then echo "::warning ::${n_fails}+ test failures" ; fi + coverage: name: Code Coverage runs-on: ${{ matrix.job.os }} @@ -490,7 +499,7 @@ jobs: - name: Install/setup prerequisites shell: bash run: | - ## install/setup prerequisites + ## Install/setup prerequisites case '${{ matrix.job.os }}' in macos-latest) brew install coreutils ;; # needed for testing esac @@ -584,7 +593,7 @@ jobs: id: coverage shell: bash run: | - # generate coverage data + ## Generate coverage data COVERAGE_REPORT_DIR="target/debug" COVERAGE_REPORT_FILE="${COVERAGE_REPORT_DIR}/lcov.info" # GRCOV_IGNORE_OPTION='--ignore build.rs --ignore "/*" --ignore "[a-zA-Z]:/*"' ## `grcov` ignores these params when passed as an environment variable (why?) From 92630a06904072a4db064b25b33366cfe9bee2c1 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 12 Jun 2021 19:16:06 -0500 Subject: [PATCH 1081/1135] maint/CICD ~ (GHA) add 'Style/dependencies' checks --- .github/workflows/CICD.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 48df4e546..9d2edeac1 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -17,6 +17,40 @@ env: on: [push, pull_request] jobs: + code_deps: + name: Style/dependencies + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + 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() { for var in "$@" ; do echo steps.vars.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 + outputs CARGO_FEATURES_OPTION + - name: Install `rust` toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + profile: minimal # minimal component installation (ie, no documentation) + - name: "`cargo update` testing" + shell: bash + run: | + ## `cargo update` testing + # * convert any warnings to GHA UI annotations; ref: + cargo fetch --locked --quiet || { echo "::error file=Cargo.lock::'Cargo.lock' file requires update (use \`cargo +${{ env.RUST_MIN_SRV }} update\`)" ; exit 1 ; } + code_format: name: Style/format runs-on: ${{ matrix.job.os }} From 5682cf30320f144c6e11fff8371767ba47974c9a Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 12 Jun 2021 17:34:48 -0500 Subject: [PATCH 1082/1135] maint/CICD ~ (GHA) update 'GNU' workflow - show dashboard warnings only when tests FAIL or ERROR - improve comments - fix spelling and spelling exceptions --- .github/workflows/GNU.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 1f9250900..7ed5f4911 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -1,5 +1,7 @@ name: GNU +# spell-checker:ignore (names) gnulib ; (utils) autopoint gperf pyinotify texinfo ; (vars) XPASS + on: [push, pull_request] jobs: @@ -7,7 +9,6 @@ jobs: name: Run GNU tests runs-on: ubuntu-latest steps: - # Checks out a copy of your repository on the ubuntu-latest machine - name: Checkout code uutil uses: actions/checkout@v2 with: @@ -18,7 +19,7 @@ jobs: repository: 'coreutils/coreutils' path: 'gnu' ref: v8.32 - - name: Checkout GNU corelib + - name: Checkout GNU coreutils library (gnulib) uses: actions/checkout@v2 with: repository: 'coreutils/gnulib' @@ -32,23 +33,26 @@ jobs: default: true profile: minimal # minimal component installation (ie, no documentation) components: rustfmt - - name: Install deps + - name: Install dependencies shell: bash run: | + ## Install dependencies sudo apt-get update sudo apt-get install autoconf autopoint bison texinfo gperf gcc g++ gdb python-pyinotify python3-sphinx jq - name: Build binaries shell: bash run: | - cd uutils - bash util/build-gnu.sh + ## Build binaries + cd uutils + bash util/build-gnu.sh - name: Run GNU tests shell: bash run: | bash uutils/util/run-gnu-test.sh - - name: Extract tests info + - name: Extract testing info shell: bash run: | + ## Extract testing info LOG_FILE=gnu/tests/test-suite.log if test -f "$LOG_FILE" then @@ -58,7 +62,9 @@ jobs: FAIL=$(sed -n "s/.*# FAIL: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1) XPASS=$(sed -n "s/.*# XPASS: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1) ERROR=$(sed -n "s/.*# ERROR: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1) - echo "::warning ::GNU testsuite = TOTAL: $TOTAL / PASS: $PASS / FAIL: $FAIL / ERROR: $ERROR" + output="GNU tests summary = TOTAL: $TOTAL / PASS: $PASS / FAIL: $FAIL / ERROR: $ERROR" + echo "${output}" + if [[ "$FAIL" -gt 0 || "$ERROR" -gt 0 ]]; then echo "::warning ::${output}" ; fi jq -n \ --arg date "$(date --rfc-email)" \ --arg sha "$GITHUB_SHA" \ @@ -72,12 +78,10 @@ jobs: else echo "::error ::Failed to get summary of test results" fi - - uses: actions/upload-artifact@v2 with: name: test-report path: gnu/tests/**/*.log - - uses: actions/upload-artifact@v2 with: name: gnu-result From dd46c2f03b3c085828cbafc9e01ad63f5d06d061 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 12 Jun 2021 23:37:00 -0500 Subject: [PATCH 1083/1135] maint/CICD ~ (GHA) rename 'GNU' workflow to 'GnuTests' --- .github/workflows/{GNU.yml => GnuTests.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{GNU.yml => GnuTests.yml} (99%) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GnuTests.yml similarity index 99% rename from .github/workflows/GNU.yml rename to .github/workflows/GnuTests.yml index 7ed5f4911..90af6a689 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GnuTests.yml @@ -1,4 +1,4 @@ -name: GNU +name: GnuTests # spell-checker:ignore (names) gnulib ; (utils) autopoint gperf pyinotify texinfo ; (vars) XPASS From c171b13982dfae75e6e53f2c76934e0c37e94762 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 12 Jun 2021 19:50:40 -0500 Subject: [PATCH 1084/1135] docs/spell ~ update cspell dictionaries --- .vscode/cspell.dictionaries/acronyms+names.wordlist.txt | 2 ++ .vscode/cspell.dictionaries/jargon.wordlist.txt | 1 + .vscode/cspell.dictionaries/workspace.wordlist.txt | 8 +++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.vscode/cspell.dictionaries/acronyms+names.wordlist.txt b/.vscode/cspell.dictionaries/acronyms+names.wordlist.txt index 3956d1d8a..a46448a32 100644 --- a/.vscode/cspell.dictionaries/acronyms+names.wordlist.txt +++ b/.vscode/cspell.dictionaries/acronyms+names.wordlist.txt @@ -12,6 +12,7 @@ FIFOs FQDN # fully qualified domain name GID # group ID GIDs +GNU GNUEABI GNUEABIhf JFS @@ -45,6 +46,7 @@ Deno EditorConfig FreeBSD Gmail +GNU Irix MS-DOS MSDOS diff --git a/.vscode/cspell.dictionaries/jargon.wordlist.txt b/.vscode/cspell.dictionaries/jargon.wordlist.txt index 89af1b153..c2e2c29f3 100644 --- a/.vscode/cspell.dictionaries/jargon.wordlist.txt +++ b/.vscode/cspell.dictionaries/jargon.wordlist.txt @@ -78,6 +78,7 @@ symlinks syscall syscalls tokenize +toolchain truthy unbuffered unescape diff --git a/.vscode/cspell.dictionaries/workspace.wordlist.txt b/.vscode/cspell.dictionaries/workspace.wordlist.txt index ed634dffb..7242199a5 100644 --- a/.vscode/cspell.dictionaries/workspace.wordlist.txt +++ b/.vscode/cspell.dictionaries/workspace.wordlist.txt @@ -48,17 +48,19 @@ xattr # * rust/rustc RUSTDOCFLAGS RUSTFLAGS +clippy +rustc +rustfmt +rustup +# bitor # BitOr trait function bitxor # BitXor trait function -clippy concat fract powi println repr rfind -rustc -rustfmt struct structs substr From b11e9a057e3c08aa3edeffea4dd6d6e5e2064d8a Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 12 Jun 2021 19:52:34 -0500 Subject: [PATCH 1085/1135] docs/spell ~ (uucore) add spelling exceptions --- src/uucore/src/lib/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index f765b7b3e..bf2e5b1bb 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -186,7 +186,7 @@ mod tests { fn make_os_vec(os_str: &OsStr) -> Vec { vec![ OsString::from("test"), - OsString::from("สวัสดี"), + OsString::from("สวัสดี"), // spell-checker:disable-line os_str.to_os_string(), ] } From 2cb97c81ed9b214f718c3c6ec64210064be296f0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 6 Jun 2021 20:24:40 +0200 Subject: [PATCH 1086/1135] maint/CICD ~ add GHA 'FixPR' to auto-fix issues for merging PRs - auto-fix formatting - auto-fix incompatible/out-of-date 'Cargo.lock' --- .github/workflows/FixPR.yml | 133 ++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 .github/workflows/FixPR.yml diff --git a/.github/workflows/FixPR.yml b/.github/workflows/FixPR.yml new file mode 100644 index 000000000..17470df26 --- /dev/null +++ b/.github/workflows/FixPR.yml @@ -0,0 +1,133 @@ +name: FixPR + +# Trigger automated fixes for PRs being merged (with associated commits) + +env: + BRANCH_TARGET: master + +on: + # * only trigger on pull request closed to specific branches + # ref: https://github.community/t/trigger-workflow-only-on-pull-request-merge/17359/9 + pull_request: + branches: + - master # == env.BRANCH_TARGET ## unfortunately, env context variables are only available in jobs/steps (see ) + types: [ closed ] + +jobs: + code_deps: + # Refresh dependencies (ie, 'Cargo.lock') and show updated dependency tree + if: github.event.pull_request.merged == true ## only for PR merges + name: Update/dependencies + runs-on: ${{ matrix.job.os }} + strategy: + matrix: + job: + - { os: ubuntu-latest , features: feat_os_unix } + steps: + - uses: actions/checkout@v2 + - name: Initialize job 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; } + # surface MSRV from CICD workflow + RUST_MIN_SRV=$(grep -P "^\s+RUST_MIN_SRV:" .github/workflows/CICD.yml | grep -Po "(?<=\x22)\d+[.]\d+(?:[.]\d+)?(?=\x22)" ) + outputs RUST_MIN_SRV + - name: Install `rust` toolchain (v${{ steps.vars.outputs.RUST_MIN_SRV }}) + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ steps.vars.outputs.RUST_MIN_SRV }} + default: true + profile: minimal # minimal component installation (ie, no documentation) + - name: Install `cargo-tree` # for dependency information + uses: actions-rs/install@v0.1 + with: + crate: cargo-tree + version: latest + use-tool-cache: true + env: + RUSTUP_TOOLCHAIN: stable + - name: Ensure updated 'Cargo.lock' + shell: bash + run: | + # Ensure updated 'Cargo.lock' + # * 'Cargo.lock' is required to be in a format that `cargo` of MinSRV can interpret (eg, v1-format for MinSRV < v1.38) + cargo fetch --locked --quiet || cargo +${{ steps.vars.outputs.RUST_MIN_SRV }} update + - name: Info + shell: bash + run: | + # Info + ## environment + echo "## environment" + echo "CI='${CI}'" + ## tooling info display + echo "## tooling" + which gcc >/dev/null 2>&1 && (gcc --version | head -1) || true + rustup -V + rustup show active-toolchain + cargo -V + rustc -V + 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 --frozen --all --no-dev-dependencies --no-indent --features ${{ matrix.job.features }} | grep -vE "$PWD" | sort --unique + - name: Commit any changes (to '${{ env.BRANCH_TARGET }}') + uses: EndBug/add-and-commit@v7 + with: + branch: ${{ env.BRANCH_TARGET }} + default_author: github_actions + message: "maint ~ refresh 'Cargo.lock'" + add: Cargo.lock + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + code_format: + # Recheck/refresh code formatting + if: github.event.pull_request.merged == true ## only for PR merges + name: Update/format + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + - { os: ubuntu-latest , features: feat_os_unix } + steps: + - uses: actions/checkout@v2 + - name: Initialize job 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; } + # 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 + - name: Install `rust` toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + profile: minimal # minimal component installation (ie, no documentation) + components: rustfmt + - name: "`cargo fmt`" + shell: bash + run: | + cargo fmt + - name: "`cargo fmt` tests" + shell: bash + run: | + # `cargo fmt` of tests + find tests -name "*.rs" -print0 | xargs -0 cargo fmt -- + - name: Commit any changes (to '${{ env.BRANCH_TARGET }}') + uses: EndBug/add-and-commit@v7 + with: + branch: ${{ env.BRANCH_TARGET }} + default_author: github_actions + message: "maint ~ rustfmt (`cargo fmt`)" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b4a06cfdbad6db079f4a836996d06aef0c068986 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 12 Jun 2021 23:27:03 -0500 Subject: [PATCH 1087/1135] maint/CICD ~ refactor; improve logging for `outputs` shell script --- .github/workflows/CICD.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 9d2edeac1..a8046269a 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -32,7 +32,7 @@ jobs: shell: bash run: | ## VARs setup - outputs() { for var in "$@" ; do echo steps.vars.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } + 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='' ; @@ -66,7 +66,7 @@ jobs: shell: bash run: | ## VARs setup - outputs() { for var in "$@" ; do echo steps.vars.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } + 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='' ; @@ -110,7 +110,7 @@ jobs: shell: bash run: | ## VARs setup - outputs() { for var in "$@" ; do echo steps.vars.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } + 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='' ; @@ -276,7 +276,7 @@ jobs: shell: bash run: | ## VARs setup - outputs() { for var in "$@" ; do echo steps.vars.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } + outputs() { step_id="vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } # toolchain TOOLCHAIN="stable" ## default to "stable" toolchain # * specify alternate/non-default TOOLCHAIN for *-pc-windows-gnu targets; gnu targets on Windows are broken for the standard *-pc-windows-msvc toolchain (refs: GH:rust-lang/rust#47048, GH:rust-lang/rust#53454, GH:rust-lang/cargo#6754) @@ -382,7 +382,7 @@ jobs: shell: bash run: | ## Dependent VARs setup - outputs() { for var in "$@" ; do echo steps.vars.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } + outputs() { step_id="dep_vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } # * determine sub-crate utility list UTILITY_LIST="$(./util/show-utils.sh ${CARGO_FEATURES_OPTION})" echo UTILITY_LIST=${UTILITY_LIST} @@ -544,7 +544,7 @@ jobs: shell: bash run: | ## VARs setup - outputs() { for var in "$@" ; do echo steps.vars.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } + 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 # * specify gnu-type TOOLCHAIN for windows; `grcov` requires gnu-style code coverage data files @@ -579,7 +579,7 @@ jobs: shell: bash run: | ## Dependent VARs setup - outputs() { for var in "$@" ; do echo steps.vars.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } + outputs() { step_id="dep_vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } # * determine sub-crate utility list UTILITY_LIST="$(./util/show-utils.sh ${CARGO_FEATURES_OPTION})" CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo "-puu_${u}"; done;)" From c74bc2eedd10b1575836056e72a322184ec6f7d9 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 13 Jun 2021 00:36:05 -0500 Subject: [PATCH 1088/1135] maint/CICD ~ add 'GHA-delete-GNU-workflow-logs' shell script utility --- util/GHA-delete-GNU-workflow-logs.sh | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 util/GHA-delete-GNU-workflow-logs.sh diff --git a/util/GHA-delete-GNU-workflow-logs.sh b/util/GHA-delete-GNU-workflow-logs.sh new file mode 100644 index 000000000..19e3311d4 --- /dev/null +++ b/util/GHA-delete-GNU-workflow-logs.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +# spell-checker:ignore (utils) gitsome jq ; (gh) repos + +ME="${0}" +ME_dir="$(dirname -- "${ME}")" +ME_parent_dir="$(dirname -- "${ME_dir}")" +ME_parent_dir_abs="$(realpath -mP -- "${ME_parent_dir}")" + +# ref: + +# note: requires `gh` and `jq` + +## tools available? + +# * `gh` available? +unset GH +gh --version 1>/dev/null 2>&1 +if [ $? -eq 0 ]; then export GH="gh"; fi + +# * `jq` available? +unset JQ +jq --version 1>/dev/null 2>&1 +if [ $? -eq 0 ]; then export JQ="jq"; fi + +if [ -z "${GH}" ] || [ -z "${JQ}" ]; then + if [ -z "${GH}" ]; then + echo 'ERR!: missing `gh` (see install instructions at )' 1>&2 + fi + if [ -z "${JQ}" ]; then + echo 'ERR!: missing `jq` (install with `sudo apt install jq`)' 1>&2 + fi + exit 1 +fi + +dry_run=true + +USER_NAME=uutils +REPO_NAME=coreutils +WORK_NAME=GNU + +# * `--paginate` retrieves all pages +# gh api --paginate "repos/${USER_NAME}/${REPO_NAME}/actions/runs" | jq -r ".workflow_runs[] | select(.name == \"${WORK_NAME}\") | (.id)" | xargs -n1 sh -c "for arg do { echo gh api repos/${USER_NAME}/${REPO_NAME}/actions/runs/\${arg} -X DELETE ; if [ -z "$dry_run" ]; then gh api repos/${USER_NAME}/${REPO_NAME}/actions/runs/\${arg} -X DELETE ; fi ; } ; done ;" _ +gh api "repos/${USER_NAME}/${REPO_NAME}/actions/runs" | jq -r ".workflow_runs[] | select(.name == \"${WORK_NAME}\") | (.id)" | xargs -n1 sh -c "for arg do { echo gh api repos/${USER_NAME}/${REPO_NAME}/actions/runs/\${arg} -X DELETE ; if [ -z "$dry_run" ]; then gh api repos/${USER_NAME}/${REPO_NAME}/actions/runs/\${arg} -X DELETE ; fi ; } ; done ;" _ From f5edc500e03dc3fc37339e1b5441a4224d460b34 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 19 Jun 2021 10:53:06 -0500 Subject: [PATCH 1089/1135] tests ~ fix spelling errors --- tests/by-util/test_cut.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_cut.rs b/tests/by-util/test_cut.rs index e21010ec8..92bab4d75 100644 --- a/tests/by-util/test_cut.rs +++ b/tests/by-util/test_cut.rs @@ -162,7 +162,7 @@ fn test_directory_and_no_such_file() { fn test_equal_as_delimiter() { new_ucmd!() .args(&["-f", "2", "-d="]) - .pipe_in("--libdir=./out/lib") + .pipe_in("--dir=./out/lib") .succeeds() .stdout_only("./out/lib\n"); } From f6cb1324b630b8b0208efadc789d117557a81189 Mon Sep 17 00:00:00 2001 From: Anup Mahindre Date: Sun, 20 Jun 2021 13:19:50 +0530 Subject: [PATCH 1090/1135] ls: Fix problems dealing with dangling symlinks - For dangling symlinks, errors should only be reported if dereferencing options were passed and dereferencing was applicable to the particular symlink - With -i parameter, report '?' as the inode number for dangling symlinks --- src/uu/ls/src/ls.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 0bffa2e52..677556ab0 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1196,7 +1196,9 @@ fn list(locs: Vec, config: Config) -> i32 { for loc in &locs { let p = PathBuf::from(&loc); - if !p.exists() { + let path_data = PathData::new(p, None, None, &config, true); + + if !path_data.md().is_some() { show_error!("'{}': {}", &loc, "No such file or directory"); /* We found an error, the return code of ls should not be 0 @@ -1206,8 +1208,6 @@ fn list(locs: Vec, config: Config) -> i32 { continue; } - let path_data = PathData::new(p, None, None, &config, true); - let show_dir_contents = match path_data.file_type() { Some(ft) => !config.directory && ft.is_dir(), None => { @@ -1331,7 +1331,7 @@ fn enter_directory(dir: &PathData, config: &Config, out: &mut BufWriter) fn get_metadata(entry: &Path, dereference: bool) -> std::io::Result { if dereference { - entry.metadata().or_else(|_| entry.symlink_metadata()) + entry.metadata() } else { entry.symlink_metadata() } @@ -1733,7 +1733,11 @@ fn display_file_name(path: &PathData, config: &Config) -> Option { #[cfg(unix)] { if config.format != Format::Long && config.inode { - name = get_inode(path.md()?) + " " + &name; + name = path + .md() + .map_or_else(|| "?".to_string(), |md| get_inode(md)) + + " " + + &name; } } From d0039df8c3de451a07a52dc96f1d6b4d71181817 Mon Sep 17 00:00:00 2001 From: Anup Mahindre Date: Sun, 20 Jun 2021 13:50:38 +0530 Subject: [PATCH 1091/1135] tests: Add test for dangling symlinks with ls Add test similar to gnu dangling symlinks test --- tests/by-util/test_ls.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index f8aa4453b..741a304e3 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -2021,3 +2021,28 @@ fn test_ls_path() { .run() .stdout_is(expected_stdout); } + +#[test] +fn test_ls_dangling_symlinks() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.mkdir("temp_dir"); + at.symlink_file("does_not_exist", "temp_dir/dangle"); + + scene.ucmd().arg("-L").arg("temp_dir/dangle").fails(); + scene.ucmd().arg("-H").arg("temp_dir/dangle").fails(); + + scene + .ucmd() + .arg("temp_dir/dangle") + .succeeds() + .stdout_contains("dangle"); + + scene + .ucmd() + .arg("-Li") + .arg("temp_dir") + .succeeds() // this should fail, though at the moment, ls lacks a way to propagate errors encountered during display + .stdout_contains("? dangle"); +} From 5ac0274c133299c16cb48d76cd5ef12d3946b72e Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 20 Jun 2021 11:50:14 +0200 Subject: [PATCH 1092/1135] numfmt: fix doctest and spell check --- src/uu/numfmt/src/format.rs | 31 +++++++++++++++++++------------ src/uu/numfmt/src/numfmt.rs | 4 +++- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/uu/numfmt/src/format.rs b/src/uu/numfmt/src/format.rs index f0f1bf739..e44446818 100644 --- a/src/uu/numfmt/src/format.rs +++ b/src/uu/numfmt/src/format.rs @@ -131,25 +131,32 @@ fn transform_from(s: &str, opts: &Unit) -> Result { remove_suffix(i, suffix, opts).map(|n| if n < 0.0 { -n.abs().ceil() } else { n.ceil() }) } -/// Divide numerator by denominator, with ceiling. +/// Divide numerator by denominator, with rounding. /// -/// If the result of the division is less than 10.0, truncate the result -/// to the next highest tenth. +/// If the result of the division is less than 10.0, round to one decimal point. /// -/// Otherwise, truncate the result to the next highest whole number. +/// Otherwise, round to an integer. /// /// # Examples: /// /// ``` -/// use uu_numfmt::format::div_ceil; +/// use uu_numfmt::format::div_round; +/// use uu_numfmt::options::RoundMethod; /// -/// assert_eq!(div_ceil(1.01, 1.0), 1.1); -/// assert_eq!(div_ceil(999.1, 1000.), 1.0); -/// assert_eq!(div_ceil(1001., 10.), 101.); -/// assert_eq!(div_ceil(9991., 10.), 1000.); -/// assert_eq!(div_ceil(-12.34, 1.0), -13.0); -/// assert_eq!(div_ceil(1000.0, -3.14), -319.0); -/// assert_eq!(div_ceil(-271828.0, -271.0), 1004.0); +/// // Rounding methods: +/// assert_eq!(div_round(1.01, 1.0, RoundMethod::FromZero), 1.1); +/// assert_eq!(div_round(1.01, 1.0, RoundMethod::TowardsZero), 1.0); +/// assert_eq!(div_round(1.01, 1.0, RoundMethod::Up), 1.1); +/// assert_eq!(div_round(1.01, 1.0, RoundMethod::Down), 1.0); +/// assert_eq!(div_round(1.01, 1.0, RoundMethod::Nearest), 1.0); +/// +/// // Division: +/// assert_eq!(div_round(999.1, 1000.0, RoundMethod::FromZero), 1.0); +/// assert_eq!(div_round(1001., 10., RoundMethod::FromZero), 101.); +/// assert_eq!(div_round(9991., 10., RoundMethod::FromZero), 1000.); +/// assert_eq!(div_round(-12.34, 1.0, RoundMethod::FromZero), -13.0); +/// assert_eq!(div_round(1000.0, -3.14, RoundMethod::FromZero), -319.0); +/// assert_eq!(div_round(-271828.0, -271.0, RoundMethod::FromZero), 1004.0); /// ``` pub fn div_round(n: f64, d: f64, method: RoundMethod) -> f64 { let v = n / d; diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index 0a17882e8..b534a9789 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -5,6 +5,8 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. +// spell-checker:ignore N'th M'th + #[macro_use] extern crate uucore; @@ -16,7 +18,7 @@ use std::io::{BufRead, Write}; use uucore::ranges::Range; pub mod format; -mod options; +pub mod options; mod units; static ABOUT: &str = "Convert numbers from/to human-readable strings"; From 3b641afadcf57facf160b57c5e90bfeeeb68bed7 Mon Sep 17 00:00:00 2001 From: Anup Mahindre Date: Sun, 20 Jun 2021 16:56:25 +0530 Subject: [PATCH 1093/1135] ls: Fix issue with Windows and dangling symbolic links - Windows hidden file attribute determination would assume symbolic link to be valid and would panic - Check symbolic link's attributes if the link points to non-existing file --- src/uu/ls/src/ls.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 677556ab0..220eccb30 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1270,7 +1270,8 @@ fn sort_entries(entries: &mut Vec, config: &Config) { #[cfg(windows)] fn is_hidden(file_path: &DirEntry) -> bool { - let metadata = fs::metadata(file_path.path()).unwrap(); + let path = file_path.path(); + let metadata = fs::metadata(&path).unwrap_or_else(|_| fs::symlink_metadata(&path).unwrap()); let attr = metadata.file_attributes(); (attr & 0x2) > 0 } From ffb6b7152f8699b0a42fe811a576a6a3633f4baf Mon Sep 17 00:00:00 2001 From: Anup Mahindre Date: Sun, 20 Jun 2021 16:58:28 +0530 Subject: [PATCH 1094/1135] tests: Fix ls dangling symbolic links test output for windows On windows we do not print inode numbers at all, so skip checking for ? for dangling symbolic links in expected output --- tests/by-util/test_ls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 741a304e3..67112b4f5 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -2044,5 +2044,5 @@ fn test_ls_dangling_symlinks() { .arg("-Li") .arg("temp_dir") .succeeds() // this should fail, though at the moment, ls lacks a way to propagate errors encountered during display - .stdout_contains("? dangle"); + .stdout_contains(if cfg!(windows) { "dangle" } else { "? dangle" }); } From a91369bbff9f6587bfd23d76f043be25bfdbd294 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sun, 20 Jun 2021 19:10:51 +0200 Subject: [PATCH 1095/1135] cp: fix dead code warnings on windows --- src/uu/cp/src/cp.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 7cf6a1d9b..9186ec259 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1242,6 +1242,7 @@ fn copy_helper(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> return Err("--reflink is only supported on linux and macOS" .to_string() .into()); + #[cfg(any(target_os = "linux", target_os = "macos"))] if is_symlink { assert!(options.dereference); let real_path = std::fs::read_link(source)?; From 6aa79440f5c9ff2015a2b2d3c184b2c82699a4c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Lauzier?= Date: Sun, 20 Jun 2021 21:21:50 -0400 Subject: [PATCH 1096/1135] Fix a clippy warning --- src/uu/timeout/src/timeout.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index bc92157ca..f21a0265f 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -89,8 +89,8 @@ impl Config { signal, duration, preserve_status, - command, verbose, + command, } } } From 30e45eefa4a5e627a11d7a09f23cec7d5ec68137 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 21 Jun 2021 13:19:57 +0200 Subject: [PATCH 1097/1135] groups: fix to pass GNU Testsuite `groups-dash.sh` --- src/uu/groups/src/groups.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/groups/src/groups.rs b/src/uu/groups/src/groups.rs index 07c25cebb..746b7ff97 100644 --- a/src/uu/groups/src/groups.rs +++ b/src/uu/groups/src/groups.rs @@ -56,7 +56,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); 0 } else { - crash!(1, "unknown user {}", user); + crash!(1, "'{}': no such user", user); } } } From 25ef39472c46b231944d56e6cf53a1e220eeb6d2 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 21 Jun 2021 14:33:09 +0200 Subject: [PATCH 1098/1135] groups: fix to pass GNU Testsuite `groups-process-all.sh` * add support for multiple users * sync help text with GNU's `groups` manpage --- src/uu/groups/Cargo.toml | 2 +- src/uu/groups/src/groups.rs | 84 +++++++++++++++++++++++++------------ 2 files changed, 59 insertions(+), 27 deletions(-) diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index 4a5a537e5..e7ce52650 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -3,7 +3,7 @@ name = "uu_groups" version = "0.0.6" authors = ["uutils developers"] license = "MIT" -description = "groups ~ (uutils) display group memberships for USERNAME" +description = "groups ~ (uutils) print the groups a user is in" homepage = "https://github.com/uutils/coreutils" repository = "https://github.com/uutils/coreutils/tree/master/src/uu/groups" diff --git a/src/uu/groups/src/groups.rs b/src/uu/groups/src/groups.rs index 746b7ff97..22e7b8918 100644 --- a/src/uu/groups/src/groups.rs +++ b/src/uu/groups/src/groups.rs @@ -5,6 +5,13 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +// +// ============================================================================ +// Testsuite summary for GNU coreutils 8.32.162-4eda +// ============================================================================ +// PASS: tests/misc/groups-dash.sh +// PASS: tests/misc/groups-process-all.sh +// PASS: tests/misc/groups-version.sh // spell-checker:ignore (ToDO) passwd @@ -14,11 +21,15 @@ use uucore::entries::{get_groups_gnu, gid2grp, Locate, Passwd}; use clap::{crate_version, App, Arg}; -static ABOUT: &str = "display current group names"; -static OPT_USER: &str = "user"; +mod options { + pub const USERS: &str = "USERNAME"; +} +static ABOUT: &str = "Print group memberships for each USERNAME or, \ + if no USERNAME is specified, for\nthe current process \ + (which may differ if the groups data‐base has changed)."; fn get_usage() -> String { - format!("{0} [USERNAME]", executable!()) + format!("{0} [OPTION]... [USERNAME]...", executable!()) } pub fn uumain(args: impl uucore::Args) -> i32 { @@ -28,36 +39,57 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .version(crate_version!()) .about(ABOUT) .usage(&usage[..]) - .arg(Arg::with_name(OPT_USER)) + .arg( + Arg::with_name(options::USERS) + .multiple(true) + .takes_value(true) + .value_name(options::USERS), + ) .get_matches_from(args); - match matches.value_of(OPT_USER) { - None => { + let users: Vec = matches + .values_of(options::USERS) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + + let mut exit_code = 1; + + if users.is_empty() { + println!( + "{}", + get_groups_gnu(None) + .unwrap() + .iter() + .map(|&gid| gid2grp(gid).unwrap_or_else(|_| { + show_error!("cannot find name for group ID {}", gid); + exit_code = 1; + gid.to_string() + })) + .collect::>() + .join(" ") + ); + return exit_code; + } + + for user in users { + if let Ok(p) = Passwd::locate(user.as_str()) { println!( - "{}", - get_groups_gnu(None) - .unwrap() + "{} : {}", + user, + p.belongs_to() .iter() - .map(|&g| gid2grp(g).unwrap()) + .map(|&gid| gid2grp(gid).unwrap_or_else(|_| { + show_error!("cannot find name for group ID {}", gid); + exit_code = 1; + gid.to_string() + })) .collect::>() .join(" ") ); - 0 - } - Some(user) => { - if let Ok(p) = Passwd::locate(user) { - println!( - "{}", - p.belongs_to() - .iter() - .map(|&g| gid2grp(g).unwrap()) - .collect::>() - .join(" ") - ); - 0 - } else { - crash!(1, "'{}': no such user", user); - } + } else { + show_error!("'{}': no such user", user); + exit_code = 1; } } + exit_code } From 4b3224dd82d2f80bdca5598675f397c5577a568d Mon Sep 17 00:00:00 2001 From: Anup Mahindre Date: Mon, 21 Jun 2021 20:29:22 +0530 Subject: [PATCH 1099/1135] ls: Fix clippy warning --- src/uu/ls/src/ls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 220eccb30..1d050a376 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -1198,7 +1198,7 @@ fn list(locs: Vec, config: Config) -> i32 { let p = PathBuf::from(&loc); let path_data = PathData::new(p, None, None, &config, true); - if !path_data.md().is_some() { + if path_data.md().is_none() { show_error!("'{}': {}", &loc, "No such file or directory"); /* We found an error, the return code of ls should not be 0 From ed8d390ca7f563e742f9ad812ad6203996fa76f2 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 22 Jun 2021 14:25:32 +0200 Subject: [PATCH 1100/1135] CI/GNU: if an error is detected, don't generate the json file Avoid to generate incorrect json files --- .github/workflows/GnuTests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/GnuTests.yml b/.github/workflows/GnuTests.yml index 90af6a689..9c90b0a9c 100644 --- a/.github/workflows/GnuTests.yml +++ b/.github/workflows/GnuTests.yml @@ -62,6 +62,10 @@ jobs: FAIL=$(sed -n "s/.*# FAIL: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1) XPASS=$(sed -n "s/.*# XPASS: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1) ERROR=$(sed -n "s/.*# ERROR: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1) + if [[ "$TOTAL" --eq 0 || "$TOTAL" --eq 1 ]]; then + echo "Error in the execution, failing early" + exit 1 + fi output="GNU tests summary = TOTAL: $TOTAL / PASS: $PASS / FAIL: $FAIL / ERROR: $ERROR" echo "${output}" if [[ "$FAIL" -gt 0 || "$ERROR" -gt 0 ]]; then echo "::warning ::${output}" ; fi From e5a7bcbb9d6a29d0f9c3b8911ed4d4764cf51882 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Mon, 21 Jun 2021 21:13:40 +0200 Subject: [PATCH 1101/1135] tests: keep env vars for the temporary directory On some Windows machines this would otherwise cause `std::env::temp_dir` to fall back to a path that is not writeable (C:\\Windows). Since by default integration tests don't inherit env vars from the parent, we have to override this in some cases. --- tests/by-util/test_mktemp.rs | 4 ++-- tests/by-util/test_sort.rs | 15 ++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index d601bad5b..413b35bc5 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -386,7 +386,7 @@ fn test_mktemp_tmpdir_one_arg() { let scene = TestScenario::new(util_name!()); let result = scene - .ucmd() + .ucmd_keepenv() .arg("--tmpdir") .arg("apt-key-gpghome.XXXXXXXXXX") .succeeds(); @@ -399,7 +399,7 @@ fn test_mktemp_directory_tmpdir() { let scene = TestScenario::new(util_name!()); let result = scene - .ucmd() + .ucmd_keepenv() .arg("--directory") .arg("--tmpdir") .arg("apt-key-gpghome.XXXXXXXXXX") diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 0f9a9d3f1..01fafae00 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -28,7 +28,8 @@ fn test_helper(file_name: &str, possible_args: &[&str]) { fn test_buffer_sizes() { let buffer_sizes = ["0", "50K", "50k", "1M", "100M"]; for buffer_size in &buffer_sizes { - new_ucmd!() + TestScenario::new(util_name!()) + .ucmd_keepenv() .arg("-n") .arg("-S") .arg(buffer_size) @@ -40,7 +41,8 @@ fn test_buffer_sizes() { { let buffer_sizes = ["1000G", "10T"]; for buffer_size in &buffer_sizes { - new_ucmd!() + TestScenario::new(util_name!()) + .ucmd_keepenv() .arg("-n") .arg("-S") .arg(buffer_size) @@ -877,7 +879,8 @@ fn test_compress() { #[test] fn test_compress_fail() { - new_ucmd!() + TestScenario::new(util_name!()) + .ucmd_keepenv() .args(&[ "ext_sort.txt", "-n", @@ -892,7 +895,8 @@ fn test_compress_fail() { #[test] fn test_merge_batches() { - new_ucmd!() + TestScenario::new(util_name!()) + .ucmd_keepenv() .args(&["ext_sort.txt", "-n", "-S", "150b"]) .succeeds() .stdout_only_fixture("ext_sort.expected"); @@ -900,7 +904,8 @@ fn test_merge_batches() { #[test] fn test_merge_batch_size() { - new_ucmd!() + TestScenario::new(util_name!()) + .ucmd_keepenv() .arg("--batch-size=2") .arg("-m") .arg("--unique") From 622504467f369198ce5839560617130199b6b917 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Tue, 22 Jun 2021 17:36:56 +0200 Subject: [PATCH 1102/1135] mktemp: note that windows uses a different env var for tmpdir On windows `std::env::temp_dir` uses the `TMP` environment variable instead of `TMPDIR`. --- src/uu/mktemp/src/mktemp.rs | 4 ++-- tests/by-util/test_mktemp.rs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index e04de8702..bd77e9d51 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -77,14 +77,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_TMPDIR) .help( "interpret TEMPLATE relative to DIR; if DIR is not specified, use \ - $TMPDIR if set, else /tmp. With this option, TEMPLATE must not \ + $TMPDIR ($TMP on windows) if set, else /tmp. With this option, TEMPLATE must not \ be an absolute name; unlike with -t, TEMPLATE may contain \ slashes, but mktemp creates only the final component", ) .value_name("DIR"), ) .arg(Arg::with_name(OPT_T).short(OPT_T).help( - "Generate a template (using the supplied prefix and TMPDIR if set) \ + "Generate a template (using the supplied prefix and TMPDIR (TMP on windows) if set) \ to create a filename template [deprecated]", )) .arg( diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index 413b35bc5..bcf75ee20 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -17,7 +17,10 @@ static TEST_TEMPLATE8: &str = "tempXXXl/ate"; #[cfg(windows)] static TEST_TEMPLATE8: &str = "tempXXXl\\ate"; +#[cfg(not(windows))] const TMPDIR: &str = "TMPDIR"; +#[cfg(windows)] +const TMPDIR: &str = "TMP"; #[test] fn test_mktemp_mktemp() { From 34db1c591654ad08c29c12028f78c404fb1aa7a7 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 22 Jun 2021 18:03:12 +0200 Subject: [PATCH 1103/1135] Simple dash, not double --- .github/workflows/GnuTests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GnuTests.yml b/.github/workflows/GnuTests.yml index 9c90b0a9c..8bf6c091b 100644 --- a/.github/workflows/GnuTests.yml +++ b/.github/workflows/GnuTests.yml @@ -62,7 +62,7 @@ jobs: FAIL=$(sed -n "s/.*# FAIL: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1) XPASS=$(sed -n "s/.*# XPASS: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1) ERROR=$(sed -n "s/.*# ERROR: \(.*\)/\1/p" "$LOG_FILE"|tr -d '\r'|head -n1) - if [[ "$TOTAL" --eq 0 || "$TOTAL" --eq 1 ]]; then + if [[ "$TOTAL" -eq 0 || "$TOTAL" -eq 1 ]]; then echo "Error in the execution, failing early" exit 1 fi From 4a956f38b9ef8d005c0f926c3c4bbfd6dd5661f7 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sun, 20 Jun 2021 23:56:14 +0200 Subject: [PATCH 1104/1135] sort: separate additional data from the Line struct Data that was previously boxed inside the `Line` struct was moved to separate vectors. Inside of each `Line` remains only an index that allows to access that data. This helps with keeping the `Line` struct small and therefore reduces memory usage in most cases. Additionally, this improves performance because one big allocation (the vectors) are faster than many small ones (many boxes inside of each `Line`). Those vectors can be reused as well, reducing the amount of (de-)allocations. --- src/uu/sort/src/check.rs | 32 ++-- src/uu/sort/src/chunks.rs | 130 ++++++++++++---- src/uu/sort/src/ext_sort.rs | 76 ++++++---- src/uu/sort/src/merge.rs | 35 ++--- src/uu/sort/src/sort.rs | 290 ++++++++++++++++++++---------------- 5 files changed, 347 insertions(+), 216 deletions(-) diff --git a/src/uu/sort/src/check.rs b/src/uu/sort/src/check.rs index f53e4edb4..f1cd22686 100644 --- a/src/uu/sort/src/check.rs +++ b/src/uu/sort/src/check.rs @@ -8,7 +8,7 @@ //! Check if a file is ordered use crate::{ - chunks::{self, Chunk}, + chunks::{self, Chunk, RecycledChunk}, compare_by, open, GlobalSettings, }; use itertools::Itertools; @@ -34,7 +34,7 @@ pub fn check(path: &str, settings: &GlobalSettings) -> i32 { move || reader(file, recycled_receiver, loaded_sender, &settings) }); for _ in 0..2 { - let _ = recycled_sender.send(Chunk::new(vec![0; 100 * 1024], |_| Vec::new())); + let _ = recycled_sender.send(RecycledChunk::new(100 * 1024)); } let mut prev_chunk: Option = None; @@ -44,21 +44,29 @@ pub fn check(path: &str, settings: &GlobalSettings) -> i32 { if let Some(prev_chunk) = prev_chunk.take() { // Check if the first element of the new chunk is greater than the last // element from the previous chunk - let prev_last = prev_chunk.borrow_lines().last().unwrap(); - let new_first = chunk.borrow_lines().first().unwrap(); + let prev_last = prev_chunk.lines().last().unwrap(); + let new_first = chunk.lines().first().unwrap(); - if compare_by(prev_last, new_first, settings) == Ordering::Greater { + if compare_by( + prev_last, + new_first, + settings, + prev_chunk.line_data(), + chunk.line_data(), + ) == Ordering::Greater + { if !settings.check_silent { println!("sort: {}:{}: disorder: {}", path, line_idx, new_first.line); } return 1; } - let _ = recycled_sender.send(prev_chunk); + let _ = recycled_sender.send(prev_chunk.recycle()); } - for (a, b) in chunk.borrow_lines().iter().tuple_windows() { + for (a, b) in chunk.lines().iter().tuple_windows() { line_idx += 1; - if compare_by(a, b, settings) == Ordering::Greater { + if compare_by(a, b, settings, chunk.line_data(), chunk.line_data()) == Ordering::Greater + { if !settings.check_silent { println!("sort: {}:{}: disorder: {}", path, line_idx, b.line); } @@ -74,16 +82,15 @@ pub fn check(path: &str, settings: &GlobalSettings) -> i32 { /// The function running on the reader thread. fn reader( mut file: Box, - receiver: Receiver, + receiver: Receiver, sender: SyncSender, settings: &GlobalSettings, ) { let mut carry_over = vec![]; - for chunk in receiver.iter() { - let (recycled_lines, recycled_buffer) = chunk.recycle(); + for recycled_chunk in receiver.iter() { let should_continue = chunks::read( &sender, - recycled_buffer, + recycled_chunk, None, &mut carry_over, &mut file, @@ -93,7 +100,6 @@ fn reader( } else { b'\n' }, - recycled_lines, settings, ); if !should_continue { diff --git a/src/uu/sort/src/chunks.rs b/src/uu/sort/src/chunks.rs index d452401df..9e9d212c2 100644 --- a/src/uu/sort/src/chunks.rs +++ b/src/uu/sort/src/chunks.rs @@ -15,7 +15,7 @@ use std::{ use memchr::memchr_iter; use ouroboros::self_referencing; -use crate::{GlobalSettings, Line}; +use crate::{numeric_str_cmp::NumInfo, GeneralF64ParseResult, GlobalSettings, Line}; /// The chunk that is passed around between threads. /// `lines` consist of slices into `buffer`. @@ -25,28 +25,87 @@ pub struct Chunk { pub buffer: Vec, #[borrows(buffer)] #[covariant] - pub lines: Vec>, + pub contents: ChunkContents<'this>, +} + +#[derive(Debug)] +pub struct ChunkContents<'a> { + pub lines: Vec>, + pub line_data: LineData<'a>, +} + +#[derive(Debug)] +pub struct LineData<'a> { + pub selections: Vec<&'a str>, + pub num_infos: Vec, + pub parsed_floats: Vec, } impl Chunk { /// Destroy this chunk and return its components to be reused. - /// - /// # Returns - /// - /// * The `lines` vector, emptied - /// * The `buffer` vector, **not** emptied - pub fn recycle(mut self) -> (Vec>, Vec) { - let recycled_lines = self.with_lines_mut(|lines| { - lines.clear(); - unsafe { + pub fn recycle(mut self) -> RecycledChunk { + let recycled_contents = self.with_contents_mut(|contents| { + contents.lines.clear(); + contents.line_data.selections.clear(); + contents.line_data.num_infos.clear(); + contents.line_data.parsed_floats.clear(); + let lines = unsafe { // SAFETY: It is safe to (temporarily) transmute to a vector of lines with a longer lifetime, // because the vector is empty. // Transmuting is necessary to make recycling possible. See https://github.com/rust-lang/rfcs/pull/2802 // for a rfc to make this unnecessary. Its example is similar to the code here. - std::mem::transmute::>, Vec>>(std::mem::take(lines)) - } + std::mem::transmute::>, Vec>>(std::mem::take( + &mut contents.lines, + )) + }; + let selections = unsafe { + // SAFETY: (same as above) It is safe to (temporarily) transmute to a vector of &str with a longer lifetime, + // because the vector is empty. + std::mem::transmute::, Vec<&'static str>>(std::mem::take( + &mut contents.line_data.selections, + )) + }; + ( + lines, + selections, + std::mem::take(&mut contents.line_data.num_infos), + std::mem::take(&mut contents.line_data.parsed_floats), + ) }); - (recycled_lines, self.into_heads().buffer) + RecycledChunk { + lines: recycled_contents.0, + selections: recycled_contents.1, + num_infos: recycled_contents.2, + parsed_floats: recycled_contents.3, + buffer: self.into_heads().buffer, + } + } + + pub fn lines(&self) -> &Vec { + &self.borrow_contents().lines + } + pub fn line_data(&self) -> &LineData { + &self.borrow_contents().line_data + } +} + +pub struct RecycledChunk { + lines: Vec>, + selections: Vec<&'static str>, + num_infos: Vec, + parsed_floats: Vec, + buffer: Vec, +} + +impl RecycledChunk { + pub fn new(capacity: usize) -> Self { + RecycledChunk { + lines: Vec::new(), + selections: Vec::new(), + num_infos: Vec::new(), + parsed_floats: Vec::new(), + buffer: vec![0; capacity], + } } } @@ -63,28 +122,32 @@ impl Chunk { /// (see also `read_to_chunk` for a more detailed documentation) /// /// * `sender`: The sender to send the lines to the sorter. -/// * `buffer`: The recycled buffer. All contents will be overwritten, but it must already be filled. +/// * `recycled_chunk`: The recycled chunk, as returned by `Chunk::recycle`. /// (i.e. `buffer.len()` should be equal to `buffer.capacity()`) /// * `max_buffer_size`: How big `buffer` can be. /// * `carry_over`: The bytes that must be carried over in between invocations. /// * `file`: The current file. /// * `next_files`: What `file` should be updated to next. /// * `separator`: The line separator. -/// * `lines`: The recycled vector to fill with lines. Must be empty. /// * `settings`: The global settings. #[allow(clippy::too_many_arguments)] pub fn read( sender: &SyncSender, - mut buffer: Vec, + recycled_chunk: RecycledChunk, max_buffer_size: Option, carry_over: &mut Vec, file: &mut T, next_files: &mut impl Iterator, separator: u8, - lines: Vec>, settings: &GlobalSettings, ) -> bool { - assert!(lines.is_empty()); + let RecycledChunk { + lines, + selections, + num_infos, + parsed_floats, + mut buffer, + } = recycled_chunk; if buffer.len() < carry_over.len() { buffer.resize(carry_over.len() + 10 * 1024, 0); } @@ -101,15 +164,25 @@ pub fn read( carry_over.extend_from_slice(&buffer[read..]); if read != 0 { - let payload = Chunk::new(buffer, |buf| { + let payload = Chunk::new(buffer, |buffer| { + let selections = unsafe { + // SAFETY: It is safe to transmute to an empty vector of selections with shorter lifetime. + // It was only temporarily transmuted to a Vec> to make recycling possible. + std::mem::transmute::, Vec<&'_ str>>(selections) + }; let mut lines = unsafe { - // SAFETY: It is safe to transmute to a vector of lines with shorter lifetime, + // SAFETY: (same as above) It is safe to transmute to a vector of lines with shorter lifetime, // because it was only temporarily transmuted to a Vec> to make recycling possible. std::mem::transmute::>, Vec>>(lines) }; - let read = crash_if_err!(1, std::str::from_utf8(&buf[..read])); - parse_lines(read, &mut lines, separator, settings); - lines + let read = crash_if_err!(1, std::str::from_utf8(&buffer[..read])); + let mut line_data = LineData { + selections, + num_infos, + parsed_floats, + }; + parse_lines(read, &mut lines, &mut line_data, separator, settings); + ChunkContents { lines, line_data } }); sender.send(payload).unwrap(); } @@ -120,6 +193,7 @@ pub fn read( fn parse_lines<'a>( mut read: &'a str, lines: &mut Vec>, + line_data: &mut LineData<'a>, separator: u8, settings: &GlobalSettings, ) { @@ -128,9 +202,15 @@ fn parse_lines<'a>( read = &read[..read.len() - 1]; } + assert!(lines.is_empty()); + assert!(line_data.selections.is_empty()); + assert!(line_data.num_infos.is_empty()); + assert!(line_data.parsed_floats.is_empty()); + let mut token_buffer = vec![]; lines.extend( read.split(separator as char) - .map(|line| Line::create(line, settings)), + .enumerate() + .map(|(index, line)| Line::create(line, index, line_data, &mut token_buffer, settings)), ); } diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs index 44ff6014a..e0814b7a2 100644 --- a/src/uu/sort/src/ext_sort.rs +++ b/src/uu/sort/src/ext_sort.rs @@ -23,15 +23,16 @@ use std::{ use itertools::Itertools; +use crate::chunks::RecycledChunk; use crate::merge::ClosedTmpFile; use crate::merge::WriteableCompressedTmpFile; use crate::merge::WriteablePlainTmpFile; use crate::merge::WriteableTmpFile; -use crate::Line; use crate::{ chunks::{self, Chunk}, - compare_by, merge, output_sorted_lines, sort_by, GlobalSettings, + compare_by, merge, sort_by, GlobalSettings, }; +use crate::{print_sorted, Line}; use tempfile::TempDir; const START_BUFFER_SIZE: usize = 8_000; @@ -98,16 +99,39 @@ fn reader_writer>, Tmp: WriteableTmpFile merger.write_all(settings); } ReadResult::SortedSingleChunk(chunk) => { - output_sorted_lines(chunk.borrow_lines().iter(), settings); + if settings.unique { + print_sorted( + chunk.lines().iter().dedup_by(|a, b| { + compare_by(a, b, settings, chunk.line_data(), chunk.line_data()) + == Ordering::Equal + }), + settings, + ); + } else { + print_sorted(chunk.lines().iter(), settings); + } } ReadResult::SortedTwoChunks([a, b]) => { - let merged_iter = a - .borrow_lines() - .iter() - .merge_by(b.borrow_lines().iter(), |line_a, line_b| { - compare_by(line_a, line_b, settings) != Ordering::Greater - }); - output_sorted_lines(merged_iter, settings); + let merged_iter = a.lines().iter().map(|line| (line, &a)).merge_by( + b.lines().iter().map(|line| (line, &b)), + |(line_a, a), (line_b, b)| { + compare_by(line_a, line_b, settings, a.line_data(), b.line_data()) + != Ordering::Greater + }, + ); + if settings.unique { + print_sorted( + merged_iter + .dedup_by(|(line_a, a), (line_b, b)| { + compare_by(line_a, line_b, settings, a.line_data(), b.line_data()) + == Ordering::Equal + }) + .map(|(line, _)| line), + settings, + ); + } else { + print_sorted(merged_iter.map(|(line, _)| line), settings); + } } ReadResult::EmptyInput => { // don't output anything @@ -118,7 +142,9 @@ fn reader_writer>, Tmp: WriteableTmpFile /// The function that is executed on the sorter thread. fn sorter(receiver: Receiver, sender: SyncSender, settings: GlobalSettings) { while let Ok(mut payload) = receiver.recv() { - payload.with_lines_mut(|lines| sort_by(lines, &settings)); + payload.with_contents_mut(|contents| { + sort_by(&mut contents.lines, &settings, &contents.line_data) + }); sender.send(payload).unwrap(); } } @@ -154,20 +180,16 @@ fn read_write_loop( for _ in 0..2 { let should_continue = chunks::read( &sender, - vec![ - 0; - if START_BUFFER_SIZE < buffer_size { - START_BUFFER_SIZE - } else { - buffer_size - } - ], + RecycledChunk::new(if START_BUFFER_SIZE < buffer_size { + START_BUFFER_SIZE + } else { + buffer_size + }), Some(buffer_size), &mut carry_over, &mut file, &mut files, separator, - Vec::new(), settings, ); @@ -216,18 +238,17 @@ fn read_write_loop( file_number += 1; - let (recycled_lines, recycled_buffer) = chunk.recycle(); + let recycled_chunk = chunk.recycle(); if let Some(sender) = &sender_option { let should_continue = chunks::read( sender, - recycled_buffer, + recycled_chunk, None, &mut carry_over, &mut file, &mut files, separator, - recycled_lines, settings, ); if !should_continue { @@ -245,12 +266,9 @@ fn write( compress_prog: Option<&str>, separator: u8, ) -> I::Closed { - chunk.with_lines_mut(|lines| { - // Write the lines to the file - let mut tmp_file = I::create(file, compress_prog); - write_lines(lines, tmp_file.as_write(), separator); - tmp_file.finished_writing() - }) + let mut tmp_file = I::create(file, compress_prog); + write_lines(chunk.lines(), tmp_file.as_write(), separator); + tmp_file.finished_writing() } fn write_lines<'a, T: Write>(lines: &[Line<'a>], writer: &mut T, separator: u8) { diff --git a/src/uu/sort/src/merge.rs b/src/uu/sort/src/merge.rs index 173faaffc..12d7a9b9b 100644 --- a/src/uu/sort/src/merge.rs +++ b/src/uu/sort/src/merge.rs @@ -24,7 +24,7 @@ use itertools::Itertools; use tempfile::TempDir; use crate::{ - chunks::{self, Chunk}, + chunks::{self, Chunk, RecycledChunk}, compare_by, GlobalSettings, }; @@ -125,14 +125,14 @@ fn merge_without_limit>( })); // Send the initial chunk to trigger a read for each file request_sender - .send((file_number, Chunk::new(vec![0; 8 * 1024], |_| Vec::new()))) + .send((file_number, RecycledChunk::new(8 * 1024))) .unwrap(); } // Send the second chunk for each file for file_number in 0..reader_files.len() { request_sender - .send((file_number, Chunk::new(vec![0; 8 * 1024], |_| Vec::new()))) + .send((file_number, RecycledChunk::new(8 * 1024))) .unwrap(); } @@ -181,13 +181,12 @@ struct ReaderFile { /// The function running on the reader thread. fn reader( - recycled_receiver: Receiver<(usize, Chunk)>, + recycled_receiver: Receiver<(usize, RecycledChunk)>, files: &mut [Option>], settings: &GlobalSettings, separator: u8, ) { - for (file_idx, chunk) in recycled_receiver.iter() { - let (recycled_lines, recycled_buffer) = chunk.recycle(); + for (file_idx, recycled_chunk) in recycled_receiver.iter() { if let Some(ReaderFile { file, sender, @@ -196,13 +195,12 @@ fn reader( { let should_continue = chunks::read( sender, - recycled_buffer, + recycled_chunk, None, carry_over, file.as_read(), &mut iter::empty(), separator, - recycled_lines, settings, ); if !should_continue { @@ -234,7 +232,7 @@ struct PreviousLine { /// Merges files together. This is **not** an iterator because of lifetime problems. pub struct FileMerger<'a> { heap: binary_heap_plus::BinaryHeap>, - request_sender: Sender<(usize, Chunk)>, + request_sender: Sender<(usize, RecycledChunk)>, prev: Option, } @@ -257,14 +255,16 @@ impl<'a> FileMerger<'a> { file_number: file.file_number, }); - file.current_chunk.with_lines(|lines| { - let current_line = &lines[file.line_idx]; + file.current_chunk.with_contents(|contents| { + let current_line = &contents.lines[file.line_idx]; if settings.unique { if let Some(prev) = &prev { let cmp = compare_by( - &prev.chunk.borrow_lines()[prev.line_idx], + &prev.chunk.lines()[prev.line_idx], current_line, settings, + prev.chunk.line_data(), + file.current_chunk.line_data(), ); if cmp == Ordering::Equal { return; @@ -274,8 +274,7 @@ impl<'a> FileMerger<'a> { current_line.print(out, settings); }); - let was_last_line_for_file = - file.current_chunk.borrow_lines().len() == file.line_idx + 1; + let was_last_line_for_file = file.current_chunk.lines().len() == file.line_idx + 1; if was_last_line_for_file { if let Ok(next_chunk) = file.receiver.recv() { @@ -295,7 +294,7 @@ impl<'a> FileMerger<'a> { // If nothing is referencing the previous chunk anymore, this means that the previous line // was the last line of the chunk. We can recycle the chunk. self.request_sender - .send((prev.file_number, prev_chunk)) + .send((prev.file_number, prev_chunk.recycle())) .ok(); } } @@ -312,9 +311,11 @@ struct FileComparator<'a> { impl<'a> Compare for FileComparator<'a> { fn compare(&self, a: &MergeableFile, b: &MergeableFile) -> Ordering { let mut cmp = compare_by( - &a.current_chunk.borrow_lines()[a.line_idx], - &b.current_chunk.borrow_lines()[b.line_idx], + &a.current_chunk.lines()[a.line_idx], + &b.current_chunk.lines()[b.line_idx], self.settings, + a.current_chunk.line_data(), + b.current_chunk.line_data(), ); if cmp == Ordering::Equal { // To make sorting stable, we need to consider the file number as well, diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 7f3d2872e..2512d65d1 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -23,11 +23,11 @@ mod ext_sort; mod merge; mod numeric_str_cmp; +use chunks::LineData; use clap::{crate_version, App, Arg}; use custom_str_cmp::custom_str_cmp; use ext_sort::ext_sort; use fnv::FnvHasher; -use itertools::Itertools; use numeric_str_cmp::{numeric_str_cmp, NumInfo, NumInfoParseSettings}; use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; @@ -170,6 +170,17 @@ pub struct GlobalSettings { tmp_dir: PathBuf, compress_prog: Option, merge_batch_size: usize, + precomputed: Precomputed, +} + +/// Data needed for sorting. Should be computed once before starting to sort +/// by calling `GlobalSettings::init_precomputed`. +#[derive(Clone, Debug)] +struct Precomputed { + needs_tokens: bool, + num_infos_per_line: usize, + floats_per_line: usize, + selections_per_line: usize, } impl GlobalSettings { @@ -210,6 +221,28 @@ impl GlobalSettings { None => BufWriter::new(Box::new(stdout()) as Box), } } + + /// Precompute some data needed for sorting. + /// This function **must** be called before starting to sort, and `GlobalSettings` may not be altered + /// afterwards. + fn init_precomputed(&mut self) { + self.precomputed.needs_tokens = self.selectors.iter().any(|s| s.needs_tokens); + self.precomputed.selections_per_line = self + .selectors + .iter() + .filter(|s| !s.is_default_selection) + .count(); + self.precomputed.num_infos_per_line = self + .selectors + .iter() + .filter(|s| matches!(s.settings.mode, SortMode::Numeric | SortMode::HumanNumeric)) + .count(); + self.precomputed.floats_per_line = self + .selectors + .iter() + .filter(|s| matches!(s.settings.mode, SortMode::GeneralNumeric)) + .count(); + } } impl Default for GlobalSettings { @@ -237,9 +270,16 @@ impl Default for GlobalSettings { tmp_dir: PathBuf::new(), compress_prog: None, merge_batch_size: 32, + precomputed: Precomputed { + num_infos_per_line: 0, + floats_per_line: 0, + selections_per_line: 0, + needs_tokens: false, + }, } } } + #[derive(Clone, PartialEq, Debug)] struct KeySettings { mode: SortMode, @@ -322,32 +362,10 @@ impl Default for KeySettings { Self::from(&GlobalSettings::default()) } } - -#[derive(Clone, Debug)] enum NumCache { AsF64(GeneralF64ParseResult), WithInfo(NumInfo), -} - -impl NumCache { - fn as_f64(&self) -> GeneralF64ParseResult { - match self { - NumCache::AsF64(n) => *n, - _ => unreachable!(), - } - } - fn as_num_info(&self) -> &NumInfo { - match self { - NumCache::WithInfo(n) => n, - _ => unreachable!(), - } - } -} - -#[derive(Clone, Debug)] -struct Selection<'a> { - slice: &'a str, - num_cache: Option>, + None, } type Field = Range; @@ -355,31 +373,39 @@ type Field = Range; #[derive(Clone, Debug)] pub struct Line<'a> { line: &'a str, - selections: Box<[Selection<'a>]>, + index: usize, } impl<'a> Line<'a> { - fn create(string: &'a str, settings: &GlobalSettings) -> Self { - let fields = if settings + /// Creates a new `Line`. + /// + /// If additional data is needed for sorting it is added to `line_data`. + /// `token_buffer` allows to reuse the allocation for tokens. + fn create( + line: &'a str, + index: usize, + line_data: &mut LineData<'a>, + token_buffer: &mut Vec, + settings: &GlobalSettings, + ) -> Self { + token_buffer.clear(); + if settings.precomputed.needs_tokens { + tokenize(line, settings.separator, token_buffer); + } + for (selection, num_cache) in settings .selectors .iter() - .any(|selector| selector.needs_tokens) + .filter(|selector| !selector.is_default_selection) + .map(|selector| selector.get_selection(line, token_buffer)) { - // Only tokenize if we will need tokens. - Some(tokenize(string, settings.separator)) - } else { - None - }; - - Line { - line: string, - selections: settings - .selectors - .iter() - .filter(|selector| !selector.is_default_selection) - .map(|selector| selector.get_selection(string, fields.as_deref())) - .collect(), + line_data.selections.push(selection); + match num_cache { + NumCache::AsF64(parsed_float) => line_data.parsed_floats.push(parsed_float), + NumCache::WithInfo(num_info) => line_data.num_infos.push(num_info), + NumCache::None => (), + } } + Self { line, index } } fn print(&self, writer: &mut impl Write, settings: &GlobalSettings) { @@ -408,7 +434,8 @@ impl<'a> Line<'a> { let line = self.line.replace('\t', ">"); writeln!(writer, "{}", line)?; - let fields = tokenize(self.line, settings.separator); + let mut fields = vec![]; + tokenize(self.line, settings.separator, &mut fields); for selector in settings.selectors.iter() { let mut selection = selector.get_range(self.line, Some(&fields)); match selector.settings.mode { @@ -539,51 +566,51 @@ impl<'a> Line<'a> { } } -/// Tokenize a line into fields. -fn tokenize(line: &str, separator: Option) -> Vec { +/// Tokenize a line into fields. The result is stored into `token_buffer`. +fn tokenize(line: &str, separator: Option, token_buffer: &mut Vec) { + assert!(token_buffer.is_empty()); if let Some(separator) = separator { - tokenize_with_separator(line, separator) + tokenize_with_separator(line, separator, token_buffer) } else { - tokenize_default(line) + tokenize_default(line, token_buffer) } } /// By default fields are separated by the first whitespace after non-whitespace. /// Whitespace is included in fields at the start. -fn tokenize_default(line: &str) -> Vec { - let mut tokens = vec![0..0]; +/// The result is stored into `token_buffer`. +fn tokenize_default(line: &str, token_buffer: &mut Vec) { + token_buffer.push(0..0); // pretend that there was whitespace in front of the line let mut previous_was_whitespace = true; for (idx, char) in line.char_indices() { if char.is_whitespace() { if !previous_was_whitespace { - tokens.last_mut().unwrap().end = idx; - tokens.push(idx..0); + token_buffer.last_mut().unwrap().end = idx; + token_buffer.push(idx..0); } previous_was_whitespace = true; } else { previous_was_whitespace = false; } } - tokens.last_mut().unwrap().end = line.len(); - tokens + token_buffer.last_mut().unwrap().end = line.len(); } /// Split between separators. These separators are not included in fields. -fn tokenize_with_separator(line: &str, separator: char) -> Vec { - let mut tokens = vec![]; +/// The result is stored into `token_buffer`. +fn tokenize_with_separator(line: &str, separator: char, token_buffer: &mut Vec) { let separator_indices = line.char_indices() .filter_map(|(i, c)| if c == separator { Some(i) } else { None }); let mut start = 0; for sep_idx in separator_indices { - tokens.push(start..sep_idx); + token_buffer.push(start..sep_idx); start = sep_idx + 1; } if start < line.len() { - tokens.push(start..line.len()); + token_buffer.push(start..line.len()); } - tokens } #[derive(Clone, PartialEq, Debug)] @@ -764,8 +791,14 @@ impl FieldSelector { } /// Get the selection that corresponds to this selector for the line. - /// If needs_fields returned false, tokens may be None. - fn get_selection<'a>(&self, line: &'a str, tokens: Option<&[Field]>) -> Selection<'a> { + /// If needs_fields returned false, tokens may be empty. + fn get_selection<'a>(&self, line: &'a str, tokens: &[Field]) -> (&'a str, NumCache) { + // `get_range` expects `None` when we don't need tokens and would get confused by an empty vector. + let tokens = if self.needs_tokens { + Some(tokens) + } else { + None + }; let mut range = &line[self.get_range(line, tokens)]; let num_cache = if self.settings.mode == SortMode::Numeric || self.settings.mode == SortMode::HumanNumeric @@ -780,24 +813,19 @@ impl FieldSelector { ); // Shorten the range to what we need to pass to numeric_str_cmp later. range = &range[num_range]; - Some(Box::new(NumCache::WithInfo(info))) + NumCache::WithInfo(info) } else if self.settings.mode == SortMode::GeneralNumeric { // Parse this number as f64, as this is the requirement for general numeric sorting. - Some(Box::new(NumCache::AsF64(general_f64_parse( - &range[get_leading_gen(range)], - )))) + NumCache::AsF64(general_f64_parse(&range[get_leading_gen(range)])) } else { // This is not a numeric sort, so we don't need a NumCache. - None + NumCache::None }; - Selection { - slice: range, - num_cache, - } + (range, num_cache) } /// Look up the range in the line that corresponds to this selector. - /// If needs_fields returned false, tokens may be None. + /// If needs_fields returned false, tokens must be None. fn get_range<'a>(&self, line: &'a str, tokens: Option<&[Field]>) -> Range { enum Resolution { // The start index of the resolved character, inclusive @@ -1297,18 +1325,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); } - exec(&files, &settings) -} + settings.init_precomputed(); -fn output_sorted_lines<'a>(iter: impl Iterator>, settings: &GlobalSettings) { - if settings.unique { - print_sorted( - iter.dedup_by(|a, b| compare_by(a, b, settings) == Ordering::Equal), - settings, - ); - } else { - print_sorted(iter, settings); - } + exec(&files, &settings) } fn exec(files: &[String], settings: &GlobalSettings) -> i32 { @@ -1328,55 +1347,59 @@ fn exec(files: &[String], settings: &GlobalSettings) -> i32 { 0 } -fn sort_by<'a>(unsorted: &mut Vec>, settings: &GlobalSettings) { +fn sort_by<'a>(unsorted: &mut Vec>, settings: &GlobalSettings, line_data: &LineData<'a>) { if settings.stable || settings.unique { - unsorted.par_sort_by(|a, b| compare_by(a, b, settings)) + unsorted.par_sort_by(|a, b| compare_by(a, b, settings, line_data, line_data)) } else { - unsorted.par_sort_unstable_by(|a, b| compare_by(a, b, settings)) + unsorted.par_sort_unstable_by(|a, b| compare_by(a, b, settings, line_data, line_data)) } } -fn compare_by<'a>(a: &Line<'a>, b: &Line<'a>, global_settings: &GlobalSettings) -> Ordering { - let mut idx = 0; +fn compare_by<'a>( + a: &Line<'a>, + b: &Line<'a>, + global_settings: &GlobalSettings, + a_line_data: &LineData<'a>, + b_line_data: &LineData<'a>, +) -> Ordering { + let mut selection_index = 0; + let mut num_info_index = 0; + let mut parsed_float_index = 0; for selector in &global_settings.selectors { - let mut _selections = None; - let (a_selection, b_selection) = if selector.is_default_selection { + let (a_str, b_str) = if selector.is_default_selection { // We can select the whole line. - // We have to store the selections outside of the if-block so that they live long enough. - _selections = Some(( - Selection { - slice: a.line, - num_cache: None, - }, - Selection { - slice: b.line, - num_cache: None, - }, - )); - // Unwrap the selections again, and return references to them. - ( - &_selections.as_ref().unwrap().0, - &_selections.as_ref().unwrap().1, - ) + (a.line, b.line) } else { - let selections = (&a.selections[idx], &b.selections[idx]); - idx += 1; + let selections = ( + a_line_data.selections + [a.index * global_settings.precomputed.selections_per_line + selection_index], + b_line_data.selections + [b.index * global_settings.precomputed.selections_per_line + selection_index], + ); + selection_index += 1; selections }; - let a_str = a_selection.slice; - let b_str = b_selection.slice; + let settings = &selector.settings; let cmp: Ordering = match settings.mode { SortMode::Random => random_shuffle(a_str, b_str, &global_settings.salt), - SortMode::Numeric | SortMode::HumanNumeric => numeric_str_cmp( - (a_str, a_selection.num_cache.as_ref().unwrap().as_num_info()), - (b_str, b_selection.num_cache.as_ref().unwrap().as_num_info()), - ), - SortMode::GeneralNumeric => general_numeric_compare( - a_selection.num_cache.as_ref().unwrap().as_f64(), - b_selection.num_cache.as_ref().unwrap().as_f64(), - ), + SortMode::Numeric | SortMode::HumanNumeric => { + let a_num_info = &a_line_data.num_infos + [a.index * global_settings.precomputed.num_infos_per_line + num_info_index]; + let b_num_info = &b_line_data.num_infos + [b.index * global_settings.precomputed.num_infos_per_line + num_info_index]; + num_info_index += 1; + numeric_str_cmp((a_str, a_num_info), (b_str, b_num_info)) + } + SortMode::GeneralNumeric => { + let a_float = &a_line_data.parsed_floats + [a.index * global_settings.precomputed.floats_per_line + parsed_float_index]; + let b_float = &b_line_data.parsed_floats + [b.index * global_settings.precomputed.floats_per_line + parsed_float_index]; + parsed_float_index += 1; + general_numeric_compare(a_float, b_float) + } SortMode::Month => month_compare(a_str, b_str), SortMode::Version => version_compare(a_str, b_str), SortMode::Default => custom_str_cmp( @@ -1470,7 +1493,7 @@ fn get_leading_gen(input: &str) -> Range { } #[derive(Copy, Clone, PartialEq, PartialOrd, Debug)] -enum GeneralF64ParseResult { +pub enum GeneralF64ParseResult { Invalid, NaN, NegInfinity, @@ -1497,8 +1520,8 @@ fn general_f64_parse(a: &str) -> GeneralF64ParseResult { /// Compares two floats, with errors and non-numerics assumed to be -inf. /// Stops coercing at the first non-numeric char. /// We explicitly need to convert to f64 in this case. -fn general_numeric_compare(a: GeneralF64ParseResult, b: GeneralF64ParseResult) -> Ordering { - a.partial_cmp(&b).unwrap() +fn general_numeric_compare(a: &GeneralF64ParseResult, b: &GeneralF64ParseResult) -> Ordering { + a.partial_cmp(b).unwrap() } fn get_rand_string() -> String { @@ -1646,6 +1669,12 @@ mod tests { use super::*; + fn tokenize_helper(line: &str, separator: Option) -> Vec { + let mut buffer = vec![]; + tokenize(line, separator, &mut buffer); + buffer + } + #[test] fn test_get_hash() { let a = "Ted".to_string(); @@ -1689,20 +1718,23 @@ mod tests { #[test] fn test_tokenize_fields() { let line = "foo bar b x"; - assert_eq!(tokenize(line, None), vec![0..3, 3..7, 7..9, 9..14,],); + assert_eq!(tokenize_helper(line, None), vec![0..3, 3..7, 7..9, 9..14,],); } #[test] fn test_tokenize_fields_leading_whitespace() { let line = " foo bar b x"; - assert_eq!(tokenize(line, None), vec![0..7, 7..11, 11..13, 13..18,]); + assert_eq!( + tokenize_helper(line, None), + vec![0..7, 7..11, 11..13, 13..18,] + ); } #[test] fn test_tokenize_fields_custom_separator() { let line = "aaa foo bar b x"; assert_eq!( - tokenize(line, Some('a')), + tokenize_helper(line, Some('a')), vec![0..0, 1..1, 2..2, 3..9, 10..18,] ); } @@ -1710,11 +1742,11 @@ mod tests { #[test] fn test_tokenize_fields_trailing_custom_separator() { let line = "a"; - assert_eq!(tokenize(line, Some('a')), vec![0..0]); + assert_eq!(tokenize_helper(line, Some('a')), vec![0..0]); let line = "aa"; - assert_eq!(tokenize(line, Some('a')), vec![0..0, 1..1]); + assert_eq!(tokenize_helper(line, Some('a')), vec![0..0, 1..1]); let line = "..a..a"; - assert_eq!(tokenize(line, Some('a')), vec![0..2, 3..5]); + assert_eq!(tokenize_helper(line, Some('a')), vec![0..2, 3..5]); } #[test] @@ -1722,13 +1754,7 @@ mod tests { fn test_line_size() { // We should make sure to not regress the size of the Line struct because // it is unconditional overhead for every line we sort. - assert_eq!(std::mem::size_of::(), 32); - // These are the fields of Line: - assert_eq!(std::mem::size_of::<&str>(), 16); - assert_eq!(std::mem::size_of::>(), 16); - - // How big is a selection? Constant cost all lines pay when we need selections. - assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); } #[test] From ce0801db909c979ad2cce37d25879159d71dbbc2 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Tue, 22 Jun 2021 15:31:49 +0200 Subject: [PATCH 1105/1135] tests/mv: test uutils mv instead of system util Calling `cmd_keepenv("mv")` spawned the system `mv` instead of the uutils `mv`. Also, `keepenv` isn't necessary because it doesn't need to inherit environment variables. We now actually check the stderr, because previously the result of `ends_with` was not used, making the test pass even when it shouldn't. I disabled the test on windows because `mkdir` does not support `-m` on windows, making the test fail because there will be no permission error. On FreeBSD there isn't a permission error either, and `mv` succeeds. --- tests/by-util/test_mv.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index 2f35bf5eb..d8733a4f0 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -729,6 +729,7 @@ fn test_mv_verbose() { } #[test] +#[cfg(target_os = "linux")] // mkdir does not support -m on windows. Freebsd doesn't return a permission error either. fn test_mv_permission_error() { let scene = TestScenario::new("mkdir"); let folder1 = "bar"; @@ -738,12 +739,11 @@ fn test_mv_permission_error() { scene.ucmd().arg("-m777").arg(folder2).succeeds(); scene - .cmd_keepenv(util_name!()) + .ccmd("mv") .arg(folder2) .arg(folder_to_move) - .run() - .stderr_str() - .ends_with("Permission denied"); + .fails() + .stderr_contains("Permission denied"); } // Todo: From d60afb89472c0166d4c884239d8b5784f518d1b4 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Tue, 22 Jun 2021 16:02:50 +0200 Subject: [PATCH 1106/1135] mkdir: note that -m is not supported on windows --- src/uu/mkdir/src/mkdir.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/mkdir/src/mkdir.rs b/src/uu/mkdir/src/mkdir.rs index e8a8ef2db..c5ff8b76c 100644 --- a/src/uu/mkdir/src/mkdir.rs +++ b/src/uu/mkdir/src/mkdir.rs @@ -40,7 +40,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(OPT_MODE) .short("m") .long(OPT_MODE) - .help("set file mode") + .help("set file mode (not implemented on windows)") .default_value("755"), ) .arg( From c0be9796112439b8e26315572a4f7cfa4964b079 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Tue, 22 Jun 2021 00:22:30 +0200 Subject: [PATCH 1107/1135] fix some issues with locale (replace "LANGUAGE" with "LC_ALL") MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `LANGUAGE=C` is not enough, `LC_ALL=C` is needed as the environment variable that overrides all the other localization settings. e.g. ```bash $ LANGUAGE=C id foobar id: ‘foobar’: no such user $ LC_ALL=C id foobar id: 'foobar': no such user ``` * replace `LANGUAGE` with `LC_ALL` as environment variable in the tests * fix the the date string of affected uutils * replace `‘` and `’` with `'` --- src/uu/base32/src/base_common.rs | 4 +-- src/uu/chown/src/chown.rs | 4 +-- src/uu/cp/src/cp.rs | 2 +- src/uu/date/src/date.rs | 6 ++-- src/uu/dircolors/src/dircolors.rs | 4 +-- src/uu/du/src/du.rs | 14 ++++----- src/uu/id/src/id.rs | 2 +- src/uu/ls/src/ls.rs | 4 +-- src/uu/mknod/src/mknod.rs | 2 +- src/uu/mktemp/src/mktemp.rs | 2 +- src/uu/mv/src/mv.rs | 22 +++++++------- src/uu/numfmt/src/format.rs | 6 ++-- src/uu/numfmt/src/numfmt.rs | 2 +- src/uu/pinky/src/pinky.rs | 2 +- src/uu/split/src/split.rs | 2 +- src/uu/stat/src/stat.rs | 2 +- src/uu/test/src/parser.rs | 4 +-- src/uu/test/src/test.rs | 8 +++--- src/uu/tr/src/tr.rs | 2 +- src/uu/truncate/src/truncate.rs | 2 +- src/uu/who/src/who.rs | 6 ++-- src/uucore/src/lib/parser/parse_size.rs | 38 ++++++++++++------------- tests/by-util/test_base32.rs | 4 +-- tests/by-util/test_base64.rs | 4 +-- tests/by-util/test_chown.rs | 4 +-- tests/by-util/test_date.rs | 2 +- tests/by-util/test_du.rs | 2 +- tests/by-util/test_head.rs | 10 +++---- tests/by-util/test_id.rs | 4 +-- tests/by-util/test_ls.rs | 2 +- tests/by-util/test_mv.rs | 18 ++++++------ tests/by-util/test_numfmt.rs | 20 ++++++------- tests/by-util/test_pinky.rs | 2 +- tests/by-util/test_split.rs | 8 +++--- tests/by-util/test_stat.rs | 2 +- tests/by-util/test_stdbuf.rs | 4 +-- tests/by-util/test_tail.rs | 10 +++---- tests/by-util/test_test.rs | 10 +++---- tests/by-util/test_truncate.rs | 14 ++++----- tests/by-util/test_users.rs | 2 +- tests/by-util/test_who.rs | 13 ++++----- 41 files changed, 135 insertions(+), 140 deletions(-) diff --git a/src/uu/base32/src/base_common.rs b/src/uu/base32/src/base_common.rs index 256b674e2..a606351ce 100644 --- a/src/uu/base32/src/base_common.rs +++ b/src/uu/base32/src/base_common.rs @@ -39,7 +39,7 @@ impl Config { Some(mut values) => { let name = values.next().unwrap(); if values.len() != 0 { - return Err(format!("extra operand ‘{}’", name)); + return Err(format!("extra operand '{}'", name)); } if name == "-" { @@ -58,7 +58,7 @@ impl Config { .value_of(options::WRAP) .map(|num| { num.parse::() - .map_err(|e| format!("Invalid wrap size: ‘{}’: {}", num, e)) + .map_err(|e| format!("Invalid wrap size: '{}': {}", num, e)) }) .transpose()?; diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index ab9f10dba..7fc7f04d3 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -281,7 +281,7 @@ fn parse_spec(spec: &str) -> Result<(Option, Option), String> { let uid = if usr_only || usr_grp { Some( Passwd::locate(args[0]) - .map_err(|_| format!("invalid user: ‘{}’", spec))? + .map_err(|_| format!("invalid user: '{}'", spec))? .uid(), ) } else { @@ -290,7 +290,7 @@ fn parse_spec(spec: &str) -> Result<(Option, Option), String> { let gid = if grp_only || usr_grp { Some( Group::locate(args[1]) - .map_err(|_| format!("invalid group: ‘{}’", spec))? + .map_err(|_| format!("invalid group: '{}'", spec))? .gid(), ) } else { diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 851117bde..0d7946b06 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1254,7 +1254,7 @@ fn copy_link(source: &Path, dest: &Path) -> CopyResult<()> { Some(name) => dest.join(name).into(), None => crash!( EXIT_ERR, - "cannot stat ‘{}’: No such file or directory", + "cannot stat '{}': No such file or directory", source.display() ), } diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index 8a0e3ef3a..11c3eb31f 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -210,7 +210,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let format = if let Some(form) = matches.value_of(OPT_FORMAT) { if !form.starts_with('+') { - eprintln!("date: invalid date ‘{}’", form); + eprintln!("date: invalid date '{}'", form); return 1; } let form = form[1..].to_string(); @@ -239,7 +239,7 @@ 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))) => { - eprintln!("date: invalid date ‘{}’", input); + eprintln!("date: invalid date '{}'", input); return 1; } Some(Ok(date)) => Some(date), @@ -305,7 +305,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { println!("{}", formatted); } Err((input, _err)) => { - println!("date: invalid date ‘{}’", input); + println!("date: invalid date '{}'", input); } } } diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index 2fa2e8b91..8a01d77d6 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -123,7 +123,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if matches.is_present(options::PRINT_DATABASE) { if !files.is_empty() { show_usage_error!( - "extra operand ‘{}’\nfile operands cannot be combined with \ + "extra operand '{}'\nfile operands cannot be combined with \ --print-database (-p)", files[0] ); @@ -155,7 +155,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { result = parse(INTERNAL_DB.lines(), out_format, "") } else { if files.len() > 1 { - show_usage_error!("extra operand ‘{}’", files[1]); + show_usage_error!("extra operand '{}'", files[1]); return 1; } match File::open(files[0]) { diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index fa6c34165..623faf62c 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -274,7 +274,7 @@ fn du( Err(e) => { safe_writeln!( stderr(), - "{}: cannot read directory ‘{}‘: {}", + "{}: cannot read directory '{}': {}", options.program_name, my_stat.path.display(), e @@ -318,9 +318,7 @@ fn du( let error_message = "Permission denied"; show_error_custom_description!(description, "{}", error_message) } - _ => { - show_error!("cannot access '{}': {}", entry.path().display(), error) - } + _ => show_error!("cannot access '{}': {}", entry.path().display(), error), }, }, Err(error) => show_error!("{}", error), @@ -594,9 +592,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let files = match matches.value_of(options::FILE) { Some(_) => matches.values_of(options::FILE).unwrap().collect(), - None => { - vec!["."] - } + None => vec!["."], }; let block_size = u64::try_from(read_block_size(matches.value_of(options::BLOCK_SIZE))).unwrap(); @@ -693,8 +689,8 @@ Try '{} --help' for more information.", time } else { show_error!( - "Invalid argument ‘{}‘ for --time. -‘birth‘ and ‘creation‘ arguments are not supported on this platform.", + "Invalid argument '{}' for --time. +'birth' and 'creation' arguments are not supported on this platform.", s ); return 1; diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index 9037745eb..176240f0c 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -269,7 +269,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { match Passwd::locate(users[i].as_str()) { Ok(p) => Some(p), Err(_) => { - show_error!("‘{}’: no such user", users[i]); + show_error!("'{}': no such user", users[i]); exit_code = 1; if i + 1 >= users.len() { break; diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 0bffa2e52..e01bba8dc 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -373,7 +373,7 @@ impl Config { .value_of(options::WIDTH) .map(|x| { x.parse::().unwrap_or_else(|_e| { - show_error!("invalid line width: ‘{}’", x); + show_error!("invalid line width: '{}'", x); exit(2); }) }) @@ -756,7 +756,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(options::time::CHANGE) .short(options::time::CHANGE) .help("If the long listing format (e.g., -l, -o) is being used, print the status \ - change time (the ‘ctime’ in the inode) instead of the modification time. When \ + change time (the 'ctime' in the inode) instead of the modification time. When \ explicitly sorting by time (--sort=time or -t) or when not using a long listing \ format, sort according to the status change time.") .overrides_with_all(&[ diff --git a/src/uu/mknod/src/mknod.rs b/src/uu/mknod/src/mknod.rs index e5e6ef1fa..a1f361e55 100644 --- a/src/uu/mknod/src/mknod.rs +++ b/src/uu/mknod/src/mknod.rs @@ -210,7 +210,7 @@ fn valid_type(tpe: String) -> Result<(), String> { if vec!['b', 'c', 'u', 'p'].contains(&first_char) { Ok(()) } else { - Err(format!("invalid device type ‘{}’", tpe)) + Err(format!("invalid device type '{}'", tpe)) } }) } diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index e04de8702..b0bc3474b 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -154,7 +154,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if matches.is_present(OPT_TMPDIR) && PathBuf::from(prefix).is_absolute() { show_error!( - "invalid template, ‘{}’; with --tmpdir, it may not be absolute", + "invalid template, '{}'; with --tmpdir, it may not be absolute", template ); return 1; diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index bb402737e..d709a2117 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -230,7 +230,7 @@ fn exec(files: &[PathBuf], b: Behavior) -> i32 { // lacks permission to access metadata. if source.symlink_metadata().is_err() { show_error!( - "cannot stat ‘{}’: No such file or directory", + "cannot stat '{}': No such file or directory", source.display() ); return 1; @@ -240,7 +240,7 @@ fn exec(files: &[PathBuf], b: Behavior) -> i32 { if b.no_target_dir { if !source.is_dir() { show_error!( - "cannot overwrite directory ‘{}’ with non-directory", + "cannot overwrite directory '{}' with non-directory", target.display() ); return 1; @@ -249,7 +249,7 @@ fn exec(files: &[PathBuf], b: Behavior) -> i32 { return match rename(source, target, &b) { Err(e) => { show_error!( - "cannot move ‘{}’ to ‘{}’: {}", + "cannot move '{}' to '{}': {}", source.display(), target.display(), e.to_string() @@ -263,7 +263,7 @@ fn exec(files: &[PathBuf], b: Behavior) -> i32 { return move_files_into_dir(&[source.clone()], target, &b); } else if target.exists() && source.is_dir() { show_error!( - "cannot overwrite non-directory ‘{}’ with directory ‘{}’", + "cannot overwrite non-directory '{}' with directory '{}'", target.display(), source.display() ); @@ -278,7 +278,7 @@ fn exec(files: &[PathBuf], b: Behavior) -> i32 { _ => { if b.no_target_dir { show_error!( - "mv: extra operand ‘{}’\n\ + "mv: extra operand '{}'\n\ Try '{} --help' for more information.", files[2].display(), executable!() @@ -294,7 +294,7 @@ fn exec(files: &[PathBuf], b: Behavior) -> i32 { fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> i32 { if !target_dir.is_dir() { - show_error!("target ‘{}’ is not a directory", target_dir.display()); + show_error!("target '{}' is not a directory", target_dir.display()); return 1; } @@ -304,7 +304,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> i3 Some(name) => target_dir.join(name), None => { show_error!( - "cannot stat ‘{}’: No such file or directory", + "cannot stat '{}': No such file or directory", sourcepath.display() ); @@ -315,7 +315,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> i3 if let Err(e) = rename(sourcepath, &targetpath, b) { show_error!( - "cannot move ‘{}’ to ‘{}’: {}", + "cannot move '{}' to '{}': {}", sourcepath.display(), targetpath.display(), e.to_string() @@ -338,7 +338,7 @@ fn rename(from: &Path, to: &Path, b: &Behavior) -> io::Result<()> { match b.overwrite { OverwriteMode::NoClobber => return Ok(()), OverwriteMode::Interactive => { - println!("{}: overwrite ‘{}’? ", executable!(), to.display()); + println!("{}: overwrite '{}'? ", executable!(), to.display()); if !read_yes() { return Ok(()); } @@ -371,9 +371,9 @@ fn rename(from: &Path, to: &Path, b: &Behavior) -> io::Result<()> { rename_with_fallback(from, to)?; if b.verbose { - print!("‘{}’ -> ‘{}’", from.display(), to.display()); + print!("'{}' -> '{}'", from.display(), to.display()); match backup_path { - Some(path) => println!(" (backup: ‘{}’)", path.display()), + Some(path) => println!(" (backup: '{}')", path.display()), None => println!(), } } diff --git a/src/uu/numfmt/src/format.rs b/src/uu/numfmt/src/format.rs index ee692d8f0..54e122215 100644 --- a/src/uu/numfmt/src/format.rs +++ b/src/uu/numfmt/src/format.rs @@ -62,7 +62,7 @@ impl<'a> Iterator for WhitespaceSplitter<'a> { fn parse_suffix(s: &str) -> Result<(f64, Option)> { if s.is_empty() { - return Err("invalid number: ‘’".to_string()); + return Err("invalid number: ''".to_string()); } let with_i = s.ends_with('i'); @@ -80,7 +80,7 @@ fn parse_suffix(s: &str) -> Result<(f64, Option)> { Some('Z') => Ok(Some((RawSuffix::Z, with_i))), Some('Y') => Ok(Some((RawSuffix::Y, with_i))), Some('0'..='9') => Ok(None), - _ => Err(format!("invalid suffix in input: ‘{}’", s)), + _ => Err(format!("invalid suffix in input: '{}'", s)), }?; let suffix_len = match suffix { @@ -91,7 +91,7 @@ fn parse_suffix(s: &str) -> Result<(f64, Option)> { let number = s[..s.len() - suffix_len] .parse::() - .map_err(|_| format!("invalid number: ‘{}’", s))?; + .map_err(|_| format!("invalid number: '{}'", s))?; Ok((number, suffix)) } diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index 086336437..88cb008cc 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -114,7 +114,7 @@ fn parse_options(args: &ArgMatches) -> Result { 0 => Err(value), _ => Ok(n), }) - .map_err(|value| format!("invalid header value ‘{}’", value)) + .map_err(|value| format!("invalid header value '{}'", value)) } }?; diff --git a/src/uu/pinky/src/pinky.rs b/src/uu/pinky/src/pinky.rs index d15730b32..33dcff274 100644 --- a/src/uu/pinky/src/pinky.rs +++ b/src/uu/pinky/src/pinky.rs @@ -234,7 +234,7 @@ fn idle_string(when: i64) -> String { } fn time_string(ut: &Utmpx) -> String { - time::strftime("%Y-%m-%d %H:%M", &ut.login_time()).unwrap() + time::strftime("%b %e %H:%M", &ut.login_time()).unwrap() // LC_ALL=C } impl Pinky { diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index 0d5543d8b..ad5c083aa 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -234,7 +234,7 @@ impl LineSplitter { fn new(settings: &Settings) -> LineSplitter { LineSplitter { lines_per_split: settings.strategy_param.parse().unwrap_or_else(|_| { - crash!(1, "invalid number of lines: ‘{}’", settings.strategy_param) + crash!(1, "invalid number of lines: '{}'", settings.strategy_param) }), } } diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 4e1d9d2c9..7bf3db4c2 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -24,7 +24,7 @@ use std::{cmp, fs, iter}; macro_rules! check_bound { ($str: ident, $bound:expr, $beg: expr, $end: expr) => { if $end >= $bound { - return Err(format!("‘{}’: invalid directive", &$str[$beg..$end])); + return Err(format!("'{}': invalid directive", &$str[$beg..$end])); } }; } diff --git a/src/uu/test/src/parser.rs b/src/uu/test/src/parser.rs index d4302bd67..5eec781ba 100644 --- a/src/uu/test/src/parser.rs +++ b/src/uu/test/src/parser.rs @@ -167,7 +167,7 @@ impl Parser { self.expr(); match self.next_token() { Symbol::Literal(s) if s == ")" => (), - _ => panic!("expected ‘)’"), + _ => panic!("expected ')'"), } } } @@ -314,7 +314,7 @@ impl Parser { self.expr(); match self.tokens.next() { - Some(token) => Err(format!("extra argument ‘{}’", token.to_string_lossy())), + Some(token) => Err(format!("extra argument '{}'", token.to_string_lossy())), None => Ok(()), } } diff --git a/src/uu/test/src/test.rs b/src/uu/test/src/test.rs index 97a244cdc..107ad2df4 100644 --- a/src/uu/test/src/test.rs +++ b/src/uu/test/src/test.rs @@ -88,7 +88,7 @@ fn eval(stack: &mut Vec) -> Result { return Ok(true); } _ => { - return Err(format!("missing argument after ‘{:?}’", op)); + return Err(format!("missing argument after '{:?}'", op)); } }; @@ -140,7 +140,7 @@ fn eval(stack: &mut Vec) -> Result { } fn integers(a: &OsStr, b: &OsStr, op: &OsStr) -> Result { - let format_err = |value| format!("invalid integer ‘{}’", value); + let format_err = |value| format!("invalid integer '{}'", value); let a = a.to_string_lossy(); let a: i64 = a.parse().map_err(|_| format_err(a))?; @@ -156,7 +156,7 @@ fn integers(a: &OsStr, b: &OsStr, op: &OsStr) -> Result { "-ge" => a >= b, "-lt" => a < b, "-le" => a <= b, - _ => return Err(format!("unknown operator ‘{}’", operator)), + _ => return Err(format!("unknown operator '{}'", operator)), }) } @@ -164,7 +164,7 @@ fn isatty(fd: &OsStr) -> Result { let fd = fd.to_string_lossy(); fd.parse() - .map_err(|_| format!("invalid integer ‘{}’", fd)) + .map_err(|_| format!("invalid integer '{}'", fd)) .map(|i| { #[cfg(not(target_os = "redox"))] unsafe { diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index 3c362dcec..9916af7db 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -311,7 +311,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if !(delete_flag || squeeze_flag) && sets.len() < 2 { show_error!( - "missing operand after ‘{}’\nTry `{} --help` for more information.", + "missing operand after '{}'\nTry `{} --help` for more information.", sets[0], executable!() ); diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index f81a95ab2..8ef246833 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -210,7 +210,7 @@ fn truncate_reference_and_size( let mode = match parse_mode_and_size(size_string) { Ok(m) => match m { TruncateMode::Absolute(_) => { - crash!(1, "you must specify a relative ‘--size’ with ‘--reference’") + crash!(1, "you must specify a relative '--size' with '--reference'") } _ => m, }, diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index 44f565438..047452240 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -300,7 +300,7 @@ fn idle_string<'a>(when: i64, boottime: i64) -> Cow<'a, str> { } fn time_string(ut: &Utmpx) -> String { - time::strftime("%Y-%m-%d %H:%M", &ut.login_time()).unwrap() + time::strftime("%b %e %H:%M", &ut.login_time()).unwrap() // LC_ALL=C } #[inline] @@ -523,8 +523,8 @@ impl Who { buf.push_str(&msg); } buf.push_str(&format!(" {:<12}", line)); - // "%Y-%m-%d %H:%M" - let time_size = 4 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2; + // "%b %e %H:%M" (LC_ALL=C) + let time_size = 3 + 2 + 2 + 1 + 2; buf.push_str(&format!(" {:<1$}", time, time_size)); if !self.short_output { diff --git a/src/uucore/src/lib/parser/parse_size.rs b/src/uucore/src/lib/parser/parse_size.rs index 58213adef..ec0b08c9e 100644 --- a/src/uucore/src/lib/parser/parse_size.rs +++ b/src/uucore/src/lib/parser/parse_size.rs @@ -18,7 +18,7 @@ use std::fmt; /// /// # Errors /// -/// Will return `ParseSizeError` if it’s not possible to parse this +/// Will return `ParseSizeError` if it's not possible to parse this /// string into a number, e.g. if the string does not begin with a /// numeral, or if the unit is not one of the supported units described /// in the preceding section. @@ -109,19 +109,19 @@ impl fmt::Display for ParseSizeError { impl ParseSizeError { fn parse_failure(s: &str) -> ParseSizeError { - // stderr on linux (GNU coreutils 8.32) + // stderr on linux (GNU coreutils 8.32) (LC_ALL=C) // has to be handled in the respective uutils because strings differ, e.g.: // // `NUM` - // head: invalid number of bytes: ‘1fb’ - // tail: invalid number of bytes: ‘1fb’ + // head: invalid number of bytes: '1fb' + // tail: invalid number of bytes: '1fb' // // `SIZE` - // split: invalid number of bytes: ‘1fb’ - // truncate: Invalid number: ‘1fb’ + // split: invalid number of bytes: '1fb' + // truncate: Invalid number: '1fb' // // `MODE` - // stdbuf: invalid mode ‘1fb’ + // stdbuf: invalid mode '1fb' // // `SIZE` // sort: invalid suffix in --buffer-size argument '1fb' @@ -140,27 +140,27 @@ impl ParseSizeError { // --width // --strings // etc. - ParseSizeError::ParseFailure(format!("‘{}’", s)) + ParseSizeError::ParseFailure(format!("'{}'", s)) } fn size_too_big(s: &str) -> ParseSizeError { - // stderr on linux (GNU coreutils 8.32) + // stderr on linux (GNU coreutils 8.32) (LC_ALL=C) // has to be handled in the respective uutils because strings differ, e.g.: // - // head: invalid number of bytes: ‘1Y’: Value too large for defined data type - // tail: invalid number of bytes: ‘1Y’: Value too large for defined data type - // split: invalid number of bytes: ‘1Y’: Value too large for defined data type - // truncate: Invalid number: ‘1Y’: Value too large for defined data type - // stdbuf: invalid mode ‘1Y’: Value too large for defined data type + // head: invalid number of bytes: '1Y': Value too large for defined data type + // tail: invalid number of bytes: '1Y': Value too large for defined data type + // split: invalid number of bytes: '1Y': Value too large for defined data type + // truncate: Invalid number: '1Y': Value too large for defined data type + // stdbuf: invalid mode '1Y': Value too large for defined data type // sort: -S argument '1Y' too large // du: -B argument '1Y' too large // od: -N argument '1Y' too large // etc. // // stderr on macos (brew - GNU coreutils 8.32) also differs for the same version, e.g.: - // ghead: invalid number of bytes: ‘1Y’: Value too large to be stored in data type - // gtail: invalid number of bytes: ‘1Y’: Value too large to be stored in data type - ParseSizeError::SizeTooBig(format!("‘{}’: Value too large for defined data type", s)) + // ghead: invalid number of bytes: '1Y': Value too large to be stored in data type + // gtail: invalid number of bytes: '1Y': Value too large to be stored in data type + ParseSizeError::SizeTooBig(format!("'{}': Value too large for defined data type", s)) } } @@ -227,7 +227,7 @@ mod tests { )); assert_eq!( - ParseSizeError::SizeTooBig("‘1Y’: Value too large for defined data type".to_string()), + ParseSizeError::SizeTooBig("'1Y': Value too large for defined data type".to_string()), parse_size("1Y").unwrap_err() ); } @@ -262,7 +262,7 @@ mod tests { for &test_string in &test_strings { assert_eq!( parse_size(test_string).unwrap_err(), - ParseSizeError::ParseFailure(format!("‘{}’", test_string)) + ParseSizeError::ParseFailure(format!("'{}'", test_string)) ); } } diff --git a/tests/by-util/test_base32.rs b/tests/by-util/test_base32.rs index 8e3e780c5..38ead28f1 100644 --- a/tests/by-util/test_base32.rs +++ b/tests/by-util/test_base32.rs @@ -103,7 +103,7 @@ fn test_wrap_bad_arg() { .arg(wrap_param) .arg("b") .fails() - .stderr_only("base32: Invalid wrap size: ‘b’: invalid digit found in string\n"); + .stderr_only("base32: Invalid wrap size: 'b': invalid digit found in string\n"); } } @@ -114,7 +114,7 @@ fn test_base32_extra_operand() { .arg("a.txt") .arg("a.txt") .fails() - .stderr_only("base32: extra operand ‘a.txt’"); + .stderr_only("base32: extra operand 'a.txt'"); } #[test] diff --git a/tests/by-util/test_base64.rs b/tests/by-util/test_base64.rs index 236f53fb1..7c7f19205 100644 --- a/tests/by-util/test_base64.rs +++ b/tests/by-util/test_base64.rs @@ -89,7 +89,7 @@ fn test_wrap_bad_arg() { .arg(wrap_param) .arg("b") .fails() - .stderr_only("base64: Invalid wrap size: ‘b’: invalid digit found in string\n"); + .stderr_only("base64: Invalid wrap size: 'b': invalid digit found in string\n"); } } @@ -100,7 +100,7 @@ fn test_base64_extra_operand() { .arg("a.txt") .arg("a.txt") .fails() - .stderr_only("base64: extra operand ‘a.txt’"); + .stderr_only("base64: extra operand 'a.txt'"); } #[test] diff --git a/tests/by-util/test_chown.rs b/tests/by-util/test_chown.rs index c8a8ea538..86365f51b 100644 --- a/tests/by-util/test_chown.rs +++ b/tests/by-util/test_chown.rs @@ -172,14 +172,14 @@ fn test_chown_only_colon() { // expected: // $ chown -v :: file.txt 2>out_err ; echo $? ; cat out_err // 1 - // chown: invalid group: ‘::’ + // chown: invalid group: '::' scene .ucmd() .arg("::") .arg("--verbose") .arg(file1) .fails() - .stderr_contains(&"invalid group: ‘::’"); + .stderr_contains(&"invalid group: '::'"); } #[test] diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 72747fa66..a7a5fa583 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -117,7 +117,7 @@ fn test_date_format_without_plus() { new_ucmd!() .arg("%s") .fails() - .stderr_contains("date: invalid date ‘%s’") + .stderr_contains("date: invalid date '%s'") .code_is(1); } diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index ffe449880..67036be44 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -355,7 +355,7 @@ fn test_du_no_permission() { let result = scene.ucmd().arg(SUB_DIR_LINKS).run(); // TODO: replace with ".fails()" once `du` is fixed result.stderr_contains( - "du: cannot read directory ‘subdir/links‘: Permission denied (os error 13)", + "du: cannot read directory 'subdir/links': Permission denied (os error 13)", ); #[cfg(target_os = "linux")] diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index 2c4b66696..8065cb490 100755 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -255,21 +255,21 @@ fn test_head_invalid_num() { new_ucmd!() .args(&["-c", "1024R", "emptyfile.txt"]) .fails() - .stderr_is("head: invalid number of bytes: ‘1024R’"); + .stderr_is("head: invalid number of bytes: '1024R'"); new_ucmd!() .args(&["-n", "1024R", "emptyfile.txt"]) .fails() - .stderr_is("head: invalid number of lines: ‘1024R’"); + .stderr_is("head: invalid number of lines: '1024R'"); #[cfg(not(target_pointer_width = "128"))] new_ucmd!() .args(&["-c", "1Y", "emptyfile.txt"]) .fails() - .stderr_is("head: invalid number of bytes: ‘1Y’: Value too large for defined data type"); + .stderr_is("head: invalid number of bytes: '1Y': Value too large for defined data type"); #[cfg(not(target_pointer_width = "128"))] new_ucmd!() .args(&["-n", "1Y", "emptyfile.txt"]) .fails() - .stderr_is("head: invalid number of lines: ‘1Y’: Value too large for defined data type"); + .stderr_is("head: invalid number of lines: '1Y': Value too large for defined data type"); #[cfg(target_pointer_width = "32")] { let sizes = ["1000G", "10T"]; @@ -279,7 +279,7 @@ fn test_head_invalid_num() { .fails() .code_is(1) .stderr_only(format!( - "head: invalid number of bytes: ‘{}’: Value too large for defined data type", + "head: invalid number of bytes: '{}': Value too large for defined data type", size )); } diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index b4b929a2c..102ae2aa1 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -432,7 +432,7 @@ fn check_coreutil_version(util_name: &str, version_expected: &str) -> String { let scene = TestScenario::new(util_name); let version_check = scene .cmd_keepenv(&util_name) - .env("LANGUAGE", "C") + .env("LC_ALL", "C") .arg("--version") .run(); version_check @@ -476,7 +476,7 @@ fn expected_result(args: &[&str]) -> Result { let scene = TestScenario::new(util_name); let result = scene .cmd_keepenv(util_name) - .env("LANGUAGE", "C") + .env("LC_ALL", "C") .args(args) .run(); diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index f8aa4453b..2a6e827f5 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -168,7 +168,7 @@ fn test_ls_width() { .ucmd() .args(&option.split(' ').collect::>()) .fails() - .stderr_only("ls: invalid line width: ‘1a’"); + .stderr_only("ls: invalid line width: '1a'"); } } diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index 2f35bf5eb..0c33eaf11 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -614,7 +614,7 @@ fn test_mv_overwrite_nonempty_dir() { // Not same error as GNU; the error message is a rust builtin // TODO: test (and implement) correct error message (or at least decide whether to do so) // Current: "mv: couldn't rename path (Directory not empty; from=a; to=b)" - // GNU: "mv: cannot move ‘a’ to ‘b’: Directory not empty" + // GNU: "mv: cannot move 'a' to 'b': Directory not empty" // Verbose output for the move should not be shown on failure let result = ucmd.arg("-vT").arg(dir_a).arg(dir_b).fails(); @@ -638,7 +638,7 @@ fn test_mv_backup_dir() { .arg(dir_b) .succeeds() .stdout_only(format!( - "‘{}’ -> ‘{}’ (backup: ‘{}~’)\n", + "'{}' -> '{}' (backup: '{}~')\n", dir_a, dir_b, dir_b )); @@ -672,7 +672,7 @@ fn test_mv_errors() { // $ at.touch file && at.mkdir dir // $ mv -T file dir - // err == mv: cannot overwrite directory ‘dir’ with non-directory + // err == mv: cannot overwrite directory 'dir' with non-directory scene .ucmd() .arg("-T") @@ -680,13 +680,13 @@ fn test_mv_errors() { .arg(dir) .fails() .stderr_is(format!( - "mv: cannot overwrite directory ‘{}’ with non-directory\n", + "mv: cannot overwrite directory '{}' with non-directory\n", dir )); // $ at.mkdir dir && at.touch file // $ mv dir file - // err == mv: cannot overwrite non-directory ‘file’ with directory ‘dir’ + // err == mv: cannot overwrite non-directory 'file' with directory 'dir' assert!(!scene .ucmd() .arg(dir) @@ -713,7 +713,7 @@ fn test_mv_verbose() { .arg(file_a) .arg(file_b) .succeeds() - .stdout_only(format!("‘{}’ -> ‘{}’\n", file_a, file_b)); + .stdout_only(format!("'{}' -> '{}'\n", file_a, file_b)); at.touch(file_a); scene @@ -723,7 +723,7 @@ fn test_mv_verbose() { .arg(file_b) .succeeds() .stdout_only(format!( - "‘{}’ -> ‘{}’ (backup: ‘{}~’)\n", + "'{}' -> '{}' (backup: '{}~')\n", file_a, file_b, file_b )); } @@ -756,5 +756,5 @@ fn test_mv_permission_error() { // -r--r--r-- 1 user user 0 okt 25 11:21 b // $ // $ mv -v a b -// mv: try to overwrite ‘b’, overriding mode 0444 (r--r--r--)? y -// ‘a’ -> ‘b’ +// mv: try to overwrite 'b', overriding mode 0444 (r--r--r--)? y +// 'a' -> 'b' diff --git a/tests/by-util/test_numfmt.rs b/tests/by-util/test_numfmt.rs index bb29d431e..e64182fcb 100644 --- a/tests/by-util/test_numfmt.rs +++ b/tests/by-util/test_numfmt.rs @@ -35,7 +35,7 @@ fn test_from_iec_i_requires_suffix() { new_ucmd!() .args(&["--from=iec-i", "1024"]) .fails() - .stderr_is("numfmt: missing 'i' suffix in input: ‘1024’ (e.g Ki/Mi/Gi)"); + .stderr_is("numfmt: missing 'i' suffix in input: '1024' (e.g Ki/Mi/Gi)"); } #[test] @@ -123,7 +123,7 @@ fn test_header_error_if_non_numeric() { new_ucmd!() .args(&["--header=two"]) .run() - .stderr_is("numfmt: invalid header value ‘two’"); + .stderr_is("numfmt: invalid header value 'two'"); } #[test] @@ -131,7 +131,7 @@ fn test_header_error_if_0() { new_ucmd!() .args(&["--header=0"]) .run() - .stderr_is("numfmt: invalid header value ‘0’"); + .stderr_is("numfmt: invalid header value '0'"); } #[test] @@ -139,7 +139,7 @@ fn test_header_error_if_negative() { new_ucmd!() .args(&["--header=-3"]) .run() - .stderr_is("numfmt: invalid header value ‘-3’"); + .stderr_is("numfmt: invalid header value '-3'"); } #[test] @@ -187,7 +187,7 @@ fn test_should_report_invalid_empty_number_on_empty_stdin() { .args(&["--from=auto"]) .pipe_in("\n") .run() - .stderr_is("numfmt: invalid number: ‘’\n"); + .stderr_is("numfmt: invalid number: ''\n"); } #[test] @@ -196,7 +196,7 @@ fn test_should_report_invalid_empty_number_on_blank_stdin() { .args(&["--from=auto"]) .pipe_in(" \t \n") .run() - .stderr_is("numfmt: invalid number: ‘’\n"); + .stderr_is("numfmt: invalid number: ''\n"); } #[test] @@ -205,14 +205,14 @@ fn test_should_report_invalid_suffix_on_stdin() { .args(&["--from=auto"]) .pipe_in("1k") .run() - .stderr_is("numfmt: invalid suffix in input: ‘1k’\n"); + .stderr_is("numfmt: invalid suffix in input: '1k'\n"); // GNU numfmt reports this one as “invalid number” new_ucmd!() .args(&["--from=auto"]) .pipe_in("NaN") .run() - .stderr_is("numfmt: invalid suffix in input: ‘NaN’\n"); + .stderr_is("numfmt: invalid suffix in input: 'NaN'\n"); } #[test] @@ -222,7 +222,7 @@ fn test_should_report_invalid_number_with_interior_junk() { .args(&["--from=auto"]) .pipe_in("1x0K") .run() - .stderr_is("numfmt: invalid number: ‘1x0K’\n"); + .stderr_is("numfmt: invalid number: '1x0K'\n"); } #[test] @@ -461,7 +461,7 @@ fn test_delimiter_overrides_whitespace_separator() { .args(&["-d,"]) .pipe_in("1 234,56") .fails() - .stderr_is("numfmt: invalid number: ‘1 234’\n"); + .stderr_is("numfmt: invalid number: '1 234'\n"); } #[test] diff --git a/tests/by-util/test_pinky.rs b/tests/by-util/test_pinky.rs index 8b50ec2bd..bc2833a42 100644 --- a/tests/by-util/test_pinky.rs +++ b/tests/by-util/test_pinky.rs @@ -106,7 +106,7 @@ fn expected_result(args: &[&str]) -> String { #[allow(clippy::needless_borrow)] TestScenario::new(&util_name) .cmd_keepenv(util_name) - .env("LANGUAGE", "C") + .env("LC_ALL", "C") .args(args) .succeeds() .stdout_move_str() diff --git a/tests/by-util/test_split.rs b/tests/by-util/test_split.rs index a1350534f..229925a1c 100644 --- a/tests/by-util/test_split.rs +++ b/tests/by-util/test_split.rs @@ -309,7 +309,7 @@ fn test_split_lines_number() { .args(&["--lines", "2fb", "file"]) .fails() .code_is(1) - .stderr_only("split: invalid number of lines: ‘2fb’"); + .stderr_only("split: invalid number of lines: '2fb'"); } #[test] @@ -318,13 +318,13 @@ fn test_split_invalid_bytes_size() { .args(&["-b", "1024R"]) .fails() .code_is(1) - .stderr_only("split: invalid number of bytes: ‘1024R’"); + .stderr_only("split: invalid number of bytes: '1024R'"); #[cfg(not(target_pointer_width = "128"))] new_ucmd!() .args(&["-b", "1Y"]) .fails() .code_is(1) - .stderr_only("split: invalid number of bytes: ‘1Y’: Value too large for defined data type"); + .stderr_only("split: invalid number of bytes: '1Y': Value too large for defined data type"); #[cfg(target_pointer_width = "32")] { let sizes = ["1000G", "10T"]; @@ -334,7 +334,7 @@ fn test_split_invalid_bytes_size() { .fails() .code_is(1) .stderr_only(format!( - "split: invalid number of bytes: ‘{}’: Value too large for defined data type", + "split: invalid number of bytes: '{}': Value too large for defined data type", size )); } diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 37328d5ae..ddf78815f 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -317,7 +317,7 @@ fn expected_result(args: &[&str]) -> String { #[allow(clippy::needless_borrow)] TestScenario::new(&util_name) .cmd_keepenv(util_name) - .env("LANGUAGE", "C") + .env("LC_ALL", "C") .args(args) .succeeds() .stdout_move_str() diff --git a/tests/by-util/test_stdbuf.rs b/tests/by-util/test_stdbuf.rs index fc1b9324a..66892ea0f 100644 --- a/tests/by-util/test_stdbuf.rs +++ b/tests/by-util/test_stdbuf.rs @@ -63,12 +63,12 @@ fn test_stdbuf_invalid_mode_fails() { .args(&[*option, "1024R", "head"]) .fails() .code_is(125) - .stderr_only("stdbuf: invalid mode ‘1024R’"); + .stderr_only("stdbuf: invalid mode '1024R'"); #[cfg(not(target_pointer_width = "128"))] new_ucmd!() .args(&[*option, "1Y", "head"]) .fails() .code_is(125) - .stderr_contains("stdbuf: invalid mode ‘1Y’: Value too large for defined data type"); + .stderr_contains("stdbuf: invalid mode '1Y': Value too large for defined data type"); } } diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 8478944e2..e8dd63317 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -364,21 +364,21 @@ fn test_tail_invalid_num() { new_ucmd!() .args(&["-c", "1024R", "emptyfile.txt"]) .fails() - .stderr_is("tail: invalid number of bytes: ‘1024R’"); + .stderr_is("tail: invalid number of bytes: '1024R'"); new_ucmd!() .args(&["-n", "1024R", "emptyfile.txt"]) .fails() - .stderr_is("tail: invalid number of lines: ‘1024R’"); + .stderr_is("tail: invalid number of lines: '1024R'"); #[cfg(not(target_pointer_width = "128"))] new_ucmd!() .args(&["-c", "1Y", "emptyfile.txt"]) .fails() - .stderr_is("tail: invalid number of bytes: ‘1Y’: Value too large for defined data type"); + .stderr_is("tail: invalid number of bytes: '1Y': Value too large for defined data type"); #[cfg(not(target_pointer_width = "128"))] new_ucmd!() .args(&["-n", "1Y", "emptyfile.txt"]) .fails() - .stderr_is("tail: invalid number of lines: ‘1Y’: Value too large for defined data type"); + .stderr_is("tail: invalid number of lines: '1Y': Value too large for defined data type"); #[cfg(target_pointer_width = "32")] { let sizes = ["1000G", "10T"]; @@ -388,7 +388,7 @@ fn test_tail_invalid_num() { .fails() .code_is(1) .stderr_only(format!( - "tail: invalid number of bytes: ‘{}’: Value too large for defined data type", + "tail: invalid number of bytes: '{}': Value too large for defined data type", size )); } diff --git a/tests/by-util/test_test.rs b/tests/by-util/test_test.rs index 36e825f2d..1867927da 100644 --- a/tests/by-util/test_test.rs +++ b/tests/by-util/test_test.rs @@ -165,7 +165,7 @@ fn test_dangling_string_comparison_is_error() { .args(&["missing_something", "="]) .run() .status_code(2) - .stderr_is("test: missing argument after ‘=’"); + .stderr_is("test: missing argument after '='"); } #[test] @@ -265,7 +265,7 @@ fn test_float_inequality_is_error() { .args(&["123.45", "-ge", "6"]) .run() .status_code(2) - .stderr_is("test: invalid integer ‘123.45’"); + .stderr_is("test: invalid integer '123.45'"); } #[test] @@ -283,7 +283,7 @@ fn test_invalid_utf8_integer_compare() { cmd.run() .status_code(2) - .stderr_is("test: invalid integer ‘fo�o’"); + .stderr_is("test: invalid integer 'fo�o'"); let mut cmd = new_ucmd!(); cmd.raw.arg(arg); @@ -291,7 +291,7 @@ fn test_invalid_utf8_integer_compare() { cmd.run() .status_code(2) - .stderr_is("test: invalid integer ‘fo�o’"); + .stderr_is("test: invalid integer 'fo�o'"); } #[test] @@ -674,7 +674,7 @@ fn test_erroneous_parenthesized_expression() { .args(&["a", "!=", "(", "b", "-a", "b", ")", "!=", "c"]) .run() .status_code(2) - .stderr_is("test: extra argument ‘b’"); + .stderr_is("test: extra argument 'b'"); } #[test] diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index 2da59035e..4b2e9e502 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -249,7 +249,7 @@ fn test_size_and_reference() { #[test] fn test_error_filename_only() { - // truncate: you must specify either ‘--size’ or ‘--reference’ + // truncate: you must specify either '--size' or '--reference' new_ucmd!().args(&["file"]).fails().stderr_contains( "error: The following required arguments were not provided: --reference @@ -262,15 +262,15 @@ fn test_invalid_numbers() { new_ucmd!() .args(&["-s", "0X", "file"]) .fails() - .stderr_contains("Invalid number: ‘0X’"); + .stderr_contains("Invalid number: '0X'"); new_ucmd!() .args(&["-s", "0XB", "file"]) .fails() - .stderr_contains("Invalid number: ‘0XB’"); + .stderr_contains("Invalid number: '0XB'"); new_ucmd!() .args(&["-s", "0B", "file"]) .fails() - .stderr_contains("Invalid number: ‘0B’"); + .stderr_contains("Invalid number: '0B'"); } #[test] @@ -299,13 +299,13 @@ fn test_truncate_bytes_size() { .args(&["--size", "1024R", "file"]) .fails() .code_is(1) - .stderr_only("truncate: Invalid number: ‘1024R’"); + .stderr_only("truncate: Invalid number: '1024R'"); #[cfg(not(target_pointer_width = "128"))] new_ucmd!() .args(&["--size", "1Y", "file"]) .fails() .code_is(1) - .stderr_only("truncate: Invalid number: ‘1Y’: Value too large for defined data type"); + .stderr_only("truncate: Invalid number: '1Y': Value too large for defined data type"); #[cfg(target_pointer_width = "32")] { let sizes = ["1000G", "10T"]; @@ -315,7 +315,7 @@ fn test_truncate_bytes_size() { .fails() .code_is(1) .stderr_only(format!( - "truncate: Invalid number: ‘{}’: Value too large for defined data type", + "truncate: Invalid number: '{}': Value too large for defined data type", size )); } diff --git a/tests/by-util/test_users.rs b/tests/by-util/test_users.rs index 68bdf9a5e..1bcbdbdc1 100644 --- a/tests/by-util/test_users.rs +++ b/tests/by-util/test_users.rs @@ -17,7 +17,7 @@ fn test_users_check_name() { #[allow(clippy::needless_borrow)] let expected = TestScenario::new(&util_name) .cmd_keepenv(util_name) - .env("LANGUAGE", "C") + .env("LC_ALL", "C") .succeeds() .stdout_move_str(); diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index 4907d2306..9315a5956 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -158,13 +158,12 @@ fn test_users() { let mut v_actual: Vec<&str> = actual.split_whitespace().collect(); let mut v_expect: Vec<&str> = expect.split_whitespace().collect(); - // TODO: `--users` differs from GNU's output on macOS - // Diff < left / right > : - // <"runner console 2021-05-20 22:03 00:08 196\n" - // >"runner console 2021-05-20 22:03 old 196\n" + // TODO: `--users` sometimes differs from GNU's output on macOS (race condition?) + // actual: "runner console Jun 23 06:37 00:34 196\n" + // expect: "runner console Jun 23 06:37 old 196\n" if cfg!(target_os = "macos") { - v_actual.remove(4); - v_expect.remove(4); + v_actual.remove(5); + v_expect.remove(5); } assert_eq!(v_actual, v_expect); @@ -242,7 +241,7 @@ fn expected_result(args: &[&str]) -> String { #[allow(clippy::needless_borrow)] TestScenario::new(&util_name) .cmd_keepenv(util_name) - .env("LANGUAGE", "C") + .env("LC_ALL", "C") .args(args) .succeeds() .stdout_move_str() From 4b3da59b0eb89ebd840d158cbab756ecdc82e936 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 23 Jun 2021 12:27:01 +0200 Subject: [PATCH 1108/1135] id: refactor identifiers * change of identifier names and spelling according to the suggestions in the review of #2446 --- src/uu/id/src/id.rs | 8 ++++---- tests/by-util/test_id.rs | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index 9037745eb..1c967ec12 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -13,11 +13,11 @@ // http://www.opensource.apple.com/source/shell_cmds/shell_cmds-118/id/id.c // // * This was partially rewritten in order for stdout/stderr/exit_code -// to be conform with GNU coreutils (8.32) testsuite for `id`. +// to be conform with GNU coreutils (8.32) test suite for `id`. // // * This supports multiple users (a feature that was introduced in coreutils 8.31) // -// * This passes GNU's coreutils Testsuite (8.32) +// * This passes GNU's coreutils Test suite (8.32) // for "tests/id/uid.sh" and "tests/id/zero/sh". // // * Option '--zero' does not exist for BSD's `id`, therefore '--zero' is only @@ -26,7 +26,7 @@ // * Help text based on BSD's `id` manpage and GNU's `id` manpage. // -// spell-checker:ignore (ToDO) asid auditid auditinfo auid cstr egid emod euid getaudit getlogin gflag nflag pline rflag termid uflag gsflag zflag testsuite +// spell-checker:ignore (ToDO) asid auditid auditinfo auid cstr egid emod euid getaudit getlogin gflag nflag pline rflag termid uflag gsflag zflag #![allow(non_camel_case_types)] #![allow(dead_code)] @@ -242,7 +242,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { crash!(1, "cannot print only names or real IDs in default format"); } if (state.zflag) && default_format { - // NOTE: GNU testsuite "id/zero.sh" needs this stderr output: + // NOTE: GNU test suite "id/zero.sh" needs this stderr output: crash!(1, "option --zero not permitted in default format"); } diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index b4b929a2c..b0f48fe70 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -1,6 +1,6 @@ use crate::common::util::*; -// spell-checker:ignore (ToDO) testsuite coreutil +// spell-checker:ignore (ToDO) coreutil // These tests run the GNU coreutils `(g)id` binary in `$PATH` in order to gather reference values. // If the `(g)id` in `$PATH` doesn't include a coreutils version string, @@ -8,8 +8,8 @@ use crate::common::util::*; // The reference version is 8.32. Here 8.30 was chosen because right now there's no // ubuntu image for github action available with a higher version than 8.30. -const VERSION_EXPECTED: &str = "8.30"; // Version expected for the reference `id` in $PATH -const VERSION_MULTIPLE_USERS: &str = "8.31"; +const VERSION_MIN: &str = "8.30"; // minimum Version for the reference `id` in $PATH +const VERSION_MIN_MULTIPLE_USERS: &str = "8.31"; // this feature was introduced in GNU's coreutils 8.31 const UUTILS_WARNING: &str = "uutils-tests-warning"; const UUTILS_INFO: &str = "uutils-tests-info"; @@ -210,13 +210,13 @@ fn test_id_multiple_users() { let util_name = util_name!(); #[cfg(all(unix, not(target_os = "linux")))] let util_name = &format!("g{}", util_name!()); - let version_check_string = check_coreutil_version(util_name, VERSION_MULTIPLE_USERS); + let version_check_string = check_coreutil_version(util_name, VERSION_MIN_MULTIPLE_USERS); if version_check_string.starts_with(UUTILS_WARNING) { println!("{}\ntest skipped", version_check_string); return; } - // Same typical users that GNU testsuite is using. + // Same typical users that GNU test suite is using. let test_users = ["root", "man", "postfix", "sshd", &whoami()]; let scene = TestScenario::new(util_name!()); @@ -278,7 +278,7 @@ fn test_id_multiple_users_non_existing() { let util_name = util_name!(); #[cfg(all(unix, not(target_os = "linux")))] let util_name = &format!("g{}", util_name!()); - let version_check_string = check_coreutil_version(util_name, VERSION_MULTIPLE_USERS); + let version_check_string = check_coreutil_version(util_name, VERSION_MIN_MULTIPLE_USERS); if version_check_string.starts_with(UUTILS_WARNING) { println!("{}\ntest skipped", version_check_string); return; @@ -467,7 +467,7 @@ fn expected_result(args: &[&str]) -> Result { #[cfg(all(unix, not(target_os = "linux")))] let util_name = &format!("g{}", util_name!()); - let version_check_string = check_coreutil_version(util_name, VERSION_EXPECTED); + let version_check_string = check_coreutil_version(util_name, VERSION_MIN); if version_check_string.starts_with(UUTILS_WARNING) { return Err(version_check_string); } From 11f36eae3b1944b40af7ca51af1a10458bb50865 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 21 Jun 2021 20:55:57 +0200 Subject: [PATCH 1109/1135] tests/groups: fix/add tests for (multiple) username(s) --- src/uu/groups/Cargo.toml | 2 +- src/uu/groups/src/groups.rs | 4 +- tests/by-util/test_groups.rs | 202 ++++++++++++++++++++++++++++------- 3 files changed, 164 insertions(+), 44 deletions(-) diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index e7ce52650..4a5a537e5 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -3,7 +3,7 @@ name = "uu_groups" version = "0.0.6" authors = ["uutils developers"] license = "MIT" -description = "groups ~ (uutils) print the groups a user is in" +description = "groups ~ (uutils) display group memberships for USERNAME" homepage = "https://github.com/uutils/coreutils" repository = "https://github.com/uutils/coreutils/tree/master/src/uu/groups" diff --git a/src/uu/groups/src/groups.rs b/src/uu/groups/src/groups.rs index 22e7b8918..6585f3d16 100644 --- a/src/uu/groups/src/groups.rs +++ b/src/uu/groups/src/groups.rs @@ -7,7 +7,7 @@ // file that was distributed with this source code. // // ============================================================================ -// Testsuite summary for GNU coreutils 8.32.162-4eda +// Test suite summary for GNU coreutils 8.32.162-4eda // ============================================================================ // PASS: tests/misc/groups-dash.sh // PASS: tests/misc/groups-process-all.sh @@ -52,7 +52,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); - let mut exit_code = 1; + let mut exit_code = 0; if users.is_empty() { println!( diff --git a/tests/by-util/test_groups.rs b/tests/by-util/test_groups.rs index c1b98aea1..9bd0cd12a 100644 --- a/tests/by-util/test_groups.rs +++ b/tests/by-util/test_groups.rs @@ -1,56 +1,176 @@ use crate::common::util::*; +// spell-checker:ignore (ToDO) coreutil + +// These tests run the GNU coreutils `(g)groups` binary in `$PATH` in order to gather reference values. +// If the `(g)groups` in `$PATH` doesn't include a coreutils version string, +// or the version is too low, the test is skipped. + +// The reference version is 8.32. Here 8.30 was chosen because right now there's no +// ubuntu image for github action available with a higher version than 8.30. +const VERSION_MIN: &str = "8.30"; // minimum Version for the reference `groups` in $PATH +const VERSION_MIN_MULTIPLE_USERS: &str = "8.31"; // this feature was introduced in GNU's coreutils 8.31 +const UUTILS_WARNING: &str = "uutils-tests-warning"; +const UUTILS_INFO: &str = "uutils-tests-info"; + +macro_rules! unwrap_or_return { + ( $e:expr ) => { + match $e { + Ok(x) => x, + Err(e) => { + println!("{}: test skipped: {}", UUTILS_INFO, e); + return; + } + } + }; +} + +fn whoami() -> String { + // Apparently some CI environments have configuration issues, e.g. with 'whoami' and 'id'. + // + // From the Logs: "Build (ubuntu-18.04, x86_64-unknown-linux-gnu, feat_os_unix, use-cross)" + // whoami: cannot find name for user ID 1001 + // id --name: cannot find name for user ID 1001 + // id --name: cannot find name for group ID 116 + // + // However, when running "id" from within "/bin/bash" it looks fine: + // id: "uid=1001(runner) gid=118(docker) groups=118(docker),4(adm),101(systemd-journal)" + // whoami: "runner" + + // Use environment variable to get current user instead of + // invoking `whoami` and fall back to user "nobody" on error. + std::env::var("USER").unwrap_or_else(|e| { + println!("{}: {}, using \"nobody\" instead", UUTILS_WARNING, e); + "nobody".to_string() + }) +} + #[test] #[cfg(unix)] fn test_groups() { - if !is_ci() { - new_ucmd!().succeeds().stdout_is(expected_result(&[])); - } else { - // TODO: investigate how this could be tested in CI - // stderr = groups: cannot find name for group ID 116 - println!("test skipped:"); - } + let result = new_ucmd!().run(); + let exp_result = unwrap_or_return!(expected_result(&[])); + + result + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); } #[test] #[cfg(unix)] -#[ignore = "fixme: 'groups USERNAME' needs more debugging"] fn test_groups_username() { - let scene = TestScenario::new(util_name!()); - let whoami_result = scene.cmd("whoami").run(); + let test_users = [&whoami()[..]]; - let username = if whoami_result.succeeded() { - whoami_result.stdout_move_str() - } else if is_ci() { - String::from("docker") - } else { - println!("test skipped:"); + let result = new_ucmd!().args(&test_users).run(); + let exp_result = unwrap_or_return!(expected_result(&test_users)); + + result + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); +} + +#[test] +#[cfg(unix)] +fn test_groups_username_multiple() { + // TODO: [2021-06; jhscheer] refactor this as `let util_name = host_name_for(util_name!())` when that function is added to 'tests/common' + #[cfg(target_os = "linux")] + let util_name = util_name!(); + #[cfg(all(unix, not(target_os = "linux")))] + let util_name = &format!("g{}", util_name!()); + let version_check_string = check_coreutil_version(util_name, VERSION_MIN_MULTIPLE_USERS); + if version_check_string.starts_with(UUTILS_WARNING) { + println!("{}\ntest skipped", version_check_string); return; + } + let test_users = ["root", "man", "postfix", "sshd", &whoami()]; + + let result = new_ucmd!().args(&test_users).run(); + let exp_result = unwrap_or_return!(expected_result(&test_users)); + + result + .stdout_is(exp_result.stdout_str()) + .stderr_is(exp_result.stderr_str()) + .code_is(exp_result.code()); +} + +fn check_coreutil_version(util_name: &str, version_expected: &str) -> String { + // example: + // $ id --version | head -n 1 + // id (GNU coreutils) 8.32.162-4eda + let scene = TestScenario::new(util_name); + let version_check = scene + .cmd_keepenv(&util_name) + .env("LC_ALL", "C") + .arg("--version") + .run(); + version_check + .stdout_str() + .split('\n') + .collect::>() + .get(0) + .map_or_else( + || format!("{}: unexpected output format for reference coreutil: '{} --version'", UUTILS_WARNING, util_name), + |s| { + if s.contains(&format!("(GNU coreutils) {}", version_expected)) { + s.to_string() + } else if s.contains("(GNU coreutils)") { + let version_found = s.split_whitespace().last().unwrap()[..4].parse::().unwrap_or_default(); + let version_expected = version_expected.parse::().unwrap_or_default(); + if version_found > version_expected { + format!("{}: version for the reference coreutil '{}' is higher than expected; expected: {}, found: {}", UUTILS_INFO, util_name, version_expected, version_found) + } else { + format!("{}: version for the reference coreutil '{}' does not match; expected: {}, found: {}", UUTILS_WARNING, util_name, version_expected, version_found) } + } else { + format!("{}: no coreutils version string found for reference coreutils '{} --version'", UUTILS_WARNING, util_name) + } + }, + ) +} + +#[allow(clippy::needless_borrow)] +#[cfg(unix)] +fn expected_result(args: &[&str]) -> Result { + // TODO: [2021-06; jhscheer] refactor this as `let util_name = host_name_for(util_name!())` when that function is added to 'tests/common' + #[cfg(target_os = "linux")] + let util_name = util_name!(); + #[cfg(all(unix, not(target_os = "linux")))] + let util_name = &format!("g{}", util_name!()); + + let version_check_string = check_coreutil_version(util_name, VERSION_MIN); + if version_check_string.starts_with(UUTILS_WARNING) { + return Err(version_check_string); + } + println!("{}", version_check_string); + + let scene = TestScenario::new(util_name); + let result = scene + .cmd_keepenv(util_name) + .env("LC_ALL", "C") + .args(args) + .run(); + + let (stdout, stderr): (String, String) = if cfg!(target_os = "linux") { + ( + result.stdout_str().to_string(), + result.stderr_str().to_string(), + ) + } else { + // strip 'g' prefix from results: + let from = util_name.to_string() + ":"; + let to = &from[1..]; + ( + result.stdout_str().replace(&from, to), + result.stderr_str().replace(&from, to), + ) }; - // TODO: stdout should be in the form: "username : group1 group2 group3" - - scene - .ucmd() - .arg(&username) - .succeeds() - .stdout_is(expected_result(&[&username])); -} - -#[cfg(unix)] -fn expected_result(args: &[&str]) -> String { - // We want to use GNU id. On most linux systems, this is "id", but on - // bsd-like systems (e.g. FreeBSD, MacOS), it is commonly "gid". - #[cfg(any(target_os = "linux"))] - let util_name = "id"; - #[cfg(not(target_os = "linux"))] - let util_name = "gid"; - - TestScenario::new(util_name) - .cmd_keepenv(util_name) - .env("LANGUAGE", "C") - .args(args) - .args(&["-Gn"]) - .succeeds() - .stdout_move_str() + Ok(CmdResult::new( + Some(result.tmpd()), + Some(result.code()), + result.succeeded(), + stdout.as_bytes(), + stderr.as_bytes(), + )) } From 8884666ce0531ba3751e96bfd46bd710a2e55538 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 23 Jun 2021 10:00:27 -0500 Subject: [PATCH 1110/1135] maint/CICD ~ fix dependency display errors (relax network lockout) --- .github/workflows/CICD.yml | 4 ++-- .github/workflows/FixPR.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index a8046269a..1aa9cc50a 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -198,7 +198,7 @@ jobs: 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 --frozen --all --no-dev-dependencies --no-indent --features ${{ matrix.job.features }} | grep -vE "$PWD" | sort --unique + RUSTUP_TOOLCHAIN=stable cargo-tree tree --locked --all --no-dev-dependencies --no-indent --features ${{ matrix.job.features }} | grep -vE "$PWD" | sort --unique - name: Test uses: actions-rs/cargo@v1 with: @@ -418,7 +418,7 @@ jobs: # dependencies echo "## dependency list" cargo fetch --locked --quiet - cargo-tree tree --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --all --no-dev-dependencies --no-indent | grep -vE "$PWD" | sort --unique + cargo-tree tree --locked --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --all --no-dev-dependencies --no-indent | grep -vE "$PWD" | sort --unique - name: Build uses: actions-rs/cargo@v1 with: diff --git a/.github/workflows/FixPR.yml b/.github/workflows/FixPR.yml index 17470df26..5c87d5db0 100644 --- a/.github/workflows/FixPR.yml +++ b/.github/workflows/FixPR.yml @@ -73,7 +73,7 @@ jobs: 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 --frozen --all --no-dev-dependencies --no-indent --features ${{ matrix.job.features }} | grep -vE "$PWD" | sort --unique + RUSTUP_TOOLCHAIN=stable cargo-tree tree --locked --all --no-dev-dependencies --no-indent --features ${{ matrix.job.features }} | grep -vE "$PWD" | sort --unique - name: Commit any changes (to '${{ env.BRANCH_TARGET }}') uses: EndBug/add-and-commit@v7 with: From 17a959853e938f9b3af316b5f362a854d976bb1f Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 23 Jun 2021 10:05:49 -0500 Subject: [PATCH 1111/1135] maint/CICD ~ suppress useless `rustup` notices --- .github/workflows/CICD.yml | 4 ++-- .github/workflows/FixPR.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 1aa9cc50a..9c0e94bb2 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -189,7 +189,7 @@ jobs: # tooling info display echo "## tooling" which gcc >/dev/null 2>&1 && (gcc --version | head -1) || true - rustup -V + rustup -V 2>/dev/null rustup show active-toolchain cargo -V rustc -V @@ -410,7 +410,7 @@ jobs: # tooling info display echo "## tooling" which gcc >/dev/null 2>&1 && (gcc --version | head -1) || true - rustup -V + rustup -V 2>/dev/null rustup show active-toolchain cargo -V rustc -V diff --git a/.github/workflows/FixPR.yml b/.github/workflows/FixPR.yml index 5c87d5db0..cfcb6e597 100644 --- a/.github/workflows/FixPR.yml +++ b/.github/workflows/FixPR.yml @@ -64,7 +64,7 @@ jobs: ## tooling info display echo "## tooling" which gcc >/dev/null 2>&1 && (gcc --version | head -1) || true - rustup -V + rustup -V 2>/dev/null rustup show active-toolchain cargo -V rustc -V From 42fed9186dbec1ea0058f8191a1f1ff3ff7d555c Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 23 Jun 2021 12:03:35 -0500 Subject: [PATCH 1112/1135] maint/docs ~ add ToDO for change from `cargo-tree` to `cargo tree` --- .github/workflows/CICD.yml | 2 ++ .github/workflows/FixPR.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 9c0e94bb2..b2d77a5a4 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -7,6 +7,8 @@ name: CICD # 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 +# ToDO: [2021-06; rivy] change from `cargo-tree` to `cargo tree` once MSRV is >= 1.45 + env: PROJECT_NAME: coreutils PROJECT_DESC: "Core universal (cross-platform) utilities" diff --git a/.github/workflows/FixPR.yml b/.github/workflows/FixPR.yml index cfcb6e597..d3f8a86b8 100644 --- a/.github/workflows/FixPR.yml +++ b/.github/workflows/FixPR.yml @@ -2,6 +2,8 @@ name: FixPR # Trigger automated fixes for PRs being merged (with associated commits) +# ToDO: [2021-06; rivy] change from `cargo-tree` to `cargo tree` once MSRV is >= 1.45 + env: BRANCH_TARGET: master From b881c4ef925430d7366b97adab10489d69043997 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 23 Jun 2021 12:10:48 -0500 Subject: [PATCH 1113/1135] docs ~ add 'Jan Scheer' to spell-checker exceptions word list --- .vscode/cspell.dictionaries/people.wordlist.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.vscode/cspell.dictionaries/people.wordlist.txt b/.vscode/cspell.dictionaries/people.wordlist.txt index 0a091633f..0c5893eae 100644 --- a/.vscode/cspell.dictionaries/people.wordlist.txt +++ b/.vscode/cspell.dictionaries/people.wordlist.txt @@ -58,6 +58,9 @@ Haitao Li Inokentiy Babushkin Inokentiy Babushkin +Jan Scheer * jhscheer + Jan + Scheer Jeremiah Peschka Jeremiah Peschka From 2990ebd0aab2d50dee97ed3876fd05bfe328fb4a Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 23 Jun 2021 17:01:42 -0500 Subject: [PATCH 1114/1135] docs ~ fix addition of 'jhscheer' to spell-checker exceptions word list --- .vscode/cspell.dictionaries/people.wordlist.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.vscode/cspell.dictionaries/people.wordlist.txt b/.vscode/cspell.dictionaries/people.wordlist.txt index 0c5893eae..d7665585b 100644 --- a/.vscode/cspell.dictionaries/people.wordlist.txt +++ b/.vscode/cspell.dictionaries/people.wordlist.txt @@ -61,6 +61,7 @@ Inokentiy Babushkin Jan Scheer * jhscheer Jan Scheer + jhscheer Jeremiah Peschka Jeremiah Peschka From b03d4c02bb70960d609f4ac15f3dac0a4e0000ec Mon Sep 17 00:00:00 2001 From: James Vasile Date: Thu, 24 Jun 2021 10:44:47 -0400 Subject: [PATCH 1115/1135] Fix typo: duplicated word --- docs/uutils.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/uutils.rst b/docs/uutils.rst index 19af87fef..e3b8c6a1a 100644 --- a/docs/uutils.rst +++ b/docs/uutils.rst @@ -16,7 +16,7 @@ Synopsis Description ----------- -``uutils`` is a program that contains that other coreutils commands, somewhat +``uutils`` is a program that contains other coreutils commands, somewhat similar to Busybox. --help, -h print a help menu for PROGRAM displaying accepted options and From 8bebfbb3e648c99d519f3ad55ea73c49d49668d7 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Thu, 24 Jun 2021 18:33:33 +0200 Subject: [PATCH 1116/1135] sort: don't store slices for general numeric sort Gerenal numeric sort works by comparing pre-parsed floating point numbers. That means that we don't have to store the &str the float was parsed from. As a result, memory usage was slightly reduced for general numeric sort. --- src/uu/sort/src/sort.rs | 73 ++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 2512d65d1..202ab5d1a 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -227,11 +227,8 @@ impl GlobalSettings { /// afterwards. fn init_precomputed(&mut self) { self.precomputed.needs_tokens = self.selectors.iter().any(|s| s.needs_tokens); - self.precomputed.selections_per_line = self - .selectors - .iter() - .filter(|s| !s.is_default_selection) - .count(); + self.precomputed.selections_per_line = + self.selectors.iter().filter(|s| s.needs_selection).count(); self.precomputed.num_infos_per_line = self .selectors .iter() @@ -362,10 +359,10 @@ impl Default for KeySettings { Self::from(&GlobalSettings::default()) } } -enum NumCache { +enum Selection<'a> { AsF64(GeneralF64ParseResult), - WithInfo(NumInfo), - None, + WithNumInfo(&'a str, NumInfo), + Str(&'a str), } type Field = Range; @@ -392,17 +389,22 @@ impl<'a> Line<'a> { if settings.precomputed.needs_tokens { tokenize(line, settings.separator, token_buffer); } - for (selection, num_cache) in settings + for (selector, selection) in settings .selectors .iter() - .filter(|selector| !selector.is_default_selection) - .map(|selector| selector.get_selection(line, token_buffer)) + .map(|selector| (selector, selector.get_selection(line, token_buffer))) { - line_data.selections.push(selection); - match num_cache { - NumCache::AsF64(parsed_float) => line_data.parsed_floats.push(parsed_float), - NumCache::WithInfo(num_info) => line_data.num_infos.push(num_info), - NumCache::None => (), + match selection { + Selection::AsF64(parsed_float) => line_data.parsed_floats.push(parsed_float), + Selection::WithNumInfo(str, num_info) => { + line_data.num_infos.push(num_info); + line_data.selections.push(str); + } + Selection::Str(str) => { + if selector.needs_selection { + line_data.selections.push(str) + } + } } } Self { line, index } @@ -667,8 +669,10 @@ struct FieldSelector { to: Option, settings: KeySettings, needs_tokens: bool, - // Whether the selection for each line is going to be the whole line with no NumCache - is_default_selection: bool, + // Whether this selector operates on a sub-slice of a line. + // Selections are therefore not needed when this selector matches the whole line + // or the sort mode is general-numeric. + needs_selection: bool, } impl Default for FieldSelector { @@ -678,7 +682,7 @@ impl Default for FieldSelector { to: None, settings: Default::default(), needs_tokens: false, - is_default_selection: true, + needs_selection: false, } } } @@ -774,14 +778,12 @@ impl FieldSelector { Err("invalid character index 0 for the start position of a field".to_string()) } else { Ok(Self { - is_default_selection: from.field == 1 - && from.char == 1 - && to.is_none() - && !matches!( - settings.mode, - SortMode::Numeric | SortMode::GeneralNumeric | SortMode::HumanNumeric - ) - && !from.ignore_blanks, + needs_selection: (from.field != 1 + || from.char != 1 + || to.is_some() + || matches!(settings.mode, SortMode::Numeric | SortMode::HumanNumeric) + || from.ignore_blanks) + && !matches!(settings.mode, SortMode::GeneralNumeric), needs_tokens: from.field != 1 || from.char == 0 || to.is_some(), from, to, @@ -792,7 +794,7 @@ impl FieldSelector { /// Get the selection that corresponds to this selector for the line. /// If needs_fields returned false, tokens may be empty. - fn get_selection<'a>(&self, line: &'a str, tokens: &[Field]) -> (&'a str, NumCache) { + fn get_selection<'a>(&self, line: &'a str, tokens: &[Field]) -> Selection<'a> { // `get_range` expects `None` when we don't need tokens and would get confused by an empty vector. let tokens = if self.needs_tokens { Some(tokens) @@ -800,9 +802,7 @@ impl FieldSelector { None }; let mut range = &line[self.get_range(line, tokens)]; - let num_cache = if self.settings.mode == SortMode::Numeric - || self.settings.mode == SortMode::HumanNumeric - { + if self.settings.mode == SortMode::Numeric || self.settings.mode == SortMode::HumanNumeric { // Parse NumInfo for this number. let (info, num_range) = NumInfo::parse( range, @@ -813,15 +813,14 @@ impl FieldSelector { ); // Shorten the range to what we need to pass to numeric_str_cmp later. range = &range[num_range]; - NumCache::WithInfo(info) + Selection::WithNumInfo(range, info) } else if self.settings.mode == SortMode::GeneralNumeric { // Parse this number as f64, as this is the requirement for general numeric sorting. - NumCache::AsF64(general_f64_parse(&range[get_leading_gen(range)])) + Selection::AsF64(general_f64_parse(&range[get_leading_gen(range)])) } else { // This is not a numeric sort, so we don't need a NumCache. - NumCache::None - }; - (range, num_cache) + Selection::Str(range) + } } /// Look up the range in the line that corresponds to this selector. @@ -1366,7 +1365,7 @@ fn compare_by<'a>( let mut num_info_index = 0; let mut parsed_float_index = 0; for selector in &global_settings.selectors { - let (a_str, b_str) = if selector.is_default_selection { + let (a_str, b_str) = if !selector.needs_selection { // We can select the whole line. (a.line, b.line) } else { From 548a895cd6bd9f014533bb3bd1e58b8410beb40a Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 25 Jun 2021 18:19:00 +0200 Subject: [PATCH 1117/1135] sort: compatibility of human-numeric sort Closes #1985. This makes human-numeric sort follow the same algorithm as GNU's/FreeBSD's sort. As documented by GNU in https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html, we first compare by sign, then by si unit and finally by the numeric value. --- src/uu/sort/src/numeric_str_cmp.rs | 71 +++++++++++++------ src/uu/sort/src/sort.rs | 12 +++- tests/by-util/test_sort.rs | 12 +++- .../fixtures/sort/human_block_sizes.expected | 1 + .../sort/human_block_sizes.expected.debug | 3 + tests/fixtures/sort/human_block_sizes.txt | 3 +- 6 files changed, 77 insertions(+), 25 deletions(-) diff --git a/src/uu/sort/src/numeric_str_cmp.rs b/src/uu/sort/src/numeric_str_cmp.rs index 8cd3faab2..d753c2d9d 100644 --- a/src/uu/sort/src/numeric_str_cmp.rs +++ b/src/uu/sort/src/numeric_str_cmp.rs @@ -81,28 +81,12 @@ impl NumInfo { } if Self::is_invalid_char(char, &mut had_decimal_pt, &parse_settings) { - let si_unit = if parse_settings.accept_si_units { - match char { - 'K' | 'k' => 3, - 'M' => 6, - 'G' => 9, - 'T' => 12, - 'P' => 15, - 'E' => 18, - 'Z' => 21, - 'Y' => 24, - _ => 0, - } - } else { - 0 - }; return if let Some(start) = start { + let has_si_unit = parse_settings.accept_si_units + && matches!(char, 'K' | 'k' | 'M' | 'G' | 'T' | 'P' | 'E' | 'Z' | 'Y'); ( - NumInfo { - exponent: exponent + si_unit, - sign, - }, - start..idx, + NumInfo { exponent, sign }, + start..if has_si_unit { idx + 1 } else { idx }, ) } else { ( @@ -182,8 +166,53 @@ impl NumInfo { } } -/// compare two numbers as strings without parsing them as a number first. This should be more performant and can handle numbers more precisely. +fn get_unit(unit: Option) -> u8 { + if let Some(unit) = unit { + match unit { + 'K' | 'k' => 1, + 'M' => 2, + 'G' => 3, + 'T' => 4, + 'P' => 5, + 'E' => 6, + 'Z' => 7, + 'Y' => 8, + _ => 0, + } + } else { + 0 + } +} + +/// Compare two numbers according to the rules of human numeric comparison. +/// The SI-Unit takes precedence over the actual value (i.e. 2000M < 1G). +pub fn human_numeric_str_cmp( + (a, a_info): (&str, &NumInfo), + (b, b_info): (&str, &NumInfo), +) -> Ordering { + // 1. Sign + if a_info.sign != b_info.sign { + return a_info.sign.cmp(&b_info.sign); + } + // 2. Unit + let a_unit = get_unit(a.chars().next_back()); + let b_unit = get_unit(b.chars().next_back()); + let ordering = a_unit.cmp(&b_unit); + if ordering != Ordering::Equal { + if a_info.sign == Sign::Negative { + ordering.reverse() + } else { + ordering + } + } else { + // 3. Number + numeric_str_cmp((a, a_info), (b, b_info)) + } +} + +/// Compare two numbers as strings without parsing them as a number first. This should be more performant and can handle numbers more precisely. /// NumInfo is needed to provide a fast path for most numbers. +#[inline(always)] pub fn numeric_str_cmp((a, a_info): (&str, &NumInfo), (b, b_info): (&str, &NumInfo)) -> Ordering { // check for a difference in the sign if a_info.sign != b_info.sign { diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 202ab5d1a..d0e574627 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -28,7 +28,7 @@ use clap::{crate_version, App, Arg}; use custom_str_cmp::custom_str_cmp; use ext_sort::ext_sort; use fnv::FnvHasher; -use numeric_str_cmp::{numeric_str_cmp, NumInfo, NumInfoParseSettings}; +use numeric_str_cmp::{human_numeric_str_cmp, numeric_str_cmp, NumInfo, NumInfoParseSettings}; use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; use rayon::prelude::*; @@ -1383,7 +1383,7 @@ fn compare_by<'a>( let cmp: Ordering = match settings.mode { SortMode::Random => random_shuffle(a_str, b_str, &global_settings.salt), - SortMode::Numeric | SortMode::HumanNumeric => { + SortMode::Numeric => { let a_num_info = &a_line_data.num_infos [a.index * global_settings.precomputed.num_infos_per_line + num_info_index]; let b_num_info = &b_line_data.num_infos @@ -1391,6 +1391,14 @@ fn compare_by<'a>( num_info_index += 1; numeric_str_cmp((a_str, a_num_info), (b_str, b_num_info)) } + SortMode::HumanNumeric => { + let a_num_info = &a_line_data.num_infos + [a.index * global_settings.precomputed.num_infos_per_line + num_info_index]; + let b_num_info = &b_line_data.num_infos + [b.index * global_settings.precomputed.num_infos_per_line + num_info_index]; + num_info_index += 1; + human_numeric_str_cmp((a_str, a_num_info), (b_str, b_num_info)) + } SortMode::GeneralNumeric => { let a_float = &a_line_data.parsed_floats [a.index * global_settings.precomputed.floats_per_line + parsed_float_index]; diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 01fafae00..3e841f630 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -456,10 +456,20 @@ fn test_human_block_sizes2() { .arg(human_numeric_sort_param) .pipe_in(input) .succeeds() - .stdout_only("-8T\n0.8M\n8981K\n21G\n909991M\n"); + .stdout_only("-8T\n8981K\n0.8M\n909991M\n21G\n"); } } +#[test] +fn test_human_numeric_zero_stable() { + let input = "0M\n0K\n-0K\n-P\n-0M\n"; + new_ucmd!() + .arg("-hs") + .pipe_in(input) + .succeeds() + .stdout_only(input); +} + #[test] fn test_month_default2() { for month_sort_param in &["-M", "--month-sort", "--sort=month"] { diff --git a/tests/fixtures/sort/human_block_sizes.expected b/tests/fixtures/sort/human_block_sizes.expected index 0e4fdfbb6..5b4f8bb83 100644 --- a/tests/fixtures/sort/human_block_sizes.expected +++ b/tests/fixtures/sort/human_block_sizes.expected @@ -1,3 +1,4 @@ +0K K 844K 981K diff --git a/tests/fixtures/sort/human_block_sizes.expected.debug b/tests/fixtures/sort/human_block_sizes.expected.debug index cde98628e..398ff9db4 100644 --- a/tests/fixtures/sort/human_block_sizes.expected.debug +++ b/tests/fixtures/sort/human_block_sizes.expected.debug @@ -1,3 +1,6 @@ +0K +__ +__ K ^ no match for key _ diff --git a/tests/fixtures/sort/human_block_sizes.txt b/tests/fixtures/sort/human_block_sizes.txt index 9cc2b3c6c..a5adb9b5e 100644 --- a/tests/fixtures/sort/human_block_sizes.txt +++ b/tests/fixtures/sort/human_block_sizes.txt @@ -9,4 +9,5 @@ 844K 981K 13M -K \ No newline at end of file +K +0K \ No newline at end of file From 004b5d1b386d35019dd114c88162cadb62e0b031 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 25 Jun 2021 19:35:33 +0200 Subject: [PATCH 1118/1135] format: formatting --- src/uu/numfmt/src/format.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/numfmt/src/format.rs b/src/uu/numfmt/src/format.rs index 4e8cd8f06..e44446818 100644 --- a/src/uu/numfmt/src/format.rs +++ b/src/uu/numfmt/src/format.rs @@ -79,7 +79,7 @@ fn parse_suffix(s: &str) -> Result<(f64, Option)> { Some('Y') => Some((RawSuffix::Y, with_i)), Some('0'..='9') => None, _ => return Err(format!("invalid suffix in input: '{}'", s)), - }; + }; let suffix_len = match suffix { None => 0, From 0531153fa6331407093474753d5178994e7d1895 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Tue, 15 Jun 2021 15:35:02 +0200 Subject: [PATCH 1119/1135] uutils: move clap::App creation to separate functions --- Cargo.lock | 7 + src/uu/arch/src/arch.rs | 13 +- src/uu/base32/src/base32.rs | 5 + src/uu/base32/src/base_common.rs | 17 +- src/uu/base64/src/base64.rs | 1 + src/uu/basename/src/basename.rs | 52 ++--- src/uu/cat/src/cat.rs | 115 +++++----- src/uu/chgrp/src/chgrp.rs | 159 +++++++------- src/uu/chmod/src/chmod.rs | 108 ++++----- src/uu/chown/src/chown.rs | 192 ++++++++-------- src/uu/chroot/src/chroot.rs | 99 +++++---- src/uu/cksum/src/cksum.rs | 17 +- src/uu/comm/src/comm.rs | 22 +- src/uu/cp/src/cp.rs | 18 +- src/uu/csplit/src/csplit.rs | 56 ++--- src/uu/cut/src/cut.rs | 167 +++++++------- src/uu/date/src/date.rs | 132 +++++------ src/uu/df/src/df.rs | 230 +++++++++---------- src/uu/dircolors/src/dircolors.rs | 62 +++--- src/uu/dirname/src/dirname.rs | 24 +- src/uu/du/src/du.rs | 354 +++++++++++++++--------------- src/uu/echo/src/echo.rs | 37 ++-- src/uu/env/src/env.rs | 4 +- src/uu/expand/src/expand.rs | 14 +- src/uu/expr/Cargo.toml | 1 + src/uu/expr/src/expr.rs | 13 +- src/uu/factor/src/cli.rs | 13 +- src/uu/false/Cargo.toml | 1 + src/uu/false/src/false.rs | 9 + src/uu/fmt/src/fmt.rs | 248 ++++++++++----------- src/uu/fold/src/fold.rs | 55 ++--- src/uu/groups/src/groups.rs | 24 +- src/uu/hashsum/src/hashsum.rs | 232 ++++++++++---------- src/uu/head/src/head.rs | 4 +- src/uu/hostid/Cargo.toml | 1 + src/uu/hostid/src/hostid.rs | 15 +- src/uu/hostname/src/hostname.rs | 32 +-- src/uu/id/src/id.rs | 200 ++++++++--------- src/uu/install/src/install.rs | 52 ++--- src/uu/join/src/join.rs | 129 +++++------ src/uu/kill/src/kill.rs | 66 +++--- src/uu/link/src/link.rs | 28 +-- src/uu/ln/src/ln.rs | 122 +++++----- src/uu/logname/src/logname.rs | 12 +- src/uu/ls/src/ls.rs | 27 ++- src/uu/mkdir/src/mkdir.rs | 56 ++--- src/uu/mkfifo/src/mkfifo.rs | 45 ++-- src/uu/mknod/src/mknod.rs | 87 ++++---- src/uu/mktemp/src/mktemp.rs | 112 +++++----- src/uu/more/src/more.rs | 83 +++---- src/uu/mv/src/mv.rs | 104 +++++---- src/uu/nice/src/nice.rs | 30 +-- src/uu/nl/src/nl.rs | 109 ++++----- src/uu/nohup/src/nohup.rs | 28 +-- src/uu/nproc/src/nproc.rs | 38 ++-- src/uu/numfmt/src/numfmt.rs | 38 ++-- src/uu/od/src/od.rs | 76 ++++--- src/uu/paste/src/paste.rs | 29 +-- src/uu/pathchk/src/pathchk.rs | 44 ++-- src/uu/pinky/src/pinky.rs | 112 +++++----- src/uu/pr/Cargo.toml | 1 + src/uu/pr/src/pr.rs | 6 + src/uu/printenv/src/printenv.rs | 36 +-- src/uu/printf/Cargo.toml | 1 + src/uu/printf/src/printf.rs | 16 +- src/uu/ptx/src/ptx.rs | 41 ++-- src/uu/pwd/src/pwd.rs | 36 +-- src/uu/readlink/src/readlink.rs | 128 +++++------ src/uu/realpath/src/realpath.rs | 52 ++--- src/uu/relpath/src/relpath.rs | 42 ++-- src/uu/rm/src/rm.rs | 124 ++++++----- src/uu/rmdir/src/rmdir.rs | 40 ++-- src/uu/seq/src/seq.rs | 74 ++++--- src/uu/shred/src/shred.rs | 115 +++++----- src/uu/shuf/src/shuf.rs | 117 +++++----- src/uu/sleep/src/sleep.rs | 22 +- src/uu/sort/src/sort.rs | 322 +++++++++++++-------------- src/uu/split/src/split.rs | 157 ++++++------- src/uu/stat/src/stat.rs | 28 ++- src/uu/stdbuf/src/stdbuf.rs | 62 +++--- src/uu/sum/src/sum.rs | 39 ++-- src/uu/sync/src/sync.rs | 42 ++-- src/uu/tac/src/tac.rs | 47 ++-- src/uu/tail/src/tail.rs | 140 ++++++------ src/uu/tee/src/tee.rs | 40 ++-- src/uu/test/Cargo.toml | 1 + src/uu/test/src/test.rs | 8 + src/uu/timeout/src/timeout.rs | 35 +-- src/uu/touch/src/touch.rs | 150 ++++++------- src/uu/tr/src/tr.rs | 80 +++---- src/uu/true/Cargo.toml | 1 + src/uu/true/src/true.rs | 9 + src/uu/truncate/src/truncate.rs | 78 +++---- src/uu/tsort/src/tsort.rs | 23 +- src/uu/tty/src/tty.rs | 28 +-- src/uu/uname/src/uname.rs | 88 ++++---- src/uu/unexpand/src/unexpand.rs | 15 +- src/uu/uniq/src/uniq.rs | 84 +++---- src/uu/unlink/src/unlink.rs | 14 +- src/uu/uptime/src/uptime.rs | 24 +- src/uu/users/src/users.rs | 12 +- src/uu/wc/src/wc.rs | 60 ++--- src/uu/who/src/who.rs | 190 ++++++++-------- src/uu/whoami/src/whoami.rs | 8 +- src/uu/yes/src/yes.rs | 8 +- 105 files changed, 3571 insertions(+), 3253 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a059c1cd5..5f96f7f8b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1959,6 +1959,7 @@ dependencies = [ name = "uu_expr" version = "0.0.6" dependencies = [ + "clap", "libc", "num-bigint", "num-traits", @@ -1986,6 +1987,7 @@ dependencies = [ name = "uu_false" version = "0.0.6" dependencies = [ + "clap", "uucore", "uucore_procs", ] @@ -2051,6 +2053,7 @@ dependencies = [ name = "uu_hostid" version = "0.0.6" dependencies = [ + "clap", "libc", "uucore", "uucore_procs", @@ -2327,6 +2330,7 @@ name = "uu_pr" version = "0.0.6" dependencies = [ "chrono", + "clap", "getopts", "itertools 0.10.0", "quick-error 2.0.1", @@ -2349,6 +2353,7 @@ dependencies = [ name = "uu_printf" version = "0.0.6" dependencies = [ + "clap", "itertools 0.8.2", "uucore", "uucore_procs", @@ -2585,6 +2590,7 @@ dependencies = [ name = "uu_test" version = "0.0.6" dependencies = [ + "clap", "libc", "redox_syscall 0.1.57", "uucore", @@ -2628,6 +2634,7 @@ dependencies = [ name = "uu_true" version = "0.0.6" dependencies = [ + "clap", "uucore", "uucore_procs", ] diff --git a/src/uu/arch/src/arch.rs b/src/uu/arch/src/arch.rs index eddd24502..955e57389 100644 --- a/src/uu/arch/src/arch.rs +++ b/src/uu/arch/src/arch.rs @@ -17,13 +17,16 @@ static ABOUT: &str = "Display machine architecture"; static SUMMARY: &str = "Determine architecture name for current machine."; pub fn uumain(args: impl uucore::Args) -> i32 { - App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .after_help(SUMMARY) - .get_matches_from(args); + uu_app().get_matches_from(args); let uts = return_if_err!(1, PlatformInfo::new()); println!("{}", uts.machine().trim()); 0 } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .after_help(SUMMARY) +} diff --git a/src/uu/base32/src/base32.rs b/src/uu/base32/src/base32.rs index e6a01cb34..9a29717ac 100644 --- a/src/uu/base32/src/base32.rs +++ b/src/uu/base32/src/base32.rs @@ -10,6 +10,7 @@ extern crate uucore; use std::io::{stdin, Read}; +use clap::App; use uucore::encoding::Format; pub mod base_common; @@ -56,3 +57,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } + +pub fn uu_app() -> App<'static, 'static> { + base_common::base_app(executable!(), VERSION, ABOUT) +} diff --git a/src/uu/base32/src/base_common.rs b/src/uu/base32/src/base_common.rs index a606351ce..4fc8b495b 100644 --- a/src/uu/base32/src/base_common.rs +++ b/src/uu/base32/src/base_common.rs @@ -78,10 +78,17 @@ pub fn parse_base_cmd_args( about: &str, usage: &str, ) -> Result { - let app = App::new(name) + let app = base_app(name, version, about).usage(usage); + let arg_list = args + .collect_str(InvalidEncodingHandling::ConvertLossy) + .accept_any(); + Config::from(app.get_matches_from(arg_list)) +} + +pub fn base_app<'a>(name: &str, version: &'a str, about: &'a str) -> App<'static, 'a> { + App::new(name) .version(version) .about(about) - .usage(usage) // Format arguments. .arg( Arg::with_name(options::DECODE) @@ -106,11 +113,7 @@ pub fn parse_base_cmd_args( ) // "multiple" arguments are used to check whether there is more than one // file passed in. - .arg(Arg::with_name(options::FILE).index(1).multiple(true)); - let arg_list = args - .collect_str(InvalidEncodingHandling::ConvertLossy) - .accept_any(); - Config::from(app.get_matches_from(arg_list)) + .arg(Arg::with_name(options::FILE).index(1).multiple(true)) } pub fn get_input<'a>(config: &Config, stdin_ref: &'a Stdin) -> Box { diff --git a/src/uu/base64/src/base64.rs b/src/uu/base64/src/base64.rs index 0dd831027..71ed44e6e 100644 --- a/src/uu/base64/src/base64.rs +++ b/src/uu/base64/src/base64.rs @@ -10,6 +10,7 @@ extern crate uucore; use uu_base32::base_common; +pub use uu_base32::uu_app; use uucore::encoding::Format; diff --git a/src/uu/basename/src/basename.rs b/src/uu/basename/src/basename.rs index 098a3e2b2..5450ee3f2 100644 --- a/src/uu/basename/src/basename.rs +++ b/src/uu/basename/src/basename.rs @@ -40,31 +40,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // // Argument parsing // - let matches = App::new(executable!()) - .version(crate_version!()) - .about(SUMMARY) - .usage(&usage[..]) - .arg( - Arg::with_name(options::MULTIPLE) - .short("a") - .long(options::MULTIPLE) - .help("support multiple arguments and treat each as a NAME"), - ) - .arg(Arg::with_name(options::NAME).multiple(true).hidden(true)) - .arg( - Arg::with_name(options::SUFFIX) - .short("s") - .long(options::SUFFIX) - .value_name("SUFFIX") - .help("remove a trailing SUFFIX; implies -a"), - ) - .arg( - Arg::with_name(options::ZERO) - .short("z") - .long(options::ZERO) - .help("end each output line with NUL, not newline"), - ) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); // too few arguments if !matches.is_present(options::NAME) { @@ -116,6 +92,32 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(SUMMARY) + .arg( + Arg::with_name(options::MULTIPLE) + .short("a") + .long(options::MULTIPLE) + .help("support multiple arguments and treat each as a NAME"), + ) + .arg(Arg::with_name(options::NAME).multiple(true).hidden(true)) + .arg( + Arg::with_name(options::SUFFIX) + .short("s") + .long(options::SUFFIX) + .value_name("SUFFIX") + .help("remove a trailing SUFFIX; implies -a"), + ) + .arg( + Arg::with_name(options::ZERO) + .short("z") + .long(options::ZERO) + .help("end each output line with NUL, not newline"), + ) +} + fn basename(fullname: &str, suffix: &str) -> String { // Remove all platform-specific path separators from the end let path = fullname.trim_end_matches(is_separator); diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index 889ba424a..35a5308ed 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -169,7 +169,65 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .collect_str(InvalidEncodingHandling::Ignore) .accept_any(); - let matches = App::new(executable!()) + let matches = uu_app().get_matches_from(args); + + let number_mode = if matches.is_present(options::NUMBER_NONBLANK) { + NumberingMode::NonEmpty + } else if matches.is_present(options::NUMBER) { + NumberingMode::All + } else { + NumberingMode::None + }; + + let show_nonprint = vec![ + options::SHOW_ALL.to_owned(), + options::SHOW_NONPRINTING_ENDS.to_owned(), + options::SHOW_NONPRINTING_TABS.to_owned(), + options::SHOW_NONPRINTING.to_owned(), + ] + .iter() + .any(|v| matches.is_present(v)); + + let show_ends = vec![ + options::SHOW_ENDS.to_owned(), + options::SHOW_ALL.to_owned(), + options::SHOW_NONPRINTING_ENDS.to_owned(), + ] + .iter() + .any(|v| matches.is_present(v)); + + let show_tabs = vec![ + options::SHOW_ALL.to_owned(), + options::SHOW_TABS.to_owned(), + options::SHOW_NONPRINTING_TABS.to_owned(), + ] + .iter() + .any(|v| matches.is_present(v)); + + let squeeze_blank = matches.is_present(options::SQUEEZE_BLANK); + let files: Vec = match matches.values_of(options::FILE) { + Some(v) => v.clone().map(|v| v.to_owned()).collect(), + None => vec!["-".to_owned()], + }; + + let options = OutputOptions { + show_ends, + number: number_mode, + show_nonprint, + show_tabs, + squeeze_blank, + }; + let success = cat_files(files, &options).is_ok(); + + if success { + 0 + } else { + 1 + } +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .name(NAME) .version(crate_version!()) .usage(SYNTAX) @@ -229,61 +287,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::SHOW_NONPRINTING) .help("use ^ and M- notation, except for LF (\\n) and TAB (\\t)"), ) - .get_matches_from(args); - - let number_mode = if matches.is_present(options::NUMBER_NONBLANK) { - NumberingMode::NonEmpty - } else if matches.is_present(options::NUMBER) { - NumberingMode::All - } else { - NumberingMode::None - }; - - let show_nonprint = vec![ - options::SHOW_ALL.to_owned(), - options::SHOW_NONPRINTING_ENDS.to_owned(), - options::SHOW_NONPRINTING_TABS.to_owned(), - options::SHOW_NONPRINTING.to_owned(), - ] - .iter() - .any(|v| matches.is_present(v)); - - let show_ends = vec![ - options::SHOW_ENDS.to_owned(), - options::SHOW_ALL.to_owned(), - options::SHOW_NONPRINTING_ENDS.to_owned(), - ] - .iter() - .any(|v| matches.is_present(v)); - - let show_tabs = vec![ - options::SHOW_ALL.to_owned(), - options::SHOW_TABS.to_owned(), - options::SHOW_NONPRINTING_TABS.to_owned(), - ] - .iter() - .any(|v| matches.is_present(v)); - - let squeeze_blank = matches.is_present(options::SQUEEZE_BLANK); - let files: Vec = match matches.values_of(options::FILE) { - Some(v) => v.clone().map(|v| v.to_owned()).collect(), - None => vec!["-".to_owned()], - }; - - let options = OutputOptions { - show_ends, - number: number_mode, - show_nonprint, - show_tabs, - squeeze_blank, - }; - let success = cat_files(files, &options).is_ok(); - - if success { - 0 - } else { - 1 - } } fn cat_handle( diff --git a/src/uu/chgrp/src/chgrp.rs b/src/uu/chgrp/src/chgrp.rs index 454a0386c..489be59eb 100644 --- a/src/uu/chgrp/src/chgrp.rs +++ b/src/uu/chgrp/src/chgrp.rs @@ -73,84 +73,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let mut app = App::new(executable!()) - .version(VERSION) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(options::verbosity::CHANGES) - .short("c") - .long(options::verbosity::CHANGES) - .help("like verbose but report only when a change is made"), - ) - .arg( - Arg::with_name(options::verbosity::SILENT) - .short("f") - .long(options::verbosity::SILENT), - ) - .arg( - Arg::with_name(options::verbosity::QUIET) - .long(options::verbosity::QUIET) - .help("suppress most error messages"), - ) - .arg( - Arg::with_name(options::verbosity::VERBOSE) - .short("v") - .long(options::verbosity::VERBOSE) - .help("output a diagnostic for every file processed"), - ) - .arg( - Arg::with_name(options::dereference::DEREFERENCE) - .long(options::dereference::DEREFERENCE), - ) - .arg( - Arg::with_name(options::dereference::NO_DEREFERENCE) - .short("h") - .long(options::dereference::NO_DEREFERENCE) - .help( - "affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)", - ), - ) - .arg( - Arg::with_name(options::preserve_root::PRESERVE) - .long(options::preserve_root::PRESERVE) - .help("fail to operate recursively on '/'"), - ) - .arg( - Arg::with_name(options::preserve_root::NO_PRESERVE) - .long(options::preserve_root::NO_PRESERVE) - .help("do not treat '/' specially (the default)"), - ) - .arg( - Arg::with_name(options::REFERENCE) - .long(options::REFERENCE) - .value_name("RFILE") - .help("use RFILE's group rather than specifying GROUP values") - .takes_value(true) - .multiple(false), - ) - .arg( - Arg::with_name(options::RECURSIVE) - .short("R") - .long(options::RECURSIVE) - .help("operate on files and directories recursively"), - ) - .arg( - Arg::with_name(options::traverse::TRAVERSE) - .short(options::traverse::TRAVERSE) - .help("if a command line argument is a symbolic link to a directory, traverse it"), - ) - .arg( - Arg::with_name(options::traverse::NO_TRAVERSE) - .short(options::traverse::NO_TRAVERSE) - .help("do not traverse any symbolic links (default)") - .overrides_with_all(&[options::traverse::TRAVERSE, options::traverse::EVERY]), - ) - .arg( - Arg::with_name(options::traverse::EVERY) - .short(options::traverse::EVERY) - .help("traverse every symbolic link to a directory encountered"), - ); + let mut app = uu_app().usage(&usage[..]); // we change the positional args based on whether // --reference was used. @@ -274,6 +197,86 @@ pub fn uumain(args: impl uucore::Args) -> i32 { executor.exec() } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .arg( + Arg::with_name(options::verbosity::CHANGES) + .short("c") + .long(options::verbosity::CHANGES) + .help("like verbose but report only when a change is made"), + ) + .arg( + Arg::with_name(options::verbosity::SILENT) + .short("f") + .long(options::verbosity::SILENT), + ) + .arg( + Arg::with_name(options::verbosity::QUIET) + .long(options::verbosity::QUIET) + .help("suppress most error messages"), + ) + .arg( + Arg::with_name(options::verbosity::VERBOSE) + .short("v") + .long(options::verbosity::VERBOSE) + .help("output a diagnostic for every file processed"), + ) + .arg( + Arg::with_name(options::dereference::DEREFERENCE) + .long(options::dereference::DEREFERENCE), + ) + .arg( + Arg::with_name(options::dereference::NO_DEREFERENCE) + .short("h") + .long(options::dereference::NO_DEREFERENCE) + .help( + "affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)", + ), + ) + .arg( + Arg::with_name(options::preserve_root::PRESERVE) + .long(options::preserve_root::PRESERVE) + .help("fail to operate recursively on '/'"), + ) + .arg( + Arg::with_name(options::preserve_root::NO_PRESERVE) + .long(options::preserve_root::NO_PRESERVE) + .help("do not treat '/' specially (the default)"), + ) + .arg( + Arg::with_name(options::REFERENCE) + .long(options::REFERENCE) + .value_name("RFILE") + .help("use RFILE's group rather than specifying GROUP values") + .takes_value(true) + .multiple(false), + ) + .arg( + Arg::with_name(options::RECURSIVE) + .short("R") + .long(options::RECURSIVE) + .help("operate on files and directories recursively"), + ) + .arg( + Arg::with_name(options::traverse::TRAVERSE) + .short(options::traverse::TRAVERSE) + .help("if a command line argument is a symbolic link to a directory, traverse it"), + ) + .arg( + Arg::with_name(options::traverse::NO_TRAVERSE) + .short(options::traverse::NO_TRAVERSE) + .help("do not traverse any symbolic links (default)") + .overrides_with_all(&[options::traverse::TRAVERSE, options::traverse::EVERY]), + ) + .arg( + Arg::with_name(options::traverse::EVERY) + .short(options::traverse::EVERY) + .help("traverse every symbolic link to a directory encountered"), + ) +} + struct Chgrper { dest_gid: gid_t, bit_flag: u8, diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index 2d5787099..d89827c97 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -61,11 +61,64 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let after_help = get_long_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) + let matches = uu_app() .usage(&usage[..]) .after_help(&after_help[..]) + .get_matches_from(args); + + let changes = matches.is_present(options::CHANGES); + let quiet = matches.is_present(options::QUIET); + let verbose = matches.is_present(options::VERBOSE); + let preserve_root = matches.is_present(options::PRESERVE_ROOT); + let recursive = matches.is_present(options::RECURSIVE); + let fmode = matches + .value_of(options::REFERENCE) + .and_then(|fref| match fs::metadata(fref) { + Ok(meta) => Some(meta.mode()), + Err(err) => crash!(1, "cannot stat attributes of '{}': {}", fref, err), + }); + let modes = matches.value_of(options::MODE).unwrap(); // should always be Some because required + let cmode = if mode_had_minus_prefix { + // clap parsing is finished, now put prefix back + format!("-{}", modes) + } else { + modes.to_string() + }; + let mut files: Vec = matches + .values_of(options::FILE) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + let cmode = if fmode.is_some() { + // "--reference" and MODE are mutually exclusive + // if "--reference" was used MODE needs to be interpreted as another FILE + // it wasn't possible to implement this behavior directly with clap + files.push(cmode); + None + } else { + Some(cmode) + }; + + let chmoder = Chmoder { + changes, + quiet, + verbose, + preserve_root, + recursive, + fmode, + cmode, + }; + match chmoder.chmod(files) { + Ok(()) => {} + Err(e) => return e, + } + + 0 +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) .arg( Arg::with_name(options::CHANGES) .long(options::CHANGES) @@ -120,55 +173,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .required_unless(options::MODE) .multiple(true), ) - .get_matches_from(args); - - let changes = matches.is_present(options::CHANGES); - let quiet = matches.is_present(options::QUIET); - let verbose = matches.is_present(options::VERBOSE); - let preserve_root = matches.is_present(options::PRESERVE_ROOT); - let recursive = matches.is_present(options::RECURSIVE); - let fmode = matches - .value_of(options::REFERENCE) - .and_then(|fref| match fs::metadata(fref) { - Ok(meta) => Some(meta.mode()), - Err(err) => crash!(1, "cannot stat attributes of '{}': {}", fref, err), - }); - let modes = matches.value_of(options::MODE).unwrap(); // should always be Some because required - let cmode = if mode_had_minus_prefix { - // clap parsing is finished, now put prefix back - format!("-{}", modes) - } else { - modes.to_string() - }; - let mut files: Vec = matches - .values_of(options::FILE) - .map(|v| v.map(ToString::to_string).collect()) - .unwrap_or_default(); - let cmode = if fmode.is_some() { - // "--reference" and MODE are mutually exclusive - // if "--reference" was used MODE needs to be interpreted as another FILE - // it wasn't possible to implement this behavior directly with clap - files.push(cmode); - None - } else { - Some(cmode) - }; - - let chmoder = Chmoder { - changes, - quiet, - verbose, - preserve_root, - recursive, - fmode, - cmode, - }; - match chmoder.chmod(files) { - Ok(()) => {} - Err(e) => return e, - } - - 0 } // Iterate 'args' and delete the first occurrence diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index 7fc7f04d3..e1d3ff22b 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -73,101 +73,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(options::verbosity::CHANGES) - .short("c") - .long(options::verbosity::CHANGES) - .help("like verbose but report only when a change is made"), - ) - .arg(Arg::with_name(options::dereference::DEREFERENCE).long(options::dereference::DEREFERENCE).help( - "affect the referent of each symbolic link (this is the default), rather than the symbolic link itself", - )) - .arg( - Arg::with_name(options::dereference::NO_DEREFERENCE) - .short("h") - .long(options::dereference::NO_DEREFERENCE) - .help( - "affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)", - ), - ) - .arg( - Arg::with_name(options::FROM) - .long(options::FROM) - .help( - "change the owner and/or group of each file only if its current owner and/or group match those specified here. Either may be omitted, in which case a match is not required for the omitted attribute", - ) - .value_name("CURRENT_OWNER:CURRENT_GROUP"), - ) - .arg( - Arg::with_name(options::preserve_root::PRESERVE) - .long(options::preserve_root::PRESERVE) - .help("fail to operate recursively on '/'"), - ) - .arg( - Arg::with_name(options::preserve_root::NO_PRESERVE) - .long(options::preserve_root::NO_PRESERVE) - .help("do not treat '/' specially (the default)"), - ) - .arg( - Arg::with_name(options::verbosity::QUIET) - .long(options::verbosity::QUIET) - .help("suppress most error messages"), - ) - .arg( - Arg::with_name(options::RECURSIVE) - .short("R") - .long(options::RECURSIVE) - .help("operate on files and directories recursively"), - ) - .arg( - Arg::with_name(options::REFERENCE) - .long(options::REFERENCE) - .help("use RFILE's owner and group rather than specifying OWNER:GROUP values") - .value_name("RFILE") - .min_values(1), - ) - .arg(Arg::with_name(options::verbosity::SILENT).short("f").long(options::verbosity::SILENT)) - .arg( - Arg::with_name(options::traverse::TRAVERSE) - .short(options::traverse::TRAVERSE) - .help("if a command line argument is a symbolic link to a directory, traverse it") - .overrides_with_all(&[options::traverse::EVERY, options::traverse::NO_TRAVERSE]), - ) - .arg( - Arg::with_name(options::traverse::EVERY) - .short(options::traverse::EVERY) - .help("traverse every symbolic link to a directory encountered") - .overrides_with_all(&[options::traverse::TRAVERSE, options::traverse::NO_TRAVERSE]), - ) - .arg( - Arg::with_name(options::traverse::NO_TRAVERSE) - .short(options::traverse::NO_TRAVERSE) - .help("do not traverse any symbolic links (default)") - .overrides_with_all(&[options::traverse::TRAVERSE, options::traverse::EVERY]), - ) - .arg( - Arg::with_name(options::verbosity::VERBOSE) - .long(options::verbosity::VERBOSE) - .help("output a diagnostic for every file processed"), - ) - .arg( - Arg::with_name(ARG_OWNER) - .multiple(false) - .takes_value(true) - .required(true), - ) - .arg( - Arg::with_name(ARG_FILES) - .multiple(true) - .takes_value(true) - .required(true) - .min_values(1), - ) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); /* First arg is the owner/group */ let owner = matches.value_of(ARG_OWNER).unwrap(); @@ -273,6 +179,102 @@ pub fn uumain(args: impl uucore::Args) -> i32 { executor.exec() } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(options::verbosity::CHANGES) + .short("c") + .long(options::verbosity::CHANGES) + .help("like verbose but report only when a change is made"), + ) + .arg(Arg::with_name(options::dereference::DEREFERENCE).long(options::dereference::DEREFERENCE).help( + "affect the referent of each symbolic link (this is the default), rather than the symbolic link itself", + )) + .arg( + Arg::with_name(options::dereference::NO_DEREFERENCE) + .short("h") + .long(options::dereference::NO_DEREFERENCE) + .help( + "affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)", + ), + ) + .arg( + Arg::with_name(options::FROM) + .long(options::FROM) + .help( + "change the owner and/or group of each file only if its current owner and/or group match those specified here. Either may be omitted, in which case a match is not required for the omitted attribute", + ) + .value_name("CURRENT_OWNER:CURRENT_GROUP"), + ) + .arg( + Arg::with_name(options::preserve_root::PRESERVE) + .long(options::preserve_root::PRESERVE) + .help("fail to operate recursively on '/'"), + ) + .arg( + Arg::with_name(options::preserve_root::NO_PRESERVE) + .long(options::preserve_root::NO_PRESERVE) + .help("do not treat '/' specially (the default)"), + ) + .arg( + Arg::with_name(options::verbosity::QUIET) + .long(options::verbosity::QUIET) + .help("suppress most error messages"), + ) + .arg( + Arg::with_name(options::RECURSIVE) + .short("R") + .long(options::RECURSIVE) + .help("operate on files and directories recursively"), + ) + .arg( + Arg::with_name(options::REFERENCE) + .long(options::REFERENCE) + .help("use RFILE's owner and group rather than specifying OWNER:GROUP values") + .value_name("RFILE") + .min_values(1), + ) + .arg(Arg::with_name(options::verbosity::SILENT).short("f").long(options::verbosity::SILENT)) + .arg( + Arg::with_name(options::traverse::TRAVERSE) + .short(options::traverse::TRAVERSE) + .help("if a command line argument is a symbolic link to a directory, traverse it") + .overrides_with_all(&[options::traverse::EVERY, options::traverse::NO_TRAVERSE]), + ) + .arg( + Arg::with_name(options::traverse::EVERY) + .short(options::traverse::EVERY) + .help("traverse every symbolic link to a directory encountered") + .overrides_with_all(&[options::traverse::TRAVERSE, options::traverse::NO_TRAVERSE]), + ) + .arg( + Arg::with_name(options::traverse::NO_TRAVERSE) + .short(options::traverse::NO_TRAVERSE) + .help("do not traverse any symbolic links (default)") + .overrides_with_all(&[options::traverse::TRAVERSE, options::traverse::EVERY]), + ) + .arg( + Arg::with_name(options::verbosity::VERBOSE) + .long(options::verbosity::VERBOSE) + .help("output a diagnostic for every file processed"), + ) + .arg( + Arg::with_name(ARG_OWNER) + .multiple(false) + .takes_value(true) + .required(true), + ) + .arg( + Arg::with_name(ARG_FILES) + .multiple(true) + .takes_value(true) + .required(true) + .min_values(1), + ) +} + fn parse_spec(spec: &str) -> Result<(Option, Option), String> { let args = spec.split_terminator(':').collect::>(); let usr_only = args.len() == 1 && !args[0].is_empty(); diff --git a/src/uu/chroot/src/chroot.rs b/src/uu/chroot/src/chroot.rs index 86d4a4900..2c0f8522c 100644 --- a/src/uu/chroot/src/chroot.rs +++ b/src/uu/chroot/src/chroot.rs @@ -36,54 +36,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(SYNTAX) - .arg( - Arg::with_name(options::NEWROOT) - .hidden(true) - .required(true) - .index(1), - ) - .arg( - Arg::with_name(options::USER) - .short("u") - .long(options::USER) - .help("User (ID or name) to switch before running the program") - .value_name("USER"), - ) - .arg( - Arg::with_name(options::GROUP) - .short("g") - .long(options::GROUP) - .help("Group (ID or name) to switch to") - .value_name("GROUP"), - ) - .arg( - Arg::with_name(options::GROUPS) - .short("G") - .long(options::GROUPS) - .help("Comma-separated list of groups to switch to") - .value_name("GROUP1,GROUP2..."), - ) - .arg( - Arg::with_name(options::USERSPEC) - .long(options::USERSPEC) - .help( - "Colon-separated user and group to switch to. \ - Same as -u USER -g GROUP. \ - Userspec has higher preference than -u and/or -g", - ) - .value_name("USER:GROUP"), - ) - .arg( - Arg::with_name(options::COMMAND) - .hidden(true) - .multiple(true) - .index(2), - ) - .get_matches_from(args); + let matches = uu_app().get_matches_from(args); let default_shell: &'static str = "/bin/sh"; let default_option: &'static str = "-i"; @@ -138,6 +91,56 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .usage(SYNTAX) + .arg( + Arg::with_name(options::NEWROOT) + .hidden(true) + .required(true) + .index(1), + ) + .arg( + Arg::with_name(options::USER) + .short("u") + .long(options::USER) + .help("User (ID or name) to switch before running the program") + .value_name("USER"), + ) + .arg( + Arg::with_name(options::GROUP) + .short("g") + .long(options::GROUP) + .help("Group (ID or name) to switch to") + .value_name("GROUP"), + ) + .arg( + Arg::with_name(options::GROUPS) + .short("G") + .long(options::GROUPS) + .help("Comma-separated list of groups to switch to") + .value_name("GROUP1,GROUP2..."), + ) + .arg( + Arg::with_name(options::USERSPEC) + .long(options::USERSPEC) + .help( + "Colon-separated user and group to switch to. \ + Same as -u USER -g GROUP. \ + Userspec has higher preference than -u and/or -g", + ) + .value_name("USER:GROUP"), + ) + .arg( + Arg::with_name(options::COMMAND) + .hidden(true) + .multiple(true) + .index(2), + ) +} + fn set_context(root: &Path, options: &clap::ArgMatches) { let userspec_str = options.value_of(options::USERSPEC); let user_str = options.value_of(options::USER).unwrap_or_default(); diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index 6a812c186..e88cc78b3 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -180,13 +180,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .collect_str(InvalidEncodingHandling::Ignore) .accept_any(); - let matches = App::new(executable!()) - .name(NAME) - .version(crate_version!()) - .about(SUMMARY) - .usage(SYNTAX) - .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) - .get_matches_from(args); + let matches = uu_app().get_matches_from(args); let files: Vec = match matches.values_of(options::FILE) { Some(v) => v.clone().map(|v| v.to_owned()).collect(), @@ -217,3 +211,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { exit_code } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .name(NAME) + .version(crate_version!()) + .about(SUMMARY) + .usage(SYNTAX) + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) +} diff --git a/src/uu/comm/src/comm.rs b/src/uu/comm/src/comm.rs index 7a6086bb5..aa10432a2 100644 --- a/src/uu/comm/src/comm.rs +++ b/src/uu/comm/src/comm.rs @@ -137,10 +137,20 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); - let matches = App::new(executable!()) + let matches = uu_app().usage(&usage[..]).get_matches_from(args); + + let mut f1 = open_file(matches.value_of(options::FILE_1).unwrap()).unwrap(); + let mut f2 = open_file(matches.value_of(options::FILE_2).unwrap()).unwrap(); + + comm(&mut f1, &mut f2, &matches); + + 0 +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .version(crate_version!()) .about(ABOUT) - .usage(&usage[..]) .after_help(LONG_HELP) .arg( Arg::with_name(options::COLUMN_1) @@ -167,12 +177,4 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) .arg(Arg::with_name(options::FILE_1).required(true)) .arg(Arg::with_name(options::FILE_2).required(true)) - .get_matches_from(args); - - let mut f1 = open_file(matches.value_of(options::FILE_1).unwrap()).unwrap(); - let mut f2 = open_file(matches.value_of(options::FILE_2).unwrap()).unwrap(); - - comm(&mut f1, &mut f2, &matches); - - 0 } diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index e702179ec..12dfeab3f 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -290,13 +290,10 @@ static DEFAULT_ATTRIBUTES: &[Attribute] = &[ Attribute::Timestamps, ]; -pub fn uumain(args: impl uucore::Args) -> i32 { - let usage = get_usage(); - let matches = App::new(executable!()) +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .version(crate_version!()) .about(ABOUT) - .after_help(&*format!("{}\n{}", LONG_HELP, backup_control::BACKUP_CONTROL_LONG_HELP)) - .usage(&usage[..]) .arg(Arg::with_name(options::TARGET_DIRECTORY) .short("t") .conflicts_with(options::NO_TARGET_DIRECTORY) @@ -464,6 +461,17 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg(Arg::with_name(options::PATHS) .multiple(true)) +} + +pub fn uumain(args: impl uucore::Args) -> i32 { + let usage = get_usage(); + let matches = uu_app() + .after_help(&*format!( + "{}\n{}", + LONG_HELP, + backup_control::BACKUP_CONTROL_LONG_HELP + )) + .usage(&usage[..]) .get_matches_from(args); let options = crash_if_err!(EXIT_ERR, Options::from_matches(&matches)); diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index d69254a3a..048ec80d8 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -711,10 +711,37 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .collect_str(InvalidEncodingHandling::Ignore) .accept_any(); - let matches = App::new(executable!()) + let matches = uu_app().usage(&usage[..]).get_matches_from(args); + + // get the file to split + let file_name = matches.value_of(options::FILE).unwrap(); + + // get the patterns to split on + let patterns: Vec = matches + .values_of(options::PATTERN) + .unwrap() + .map(str::to_string) + .collect(); + let patterns = return_if_err!(1, patterns::get_patterns(&patterns[..])); + let options = CsplitOptions::new(&matches); + if file_name == "-" { + let stdin = io::stdin(); + crash_if_err!(1, csplit(&options, patterns, stdin.lock())); + } else { + let file = return_if_err!(1, File::open(file_name)); + let file_metadata = return_if_err!(1, file.metadata()); + if !file_metadata.is_file() { + crash!(1, "'{}' is not a regular file", file_name); + } + crash_if_err!(1, csplit(&options, patterns, BufReader::new(file))); + }; + 0 +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .version(crate_version!()) .about(SUMMARY) - .usage(&usage[..]) .arg( Arg::with_name(options::SUFFIX_FORMAT) .short("b") @@ -768,29 +795,4 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .required(true), ) .after_help(LONG_HELP) - .get_matches_from(args); - - // get the file to split - let file_name = matches.value_of(options::FILE).unwrap(); - - // get the patterns to split on - let patterns: Vec = matches - .values_of(options::PATTERN) - .unwrap() - .map(str::to_string) - .collect(); - let patterns = return_if_err!(1, patterns::get_patterns(&patterns[..])); - let options = CsplitOptions::new(&matches); - if file_name == "-" { - let stdin = io::stdin(); - crash_if_err!(1, csplit(&options, patterns, stdin.lock())); - } else { - let file = return_if_err!(1, File::open(file_name)); - let file_metadata = return_if_err!(1, file.metadata()); - if !file_metadata.is_file() { - crash!(1, "'{}' is not a regular file", file_name); - } - crash_if_err!(1, csplit(&options, patterns, BufReader::new(file))); - }; - 0 } diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index 6602b1eb1..e33b8a2fe 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -396,88 +396,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .collect_str(InvalidEncodingHandling::Ignore) .accept_any(); - let matches = App::new(executable!()) - .name(NAME) - .version(crate_version!()) - .usage(SYNTAX) - .about(SUMMARY) - .after_help(LONG_HELP) - .arg( - Arg::with_name(options::BYTES) - .short("b") - .long(options::BYTES) - .takes_value(true) - .help("filter byte columns from the input source") - .allow_hyphen_values(true) - .value_name("LIST") - .display_order(1), - ) - .arg( - Arg::with_name(options::CHARACTERS) - .short("c") - .long(options::CHARACTERS) - .help("alias for character mode") - .takes_value(true) - .allow_hyphen_values(true) - .value_name("LIST") - .display_order(2), - ) - .arg( - Arg::with_name(options::DELIMITER) - .short("d") - .long(options::DELIMITER) - .help("specify the delimiter character that separates fields in the input source. Defaults to Tab.") - .takes_value(true) - .value_name("DELIM") - .display_order(3), - ) - .arg( - Arg::with_name(options::FIELDS) - .short("f") - .long(options::FIELDS) - .help("filter field columns from the input source") - .takes_value(true) - .allow_hyphen_values(true) - .value_name("LIST") - .display_order(4), - ) - .arg( - Arg::with_name(options::COMPLEMENT) - .long(options::COMPLEMENT) - .help("invert the filter - instead of displaying only the filtered columns, display all but those columns") - .takes_value(false) - .display_order(5), - ) - .arg( - Arg::with_name(options::ONLY_DELIMITED) - .short("s") - .long(options::ONLY_DELIMITED) - .help("in field mode, only print lines which contain the delimiter") - .takes_value(false) - .display_order(6), - ) - .arg( - Arg::with_name(options::ZERO_TERMINATED) - .short("z") - .long(options::ZERO_TERMINATED) - .help("instead of filtering columns based on line, filter columns based on \\0 (NULL character)") - .takes_value(false) - .display_order(8), - ) - .arg( - Arg::with_name(options::OUTPUT_DELIMITER) - .long(options::OUTPUT_DELIMITER) - .help("in field mode, replace the delimiter in output lines with this option's argument") - .takes_value(true) - .value_name("NEW_DELIM") - .display_order(7), - ) - .arg( - Arg::with_name(options::FILE) - .hidden(true) - .multiple(true) - ) - .get_matches_from(args); + let matches = uu_app().get_matches_from(args); let complement = matches.is_present(options::COMPLEMENT); @@ -627,3 +546,87 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .name(NAME) + .version(crate_version!()) + .usage(SYNTAX) + .about(SUMMARY) + .after_help(LONG_HELP) + .arg( + Arg::with_name(options::BYTES) + .short("b") + .long(options::BYTES) + .takes_value(true) + .help("filter byte columns from the input source") + .allow_hyphen_values(true) + .value_name("LIST") + .display_order(1), + ) + .arg( + Arg::with_name(options::CHARACTERS) + .short("c") + .long(options::CHARACTERS) + .help("alias for character mode") + .takes_value(true) + .allow_hyphen_values(true) + .value_name("LIST") + .display_order(2), + ) + .arg( + Arg::with_name(options::DELIMITER) + .short("d") + .long(options::DELIMITER) + .help("specify the delimiter character that separates fields in the input source. Defaults to Tab.") + .takes_value(true) + .value_name("DELIM") + .display_order(3), + ) + .arg( + Arg::with_name(options::FIELDS) + .short("f") + .long(options::FIELDS) + .help("filter field columns from the input source") + .takes_value(true) + .allow_hyphen_values(true) + .value_name("LIST") + .display_order(4), + ) + .arg( + Arg::with_name(options::COMPLEMENT) + .long(options::COMPLEMENT) + .help("invert the filter - instead of displaying only the filtered columns, display all but those columns") + .takes_value(false) + .display_order(5), + ) + .arg( + Arg::with_name(options::ONLY_DELIMITED) + .short("s") + .long(options::ONLY_DELIMITED) + .help("in field mode, only print lines which contain the delimiter") + .takes_value(false) + .display_order(6), + ) + .arg( + Arg::with_name(options::ZERO_TERMINATED) + .short("z") + .long(options::ZERO_TERMINATED) + .help("instead of filtering columns based on line, filter columns based on \\0 (NULL character)") + .takes_value(false) + .display_order(8), + ) + .arg( + Arg::with_name(options::OUTPUT_DELIMITER) + .long(options::OUTPUT_DELIMITER) + .help("in field mode, replace the delimiter in output lines with this option's argument") + .takes_value(true) + .value_name("NEW_DELIM") + .display_order(7), + ) + .arg( + Arg::with_name(options::FILE) + .hidden(true) + .multiple(true) + ) +} diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index 11c3eb31f..0071b5e8c 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -142,71 +142,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { {0} [OPTION]... [MMDDhhmm[[CC]YY][.ss]]", NAME ); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&syntax[..]) - .arg( - Arg::with_name(OPT_DATE) - .short("d") - .long(OPT_DATE) - .takes_value(true) - .help("display time described by STRING, not 'now'"), - ) - .arg( - Arg::with_name(OPT_FILE) - .short("f") - .long(OPT_FILE) - .takes_value(true) - .help("like --date; once for each line of DATEFILE"), - ) - .arg( - Arg::with_name(OPT_ISO_8601) - .short("I") - .long(OPT_ISO_8601) - .takes_value(true) - .help(ISO_8601_HELP_STRING), - ) - .arg( - Arg::with_name(OPT_RFC_EMAIL) - .short("R") - .long(OPT_RFC_EMAIL) - .help(RFC_5322_HELP_STRING), - ) - .arg( - Arg::with_name(OPT_RFC_3339) - .long(OPT_RFC_3339) - .takes_value(true) - .help(RFC_3339_HELP_STRING), - ) - .arg( - Arg::with_name(OPT_DEBUG) - .long(OPT_DEBUG) - .help("annotate the parsed date, and warn about questionable usage to stderr"), - ) - .arg( - Arg::with_name(OPT_REFERENCE) - .short("r") - .long(OPT_REFERENCE) - .takes_value(true) - .help("display the last modification time of FILE"), - ) - .arg( - Arg::with_name(OPT_SET) - .short("s") - .long(OPT_SET) - .takes_value(true) - .help(OPT_SET_HELP_STRING), - ) - .arg( - Arg::with_name(OPT_UNIVERSAL) - .short("u") - .long(OPT_UNIVERSAL) - .alias(OPT_UNIVERSAL_2) - .help("print or set Coordinated Universal Time (UTC)"), - ) - .arg(Arg::with_name(OPT_FORMAT).multiple(false)) - .get_matches_from(args); + let matches = uu_app().usage(&syntax[..]).get_matches_from(args); let format = if let Some(form) = matches.value_of(OPT_FORMAT) { if !form.starts_with('+') { @@ -314,6 +250,72 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(OPT_DATE) + .short("d") + .long(OPT_DATE) + .takes_value(true) + .help("display time described by STRING, not 'now'"), + ) + .arg( + Arg::with_name(OPT_FILE) + .short("f") + .long(OPT_FILE) + .takes_value(true) + .help("like --date; once for each line of DATEFILE"), + ) + .arg( + Arg::with_name(OPT_ISO_8601) + .short("I") + .long(OPT_ISO_8601) + .takes_value(true) + .help(ISO_8601_HELP_STRING), + ) + .arg( + Arg::with_name(OPT_RFC_EMAIL) + .short("R") + .long(OPT_RFC_EMAIL) + .help(RFC_5322_HELP_STRING), + ) + .arg( + Arg::with_name(OPT_RFC_3339) + .long(OPT_RFC_3339) + .takes_value(true) + .help(RFC_3339_HELP_STRING), + ) + .arg( + Arg::with_name(OPT_DEBUG) + .long(OPT_DEBUG) + .help("annotate the parsed date, and warn about questionable usage to stderr"), + ) + .arg( + Arg::with_name(OPT_REFERENCE) + .short("r") + .long(OPT_REFERENCE) + .takes_value(true) + .help("display the last modification time of FILE"), + ) + .arg( + Arg::with_name(OPT_SET) + .short("s") + .long(OPT_SET) + .takes_value(true) + .help(OPT_SET_HELP_STRING), + ) + .arg( + Arg::with_name(OPT_UNIVERSAL) + .short("u") + .long(OPT_UNIVERSAL) + .alias(OPT_UNIVERSAL_2) + .help("print or set Coordinated Universal Time (UTC)"), + ) + .arg(Arg::with_name(OPT_FORMAT).multiple(false)) +} + /// Return the appropriate format string for the given settings. fn make_format_string(settings: &Settings) -> &str { match settings.format { diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index 0836aa43d..1092938df 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -258,120 +258,7 @@ fn use_size(free_size: u64, total_size: u64) -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(OPT_ALL) - .short("a") - .long("all") - .help("include dummy file systems"), - ) - .arg( - Arg::with_name(OPT_BLOCKSIZE) - .short("B") - .long("block-size") - .takes_value(true) - .help( - "scale sizes by SIZE before printing them; e.g.\ - '-BM' prints sizes in units of 1,048,576 bytes", - ), - ) - .arg( - Arg::with_name(OPT_DIRECT) - .long("direct") - .help("show statistics for a file instead of mount point"), - ) - .arg( - Arg::with_name(OPT_TOTAL) - .long("total") - .help("produce a grand total"), - ) - .arg( - Arg::with_name(OPT_HUMAN_READABLE) - .short("h") - .long("human-readable") - .conflicts_with(OPT_HUMAN_READABLE_2) - .help("print sizes in human readable format (e.g., 1K 234M 2G)"), - ) - .arg( - Arg::with_name(OPT_HUMAN_READABLE_2) - .short("H") - .long("si") - .conflicts_with(OPT_HUMAN_READABLE) - .help("likewise, but use powers of 1000 not 1024"), - ) - .arg( - Arg::with_name(OPT_INODES) - .short("i") - .long("inodes") - .help("list inode information instead of block usage"), - ) - .arg( - Arg::with_name(OPT_KILO) - .short("k") - .help("like --block-size=1K"), - ) - .arg( - Arg::with_name(OPT_LOCAL) - .short("l") - .long("local") - .help("limit listing to local file systems"), - ) - .arg( - Arg::with_name(OPT_NO_SYNC) - .long("no-sync") - .conflicts_with(OPT_SYNC) - .help("do not invoke sync before getting usage info (default)"), - ) - .arg( - Arg::with_name(OPT_OUTPUT) - .long("output") - .takes_value(true) - .use_delimiter(true) - .help( - "use the output format defined by FIELD_LIST,\ - or print all fields if FIELD_LIST is omitted.", - ), - ) - .arg( - Arg::with_name(OPT_PORTABILITY) - .short("P") - .long("portability") - .help("use the POSIX output format"), - ) - .arg( - Arg::with_name(OPT_SYNC) - .long("sync") - .conflicts_with(OPT_NO_SYNC) - .help("invoke sync before getting usage info"), - ) - .arg( - Arg::with_name(OPT_TYPE) - .short("t") - .long("type") - .takes_value(true) - .use_delimiter(true) - .help("limit listing to file systems of type TYPE"), - ) - .arg( - Arg::with_name(OPT_PRINT_TYPE) - .short("T") - .long("print-type") - .help("print file system type"), - ) - .arg( - Arg::with_name(OPT_EXCLUDE_TYPE) - .short("x") - .long("exclude-type") - .takes_value(true) - .use_delimiter(true) - .help("limit listing to file systems not of type TYPE"), - ) - .arg(Arg::with_name(OPT_PATHS).multiple(true)) - .help("Filesystem(s) to list") - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let paths: Vec = matches .values_of(OPT_PATHS) @@ -511,3 +398,118 @@ pub fn uumain(args: impl uucore::Args) -> i32 { EXIT_OK } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(OPT_ALL) + .short("a") + .long("all") + .help("include dummy file systems"), + ) + .arg( + Arg::with_name(OPT_BLOCKSIZE) + .short("B") + .long("block-size") + .takes_value(true) + .help( + "scale sizes by SIZE before printing them; e.g.\ + '-BM' prints sizes in units of 1,048,576 bytes", + ), + ) + .arg( + Arg::with_name(OPT_DIRECT) + .long("direct") + .help("show statistics for a file instead of mount point"), + ) + .arg( + Arg::with_name(OPT_TOTAL) + .long("total") + .help("produce a grand total"), + ) + .arg( + Arg::with_name(OPT_HUMAN_READABLE) + .short("h") + .long("human-readable") + .conflicts_with(OPT_HUMAN_READABLE_2) + .help("print sizes in human readable format (e.g., 1K 234M 2G)"), + ) + .arg( + Arg::with_name(OPT_HUMAN_READABLE_2) + .short("H") + .long("si") + .conflicts_with(OPT_HUMAN_READABLE) + .help("likewise, but use powers of 1000 not 1024"), + ) + .arg( + Arg::with_name(OPT_INODES) + .short("i") + .long("inodes") + .help("list inode information instead of block usage"), + ) + .arg( + Arg::with_name(OPT_KILO) + .short("k") + .help("like --block-size=1K"), + ) + .arg( + Arg::with_name(OPT_LOCAL) + .short("l") + .long("local") + .help("limit listing to local file systems"), + ) + .arg( + Arg::with_name(OPT_NO_SYNC) + .long("no-sync") + .conflicts_with(OPT_SYNC) + .help("do not invoke sync before getting usage info (default)"), + ) + .arg( + Arg::with_name(OPT_OUTPUT) + .long("output") + .takes_value(true) + .use_delimiter(true) + .help( + "use the output format defined by FIELD_LIST,\ + or print all fields if FIELD_LIST is omitted.", + ), + ) + .arg( + Arg::with_name(OPT_PORTABILITY) + .short("P") + .long("portability") + .help("use the POSIX output format"), + ) + .arg( + Arg::with_name(OPT_SYNC) + .long("sync") + .conflicts_with(OPT_NO_SYNC) + .help("invoke sync before getting usage info"), + ) + .arg( + Arg::with_name(OPT_TYPE) + .short("t") + .long("type") + .takes_value(true) + .use_delimiter(true) + .help("limit listing to file systems of type TYPE"), + ) + .arg( + Arg::with_name(OPT_PRINT_TYPE) + .short("T") + .long("print-type") + .help("print file system type"), + ) + .arg( + Arg::with_name(OPT_EXCLUDE_TYPE) + .short("x") + .long("exclude-type") + .takes_value(true) + .use_delimiter(true) + .help("limit listing to file systems not of type TYPE"), + ) + .arg(Arg::with_name(OPT_PATHS).multiple(true)) + .help("Filesystem(s) to list") +} diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index 3200a331f..70b609e31 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -73,36 +73,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(SUMMARY) - .usage(&usage[..]) - .after_help(LONG_HELP) - .arg( - Arg::with_name(options::BOURNE_SHELL) - .long("sh") - .short("b") - .visible_alias("bourne-shell") - .help("output Bourne shell code to set LS_COLORS") - .display_order(1), - ) - .arg( - Arg::with_name(options::C_SHELL) - .long("csh") - .short("c") - .visible_alias("c-shell") - .help("output C shell code to set LS_COLORS") - .display_order(2), - ) - .arg( - Arg::with_name(options::PRINT_DATABASE) - .long("print-database") - .short("p") - .help("print the byte counts") - .display_order(3), - ) - .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) - .get_matches_from(&args); + let matches = uu_app().usage(&usage[..]).get_matches_from(&args); let files = matches .values_of(options::FILE) @@ -181,6 +152,37 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(SUMMARY) + .after_help(LONG_HELP) + .arg( + Arg::with_name(options::BOURNE_SHELL) + .long("sh") + .short("b") + .visible_alias("bourne-shell") + .help("output Bourne shell code to set LS_COLORS") + .display_order(1), + ) + .arg( + Arg::with_name(options::C_SHELL) + .long("csh") + .short("c") + .visible_alias("c-shell") + .help("output C shell code to set LS_COLORS") + .display_order(2), + ) + .arg( + Arg::with_name(options::PRINT_DATABASE) + .long("print-database") + .short("p") + .help("print the byte counts") + .display_order(3), + ) + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) +} + pub trait StrUtils { /// Remove comments and trim whitespace fn purify(&self) -> &Self; diff --git a/src/uu/dirname/src/dirname.rs b/src/uu/dirname/src/dirname.rs index ad42517d4..356f2e6b1 100644 --- a/src/uu/dirname/src/dirname.rs +++ b/src/uu/dirname/src/dirname.rs @@ -38,18 +38,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let after_help = get_long_usage(); - let matches = App::new(executable!()) - .about(ABOUT) + let matches = uu_app() .usage(&usage[..]) .after_help(&after_help[..]) - .version(crate_version!()) - .arg( - Arg::with_name(options::ZERO) - .long(options::ZERO) - .short("z") - .help("separate output with NUL rather than newline"), - ) - .arg(Arg::with_name(options::DIR).hidden(true).multiple(true)) .get_matches_from(args); let separator = if matches.is_present(options::ZERO) { @@ -92,3 +83,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .about(ABOUT) + .version(crate_version!()) + .arg( + Arg::with_name(options::ZERO) + .long(options::ZERO) + .short("z") + .help("separate output with NUL rather than newline"), + ) + .arg(Arg::with_name(options::DIR).hidden(true).multiple(true)) +} diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 623faf62c..e5f0e6efc 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -387,182 +387,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(SUMMARY) - .usage(&usage[..]) - .after_help(LONG_HELP) - .arg( - Arg::with_name(options::ALL) - .short("a") - .long(options::ALL) - .help("write counts for all files, not just directories"), - ) - .arg( - Arg::with_name(options::APPARENT_SIZE) - .long(options::APPARENT_SIZE) - .help( - "print apparent sizes, rather than disk usage \ - although the apparent size is usually smaller, it may be larger due to holes \ - in ('sparse') files, internal fragmentation, indirect blocks, and the like" - ) - .alias("app") // The GNU test suite uses this alias - ) - .arg( - Arg::with_name(options::BLOCK_SIZE) - .short("B") - .long(options::BLOCK_SIZE) - .value_name("SIZE") - .help( - "scale sizes by SIZE before printing them. \ - E.g., '-BM' prints sizes in units of 1,048,576 bytes. See SIZE format below." - ) - ) - .arg( - Arg::with_name(options::BYTES) - .short("b") - .long("bytes") - .help("equivalent to '--apparent-size --block-size=1'") - ) - .arg( - Arg::with_name(options::TOTAL) - .long("total") - .short("c") - .help("produce a grand total") - ) - .arg( - Arg::with_name(options::MAX_DEPTH) - .short("d") - .long("max-depth") - .value_name("N") - .help( - "print the total for a directory (or file, with --all) \ - only if it is N or fewer levels below the command \ - line argument; --max-depth=0 is the same as --summarize" - ) - ) - .arg( - Arg::with_name(options::HUMAN_READABLE) - .long("human-readable") - .short("h") - .help("print sizes in human readable format (e.g., 1K 234M 2G)") - ) - .arg( - Arg::with_name("inodes") - .long("inodes") - .help( - "list inode usage information instead of block usage like --block-size=1K" - ) - ) - .arg( - Arg::with_name(options::BLOCK_SIZE_1K) - .short("k") - .help("like --block-size=1K") - ) - .arg( - Arg::with_name(options::COUNT_LINKS) - .short("l") - .long("count-links") - .help("count sizes many times if hard linked") - ) - .arg( - Arg::with_name(options::DEREFERENCE) - .short("L") - .long(options::DEREFERENCE) - .help("dereference all symbolic links") - ) - // .arg( - // Arg::with_name("no-dereference") - // .short("P") - // .long("no-dereference") - // .help("don't follow any symbolic links (this is the default)") - // ) - .arg( - Arg::with_name(options::BLOCK_SIZE_1M) - .short("m") - .help("like --block-size=1M") - ) - .arg( - Arg::with_name(options::NULL) - .short("0") - .long("null") - .help("end each output line with 0 byte rather than newline") - ) - .arg( - Arg::with_name(options::SEPARATE_DIRS) - .short("S") - .long("separate-dirs") - .help("do not include size of subdirectories") - ) - .arg( - Arg::with_name(options::SUMMARIZE) - .short("s") - .long("summarize") - .help("display only a total for each argument") - ) - .arg( - Arg::with_name(options::SI) - .long(options::SI) - .help("like -h, but use powers of 1000 not 1024") - ) - .arg( - Arg::with_name(options::ONE_FILE_SYSTEM) - .short("x") - .long(options::ONE_FILE_SYSTEM) - .help("skip directories on different file systems") - ) - .arg( - Arg::with_name(options::THRESHOLD) - .short("t") - .long(options::THRESHOLD) - .alias("th") - .value_name("SIZE") - .number_of_values(1) - .allow_hyphen_values(true) - .help("exclude entries smaller than SIZE if positive, \ - or entries greater than SIZE if negative") - ) - // .arg( - // Arg::with_name("") - // .short("x") - // .long("exclude-from") - // .value_name("FILE") - // .help("exclude files that match any pattern in FILE") - // ) - // .arg( - // Arg::with_name("exclude") - // .long("exclude") - // .value_name("PATTERN") - // .help("exclude files that match PATTERN") - // ) - .arg( - Arg::with_name(options::TIME) - .long(options::TIME) - .value_name("WORD") - .require_equals(true) - .min_values(0) - .possible_values(&["atime", "access", "use", "ctime", "status", "birth", "creation"]) - .help( - "show time of the last modification of any file in the \ - directory, or any of its subdirectories. If WORD is given, show time as WORD instead \ - of modification time: atime, access, use, ctime, status, birth or creation" - ) - ) - .arg( - Arg::with_name(options::TIME_STYLE) - .long(options::TIME_STYLE) - .value_name("STYLE") - .help( - "show times using style STYLE: \ - full-iso, long-iso, iso, +FORMAT FORMAT is interpreted like 'date'" - ) - ) - .arg( - Arg::with_name(options::FILE) - .hidden(true) - .multiple(true) - ) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let summarize = matches.is_present(options::SUMMARIZE); @@ -743,6 +568,183 @@ Try '{} --help' for more information.", 0 } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(SUMMARY) + .after_help(LONG_HELP) + .arg( + Arg::with_name(options::ALL) + .short("a") + .long(options::ALL) + .help("write counts for all files, not just directories"), + ) + .arg( + Arg::with_name(options::APPARENT_SIZE) + .long(options::APPARENT_SIZE) + .help( + "print apparent sizes, rather than disk usage \ + although the apparent size is usually smaller, it may be larger due to holes \ + in ('sparse') files, internal fragmentation, indirect blocks, and the like" + ) + .alias("app") // The GNU test suite uses this alias + ) + .arg( + Arg::with_name(options::BLOCK_SIZE) + .short("B") + .long(options::BLOCK_SIZE) + .value_name("SIZE") + .help( + "scale sizes by SIZE before printing them. \ + E.g., '-BM' prints sizes in units of 1,048,576 bytes. See SIZE format below." + ) + ) + .arg( + Arg::with_name(options::BYTES) + .short("b") + .long("bytes") + .help("equivalent to '--apparent-size --block-size=1'") + ) + .arg( + Arg::with_name(options::TOTAL) + .long("total") + .short("c") + .help("produce a grand total") + ) + .arg( + Arg::with_name(options::MAX_DEPTH) + .short("d") + .long("max-depth") + .value_name("N") + .help( + "print the total for a directory (or file, with --all) \ + only if it is N or fewer levels below the command \ + line argument; --max-depth=0 is the same as --summarize" + ) + ) + .arg( + Arg::with_name(options::HUMAN_READABLE) + .long("human-readable") + .short("h") + .help("print sizes in human readable format (e.g., 1K 234M 2G)") + ) + .arg( + Arg::with_name("inodes") + .long("inodes") + .help( + "list inode usage information instead of block usage like --block-size=1K" + ) + ) + .arg( + Arg::with_name(options::BLOCK_SIZE_1K) + .short("k") + .help("like --block-size=1K") + ) + .arg( + Arg::with_name(options::COUNT_LINKS) + .short("l") + .long("count-links") + .help("count sizes many times if hard linked") + ) + .arg( + Arg::with_name(options::DEREFERENCE) + .short("L") + .long(options::DEREFERENCE) + .help("dereference all symbolic links") + ) + // .arg( + // Arg::with_name("no-dereference") + // .short("P") + // .long("no-dereference") + // .help("don't follow any symbolic links (this is the default)") + // ) + .arg( + Arg::with_name(options::BLOCK_SIZE_1M) + .short("m") + .help("like --block-size=1M") + ) + .arg( + Arg::with_name(options::NULL) + .short("0") + .long("null") + .help("end each output line with 0 byte rather than newline") + ) + .arg( + Arg::with_name(options::SEPARATE_DIRS) + .short("S") + .long("separate-dirs") + .help("do not include size of subdirectories") + ) + .arg( + Arg::with_name(options::SUMMARIZE) + .short("s") + .long("summarize") + .help("display only a total for each argument") + ) + .arg( + Arg::with_name(options::SI) + .long(options::SI) + .help("like -h, but use powers of 1000 not 1024") + ) + .arg( + Arg::with_name(options::ONE_FILE_SYSTEM) + .short("x") + .long(options::ONE_FILE_SYSTEM) + .help("skip directories on different file systems") + ) + .arg( + Arg::with_name(options::THRESHOLD) + .short("t") + .long(options::THRESHOLD) + .alias("th") + .value_name("SIZE") + .number_of_values(1) + .allow_hyphen_values(true) + .help("exclude entries smaller than SIZE if positive, \ + or entries greater than SIZE if negative") + ) + // .arg( + // Arg::with_name("") + // .short("x") + // .long("exclude-from") + // .value_name("FILE") + // .help("exclude files that match any pattern in FILE") + // ) + // .arg( + // Arg::with_name("exclude") + // .long("exclude") + // .value_name("PATTERN") + // .help("exclude files that match PATTERN") + // ) + .arg( + Arg::with_name(options::TIME) + .long(options::TIME) + .value_name("WORD") + .require_equals(true) + .min_values(0) + .possible_values(&["atime", "access", "use", "ctime", "status", "birth", "creation"]) + .help( + "show time of the last modification of any file in the \ + directory, or any of its subdirectories. If WORD is given, show time as WORD instead \ + of modification time: atime, access, use, ctime, status, birth or creation" + ) + ) + .arg( + Arg::with_name(options::TIME_STYLE) + .long(options::TIME_STYLE) + .value_name("STYLE") + .help( + "show times using style STYLE: \ + full-iso, long-iso, iso, +FORMAT FORMAT is interpreted like 'date'" + ) + ) + .arg( + Arg::with_name(options::FILE) + .hidden(true) + .multiple(true) + ) +} + #[derive(Clone, Copy)] enum Threshold { Lower(u64), diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index d83a4fe06..8c976c2b4 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -117,7 +117,26 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let args = args .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); - let matches = App::new(executable!()) + let matches = uu_app().get_matches_from(args); + + let no_newline = matches.is_present(options::NO_NEWLINE); + let escaped = matches.is_present(options::ENABLE_BACKSLASH_ESCAPE); + let values: Vec = match matches.values_of(options::STRING) { + Some(s) => s.map(|s| s.to_string()).collect(), + None => vec!["".to_string()], + }; + + match execute(no_newline, escaped, values) { + Ok(_) => 0, + Err(f) => { + show_error!("{}", f); + 1 + } + } +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .name(NAME) // TrailingVarArg specifies the final positional argument is a VarArg // and it doesn't attempts the parse any further args. @@ -154,22 +173,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .multiple(true) .allow_hyphen_values(true), ) - .get_matches_from(args); - - let no_newline = matches.is_present(options::NO_NEWLINE); - let escaped = matches.is_present(options::ENABLE_BACKSLASH_ESCAPE); - let values: Vec = match matches.values_of(options::STRING) { - Some(s) => s.map(|s| s.to_string()).collect(), - None => vec!["".to_string()], - }; - - match execute(no_newline, escaped, values) { - Ok(_) => 0, - Err(f) => { - show_error!("{}", f); - 1 - } - } } fn execute(no_newline: bool, escaped: bool, free: Vec) -> io::Result<()> { diff --git a/src/uu/env/src/env.rs b/src/uu/env/src/env.rs index 0ea66d7e9..51ff92801 100644 --- a/src/uu/env/src/env.rs +++ b/src/uu/env/src/env.rs @@ -114,7 +114,7 @@ fn build_command<'a, 'b>(args: &'a mut Vec<&'b str>) -> (Cow<'b, str>, &'a [&'b (progname, &args[..]) } -fn create_app() -> App<'static, 'static> { +pub fn uu_app() -> App<'static, 'static> { App::new(crate_name!()) .version(crate_version!()) .author(crate_authors!()) @@ -158,7 +158,7 @@ fn create_app() -> App<'static, 'static> { } fn run_env(args: impl uucore::Args) -> Result<(), i32> { - let app = create_app(); + let app = uu_app(); let matches = app.get_matches_from(args); let ignore_env = matches.is_present("ignore-environment"); diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index d9d669e7c..66c3eb259 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -108,10 +108,16 @@ impl Options { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) + let matches = uu_app().usage(&usage[..]).get_matches_from(args); + + expand(Options::new(&matches)); + 0 +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .version(crate_version!()) .about(ABOUT) - .usage(&usage[..]) .after_help(LONG_HELP) .arg( Arg::with_name(options::INITIAL) @@ -138,10 +144,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .hidden(true) .takes_value(true) ) - .get_matches_from(args); - - expand(Options::new(&matches)); - 0 } fn open(path: String) -> BufReader> { diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index ed992bf71..0906856d1 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/expr.rs" [dependencies] +clap = "2.33.3" libc = "0.2.42" num-bigint = "0.4.0" num-traits = "0.2.14" diff --git a/src/uu/expr/src/expr.rs b/src/uu/expr/src/expr.rs index 8238917f7..92c15565d 100644 --- a/src/uu/expr/src/expr.rs +++ b/src/uu/expr/src/expr.rs @@ -8,13 +8,20 @@ #[macro_use] extern crate uucore; +use clap::{crate_version, App, Arg}; use uucore::InvalidEncodingHandling; mod syntax_tree; mod tokens; -static NAME: &str = "expr"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); +const VERSION: &str = "version"; +const HELP: &str = "help"; + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .arg(Arg::with_name(VERSION).long(VERSION)) + .arg(Arg::with_name(HELP).long(HELP)) +} pub fn uumain(args: impl uucore::Args) -> i32 { let args = args @@ -133,5 +140,5 @@ Environment variables: } fn print_version() { - println!("{} {}", NAME, VERSION); + println!("{} {}", executable!(), crate_version!()); } diff --git a/src/uu/factor/src/cli.rs b/src/uu/factor/src/cli.rs index af5e3cdb0..0f5d21362 100644 --- a/src/uu/factor/src/cli.rs +++ b/src/uu/factor/src/cli.rs @@ -36,11 +36,7 @@ fn print_factors_str(num_str: &str, w: &mut impl io::Write) -> Result<(), Box i32 { - let matches = App::new(executable!()) - .version(crate_version!()) - .about(SUMMARY) - .arg(Arg::with_name(options::NUMBER).multiple(true)) - .get_matches_from(args); + let matches = uu_app().get_matches_from(args); let stdout = stdout(); let mut w = io::BufWriter::new(stdout.lock()); @@ -68,3 +64,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(SUMMARY) + .arg(Arg::with_name(options::NUMBER).multiple(true)) +} diff --git a/src/uu/false/Cargo.toml b/src/uu/false/Cargo.toml index d7cbcd13a..644051d59 100644 --- a/src/uu/false/Cargo.toml +++ b/src/uu/false/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/false.rs" [dependencies] +clap = "2.33.3" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/false/src/false.rs b/src/uu/false/src/false.rs index 917c43fa0..aaeb6b751 100644 --- a/src/uu/false/src/false.rs +++ b/src/uu/false/src/false.rs @@ -5,6 +5,15 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. +use clap::{App, AppSettings}; +use uucore::executable; + pub fn uumain(_: impl uucore::Args) -> i32 { 1 } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .setting(AppSettings::DisableHelpFlags) + .setting(AppSettings::DisableVersion) +} diff --git a/src/uu/fmt/src/fmt.rs b/src/uu/fmt/src/fmt.rs index 91f59e076..9eceaa56c 100644 --- a/src/uu/fmt/src/fmt.rs +++ b/src/uu/fmt/src/fmt.rs @@ -77,129 +77,7 @@ pub struct FmtOptions { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(OPT_CROWN_MARGIN) - .short("c") - .long(OPT_CROWN_MARGIN) - .help( - "First and second line of paragraph - may have different indentations, in which - case the first line's indentation is preserved, - and each subsequent line's indentation matches the second line.", - ), - ) - .arg( - Arg::with_name(OPT_TAGGED_PARAGRAPH) - .short("t") - .long("tagged-paragraph") - .help( - "Like -c, except that the first and second line of a paragraph *must* - have different indentation or they are treated as separate paragraphs.", - ), - ) - .arg( - Arg::with_name(OPT_PRESERVE_HEADERS) - .short("m") - .long("preserve-headers") - .help( - "Attempt to detect and preserve mail headers in the input. - Be careful when combining this flag with -p.", - ), - ) - .arg( - Arg::with_name(OPT_SPLIT_ONLY) - .short("s") - .long("split-only") - .help("Split lines only, do not reflow."), - ) - .arg( - Arg::with_name(OPT_UNIFORM_SPACING) - .short("u") - .long("uniform-spacing") - .help( - "Insert exactly one - space between words, and two between sentences. - Sentence breaks in the input are detected as [?!.] - followed by two spaces or a newline; other punctuation - is not interpreted as a sentence break.", - ), - ) - .arg( - Arg::with_name(OPT_PREFIX) - .short("p") - .long("prefix") - .help( - "Reformat only lines - beginning with PREFIX, reattaching PREFIX to reformatted lines. - Unless -x is specified, leading whitespace will be ignored - when matching PREFIX.", - ) - .value_name("PREFIX"), - ) - .arg( - Arg::with_name(OPT_SKIP_PREFIX) - .short("P") - .long("skip-prefix") - .help( - "Do not reformat lines - beginning with PSKIP. Unless -X is specified, leading whitespace - will be ignored when matching PSKIP", - ) - .value_name("PSKIP"), - ) - .arg( - Arg::with_name(OPT_EXACT_PREFIX) - .short("x") - .long("exact-prefix") - .help( - "PREFIX must match at the - beginning of the line with no preceding whitespace.", - ), - ) - .arg( - Arg::with_name(OPT_EXACT_SKIP_PREFIX) - .short("X") - .long("exact-skip-prefix") - .help( - "PSKIP must match at the - beginning of the line with no preceding whitespace.", - ), - ) - .arg( - Arg::with_name(OPT_WIDTH) - .short("w") - .long("width") - .help("Fill output lines up to a maximum of WIDTH columns, default 79.") - .value_name("WIDTH"), - ) - .arg( - Arg::with_name(OPT_GOAL) - .short("g") - .long("goal") - .help("Goal width, default ~0.94*WIDTH. Must be less than WIDTH.") - .value_name("GOAL"), - ) - .arg(Arg::with_name(OPT_QUICK).short("q").long("quick").help( - "Break lines more quickly at the - expense of a potentially more ragged appearance.", - )) - .arg( - Arg::with_name(OPT_TAB_WIDTH) - .short("T") - .long("tab-width") - .help( - "Treat tabs as TABWIDTH spaces for - determining line length, default 8. Note that this is used only for - calculating line lengths; tabs are preserved in the output.", - ) - .value_name("TABWIDTH"), - ) - .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let mut files: Vec = matches .values_of(ARG_FILES) @@ -331,3 +209,127 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(OPT_CROWN_MARGIN) + .short("c") + .long(OPT_CROWN_MARGIN) + .help( + "First and second line of paragraph + may have different indentations, in which + case the first line's indentation is preserved, + and each subsequent line's indentation matches the second line.", + ), + ) + .arg( + Arg::with_name(OPT_TAGGED_PARAGRAPH) + .short("t") + .long("tagged-paragraph") + .help( + "Like -c, except that the first and second line of a paragraph *must* + have different indentation or they are treated as separate paragraphs.", + ), + ) + .arg( + Arg::with_name(OPT_PRESERVE_HEADERS) + .short("m") + .long("preserve-headers") + .help( + "Attempt to detect and preserve mail headers in the input. + Be careful when combining this flag with -p.", + ), + ) + .arg( + Arg::with_name(OPT_SPLIT_ONLY) + .short("s") + .long("split-only") + .help("Split lines only, do not reflow."), + ) + .arg( + Arg::with_name(OPT_UNIFORM_SPACING) + .short("u") + .long("uniform-spacing") + .help( + "Insert exactly one + space between words, and two between sentences. + Sentence breaks in the input are detected as [?!.] + followed by two spaces or a newline; other punctuation + is not interpreted as a sentence break.", + ), + ) + .arg( + Arg::with_name(OPT_PREFIX) + .short("p") + .long("prefix") + .help( + "Reformat only lines + beginning with PREFIX, reattaching PREFIX to reformatted lines. + Unless -x is specified, leading whitespace will be ignored + when matching PREFIX.", + ) + .value_name("PREFIX"), + ) + .arg( + Arg::with_name(OPT_SKIP_PREFIX) + .short("P") + .long("skip-prefix") + .help( + "Do not reformat lines + beginning with PSKIP. Unless -X is specified, leading whitespace + will be ignored when matching PSKIP", + ) + .value_name("PSKIP"), + ) + .arg( + Arg::with_name(OPT_EXACT_PREFIX) + .short("x") + .long("exact-prefix") + .help( + "PREFIX must match at the + beginning of the line with no preceding whitespace.", + ), + ) + .arg( + Arg::with_name(OPT_EXACT_SKIP_PREFIX) + .short("X") + .long("exact-skip-prefix") + .help( + "PSKIP must match at the + beginning of the line with no preceding whitespace.", + ), + ) + .arg( + Arg::with_name(OPT_WIDTH) + .short("w") + .long("width") + .help("Fill output lines up to a maximum of WIDTH columns, default 79.") + .value_name("WIDTH"), + ) + .arg( + Arg::with_name(OPT_GOAL) + .short("g") + .long("goal") + .help("Goal width, default ~0.94*WIDTH. Must be less than WIDTH.") + .value_name("GOAL"), + ) + .arg(Arg::with_name(OPT_QUICK).short("q").long("quick").help( + "Break lines more quickly at the + expense of a potentially more ragged appearance.", + )) + .arg( + Arg::with_name(OPT_TAB_WIDTH) + .short("T") + .long("tab-width") + .help( + "Treat tabs as TABWIDTH spaces for + determining line length, default 8. Note that this is used only for + calculating line lengths; tabs are preserved in the output.", + ) + .value_name("TABWIDTH"), + ) + .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) +} diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index 118f7f5f9..1dbc8cdc7 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -36,7 +36,35 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .accept_any(); let (args, obs_width) = handle_obsolete(&args[..]); - let matches = App::new(executable!()) + let matches = uu_app().get_matches_from(args); + + let bytes = matches.is_present(options::BYTES); + let spaces = matches.is_present(options::SPACES); + let poss_width = match matches.value_of(options::WIDTH) { + Some(v) => Some(v.to_owned()), + None => obs_width, + }; + + let width = match poss_width { + Some(inp_width) => match inp_width.parse::() { + Ok(width) => width, + Err(e) => crash!(1, "illegal width value (\"{}\"): {}", inp_width, e), + }, + None => 80, + }; + + let files = match matches.values_of(options::FILE) { + Some(v) => v.map(|v| v.to_owned()).collect(), + None => vec!["-".to_owned()], + }; + + fold(files, bytes, spaces, width); + + 0 +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .name(NAME) .version(crate_version!()) .usage(SYNTAX) @@ -68,31 +96,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true), ) .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) - .get_matches_from(args); - - let bytes = matches.is_present(options::BYTES); - let spaces = matches.is_present(options::SPACES); - let poss_width = match matches.value_of(options::WIDTH) { - Some(v) => Some(v.to_owned()), - None => obs_width, - }; - - let width = match poss_width { - Some(inp_width) => match inp_width.parse::() { - Ok(width) => width, - Err(e) => crash!(1, "illegal width value (\"{}\"): {}", inp_width, e), - }, - None => 80, - }; - - let files = match matches.values_of(options::FILE) { - Some(v) => v.map(|v| v.to_owned()).collect(), - None => vec!["-".to_owned()], - }; - - fold(files, bytes, spaces, width); - - 0 } fn handle_obsolete(args: &[String]) -> (Vec, Option) { diff --git a/src/uu/groups/src/groups.rs b/src/uu/groups/src/groups.rs index 6585f3d16..a40d1a490 100644 --- a/src/uu/groups/src/groups.rs +++ b/src/uu/groups/src/groups.rs @@ -35,17 +35,7 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(options::USERS) - .multiple(true) - .takes_value(true) - .value_name(options::USERS), - ) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let users: Vec = matches .values_of(options::USERS) @@ -93,3 +83,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } exit_code } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(options::USERS) + .multiple(true) + .takes_value(true) + .value_name(options::USERS), + ) +} diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index a007473ab..d9feb6648 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -285,119 +285,7 @@ pub fn uumain(mut args: impl uucore::Args) -> i32 { // Default binary in Windows, text mode otherwise let binary_flag_default = cfg!(windows); - let binary_help = format!( - "read in binary mode{}", - if binary_flag_default { - " (default)" - } else { - "" - } - ); - - let text_help = format!( - "read in text mode{}", - if binary_flag_default { - "" - } else { - " (default)" - } - ); - - let mut app = App::new(executable!()) - .version(crate_version!()) - .about("Compute and check message digests.") - .arg( - Arg::with_name("binary") - .short("b") - .long("binary") - .help(&binary_help), - ) - .arg( - Arg::with_name("check") - .short("c") - .long("check") - .help("read hashsums from the FILEs and check them"), - ) - .arg( - Arg::with_name("tag") - .long("tag") - .help("create a BSD-style checksum"), - ) - .arg( - Arg::with_name("text") - .short("t") - .long("text") - .help(&text_help) - .conflicts_with("binary"), - ) - .arg( - Arg::with_name("quiet") - .short("q") - .long("quiet") - .help("don't print OK for each successfully verified file"), - ) - .arg( - Arg::with_name("status") - .short("s") - .long("status") - .help("don't output anything, status code shows success"), - ) - .arg( - Arg::with_name("strict") - .long("strict") - .help("exit non-zero for improperly formatted checksum lines"), - ) - .arg( - Arg::with_name("warn") - .short("w") - .long("warn") - .help("warn about improperly formatted checksum lines"), - ) - // Needed for variable-length output sums (e.g. SHAKE) - .arg( - Arg::with_name("bits") - .long("bits") - .help("set the size of the output (only for SHAKE)") - .takes_value(true) - .value_name("BITS") - // XXX: should we actually use validators? they're not particularly efficient - .validator(is_valid_bit_num), - ) - .arg( - Arg::with_name("FILE") - .index(1) - .multiple(true) - .value_name("FILE"), - ); - - if !is_custom_binary(&binary_name) { - let algorithms = &[ - ("md5", "work with MD5"), - ("sha1", "work with SHA1"), - ("sha224", "work with SHA224"), - ("sha256", "work with SHA256"), - ("sha384", "work with SHA384"), - ("sha512", "work with SHA512"), - ("sha3", "work with SHA3"), - ("sha3-224", "work with SHA3-224"), - ("sha3-256", "work with SHA3-256"), - ("sha3-384", "work with SHA3-384"), - ("sha3-512", "work with SHA3-512"), - ( - "shake128", - "work with SHAKE128 using BITS for the output size", - ), - ( - "shake256", - "work with SHAKE256 using BITS for the output size", - ), - ("b2sum", "work with BLAKE2"), - ]; - - for (name, desc) in algorithms { - app = app.arg(Arg::with_name(name).long(name).help(desc)); - } - } + let app = uu_app(&binary_name); // FIXME: this should use get_matches_from_safe() and crash!(), but at the moment that just // causes "error: " to be printed twice (once from crash!() and once from clap). With @@ -445,6 +333,124 @@ pub fn uumain(mut args: impl uucore::Args) -> i32 { } } +pub fn uu_app_common() -> App<'static, 'static> { + #[cfg(windows)] + const BINARY_HELP: &str = "read in binary mode (default)"; + #[cfg(not(windows))] + const BINARY_HELP: &str = "read in binary mode"; + #[cfg(windows)] + const TEXT_HELP: &str = "read in text mode"; + #[cfg(not(windows))] + const TEXT_HELP: &str = "read in text mode (default)"; + App::new(executable!()) + .version(crate_version!()) + .about("Compute and check message digests.") + .arg( + Arg::with_name("binary") + .short("b") + .long("binary") + .help(BINARY_HELP), + ) + .arg( + Arg::with_name("check") + .short("c") + .long("check") + .help("read hashsums from the FILEs and check them"), + ) + .arg( + Arg::with_name("tag") + .long("tag") + .help("create a BSD-style checksum"), + ) + .arg( + Arg::with_name("text") + .short("t") + .long("text") + .help(TEXT_HELP) + .conflicts_with("binary"), + ) + .arg( + Arg::with_name("quiet") + .short("q") + .long("quiet") + .help("don't print OK for each successfully verified file"), + ) + .arg( + Arg::with_name("status") + .short("s") + .long("status") + .help("don't output anything, status code shows success"), + ) + .arg( + Arg::with_name("strict") + .long("strict") + .help("exit non-zero for improperly formatted checksum lines"), + ) + .arg( + Arg::with_name("warn") + .short("w") + .long("warn") + .help("warn about improperly formatted checksum lines"), + ) + // Needed for variable-length output sums (e.g. SHAKE) + .arg( + Arg::with_name("bits") + .long("bits") + .help("set the size of the output (only for SHAKE)") + .takes_value(true) + .value_name("BITS") + // XXX: should we actually use validators? they're not particularly efficient + .validator(is_valid_bit_num), + ) + .arg( + Arg::with_name("FILE") + .index(1) + .multiple(true) + .value_name("FILE"), + ) +} + +pub fn uu_app_custom() -> App<'static, 'static> { + let mut app = uu_app_common(); + let algorithms = &[ + ("md5", "work with MD5"), + ("sha1", "work with SHA1"), + ("sha224", "work with SHA224"), + ("sha256", "work with SHA256"), + ("sha384", "work with SHA384"), + ("sha512", "work with SHA512"), + ("sha3", "work with SHA3"), + ("sha3-224", "work with SHA3-224"), + ("sha3-256", "work with SHA3-256"), + ("sha3-384", "work with SHA3-384"), + ("sha3-512", "work with SHA3-512"), + ( + "shake128", + "work with SHAKE128 using BITS for the output size", + ), + ( + "shake256", + "work with SHAKE256 using BITS for the output size", + ), + ("b2sum", "work with BLAKE2"), + ]; + + for (name, desc) in algorithms { + app = app.arg(Arg::with_name(name).long(name).help(desc)); + } + app +} + +// hashsum is handled differently in build.rs, therefore this is not the same +// as in other utilities. +fn uu_app(binary_name: &str) -> App<'static, 'static> { + if !is_custom_binary(binary_name) { + uu_app_custom() + } else { + uu_app_common() + } +} + #[allow(clippy::cognitive_complexity)] fn hashsum<'a, I>(mut options: Options, files: I) -> Result<(), i32> where diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index aceecd941..e17e17034 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -40,7 +40,7 @@ mod take; use lines::zlines; use take::take_all_but; -fn app<'a>() -> App<'a, 'a> { +pub fn uu_app() -> App<'static, 'static> { App::new(executable!()) .version(crate_version!()) .about(ABOUT) @@ -167,7 +167,7 @@ impl HeadOptions { ///Construct options from matches pub fn get_from(args: impl uucore::Args) -> Result { - let matches = app().get_matches_from(arg_iterate(args)?); + let matches = uu_app().get_matches_from(arg_iterate(args)?); let mut options = HeadOptions::new(); diff --git a/src/uu/hostid/Cargo.toml b/src/uu/hostid/Cargo.toml index ab6954104..ab8b43f05 100644 --- a/src/uu/hostid/Cargo.toml +++ b/src/uu/hostid/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/hostid.rs" [dependencies] +clap = "2.33.3" libc = "0.2.42" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/hostid/src/hostid.rs b/src/uu/hostid/src/hostid.rs index 551866521..e9fc08379 100644 --- a/src/uu/hostid/src/hostid.rs +++ b/src/uu/hostid/src/hostid.rs @@ -10,12 +10,10 @@ #[macro_use] extern crate uucore; +use clap::{crate_version, App}; use libc::c_long; -use uucore::InvalidEncodingHandling; static SYNTAX: &str = "[options]"; -static SUMMARY: &str = ""; -static LONG_HELP: &str = ""; // currently rust libc interface doesn't include gethostid extern "C" { @@ -23,14 +21,17 @@ extern "C" { } pub fn uumain(args: impl uucore::Args) -> i32 { - app!(SYNTAX, SUMMARY, LONG_HELP).parse( - args.collect_str(InvalidEncodingHandling::ConvertLossy) - .accept_any(), - ); + uu_app().get_matches_from(args); hostid(); 0 } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .usage(SYNTAX) +} + fn hostid() { /* * POSIX says gethostid returns a "32-bit identifier" but is silent diff --git a/src/uu/hostname/src/hostname.rs b/src/uu/hostname/src/hostname.rs index ff312fb58..fe477d7b5 100644 --- a/src/uu/hostname/src/hostname.rs +++ b/src/uu/hostname/src/hostname.rs @@ -52,10 +52,25 @@ fn get_usage() -> String { } fn execute(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) + let matches = uu_app().usage(&usage[..]).get_matches_from(args); + + match matches.value_of(OPT_HOST) { + None => display_hostname(&matches), + Some(host) => { + if let Err(err) = hostname::set(host) { + show_error!("{}", err); + 1 + } else { + 0 + } + } + } +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .version(crate_version!()) .about(ABOUT) - .usage(&usage[..]) .arg( Arg::with_name(OPT_DOMAIN) .short("d") @@ -80,19 +95,6 @@ fn execute(args: impl uucore::Args) -> i32 { possible", )) .arg(Arg::with_name(OPT_HOST)) - .get_matches_from(args); - - match matches.value_of(OPT_HOST) { - None => display_hostname(&matches), - Some(host) => { - if let Err(err) = hostname::set(host) { - show_error!("{}", err); - 1 - } else { - 0 - } - } - } } fn display_hostname(matches: &ArgMatches) -> i32 { diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index e6233f0b7..d5acc97f3 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -115,106 +115,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let after_help = get_description(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) + let matches = uu_app() .usage(&usage[..]) .after_help(&after_help[..]) - .arg( - Arg::with_name(options::OPT_AUDIT) - .short("A") - .conflicts_with_all(&[ - options::OPT_GROUP, - options::OPT_EFFECTIVE_USER, - options::OPT_HUMAN_READABLE, - options::OPT_PASSWORD, - options::OPT_GROUPS, - options::OPT_ZERO, - ]) - .help( - "Display the process audit user ID and other process audit properties,\n\ - which requires privilege (not available on Linux).", - ), - ) - .arg( - Arg::with_name(options::OPT_EFFECTIVE_USER) - .short("u") - .long(options::OPT_EFFECTIVE_USER) - .conflicts_with(options::OPT_GROUP) - .help("Display only the effective user ID as a number."), - ) - .arg( - Arg::with_name(options::OPT_GROUP) - .short("g") - .long(options::OPT_GROUP) - .help("Display only the effective group ID as a number"), - ) - .arg( - Arg::with_name(options::OPT_GROUPS) - .short("G") - .long(options::OPT_GROUPS) - .conflicts_with_all(&[ - options::OPT_GROUP, - options::OPT_EFFECTIVE_USER, - options::OPT_HUMAN_READABLE, - options::OPT_PASSWORD, - options::OPT_AUDIT, - ]) - .help( - "Display only the different group IDs as white-space separated numbers, \ - in no particular order.", - ), - ) - .arg( - Arg::with_name(options::OPT_HUMAN_READABLE) - .short("p") - .help("Make the output human-readable. Each display is on a separate line."), - ) - .arg( - Arg::with_name(options::OPT_NAME) - .short("n") - .long(options::OPT_NAME) - .help( - "Display the name of the user or group ID for the -G, -g and -u options \ - instead of the number.\nIf any of the ID numbers cannot be mapped into \ - names, the number will be displayed as usual.", - ), - ) - .arg( - Arg::with_name(options::OPT_PASSWORD) - .short("P") - .help("Display the id as a password file entry."), - ) - .arg( - Arg::with_name(options::OPT_REAL_ID) - .short("r") - .long(options::OPT_REAL_ID) - .help( - "Display the real ID for the -G, -g and -u options instead of \ - the effective ID.", - ), - ) - .arg( - Arg::with_name(options::OPT_ZERO) - .short("z") - .long(options::OPT_ZERO) - .help( - "delimit entries with NUL characters, not whitespace;\n\ - not permitted in default format", - ), - ) - .arg( - Arg::with_name(options::OPT_CONTEXT) - .short("Z") - .long(options::OPT_CONTEXT) - .help("NotImplemented: print only the security context of the process"), - ) - .arg( - Arg::with_name(options::ARG_USERS) - .multiple(true) - .takes_value(true) - .value_name(options::ARG_USERS), - ) .get_matches_from(args); let users: Vec = matches @@ -385,6 +288,107 @@ pub fn uumain(args: impl uucore::Args) -> i32 { exit_code } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(options::OPT_AUDIT) + .short("A") + .conflicts_with_all(&[ + options::OPT_GROUP, + options::OPT_EFFECTIVE_USER, + options::OPT_HUMAN_READABLE, + options::OPT_PASSWORD, + options::OPT_GROUPS, + options::OPT_ZERO, + ]) + .help( + "Display the process audit user ID and other process audit properties,\n\ + which requires privilege (not available on Linux).", + ), + ) + .arg( + Arg::with_name(options::OPT_EFFECTIVE_USER) + .short("u") + .long(options::OPT_EFFECTIVE_USER) + .conflicts_with(options::OPT_GROUP) + .help("Display only the effective user ID as a number."), + ) + .arg( + Arg::with_name(options::OPT_GROUP) + .short("g") + .long(options::OPT_GROUP) + .help("Display only the effective group ID as a number"), + ) + .arg( + Arg::with_name(options::OPT_GROUPS) + .short("G") + .long(options::OPT_GROUPS) + .conflicts_with_all(&[ + options::OPT_GROUP, + options::OPT_EFFECTIVE_USER, + options::OPT_HUMAN_READABLE, + options::OPT_PASSWORD, + options::OPT_AUDIT, + ]) + .help( + "Display only the different group IDs as white-space separated numbers, \ + in no particular order.", + ), + ) + .arg( + Arg::with_name(options::OPT_HUMAN_READABLE) + .short("p") + .help("Make the output human-readable. Each display is on a separate line."), + ) + .arg( + Arg::with_name(options::OPT_NAME) + .short("n") + .long(options::OPT_NAME) + .help( + "Display the name of the user or group ID for the -G, -g and -u options \ + instead of the number.\nIf any of the ID numbers cannot be mapped into \ + names, the number will be displayed as usual.", + ), + ) + .arg( + Arg::with_name(options::OPT_PASSWORD) + .short("P") + .help("Display the id as a password file entry."), + ) + .arg( + Arg::with_name(options::OPT_REAL_ID) + .short("r") + .long(options::OPT_REAL_ID) + .help( + "Display the real ID for the -G, -g and -u options instead of \ + the effective ID.", + ), + ) + .arg( + Arg::with_name(options::OPT_ZERO) + .short("z") + .long(options::OPT_ZERO) + .help( + "delimit entries with NUL characters, not whitespace;\n\ + not permitted in default format", + ), + ) + .arg( + Arg::with_name(options::OPT_CONTEXT) + .short("Z") + .long(options::OPT_CONTEXT) + .help("NotImplemented: print only the security context of the process"), + ) + .arg( + Arg::with_name(options::ARG_USERS) + .multiple(true) + .takes_value(true) + .value_name(options::ARG_USERS), + ) +} + fn pretty(possible_pw: Option) { if let Some(p) = possible_pw { print!("uid\t{}\ngroups\t", p.name()); diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 3992ac25e..e45797750 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -98,10 +98,35 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) + let matches = uu_app().usage(&usage[..]).get_matches_from(args); + + let paths: Vec = matches + .values_of(ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + + if let Err(s) = check_unimplemented(&matches) { + show_error!("Unimplemented feature: {}", s); + return 2; + } + + let behavior = match behavior(&matches) { + Ok(x) => x, + Err(ret) => { + return ret; + } + }; + + match behavior.main_function { + MainFunction::Directory => directory(paths, behavior), + MainFunction::Standard => standard(paths, behavior), + } +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .version(crate_version!()) .about(ABOUT) - .usage(&usage[..]) .arg( Arg::with_name(OPT_BACKUP) .long(OPT_BACKUP) @@ -228,29 +253,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .value_name("CONTEXT") ) .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true).min_values(1)) - .get_matches_from(args); - - let paths: Vec = matches - .values_of(ARG_FILES) - .map(|v| v.map(ToString::to_string).collect()) - .unwrap_or_default(); - - if let Err(s) = check_unimplemented(&matches) { - show_error!("Unimplemented feature: {}", s); - return 2; - } - - let behavior = match behavior(&matches) { - Ok(x) => x, - Err(ret) => { - return ret; - } - }; - - match behavior.main_function { - MainFunction::Directory => directory(paths, behavior), - MainFunction::Standard => standard(paths, behavior), - } } /// Check for unimplemented command line arguments. diff --git a/src/uu/join/src/join.rs b/src/uu/join/src/join.rs index 4cdfe2141..60721f212 100644 --- a/src/uu/join/src/join.rs +++ b/src/uu/join/src/join.rs @@ -442,7 +442,72 @@ impl<'a> State<'a> { } pub fn uumain(args: impl uucore::Args) -> i32 { - let matches = App::new(NAME) + let matches = uu_app().get_matches_from(args); + + let keys = parse_field_number_option(matches.value_of("j")); + let key1 = parse_field_number_option(matches.value_of("1")); + let key2 = parse_field_number_option(matches.value_of("2")); + + let mut settings: Settings = Default::default(); + + if let Some(value) = matches.value_of("v") { + settings.print_unpaired = parse_file_number(value); + settings.print_joined = false; + } else if let Some(value) = matches.value_of("a") { + settings.print_unpaired = parse_file_number(value); + } + + settings.ignore_case = matches.is_present("i"); + settings.key1 = get_field_number(keys, key1); + settings.key2 = get_field_number(keys, key2); + + if let Some(value) = matches.value_of("t") { + settings.separator = match value.len() { + 0 => Sep::Line, + 1 => Sep::Char(value.chars().next().unwrap()), + _ => crash!(1, "multi-character tab {}", value), + }; + } + + if let Some(format) = matches.value_of("o") { + if format == "auto" { + settings.autoformat = true; + } else { + settings.format = format + .split(|c| c == ' ' || c == ',' || c == '\t') + .map(Spec::parse) + .collect(); + } + } + + if let Some(empty) = matches.value_of("e") { + settings.empty = empty.to_string(); + } + + if matches.is_present("nocheck-order") { + settings.check_order = CheckOrder::Disabled; + } + + if matches.is_present("check-order") { + settings.check_order = CheckOrder::Enabled; + } + + if matches.is_present("header") { + settings.headers = true; + } + + let file1 = matches.value_of("file1").unwrap(); + let file2 = matches.value_of("file2").unwrap(); + + if file1 == "-" && file2 == "-" { + crash!(1, "both files cannot be standard input"); + } + + exec(file1, file2, &settings) +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(NAME) .version(crate_version!()) .about( "For each pair of input lines with identical join fields, write a line to @@ -542,68 +607,6 @@ FILENUM is 1 or 2, corresponding to FILE1 or FILE2", .value_name("FILE2") .hidden(true), ) - .get_matches_from(args); - - let keys = parse_field_number_option(matches.value_of("j")); - let key1 = parse_field_number_option(matches.value_of("1")); - let key2 = parse_field_number_option(matches.value_of("2")); - - let mut settings: Settings = Default::default(); - - if let Some(value) = matches.value_of("v") { - settings.print_unpaired = parse_file_number(value); - settings.print_joined = false; - } else if let Some(value) = matches.value_of("a") { - settings.print_unpaired = parse_file_number(value); - } - - settings.ignore_case = matches.is_present("i"); - settings.key1 = get_field_number(keys, key1); - settings.key2 = get_field_number(keys, key2); - - if let Some(value) = matches.value_of("t") { - settings.separator = match value.len() { - 0 => Sep::Line, - 1 => Sep::Char(value.chars().next().unwrap()), - _ => crash!(1, "multi-character tab {}", value), - }; - } - - if let Some(format) = matches.value_of("o") { - if format == "auto" { - settings.autoformat = true; - } else { - settings.format = format - .split(|c| c == ' ' || c == ',' || c == '\t') - .map(Spec::parse) - .collect(); - } - } - - if let Some(empty) = matches.value_of("e") { - settings.empty = empty.to_string(); - } - - if matches.is_present("nocheck-order") { - settings.check_order = CheckOrder::Disabled; - } - - if matches.is_present("check-order") { - settings.check_order = CheckOrder::Enabled; - } - - if matches.is_present("header") { - settings.headers = true; - } - - let file1 = matches.value_of("file1").unwrap(); - let file2 = matches.value_of("file2").unwrap(); - - if file1 == "-" && file2 == "-" { - crash!(1, "both files cannot be standard input"); - } - - exec(file1, file2, &settings) } fn exec(file1: &str, file2: &str, settings: &Settings) -> i32 { diff --git a/src/uu/kill/src/kill.rs b/src/uu/kill/src/kill.rs index c48864564..92868efdb 100644 --- a/src/uu/kill/src/kill.rs +++ b/src/uu/kill/src/kill.rs @@ -43,38 +43,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let (args, obs_signal) = handle_obsolete(args); let usage = format!("{} [OPTIONS]... PID...", executable!()); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(options::LIST) - .short("l") - .long(options::LIST) - .help("Lists signals") - .conflicts_with(options::TABLE) - .conflicts_with(options::TABLE_OLD), - ) - .arg( - Arg::with_name(options::TABLE) - .short("t") - .long(options::TABLE) - .help("Lists table of signals"), - ) - .arg(Arg::with_name(options::TABLE_OLD).short("L").hidden(true)) - .arg( - Arg::with_name(options::SIGNAL) - .short("s") - .long(options::SIGNAL) - .help("Sends given signal") - .takes_value(true), - ) - .arg( - Arg::with_name(options::PIDS_OR_SIGNALS) - .hidden(true) - .multiple(true), - ) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let mode = if matches.is_present(options::TABLE) || matches.is_present(options::TABLE_OLD) { Mode::Table @@ -106,6 +75,39 @@ pub fn uumain(args: impl uucore::Args) -> i32 { EXIT_OK } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(options::LIST) + .short("l") + .long(options::LIST) + .help("Lists signals") + .conflicts_with(options::TABLE) + .conflicts_with(options::TABLE_OLD), + ) + .arg( + Arg::with_name(options::TABLE) + .short("t") + .long(options::TABLE) + .help("Lists table of signals"), + ) + .arg(Arg::with_name(options::TABLE_OLD).short("L").hidden(true)) + .arg( + Arg::with_name(options::SIGNAL) + .short("s") + .long(options::SIGNAL) + .help("Sends given signal") + .takes_value(true), + ) + .arg( + Arg::with_name(options::PIDS_OR_SIGNALS) + .hidden(true) + .multiple(true), + ) +} + fn handle_obsolete(mut args: Vec) -> (Vec, Option) { let mut i = 0; while i < args.len() { diff --git a/src/uu/link/src/link.rs b/src/uu/link/src/link.rs index 08401ebaf..ad7702044 100644 --- a/src/uu/link/src/link.rs +++ b/src/uu/link/src/link.rs @@ -32,19 +32,7 @@ pub fn normalize_error_message(e: Error) -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(options::FILES) - .hidden(true) - .required(true) - .min_values(2) - .max_values(2) - .takes_value(true), - ) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let files: Vec<_> = matches .values_of_os(options::FILES) @@ -61,3 +49,17 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(options::FILES) + .hidden(true) + .required(true) + .min_values(2) + .max_values(2) + .takes_value(true), + ) +} diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index 29cab58e5..b08eba97a 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -97,11 +97,71 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let long_usage = get_long_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) + let matches = uu_app() .usage(&usage[..]) .after_help(&long_usage[..]) + .get_matches_from(args); + + /* the list of files */ + + let paths: Vec = matches + .values_of(ARG_FILES) + .unwrap() + .map(PathBuf::from) + .collect(); + + let overwrite_mode = if matches.is_present(options::FORCE) { + OverwriteMode::Force + } else if matches.is_present(options::INTERACTIVE) { + OverwriteMode::Interactive + } else { + OverwriteMode::NoClobber + }; + + let backup_mode = if matches.is_present(options::B) { + BackupMode::ExistingBackup + } else if matches.is_present(options::BACKUP) { + match matches.value_of(options::BACKUP) { + None => BackupMode::ExistingBackup, + Some(mode) => match mode { + "simple" | "never" => BackupMode::SimpleBackup, + "numbered" | "t" => BackupMode::NumberedBackup, + "existing" | "nil" => BackupMode::ExistingBackup, + "none" | "off" => BackupMode::NoBackup, + _ => panic!(), // cannot happen as it is managed by clap + }, + } + } else { + BackupMode::NoBackup + }; + + let backup_suffix = if matches.is_present(options::SUFFIX) { + matches.value_of(options::SUFFIX).unwrap() + } else { + "~" + }; + + let settings = Settings { + overwrite: overwrite_mode, + backup: backup_mode, + suffix: backup_suffix.to_string(), + symbolic: matches.is_present(options::SYMBOLIC), + relative: matches.is_present(options::RELATIVE), + target_dir: matches + .value_of(options::TARGET_DIRECTORY) + .map(String::from), + no_target_dir: matches.is_present(options::NO_TARGET_DIRECTORY), + no_dereference: matches.is_present(options::NO_DEREFERENCE), + verbose: matches.is_present(options::VERBOSE), + }; + + exec(&paths[..], &settings) +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) .arg(Arg::with_name(options::B).short(options::B).help( "make a backup of each file that would otherwise be overwritten or \ removed", @@ -198,62 +258,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .required(true) .min_values(1), ) - .get_matches_from(args); - - /* the list of files */ - - let paths: Vec = matches - .values_of(ARG_FILES) - .unwrap() - .map(PathBuf::from) - .collect(); - - let overwrite_mode = if matches.is_present(options::FORCE) { - OverwriteMode::Force - } else if matches.is_present(options::INTERACTIVE) { - OverwriteMode::Interactive - } else { - OverwriteMode::NoClobber - }; - - let backup_mode = if matches.is_present(options::B) { - BackupMode::ExistingBackup - } else if matches.is_present(options::BACKUP) { - match matches.value_of(options::BACKUP) { - None => BackupMode::ExistingBackup, - Some(mode) => match mode { - "simple" | "never" => BackupMode::SimpleBackup, - "numbered" | "t" => BackupMode::NumberedBackup, - "existing" | "nil" => BackupMode::ExistingBackup, - "none" | "off" => BackupMode::NoBackup, - _ => panic!(), // cannot happen as it is managed by clap - }, - } - } else { - BackupMode::NoBackup - }; - - let backup_suffix = if matches.is_present(options::SUFFIX) { - matches.value_of(options::SUFFIX).unwrap() - } else { - "~" - }; - - let settings = Settings { - overwrite: overwrite_mode, - backup: backup_mode, - suffix: backup_suffix.to_string(), - symbolic: matches.is_present(options::SYMBOLIC), - relative: matches.is_present(options::RELATIVE), - target_dir: matches - .value_of(options::TARGET_DIRECTORY) - .map(String::from), - no_target_dir: matches.is_present(options::NO_TARGET_DIRECTORY), - no_dereference: matches.is_present(options::NO_DEREFERENCE), - verbose: matches.is_present(options::VERBOSE), - }; - - exec(&paths[..], &settings) } fn exec(files: &[PathBuf], settings: &Settings) -> i32 { diff --git a/src/uu/logname/src/logname.rs b/src/uu/logname/src/logname.rs index ba5880403..4a6f43418 100644 --- a/src/uu/logname/src/logname.rs +++ b/src/uu/logname/src/logname.rs @@ -45,11 +45,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .accept_any(); let usage = get_usage(); - let _ = App::new(executable!()) - .version(crate_version!()) - .about(SUMMARY) - .usage(&usage[..]) - .get_matches_from(args); + let _ = uu_app().usage(&usage[..]).get_matches_from(args); match get_userlogin() { Some(userlogin) => println!("{}", userlogin), @@ -58,3 +54,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(SUMMARY) +} diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 01bc27055..6ca3f4bbe 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -558,10 +558,22 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let app = App::new(executable!()) + let app = uu_app().usage(&usage[..]); + + let matches = app.get_matches_from(args); + + let locs = matches + .values_of(options::PATHS) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_else(|| vec![String::from(".")]); + + list(locs, Config::from(matches)) +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .version(crate_version!()) .about(ABOUT) - .usage(&usage[..]) // Format arguments .arg( @@ -1095,16 +1107,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // Positional arguments .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)) - .after_help(AFTER_HELP); - - let matches = app.get_matches_from(args); - - let locs = matches - .values_of(options::PATHS) - .map(|v| v.map(ToString::to_string).collect()) - .unwrap_or_else(|| vec![String::from(".")]); - - list(locs, Config::from(matches)) + .after_help(AFTER_HELP) } /// Represents a Path along with it's associated data diff --git a/src/uu/mkdir/src/mkdir.rs b/src/uu/mkdir/src/mkdir.rs index c5ff8b76c..82d561213 100644 --- a/src/uu/mkdir/src/mkdir.rs +++ b/src/uu/mkdir/src/mkdir.rs @@ -32,10 +32,37 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // Linux-specific options, not implemented // opts.optflag("Z", "context", "set SELinux security context" + // " of each created directory to CTX"), - let matches = App::new(executable!()) + let matches = uu_app().usage(&usage[..]).get_matches_from(args); + + let dirs: Vec = matches + .values_of(ARG_DIRS) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + + let verbose = matches.is_present(OPT_VERBOSE); + let recursive = matches.is_present(OPT_PARENTS); + + // Translate a ~str in octal form to u16, default to 755 + // Not tested on Windows + let mode_match = matches.value_of(OPT_MODE); + let mode: u16 = match mode_match { + Some(m) => { + let res: Option = u16::from_str_radix(m, 8).ok(); + match res { + Some(r) => r, + _ => crash!(1, "no mode given"), + } + } + _ => 0o755_u16, + }; + + exec(dirs, recursive, mode, verbose) +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .version(crate_version!()) .about(ABOUT) - .usage(&usage[..]) .arg( Arg::with_name(OPT_MODE) .short("m") @@ -62,31 +89,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .min_values(1), ) - .get_matches_from(args); - - let dirs: Vec = matches - .values_of(ARG_DIRS) - .map(|v| v.map(ToString::to_string).collect()) - .unwrap_or_default(); - - let verbose = matches.is_present(OPT_VERBOSE); - let recursive = matches.is_present(OPT_PARENTS); - - // Translate a ~str in octal form to u16, default to 755 - // Not tested on Windows - let mode_match = matches.value_of(OPT_MODE); - let mode: u16 = match mode_match { - Some(m) => { - let res: Option = u16::from_str_radix(m, 8).ok(); - match res { - Some(r) => r, - _ => crash!(1, "no mode given"), - } - } - _ => 0o755_u16, - }; - - exec(dirs, recursive, mode, verbose) } /** diff --git a/src/uu/mkfifo/src/mkfifo.rs b/src/uu/mkfifo/src/mkfifo.rs index b8a6bbe38..ad12e230d 100644 --- a/src/uu/mkfifo/src/mkfifo.rs +++ b/src/uu/mkfifo/src/mkfifo.rs @@ -29,27 +29,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .collect_str(InvalidEncodingHandling::Ignore) .accept_any(); - let matches = App::new(executable!()) - .name(NAME) - .version(crate_version!()) - .usage(USAGE) - .about(SUMMARY) - .arg( - Arg::with_name(options::MODE) - .short("m") - .long(options::MODE) - .help("file permissions for the fifo") - .default_value("0666") - .value_name("0666"), - ) - .arg( - Arg::with_name(options::SE_LINUX_SECURITY_CONTEXT) - .short(options::SE_LINUX_SECURITY_CONTEXT) - .help("set the SELinux security context to default type") - ) - .arg(Arg::with_name(options::CONTEXT).long(options::CONTEXT).value_name("CTX").help("like -Z, or if CTX is specified then set the SELinux\nor SMACK security context to CTX")) - .arg(Arg::with_name(options::FIFO).hidden(true).multiple(true)) - .get_matches_from(args); + let matches = uu_app().get_matches_from(args); if matches.is_present(options::CONTEXT) { crash!(1, "--context is not implemented"); @@ -88,3 +68,26 @@ pub fn uumain(args: impl uucore::Args) -> i32 { exit_code } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .name(NAME) + .version(crate_version!()) + .usage(USAGE) + .about(SUMMARY) + .arg( + Arg::with_name(options::MODE) + .short("m") + .long(options::MODE) + .help("file permissions for the fifo") + .default_value("0666") + .value_name("0666"), + ) + .arg( + Arg::with_name(options::SE_LINUX_SECURITY_CONTEXT) + .short(options::SE_LINUX_SECURITY_CONTEXT) + .help("set the SELinux security context to default type") + ) + .arg(Arg::with_name(options::CONTEXT).long(options::CONTEXT).value_name("CTX").help("like -Z, or if CTX is specified then set the SELinux\nor SMACK security context to CTX")) + .arg(Arg::with_name(options::FIFO).hidden(true).multiple(true)) +} diff --git a/src/uu/mknod/src/mknod.rs b/src/uu/mknod/src/mknod.rs index a1f361e55..8cc7db908 100644 --- a/src/uu/mknod/src/mknod.rs +++ b/src/uu/mknod/src/mknod.rs @@ -89,48 +89,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // opts.optflag("Z", "", "set the SELinux security context to default type"); // opts.optopt("", "context", "like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX"); - let matches = App::new(executable!()) - .version(crate_version!()) - .usage(USAGE) - .after_help(LONG_HELP) - .about(ABOUT) - .arg( - Arg::with_name("mode") - .short("m") - .long("mode") - .value_name("MODE") - .help("set file permission bits to MODE, not a=rw - umask"), - ) - .arg( - Arg::with_name("name") - .value_name("NAME") - .help("name of the new file") - .required(true) - .index(1), - ) - .arg( - Arg::with_name("type") - .value_name("TYPE") - .help("type of the new file (b, c, u or p)") - .required(true) - .validator(valid_type) - .index(2), - ) - .arg( - Arg::with_name("major") - .value_name("MAJOR") - .help("major file type") - .validator(valid_u64) - .index(3), - ) - .arg( - Arg::with_name("minor") - .value_name("MINOR") - .help("minor file type") - .validator(valid_u64) - .index(4), - ) - .get_matches_from(args); + let matches = uu_app().get_matches_from(args); let mode = match get_mode(&matches) { Ok(mode) => mode, @@ -185,6 +144,50 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .usage(USAGE) + .after_help(LONG_HELP) + .about(ABOUT) + .arg( + Arg::with_name("mode") + .short("m") + .long("mode") + .value_name("MODE") + .help("set file permission bits to MODE, not a=rw - umask"), + ) + .arg( + Arg::with_name("name") + .value_name("NAME") + .help("name of the new file") + .required(true) + .index(1), + ) + .arg( + Arg::with_name("type") + .value_name("TYPE") + .help("type of the new file (b, c, u or p)") + .required(true) + .validator(valid_type) + .index(2), + ) + .arg( + Arg::with_name("major") + .value_name("MAJOR") + .help("major file type") + .validator(valid_u64) + .index(3), + ) + .arg( + Arg::with_name("minor") + .value_name("MINOR") + .help("minor file type") + .validator(valid_u64) + .index(4), + ) +} + fn get_mode(matches: &ArgMatches) -> Result { match matches.value_of("mode") { None => Ok(MODE_RW_UGO), diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index a052766e8..bbccf6628 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -40,61 +40,7 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(OPT_DIRECTORY) - .short("d") - .long(OPT_DIRECTORY) - .help("Make a directory instead of a file"), - ) - .arg( - Arg::with_name(OPT_DRY_RUN) - .short("u") - .long(OPT_DRY_RUN) - .help("do not create anything; merely print a name (unsafe)"), - ) - .arg( - Arg::with_name(OPT_QUIET) - .short("q") - .long("quiet") - .help("Fail silently if an error occurs."), - ) - .arg( - Arg::with_name(OPT_SUFFIX) - .long(OPT_SUFFIX) - .help( - "append SUFFIX to TEMPLATE; SUFFIX must not contain a path separator. \ - This option is implied if TEMPLATE does not end with X.", - ) - .value_name("SUFFIX"), - ) - .arg( - Arg::with_name(OPT_TMPDIR) - .short("p") - .long(OPT_TMPDIR) - .help( - "interpret TEMPLATE relative to DIR; if DIR is not specified, use \ - $TMPDIR ($TMP on windows) if set, else /tmp. With this option, TEMPLATE must not \ - be an absolute name; unlike with -t, TEMPLATE may contain \ - slashes, but mktemp creates only the final component", - ) - .value_name("DIR"), - ) - .arg(Arg::with_name(OPT_T).short(OPT_T).help( - "Generate a template (using the supplied prefix and TMPDIR (TMP on windows) if set) \ - to create a filename template [deprecated]", - )) - .arg( - Arg::with_name(ARG_TEMPLATE) - .multiple(false) - .takes_value(true) - .max_values(1) - .default_value(DEFAULT_TEMPLATE), - ) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let template = matches.value_of(ARG_TEMPLATE).unwrap(); let tmpdir = matches.value_of(OPT_TMPDIR).unwrap_or_default(); @@ -171,6 +117,62 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(OPT_DIRECTORY) + .short("d") + .long(OPT_DIRECTORY) + .help("Make a directory instead of a file"), + ) + .arg( + Arg::with_name(OPT_DRY_RUN) + .short("u") + .long(OPT_DRY_RUN) + .help("do not create anything; merely print a name (unsafe)"), + ) + .arg( + Arg::with_name(OPT_QUIET) + .short("q") + .long("quiet") + .help("Fail silently if an error occurs."), + ) + .arg( + Arg::with_name(OPT_SUFFIX) + .long(OPT_SUFFIX) + .help( + "append SUFFIX to TEMPLATE; SUFFIX must not contain a path separator. \ + This option is implied if TEMPLATE does not end with X.", + ) + .value_name("SUFFIX"), + ) + .arg( + Arg::with_name(OPT_TMPDIR) + .short("p") + .long(OPT_TMPDIR) + .help( + "interpret TEMPLATE relative to DIR; if DIR is not specified, use \ + $TMPDIR ($TMP on windows) if set, else /tmp. With this option, TEMPLATE must not \ + be an absolute name; unlike with -t, TEMPLATE may contain \ + slashes, but mktemp creates only the final component", + ) + .value_name("DIR"), + ) + .arg(Arg::with_name(OPT_T).short(OPT_T).help( + "Generate a template (using the supplied prefix and TMPDIR (TMP on windows) if set) \ + to create a filename template [deprecated]", + )) + .arg( + Arg::with_name(ARG_TEMPLATE) + .multiple(false) + .takes_value(true) + .max_values(1) + .default_value(DEFAULT_TEMPLATE), + ) +} + fn parse_template(temp: &str) -> Option<(&str, usize, &str)> { let right = match temp.rfind('X') { Some(r) => r + 1, diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index d7fba5080..8f25cd7e4 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -51,7 +51,49 @@ pub mod options { const MULTI_FILE_TOP_PROMPT: &str = "::::::::::::::\n{}\n::::::::::::::\n"; pub fn uumain(args: impl uucore::Args) -> i32 { - let matches = App::new(executable!()) + let matches = uu_app().get_matches_from(args); + + let mut buff = String::new(); + let silent = matches.is_present(options::SILENT); + if let Some(files) = matches.values_of(options::FILES) { + let mut stdout = setup_term(); + let length = files.len(); + + let mut files_iter = files.peekable(); + while let (Some(file), next_file) = (files_iter.next(), files_iter.peek()) { + let file = Path::new(file); + if file.is_dir() { + terminal::disable_raw_mode().unwrap(); + show_usage_error!("'{}' is a directory.", file.display()); + return 1; + } + if !file.exists() { + terminal::disable_raw_mode().unwrap(); + show_error!("cannot open {}: No such file or directory", file.display()); + return 1; + } + if length > 1 { + buff.push_str(&MULTI_FILE_TOP_PROMPT.replace("{}", file.to_str().unwrap())); + } + let mut reader = BufReader::new(File::open(file).unwrap()); + reader.read_to_string(&mut buff).unwrap(); + more(&buff, &mut stdout, next_file.copied(), silent); + buff.clear(); + } + reset_term(&mut stdout); + } else if atty::isnt(atty::Stream::Stdin) { + stdin().read_to_string(&mut buff).unwrap(); + let mut stdout = setup_term(); + more(&buff, &mut stdout, None, silent); + reset_term(&mut stdout); + } else { + show_usage_error!("bad usage"); + } + 0 +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .about("A file perusal filter for CRT viewing.") .version(crate_version!()) .arg( @@ -138,45 +180,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .multiple(true) .help("Path to the files to be read"), ) - .get_matches_from(args); - - let mut buff = String::new(); - let silent = matches.is_present(options::SILENT); - if let Some(files) = matches.values_of(options::FILES) { - let mut stdout = setup_term(); - let length = files.len(); - - let mut files_iter = files.peekable(); - while let (Some(file), next_file) = (files_iter.next(), files_iter.peek()) { - let file = Path::new(file); - if file.is_dir() { - terminal::disable_raw_mode().unwrap(); - show_usage_error!("'{}' is a directory.", file.display()); - return 1; - } - if !file.exists() { - terminal::disable_raw_mode().unwrap(); - show_error!("cannot open {}: No such file or directory", file.display()); - return 1; - } - if length > 1 { - buff.push_str(&MULTI_FILE_TOP_PROMPT.replace("{}", file.to_str().unwrap())); - } - let mut reader = BufReader::new(File::open(file).unwrap()); - reader.read_to_string(&mut buff).unwrap(); - more(&buff, &mut stdout, next_file.copied(), silent); - buff.clear(); - } - reset_term(&mut stdout); - } else if atty::isnt(atty::Stream::Stdin) { - stdin().read_to_string(&mut buff).unwrap(); - let mut stdout = setup_term(); - more(&buff, &mut stdout, None, silent); - reset_term(&mut stdout); - } else { - show_usage_error!("bad usage"); - } - 0 } #[cfg(not(target_os = "fuchsia"))] diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index d709a2117..4a761861f 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -70,11 +70,64 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) + let matches = uu_app() + .after_help(&*format!( + "{}\n{}", + LONG_HELP, + backup_control::BACKUP_CONTROL_LONG_HELP + )) + .usage(&usage[..]) + .get_matches_from(args); + + let files: Vec = matches + .values_of(ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + + let overwrite_mode = determine_overwrite_mode(&matches); + let backup_mode = backup_control::determine_backup_mode( + matches.is_present(OPT_BACKUP_NO_ARG) || matches.is_present(OPT_BACKUP), + matches.value_of(OPT_BACKUP), + ); + + if overwrite_mode == OverwriteMode::NoClobber && backup_mode != BackupMode::NoBackup { + show_usage_error!("options --backup and --no-clobber are mutually exclusive"); + return 1; + } + + let backup_suffix = backup_control::determine_backup_suffix(matches.value_of(OPT_SUFFIX)); + + let behavior = Behavior { + overwrite: overwrite_mode, + backup: backup_mode, + suffix: backup_suffix, + update: matches.is_present(OPT_UPDATE), + target_dir: matches.value_of(OPT_TARGET_DIRECTORY).map(String::from), + no_target_dir: matches.is_present(OPT_NO_TARGET_DIRECTORY), + verbose: matches.is_present(OPT_VERBOSE), + }; + + let paths: Vec = { + fn strip_slashes(p: &Path) -> &Path { + p.components().as_path() + } + let to_owned = |p: &Path| p.to_owned(); + let paths = files.iter().map(Path::new); + + if matches.is_present(OPT_STRIP_TRAILING_SLASHES) { + paths.map(strip_slashes).map(to_owned).collect() + } else { + paths.map(to_owned).collect() + } + }; + + exec(&paths[..], behavior) +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .version(crate_version!()) .about(ABOUT) - .after_help(&*format!("{}\n{}", LONG_HELP, backup_control::BACKUP_CONTROL_LONG_HELP)) - .usage(&usage[..]) .arg( Arg::with_name(OPT_BACKUP) .long(OPT_BACKUP) @@ -153,51 +206,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .min_values(2) .required(true) ) - .get_matches_from(args); - - let files: Vec = matches - .values_of(ARG_FILES) - .map(|v| v.map(ToString::to_string).collect()) - .unwrap_or_default(); - - let overwrite_mode = determine_overwrite_mode(&matches); - let backup_mode = backup_control::determine_backup_mode( - matches.is_present(OPT_BACKUP_NO_ARG) || matches.is_present(OPT_BACKUP), - matches.value_of(OPT_BACKUP), - ); - - if overwrite_mode == OverwriteMode::NoClobber && backup_mode != BackupMode::NoBackup { - show_usage_error!("options --backup and --no-clobber are mutually exclusive"); - return 1; - } - - let backup_suffix = backup_control::determine_backup_suffix(matches.value_of(OPT_SUFFIX)); - - let behavior = Behavior { - overwrite: overwrite_mode, - backup: backup_mode, - suffix: backup_suffix, - update: matches.is_present(OPT_UPDATE), - target_dir: matches.value_of(OPT_TARGET_DIRECTORY).map(String::from), - no_target_dir: matches.is_present(OPT_NO_TARGET_DIRECTORY), - verbose: matches.is_present(OPT_VERBOSE), - }; - - let paths: Vec = { - fn strip_slashes(p: &Path) -> &Path { - p.components().as_path() - } - let to_owned = |p: &Path| p.to_owned(); - let paths = files.iter().map(Path::new); - - if matches.is_present(OPT_STRIP_TRAILING_SLASHES) { - paths.map(strip_slashes).map(to_owned).collect() - } else { - paths.map(to_owned).collect() - } - }; - - exec(&paths[..], behavior) } fn determine_overwrite_mode(matches: &ArgMatches) -> OverwriteMode { diff --git a/src/uu/nice/src/nice.rs b/src/uu/nice/src/nice.rs index 77baad0ca..d5a4094d1 100644 --- a/src/uu/nice/src/nice.rs +++ b/src/uu/nice/src/nice.rs @@ -46,20 +46,7 @@ process).", pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .setting(AppSettings::TrailingVarArg) - .version(crate_version!()) - .usage(&usage[..]) - .arg( - Arg::with_name(options::ADJUSTMENT) - .short("n") - .long(options::ADJUSTMENT) - .help("add N to the niceness (default is 10)") - .takes_value(true) - .allow_hyphen_values(true), - ) - .arg(Arg::with_name(options::COMMAND).multiple(true)) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let mut niceness = unsafe { nix::errno::Errno::clear(); @@ -120,3 +107,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 126 } } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .setting(AppSettings::TrailingVarArg) + .version(crate_version!()) + .arg( + Arg::with_name(options::ADJUSTMENT) + .short("n") + .long(options::ADJUSTMENT) + .help("add N to the niceness (default is 10)") + .takes_value(true) + .allow_hyphen_values(true), + ) + .arg(Arg::with_name(options::COMMAND).multiple(true)) +} diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index a3181e11f..81e76aa26 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -88,7 +88,62 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); - let matches = App::new(executable!()) + let matches = uu_app().get_matches_from(args); + + // A mutable settings object, initialized with the defaults. + let mut settings = Settings { + header_numbering: NumberingStyle::NumberForNone, + body_numbering: NumberingStyle::NumberForAll, + footer_numbering: NumberingStyle::NumberForNone, + section_delimiter: ['\\', ':'], + starting_line_number: 1, + line_increment: 1, + join_blank_lines: 1, + number_width: 6, + number_format: NumberFormat::Right, + renumber: true, + number_separator: String::from("\t"), + }; + + // Update the settings from the command line options, and terminate the + // 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; + } + + let mut read_stdin = false; + let files: Vec = match matches.values_of(options::FILE) { + Some(v) => v.clone().map(|v| v.to_owned()).collect(), + None => vec!["-".to_owned()], + }; + + for file in &files { + if file == "-" { + // If both file names and '-' are specified, we choose to treat first all + // regular files, and then read from stdin last. + read_stdin = true; + continue; + } + let path = Path::new(file); + let reader = File::open(path).unwrap(); + let mut buffer = BufReader::new(reader); + nl(&mut buffer, &settings); + } + + if read_stdin { + let mut buffer = BufReader::new(stdin()); + nl(&mut buffer, &settings); + } + 0 +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .name(NAME) .version(crate_version!()) .usage(USAGE) @@ -169,58 +224,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("use NUMBER columns for line numbers") .value_name("NUMBER"), ) - .get_matches_from(args); - - // A mutable settings object, initialized with the defaults. - let mut settings = Settings { - header_numbering: NumberingStyle::NumberForNone, - body_numbering: NumberingStyle::NumberForAll, - footer_numbering: NumberingStyle::NumberForNone, - section_delimiter: ['\\', ':'], - starting_line_number: 1, - line_increment: 1, - join_blank_lines: 1, - number_width: 6, - number_format: NumberFormat::Right, - renumber: true, - number_separator: String::from("\t"), - }; - - // Update the settings from the command line options, and terminate the - // 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; - } - - let mut read_stdin = false; - let files: Vec = match matches.values_of(options::FILE) { - Some(v) => v.clone().map(|v| v.to_owned()).collect(), - None => vec!["-".to_owned()], - }; - - for file in &files { - if file == "-" { - // If both file names and '-' are specified, we choose to treat first all - // regular files, and then read from stdin last. - read_stdin = true; - continue; - } - let path = Path::new(file); - let reader = File::open(path).unwrap(); - let mut buffer = BufReader::new(reader); - nl(&mut buffer, &settings); - } - - if read_stdin { - let mut buffer = BufReader::new(stdin()); - nl(&mut buffer, &settings); - } - 0 } // nl implements the main functionality for an individual buffer. diff --git a/src/uu/nohup/src/nohup.rs b/src/uu/nohup/src/nohup.rs index 4e6fd7a7e..acc101e4e 100644 --- a/src/uu/nohup/src/nohup.rs +++ b/src/uu/nohup/src/nohup.rs @@ -45,19 +45,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .after_help(LONG_HELP) - .arg( - Arg::with_name(options::CMD) - .hidden(true) - .required(true) - .multiple(true), - ) - .setting(AppSettings::TrailingVarArg) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); replace_fds(); @@ -82,6 +70,20 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .after_help(LONG_HELP) + .arg( + Arg::with_name(options::CMD) + .hidden(true) + .required(true) + .multiple(true), + ) + .setting(AppSettings::TrailingVarArg) +} + fn replace_fds() { if atty::is(atty::Stream::Stdin) { let new_stdin = match File::open(Path::new("/dev/null")) { diff --git a/src/uu/nproc/src/nproc.rs b/src/uu/nproc/src/nproc.rs index 13f1862d2..1f284685b 100644 --- a/src/uu/nproc/src/nproc.rs +++ b/src/uu/nproc/src/nproc.rs @@ -33,24 +33,7 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(OPT_ALL) - .short("") - .long(OPT_ALL) - .help("print the number of cores available to the system"), - ) - .arg( - Arg::with_name(OPT_IGNORE) - .short("") - .long(OPT_IGNORE) - .takes_value(true) - .help("ignore up to N cores"), - ) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let mut ignore = match matches.value_of(OPT_IGNORE) { Some(numstr) => match numstr.parse() { @@ -86,6 +69,25 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(OPT_ALL) + .short("") + .long(OPT_ALL) + .help("print the number of cores available to the system"), + ) + .arg( + Arg::with_name(OPT_IGNORE) + .short("") + .long(OPT_IGNORE) + .takes_value(true) + .help("ignore up to N cores"), + ) +} + #[cfg(any( target_os = "linux", target_vendor = "apple", diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index b534a9789..01f12c51b 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -156,10 +156,28 @@ fn parse_options(args: &ArgMatches) -> Result { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) + let matches = uu_app().usage(&usage[..]).get_matches_from(args); + + let result = + parse_options(&matches).and_then(|options| match matches.values_of(options::NUMBER) { + Some(values) => handle_args(values, options), + None => handle_stdin(options), + }); + + match result { + Err(e) => { + std::io::stdout().flush().expect("error flushing stdout"); + show_error!("{}", e); + 1 + } + _ => 0, + } +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .version(crate_version!()) .about(ABOUT) - .usage(&usage[..]) .after_help(LONG_HELP) .setting(AppSettings::AllowNegativeNumbers) .arg( @@ -224,20 +242,4 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .possible_values(&["up", "down", "from-zero", "towards-zero", "nearest"]), ) .arg(Arg::with_name(options::NUMBER).hidden(true).multiple(true)) - .get_matches_from(args); - - let result = - parse_options(&matches).and_then(|options| match matches.values_of(options::NUMBER) { - Some(values) => handle_args(values, options), - None => handle_stdin(options), - }); - - match result { - Err(e) => { - std::io::stdout().flush().expect("error flushing stdout"); - show_error!("{}", e); - 1 - } - _ => 0, - } } diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index bf6c39011..ec5bb595a 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -214,7 +214,45 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .collect_str(InvalidEncodingHandling::Ignore) .accept_any(); - let clap_opts = clap::App::new(executable!()) + let clap_opts = uu_app(); + + let clap_matches = clap_opts + .clone() // Clone to reuse clap_opts to print help + .get_matches_from(args.clone()); + + let od_options = match OdOptions::new(clap_matches, args) { + Err(s) => { + crash!(1, "{}", s); + } + Ok(o) => o, + }; + + let mut input_offset = + InputOffset::new(od_options.radix, od_options.skip_bytes, od_options.label); + + let mut input = open_input_peek_reader( + &od_options.input_strings, + od_options.skip_bytes, + od_options.read_bytes, + ); + let mut input_decoder = InputDecoder::new( + &mut input, + od_options.line_bytes, + PEEK_BUFFER_SIZE, + od_options.byte_order, + ); + + let output_info = OutputInfo::new( + od_options.line_bytes, + &od_options.formats[..], + od_options.output_duplicates, + ); + + odfunc(&mut input_offset, &mut input_decoder, &output_info) +} + +pub fn uu_app() -> clap::App<'static, 'static> { + clap::App::new(executable!()) .version(crate_version!()) .about(ABOUT) .usage(USAGE) @@ -434,41 +472,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { AppSettings::DontDelimitTrailingValues, AppSettings::DisableVersion, AppSettings::DeriveDisplayOrder, - ]); - - let clap_matches = clap_opts - .clone() // Clone to reuse clap_opts to print help - .get_matches_from(args.clone()); - - let od_options = match OdOptions::new(clap_matches, args) { - Err(s) => { - crash!(1, "{}", s); - } - Ok(o) => o, - }; - - let mut input_offset = - InputOffset::new(od_options.radix, od_options.skip_bytes, od_options.label); - - let mut input = open_input_peek_reader( - &od_options.input_strings, - od_options.skip_bytes, - od_options.read_bytes, - ); - let mut input_decoder = InputDecoder::new( - &mut input, - od_options.line_bytes, - PEEK_BUFFER_SIZE, - od_options.byte_order, - ); - - let output_info = OutputInfo::new( - od_options.line_bytes, - &od_options.formats[..], - od_options.output_duplicates, - ); - - odfunc(&mut input_offset, &mut input_decoder, &output_info) + ]) } /// Loops through the input line by line, calling print_bytes to take care of the output. diff --git a/src/uu/paste/src/paste.rs b/src/uu/paste/src/paste.rs index f2fa3c81c..7f7969687 100644 --- a/src/uu/paste/src/paste.rs +++ b/src/uu/paste/src/paste.rs @@ -37,7 +37,22 @@ fn read_line( } pub fn uumain(args: impl uucore::Args) -> i32 { - let matches = App::new(executable!()) + let matches = uu_app().get_matches_from(args); + + let serial = matches.is_present(options::SERIAL); + let delimiters = matches.value_of(options::DELIMITER).unwrap().to_owned(); + let files = matches + .values_of(options::FILE) + .unwrap() + .map(|s| s.to_owned()) + .collect(); + paste(files, serial, delimiters); + + 0 +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .version(crate_version!()) .about(ABOUT) .arg( @@ -61,18 +76,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .multiple(true) .default_value("-"), ) - .get_matches_from(args); - - let serial = matches.is_present(options::SERIAL); - let delimiters = matches.value_of(options::DELIMITER).unwrap().to_owned(); - let files = matches - .values_of(options::FILE) - .unwrap() - .map(|s| s.to_owned()) - .collect(); - paste(files, serial, delimiters); - - 0 } fn paste(filenames: Vec, serial: bool, delimiters: String) { diff --git a/src/uu/pathchk/src/pathchk.rs b/src/uu/pathchk/src/pathchk.rs index 358881509..335266456 100644 --- a/src/uu/pathchk/src/pathchk.rs +++ b/src/uu/pathchk/src/pathchk.rs @@ -49,27 +49,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(options::POSIX) - .short("p") - .help("check for most POSIX systems"), - ) - .arg( - Arg::with_name(options::POSIX_SPECIAL) - .short("P") - .help(r#"check for empty names and leading "-""#), - ) - .arg( - Arg::with_name(options::PORTABILITY) - .long(options::PORTABILITY) - .help("check for all POSIX systems (equivalent to -p -P)"), - ) - .arg(Arg::with_name(options::PATH).hidden(true).multiple(true)) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); // set working mode let is_posix = matches.values_of(options::POSIX).is_some(); @@ -115,6 +95,28 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(options::POSIX) + .short("p") + .help("check for most POSIX systems"), + ) + .arg( + Arg::with_name(options::POSIX_SPECIAL) + .short("P") + .help(r#"check for empty names and leading "-""#), + ) + .arg( + Arg::with_name(options::PORTABILITY) + .long(options::PORTABILITY) + .help("check for all POSIX systems (equivalent to -p -P)"), + ) + .arg(Arg::with_name(options::PATH).hidden(true).multiple(true)) +} + // check a path, given as a slice of it's components and an operating mode fn check_path(mode: &Mode, path: &[String]) -> bool { match *mode { diff --git a/src/uu/pinky/src/pinky.rs b/src/uu/pinky/src/pinky.rs index 33dcff274..16bcfd3c9 100644 --- a/src/uu/pinky/src/pinky.rs +++ b/src/uu/pinky/src/pinky.rs @@ -60,62 +60,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let after_help = get_long_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) + let matches = uu_app() .usage(&usage[..]) .after_help(&after_help[..]) - .arg( - Arg::with_name(options::LONG_FORMAT) - .short("l") - .requires(options::USER) - .help("produce long format output for the specified USERs"), - ) - .arg( - Arg::with_name(options::OMIT_HOME_DIR) - .short("b") - .help("omit the user's home directory and shell in long format"), - ) - .arg( - Arg::with_name(options::OMIT_PROJECT_FILE) - .short("h") - .help("omit the user's project file in long format"), - ) - .arg( - Arg::with_name(options::OMIT_PLAN_FILE) - .short("p") - .help("omit the user's plan file in long format"), - ) - .arg( - Arg::with_name(options::SHORT_FORMAT) - .short("s") - .help("do short format output, this is the default"), - ) - .arg( - Arg::with_name(options::OMIT_HEADINGS) - .short("f") - .help("omit the line of column headings in short format"), - ) - .arg( - Arg::with_name(options::OMIT_NAME) - .short("w") - .help("omit the user's full name in short format"), - ) - .arg( - Arg::with_name(options::OMIT_NAME_HOST) - .short("i") - .help("omit the user's full name and remote host in short format"), - ) - .arg( - Arg::with_name(options::OMIT_NAME_HOST_TIME) - .short("q") - .help("omit the user's full name, remote host and idle time in short format"), - ) - .arg( - Arg::with_name(options::USER) - .takes_value(true) - .multiple(true), - ) .get_matches_from(args); let users: Vec = matches @@ -182,6 +129,63 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(options::LONG_FORMAT) + .short("l") + .requires(options::USER) + .help("produce long format output for the specified USERs"), + ) + .arg( + Arg::with_name(options::OMIT_HOME_DIR) + .short("b") + .help("omit the user's home directory and shell in long format"), + ) + .arg( + Arg::with_name(options::OMIT_PROJECT_FILE) + .short("h") + .help("omit the user's project file in long format"), + ) + .arg( + Arg::with_name(options::OMIT_PLAN_FILE) + .short("p") + .help("omit the user's plan file in long format"), + ) + .arg( + Arg::with_name(options::SHORT_FORMAT) + .short("s") + .help("do short format output, this is the default"), + ) + .arg( + Arg::with_name(options::OMIT_HEADINGS) + .short("f") + .help("omit the line of column headings in short format"), + ) + .arg( + Arg::with_name(options::OMIT_NAME) + .short("w") + .help("omit the user's full name in short format"), + ) + .arg( + Arg::with_name(options::OMIT_NAME_HOST) + .short("i") + .help("omit the user's full name and remote host in short format"), + ) + .arg( + Arg::with_name(options::OMIT_NAME_HOST_TIME) + .short("q") + .help("omit the user's full name, remote host and idle time in short format"), + ) + .arg( + Arg::with_name(options::USER) + .takes_value(true) + .multiple(true), + ) +} + struct Pinky { include_idle: bool, include_heading: bool, diff --git a/src/uu/pr/Cargo.toml b/src/uu/pr/Cargo.toml index 6d9ec2304..de519161a 100644 --- a/src/uu/pr/Cargo.toml +++ b/src/uu/pr/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/pr.rs" [dependencies] +clap = "2.33.3" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["utmpx", "entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } getopts = "0.2.21" diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index 239a0970f..d6b9e8ca3 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -23,6 +23,7 @@ use std::fs::{metadata, File}; use std::io::{stdin, stdout, BufRead, BufReader, Lines, Read, Stdout, Write}; #[cfg(unix)] use std::os::unix::fs::FileTypeExt; +use uucore::executable; type IOError = std::io::Error; @@ -167,6 +168,11 @@ quick_error! { } } +pub fn uu_app() -> clap::App<'static, 'static> { + // TODO: migrate to clap to get more shell completions + clap::App::new(executable!()) +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args .collect_str(uucore::InvalidEncodingHandling::Ignore) diff --git a/src/uu/printenv/src/printenv.rs b/src/uu/printenv/src/printenv.rs index 5c2594835..6e0ca7157 100644 --- a/src/uu/printenv/src/printenv.rs +++ b/src/uu/printenv/src/printenv.rs @@ -26,23 +26,7 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(OPT_NULL) - .short("0") - .long(OPT_NULL) - .help("end each output line with 0 byte rather than newline"), - ) - .arg( - Arg::with_name(ARG_VARIABLES) - .multiple(true) - .takes_value(true) - .min_values(1), - ) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let variables: Vec = matches .values_of(ARG_VARIABLES) @@ -69,3 +53,21 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } 0 } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(OPT_NULL) + .short("0") + .long(OPT_NULL) + .help("end each output line with 0 byte rather than newline"), + ) + .arg( + Arg::with_name(ARG_VARIABLES) + .multiple(true) + .takes_value(true) + .min_values(1), + ) +} diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index bc77d31be..13d54fcca 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -18,6 +18,7 @@ edition = "2018" path = "src/printf.rs" [dependencies] +clap = "2.33.3" itertools = "0.8.0" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/printf/src/printf.rs b/src/uu/printf/src/printf.rs index 88d18838d..efa9aea57 100644 --- a/src/uu/printf/src/printf.rs +++ b/src/uu/printf/src/printf.rs @@ -2,14 +2,18 @@ // spell-checker:ignore (change!) each's // spell-checker:ignore (ToDO) LONGHELP FORMATSTRING templating parameterizing formatstr +#[macro_use] +extern crate uucore; + +use clap::{crate_version, App, Arg}; use uucore::InvalidEncodingHandling; mod cli; mod memo; mod tokenize; -static NAME: &str = "printf"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); +const VERSION: &str = "version"; +const HELP: &str = "help"; static LONGHELP_LEAD: &str = "printf USAGE: printf FORMATSTRING [ARGUMENT]... @@ -290,10 +294,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if formatstr == "--help" { print!("{} {}", LONGHELP_LEAD, LONGHELP_BODY); } else if formatstr == "--version" { - println!("{} {}", NAME, VERSION); + println!("{} {}", executable!(), crate_version!()); } else { let printf_args = &args[2..]; memo::Memo::run_all(formatstr, printf_args); } 0 } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .arg(Arg::with_name(VERSION).long(VERSION)) + .arg(Arg::with_name(HELP).long(HELP)) +} diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index 31da8f05d..01b14bc4d 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -638,7 +638,28 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .accept_any(); // let mut opts = Options::new(); - let matches = App::new(executable!()) + let matches = uu_app().get_matches_from(args); + + let input_files: Vec = match &matches.values_of(options::FILE) { + Some(v) => v.clone().map(|v| v.to_owned()).collect(), + None => vec!["-".to_string()], + }; + + let config = get_config(&matches); + let word_filter = WordFilter::new(&matches, &config); + let file_map = read_input(&input_files, &config); + let word_set = create_word_set(&config, &word_filter, &file_map); + let output_file = if !config.gnu_ext && matches.args.len() == 2 { + matches.value_of(options::FILE).unwrap_or("-").to_string() + } else { + "-".to_owned() + }; + write_traditional_output(&config, &file_map, &word_set, &output_file); + 0 +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .name(NAME) .version(crate_version!()) .usage(BRIEF) @@ -762,22 +783,4 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .value_name("NUMBER") .takes_value(true), ) - .get_matches_from(args); - - let input_files: Vec = match &matches.values_of(options::FILE) { - Some(v) => v.clone().map(|v| v.to_owned()).collect(), - None => vec!["-".to_string()], - }; - - let config = get_config(&matches); - let word_filter = WordFilter::new(&matches, &config); - let file_map = read_input(&input_files, &config); - let word_set = create_word_set(&config, &word_filter, &file_map); - let output_file = if !config.gnu_ext && matches.args.len() == 2 { - matches.value_of(options::FILE).unwrap_or("-").to_string() - } else { - "-".to_owned() - }; - write_traditional_output(&config, &file_map, &word_set, &output_file); - 0 } diff --git a/src/uu/pwd/src/pwd.rs b/src/uu/pwd/src/pwd.rs index 9b4e5c600..764a63a88 100644 --- a/src/uu/pwd/src/pwd.rs +++ b/src/uu/pwd/src/pwd.rs @@ -39,23 +39,7 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(OPT_LOGICAL) - .short("L") - .long(OPT_LOGICAL) - .help("use PWD from environment, even if it contains symlinks"), - ) - .arg( - Arg::with_name(OPT_PHYSICAL) - .short("P") - .long(OPT_PHYSICAL) - .help("avoid all symlinks"), - ) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); match env::current_dir() { Ok(logical_path) => { @@ -73,3 +57,21 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(OPT_LOGICAL) + .short("L") + .long(OPT_LOGICAL) + .help("use PWD from environment, even if it contains symlinks"), + ) + .arg( + Arg::with_name(OPT_PHYSICAL) + .short("P") + .long(OPT_PHYSICAL) + .help("avoid all symlinks"), + ) +} diff --git a/src/uu/readlink/src/readlink.rs b/src/uu/readlink/src/readlink.rs index 02e286315..826fa0254 100644 --- a/src/uu/readlink/src/readlink.rs +++ b/src/uu/readlink/src/readlink.rs @@ -35,69 +35,7 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(OPT_CANONICALIZE) - .short("f") - .long(OPT_CANONICALIZE) - .help( - "canonicalize by following every symlink in every component of the \ - given name recursively; all but the last component must exist", - ), - ) - .arg( - Arg::with_name(OPT_CANONICALIZE_EXISTING) - .short("e") - .long("canonicalize-existing") - .help( - "canonicalize by following every symlink in every component of the \ - given name recursively, all components must exist", - ), - ) - .arg( - Arg::with_name(OPT_CANONICALIZE_MISSING) - .short("m") - .long(OPT_CANONICALIZE_MISSING) - .help( - "canonicalize by following every symlink in every component of the \ - given name recursively, without requirements on components existence", - ), - ) - .arg( - Arg::with_name(OPT_NO_NEWLINE) - .short("n") - .long(OPT_NO_NEWLINE) - .help("do not output the trailing delimiter"), - ) - .arg( - Arg::with_name(OPT_QUIET) - .short("q") - .long(OPT_QUIET) - .help("suppress most error messages"), - ) - .arg( - Arg::with_name(OPT_SILENT) - .short("s") - .long(OPT_SILENT) - .help("suppress most error messages"), - ) - .arg( - Arg::with_name(OPT_VERBOSE) - .short("v") - .long(OPT_VERBOSE) - .help("report error message"), - ) - .arg( - Arg::with_name(OPT_ZERO) - .short("z") - .long(OPT_ZERO) - .help("separate output with NUL rather than newline"), - ) - .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let mut no_newline = matches.is_present(OPT_NO_NEWLINE); let use_zero = matches.is_present(OPT_ZERO); @@ -159,6 +97,70 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(OPT_CANONICALIZE) + .short("f") + .long(OPT_CANONICALIZE) + .help( + "canonicalize by following every symlink in every component of the \ + given name recursively; all but the last component must exist", + ), + ) + .arg( + Arg::with_name(OPT_CANONICALIZE_EXISTING) + .short("e") + .long("canonicalize-existing") + .help( + "canonicalize by following every symlink in every component of the \ + given name recursively, all components must exist", + ), + ) + .arg( + Arg::with_name(OPT_CANONICALIZE_MISSING) + .short("m") + .long(OPT_CANONICALIZE_MISSING) + .help( + "canonicalize by following every symlink in every component of the \ + given name recursively, without requirements on components existence", + ), + ) + .arg( + Arg::with_name(OPT_NO_NEWLINE) + .short("n") + .long(OPT_NO_NEWLINE) + .help("do not output the trailing delimiter"), + ) + .arg( + Arg::with_name(OPT_QUIET) + .short("q") + .long(OPT_QUIET) + .help("suppress most error messages"), + ) + .arg( + Arg::with_name(OPT_SILENT) + .short("s") + .long(OPT_SILENT) + .help("suppress most error messages"), + ) + .arg( + Arg::with_name(OPT_VERBOSE) + .short("v") + .long(OPT_VERBOSE) + .help("report error message"), + ) + .arg( + Arg::with_name(OPT_ZERO) + .short("z") + .long(OPT_ZERO) + .help("separate output with NUL rather than newline"), + ) + .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) +} + fn show(path: &Path, no_newline: bool, use_zero: bool) { let path = path.to_str().unwrap(); if use_zero { diff --git a/src/uu/realpath/src/realpath.rs b/src/uu/realpath/src/realpath.rs index 1a96b7f80..fe2ad4ccc 100644 --- a/src/uu/realpath/src/realpath.rs +++ b/src/uu/realpath/src/realpath.rs @@ -29,10 +29,35 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) + let matches = uu_app().usage(&usage[..]).get_matches_from(args); + + /* the list of files */ + + let paths: Vec = matches + .values_of(ARG_FILES) + .unwrap() + .map(PathBuf::from) + .collect(); + + let strip = matches.is_present(OPT_STRIP); + let zero = matches.is_present(OPT_ZERO); + let quiet = matches.is_present(OPT_QUIET); + let mut retcode = 0; + for path in &paths { + if let Err(e) = resolve_path(path, strip, zero) { + if !quiet { + show_error!("{}: {}", e, path.display()); + } + retcode = 1 + }; + } + retcode +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .version(crate_version!()) .about(ABOUT) - .usage(&usage[..]) .arg( Arg::with_name(OPT_QUIET) .short("q") @@ -58,29 +83,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .required(true) .min_values(1), ) - .get_matches_from(args); - - /* the list of files */ - - let paths: Vec = matches - .values_of(ARG_FILES) - .unwrap() - .map(PathBuf::from) - .collect(); - - let strip = matches.is_present(OPT_STRIP); - let zero = matches.is_present(OPT_ZERO); - let quiet = matches.is_present(OPT_QUIET); - let mut retcode = 0; - for path in &paths { - if let Err(e) = resolve_path(path, strip, zero) { - if !quiet { - show_error!("{}: {}", e, path.display()); - } - retcode = 1 - }; - } - retcode } /// Resolve a path to an absolute form and print it. diff --git a/src/uu/relpath/src/relpath.rs b/src/uu/relpath/src/relpath.rs index a997e1c5f..cb0fba7cc 100644 --- a/src/uu/relpath/src/relpath.rs +++ b/src/uu/relpath/src/relpath.rs @@ -35,26 +35,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .accept_any(); let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(options::DIR) - .short("d") - .takes_value(true) - .help("If any of FROM and TO is not subpath of DIR, output absolute path instead of relative"), - ) - .arg( - Arg::with_name(options::TO) - .required(true) - .takes_value(true), - ) - .arg( - Arg::with_name(options::FROM) - .takes_value(true), - ) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let to = Path::new(matches.value_of(options::TO).unwrap()).to_path_buf(); // required let from = match matches.value_of(options::FROM) { @@ -99,3 +80,24 @@ pub fn uumain(args: impl uucore::Args) -> i32 { println!("{}", result.display()); 0 } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(options::DIR) + .short("d") + .takes_value(true) + .help("If any of FROM and TO is not subpath of DIR, output absolute path instead of relative"), + ) + .arg( + Arg::with_name(options::TO) + .required(true) + .takes_value(true), + ) + .arg( + Arg::with_name(options::FROM) + .takes_value(true), + ) +} diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 40a24cea7..259d1ab39 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -77,11 +77,72 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let long_usage = get_long_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) + let matches = uu_app() .usage(&usage[..]) .after_help(&long_usage[..]) + .get_matches_from(args); + + let files: Vec = matches + .values_of(ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + + let force = matches.is_present(OPT_FORCE); + + if files.is_empty() && !force { + // Still check by hand and not use clap + // Because "rm -f" is a thing + show_error!("missing an argument"); + show_error!("for help, try '{0} --help'", executable!()); + return 1; + } else { + let options = Options { + force, + interactive: { + if matches.is_present(OPT_PROMPT) { + InteractiveMode::Always + } else if matches.is_present(OPT_PROMPT_MORE) { + InteractiveMode::Once + } else if matches.is_present(OPT_INTERACTIVE) { + match matches.value_of(OPT_INTERACTIVE).unwrap() { + "none" => InteractiveMode::None, + "once" => InteractiveMode::Once, + "always" => InteractiveMode::Always, + val => crash!(1, "Invalid argument to interactive ({})", val), + } + } else { + InteractiveMode::None + } + }, + one_fs: matches.is_present(OPT_ONE_FILE_SYSTEM), + preserve_root: !matches.is_present(OPT_NO_PRESERVE_ROOT), + recursive: matches.is_present(OPT_RECURSIVE) || matches.is_present(OPT_RECURSIVE_R), + dir: matches.is_present(OPT_DIR), + verbose: matches.is_present(OPT_VERBOSE), + }; + if options.interactive == InteractiveMode::Once && (options.recursive || files.len() > 3) { + let msg = if options.recursive { + "Remove all arguments recursively? " + } else { + "Remove all arguments? " + }; + if !prompt(msg) { + return 0; + } + } + + if remove(files, options) { + return 1; + } + } + + 0 +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) .arg( Arg::with_name(OPT_FORCE) @@ -151,63 +212,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .min_values(1) ) - .get_matches_from(args); - - let files: Vec = matches - .values_of(ARG_FILES) - .map(|v| v.map(ToString::to_string).collect()) - .unwrap_or_default(); - - let force = matches.is_present(OPT_FORCE); - - if files.is_empty() && !force { - // Still check by hand and not use clap - // Because "rm -f" is a thing - show_error!("missing an argument"); - show_error!("for help, try '{0} --help'", executable!()); - return 1; - } else { - let options = Options { - force, - interactive: { - if matches.is_present(OPT_PROMPT) { - InteractiveMode::Always - } else if matches.is_present(OPT_PROMPT_MORE) { - InteractiveMode::Once - } else if matches.is_present(OPT_INTERACTIVE) { - match matches.value_of(OPT_INTERACTIVE).unwrap() { - "none" => InteractiveMode::None, - "once" => InteractiveMode::Once, - "always" => InteractiveMode::Always, - val => crash!(1, "Invalid argument to interactive ({})", val), - } - } else { - InteractiveMode::None - } - }, - one_fs: matches.is_present(OPT_ONE_FILE_SYSTEM), - preserve_root: !matches.is_present(OPT_NO_PRESERVE_ROOT), - recursive: matches.is_present(OPT_RECURSIVE) || matches.is_present(OPT_RECURSIVE_R), - dir: matches.is_present(OPT_DIR), - verbose: matches.is_present(OPT_VERBOSE), - }; - if options.interactive == InteractiveMode::Once && (options.recursive || files.len() > 3) { - let msg = if options.recursive { - "Remove all arguments recursively? " - } else { - "Remove all arguments? " - }; - if !prompt(msg) { - return 0; - } - } - - if remove(files, options) { - return 1; - } - } - - 0 } // TODO: implement one-file-system (this may get partially implemented in walkdir) diff --git a/src/uu/rmdir/src/rmdir.rs b/src/uu/rmdir/src/rmdir.rs index fc22cca09..8dbaf79a8 100644 --- a/src/uu/rmdir/src/rmdir.rs +++ b/src/uu/rmdir/src/rmdir.rs @@ -33,10 +33,29 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) + let matches = uu_app().usage(&usage[..]).get_matches_from(args); + + let dirs: Vec = matches + .values_of(ARG_DIRS) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + + let ignore = matches.is_present(OPT_IGNORE_FAIL_NON_EMPTY); + let parents = matches.is_present(OPT_PARENTS); + let verbose = matches.is_present(OPT_VERBOSE); + + match remove(dirs, ignore, parents, verbose) { + Ok(()) => ( /* pass */ ), + Err(e) => return e, + } + + 0 +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .version(crate_version!()) .about(ABOUT) - .usage(&usage[..]) .arg( Arg::with_name(OPT_IGNORE_FAIL_NON_EMPTY) .long(OPT_IGNORE_FAIL_NON_EMPTY) @@ -64,23 +83,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .min_values(1) .required(true), ) - .get_matches_from(args); - - let dirs: Vec = matches - .values_of(ARG_DIRS) - .map(|v| v.map(ToString::to_string).collect()) - .unwrap_or_default(); - - let ignore = matches.is_present(OPT_IGNORE_FAIL_NON_EMPTY); - let parents = matches.is_present(OPT_PARENTS); - let verbose = matches.is_present(OPT_VERBOSE); - - match remove(dirs, ignore, parents, verbose) { - Ok(()) => ( /* pass */ ), - Err(e) => return e, - } - - 0 } fn remove(dirs: Vec, ignore: bool, parents: bool, verbose: bool) -> Result<(), i32> { diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index 954d15f2f..50a93d3af 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -87,42 +87,7 @@ impl FromStr for Number { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .setting(AppSettings::AllowLeadingHyphen) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(OPT_SEPARATOR) - .short("s") - .long("separator") - .help("Separator character (defaults to \\n)") - .takes_value(true) - .number_of_values(1), - ) - .arg( - Arg::with_name(OPT_TERMINATOR) - .short("t") - .long("terminator") - .help("Terminator character (defaults to \\n)") - .takes_value(true) - .number_of_values(1), - ) - .arg( - Arg::with_name(OPT_WIDTHS) - .short("w") - .long("widths") - .help("Equalize widths of all numbers by padding with zeros"), - ) - .arg( - Arg::with_name(ARG_NUMBERS) - .multiple(true) - .takes_value(true) - .allow_hyphen_values(true) - .max_values(3) - .required(true), - ) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let numbers = matches.values_of(ARG_NUMBERS).unwrap().collect::>(); @@ -197,6 +162,43 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .setting(AppSettings::AllowLeadingHyphen) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(OPT_SEPARATOR) + .short("s") + .long("separator") + .help("Separator character (defaults to \\n)") + .takes_value(true) + .number_of_values(1), + ) + .arg( + Arg::with_name(OPT_TERMINATOR) + .short("t") + .long("terminator") + .help("Terminator character (defaults to \\n)") + .takes_value(true) + .number_of_values(1), + ) + .arg( + Arg::with_name(OPT_WIDTHS) + .short("w") + .long("widths") + .help("Equalize widths of all numbers by padding with zeros"), + ) + .arg( + Arg::with_name(ARG_NUMBERS) + .multiple(true) + .takes_value(true) + .allow_hyphen_values(true) + .max_values(3) + .required(true), + ) +} + fn done_printing(next: &T, increment: &T, last: &T) -> bool { if increment >= &T::zero() { next > last diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 177143811..90336ea95 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -272,62 +272,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let app = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .after_help(AFTER_HELP) - .usage(&usage[..]) - .arg( - Arg::with_name(options::FORCE) - .long(options::FORCE) - .short("f") - .help("change permissions to allow writing if necessary"), - ) - .arg( - Arg::with_name(options::ITERATIONS) - .long(options::ITERATIONS) - .short("n") - .help("overwrite N times instead of the default (3)") - .value_name("NUMBER") - .default_value("3"), - ) - .arg( - Arg::with_name(options::SIZE) - .long(options::SIZE) - .short("s") - .takes_value(true) - .value_name("N") - .help("shred this many bytes (suffixes like K, M, G accepted)"), - ) - .arg( - Arg::with_name(options::REMOVE) - .short("u") - .long(options::REMOVE) - .help("truncate and remove file after overwriting; See below"), - ) - .arg( - Arg::with_name(options::VERBOSE) - .long(options::VERBOSE) - .short("v") - .help("show progress"), - ) - .arg( - Arg::with_name(options::EXACT) - .long(options::EXACT) - .short("x") - .help( - "do not round file sizes up to the next full block;\n\ - this is the default for non-regular files", - ), - ) - .arg( - Arg::with_name(options::ZERO) - .long(options::ZERO) - .short("z") - .help("add a final overwrite with zeros to hide shredding"), - ) - // Positional arguments - .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)); + let app = uu_app().usage(&usage[..]); let matches = app.get_matches_from(args); @@ -384,6 +329,64 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .after_help(AFTER_HELP) + .arg( + Arg::with_name(options::FORCE) + .long(options::FORCE) + .short("f") + .help("change permissions to allow writing if necessary"), + ) + .arg( + Arg::with_name(options::ITERATIONS) + .long(options::ITERATIONS) + .short("n") + .help("overwrite N times instead of the default (3)") + .value_name("NUMBER") + .default_value("3"), + ) + .arg( + Arg::with_name(options::SIZE) + .long(options::SIZE) + .short("s") + .takes_value(true) + .value_name("N") + .help("shred this many bytes (suffixes like K, M, G accepted)"), + ) + .arg( + Arg::with_name(options::REMOVE) + .short("u") + .long(options::REMOVE) + .help("truncate and remove file after overwriting; See below"), + ) + .arg( + Arg::with_name(options::VERBOSE) + .long(options::VERBOSE) + .short("v") + .help("show progress"), + ) + .arg( + Arg::with_name(options::EXACT) + .long(options::EXACT) + .short("x") + .help( + "do not round file sizes up to the next full block;\n\ + this is the default for non-regular files", + ), + ) + .arg( + Arg::with_name(options::ZERO) + .long(options::ZERO) + .short("z") + .help("add a final overwrite with zeros to hide shredding"), + ) + // Positional arguments + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) +} + // TODO: Add support for all postfixes here up to and including EiB // http://www.gnu.org/software/coreutils/manual/coreutils.html#Block-size fn get_size(size_str_opt: Option) -> Option { diff --git a/src/uu/shuf/src/shuf.rs b/src/uu/shuf/src/shuf.rs index 2d1f558de..4690d1c6e 100644 --- a/src/uu/shuf/src/shuf.rs +++ b/src/uu/shuf/src/shuf.rs @@ -56,7 +56,66 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); - let matches = App::new(executable!()) + let matches = uu_app().get_matches_from(args); + + let mode = if let Some(args) = matches.values_of(options::ECHO) { + Mode::Echo(args.map(String::from).collect()) + } else if let Some(range) = matches.value_of(options::INPUT_RANGE) { + match parse_range(range) { + Ok(m) => Mode::InputRange(m), + Err(msg) => { + crash!(1, "{}", msg); + } + } + } else { + Mode::Default(matches.value_of(options::FILE).unwrap_or("-").to_string()) + }; + + let options = Options { + head_count: match matches.value_of(options::HEAD_COUNT) { + Some(count) => match count.parse::() { + Ok(val) => val, + Err(_) => { + show_error!("invalid line count: '{}'", count); + return 1; + } + }, + None => std::usize::MAX, + }, + output: matches.value_of(options::OUTPUT).map(String::from), + random_source: matches.value_of(options::RANDOM_SOURCE).map(String::from), + repeat: matches.is_present(options::REPEAT), + sep: if matches.is_present(options::ZERO_TERMINATED) { + 0x00_u8 + } else { + 0x0a_u8 + }, + }; + + match mode { + Mode::Echo(args) => { + let mut evec = args.iter().map(String::as_bytes).collect::>(); + find_seps(&mut evec, options.sep); + shuf_bytes(&mut evec, options); + } + Mode::InputRange((b, e)) => { + let rvec = (b..e).map(|x| format!("{}", x)).collect::>(); + let mut rvec = rvec.iter().map(String::as_bytes).collect::>(); + shuf_bytes(&mut rvec, options); + } + Mode::Default(filename) => { + let fdata = read_input_file(&filename); + let mut fdata = vec![&fdata[..]]; + find_seps(&mut fdata, options.sep); + shuf_bytes(&mut fdata, options); + } + } + + 0 +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .name(NAME) .version(crate_version!()) .template(TEMPLATE) @@ -118,62 +177,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("line delimiter is NUL, not newline"), ) .arg(Arg::with_name(options::FILE).takes_value(true)) - .get_matches_from(args); - - let mode = if let Some(args) = matches.values_of(options::ECHO) { - Mode::Echo(args.map(String::from).collect()) - } else if let Some(range) = matches.value_of(options::INPUT_RANGE) { - match parse_range(range) { - Ok(m) => Mode::InputRange(m), - Err(msg) => { - crash!(1, "{}", msg); - } - } - } else { - Mode::Default(matches.value_of(options::FILE).unwrap_or("-").to_string()) - }; - - let options = Options { - head_count: match matches.value_of(options::HEAD_COUNT) { - Some(count) => match count.parse::() { - Ok(val) => val, - Err(_) => { - show_error!("invalid line count: '{}'", count); - return 1; - } - }, - None => std::usize::MAX, - }, - output: matches.value_of(options::OUTPUT).map(String::from), - random_source: matches.value_of(options::RANDOM_SOURCE).map(String::from), - repeat: matches.is_present(options::REPEAT), - sep: if matches.is_present(options::ZERO_TERMINATED) { - 0x00_u8 - } else { - 0x0a_u8 - }, - }; - - match mode { - Mode::Echo(args) => { - let mut evec = args.iter().map(String::as_bytes).collect::>(); - find_seps(&mut evec, options.sep); - shuf_bytes(&mut evec, options); - } - Mode::InputRange((b, e)) => { - let rvec = (b..e).map(|x| format!("{}", x)).collect::>(); - let mut rvec = rvec.iter().map(String::as_bytes).collect::>(); - shuf_bytes(&mut rvec, options); - } - Mode::Default(filename) => { - let fdata = read_input_file(&filename); - let mut fdata = vec![&fdata[..]]; - find_seps(&mut fdata, options.sep); - shuf_bytes(&mut fdata, options); - } - } - - 0 } fn read_input_file(filename: &str) -> Vec { diff --git a/src/uu/sleep/src/sleep.rs b/src/uu/sleep/src/sleep.rs index c78c1cfc9..ada3336df 100644 --- a/src/uu/sleep/src/sleep.rs +++ b/src/uu/sleep/src/sleep.rs @@ -35,10 +35,20 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) + let matches = uu_app().usage(&usage[..]).get_matches_from(args); + + if let Some(values) = matches.values_of(options::NUMBER) { + let numbers = values.collect(); + sleep(numbers); + } + + 0 +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .version(crate_version!()) .about(ABOUT) - .usage(&usage[..]) .after_help(LONG_HELP) .arg( Arg::with_name(options::NUMBER) @@ -49,14 +59,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .multiple(true) .required(true), ) - .get_matches_from(args); - - if let Some(values) = matches.values_of(options::NUMBER) { - let numbers = values.collect(); - sleep(numbers); - } - - 0 } fn sleep(args: Vec<&str>) { diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index d0e574627..fb0241945 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -944,10 +944,170 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let mut settings: GlobalSettings = Default::default(); - let matches = App::new(executable!()) + let matches = uu_app().usage(&usage[..]).get_matches_from(args); + + settings.debug = matches.is_present(options::DEBUG); + + // check whether user specified a zero terminated list of files for input, otherwise read files from args + let mut files: Vec = if matches.is_present(options::FILES0_FROM) { + let files0_from: Vec = matches + .values_of(options::FILES0_FROM) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + + let mut files = Vec::new(); + for path in &files0_from { + let reader = open(path.as_str()); + let buf_reader = BufReader::new(reader); + for line in buf_reader.split(b'\0').flatten() { + files.push( + std::str::from_utf8(&line) + .expect("Could not parse string from zero terminated input.") + .to_string(), + ); + } + } + files + } else { + matches + .values_of(options::FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default() + }; + + settings.mode = if matches.is_present(options::modes::HUMAN_NUMERIC) + || matches.value_of(options::modes::SORT) == Some("human-numeric") + { + SortMode::HumanNumeric + } else if matches.is_present(options::modes::MONTH) + || matches.value_of(options::modes::SORT) == Some("month") + { + SortMode::Month + } else if matches.is_present(options::modes::GENERAL_NUMERIC) + || matches.value_of(options::modes::SORT) == Some("general-numeric") + { + SortMode::GeneralNumeric + } else if matches.is_present(options::modes::NUMERIC) + || matches.value_of(options::modes::SORT) == Some("numeric") + { + SortMode::Numeric + } else if matches.is_present(options::modes::VERSION) + || matches.value_of(options::modes::SORT) == Some("version") + { + SortMode::Version + } else if matches.is_present(options::modes::RANDOM) + || matches.value_of(options::modes::SORT) == Some("random") + { + settings.salt = get_rand_string(); + SortMode::Random + } else { + SortMode::Default + }; + + settings.dictionary_order = matches.is_present(options::DICTIONARY_ORDER); + settings.ignore_non_printing = matches.is_present(options::IGNORE_NONPRINTING); + if matches.is_present(options::PARALLEL) { + // "0" is default - threads = num of cores + settings.threads = matches + .value_of(options::PARALLEL) + .map(String::from) + .unwrap_or_else(|| "0".to_string()); + env::set_var("RAYON_NUM_THREADS", &settings.threads); + } + + settings.buffer_size = matches + .value_of(options::BUF_SIZE) + .map_or(DEFAULT_BUF_SIZE, |s| { + GlobalSettings::parse_byte_count(s) + .unwrap_or_else(|e| crash!(2, "{}", format_error_message(e, s, options::BUF_SIZE))) + }); + + settings.tmp_dir = matches + .value_of(options::TMP_DIR) + .map(PathBuf::from) + .unwrap_or_else(env::temp_dir); + + settings.compress_prog = matches.value_of(options::COMPRESS_PROG).map(String::from); + + if let Some(n_merge) = matches.value_of(options::BATCH_SIZE) { + settings.merge_batch_size = n_merge + .parse() + .unwrap_or_else(|_| crash!(2, "invalid --batch-size argument '{}'", n_merge)); + } + + settings.zero_terminated = matches.is_present(options::ZERO_TERMINATED); + settings.merge = matches.is_present(options::MERGE); + + settings.check = matches.is_present(options::check::CHECK); + if matches.is_present(options::check::CHECK_SILENT) + || matches!( + matches.value_of(options::check::CHECK), + Some(options::check::SILENT) | Some(options::check::QUIET) + ) + { + settings.check_silent = true; + settings.check = true; + }; + + settings.ignore_case = matches.is_present(options::IGNORE_CASE); + + settings.ignore_leading_blanks = matches.is_present(options::IGNORE_LEADING_BLANKS); + + settings.output_file = matches.value_of(options::OUTPUT).map(String::from); + settings.reverse = matches.is_present(options::REVERSE); + settings.stable = matches.is_present(options::STABLE); + settings.unique = matches.is_present(options::UNIQUE); + + if files.is_empty() { + /* if no file, default to stdin */ + files.push("-".to_owned()); + } else if settings.check && files.len() != 1 { + crash!(1, "extra operand `{}' not allowed with -c", files[1]) + } + + if let Some(arg) = matches.args.get(options::SEPARATOR) { + let separator = arg.vals[0].to_string_lossy(); + let separator = separator; + if separator.len() != 1 { + crash!(1, "separator must be exactly one character long"); + } + settings.separator = Some(separator.chars().next().unwrap()) + } + + if let Some(values) = matches.values_of(options::KEY) { + for value in values { + settings + .selectors + .push(FieldSelector::parse(value, &settings)); + } + } + + if !matches.is_present(options::KEY) { + // add a default selector matching the whole line + let key_settings = KeySettings::from(&settings); + settings.selectors.push( + FieldSelector::new( + KeyPosition { + field: 1, + char: 1, + ignore_blanks: key_settings.ignore_blanks, + }, + None, + key_settings, + ) + .unwrap(), + ); + } + + settings.init_precomputed(); + + exec(&files, &settings) +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .version(crate_version!()) .about(ABOUT) - .usage(&usage[..]) .arg( Arg::with_name(options::modes::SORT) .long(options::modes::SORT) @@ -1169,164 +1329,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("underline the parts of the line that are actually used for sorting"), ) .arg(Arg::with_name(options::FILES).multiple(true).takes_value(true)) - .get_matches_from(args); - - settings.debug = matches.is_present(options::DEBUG); - - // check whether user specified a zero terminated list of files for input, otherwise read files from args - let mut files: Vec = if matches.is_present(options::FILES0_FROM) { - let files0_from: Vec = matches - .values_of(options::FILES0_FROM) - .map(|v| v.map(ToString::to_string).collect()) - .unwrap_or_default(); - - let mut files = Vec::new(); - for path in &files0_from { - let reader = open(path.as_str()); - let buf_reader = BufReader::new(reader); - for line in buf_reader.split(b'\0').flatten() { - files.push( - std::str::from_utf8(&line) - .expect("Could not parse string from zero terminated input.") - .to_string(), - ); - } - } - files - } else { - matches - .values_of(options::FILES) - .map(|v| v.map(ToString::to_string).collect()) - .unwrap_or_default() - }; - - settings.mode = if matches.is_present(options::modes::HUMAN_NUMERIC) - || matches.value_of(options::modes::SORT) == Some("human-numeric") - { - SortMode::HumanNumeric - } else if matches.is_present(options::modes::MONTH) - || matches.value_of(options::modes::SORT) == Some("month") - { - SortMode::Month - } else if matches.is_present(options::modes::GENERAL_NUMERIC) - || matches.value_of(options::modes::SORT) == Some("general-numeric") - { - SortMode::GeneralNumeric - } else if matches.is_present(options::modes::NUMERIC) - || matches.value_of(options::modes::SORT) == Some("numeric") - { - SortMode::Numeric - } else if matches.is_present(options::modes::VERSION) - || matches.value_of(options::modes::SORT) == Some("version") - { - SortMode::Version - } else if matches.is_present(options::modes::RANDOM) - || matches.value_of(options::modes::SORT) == Some("random") - { - settings.salt = get_rand_string(); - SortMode::Random - } else { - SortMode::Default - }; - - settings.dictionary_order = matches.is_present(options::DICTIONARY_ORDER); - settings.ignore_non_printing = matches.is_present(options::IGNORE_NONPRINTING); - if matches.is_present(options::PARALLEL) { - // "0" is default - threads = num of cores - settings.threads = matches - .value_of(options::PARALLEL) - .map(String::from) - .unwrap_or_else(|| "0".to_string()); - env::set_var("RAYON_NUM_THREADS", &settings.threads); - } - - settings.buffer_size = matches - .value_of(options::BUF_SIZE) - .map_or(DEFAULT_BUF_SIZE, |s| { - GlobalSettings::parse_byte_count(s) - .unwrap_or_else(|e| crash!(2, "{}", format_error_message(e, s, options::BUF_SIZE))) - }); - - settings.tmp_dir = matches - .value_of(options::TMP_DIR) - .map(PathBuf::from) - .unwrap_or_else(env::temp_dir); - - settings.compress_prog = matches.value_of(options::COMPRESS_PROG).map(String::from); - - if let Some(n_merge) = matches.value_of(options::BATCH_SIZE) { - settings.merge_batch_size = n_merge - .parse() - .unwrap_or_else(|_| crash!(2, "invalid --batch-size argument '{}'", n_merge)); - } - - settings.zero_terminated = matches.is_present(options::ZERO_TERMINATED); - settings.merge = matches.is_present(options::MERGE); - - settings.check = matches.is_present(options::check::CHECK); - if matches.is_present(options::check::CHECK_SILENT) - || matches!( - matches.value_of(options::check::CHECK), - Some(options::check::SILENT) | Some(options::check::QUIET) - ) - { - settings.check_silent = true; - settings.check = true; - }; - - settings.ignore_case = matches.is_present(options::IGNORE_CASE); - - settings.ignore_leading_blanks = matches.is_present(options::IGNORE_LEADING_BLANKS); - - settings.output_file = matches.value_of(options::OUTPUT).map(String::from); - settings.reverse = matches.is_present(options::REVERSE); - settings.stable = matches.is_present(options::STABLE); - settings.unique = matches.is_present(options::UNIQUE); - - if files.is_empty() { - /* if no file, default to stdin */ - files.push("-".to_owned()); - } else if settings.check && files.len() != 1 { - crash!(1, "extra operand `{}' not allowed with -c", files[1]) - } - - if let Some(arg) = matches.args.get(options::SEPARATOR) { - let separator = arg.vals[0].to_string_lossy(); - let separator = separator; - if separator.len() != 1 { - crash!(1, "separator must be exactly one character long"); - } - settings.separator = Some(separator.chars().next().unwrap()) - } - - if let Some(values) = matches.values_of(options::KEY) { - for value in values { - settings - .selectors - .push(FieldSelector::parse(value, &settings)); - } - } - - if !matches.is_present(options::KEY) { - // add a default selector matching the whole line - let key_settings = KeySettings::from(&settings); - settings.selectors.push( - FieldSelector::new( - KeyPosition { - field: 1, - char: 1, - ignore_blanks: key_settings.ignore_blanks, - }, - None, - key_settings, - ) - .unwrap(), - ); - } - - settings.init_precomputed(); - - exec(&files, &settings) } fn exec(files: &[String], settings: &GlobalSettings) -> i32 { diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index ad5c083aa..ccc98ee5e 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -30,7 +30,7 @@ static OPT_ADDITIONAL_SUFFIX: &str = "additional-suffix"; static OPT_FILTER: &str = "filter"; static OPT_NUMERIC_SUFFIXES: &str = "numeric-suffixes"; static OPT_SUFFIX_LENGTH: &str = "suffix-length"; -static OPT_DEFAULT_SUFFIX_LENGTH: usize = 2; +static OPT_DEFAULT_SUFFIX_LENGTH: &str = "2"; static OPT_VERBOSE: &str = "verbose"; static ARG_INPUT: &str = "input"; @@ -54,85 +54,10 @@ size is 1000, and default PREFIX is 'x'. With no INPUT, or when INPUT is pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let long_usage = get_long_usage(); - let default_suffix_length_str = OPT_DEFAULT_SUFFIX_LENGTH.to_string(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about("Create output files containing consecutive or interleaved sections of input") + let matches = uu_app() .usage(&usage[..]) .after_help(&long_usage[..]) - // strategy (mutually exclusive) - .arg( - Arg::with_name(OPT_BYTES) - .short("b") - .long(OPT_BYTES) - .takes_value(true) - .default_value("2") - .help("use suffixes of length N (default 2)"), - ) - .arg( - Arg::with_name(OPT_LINE_BYTES) - .short("C") - .long(OPT_LINE_BYTES) - .takes_value(true) - .default_value("2") - .help("put at most SIZE bytes of lines per output file"), - ) - .arg( - Arg::with_name(OPT_LINES) - .short("l") - .long(OPT_LINES) - .takes_value(true) - .default_value("1000") - .help("write to shell COMMAND file name is $FILE (Currently not implemented for Windows)"), - ) - // rest of the arguments - .arg( - Arg::with_name(OPT_ADDITIONAL_SUFFIX) - .long(OPT_ADDITIONAL_SUFFIX) - .takes_value(true) - .default_value("") - .help("additional suffix to append to output file names"), - ) - .arg( - Arg::with_name(OPT_FILTER) - .long(OPT_FILTER) - .takes_value(true) - .help("write to shell COMMAND file name is $FILE (Currently not implemented for Windows)"), - ) - .arg( - Arg::with_name(OPT_NUMERIC_SUFFIXES) - .short("d") - .long(OPT_NUMERIC_SUFFIXES) - .takes_value(true) - .default_value("0") - .help("use numeric suffixes instead of alphabetic"), - ) - .arg( - Arg::with_name(OPT_SUFFIX_LENGTH) - .short("a") - .long(OPT_SUFFIX_LENGTH) - .takes_value(true) - .default_value(default_suffix_length_str.as_str()) - .help("use suffixes of length N (default 2)"), - ) - .arg( - Arg::with_name(OPT_VERBOSE) - .long(OPT_VERBOSE) - .help("print a diagnostic just before each output file is opened"), - ) - .arg( - Arg::with_name(ARG_INPUT) - .takes_value(true) - .default_value("-") - .index(1) - ) - .arg( - Arg::with_name(ARG_PREFIX) - .takes_value(true) - .default_value("x") - .index(2) - ) .get_matches_from(args); let mut settings = Settings { @@ -201,6 +126,84 @@ pub fn uumain(args: impl uucore::Args) -> i32 { split(&settings) } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about("Create output files containing consecutive or interleaved sections of input") + // strategy (mutually exclusive) + .arg( + Arg::with_name(OPT_BYTES) + .short("b") + .long(OPT_BYTES) + .takes_value(true) + .default_value("2") + .help("use suffixes of length N (default 2)"), + ) + .arg( + Arg::with_name(OPT_LINE_BYTES) + .short("C") + .long(OPT_LINE_BYTES) + .takes_value(true) + .default_value("2") + .help("put at most SIZE bytes of lines per output file"), + ) + .arg( + Arg::with_name(OPT_LINES) + .short("l") + .long(OPT_LINES) + .takes_value(true) + .default_value("1000") + .help("write to shell COMMAND file name is $FILE (Currently not implemented for Windows)"), + ) + // rest of the arguments + .arg( + Arg::with_name(OPT_ADDITIONAL_SUFFIX) + .long(OPT_ADDITIONAL_SUFFIX) + .takes_value(true) + .default_value("") + .help("additional suffix to append to output file names"), + ) + .arg( + Arg::with_name(OPT_FILTER) + .long(OPT_FILTER) + .takes_value(true) + .help("write to shell COMMAND file name is $FILE (Currently not implemented for Windows)"), + ) + .arg( + Arg::with_name(OPT_NUMERIC_SUFFIXES) + .short("d") + .long(OPT_NUMERIC_SUFFIXES) + .takes_value(true) + .default_value("0") + .help("use numeric suffixes instead of alphabetic"), + ) + .arg( + Arg::with_name(OPT_SUFFIX_LENGTH) + .short("a") + .long(OPT_SUFFIX_LENGTH) + .takes_value(true) + .default_value(OPT_DEFAULT_SUFFIX_LENGTH) + .help("use suffixes of length N (default 2)"), + ) + .arg( + Arg::with_name(OPT_VERBOSE) + .long(OPT_VERBOSE) + .help("print a diagnostic just before each output file is opened"), + ) + .arg( + Arg::with_name(ARG_INPUT) + .takes_value(true) + .default_value("-") + .index(1) + ) + .arg( + Arg::with_name(ARG_PREFIX) + .takes_value(true) + .default_value("x") + .index(2) + ) +} + #[allow(dead_code)] struct Settings { prefix: String, diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 7bf3db4c2..70c06bdf6 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -947,11 +947,24 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let long_usage = get_long_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) + let matches = uu_app() .usage(&usage[..]) .after_help(&long_usage[..]) + .get_matches_from(args); + + match Stater::new(matches) { + Ok(stater) => stater.exec(), + Err(e) => { + show_error!("{}", e); + 1 + } + } +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) .arg( Arg::with_name(options::DEREFERENCE) .short("L") @@ -996,13 +1009,4 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .min_values(1), ) - .get_matches_from(args); - - match Stater::new(matches) { - Ok(stater) => stater.exec(), - Err(e) => { - show_error!("{}", e); - 1 - } - } } diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index fc0c83ec8..7460a2cb2 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -154,10 +154,40 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .accept_any(); let usage = get_usage(); - let matches = App::new(executable!()) + let matches = uu_app().usage(&usage[..]).get_matches_from(args); + + let options = ProgramOptions::try_from(&matches) + .unwrap_or_else(|e| crash!(125, "{}\nTry 'stdbuf --help' for more information.", e.0)); + + let mut command_values = matches.values_of::<&str>(options::COMMAND).unwrap(); + let mut command = Command::new(command_values.next().unwrap()); + let command_params: Vec<&str> = command_values.collect(); + + let mut tmp_dir = tempdir().unwrap(); + let (preload_env, libstdbuf) = return_if_err!(1, get_preload_env(&mut tmp_dir)); + command.env(preload_env, libstdbuf); + set_command_env(&mut command, "_STDBUF_I", options.stdin); + set_command_env(&mut command, "_STDBUF_O", options.stdout); + set_command_env(&mut command, "_STDBUF_E", options.stderr); + command.args(command_params); + + let mut process = match command.spawn() { + Ok(p) => p, + Err(e) => crash!(1, "failed to execute process: {}", e), + }; + match process.wait() { + Ok(status) => match status.code() { + Some(i) => i, + None => crash!(1, "process killed by signal {}", status.signal().unwrap()), + }, + Err(e) => crash!(1, "{}", e), + } +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .version(crate_version!()) .about(ABOUT) - .usage(&usage[..]) .after_help(LONG_HELP) .setting(AppSettings::TrailingVarArg) .arg( @@ -191,32 +221,4 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .hidden(true) .required(true), ) - .get_matches_from(args); - - let options = ProgramOptions::try_from(&matches) - .unwrap_or_else(|e| crash!(125, "{}\nTry 'stdbuf --help' for more information.", e.0)); - - let mut command_values = matches.values_of::<&str>(options::COMMAND).unwrap(); - let mut command = Command::new(command_values.next().unwrap()); - let command_params: Vec<&str> = command_values.collect(); - - let mut tmp_dir = tempdir().unwrap(); - let (preload_env, libstdbuf) = return_if_err!(1, get_preload_env(&mut tmp_dir)); - command.env(preload_env, libstdbuf); - set_command_env(&mut command, "_STDBUF_I", options.stdin); - set_command_env(&mut command, "_STDBUF_O", options.stdout); - set_command_env(&mut command, "_STDBUF_E", options.stderr); - command.args(command_params); - - let mut process = match command.spawn() { - Ok(p) => p, - Err(e) => crash!(1, "failed to execute process: {}", e), - }; - match process.wait() { - Ok(status) => match status.code() { - Some(i) => i, - None => crash!(1, "process killed by signal {}", status.signal().unwrap()), - }, - Err(e) => crash!(1, "{}", e), - } } diff --git a/src/uu/sum/src/sum.rs b/src/uu/sum/src/sum.rs index 4d42d7a97..0ce612859 100644 --- a/src/uu/sum/src/sum.rs +++ b/src/uu/sum/src/sum.rs @@ -98,24 +98,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); - let matches = App::new(executable!()) - .name(NAME) - .version(crate_version!()) - .usage(USAGE) - .about(SUMMARY) - .arg(Arg::with_name(options::FILE).multiple(true).hidden(true)) - .arg( - Arg::with_name(options::BSD_COMPATIBLE) - .short(options::BSD_COMPATIBLE) - .help("use the BSD sum algorithm, use 1K blocks (default)"), - ) - .arg( - Arg::with_name(options::SYSTEM_V_COMPATIBLE) - .short("s") - .long(options::SYSTEM_V_COMPATIBLE) - .help("use System V sum algorithm, use 512 bytes blocks"), - ) - .get_matches_from(args); + let matches = uu_app().get_matches_from(args); let files: Vec = match matches.values_of(options::FILE) { Some(v) => v.clone().map(|v| v.to_owned()).collect(), @@ -155,3 +138,23 @@ pub fn uumain(args: impl uucore::Args) -> i32 { exit_code } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .name(NAME) + .version(crate_version!()) + .usage(USAGE) + .about(SUMMARY) + .arg(Arg::with_name(options::FILE).multiple(true).hidden(true)) + .arg( + Arg::with_name(options::BSD_COMPATIBLE) + .short(options::BSD_COMPATIBLE) + .help("use the BSD sum algorithm, use 1K blocks (default)"), + ) + .arg( + Arg::with_name(options::SYSTEM_V_COMPATIBLE) + .short("s") + .long(options::SYSTEM_V_COMPATIBLE) + .help("use System V sum algorithm, use 512 bytes blocks"), + ) +} diff --git a/src/uu/sync/src/sync.rs b/src/uu/sync/src/sync.rs index 53d1a5701..4fcdf49f9 100644 --- a/src/uu/sync/src/sync.rs +++ b/src/uu/sync/src/sync.rs @@ -166,26 +166,7 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(options::FILE_SYSTEM) - .short("f") - .long(options::FILE_SYSTEM) - .conflicts_with(options::DATA) - .help("sync the file systems that contain the files (Linux and Windows only)"), - ) - .arg( - Arg::with_name(options::DATA) - .short("d") - .long(options::DATA) - .conflicts_with(options::FILE_SYSTEM) - .help("sync only file data, no unneeded metadata (Linux only)"), - ) - .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let files: Vec = matches .values_of(ARG_FILES) @@ -211,6 +192,27 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(options::FILE_SYSTEM) + .short("f") + .long(options::FILE_SYSTEM) + .conflicts_with(options::DATA) + .help("sync the file systems that contain the files (Linux and Windows only)"), + ) + .arg( + Arg::with_name(options::DATA) + .short("d") + .long(options::DATA) + .conflicts_with(options::FILE_SYSTEM) + .help("sync only file data, no unneeded metadata (Linux only)"), + ) + .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) +} + fn sync() -> isize { unsafe { platform::do_sync() } } diff --git a/src/uu/tac/src/tac.rs b/src/uu/tac/src/tac.rs index be1852ec5..ae1fd9bc5 100644 --- a/src/uu/tac/src/tac.rs +++ b/src/uu/tac/src/tac.rs @@ -31,7 +31,31 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); - let matches = App::new(executable!()) + let matches = uu_app().get_matches_from(args); + + let before = matches.is_present(options::BEFORE); + let regex = matches.is_present(options::REGEX); + let separator = match matches.value_of(options::SEPARATOR) { + Some(m) => { + if m.is_empty() { + crash!(1, "separator cannot be empty") + } else { + m.to_owned() + } + } + None => "\n".to_owned(), + }; + + let files: Vec = match matches.values_of(options::FILE) { + Some(v) => v.map(|v| v.to_owned()).collect(), + None => vec!["-".to_owned()], + }; + + tac(files, before, regex, &separator[..]) +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .name(NAME) .version(crate_version!()) .usage(USAGE) @@ -58,27 +82,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true), ) .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) - .get_matches_from(args); - - let before = matches.is_present(options::BEFORE); - let regex = matches.is_present(options::REGEX); - let separator = match matches.value_of(options::SEPARATOR) { - Some(m) => { - if m.is_empty() { - crash!(1, "separator cannot be empty") - } else { - m.to_owned() - } - } - None => "\n".to_owned(), - }; - - let files: Vec = match matches.values_of(options::FILE) { - Some(v) => v.map(|v| v.to_owned()).collect(), - None => vec!["-".to_owned()], - }; - - tac(files, before, regex, &separator[..]) } fn tac(filenames: Vec, before: bool, _: bool, separator: &str) -> i32 { diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 8950886a2..4970cdcc2 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -72,74 +72,7 @@ impl Default for Settings { pub fn uumain(args: impl uucore::Args) -> i32 { let mut settings: Settings = Default::default(); - let app = App::new(executable!()) - .version(crate_version!()) - .about("output the last part of files") - // TODO: add usage - .arg( - Arg::with_name(options::BYTES) - .short("c") - .long(options::BYTES) - .takes_value(true) - .allow_hyphen_values(true) - .overrides_with_all(&[options::BYTES, options::LINES]) - .help("Number of bytes to print"), - ) - .arg( - Arg::with_name(options::FOLLOW) - .short("f") - .long(options::FOLLOW) - .help("Print the file as it grows"), - ) - .arg( - Arg::with_name(options::LINES) - .short("n") - .long(options::LINES) - .takes_value(true) - .allow_hyphen_values(true) - .overrides_with_all(&[options::BYTES, options::LINES]) - .help("Number of lines to print"), - ) - .arg( - Arg::with_name(options::PID) - .long(options::PID) - .takes_value(true) - .help("with -f, terminate after process ID, PID dies"), - ) - .arg( - Arg::with_name(options::verbosity::QUIET) - .short("q") - .long(options::verbosity::QUIET) - .visible_alias("silent") - .overrides_with_all(&[options::verbosity::QUIET, options::verbosity::VERBOSE]) - .help("never output headers giving file names"), - ) - .arg( - Arg::with_name(options::SLEEP_INT) - .short("s") - .takes_value(true) - .long(options::SLEEP_INT) - .help("Number or seconds to sleep between polling the file when running with -f"), - ) - .arg( - Arg::with_name(options::verbosity::VERBOSE) - .short("v") - .long(options::verbosity::VERBOSE) - .overrides_with_all(&[options::verbosity::QUIET, options::verbosity::VERBOSE]) - .help("always output headers giving file names"), - ) - .arg( - Arg::with_name(options::ZERO_TERM) - .short("z") - .long(options::ZERO_TERM) - .help("Line delimiter is NUL, not newline"), - ) - .arg( - Arg::with_name(options::ARG_FILES) - .multiple(true) - .takes_value(true) - .min_values(1), - ); + let app = uu_app(); let matches = app.get_matches_from(args); @@ -244,6 +177,77 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about("output the last part of files") + // TODO: add usage + .arg( + Arg::with_name(options::BYTES) + .short("c") + .long(options::BYTES) + .takes_value(true) + .allow_hyphen_values(true) + .overrides_with_all(&[options::BYTES, options::LINES]) + .help("Number of bytes to print"), + ) + .arg( + Arg::with_name(options::FOLLOW) + .short("f") + .long(options::FOLLOW) + .help("Print the file as it grows"), + ) + .arg( + Arg::with_name(options::LINES) + .short("n") + .long(options::LINES) + .takes_value(true) + .allow_hyphen_values(true) + .overrides_with_all(&[options::BYTES, options::LINES]) + .help("Number of lines to print"), + ) + .arg( + Arg::with_name(options::PID) + .long(options::PID) + .takes_value(true) + .help("with -f, terminate after process ID, PID dies"), + ) + .arg( + Arg::with_name(options::verbosity::QUIET) + .short("q") + .long(options::verbosity::QUIET) + .visible_alias("silent") + .overrides_with_all(&[options::verbosity::QUIET, options::verbosity::VERBOSE]) + .help("never output headers giving file names"), + ) + .arg( + Arg::with_name(options::SLEEP_INT) + .short("s") + .takes_value(true) + .long(options::SLEEP_INT) + .help("Number or seconds to sleep between polling the file when running with -f"), + ) + .arg( + Arg::with_name(options::verbosity::VERBOSE) + .short("v") + .long(options::verbosity::VERBOSE) + .overrides_with_all(&[options::verbosity::QUIET, options::verbosity::VERBOSE]) + .help("always output headers giving file names"), + ) + .arg( + Arg::with_name(options::ZERO_TERM) + .short("z") + .long(options::ZERO_TERM) + .help("Line delimiter is NUL, not newline"), + ) + .arg( + Arg::with_name(options::ARG_FILES) + .multiple(true) + .takes_value(true) + .min_values(1), + ) +} + fn follow(readers: &mut [BufReader], filenames: &[String], settings: &Settings) { assert!(settings.follow); let mut last = readers.len() - 1; diff --git a/src/uu/tee/src/tee.rs b/src/uu/tee/src/tee.rs index f5f24d944..a207dee63 100644 --- a/src/uu/tee/src/tee.rs +++ b/src/uu/tee/src/tee.rs @@ -39,25 +39,7 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .after_help("If a FILE is -, it refers to a file named - .") - .arg( - Arg::with_name(options::APPEND) - .long(options::APPEND) - .short("a") - .help("append to the given FILEs, do not overwrite"), - ) - .arg( - Arg::with_name(options::IGNORE_INTERRUPTS) - .long(options::IGNORE_INTERRUPTS) - .short("i") - .help("ignore interrupt signals (ignored on non-Unix platforms)"), - ) - .arg(Arg::with_name(options::FILE).multiple(true)) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let options = Options { append: matches.is_present(options::APPEND), @@ -74,6 +56,26 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .after_help("If a FILE is -, it refers to a file named - .") + .arg( + Arg::with_name(options::APPEND) + .long(options::APPEND) + .short("a") + .help("append to the given FILEs, do not overwrite"), + ) + .arg( + Arg::with_name(options::IGNORE_INTERRUPTS) + .long(options::IGNORE_INTERRUPTS) + .short("i") + .help("ignore interrupt signals (ignored on non-Unix platforms)"), + ) + .arg(Arg::with_name(options::FILE).multiple(true)) +} + #[cfg(unix)] fn ignore_interrupts() -> Result<()> { let ret = unsafe { libc::signal(libc::SIGINT, libc::SIG_IGN) }; diff --git a/src/uu/test/Cargo.toml b/src/uu/test/Cargo.toml index e1f6e62e7..cd0282a45 100644 --- a/src/uu/test/Cargo.toml +++ b/src/uu/test/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/test.rs" [dependencies] +clap = "2.33.3" libc = "0.2.42" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/test/src/test.rs b/src/uu/test/src/test.rs index 107ad2df4..dba840d3c 100644 --- a/src/uu/test/src/test.rs +++ b/src/uu/test/src/test.rs @@ -10,9 +10,17 @@ mod parser; +use clap::{App, AppSettings}; use parser::{parse, Symbol}; use std::ffi::{OsStr, OsString}; use std::path::Path; +use uucore::executable; + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .setting(AppSettings::DisableHelpFlags) + .setting(AppSettings::DisableVersion) +} pub fn uumain(mut args: impl uucore::Args) -> i32 { let program = args.next().unwrap_or_else(|| OsString::from("test")); diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index f21a0265f..464414c5e 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -102,9 +102,25 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let app = App::new("timeout") + let app = uu_app().usage(&usage[..]); + + let matches = app.get_matches_from(args); + + let config = Config::from(matches); + timeout( + &config.command, + config.duration, + config.signal, + config.kill_after, + config.foreground, + config.preserve_status, + config.verbose, + ) +} + +pub fn uu_app() -> App<'static, 'static> { + App::new("timeout") .version(crate_version!()) - .usage(&usage[..]) .about(ABOUT) .arg( Arg::with_name(options::FOREGROUND) @@ -144,20 +160,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .required(true) .multiple(true) ) - .setting(AppSettings::TrailingVarArg); - - let matches = app.get_matches_from(args); - - let config = Config::from(matches); - timeout( - &config.command, - config.duration, - config.signal, - config.kill_after, - config.foreground, - config.preserve_status, - config.verbose, - ) + .setting(AppSettings::TrailingVarArg) } /// Remove pre-existing SIGCHLD handlers that would make waiting for the child's exit code fail. diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 2e1c3c8e8..3e9ff5624 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -55,80 +55,7 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(options::ACCESS) - .short("a") - .help("change only the access time"), - ) - .arg( - Arg::with_name(options::sources::CURRENT) - .short("t") - .help("use [[CC]YY]MMDDhhmm[.ss] instead of the current time") - .value_name("STAMP") - .takes_value(true), - ) - .arg( - Arg::with_name(options::sources::DATE) - .short("d") - .long(options::sources::DATE) - .help("parse argument and use it instead of current time") - .value_name("STRING"), - ) - .arg( - Arg::with_name(options::MODIFICATION) - .short("m") - .help("change only the modification time"), - ) - .arg( - Arg::with_name(options::NO_CREATE) - .short("c") - .long(options::NO_CREATE) - .help("do not create any files"), - ) - .arg( - Arg::with_name(options::NO_DEREF) - .short("h") - .long(options::NO_DEREF) - .help( - "affect each symbolic link instead of any referenced file \ - (only for systems that can change the timestamps of a symlink)", - ), - ) - .arg( - Arg::with_name(options::sources::REFERENCE) - .short("r") - .long(options::sources::REFERENCE) - .help("use this file's times instead of the current time") - .value_name("FILE"), - ) - .arg( - Arg::with_name(options::TIME) - .long(options::TIME) - .help( - "change only the specified time: \"access\", \"atime\", or \ - \"use\" are equivalent to -a; \"modify\" or \"mtime\" are \ - equivalent to -m", - ) - .value_name("WORD") - .possible_values(&["access", "atime", "use"]) - .takes_value(true), - ) - .arg( - Arg::with_name(ARG_FILES) - .multiple(true) - .takes_value(true) - .min_values(1), - ) - .group(ArgGroup::with_name(options::SOURCES).args(&[ - options::sources::CURRENT, - options::sources::DATE, - options::sources::REFERENCE, - ])) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let files: Vec = matches .values_of(ARG_FILES) @@ -236,6 +163,81 @@ pub fn uumain(args: impl uucore::Args) -> i32 { error_code } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(options::ACCESS) + .short("a") + .help("change only the access time"), + ) + .arg( + Arg::with_name(options::sources::CURRENT) + .short("t") + .help("use [[CC]YY]MMDDhhmm[.ss] instead of the current time") + .value_name("STAMP") + .takes_value(true), + ) + .arg( + Arg::with_name(options::sources::DATE) + .short("d") + .long(options::sources::DATE) + .help("parse argument and use it instead of current time") + .value_name("STRING"), + ) + .arg( + Arg::with_name(options::MODIFICATION) + .short("m") + .help("change only the modification time"), + ) + .arg( + Arg::with_name(options::NO_CREATE) + .short("c") + .long(options::NO_CREATE) + .help("do not create any files"), + ) + .arg( + Arg::with_name(options::NO_DEREF) + .short("h") + .long(options::NO_DEREF) + .help( + "affect each symbolic link instead of any referenced file \ + (only for systems that can change the timestamps of a symlink)", + ), + ) + .arg( + Arg::with_name(options::sources::REFERENCE) + .short("r") + .long(options::sources::REFERENCE) + .help("use this file's times instead of the current time") + .value_name("FILE"), + ) + .arg( + Arg::with_name(options::TIME) + .long(options::TIME) + .help( + "change only the specified time: \"access\", \"atime\", or \ + \"use\" are equivalent to -a; \"modify\" or \"mtime\" are \ + equivalent to -m", + ) + .value_name("WORD") + .possible_values(&["access", "atime", "use"]) + .takes_value(true), + ) + .arg( + Arg::with_name(ARG_FILES) + .multiple(true) + .takes_value(true) + .min_values(1), + ) + .group(ArgGroup::with_name(options::SOURCES).args(&[ + options::sources::CURRENT, + options::sources::DATE, + options::sources::REFERENCE, + ])) +} + fn stat(path: &str, follow: bool) -> (FileTime, FileTime) { let metadata = if follow { fs::symlink_metadata(path) diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index 9916af7db..28ce70c22 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -249,46 +249,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let after_help = get_long_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) + let matches = uu_app() .usage(&usage[..]) .after_help(&after_help[..]) - .arg( - Arg::with_name(options::COMPLEMENT) - // .visible_short_alias('C') // TODO: requires clap "3.0.0-beta.2" - .short("c") - .long(options::COMPLEMENT) - .help("use the complement of SET1"), - ) - .arg( - Arg::with_name("C") // work around for `Arg::visible_short_alias` - .short("C") - .help("same as -c"), - ) - .arg( - Arg::with_name(options::DELETE) - .short("d") - .long(options::DELETE) - .help("delete characters in SET1, do not translate"), - ) - .arg( - Arg::with_name(options::SQUEEZE) - .long(options::SQUEEZE) - .short("s") - .help( - "replace each sequence of a repeated character that is - listed in the last specified SET, with a single occurrence - of that character", - ), - ) - .arg( - Arg::with_name(options::TRUNCATE) - .long(options::TRUNCATE) - .short("t") - .help("first truncate SET1 to length of SET2"), - ) - .arg(Arg::with_name(options::SETS).multiple(true)) .get_matches_from(args); let delete_flag = matches.is_present(options::DELETE); @@ -358,3 +321,44 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(options::COMPLEMENT) + // .visible_short_alias('C') // TODO: requires clap "3.0.0-beta.2" + .short("c") + .long(options::COMPLEMENT) + .help("use the complement of SET1"), + ) + .arg( + Arg::with_name("C") // work around for `Arg::visible_short_alias` + .short("C") + .help("same as -c"), + ) + .arg( + Arg::with_name(options::DELETE) + .short("d") + .long(options::DELETE) + .help("delete characters in SET1, do not translate"), + ) + .arg( + Arg::with_name(options::SQUEEZE) + .long(options::SQUEEZE) + .short("s") + .help( + "replace each sequence of a repeated character that is + listed in the last specified SET, with a single occurrence + of that character", + ), + ) + .arg( + Arg::with_name(options::TRUNCATE) + .long(options::TRUNCATE) + .short("t") + .help("first truncate SET1 to length of SET2"), + ) + .arg(Arg::with_name(options::SETS).multiple(true)) +} diff --git a/src/uu/true/Cargo.toml b/src/uu/true/Cargo.toml index 9f13318fd..f121d56de 100644 --- a/src/uu/true/Cargo.toml +++ b/src/uu/true/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/true.rs" [dependencies] +clap = "2.33.3" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/true/src/true.rs b/src/uu/true/src/true.rs index 7cb23f621..521ca2ea5 100644 --- a/src/uu/true/src/true.rs +++ b/src/uu/true/src/true.rs @@ -5,6 +5,15 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. +use clap::{App, AppSettings}; +use uucore::executable; + pub fn uumain(_: impl uucore::Args) -> i32 { 0 } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .setting(AppSettings::DisableHelpFlags) + .setting(AppSettings::DisableVersion) +} diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 8ef246833..bb7aa61d4 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -93,45 +93,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let long_usage = get_long_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) + let matches = uu_app() .usage(&usage[..]) .after_help(&long_usage[..]) - .arg( - Arg::with_name(options::IO_BLOCKS) - .short("o") - .long(options::IO_BLOCKS) - .help("treat SIZE as the number of I/O blocks of the file rather than bytes (NOT IMPLEMENTED)") - ) - .arg( - Arg::with_name(options::NO_CREATE) - .short("c") - .long(options::NO_CREATE) - .help("do not create files that do not exist") - ) - .arg( - Arg::with_name(options::REFERENCE) - .short("r") - .long(options::REFERENCE) - .required_unless(options::SIZE) - .help("base the size of each file on the size of RFILE") - .value_name("RFILE") - ) - .arg( - Arg::with_name(options::SIZE) - .short("s") - .long(options::SIZE) - .required_unless(options::REFERENCE) - .help("set or adjust the size of each file according to SIZE, which is in bytes unless --io-blocks is specified") - .value_name("SIZE") - ) - .arg(Arg::with_name(options::ARG_FILES) - .value_name("FILE") - .multiple(true) - .takes_value(true) - .required(true) - .min_values(1)) .get_matches_from(args); let files: Vec = matches @@ -168,6 +132,46 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(options::IO_BLOCKS) + .short("o") + .long(options::IO_BLOCKS) + .help("treat SIZE as the number of I/O blocks of the file rather than bytes (NOT IMPLEMENTED)") + ) + .arg( + Arg::with_name(options::NO_CREATE) + .short("c") + .long(options::NO_CREATE) + .help("do not create files that do not exist") + ) + .arg( + Arg::with_name(options::REFERENCE) + .short("r") + .long(options::REFERENCE) + .required_unless(options::SIZE) + .help("base the size of each file on the size of RFILE") + .value_name("RFILE") + ) + .arg( + Arg::with_name(options::SIZE) + .short("s") + .long(options::SIZE) + .required_unless(options::REFERENCE) + .help("set or adjust the size of each file according to SIZE, which is in bytes unless --io-blocks is specified") + .value_name("SIZE") + ) + .arg(Arg::with_name(options::ARG_FILES) + .value_name("FILE") + .multiple(true) + .takes_value(true) + .required(true) + .min_values(1)) +} + /// Truncate the named file to the specified size. /// /// If `create` is true, then the file will be created if it does not diff --git a/src/uu/tsort/src/tsort.rs b/src/uu/tsort/src/tsort.rs index 8bd6dabef..0a323f837 100644 --- a/src/uu/tsort/src/tsort.rs +++ b/src/uu/tsort/src/tsort.rs @@ -30,16 +30,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); - let matches = App::new(executable!()) - .version(crate_version!()) - .usage(USAGE) - .about(SUMMARY) - .arg( - Arg::with_name(options::FILE) - .default_value("-") - .hidden(true), - ) - .get_matches_from(args); + let matches = uu_app().get_matches_from(args); let input = matches .value_of(options::FILE) @@ -98,6 +89,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .usage(USAGE) + .about(SUMMARY) + .arg( + Arg::with_name(options::FILE) + .default_value("-") + .hidden(true), + ) +} + // We use String as a representation of node here // but using integer may improve performance. struct Graph { diff --git a/src/uu/tty/src/tty.rs b/src/uu/tty/src/tty.rs index cc5052dea..7412cdf45 100644 --- a/src/uu/tty/src/tty.rs +++ b/src/uu/tty/src/tty.rs @@ -33,19 +33,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(options::SILENT) - .long(options::SILENT) - .visible_alias("quiet") - .short("s") - .help("print nothing, only return an exit status") - .required(false), - ) - .get_matches_from_safe(args); + let matches = uu_app().usage(&usage[..]).get_matches_from_safe(args); let matches = match matches { Ok(m) => m, @@ -88,3 +76,17 @@ pub fn uumain(args: impl uucore::Args) -> i32 { libc::EXIT_FAILURE } } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(options::SILENT) + .long(options::SILENT) + .visible_alias("quiet") + .short("s") + .help("print nothing, only return an exit status") + .required(false), + ) +} diff --git a/src/uu/uname/src/uname.rs b/src/uu/uname/src/uname.rs index aa591ee18..dda859722 100644 --- a/src/uu/uname/src/uname.rs +++ b/src/uu/uname/src/uname.rs @@ -47,49 +47,7 @@ const HOST_OS: &str = "Redox"; pub fn uumain(args: impl uucore::Args) -> i32 { let usage = format!("{} [OPTION]...", executable!()); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg(Arg::with_name(options::ALL) - .short("a") - .long(options::ALL) - .help("Behave as though all of the options -mnrsv were specified.")) - .arg(Arg::with_name(options::KERNELNAME) - .short("s") - .long(options::KERNELNAME) - .alias("sysname") // Obsolescent option in GNU uname - .help("print the kernel name.")) - .arg(Arg::with_name(options::NODENAME) - .short("n") - .long(options::NODENAME) - .help("print the nodename (the nodename may be a name that the system is known by to a communications network).")) - .arg(Arg::with_name(options::KERNELRELEASE) - .short("r") - .long(options::KERNELRELEASE) - .alias("release") // Obsolescent option in GNU uname - .help("print the operating system release.")) - .arg(Arg::with_name(options::KERNELVERSION) - .short("v") - .long(options::KERNELVERSION) - .help("print the operating system version.")) - .arg(Arg::with_name(options::HWPLATFORM) - .short("i") - .long(options::HWPLATFORM) - .help("print the hardware platform (non-portable)")) - .arg(Arg::with_name(options::MACHINE) - .short("m") - .long(options::MACHINE) - .help("print the machine hardware name.")) - .arg(Arg::with_name(options::PROCESSOR) - .short("p") - .long(options::PROCESSOR) - .help("print the processor type (non-portable)")) - .arg(Arg::with_name(options::OS) - .short("o") - .long(options::OS) - .help("print the operating system name.")) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let uname = return_if_err!(1, PlatformInfo::new()); let mut output = String::new(); @@ -155,3 +113,47 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg(Arg::with_name(options::ALL) + .short("a") + .long(options::ALL) + .help("Behave as though all of the options -mnrsv were specified.")) + .arg(Arg::with_name(options::KERNELNAME) + .short("s") + .long(options::KERNELNAME) + .alias("sysname") // Obsolescent option in GNU uname + .help("print the kernel name.")) + .arg(Arg::with_name(options::NODENAME) + .short("n") + .long(options::NODENAME) + .help("print the nodename (the nodename may be a name that the system is known by to a communications network).")) + .arg(Arg::with_name(options::KERNELRELEASE) + .short("r") + .long(options::KERNELRELEASE) + .alias("release") // Obsolescent option in GNU uname + .help("print the operating system release.")) + .arg(Arg::with_name(options::KERNELVERSION) + .short("v") + .long(options::KERNELVERSION) + .help("print the operating system version.")) + .arg(Arg::with_name(options::HWPLATFORM) + .short("i") + .long(options::HWPLATFORM) + .help("print the hardware platform (non-portable)")) + .arg(Arg::with_name(options::MACHINE) + .short("m") + .long(options::MACHINE) + .help("print the machine hardware name.")) + .arg(Arg::with_name(options::PROCESSOR) + .short("p") + .long(options::PROCESSOR) + .help("print the processor type (non-portable)")) + .arg(Arg::with_name(options::OS) + .short("o") + .long(options::OS) + .help("print the operating system name.")) +} diff --git a/src/uu/unexpand/src/unexpand.rs b/src/uu/unexpand/src/unexpand.rs index 92b3c7520..50e3f186d 100644 --- a/src/uu/unexpand/src/unexpand.rs +++ b/src/uu/unexpand/src/unexpand.rs @@ -94,7 +94,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .collect_str(InvalidEncodingHandling::Ignore) .accept_any(); - let matches = App::new(executable!()) + let matches = uu_app().get_matches_from(args); + + unexpand(Options::new(matches)); + + 0 +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .name(NAME) .version(crate_version!()) .usage(USAGE) @@ -126,11 +134,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::NO_UTF8) .takes_value(false) .help("interpret input file as 8-bit ASCII rather than UTF-8")) - .get_matches_from(args); - - unexpand(Options::new(matches)); - - 0 } fn open(path: String) -> BufReader> { diff --git a/src/uu/uniq/src/uniq.rs b/src/uu/uniq/src/uniq.rs index aee024dd4..20639c850 100644 --- a/src/uu/uniq/src/uniq.rs +++ b/src/uu/uniq/src/uniq.rs @@ -238,11 +238,52 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let long_usage = get_long_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) + let matches = uu_app() .usage(&usage[..]) .after_help(&long_usage[..]) + .get_matches_from(args); + + let files: Vec = matches + .values_of(ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + + let (in_file_name, out_file_name) = match files.len() { + 0 => ("-".to_owned(), "-".to_owned()), + 1 => (files[0].clone(), "-".to_owned()), + 2 => (files[0].clone(), files[1].clone()), + _ => { + // Cannot happen as clap will fail earlier + crash!(1, "Extra operand: {}", files[2]); + } + }; + + let uniq = Uniq { + repeats_only: matches.is_present(options::REPEATED) + || matches.is_present(options::ALL_REPEATED), + uniques_only: matches.is_present(options::UNIQUE), + all_repeated: matches.is_present(options::ALL_REPEATED) + || matches.is_present(options::GROUP), + delimiters: get_delimiter(&matches), + show_counts: matches.is_present(options::COUNT), + skip_fields: opt_parsed(options::SKIP_FIELDS, &matches), + slice_start: opt_parsed(options::SKIP_CHARS, &matches), + slice_stop: opt_parsed(options::CHECK_CHARS, &matches), + ignore_case: matches.is_present(options::IGNORE_CASE), + zero_terminated: matches.is_present(options::ZERO_TERMINATED), + }; + uniq.print_uniq( + &mut open_input_file(in_file_name), + &mut open_output_file(out_file_name), + ); + + 0 +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) .arg( Arg::with_name(options::ALL_REPEATED) .short("D") @@ -329,43 +370,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .max_values(2), ) - .get_matches_from(args); - - let files: Vec = matches - .values_of(ARG_FILES) - .map(|v| v.map(ToString::to_string).collect()) - .unwrap_or_default(); - - let (in_file_name, out_file_name) = match files.len() { - 0 => ("-".to_owned(), "-".to_owned()), - 1 => (files[0].clone(), "-".to_owned()), - 2 => (files[0].clone(), files[1].clone()), - _ => { - // Cannot happen as clap will fail earlier - crash!(1, "Extra operand: {}", files[2]); - } - }; - - let uniq = Uniq { - repeats_only: matches.is_present(options::REPEATED) - || matches.is_present(options::ALL_REPEATED), - uniques_only: matches.is_present(options::UNIQUE), - all_repeated: matches.is_present(options::ALL_REPEATED) - || matches.is_present(options::GROUP), - delimiters: get_delimiter(&matches), - show_counts: matches.is_present(options::COUNT), - skip_fields: opt_parsed(options::SKIP_FIELDS, &matches), - slice_start: opt_parsed(options::SKIP_CHARS, &matches), - slice_stop: opt_parsed(options::CHECK_CHARS, &matches), - ignore_case: matches.is_present(options::IGNORE_CASE), - zero_terminated: matches.is_present(options::ZERO_TERMINATED), - }; - uniq.print_uniq( - &mut open_input_file(in_file_name), - &mut open_output_file(out_file_name), - ); - - 0 } fn get_delimiter(matches: &ArgMatches) -> Delimiters { diff --git a/src/uu/unlink/src/unlink.rs b/src/uu/unlink/src/unlink.rs index 343f2653f..49f17cb12 100644 --- a/src/uu/unlink/src/unlink.rs +++ b/src/uu/unlink/src/unlink.rs @@ -33,12 +33,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg(Arg::with_name(OPT_PATH).hidden(true).multiple(true)) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let paths: Vec = matches .values_of(OPT_PATH) @@ -98,3 +93,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg(Arg::with_name(OPT_PATH).hidden(true).multiple(true)) +} diff --git a/src/uu/uptime/src/uptime.rs b/src/uu/uptime/src/uptime.rs index 3683a4de0..35270093c 100644 --- a/src/uu/uptime/src/uptime.rs +++ b/src/uu/uptime/src/uptime.rs @@ -38,17 +38,7 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) - .usage(&usage[..]) - .arg( - Arg::with_name(options::SINCE) - .short("s") - .long(options::SINCE) - .help("system up since"), - ) - .get_matches_from(args); + let matches = uu_app().usage(&usage[..]).get_matches_from(args); let (boot_time, user_count) = process_utmpx(); let uptime = get_uptime(boot_time); @@ -73,6 +63,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg( + Arg::with_name(options::SINCE) + .short("s") + .long(options::SINCE) + .help("system up since"), + ) +} + #[cfg(unix)] fn print_loadavg() { use uucore::libc::c_double; diff --git a/src/uu/users/src/users.rs b/src/uu/users/src/users.rs index 5b1f1c037..ef878497c 100644 --- a/src/uu/users/src/users.rs +++ b/src/uu/users/src/users.rs @@ -34,12 +34,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let after_help = get_long_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) + let matches = uu_app() .usage(&usage[..]) .after_help(&after_help[..]) - .arg(Arg::with_name(ARG_FILES).takes_value(true).max_values(1)) .get_matches_from(args); let files: Vec = matches @@ -66,3 +63,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) + .arg(Arg::with_name(ARG_FILES).takes_value(true).max_values(1)) +} diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index d1e1f75ca..0bcc66664 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -134,10 +134,39 @@ impl Input { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) + let matches = uu_app().usage(&usage[..]).get_matches_from(args); + + let mut inputs: Vec = matches + .values_of(ARG_FILES) + .map(|v| { + v.map(|i| { + if i == "-" { + Input::Stdin(StdinKind::Explicit) + } else { + Input::Path(ToString::to_string(i)) + } + }) + .collect() + }) + .unwrap_or_default(); + + if inputs.is_empty() { + inputs.push(Input::Stdin(StdinKind::Implicit)); + } + + let settings = Settings::new(&matches); + + if wc(inputs, &settings).is_ok() { + 0 + } else { + 1 + } +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) .version(crate_version!()) .about(ABOUT) - .usage(&usage[..]) .arg( Arg::with_name(options::BYTES) .short("c") @@ -169,33 +198,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("print the word counts"), ) .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) - .get_matches_from(args); - - let mut inputs: Vec = matches - .values_of(ARG_FILES) - .map(|v| { - v.map(|i| { - if i == "-" { - Input::Stdin(StdinKind::Explicit) - } else { - Input::Path(ToString::to_string(i)) - } - }) - .collect() - }) - .unwrap_or_default(); - - if inputs.is_empty() { - inputs.push(Input::Stdin(StdinKind::Implicit)); - } - - let settings = Settings::new(&matches); - - if wc(inputs, &settings).is_ok() { - 0 - } else { - 1 - } } fn word_count_from_reader( diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index 047452240..6a9c88710 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -64,11 +64,105 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let after_help = get_long_usage(); - let matches = App::new(executable!()) - .version(crate_version!()) - .about(ABOUT) + let matches = uu_app() .usage(&usage[..]) .after_help(&after_help[..]) + .get_matches_from(args); + + let files: Vec = matches + .values_of(options::FILE) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + + // If true, attempt to canonicalize hostnames via a DNS lookup. + let do_lookup = matches.is_present(options::LOOKUP); + + // If true, display only a list of usernames and count of + // the users logged on. + // Ignored for 'who am i'. + let short_list = matches.is_present(options::COUNT); + + let all = matches.is_present(options::ALL); + + // If true, display a line at the top describing each field. + let include_heading = matches.is_present(options::HEADING); + + // If true, display a '+' for each user if mesg y, a '-' if mesg n, + // or a '?' if their tty cannot be statted. + let include_mesg = all || matches.is_present(options::MESG) || matches.is_present("w"); + + // If true, display the last boot time. + let need_boottime = all || matches.is_present(options::BOOT); + + // If true, display dead processes. + let need_deadprocs = all || matches.is_present(options::DEAD); + + // If true, display processes waiting for user login. + let need_login = all || matches.is_present(options::LOGIN); + + // If true, display processes started by init. + let need_initspawn = all || matches.is_present(options::PROCESS); + + // If true, display the last clock change. + let need_clockchange = all || matches.is_present(options::TIME); + + // If true, display the current runlevel. + let need_runlevel = all || matches.is_present(options::RUNLEVEL); + + let use_defaults = !(all + || need_boottime + || need_deadprocs + || need_login + || need_initspawn + || need_runlevel + || need_clockchange + || matches.is_present(options::USERS)); + + // If true, display user processes. + let need_users = all || matches.is_present(options::USERS) || use_defaults; + + // If true, display the hours:minutes since each user has touched + // the keyboard, or "." if within the last minute, or "old" if + // not within the last day. + let include_idle = need_deadprocs || need_login || need_runlevel || need_users; + + // If true, display process termination & exit status. + let include_exit = need_deadprocs; + + // If true, display only name, line, and time fields. + let short_output = !include_exit && use_defaults; + + // If true, display info only for the controlling tty. + let my_line_only = matches.is_present(options::ONLY_HOSTNAME_USER) || files.len() == 2; + + let mut who = Who { + do_lookup, + short_list, + short_output, + include_idle, + include_heading, + include_mesg, + include_exit, + need_boottime, + need_deadprocs, + need_login, + need_initspawn, + need_clockchange, + need_runlevel, + need_users, + my_line_only, + args: files, + }; + + who.exec(); + + 0 +} + +pub fn uu_app() -> App<'static, 'static> { + App::new(executable!()) + .version(crate_version!()) + .about(ABOUT) .arg( Arg::with_name(options::ALL) .long(options::ALL) @@ -164,96 +258,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .min_values(1) .max_values(2), ) - .get_matches_from(args); - - let files: Vec = matches - .values_of(options::FILE) - .map(|v| v.map(ToString::to_string).collect()) - .unwrap_or_default(); - - // If true, attempt to canonicalize hostnames via a DNS lookup. - let do_lookup = matches.is_present(options::LOOKUP); - - // If true, display only a list of usernames and count of - // the users logged on. - // Ignored for 'who am i'. - let short_list = matches.is_present(options::COUNT); - - let all = matches.is_present(options::ALL); - - // If true, display a line at the top describing each field. - let include_heading = matches.is_present(options::HEADING); - - // If true, display a '+' for each user if mesg y, a '-' if mesg n, - // or a '?' if their tty cannot be statted. - let include_mesg = all || matches.is_present(options::MESG) || matches.is_present("w"); - - // If true, display the last boot time. - let need_boottime = all || matches.is_present(options::BOOT); - - // If true, display dead processes. - let need_deadprocs = all || matches.is_present(options::DEAD); - - // If true, display processes waiting for user login. - let need_login = all || matches.is_present(options::LOGIN); - - // If true, display processes started by init. - let need_initspawn = all || matches.is_present(options::PROCESS); - - // If true, display the last clock change. - let need_clockchange = all || matches.is_present(options::TIME); - - // If true, display the current runlevel. - let need_runlevel = all || matches.is_present(options::RUNLEVEL); - - let use_defaults = !(all - || need_boottime - || need_deadprocs - || need_login - || need_initspawn - || need_runlevel - || need_clockchange - || matches.is_present(options::USERS)); - - // If true, display user processes. - let need_users = all || matches.is_present(options::USERS) || use_defaults; - - // If true, display the hours:minutes since each user has touched - // the keyboard, or "." if within the last minute, or "old" if - // not within the last day. - let include_idle = need_deadprocs || need_login || need_runlevel || need_users; - - // If true, display process termination & exit status. - let include_exit = need_deadprocs; - - // If true, display only name, line, and time fields. - let short_output = !include_exit && use_defaults; - - // If true, display info only for the controlling tty. - let my_line_only = matches.is_present(options::ONLY_HOSTNAME_USER) || files.len() == 2; - - let mut who = Who { - do_lookup, - short_list, - short_output, - include_idle, - include_heading, - include_mesg, - include_exit, - need_boottime, - need_deadprocs, - need_login, - need_initspawn, - need_clockchange, - need_runlevel, - need_users, - my_line_only, - args: files, - }; - - who.exec(); - - 0 } struct Who { diff --git a/src/uu/whoami/src/whoami.rs b/src/uu/whoami/src/whoami.rs index 383fb40b5..bd2eea1e3 100644 --- a/src/uu/whoami/src/whoami.rs +++ b/src/uu/whoami/src/whoami.rs @@ -1,3 +1,5 @@ +use clap::App; + // * This file is part of the uutils coreutils package. // * // * (c) Jordi Boggiano @@ -15,7 +17,7 @@ extern crate uucore; mod platform; pub fn uumain(args: impl uucore::Args) -> i32 { - let app = app_from_crate!(); + let app = uu_app(); if let Err(err) = app.get_matches_from_safe(args) { if err.kind == clap::ErrorKind::HelpDisplayed @@ -34,6 +36,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } +pub fn uu_app() -> App<'static, 'static> { + app_from_crate!() +} + pub fn exec() { unsafe { match platform::get_username() { diff --git a/src/uu/yes/src/yes.rs b/src/uu/yes/src/yes.rs index 1fc2d92bc..2c0d43000 100644 --- a/src/uu/yes/src/yes.rs +++ b/src/uu/yes/src/yes.rs @@ -12,7 +12,7 @@ extern crate clap; #[macro_use] extern crate uucore; -use clap::Arg; +use clap::{App, Arg}; use std::borrow::Cow; use std::io::{self, Write}; use uucore::zero_copy::ZeroCopyWriter; @@ -22,7 +22,7 @@ use uucore::zero_copy::ZeroCopyWriter; const BUF_SIZE: usize = 16 * 1024; pub fn uumain(args: impl uucore::Args) -> i32 { - let app = app_from_crate!().arg(Arg::with_name("STRING").index(1).multiple(true)); + let app = uu_app(); let matches = match app.get_matches_from_safe(args) { Ok(m) => m, @@ -56,6 +56,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } +pub fn uu_app() -> App<'static, 'static> { + app_from_crate!().arg(Arg::with_name("STRING").index(1).multiple(true)) +} + #[cfg(not(feature = "latency"))] fn prepare_buffer<'a>(input: &'a str, buffer: &'a mut [u8; BUF_SIZE]) -> &'a [u8] { if input.len() < BUF_SIZE / 2 { From a9e79c72c7717b5de86f32fa53399fbf0c5ee77f Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Tue, 15 Jun 2021 15:35:49 +0200 Subject: [PATCH 1120/1135] uutils: enable shell completions This adds a hidden `completion` subcommand to coreutils. When invoked with `coreutils completion ` a completion file will be printed to stdout. When running `make install` those files will be created for all utilities and copied to the appropriate locations. `make install` will install completions for zsh, fish and bash; however, clap also supports generating completions for powershell and elvish. With this patch all utilities are required to have a publich uu_app function that returns a clap::App in addition to the uumain function. --- Cargo.lock | 1 + Cargo.toml | 1 + GNUmakefile | 5 +++++ build.rs | 40 +++++++++++++++++----------------- src/bin/coreutils.rs | 52 +++++++++++++++++++++++++++++++++++++++++--- 5 files changed, 76 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5f96f7f8b..51424332d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -218,6 +218,7 @@ version = "0.0.6" dependencies = [ "atty", "chrono", + "clap", "conv", "filetime", "glob 0.3.0", diff --git a/Cargo.toml b/Cargo.toml index 0fec2af78..2783ff1b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -225,6 +225,7 @@ test = [ "uu_test" ] [workspace] [dependencies] +clap = "2.33.3" 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.8", package="uucore", path="src/uucore" } diff --git a/GNUmakefile b/GNUmakefile index e5ad01340..ea9c7254a 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -314,6 +314,11 @@ else endif $(foreach man, $(filter $(INSTALLEES), $(basename $(notdir $(wildcard $(DOCSDIR)/_build/man/*)))), \ cat $(DOCSDIR)/_build/man/$(man).1 | gzip > $(INSTALLDIR_MAN)/$(PROG_PREFIX)$(man).1.gz &&) : + $(foreach prog, $(INSTALLEES), \ + $(BUILDDIR)/coreutils completion $(prog) zsh > $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_$(PROG_PREFIX)$(prog); \ + $(BUILDDIR)/coreutils completion $(prog) bash > $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$(PROG_PREFIX)$(prog); \ + $(BUILDDIR)/coreutils completion $(prog) fish > $(DESTDIR)$(PREFIX)/share/fish/vendor_completions.d/$(PROG_PREFIX)$(prog).fish; \ + ) uninstall: ifeq (${MULTICALL}, y) diff --git a/build.rs b/build.rs index 2ed8e1345..e9fe129eb 100644 --- a/build.rs +++ b/build.rs @@ -43,7 +43,7 @@ pub fn main() { let mut tf = File::create(Path::new(&out_dir).join("test_modules.rs")).unwrap(); mf.write_all( - "type UtilityMap = HashMap<&'static str, fn(T) -> i32>;\n\ + "type UtilityMap = HashMap<&'static str, (fn(T) -> i32, fn() -> App<'static, 'static>)>;\n\ \n\ fn util_map() -> UtilityMap {\n\ \tlet mut map = UtilityMap::new();\n\ @@ -60,8 +60,8 @@ pub fn main() { mf.write_all( format!( "\ - \tmap.insert(\"test\", {krate}::uumain);\n\ - \t\tmap.insert(\"[\", {krate}::uumain);\n\ + \tmap.insert(\"test\", ({krate}::uumain, {krate}::uu_app));\n\ + \t\tmap.insert(\"[\", ({krate}::uumain, {krate}::uu_app));\n\ ", krate = krate ) @@ -80,7 +80,7 @@ pub fn main() { k if k.starts_with(override_prefix) => { mf.write_all( format!( - "\tmap.insert(\"{k}\", {krate}::uumain);\n", + "\tmap.insert(\"{k}\", ({krate}::uumain, {krate}::uu_app));\n", k = krate[override_prefix.len()..].to_string(), krate = krate ) @@ -100,7 +100,7 @@ pub fn main() { "false" | "true" => { mf.write_all( format!( - "\tmap.insert(\"{krate}\", r#{krate}::uumain);\n", + "\tmap.insert(\"{krate}\", (r#{krate}::uumain, r#{krate}::uu_app));\n", krate = krate ) .as_bytes(), @@ -120,20 +120,20 @@ pub fn main() { mf.write_all( format!( "\ - \tmap.insert(\"{krate}\", {krate}::uumain);\n\ - \t\tmap.insert(\"md5sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha1sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha224sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha256sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha384sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha512sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha3sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha3-224sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha3-256sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha3-384sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha3-512sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"shake128sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"shake256sum\", {krate}::uumain);\n\ + \tmap.insert(\"{krate}\", ({krate}::uumain, {krate}::uu_app_custom));\n\ + \t\tmap.insert(\"md5sum\", ({krate}::uumain, {krate}::uu_app_common));\n\ + \t\tmap.insert(\"sha1sum\", ({krate}::uumain, {krate}::uu_app_common));\n\ + \t\tmap.insert(\"sha224sum\", ({krate}::uumain, {krate}::uu_app_common));\n\ + \t\tmap.insert(\"sha256sum\", ({krate}::uumain, {krate}::uu_app_common));\n\ + \t\tmap.insert(\"sha384sum\", ({krate}::uumain, {krate}::uu_app_common));\n\ + \t\tmap.insert(\"sha512sum\", ({krate}::uumain, {krate}::uu_app_common));\n\ + \t\tmap.insert(\"sha3sum\", ({krate}::uumain, {krate}::uu_app_common));\n\ + \t\tmap.insert(\"sha3-224sum\", ({krate}::uumain, {krate}::uu_app_common));\n\ + \t\tmap.insert(\"sha3-256sum\", ({krate}::uumain, {krate}::uu_app_common));\n\ + \t\tmap.insert(\"sha3-384sum\", ({krate}::uumain, {krate}::uu_app_common));\n\ + \t\tmap.insert(\"sha3-512sum\", ({krate}::uumain, {krate}::uu_app_common));\n\ + \t\tmap.insert(\"shake128sum\", ({krate}::uumain, {krate}::uu_app_common));\n\ + \t\tmap.insert(\"shake256sum\", ({krate}::uumain, {krate}::uu_app_common));\n\ ", krate = krate ) @@ -153,7 +153,7 @@ pub fn main() { _ => { mf.write_all( format!( - "\tmap.insert(\"{krate}\", {krate}::uumain);\n", + "\tmap.insert(\"{krate}\", ({krate}::uumain, {krate}::uu_app));\n", krate = krate ) .as_bytes(), diff --git a/src/bin/coreutils.rs b/src/bin/coreutils.rs index 2e703b682..270f5153a 100644 --- a/src/bin/coreutils.rs +++ b/src/bin/coreutils.rs @@ -5,6 +5,8 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +use clap::App; +use clap::Shell; use std::cmp; use std::collections::hash_map::HashMap; use std::ffi::OsString; @@ -52,7 +54,7 @@ fn main() { let binary_as_util = name(&binary); // binary name equals util name? - if let Some(&uumain) = utils.get(binary_as_util) { + if let Some(&(uumain, _)) = utils.get(binary_as_util) { process::exit(uumain((vec![binary.into()].into_iter()).chain(args))); } @@ -74,8 +76,12 @@ fn main() { if let Some(util_os) = util_name { let util = util_os.as_os_str().to_string_lossy(); + if util == "completion" { + gen_completions(args, utils); + } + match utils.get(&util[..]) { - Some(&uumain) => { + Some(&(uumain, _)) => { process::exit(uumain((vec![util_os].into_iter()).chain(args))); } None => { @@ -85,7 +91,7 @@ fn main() { let util = util_os.as_os_str().to_string_lossy(); match utils.get(&util[..]) { - Some(&uumain) => { + Some(&(uumain, _)) => { let code = uumain( (vec![util_os, OsString::from("--help")].into_iter()) .chain(args), @@ -113,3 +119,43 @@ fn main() { process::exit(0); } } + +/// Prints completions for the utility in the first parameter for the shell in the second parameter to stdout +fn gen_completions( + mut args: impl Iterator, + util_map: UtilityMap, +) -> ! { + let utility = args + .next() + .expect("expected utility as the first parameter") + .to_str() + .expect("utility name was not valid utf-8") + .to_owned(); + let shell = args + .next() + .expect("expected shell as the second parameter") + .to_str() + .expect("shell name was not valid utf-8") + .to_owned(); + let mut app = if utility == "coreutils" { + gen_coreutils_app(util_map) + } else if let Some((_, app)) = util_map.get(utility.as_str()) { + app() + } else { + eprintln!("{} is not a valid utility", utility); + process::exit(1) + }; + let shell: Shell = shell.parse().unwrap(); + let bin_name = std::env::var("PROG_PREFIX").unwrap_or_default() + &utility; + app.gen_completions_to(bin_name, shell, &mut io::stdout()); + io::stdout().flush().unwrap(); + process::exit(0); +} + +fn gen_coreutils_app(util_map: UtilityMap) -> App<'static, 'static> { + let mut app = App::new("coreutils"); + for (_, (_, sub_app)) in util_map { + app = app.subcommand(sub_app()); + } + app +} From a8d62b9b2351e4dc216942c998cedec19f6b6fe9 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 18 Jun 2021 11:57:19 +0200 Subject: [PATCH 1121/1135] fmt: fix indentation for help --- src/uu/fmt/src/fmt.rs | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/uu/fmt/src/fmt.rs b/src/uu/fmt/src/fmt.rs index 9eceaa56c..8c2c8d9d9 100644 --- a/src/uu/fmt/src/fmt.rs +++ b/src/uu/fmt/src/fmt.rs @@ -219,10 +219,10 @@ pub fn uu_app() -> App<'static, 'static> { .short("c") .long(OPT_CROWN_MARGIN) .help( - "First and second line of paragraph - may have different indentations, in which - case the first line's indentation is preserved, - and each subsequent line's indentation matches the second line.", + "First and second line of paragraph \ + may have different indentations, in which \ + case the first line's indentation is preserved, \ + and each subsequent line's indentation matches the second line.", ), ) .arg( @@ -230,7 +230,7 @@ pub fn uu_app() -> App<'static, 'static> { .short("t") .long("tagged-paragraph") .help( - "Like -c, except that the first and second line of a paragraph *must* + "Like -c, except that the first and second line of a paragraph *must* \ have different indentation or they are treated as separate paragraphs.", ), ) @@ -239,7 +239,7 @@ pub fn uu_app() -> App<'static, 'static> { .short("m") .long("preserve-headers") .help( - "Attempt to detect and preserve mail headers in the input. + "Attempt to detect and preserve mail headers in the input. \ Be careful when combining this flag with -p.", ), ) @@ -254,10 +254,10 @@ pub fn uu_app() -> App<'static, 'static> { .short("u") .long("uniform-spacing") .help( - "Insert exactly one - space between words, and two between sentences. - Sentence breaks in the input are detected as [?!.] - followed by two spaces or a newline; other punctuation + "Insert exactly one \ + space between words, and two between sentences. \ + Sentence breaks in the input are detected as [?!.] \ + followed by two spaces or a newline; other punctuation \ is not interpreted as a sentence break.", ), ) @@ -266,9 +266,9 @@ pub fn uu_app() -> App<'static, 'static> { .short("p") .long("prefix") .help( - "Reformat only lines - beginning with PREFIX, reattaching PREFIX to reformatted lines. - Unless -x is specified, leading whitespace will be ignored + "Reformat only lines \ + beginning with PREFIX, reattaching PREFIX to reformatted lines. \ + Unless -x is specified, leading whitespace will be ignored \ when matching PREFIX.", ) .value_name("PREFIX"), @@ -278,8 +278,8 @@ pub fn uu_app() -> App<'static, 'static> { .short("P") .long("skip-prefix") .help( - "Do not reformat lines - beginning with PSKIP. Unless -X is specified, leading whitespace + "Do not reformat lines \ + beginning with PSKIP. Unless -X is specified, leading whitespace \ will be ignored when matching PSKIP", ) .value_name("PSKIP"), @@ -289,7 +289,7 @@ pub fn uu_app() -> App<'static, 'static> { .short("x") .long("exact-prefix") .help( - "PREFIX must match at the + "PREFIX must match at the \ beginning of the line with no preceding whitespace.", ), ) @@ -298,7 +298,7 @@ pub fn uu_app() -> App<'static, 'static> { .short("X") .long("exact-skip-prefix") .help( - "PSKIP must match at the + "PSKIP must match at the \ beginning of the line with no preceding whitespace.", ), ) @@ -317,7 +317,7 @@ pub fn uu_app() -> App<'static, 'static> { .value_name("GOAL"), ) .arg(Arg::with_name(OPT_QUICK).short("q").long("quick").help( - "Break lines more quickly at the + "Break lines more quickly at the \ expense of a potentially more ragged appearance.", )) .arg( @@ -325,8 +325,8 @@ pub fn uu_app() -> App<'static, 'static> { .short("T") .long("tab-width") .help( - "Treat tabs as TABWIDTH spaces for - determining line length, default 8. Note that this is used only for + "Treat tabs as TABWIDTH spaces for \ + determining line length, default 8. Note that this is used only for \ calculating line lengths; tabs are preserved in the output.", ) .value_name("TABWIDTH"), From 0fec449de334a352b5fef26b3bdc4275b7d79a70 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 18 Jun 2021 11:58:23 +0200 Subject: [PATCH 1122/1135] mkfifo: make rustfmt work --- src/uu/mkfifo/src/mkfifo.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/uu/mkfifo/src/mkfifo.rs b/src/uu/mkfifo/src/mkfifo.rs index ad12e230d..ea0906567 100644 --- a/src/uu/mkfifo/src/mkfifo.rs +++ b/src/uu/mkfifo/src/mkfifo.rs @@ -86,8 +86,16 @@ pub fn uu_app() -> App<'static, 'static> { .arg( Arg::with_name(options::SE_LINUX_SECURITY_CONTEXT) .short(options::SE_LINUX_SECURITY_CONTEXT) - .help("set the SELinux security context to default type") + .help("set the SELinux security context to default type"), + ) + .arg( + Arg::with_name(options::CONTEXT) + .long(options::CONTEXT) + .value_name("CTX") + .help( + "like -Z, or if CTX is specified then set the SELinux \ + or SMACK security context to CTX", + ), ) - .arg(Arg::with_name(options::CONTEXT).long(options::CONTEXT).value_name("CTX").help("like -Z, or if CTX is specified then set the SELinux\nor SMACK security context to CTX")) .arg(Arg::with_name(options::FIFO).hidden(true).multiple(true)) } From 2e027bf45d717a47430008d963bcae55d2e5c567 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 18 Jun 2021 12:00:08 +0200 Subject: [PATCH 1123/1135] true, false: enable --help and --version --- src/uu/false/src/false.rs | 7 +++---- src/uu/true/src/true.rs | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/uu/false/src/false.rs b/src/uu/false/src/false.rs index aaeb6b751..17c681129 100644 --- a/src/uu/false/src/false.rs +++ b/src/uu/false/src/false.rs @@ -5,15 +5,14 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -use clap::{App, AppSettings}; +use clap::App; use uucore::executable; -pub fn uumain(_: impl uucore::Args) -> i32 { +pub fn uumain(args: impl uucore::Args) -> i32 { + uu_app().get_matches_from(args); 1 } pub fn uu_app() -> App<'static, 'static> { App::new(executable!()) - .setting(AppSettings::DisableHelpFlags) - .setting(AppSettings::DisableVersion) } diff --git a/src/uu/true/src/true.rs b/src/uu/true/src/true.rs index 521ca2ea5..ea53b0075 100644 --- a/src/uu/true/src/true.rs +++ b/src/uu/true/src/true.rs @@ -5,15 +5,14 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -use clap::{App, AppSettings}; +use clap::App; use uucore::executable; -pub fn uumain(_: impl uucore::Args) -> i32 { +pub fn uumain(args: impl uucore::Args) -> i32 { + uu_app().get_matches_from(args); 0 } pub fn uu_app() -> App<'static, 'static> { App::new(executable!()) - .setting(AppSettings::DisableHelpFlags) - .setting(AppSettings::DisableVersion) } From 73cfcc27e7a03bbdec0e6539f72f16a9b4daec80 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 18 Jun 2021 12:12:06 +0200 Subject: [PATCH 1124/1135] cp: insert some spaces into the help text --- src/uu/cp/src/cp.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 12dfeab3f..4deaefa98 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -375,7 +375,7 @@ pub fn uu_app() -> App<'static, 'static> { .arg(Arg::with_name(options::UPDATE) .short("u") .long(options::UPDATE) - .help("copy only when the SOURCE file is newer than the destination file\ + .help("copy only when the SOURCE file is newer than the destination file \ or when the destination file is missing")) .arg(Arg::with_name(options::REFLINK) .long(options::REFLINK) @@ -398,7 +398,7 @@ pub fn uu_app() -> App<'static, 'static> { .conflicts_with_all(&[options::PRESERVE_DEFAULT_ATTRIBUTES, options::NO_PRESERVE]) // -d sets this option // --archive sets this option - .help("Preserve the specified attributes (default: mode(unix only),ownership,timestamps),\ + .help("Preserve the specified attributes (default: mode (unix only), ownership, timestamps), \ if possible additional attributes: context, links, xattr, all")) .arg(Arg::with_name(options::PRESERVE_DEFAULT_ATTRIBUTES) .short("-p") From a87538b77d46f5d19172c8b1f9aeca21f4d3a2f0 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 19 Jun 2021 12:31:23 +0200 Subject: [PATCH 1125/1135] uutils: uninstall shell completions --- GNUmakefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/GNUmakefile b/GNUmakefile index ea9c7254a..89a4dca80 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -326,6 +326,9 @@ ifeq (${MULTICALL}, y) endif rm -f $(addprefix $(INSTALLDIR_MAN)/,$(PROG_PREFIX)coreutils.1.gz) rm -f $(addprefix $(INSTALLDIR_BIN)/$(PROG_PREFIX),$(PROGS)) + rm -f $(addprefix $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_$(PROG_PREFIX),$(PROGS)) + rm -f $(addprefix $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$(PROG_PREFIX),$(PROGS)) + rm -f $(addprefix $(DESTDIR)$(PREFIX)/share/fish/vendor_completions.d/$(PROG_PREFIX),$(addsuffix .fish,$(PROGS))) rm -f $(addprefix $(INSTALLDIR_MAN)/$(PROG_PREFIX),$(addsuffix .1.gz,$(PROGS))) .PHONY: all build build-coreutils build-pkgs build-docs test distclean clean busytest install uninstall From 9b8150d283d2122ac162e4b84ba9b58649359415 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 19 Jun 2021 12:37:01 +0200 Subject: [PATCH 1126/1135] uutils: document completions in the readme --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index fd8709b64..083320ac0 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,9 @@ $ cargo install --path . This command will install uutils into Cargo's *bin* folder (*e.g.* `$HOME/.cargo/bin`). +This does not install files necessary for shell completion. For shell completion to work, +use `GNU Make` or see `Manually install shell completions`. + ### GNU Make To install all available utilities: @@ -179,6 +182,10 @@ Set install parent directory (default value is /usr/local): $ make PREFIX=/my/path install ``` +Installing with `make` installs shell completions for all installed utilities +for `bash`, `fish` and `zsh`. Completions for `elvish` and `powershell` can also +be generated; See `Manually install shell completions`. + ### NixOS The [standard package set](https://nixos.org/nixpkgs/manual/) of [NixOS](https://nixos.org/) @@ -188,6 +195,23 @@ provides this package out of the box since 18.03: $ nix-env -iA nixos.uutils-coreutils ``` +### Manually install shell completions + +The `coreutils` binary can generate completions for the `bash`, `elvish`, `fish`, `powershell` +and `zsh` shells. It prints the result to stdout. + +The syntax is: +```bash +cargo run completion +``` + +So, to install completions for `ls` on `bash` to `/usr/local/share/bash-completion/completions/ls`, +run: + +```bash +cargo run completion ls bash > /usr/local/share/bash-completion/completions/ls +``` + ## Un-installation Instructions Un-installation differs depending on how you have installed uutils. If you used From 66b1ac019da5459d0edc6c1c903ffb99c7492acc Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 28 Jun 2021 13:38:47 +0200 Subject: [PATCH 1127/1135] uucore/error: add standardized error handling (adds UResult & UError) --- src/uucore/src/lib/lib.rs | 1 + src/uucore/src/lib/mods.rs | 1 + src/uucore/src/lib/mods/error.rs | 479 +++++++++++++++++++++++++++++++ 3 files changed, 481 insertions(+) create mode 100644 src/uucore/src/lib/mods/error.rs diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index bf2e5b1bb..00477cd7e 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -27,6 +27,7 @@ mod parser; // string parsing modules // * cross-platform modules pub use crate::mods::backup_control; pub use crate::mods::coreopts; +pub use crate::mods::error; pub use crate::mods::os; pub use crate::mods::panic; pub use crate::mods::ranges; diff --git a/src/uucore/src/lib/mods.rs b/src/uucore/src/lib/mods.rs index 2689361a0..040da2f02 100644 --- a/src/uucore/src/lib/mods.rs +++ b/src/uucore/src/lib/mods.rs @@ -2,6 +2,7 @@ pub mod backup_control; pub mod coreopts; +pub mod error; pub mod os; pub mod panic; pub mod ranges; diff --git a/src/uucore/src/lib/mods/error.rs b/src/uucore/src/lib/mods/error.rs new file mode 100644 index 000000000..f13c777b6 --- /dev/null +++ b/src/uucore/src/lib/mods/error.rs @@ -0,0 +1,479 @@ +//! All utils return exit with an exit code. Usually, the following scheme is used: +//! * `0`: succeeded +//! * `1`: minor problems +//! * `2`: major problems +//! +//! This module provides types to reconcile these exit codes with idiomatic Rust error +//! handling. This has a couple advantages over manually using [`std::process::exit`]: +//! 1. It enables the use of `?`, `map_err`, `unwrap_or`, etc. in `uumain`. +//! 1. It encourages the use of `UResult`/`Result` in functions in the utils. +//! 1. The error messages are largely standardized across utils. +//! 1. Standardized error messages can be created from external result types +//! (i.e. [`std::io::Result`] & `clap::ClapResult`). +//! 1. `set_exit_code` takes away the burden of manually tracking exit codes for non-fatal errors. +//! +//! # Usage +//! The signature of a typical util should be: +//! ```ignore +//! fn uumain(args: impl uucore::Args) -> UResult<()> { +//! ... +//! } +//! ``` +//! [`UResult`] is a simple wrapper around [`Result`] with a custom error type: [`UError`]. The +//! most important difference with types implementing [`std::error::Error`] is that [`UError`]s +//! can specify the exit code of the program when they are returned from `uumain`: +//! * When `Ok` is returned, the code set with [`set_exit_code`] is used as exit code. If +//! [`set_exit_code`] was not used, then `0` is used. +//! * When `Err` is returned, the code corresponding with the error is used as exit code and the +//! error message is displayed. +//! +//! Additionally, the errors can be displayed manually with the [`show`] and [`show_if_err`] macros: +//! ```ignore +//! let res = Err(USimpleError::new(1, "Error!!")); +//! show_if_err!(res); +//! // or +//! if let Err(e) = res { +//! show!(e); +//! } +//! ``` +//! +//! **Note**: The [`show`] and [`show_if_err`] macros set the exit code of the program using +//! [`set_exit_code`]. See the documentation on that function for more information. +//! +//! # Guidelines +//! * Use common errors where possible. +//! * Add variants to [`UCommonError`] if an error appears in multiple utils. +//! * Prefer proper custom error types over [`ExitCode`] and [`USimpleError`]. +//! * [`USimpleError`] may be used in small utils with simple error handling. +//! * Using [`ExitCode`] is not recommended but can be useful for converting utils to use +//! [`UResult`]. + +use std::{ + error::Error, + fmt::{Display, Formatter}, + sync::atomic::{AtomicI32, Ordering}, +}; + +static EXIT_CODE: AtomicI32 = AtomicI32::new(0); + +/// Get the last exit code set with [`set_exit_code`]. +/// The default value is `0`. +pub fn get_exit_code() -> i32 { + EXIT_CODE.load(Ordering::SeqCst) +} + +/// Set the exit code for the program if `uumain` returns `Ok(())`. +/// +/// This function is most useful for non-fatal errors, for example when applying an operation to +/// multiple files: +/// ```ignore +/// use uucore::error::{UResult, set_exit_code}; +/// +/// fn uumain(args: impl uucore::Args) -> UResult<()> { +/// ... +/// for file in files { +/// let res = some_operation_that_might_fail(file); +/// match res { +/// Ok() => {}, +/// Err(_) => set_exit_code(1), +/// } +/// } +/// Ok(()) // If any of the operations failed, 1 is returned. +/// } +/// ``` +pub fn set_exit_code(code: i32) { + EXIT_CODE.store(code, Ordering::SeqCst); +} + +/// Should be returned by all utils. +/// +/// Two additional methods are implemented on [`UResult`] on top of the normal [`Result`] methods: +/// `map_err_code` & `map_err_code_message`. +/// +/// These methods are used to convert [`UCommonError`]s into errors with a custom error code and +/// message. +pub type UResult = Result; + +trait UResultTrait { + fn map_err_code(self, mapper: fn(&UCommonError) -> Option) -> Self; + fn map_err_code_and_message(self, mapper: fn(&UCommonError) -> Option<(i32, String)>) -> Self; +} + +impl UResultTrait for UResult { + fn map_err_code(self, mapper: fn(&UCommonError) -> Option) -> Self { + if let Err(UError::Common(error)) = self { + if let Some(code) = mapper(&error) { + Err(UCommonErrorWithCode { code, error }.into()) + } else { + Err(error.into()) + } + } else { + self + } + } + + fn map_err_code_and_message(self, mapper: fn(&UCommonError) -> Option<(i32, String)>) -> Self { + if let Err(UError::Common(ref error)) = self { + if let Some((code, message)) = mapper(error) { + return Err(USimpleError { code, message }.into()); + } + } + self + } +} + +/// The error type of [`UResult`]. +/// +/// `UError::Common` errors are defined in [`uucore`](crate) while `UError::Custom` errors are +/// defined by the utils. +/// ``` +/// use uucore::error::USimpleError; +/// let err = USimpleError::new(1, "Error!!".into()); +/// assert_eq!(1, err.code()); +/// assert_eq!(String::from("Error!!"), format!("{}", err)); +/// ``` +pub enum UError { + Common(UCommonError), + Custom(Box), +} + +impl UError { + pub fn code(&self) -> i32 { + match self { + UError::Common(e) => e.code(), + UError::Custom(e) => e.code(), + } + } +} + +impl From for UError { + fn from(v: UCommonError) -> Self { + UError::Common(v) + } +} + +impl From for UError { + fn from(v: i32) -> Self { + UError::Custom(Box::new(ExitCode(v))) + } +} + +impl From for UError { + fn from(v: E) -> Self { + UError::Custom(Box::new(v) as Box) + } +} + +impl Display for UError { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + UError::Common(e) => e.fmt(f), + UError::Custom(e) => e.fmt(f), + } + } +} + +/// Custom errors defined by the utils. +/// +/// All errors should implement [`std::error::Error`], [`std::fmt::Display`] and +/// [`std::fmt::Debug`] and have an additional `code` method that specifies the exit code of the +/// program if the error is returned from `uumain`. +/// +/// An example of a custom error from `ls`: +/// ``` +/// use uucore::error::{UCustomError}; +/// use std::{ +/// error::Error, +/// fmt::{Display, Debug}, +/// path::PathBuf +/// }; +/// +/// #[derive(Debug)] +/// enum LsError { +/// InvalidLineWidth(String), +/// NoMetadata(PathBuf), +/// } +/// +/// impl UCustomError for LsError { +/// fn code(&self) -> i32 { +/// match self { +/// LsError::InvalidLineWidth(_) => 2, +/// LsError::NoMetadata(_) => 1, +/// } +/// } +/// } +/// +/// impl Error for LsError {} +/// +/// impl Display for LsError { +/// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +/// match self { +/// LsError::InvalidLineWidth(s) => write!(f, "invalid line width: '{}'", s), +/// LsError::NoMetadata(p) => write!(f, "could not open file: '{}'", p.display()), +/// } +/// } +/// } +/// ``` +/// A crate like [`quick_error`](https://crates.io/crates/quick-error) might also be used, but will +/// still require an `impl` for the `code` method. +pub trait UCustomError: Error { + fn code(&self) -> i32 { + 1 + } +} + +impl From> for i32 { + fn from(e: Box) -> i32 { + e.code() + } +} + +/// A [`UCommonError`] with an overridden exit code. +/// +/// This exit code is returned instead of the default exit code for the [`UCommonError`]. This is +/// typically created with the either the `UResult::map_err_code` or `UCommonError::with_code` +/// method. +#[derive(Debug)] +pub struct UCommonErrorWithCode { + code: i32, + error: UCommonError, +} + +impl Error for UCommonErrorWithCode {} + +impl Display for UCommonErrorWithCode { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { + self.error.fmt(f) + } +} + +impl UCustomError for UCommonErrorWithCode { + fn code(&self) -> i32 { + self.code + } +} + +/// A simple error type with an exit code and a message that implements [`UCustomError`]. +/// +/// It is typically created with the `UResult::map_err_code_and_message` method. Alternatively, it +/// can be constructed by manually: +/// ``` +/// use uucore::error::{UResult, USimpleError}; +/// let err = USimpleError { code: 1, message: "error!".into()}; +/// let res: UResult<()> = Err(err.into()); +/// // or using the `new` method: +/// let res: UResult<()> = Err(USimpleError::new(1, "error!".into())); +/// ``` +#[derive(Debug)] +pub struct USimpleError { + pub code: i32, + pub message: String, +} + +impl USimpleError { + #[allow(clippy::new_ret_no_self)] + pub fn new(code: i32, message: String) -> UError { + UError::Custom(Box::new(Self { code, message })) + } +} + +impl Error for USimpleError {} + +impl Display for USimpleError { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { + self.message.fmt(f) + } +} + +impl UCustomError for USimpleError { + fn code(&self) -> i32 { + self.code + } +} + +/// Wrapper type around [`std::io::Error`]. +/// +/// The messages displayed by [`UIoError`] should match the error messages displayed by GNU +/// coreutils. +/// +/// There are two ways to construct this type: with [`UIoError::new`] or by calling the +/// [`FromIo::map_err_context`] method on a [`std::io::Result`] or [`std::io::Error`]. +/// ``` +/// use uucore::error::{FromIo, UResult, UIoError, UCommonError}; +/// use std::fs::File; +/// use std::path::Path; +/// let path = Path::new("test.txt"); +/// +/// // Manual construction +/// let e: UIoError = UIoError::new( +/// std::io::ErrorKind::NotFound, +/// format!("cannot access '{}'", path.display()) +/// ); +/// let res: UResult<()> = Err(e.into()); +/// +/// // Converting from an `std::io::Error`. +/// let res: UResult = File::open(path).map_err_context(|| format!("cannot access '{}'", path.display())); +/// ``` +#[derive(Debug)] +pub struct UIoError { + context: String, + inner: std::io::Error, +} + +impl UIoError { + pub fn new(kind: std::io::ErrorKind, context: String) -> Self { + Self { + context, + inner: std::io::Error::new(kind, ""), + } + } + + pub fn code(&self) -> i32 { + 1 + } +} + +impl Error for UIoError {} + +impl Display for UIoError { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { + use std::io::ErrorKind::*; + write!( + f, + "{}: {}", + self.context, + match self.inner.kind() { + NotFound => "No such file or directory", + PermissionDenied => "Permission denied", + ConnectionRefused => "Connection refused", + ConnectionReset => "Connection reset", + ConnectionAborted => "Connection aborted", + NotConnected => "Not connected", + AddrInUse => "Address in use", + AddrNotAvailable => "Address not available", + BrokenPipe => "Broken pipe", + AlreadyExists => "Already exists", + WouldBlock => "Would block", + InvalidInput => "Invalid input", + InvalidData => "Invalid data", + TimedOut => "Timed out", + WriteZero => "Write zero", + Interrupted => "Interrupted", + Other => "Other", + UnexpectedEof => "Unexpected end of file", + _ => panic!("Unexpected io error: {}", self.inner), + }, + ) + } +} + +/// Enables the conversion from `std::io::Error` to `UError` and from `std::io::Result` to +/// `UResult`. +pub trait FromIo { + fn map_err_context(self, context: impl FnOnce() -> String) -> T; +} + +impl FromIo for std::io::Error { + fn map_err_context(self, context: impl FnOnce() -> String) -> UIoError { + UIoError { + context: (context)(), + inner: self, + } + } +} + +impl FromIo> for std::io::Result { + fn map_err_context(self, context: impl FnOnce() -> String) -> UResult { + self.map_err(|e| UError::Common(UCommonError::Io(e.map_err_context(context)))) + } +} + +impl FromIo for std::io::ErrorKind { + fn map_err_context(self, context: impl FnOnce() -> String) -> UIoError { + UIoError { + context: (context)(), + inner: std::io::Error::new(self, ""), + } + } +} + +impl From for UCommonError { + fn from(e: UIoError) -> UCommonError { + UCommonError::Io(e) + } +} + +impl From for UError { + fn from(e: UIoError) -> UError { + let common: UCommonError = e.into(); + common.into() + } +} + +/// Common errors for utilities. +/// +/// If identical errors appear across multiple utilities, they should be added here. +#[derive(Debug)] +pub enum UCommonError { + Io(UIoError), + // Clap(UClapError), +} + +impl UCommonError { + pub fn with_code(self, code: i32) -> UCommonErrorWithCode { + UCommonErrorWithCode { code, error: self } + } + + pub fn code(&self) -> i32 { + 1 + } +} + +impl From for i32 { + fn from(common: UCommonError) -> i32 { + match common { + UCommonError::Io(e) => e.code(), + } + } +} + +impl Error for UCommonError {} + +impl Display for UCommonError { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { + match self { + UCommonError::Io(e) => e.fmt(f), + } + } +} + +/// A special error type that does not print any message when returned from +/// `uumain`. Especially useful for porting utilities to using [`UResult`]. +/// +/// There are two ways to construct an [`ExitCode`]: +/// ``` +/// use uucore::error::{ExitCode, UResult}; +/// // Explicit +/// let res: UResult<()> = Err(ExitCode(1).into()); +/// +/// // Using into on `i32`: +/// let res: UResult<()> = Err(1.into()); +/// ``` +/// This type is especially useful for a trivial conversion from utils returning [`i32`] to +/// returning [`UResult`]. +#[derive(Debug)] +pub struct ExitCode(pub i32); + +impl Error for ExitCode {} + +impl Display for ExitCode { + fn fmt(&self, _: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { + Ok(()) + } +} + +impl UCustomError for ExitCode { + fn code(&self) -> i32 { + self.0 + } +} From 43bfec7170d8df099f2ef8f300d77e0883319dd8 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 28 Jun 2021 13:39:34 +0200 Subject: [PATCH 1128/1135] uucore/error: add macros for standardized error handling --- src/uucore/src/lib/macros.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/uucore/src/lib/macros.rs b/src/uucore/src/lib/macros.rs index 07d47eed8..e4d83e746 100644 --- a/src/uucore/src/lib/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -21,6 +21,24 @@ macro_rules! executable( }) ); +#[macro_export] +macro_rules! show( + ($err:expr) => ({ + let e = $err; + uucore::error::set_exit_code(e.code()); + eprintln!("{}: {}", executable!(), e); + }) +); + +#[macro_export] +macro_rules! show_if_err( + ($res:expr) => ({ + if let Err(e) = $res { + show!(e); + } + }) +); + /// Show an error to stderr in a similar style to GNU coreutils. #[macro_export] macro_rules! show_error( From 60e4621c3be69d4f07bdeec466f1aaf6ec08d779 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 28 Jun 2021 13:44:21 +0200 Subject: [PATCH 1129/1135] uucore_procs: add temporary proc macro gen_uumain for standardized error handling --- src/uucore_procs/src/lib.rs | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/uucore_procs/src/lib.rs b/src/uucore_procs/src/lib.rs index e0d247c3f..93567a12d 100644 --- a/src/uucore_procs/src/lib.rs +++ b/src/uucore_procs/src/lib.rs @@ -1,6 +1,10 @@ // Copyright (C) ~ Roy Ivy III ; MIT license extern crate proc_macro; +use proc_macro::TokenStream; +use proc_macro2::{Ident, Span}; +use quote::quote; +use syn::{self, parse_macro_input, ItemFn}; //## rust proc-macro background info //* ref: @@ @@ -41,7 +45,7 @@ impl syn::parse::Parse for Tokens { } #[proc_macro] -pub fn main(stream: proc_macro::TokenStream) -> proc_macro::TokenStream { +pub fn main(stream: TokenStream) -> TokenStream { let Tokens { expr } = syn::parse_macro_input!(stream as Tokens); proc_dbg!(&expr); @@ -78,5 +82,32 @@ pub fn main(stream: proc_macro::TokenStream) -> proc_macro::TokenStream { std::process::exit(code); } }; - proc_macro::TokenStream::from(result) + TokenStream::from(result) +} + +#[proc_macro_attribute] +pub fn gen_uumain(_args: TokenStream, stream: TokenStream) -> TokenStream { + let mut ast = parse_macro_input!(stream as ItemFn); + + // Change the name of the function to "uumain_result" to prevent name-conflicts + ast.sig.ident = Ident::new("uumain_result", Span::call_site()); + + let new = quote!( + pub fn uumain(args: impl uucore::Args) -> i32 { + #ast + let result = uumain_result(args); + match result { + Ok(()) => uucore::error::get_exit_code(), + Err(e) => { + let s = format!("{}", e); + if s != "" { + show_error!("{}", s); + } + e.code() + } + } + } + ); + + TokenStream::from(new) } From e4eac825fb4aed0b75903babf544438aed978cee Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 28 Jun 2021 13:44:39 +0200 Subject: [PATCH 1130/1135] ls: adapt to standardized error handling --- src/uu/ls/src/ls.rs | 81 ++++++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 31 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 6ca3f4bbe..059981e28 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -26,10 +26,11 @@ use quoting_style::{escape_name, QuotingStyle}; use std::os::windows::fs::MetadataExt; use std::{ cmp::Reverse, + error::Error, + fmt::Display, fs::{self, DirEntry, FileType, Metadata}, io::{stdout, BufWriter, Stdout, Write}, path::{Path, PathBuf}, - process::exit, time::{SystemTime, UNIX_EPOCH}, }; #[cfg(unix)] @@ -38,8 +39,8 @@ use std::{ os::unix::fs::{FileTypeExt, MetadataExt}, time::Duration, }; - use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; +use uucore::error::{set_exit_code, FromIo, UCustomError, UResult}; use unicode_width::UnicodeWidthStr; #[cfg(unix)] @@ -125,6 +126,32 @@ pub mod options { pub static IGNORE: &str = "ignore"; } +#[derive(Debug)] +enum LsError { + InvalidLineWidth(String), + NoMetadata(PathBuf), +} + +impl UCustomError for LsError { + fn code(&self) -> i32 { + match self { + LsError::InvalidLineWidth(_) => 2, + LsError::NoMetadata(_) => 1, + } + } +} + +impl Error for LsError {} + +impl Display for LsError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + LsError::InvalidLineWidth(s) => write!(f, "invalid line width: '{}'", s), + LsError::NoMetadata(p) => write!(f, "could not open file: '{}'", p.display()), + } + } +} + #[derive(PartialEq, Eq)] enum Format { Columns, @@ -218,7 +245,7 @@ struct LongFormat { impl Config { #[allow(clippy::cognitive_complexity)] - fn from(options: clap::ArgMatches) -> Config { + fn from(options: clap::ArgMatches) -> UResult { let (mut format, opt) = if let Some(format_) = options.value_of(options::FORMAT) { ( match format_ { @@ -369,15 +396,13 @@ impl Config { } }; - let width = options - .value_of(options::WIDTH) - .map(|x| { - x.parse::().unwrap_or_else(|_e| { - show_error!("invalid line width: '{}'", x); - exit(2); - }) - }) - .or_else(|| termsize::get().map(|s| s.cols)); + let width = match options.value_of(options::WIDTH) { + Some(x) => match x.parse::() { + Ok(u) => Some(u), + Err(_) => return Err(LsError::InvalidLineWidth(x.into()).into()), + }, + None => termsize::get().map(|s| s.cols), + }; #[allow(clippy::needless_bool)] let show_control = if options.is_present(options::HIDE_CONTROL_CHARS) { @@ -528,7 +553,7 @@ impl Config { Dereference::DirArgs }; - Config { + Ok(Config { format, files, sort, @@ -547,11 +572,12 @@ impl Config { quoting_style, indicator_style, time_style, - } + }) } } -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::Ignore) .accept_any(); @@ -567,7 +593,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_else(|| vec![String::from(".")]); - list(locs, Config::from(matches)) + list(locs, Config::from(matches)?) } pub fn uu_app() -> App<'static, 'static> { @@ -1190,10 +1216,9 @@ impl PathData { } } -fn list(locs: Vec, config: Config) -> i32 { +fn list(locs: Vec, config: Config) -> UResult<()> { let mut files = Vec::::new(); let mut dirs = Vec::::new(); - let mut has_failed = false; let mut out = BufWriter::new(stdout()); @@ -1202,19 +1227,16 @@ fn list(locs: Vec, config: Config) -> i32 { let path_data = PathData::new(p, None, None, &config, true); if path_data.md().is_none() { - show_error!("'{}': {}", &loc, "No such file or directory"); - /* - We found an error, the return code of ls should not be 0 - And no need to continue the execution - */ - has_failed = true; + show!(std::io::ErrorKind::NotFound + .map_err_context(|| format!("cannot access '{}'", path_data.p_buf.display()))); + // We found an error, no need to continue the execution continue; } let show_dir_contents = match path_data.file_type() { Some(ft) => !config.directory && ft.is_dir(), None => { - has_failed = true; + set_exit_code(1); false } }; @@ -1235,11 +1257,8 @@ fn list(locs: Vec, config: Config) -> i32 { } enter_directory(&dir, &config, &mut out); } - if has_failed { - 1 - } else { - 0 - } + + Ok(()) } fn sort_entries(entries: &mut Vec, config: &Config) { @@ -1478,7 +1497,7 @@ fn display_item_long( ) { let md = match item.md() { None => { - show_error!("could not show file: {}", &item.p_buf.display()); + show!(LsError::NoMetadata(item.p_buf.clone())); return; } Some(md) => md, From 8c5052fcb79c1fc7ff9bacaafc9266df6ea58233 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 28 Jun 2021 13:45:04 +0200 Subject: [PATCH 1131/1135] mkdir: adapt to standardized error handling --- src/uu/mkdir/src/mkdir.rs | 126 +++++++++++++++----------------------- 1 file changed, 48 insertions(+), 78 deletions(-) diff --git a/src/uu/mkdir/src/mkdir.rs b/src/uu/mkdir/src/mkdir.rs index 82d561213..a99867570 100644 --- a/src/uu/mkdir/src/mkdir.rs +++ b/src/uu/mkdir/src/mkdir.rs @@ -8,25 +8,26 @@ #[macro_use] extern crate uucore; +use clap::OsValues; use clap::{crate_version, App, Arg}; use std::fs; use std::path::Path; +use uucore::error::{FromIo, UResult, USimpleError}; static ABOUT: &str = "Create the given DIRECTORY(ies) if they do not exist"; -static OPT_MODE: &str = "mode"; -static OPT_PARENTS: &str = "parents"; -static OPT_VERBOSE: &str = "verbose"; - -static ARG_DIRS: &str = "dirs"; +mod options { + pub const MODE: &str = "mode"; + pub const PARENTS: &str = "parents"; + pub const VERBOSE: &str = "verbose"; + pub const DIRS: &str = "dirs"; +} fn get_usage() -> String { format!("{0} [OPTION]... [USER]", executable!()) } -/** - * Handles option parsing - */ -pub fn uumain(args: impl uucore::Args) -> i32 { +#[uucore_procs::gen_uumain] +pub fn uumain(args: impl uucore::Args) -> UResult<()> { let usage = get_usage(); // Linux-specific options, not implemented @@ -34,26 +35,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // " of each created directory to CTX"), let matches = uu_app().usage(&usage[..]).get_matches_from(args); - let dirs: Vec = matches - .values_of(ARG_DIRS) - .map(|v| v.map(ToString::to_string).collect()) - .unwrap_or_default(); - - let verbose = matches.is_present(OPT_VERBOSE); - let recursive = matches.is_present(OPT_PARENTS); + let dirs = matches.values_of_os(options::DIRS).unwrap_or_default(); + let verbose = matches.is_present(options::VERBOSE); + let recursive = matches.is_present(options::PARENTS); // Translate a ~str in octal form to u16, default to 755 // Not tested on Windows - let mode_match = matches.value_of(OPT_MODE); - let mode: u16 = match mode_match { - Some(m) => { - let res: Option = u16::from_str_radix(m, 8).ok(); - match res { - Some(r) => r, - _ => crash!(1, "no mode given"), - } - } - _ => 0o755_u16, + let mode: u16 = match matches.value_of(options::MODE) { + Some(m) => u16::from_str_radix(m, 8) + .map_err(|_| USimpleError::new(1, format!("invalid mode '{}'", m)))?, + None => 0o755_u16, }; exec(dirs, recursive, mode, verbose) @@ -64,27 +55,27 @@ pub fn uu_app() -> App<'static, 'static> { .version(crate_version!()) .about(ABOUT) .arg( - Arg::with_name(OPT_MODE) + Arg::with_name(options::MODE) .short("m") - .long(OPT_MODE) + .long(options::MODE) .help("set file mode (not implemented on windows)") .default_value("755"), ) .arg( - Arg::with_name(OPT_PARENTS) + Arg::with_name(options::PARENTS) .short("p") - .long(OPT_PARENTS) + .long(options::PARENTS) .alias("parent") .help("make parent directories as needed"), ) .arg( - Arg::with_name(OPT_VERBOSE) + Arg::with_name(options::VERBOSE) .short("v") - .long(OPT_VERBOSE) + .long(options::VERBOSE) .help("print a message for each printed directory"), ) .arg( - Arg::with_name(ARG_DIRS) + Arg::with_name(options::DIRS) .multiple(true) .takes_value(true) .min_values(1), @@ -94,64 +85,43 @@ pub fn uu_app() -> App<'static, 'static> { /** * Create the list of new directories */ -fn exec(dirs: Vec, recursive: bool, mode: u16, verbose: bool) -> i32 { - let mut status = 0; - let empty = Path::new(""); - for dir in &dirs { +fn exec(dirs: OsValues, recursive: bool, mode: u16, verbose: bool) -> UResult<()> { + for dir in dirs { let path = Path::new(dir); - if !recursive { - if let Some(parent) = path.parent() { - if parent != empty && !parent.exists() { - show_error!( - "cannot create directory '{}': No such file or directory", - path.display() - ); - status = 1; - continue; - } - } - } - status |= mkdir(path, recursive, mode, verbose); + show_if_err!(mkdir(path, recursive, mode, verbose)); } - status + Ok(()) } -/** - * Wrapper to catch errors, return 1 if failed - */ -fn mkdir(path: &Path, recursive: bool, mode: u16, verbose: bool) -> i32 { +fn mkdir(path: &Path, recursive: bool, mode: u16, verbose: bool) -> UResult<()> { let create_dir = if recursive { fs::create_dir_all } else { fs::create_dir }; - if let Err(e) = create_dir(path) { - show_error!("{}: {}", path.display(), e.to_string()); - return 1; - } + + create_dir(path).map_err_context(|| format!("cannot create directory '{}'", path.display()))?; if verbose { println!("{}: created directory '{}'", executable!(), path.display()); } - #[cfg(any(unix, target_os = "redox"))] - fn chmod(path: &Path, mode: u16) -> i32 { - use std::fs::{set_permissions, Permissions}; - use std::os::unix::fs::PermissionsExt; - - let mode = Permissions::from_mode(u32::from(mode)); - - if let Err(err) = set_permissions(path, mode) { - show_error!("{}: {}", path.display(), err); - return 1; - } - 0 - } - #[cfg(windows)] - #[allow(unused_variables)] - fn chmod(path: &Path, mode: u16) -> i32 { - // chmod on Windows only sets the readonly flag, which isn't even honored on directories - 0 - } chmod(path, mode) } + +#[cfg(any(unix, target_os = "redox"))] +fn chmod(path: &Path, mode: u16) -> UResult<()> { + use std::fs::{set_permissions, Permissions}; + use std::os::unix::fs::PermissionsExt; + + let mode = Permissions::from_mode(u32::from(mode)); + + set_permissions(path, mode) + .map_err_context(|| format!("cannot set permissions '{}'", path.display())) +} + +#[cfg(windows)] +fn chmod(_path: &Path, _mode: u16) -> UResult<()> { + // chmod on Windows only sets the readonly flag, which isn't even honored on directories + Ok(()) +} From 73a7ead8570bb43a9ba34be2bb70c2868fc5c993 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 28 Jun 2021 13:45:15 +0200 Subject: [PATCH 1132/1135] mktemp: adapt to standardized error handling --- src/uu/mktemp/src/mktemp.rs | 185 +++++++++++++++++++---------------- tests/by-util/test_mktemp.rs | 3 +- 2 files changed, 105 insertions(+), 83 deletions(-) diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index bbccf6628..8a4b472aa 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -12,8 +12,11 @@ extern crate uucore; use clap::{crate_version, App, Arg}; +use uucore::error::{FromIo, UCustomError, UResult}; use std::env; +use std::error::Error; +use std::fmt::Display; use std::iter; use std::path::{is_separator, PathBuf}; @@ -37,7 +40,40 @@ fn get_usage() -> String { format!("{0} [OPTION]... [TEMPLATE]", executable!()) } -pub fn uumain(args: impl uucore::Args) -> i32 { +#[derive(Debug)] +enum MkTempError { + PersistError(PathBuf), + MustEndInX(String), + TooFewXs(String), + ContainsDirSeparator(String), + InvalidTemplate(String), +} + +impl UCustomError for MkTempError {} + +impl Error for MkTempError {} + +impl Display for MkTempError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + use MkTempError::*; + match self { + PersistError(p) => write!(f, "could not persist file '{}'", p.display()), + MustEndInX(s) => write!(f, "with --suffix, template '{}' must end in X", s), + TooFewXs(s) => write!(f, "too few X's in template '{}'", s), + ContainsDirSeparator(s) => { + write!(f, "invalid suffix '{}', contains directory separator", s) + } + InvalidTemplate(s) => write!( + f, + "invalid template, '{}'; with --tmpdir, it may not be absolute", + s + ), + } + } +} + +#[uucore_procs::gen_uumain] +pub fn uumain(args: impl uucore::Args) -> UResult<()> { let usage = get_usage(); let matches = uu_app().usage(&usage[..]).get_matches_from(args); @@ -73,47 +109,27 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let dry_run = matches.is_present(OPT_DRY_RUN); let suppress_file_err = matches.is_present(OPT_QUIET); - let (prefix, rand, suffix) = match parse_template(template) { - Some((p, r, s)) => match matches.value_of(OPT_SUFFIX) { - Some(suf) => { - if s.is_empty() { - (p, r, suf) - } else { - crash!( - 1, - "Template should end with 'X' when you specify suffix option." - ) - } - } - None => (p, r, s), - }, - None => ("", 0, ""), - }; - - if rand < 3 { - crash!(1, "Too few 'X's in template") - } - - if suffix.chars().any(is_separator) { - crash!(1, "suffix cannot contain any path separators"); - } + let (prefix, rand, suffix) = parse_template(template, matches.value_of(OPT_SUFFIX))?; if matches.is_present(OPT_TMPDIR) && PathBuf::from(prefix).is_absolute() { - show_error!( - "invalid template, '{}'; with --tmpdir, it may not be absolute", - template - ); - return 1; - }; + return Err(MkTempError::InvalidTemplate(template.into()).into()); + } if matches.is_present(OPT_T) { tmpdir = env::temp_dir() - }; + } - if dry_run { + let res = if dry_run { dry_exec(tmpdir, prefix, rand, suffix) } else { - exec(tmpdir, prefix, rand, suffix, make_dir, suppress_file_err) + exec(tmpdir, prefix, rand, suffix, make_dir) + }; + + if suppress_file_err { + // Mapping all UErrors to ExitCodes prevents the errors from being printed + res.map_err(|e| e.code().into()) + } else { + res } } @@ -173,19 +189,40 @@ pub fn uu_app() -> App<'static, 'static> { ) } -fn parse_template(temp: &str) -> Option<(&str, usize, &str)> { +fn parse_template<'a>( + temp: &'a str, + suffix: Option<&'a str>, +) -> UResult<(&'a str, usize, &'a str)> { let right = match temp.rfind('X') { Some(r) => r + 1, - None => return None, + None => return Err(MkTempError::TooFewXs(temp.into()).into()), }; let left = temp[..right].rfind(|c| c != 'X').map_or(0, |i| i + 1); let prefix = &temp[..left]; let rand = right - left; - let suffix = &temp[right..]; - Some((prefix, rand, suffix)) + + if rand < 3 { + return Err(MkTempError::TooFewXs(temp.into()).into()); + } + + let mut suf = &temp[right..]; + + if let Some(s) = suffix { + if suf.is_empty() { + suf = s; + } else { + return Err(MkTempError::MustEndInX(temp.into()).into()); + } + }; + + if suf.chars().any(is_separator) { + return Err(MkTempError::ContainsDirSeparator(suf.into()).into()); + } + + Ok((prefix, rand, suf)) } -pub fn dry_exec(mut tmpdir: PathBuf, prefix: &str, rand: usize, suffix: &str) -> i32 { +pub fn dry_exec(mut tmpdir: PathBuf, prefix: &str, rand: usize, suffix: &str) -> UResult<()> { let len = prefix.len() + suffix.len() + rand; let mut buf = String::with_capacity(len); buf.push_str(prefix); @@ -208,51 +245,35 @@ pub fn dry_exec(mut tmpdir: PathBuf, prefix: &str, rand: usize, suffix: &str) -> } tmpdir.push(buf); println!("{}", tmpdir.display()); - 0 + Ok(()) } -fn exec(dir: PathBuf, prefix: &str, rand: usize, suffix: &str, make_dir: bool, quiet: bool) -> i32 { - let res = if make_dir { - let tmpdir = Builder::new() - .prefix(prefix) - .rand_bytes(rand) - .suffix(suffix) - .tempdir_in(&dir); - - // `into_path` consumes the TempDir without removing it - tmpdir.map(|d| d.into_path().to_string_lossy().to_string()) - } else { - let tmpfile = Builder::new() - .prefix(prefix) - .rand_bytes(rand) - .suffix(suffix) - .tempfile_in(&dir); - - match tmpfile { - Ok(f) => { - // `keep` ensures that the file is not deleted - match f.keep() { - Ok((_, p)) => Ok(p.to_string_lossy().to_string()), - Err(e) => { - show_error!("'{}': {}", dir.display(), e); - return 1; - } - } - } - Err(x) => Err(x), - } +fn exec(dir: PathBuf, prefix: &str, rand: usize, suffix: &str, make_dir: bool) -> UResult<()> { + let context = || { + format!( + "failed to create file via template '{}{}{}'", + prefix, + "X".repeat(rand), + suffix + ) }; - match res { - Ok(ref f) => { - println!("{}", f); - 0 - } - Err(e) => { - if !quiet { - show_error!("{}: {}", e, dir.display()); - } - 1 - } - } + let mut builder = Builder::new(); + builder.prefix(prefix).rand_bytes(rand).suffix(suffix); + + let path = if make_dir { + builder + .tempdir_in(&dir) + .map_err_context(context)? + .into_path() // `into_path` consumes the TempDir without removing it + } else { + builder + .tempfile_in(&dir) + .map_err_context(context)? + .keep() // `keep` ensures that the file is not deleted + .map_err(|e| MkTempError::PersistError(e.file.path().to_path_buf()))? + .1 + }; + println!("{}", path.display()); + Ok(()) } diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index bcf75ee20..e824df061 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -125,7 +125,8 @@ fn test_mktemp_mktemp_t() { .arg(TEST_TEMPLATE8) .fails() .no_stdout() - .stderr_contains("suffix cannot contain any path separators"); + .stderr_contains("invalid suffix") + .stderr_contains("contains directory separator"); } #[test] From 0cfaaeceda67947f98c938b69c6c7d2f2064cc83 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 28 Jun 2021 13:45:50 +0200 Subject: [PATCH 1133/1135] touch: adapt to standardized error handling --- src/uu/touch/src/touch.rs | 165 ++++++++++++++------------------------ 1 file changed, 62 insertions(+), 103 deletions(-) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 3e9ff5624..dd2b05d0e 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -16,9 +16,8 @@ extern crate uucore; use clap::{crate_version, App, Arg, ArgGroup}; use filetime::*; use std::fs::{self, File}; -use std::io::Error; use std::path::Path; -use std::process; +use uucore::error::{FromIo, UResult, USimpleError}; static ABOUT: &str = "Update the access and modification times of each FILE to the current time."; pub mod options { @@ -52,57 +51,38 @@ fn get_usage() -> String { format!("{0} [OPTION]... [USER]", executable!()) } -pub fn uumain(args: impl uucore::Args) -> i32 { +#[uucore_procs::gen_uumain] +pub fn uumain(args: impl uucore::Args) -> UResult<()> { let usage = get_usage(); let matches = uu_app().usage(&usage[..]).get_matches_from(args); - let files: Vec = matches - .values_of(ARG_FILES) - .map(|v| v.map(ToString::to_string).collect()) - .unwrap_or_default(); + let files = matches.values_of_os(ARG_FILES).unwrap(); - let (mut atime, mut mtime) = if matches.is_present(options::sources::REFERENCE) { - stat( - matches.value_of(options::sources::REFERENCE).unwrap(), - !matches.is_present(options::NO_DEREF), - ) - } else if matches.is_present(options::sources::DATE) - || matches.is_present(options::sources::CURRENT) - { - let timestamp = if matches.is_present(options::sources::DATE) { - parse_date(matches.value_of(options::sources::DATE).unwrap()) + let (mut atime, mut mtime) = + if let Some(reference) = matches.value_of_os(options::sources::REFERENCE) { + stat(Path::new(reference), !matches.is_present(options::NO_DEREF))? } else { - parse_timestamp(matches.value_of(options::sources::CURRENT).unwrap()) + let timestamp = if let Some(date) = matches.value_of(options::sources::DATE) { + parse_date(date)? + } else if let Some(current) = matches.value_of(options::sources::CURRENT) { + parse_timestamp(current)? + } else { + local_tm_to_filetime(time::now()) + }; + (timestamp, timestamp) }; - (timestamp, timestamp) - } else { - let now = local_tm_to_filetime(time::now()); - (now, now) - }; - let mut error_code = 0; - - for filename in &files { - let path = &filename[..]; - - if !Path::new(path).exists() { + for filename in files { + let path = Path::new(filename); + if !path.exists() { // no-dereference included here for compatibility if matches.is_present(options::NO_CREATE) || matches.is_present(options::NO_DEREF) { continue; } if let Err(e) = File::create(path) { - match e.kind() { - std::io::ErrorKind::NotFound => { - show_error!("cannot touch '{}': {}", path, "No such file or directory") - } - std::io::ErrorKind::PermissionDenied => { - show_error!("cannot touch '{}': {}", path, "Permission denied") - } - _ => show_error!("cannot touch '{}': {}", path, e), - } - error_code = 1; + show!(e.map_err_context(|| format!("cannot touch '{}'", path.display()))); continue; }; @@ -118,7 +98,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { || matches.is_present(options::MODIFICATION) || matches.is_present(options::TIME) { - let st = stat(path, !matches.is_present(options::NO_DEREF)); + let st = stat(path, !matches.is_present(options::NO_DEREF))?; let time = matches.value_of(options::TIME).unwrap_or(""); if !(matches.is_present(options::ACCESS) @@ -138,29 +118,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } if matches.is_present(options::NO_DEREF) { - if let Err(e) = set_symlink_file_times(path, atime, mtime) { - // we found an error, it should fail in any case - error_code = 1; - if e.kind() == std::io::ErrorKind::PermissionDenied { - // GNU compatibility (not-owner.sh) - show_error!("setting times of '{}': {}", path, "Permission denied"); - } else { - show_error!("setting times of '{}': {}", path, e); - } - } - } else if let Err(e) = filetime::set_file_times(path, atime, mtime) { - // we found an error, it should fail in any case - error_code = 1; - - if e.kind() == std::io::ErrorKind::PermissionDenied { - // GNU compatibility (not-owner.sh) - show_error!("setting times of '{}': {}", path, "Permission denied"); - } else { - show_error!("setting times of '{}': {}", path, e); - } + set_symlink_file_times(path, atime, mtime) + } else { + filetime::set_file_times(path, atime, mtime) } + .map_err_context(|| format!("setting times of '{}'", path.display()))?; } - error_code + + Ok(()) } pub fn uu_app() -> App<'static, 'static> { @@ -238,28 +203,21 @@ pub fn uu_app() -> App<'static, 'static> { ])) } -fn stat(path: &str, follow: bool) -> (FileTime, FileTime) { +fn stat(path: &Path, follow: bool) -> UResult<(FileTime, FileTime)> { let metadata = if follow { fs::symlink_metadata(path) } else { fs::metadata(path) - }; - - match metadata { - Ok(m) => ( - FileTime::from_last_access_time(&m), - FileTime::from_last_modification_time(&m), - ), - Err(_) => crash!( - 1, - "failed to get attributes of '{}': {}", - path, - Error::last_os_error() - ), } + .map_err_context(|| format!("failed to get attributes of '{}'", path.display()))?; + + Ok(( + FileTime::from_last_access_time(&metadata), + FileTime::from_last_modification_time(&metadata), + )) } -fn parse_date(str: &str) -> FileTime { +fn parse_date(str: &str) -> UResult { // This isn't actually compatible with GNU touch, but there doesn't seem to // be any simple specification for what format this parameter allows and I'm // not about to implement GNU parse_datetime. @@ -267,18 +225,22 @@ fn parse_date(str: &str) -> FileTime { let formats = vec!["%c", "%F"]; for f in formats { if let Ok(tm) = time::strptime(str, f) { - return local_tm_to_filetime(to_local(tm)); + return Ok(local_tm_to_filetime(to_local(tm))); } } + if let Ok(tm) = time::strptime(str, "@%s") { // Don't convert to local time in this case - seconds since epoch are not time-zone dependent - return local_tm_to_filetime(tm); + return Ok(local_tm_to_filetime(tm)); } - show_error!("Unable to parse date: {}\n", str); - process::exit(1); + + Err(USimpleError::new( + 1, + format!("Unable to parse date: {}", str), + )) } -fn parse_timestamp(s: &str) -> FileTime { +fn parse_timestamp(s: &str) -> UResult { let now = time::now(); let (format, ts) = match s.chars().count() { 15 => ("%Y%m%d%H%M.%S", s.to_owned()), @@ -287,31 +249,28 @@ fn parse_timestamp(s: &str) -> FileTime { 10 => ("%y%m%d%H%M", s.to_owned()), 11 => ("%Y%m%d%H%M.%S", format!("{}{}", now.tm_year + 1900, s)), 8 => ("%Y%m%d%H%M", format!("{}{}", now.tm_year + 1900, s)), - _ => panic!("Unknown timestamp format"), + _ => return Err(USimpleError::new(1, format!("invalid date format '{}'", s))), }; - match time::strptime(&ts, format) { - Ok(tm) => { - let mut local = to_local(tm); - local.tm_isdst = -1; - let ft = local_tm_to_filetime(local); + let tm = time::strptime(&ts, format) + .map_err(|_| USimpleError::new(1, format!("invalid date format '{}'", s)))?; - // We have to check that ft is valid time. Due to daylight saving - // time switch, local time can jump from 1:59 AM to 3:00 AM, - // in which case any time between 2:00 AM and 2:59 AM is not valid. - // Convert back to local time and see if we got the same value back. - let ts = time::Timespec { - sec: ft.unix_seconds(), - nsec: 0, - }; - let tm2 = time::at(ts); - if tm.tm_hour != tm2.tm_hour { - show_error!("invalid date format {}", s); - process::exit(1); - } + let mut local = to_local(tm); + local.tm_isdst = -1; + let ft = local_tm_to_filetime(local); - ft - } - Err(e) => panic!("Unable to parse timestamp\n{}", e), + // We have to check that ft is valid time. Due to daylight saving + // time switch, local time can jump from 1:59 AM to 3:00 AM, + // in which case any time between 2:00 AM and 2:59 AM is not valid. + // Convert back to local time and see if we got the same value back. + let ts = time::Timespec { + sec: ft.unix_seconds(), + nsec: 0, + }; + let tm2 = time::at(ts); + if tm.tm_hour != tm2.tm_hour { + return Err(USimpleError::new(1, format!("invalid date format '{}'", s))); } + + Ok(ft) } From 92bfaea3faf870abc78ebbcc6d3ca980b2ed48ce Mon Sep 17 00:00:00 2001 From: Dean Li Date: Tue, 29 Jun 2021 19:48:20 +0800 Subject: [PATCH 1134/1135] arch: use UResult --- src/uu/arch/src/arch.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/uu/arch/src/arch.rs b/src/uu/arch/src/arch.rs index 955e57389..0f15654cc 100644 --- a/src/uu/arch/src/arch.rs +++ b/src/uu/arch/src/arch.rs @@ -12,16 +12,18 @@ extern crate uucore; use platform_info::*; use clap::{crate_version, App}; +use uucore::error::{FromIo, UResult}; static ABOUT: &str = "Display machine architecture"; static SUMMARY: &str = "Determine architecture name for current machine."; -pub fn uumain(args: impl uucore::Args) -> i32 { +#[uucore_procs::gen_uumain] +pub fn uumain(args: impl uucore::Args) -> UResult<()> { uu_app().get_matches_from(args); - let uts = return_if_err!(1, PlatformInfo::new()); + let uts = PlatformInfo::new().map_err_context(|| "arch: ".to_string())?; println!("{}", uts.machine().trim()); - 0 + Ok(()) } pub fn uu_app() -> App<'static, 'static> { From b21e01bcb00dad3f4dfe811950dd58214098e29e Mon Sep 17 00:00:00 2001 From: Dean Li Date: Wed, 30 Jun 2021 22:29:28 +0800 Subject: [PATCH 1135/1135] arch: match GNU error Follow up for #2466 as suggested by @miDeb --- src/uu/arch/src/arch.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/arch/src/arch.rs b/src/uu/arch/src/arch.rs index 0f15654cc..94ec97e98 100644 --- a/src/uu/arch/src/arch.rs +++ b/src/uu/arch/src/arch.rs @@ -21,7 +21,7 @@ static SUMMARY: &str = "Determine architecture name for current machine."; pub fn uumain(args: impl uucore::Args) -> UResult<()> { uu_app().get_matches_from(args); - let uts = PlatformInfo::new().map_err_context(|| "arch: ".to_string())?; + let uts = PlatformInfo::new().map_err_context(|| "cannot get system name".to_string())?; println!("{}", uts.machine().trim()); Ok(()) }